mirror of
				https://github.com/devine-dl/devine.git
				synced 2025-11-03 19:34:49 +00:00 
			
		
		
		
	Merge pull request #100 from retouching/patch-1
Check if width and height is digit if it's an str
This commit is contained in:
		
						commit
						3abb869d80
					
				@ -342,6 +342,7 @@ Please refrain from spam or asking for questions that infringe upon a Service's
 | 
				
			|||||||
<a href="https://github.com/Hollander-1908"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/93162595?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Hollander-1908"/></a>
 | 
					<a href="https://github.com/Hollander-1908"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/93162595?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Hollander-1908"/></a>
 | 
				
			||||||
<a href="https://github.com/Shivelight"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/20620780?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Shivelight"/></a>
 | 
					<a href="https://github.com/Shivelight"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/20620780?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Shivelight"/></a>
 | 
				
			||||||
<a href="https://github.com/knowhere01"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/113712042?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="knowhere01"/></a>
 | 
					<a href="https://github.com/knowhere01"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/113712042?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="knowhere01"/></a>
 | 
				
			||||||
 | 
					<a href="https://github.com/retouching"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/33735357?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="retouching"/></a>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Licensing
 | 
					## Licensing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -194,9 +194,9 @@ class Video(Track):
 | 
				
			|||||||
            raise TypeError(f"Expected range_ to be a {Video.Range}, not {range_!r}")
 | 
					            raise TypeError(f"Expected range_ to be a {Video.Range}, not {range_!r}")
 | 
				
			||||||
        if not isinstance(bitrate, (str, int, float, type(None))):
 | 
					        if not isinstance(bitrate, (str, int, float, type(None))):
 | 
				
			||||||
            raise TypeError(f"Expected bitrate to be a {str}, {int}, or {float}, not {bitrate!r}")
 | 
					            raise TypeError(f"Expected bitrate to be a {str}, {int}, or {float}, not {bitrate!r}")
 | 
				
			||||||
        if not isinstance(width, (int, type(None))):
 | 
					        if not isinstance(width, (int, str, type(None))):
 | 
				
			||||||
            raise TypeError(f"Expected width to be a {int}, not {width!r}")
 | 
					            raise TypeError(f"Expected width to be a {int}, not {width!r}")
 | 
				
			||||||
        if not isinstance(height, (int, type(None))):
 | 
					        if not isinstance(height, (int, str, type(None))):
 | 
				
			||||||
            raise TypeError(f"Expected height to be a {int}, not {height!r}")
 | 
					            raise TypeError(f"Expected height to be a {int}, not {height!r}")
 | 
				
			||||||
        if not isinstance(fps, (str, int, float, type(None))):
 | 
					        if not isinstance(fps, (str, int, float, type(None))):
 | 
				
			||||||
            raise TypeError(f"Expected fps to be a {str}, {int}, or {float}, not {fps!r}")
 | 
					            raise TypeError(f"Expected fps to be a {str}, {int}, or {float}, not {fps!r}")
 | 
				
			||||||
@ -212,12 +212,12 @@ class Video(Track):
 | 
				
			|||||||
        try:
 | 
					        try:
 | 
				
			||||||
            self.width = int(width or 0) or None
 | 
					            self.width = int(width or 0) or None
 | 
				
			||||||
        except ValueError as e:
 | 
					        except ValueError as e:
 | 
				
			||||||
            raise ValueError(f"Expected width to be a number, {e}")
 | 
					            raise ValueError(f"Expected width to be a number, not {width!r}, {e}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            self.height = int(height or 0) or None
 | 
					            self.height = int(height or 0) or None
 | 
				
			||||||
        except ValueError as e:
 | 
					        except ValueError as e:
 | 
				
			||||||
            raise ValueError(f"Expected height to be a number, {e}")
 | 
					            raise ValueError(f"Expected height to be a number, not {height!r}, {e}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            self.fps = (FPS.parse(str(fps)) or None) if fps else None
 | 
					            self.fps = (FPS.parse(str(fps)) or None) if fps else None
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user