Skip to content

Instantly share code, notes, and snippets.

@bluebird75
Created May 11, 2021 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluebird75/34b1000e4171761606a74c4d966b143d to your computer and use it in GitHub Desktop.
Save bluebird75/34b1000e4171761606a74c4d966b143d to your computer and use it in GitHub Desktop.
> pylint src --ignore src\gui -d C0103 -d C0116 -d C0301 -d C0303 -d I0101 -d E0611 -d I1101 -d E0401
************* Module src.const
src\const.py:1:0: C0114: Missing module docstring (missing-module-docstring)
************* Module src.data_table
src\data_table.py:125:0: C0325: Unnecessary parens after 'return' keyword (superfluous-parens)
src\data_table.py:255:0: C0325: Unnecessary parens after 'return' keyword (superfluous-parens)
src\data_table.py:404:0: C0305: Trailing newlines (trailing-newlines)
src\data_table.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\data_table.py:14:0: C0115: Missing class docstring (missing-class-docstring)
src\data_table.py:15:23: W0613: Unused argument 'table' (unused-argument)
src\data_table.py:14:0: R0903: Too few public methods (0/2) (too-few-public-methods)
src\data_table.py:24:0: C0115: Missing class docstring (missing-class-docstring)
src\data_table.py:68:15: W0703: Catching too general exception Exception (broad-except)
src\data_table.py:149:12: R1731: Consider using 'insert_start = max(insert_start, 0)' instead of unnecessary if block (consider-using-max-builtin)
src\data_table.py:181:24: W0622: Redefining built-in 'format' (redefined-builtin)
src\data_table.py:210:18: C0321: More than one statement on a single line (multiple-statements)
src\data_table.py:222:8: R1705: Unnecessary "else" after "return" (no-else-return)
src\data_table.py:245:16: R1705: Unnecessary "elif" after "return" (no-else-return)
src\data_table.py:219:4: R0911: Too many return statements (7/6) (too-many-return-statements)
src\data_table.py:219:4: R0912: Too many branches (14/12) (too-many-branches)
src\data_table.py:275:8: W0622: Redefining built-in 'format' (redefined-builtin)
src\data_table.py:349:35: C0321: More than one statement on a single line (multiple-statements)
src\data_table.py:397:19: W0612: Unused variable 'address' (unused-variable)
src\data_table.py:397:28: W0612: Unused variable 'validChecksum' (unused-variable)
src\data_table.py:397:43: W0612: Unused variable 'wrongChecksum' (unused-variable)
src\data_table.py:24:0: R0904: Too many public methods (29/20) (too-many-public-methods)
src\data_table.py:4:0: W0611: Unused Any imported from typing (unused-import)
src\data_table.py:6:0: W0611: Unused QHeaderView imported from PyQt5.QtWidgets (unused-import)
************* Module src.form_insert_row_value
src\form_insert_row_value.py:85:0: C0305: Trailing newlines (trailing-newlines)
src\form_insert_row_value.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\form_insert_row_value.py:13:26: W0622: Redefining built-in 'format' (redefined-builtin)
src\form_insert_row_value.py:15:4: R1705: Unnecessary "elif" after "return" (no-else-return)
src\form_insert_row_value.py:24:0: C0115: Missing class docstring (missing-class-docstring)
src\form_insert_row_value.py:25:4: R0913: Too many arguments (6/5) (too-many-arguments)
src\form_insert_row_value.py:30:16: W0613: Unused argument 'fl' (unused-argument)
src\form_insert_row_value.py:51:47: W0622: Redefining built-in 'format' (redefined-builtin)
src\form_insert_row_value.py:51:4: R0201: Method could be a function (no-self-use)
src\form_insert_row_value.py:57:40: W0622: Redefining built-in 'format' (redefined-builtin)
src\form_insert_row_value.py:70:28: C0321: More than one statement on a single line (multiple-statements)
src\form_insert_row_value.py:81:8: W0612: Unused variable 'data' (unused-variable)
************* Module src.form_set_row_size
src\form_set_row_size.py:27:0: C0325: Unnecessary parens after 'if' keyword (superfluous-parens)
src\form_set_row_size.py:30:0: C0325: Unnecessary parens after 'if' keyword (superfluous-parens)
src\form_set_row_size.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\form_set_row_size.py:10:0: C0115: Missing class docstring (missing-class-docstring)
src\form_set_row_size.py:15:16: W0613: Unused argument 'fl' (unused-argument)
src\form_set_row_size.py:27:22: C0321: More than one statement on a single line (multiple-statements)
src\form_set_row_size.py:35:20: C0321: More than one statement on a single line (multiple-statements)
src\form_set_row_size.py:22:8: W0201: Attribute 'initial_data' defined outside __init__ (attribute-defined-outside-init)
************* Module src.form_split_item
src\form_split_item.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\form_split_item.py:10:0: C0115: Missing class docstring (missing-class-docstring)
src\form_split_item.py:15:16: W0613: Unused argument 'fl' (unused-argument)
src\form_split_item.py:22:8: W0201: Attribute 'data' defined outside __init__ (attribute-defined-outside-init)
************* Module src.insert_dialog
src\insert_dialog.py:20:0: C0305: Trailing newlines (trailing-newlines)
src\insert_dialog.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\insert_dialog.py:10:0: C0115: Missing class docstring (missing-class-docstring)
src\insert_dialog.py:15:16: W0613: Unused argument 'fl' (unused-argument)
src\insert_dialog.py:10:0: R0903: Too few public methods (0/2) (too-few-public-methods)
************* Module src.main_form
src\main_form.py:453:0: C0305: Trailing newlines (trailing-newlines)
src\main_form.py:102:13: W0511: TODO: refactor to use pathlib (fixme)
src\main_form.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\main_form.py:27:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
src\main_form.py:36:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
src\main_form.py:44:0: C0115: Missing class docstring (missing-class-docstring)
src\main_form.py:45:22: W0613: Unused argument 'parent' (unused-argument)
src\main_form.py:45:78: W0613: Unused argument 'fl' (unused-argument)
src\main_form.py:92:4: R0201: Method could be a function (no-self-use)
src\main_form.py:98:15: W0612: Unused variable 'selectedFilter' (unused-variable)
src\main_form.py:135:15: W0612: Unused variable 'filterName' (unused-variable)
src\main_form.py:173:15: W0703: Catching too general exception Exception (broad-except)
src\main_form.py:187:23: C0321: More than one statement on a single line (multiple-statements)
src\main_form.py:186:15: W0612: Unused variable 'filterName' (unused-variable)
src\main_form.py:301:12: W0612: Unused variable 'e' (unused-variable)
src\main_form.py:328:8: W0612: Unused variable 'e' (unused-variable)
src\main_form.py:356:31: C0321: More than one statement on a single line (multiple-statements)
src\main_form.py:370:25: C0321: More than one statement on a single line (multiple-statements)
src\main_form.py:372:31: C0321: More than one statement on a single line (multiple-statements)
src\main_form.py:406:31: C0321: More than one statement on a single line (multiple-statements)
src\main_form.py:431:11: C1801: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (len-as-condition)
src\main_form.py:44:0: R0904: Too many public methods (30/20) (too-many-public-methods)
src\main_form.py:4:0: W0611: Unused TextIO imported from typing (unused-import)
************* Module src.paste_dialog
src\paste_dialog.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\paste_dialog.py:10:0: C0115: Missing class docstring (missing-class-docstring)
src\paste_dialog.py:15:16: W0613: Unused argument 'fl' (unused-argument)
src\paste_dialog.py:10:0: R0903: Too few public methods (0/2) (too-few-public-methods)
************* Module src.sx_file
src\sx_file.py:137:0: C0304: Final newline missing (missing-final-newline)
src\sx_file.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\sx_file.py:5:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_file.py:36:11: C0121: Comparison 'self.sxItemFirst == None' should be 'self.sxItemFirst is None' (singleton-comparison)
src\sx_file.py:36:37: C0321: More than one statement on a single line (multiple-statements)
src\sx_file.py:40:11: C0121: Comparison 'self.sxItemLast == None' should be 'self.sxItemLast is None' (singleton-comparison)
src\sx_file.py:40:36: C0321: More than one statement on a single line (multiple-statements)
src\sx_file.py:51:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
src\sx_file.py:55:49: W0613: Unused argument 'fname' (unused-argument)
src\sx_file.py:72:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
src\sx_file.py:81:44: W0622: Redefining built-in 'range' (redefined-builtin)
src\sx_file.py:92:43: W0622: Redefining built-in 'range' (redefined-builtin)
src\sx_file.py:31:8: W0201: Attribute 'sxItemFirst' defined outside __init__ (attribute-defined-outside-init)
src\sx_file.py:68:8: W0201: Attribute 'sxItemFirst' defined outside __init__ (attribute-defined-outside-init)
src\sx_file.py:32:8: W0201: Attribute 'sxItemLast' defined outside __init__ (attribute-defined-outside-init)
src\sx_file.py:69:8: W0201: Attribute 'sxItemLast' defined outside __init__ (attribute-defined-outside-init)
src\sx_file.py:30:8: W0201: Attribute 'sxItems' defined outside __init__ (attribute-defined-outside-init)
src\sx_file.py:25:8: W0201: Attribute 'sxItemsEx' defined outside __init__ (attribute-defined-outside-init)
src\sx_file.py:66:8: W0201: Attribute 'sxItemsEx' defined outside __init__ (attribute-defined-outside-init)
************* Module src.sx_item
src\sx_item.py:149:0: C0325: Unnecessary parens after 'not' keyword (superfluous-parens)
src\sx_item.py:460:0: C0305: Trailing newlines (trailing-newlines)
src\sx_item.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\sx_item.py:9:18: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:63:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_item.py:63:34: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:65:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_item.py:65:43: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:67:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_item.py:67:44: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:68:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_item.py:68:44: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:69:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_item.py:69:42: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:70:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_item.py:70:44: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:71:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_item.py:71:40: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:80:7: C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
src\sx_item.py:82:9: C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
src\sx_item.py:84:9: C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
src\sx_item.py:92:7: C1801: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (len-as-condition)
src\sx_item.py:97:24: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:124:23: W0622: Redefining built-in 'format' (redefined-builtin)
src\sx_item.py:124:4: R0913: Too many arguments (6/5) (too-many-arguments)
src\sx_item.py:137:36: W0622: Redefining built-in 'format' (redefined-builtin)
src\sx_item.py:313:8: W0622: Redefining built-in 'bytes' (redefined-builtin)
src\sx_item.py:327:0: C0115: Missing class docstring (missing-class-docstring)
src\sx_item.py:358:11: C0121: Comparison 'self.sxItemFirst == None' should be 'self.sxItemFirst is None' (singleton-comparison)
src\sx_item.py:358:37: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:362:11: C0121: Comparison 'self.sxItemLast == None' should be 'self.sxItemLast is None' (singleton-comparison)
src\sx_item.py:362:36: C0321: More than one statement on a single line (multiple-statements)
src\sx_item.py:373:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
src\sx_item.py:377:49: W0613: Unused argument 'fname' (unused-argument)
src\sx_item.py:394:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
src\sx_item.py:403:44: W0622: Redefining built-in 'range' (redefined-builtin)
src\sx_item.py:414:43: W0622: Redefining built-in 'range' (redefined-builtin)
src\sx_item.py:353:8: W0201: Attribute 'sxItemFirst' defined outside __init__ (attribute-defined-outside-init)
src\sx_item.py:390:8: W0201: Attribute 'sxItemFirst' defined outside __init__ (attribute-defined-outside-init)
src\sx_item.py:354:8: W0201: Attribute 'sxItemLast' defined outside __init__ (attribute-defined-outside-init)
src\sx_item.py:391:8: W0201: Attribute 'sxItemLast' defined outside __init__ (attribute-defined-outside-init)
src\sx_item.py:352:8: W0201: Attribute 'sxItems' defined outside __init__ (attribute-defined-outside-init)
src\sx_item.py:347:8: W0201: Attribute 'sxItemsEx' defined outside __init__ (attribute-defined-outside-init)
src\sx_item.py:388:8: W0201: Attribute 'sxItemsEx' defined outside __init__ (attribute-defined-outside-init)
************* Module src.utils
src\utils.py:52:57: E0001: invalid syntax (<unknown>, line 52) (syntax-error)
************* Module src.xor_dialog
src\xor_dialog.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src\xor_dialog.py:13:0: C0115: Missing class docstring (missing-class-docstring)
src\xor_dialog.py:15:4: R0913: Too many arguments (6/5) (too-many-arguments)
src\xor_dialog.py:1:0: R0801: Similar lines in 2 files
==src.sx_file:4
==src.sx_item:326
class SxFile:
# noinspection PyMissingTypeHints
def __init__(self) -> None:
self.clear()
def getFormat(self) -> str:
"""Return s19, s28, s37 or empty string if no data."""
if len(self.sxItemsEx) == 0:
return ''
lastFmtChar = int(self.sxItemsEx[-1].format[1])
fmt = 's%d%d' % ((10-lastFmtChar),lastFmtChar)
return fmt
def clear(self) -> None:
self.sxItemFirst = SxItem('','','','','')
self.sxItemLast = SxItem('','','','','')
self.sxItems = [] # type: List[SxItem]
self.sxItemsEx = [] # type: List[SxItem]
def syncEx(self) -> None:
self.sxItemsEx = [ self.sxItemFirst ]
self.sxItemsEx.extend( self.sxItems )
self.sxItemsEx.append( self.sxItemLast )
def syncFromEx(self) -> None:
self.sxItems = self.sxItemsEx[1:-1]
self.sxItemFirst = self.sxItemsEx[0]
self.sxItemLast = self.sxItemsEx[-1]
def __repr__(self) -> str:
s = "" # type: str
if self.sxItemFirst == None: s += 'None\n'
else: s += repr(self.sxItemFirst) + "\n"
for item in self.sxItems: # type: SxItem
s += repr(item) + "\n"
if self.sxItemLast == None: s += 'None\n'
else: s += repr(self.sxItemLast)+ "\n"
return s
def __len__(self) -> int:
return len(self.sxItemsEx)
def __getitem__(self, idx):
return self.sxItems[idx]
def fromFile(self, fname: str) -> None:
f = open(fname, 'r') # type: TextIO
self.fromFileStream(f, fname)
f.close()
def fromFileStream(self, fileStream: TextIO, fname:str) -> None:
self.clear()
lineNb = 1
line = fileStream.readline().strip()
while len(line):
sxItem = SxItem('', '', '', '', '')
sxItem.setContent( line, lineNb )
self.sxItems.append(sxItem)
line = fileStream.readline().strip()
lineNb += 1
self.sxItemsEx = self.sxItems[:]
self.sxItemFirst = self.sxItems.pop(0)
self.sxItemLast = self.sxItems.pop()
def toFile(self, file_out:str) -> None:
f = open(file_out, "w") # type: TextIO
self.toFileStream(f)
f.close()
def toFileStream(self, fileStreamOut: TextIO) -> None:
"""Pretty print every item into file_out."""
for item in self.sxItemsEx:
print(item, file=fileStreamOut)
def updateDataRange(self, new_data:str, range:List[int]) -> None:
"""
Apply a data update on items at the index given in range.
Index counts from S1 line (excludes S0) Last index is not
included in the range
"""
for item in self.sxItemsEx[range[0]+1:range[1]+1]:
item.updateData(new_data)
self.syncFromEx()
def convertRange(self, new_format:str, range:List[int]) -> None:
"""
Apply a convert on items at the index given in range.
Index counts from S1 line (excludes S0) Last index is not
included in the range
"""
for item in self.sxItems[range[0]:range[1]]:
item.convert(new_format)
self.syncEx()
def splitItem( self, itemIdx:int, offset:int ) -> None:
newItem = self.sxItems[itemIdx].split( offset ) # type: SxItem
self.sxItems.insert( itemIdx+1, newItem )
self.syncEx()
def mergeItem( self, itemStart:int, itemEnd:int ) -> None:
idxOffset = 0 # type: int
for idx in range(itemStart, itemEnd):
try:
self.sxItems[idx+idxOffset].merge( self.sxItems[idx+idxOffset+1] )
del self.sxItems[idx+idxOffset+1]
idxOffset -= 1
except SxItemBadNewAddress:
continue
self.syncEx()
def applyNewRowSize( self, newRowSize:int, itemStart:int, itemEnd:int ) -> None:
idx = itemStart # type: int
while idx <= itemEnd:
if newRowSize > self.sxItems[idx].dataLen():
# merge must occur first
if idx+1 <= itemEnd \
and self.sxItems[idx].mergePossible( self.sxItems[idx+1] ):
self.sxItems[idx].merge( self.sxItems[idx+1] )
del self.sxItems[idx+1]
itemEnd -= 1
if newRowSize < self.sxItems[idx].dataLen():
# split it
next_item = self.sxItems[idx].split( newRowSize )
self.sxItems.insert( idx+1, next_item )
itemEnd += 1
idx += 1
self.syncEx() (duplicate-code)
src\xor_dialog.py:1:0: R0801: Similar lines in 2 files
==src.form_set_row_size:13
==src.insert_dialog:13
modal:int = 0,
fl:int = 0):
QDialog.__init__(self, parent)
self.setupUi(self) # type: ignore # PyQt and Mypy don't mix very well
self.setModal(modal)
self.setObjectName(name)
(duplicate-code)
src\xor_dialog.py:1:0: R0801: Similar lines in 2 files
==src.form_set_row_size:15
==src.form_split_item:15
QDialog.__init__(self, parent)
self.setupUi(self) # type: ignore # PyQt and Mypy don't mix very well
self.setModal(modal)
self.setObjectName(name)
def setInitialData(self, data:str) -> None: (duplicate-code)
src\xor_dialog.py:1:0: R0801: Similar lines in 3 files
==src.form_insert_row_value:28
==src.form_set_row_size:13
==src.insert_dialog:13
modal:int = 0,
fl:int = 0):
QDialog.__init__(self, parent)
self.setupUi(self) # type: ignore # PyQt and Mypy don't mix very well
self.setModal(modal)
self.setObjectName(name) (duplicate-code)
------------------------------------------------------------------
Your code has been rated at 8.65/10 (previous run: 8.65/10, +0.00)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment