Skip to content

Commit

Permalink
Merge branch 'master' into set-value
Browse files Browse the repository at this point in the history
  • Loading branch information
TojikCZ authored Sep 23, 2024
2 parents 5b710d4 + fae4936 commit 19b30a7
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 20 deletions.
7 changes: 4 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
root = true

# elementary defaults
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_size = tab
indent_style = space
insert_final_newline = false
max_line_length = 80
tab_width = 4

# Markup files
[{*.html,*.xml,*.yaml,*.yml}]
# Markup and web files
[{*.html,*.xml,*.yaml,*.yml,*.json,*.toml,*.js,*.css}]
tab_width = 2
2 changes: 1 addition & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -U -r requirements.txt
pip install -U types-pkg_resources types-requests
pip install -U types-requests
pip install -U ruff pytest pytest-pylint pytest-doctestplus
pip install -U requests_mock pytest-mypy func-timeout responses
Expand Down
1 change: 1 addition & 0 deletions prusa/connect/printer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def __init__(self,
fingerprint: Optional[str] = None,
max_retries: int = 1,
mmu_supported: bool = True):
# pylint: disable=too-many-positional-arguments
self.__type = type_
self.__sn = sn
self.__fingerprint = fingerprint
Expand Down
4 changes: 3 additions & 1 deletion prusa/connect/printer/camera_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ class CameraConfigurator:
for the instance.
"""

# pylint: disable=too-many-arguments
def __init__(self,
camera_controller: CameraController,
config: ConfigParser,
config_file_path: str,
drivers: List[Type[CameraDriver]],
auto_detect=True) -> None:
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-arguments

self.camera_controller = camera_controller
self.config = config
self.config_file_path = config_file_path
Expand Down
16 changes: 9 additions & 7 deletions prusa/connect/printer/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,16 @@ def check_state(self, command_id: int, command_name: str):
return False
return True

def accept( # pylint: disable=too-many-arguments
self,
command_id: int,
command_name: str,
args: Optional[List[Any]] = None,
kwargs: Optional[Dict[str, Any]] = None,
force=False):
def accept(self,
command_id: int,
command_name: str,
args: Optional[List[Any]] = None,
kwargs: Optional[Dict[str, Any]] = None,
force=False):
"""Accept command (add event to queue)."""
# pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments

self.state = const.Event.ACCEPTED
self.command_id = command_id
self.command_name = command_name
Expand Down
4 changes: 3 additions & 1 deletion prusa/connect/printer/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class CondState(Enum):
NOK = False


# pylint: disable=too-many-arguments
class Condition:
"""A more detailed condition for state tracking"""

Expand All @@ -36,6 +35,9 @@ def __init__(self,
parent: Optional[Condition] = None,
short_msg: Optional[str] = None,
priority: int = 0):
# pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments

self.name: str = name
self.long_msg: str = long_msg
self.short_msg: str = short_msg or name
Expand Down
5 changes: 5 additions & 0 deletions prusa/connect/printer/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def start(self,
team_id: Optional[int] = None) -> dict:
"""Set a new transfer type, if no transfer is in progress"""
# pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments

filename = basename(path)

if forbidden_characters(filename):
Expand Down Expand Up @@ -254,6 +256,8 @@ def __init__(self, fs: Filesystem, transfer: Transfer,
printed_file_cb: Callable, download_finished_cb: Callable):
# pylint: disable=invalid-name
# pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments

self.buffer_size = self.BIG_BUFFER
self.throttle = 0
self.fs = fs
Expand All @@ -279,6 +283,7 @@ def start(self,
(:class:prusa.connect.printer.files.Filesystem)
"""
# pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments
# Check if no other transfer is running
retval = {}
try:
Expand Down
9 changes: 4 additions & 5 deletions prusa/connect/printer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class Event(LoopObject):
needs_token = True
data: Dict[str, Any]

# pylint: disable=too-many-arguments
def __init__(self,
event: const.Event,
source: const.Source,
Expand All @@ -128,6 +127,9 @@ def __init__(self,
state: Optional[const.State] = None,
dialog_id: Optional[int] = None,
**kwargs):
# pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments

super().__init__(timestamp=timestamp)
self.event = event
self.source = source
Expand All @@ -146,10 +148,7 @@ def to_payload(self):
"source": self.source.value,
"data": filter_null(self.data),
}
for attr in ('command_id',
'job_id',
'transfer_id',
'reason',
for attr in ('command_id', 'job_id', 'transfer_id', 'reason',
'dialog_id'):
value = getattr(self, attr)
if value:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ packages = ["prusa.connect.printer"]
"prusa.connect.printer" = ["py.typed"]

[tool.ruff]
select = [
lint.select = [
"F", # pyflakes
"E", # pycodestyle
"W", # pycodestyle
Expand Down Expand Up @@ -89,7 +89,7 @@ select = [
"NPY", # NumPy-specific rules
"RUF", # Ruff-specific rules
]
ignore = [
lint.ignore = [
"S101", # Use of `assert` detected
"S105", # Possible hardcoded password assigned to: "TOKEN"
"Q000", # Single quotes found but double quotes preferred
Expand Down

0 comments on commit 19b30a7

Please sign in to comment.