Refactor unnecessary else / elif when if block has a return statement
This commit is contained in:
committed by
GitHub
parent
86ae06de51
commit
bd2a63653b
@@ -31,7 +31,7 @@ class ByteArrayOutputStream(OutputStream):
|
||||
if byte is not None and buffer is None and offset is None and length is None:
|
||||
self.internal_write(byte)
|
||||
return
|
||||
elif byte is None and buffer is not None and offset is None and length is None:
|
||||
if byte is None and buffer is not None and offset is None and length is None:
|
||||
offset = 0
|
||||
length = len(buffer)
|
||||
elif not (byte is None and buffer is not None and offset is not None
|
||||
|
||||
@@ -13,10 +13,9 @@ class DataInputStream(FilterInputStream, DataInput):
|
||||
length: int = None) -> int:
|
||||
if b is not None and offset is None and length is None:
|
||||
return self.input_stream.read(b, 0, len(b))
|
||||
elif b is not None and offset is not None and length is not None:
|
||||
if b is not None and offset is not None and length is not None:
|
||||
return self.input_stream.read(b, offset, length)
|
||||
else:
|
||||
raise TypeError()
|
||||
raise TypeError()
|
||||
|
||||
def read_fully(self,
|
||||
b: bytearray = None,
|
||||
|
||||
@@ -35,11 +35,10 @@ class InputStream(Closeable):
|
||||
return 0
|
||||
self.ensure_open()
|
||||
return -1
|
||||
elif b is None and offset is None and length is None:
|
||||
if b is None and offset is None and length is None:
|
||||
self.ensure_open()
|
||||
return -1
|
||||
else:
|
||||
raise TypeError()
|
||||
raise TypeError()
|
||||
|
||||
def read_all_bytes(self):
|
||||
self.ensure_open()
|
||||
@@ -83,7 +82,7 @@ class InputStream(Closeable):
|
||||
length: int = None) -> int:
|
||||
if b is None and offset is None and length is None:
|
||||
return self.internal_read()
|
||||
elif b is not None and offset is None and length is None:
|
||||
if b is not None and offset is None and length is None:
|
||||
offset = 0
|
||||
length = len(b)
|
||||
elif not (b is not None and offset is not None and length is not None):
|
||||
@@ -165,7 +164,7 @@ class InputStream(Closeable):
|
||||
remaining -= count
|
||||
|
||||
return result
|
||||
elif b is not None and offset is not None and length is not None:
|
||||
if b is not None and offset is not None and length is not None:
|
||||
if len(b) < (offset + length):
|
||||
raise IndexError()
|
||||
|
||||
@@ -176,8 +175,7 @@ class InputStream(Closeable):
|
||||
break
|
||||
n += count
|
||||
return n
|
||||
else:
|
||||
raise TypeError()
|
||||
raise TypeError()
|
||||
|
||||
def skip(self, n: int) -> int:
|
||||
remaining = n
|
||||
|
||||
Reference in New Issue
Block a user