Sid Shardanand commited on
Commit
84faec3
·
unverified ·
1 Parent(s): 3cabdbd

fixing type casting bug and reinforcing _ naming convention (#1390)

Browse files
Files changed (1) hide show
  1. pytube/streams.py +9 -9
pytube/streams.py CHANGED
@@ -65,13 +65,13 @@ class Stream:
65
  self._filesize: Optional[int] = int(stream.get('contentLength', 0))
66
 
67
  # filesize in kilobytes
68
- self._filesize_kb: Optional[float] = float(ceil(stream.get('contentLength', 0) / 1024 * 1000) / 1000)
69
 
70
  # filesize in megabytes
71
- self._filesize_mb: Optional[float] = float(ceil(stream.get('contentLength', 0) / 1024 / 1024 * 1000) / 1000)
72
 
73
  # filesize in gigabytes(fingers crossed we don't need terabytes going forward though)
74
- self._filesize_gb: Optional[float] = float(ceil(stream.get('contentLength', 0) / 1024 / 1024 / 1024 * 1000) / 1000)
75
 
76
  # Additional information about the stream format, such as resolution,
77
  # frame rate, and whether the stream is live (HLS) or 3D.
@@ -162,8 +162,8 @@ class Stream:
162
  return self._filesize
163
 
164
  @property
165
- def filesizekb(self) -> float:
166
- """File size of the media stream in bytes.
167
 
168
  :rtype: float
169
  :returns:
@@ -179,8 +179,8 @@ class Stream:
179
  return self._filesize_kb
180
 
181
  @property
182
- def filesizemb(self) -> float:
183
- """File size of the media stream in bytes.
184
 
185
  :rtype: float
186
  :returns:
@@ -196,8 +196,8 @@ class Stream:
196
  return self._filesize_mb
197
 
198
  @property
199
- def filesizegb(self) -> float:
200
- """File size of the media stream in bytes.
201
 
202
  :rtype: float
203
  :returns:
 
65
  self._filesize: Optional[int] = int(stream.get('contentLength', 0))
66
 
67
  # filesize in kilobytes
68
+ self._filesize_kb: Optional[float] = float(ceil(float(stream.get('contentLength', 0)) / 1024 * 1000) / 1000)
69
 
70
  # filesize in megabytes
71
+ self._filesize_mb: Optional[float] = float(ceil(float(stream.get('contentLength', 0)) / 1024 / 1024 * 1000) / 1000)
72
 
73
  # filesize in gigabytes(fingers crossed we don't need terabytes going forward though)
74
+ self._filesize_gb: Optional[float] = float(ceil(float(stream.get('contentLength', 0)) / 1024 / 1024 / 1024 * 1000) / 1000)
75
 
76
  # Additional information about the stream format, such as resolution,
77
  # frame rate, and whether the stream is live (HLS) or 3D.
 
162
  return self._filesize
163
 
164
  @property
165
+ def filesize_kb(self) -> float:
166
+ """File size of the media stream in kilobytes.
167
 
168
  :rtype: float
169
  :returns:
 
179
  return self._filesize_kb
180
 
181
  @property
182
+ def filesize_mb(self) -> float:
183
+ """File size of the media stream in megabytes.
184
 
185
  :rtype: float
186
  :returns:
 
196
  return self._filesize_mb
197
 
198
  @property
199
+ def filesize_gb(self) -> float:
200
+ """File size of the media stream in gigabytes.
201
 
202
  :rtype: float
203
  :returns: