Skip to content

Commit

Permalink
some pylint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rlehfeld committed Apr 22, 2024
1 parent 208314d commit d52fe60
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
5 changes: 4 additions & 1 deletion RPyCRobotRemote/RPyCRobotRemoteClient.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"""
Client Implementation for RPyCRobotRemote
"""
import sys
import functools
import logging
import rpyc
from typing import Callable
from contextlib import contextmanager
import rpyc
from robot.libraries.DateTime import convert_time
from robot.api.deco import not_keyword

Expand Down
25 changes: 14 additions & 11 deletions RPyCRobotRemote/RPyCRobotRemoteServer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
"""
Server Implementation for RPyCRobotRemote
"""
import sys
import rpyc
import pathlib
import logging
import io
import inspect
from typing import TextIO, Optional, Union
from robot.libraries.DateTime import convert_time
import rpyc
from rpyc.utils.server import ThreadedServer


Expand Down Expand Up @@ -61,16 +64,16 @@ def get_keyword_names(self):

if get_kw_names:
return tuple(sorted(set(get_kw_names())))
else:
attributes = inspect.getmembers(
self._library,
is_function_or_method
)
return tuple(
name for name, value in attributes
if (name[0:1] != '_' and
not getattr(value, 'robot_not_keyword', False))
)

attributes = inspect.getmembers(
self._library,
is_function_or_method
)
return tuple(
name for name, value in attributes
if (name[0:1] != '_' and
not getattr(value, 'robot_not_keyword', False))
)

@property
def library(self):
Expand Down
14 changes: 9 additions & 5 deletions RPyCRobotRemote/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from .RPyCRobotRemoteClient import RPyCRobotRemoteClient as Client
from .RPyCRobotRemoteServer import RPyCRobotRemoteServer as Server # noqa, F401
from rpyc.utils.server import Server as _RPyCServer
"""
__init__.py for RPyCRobotRemote
"""
from collections.abc import Iterable
from collections import UserString
from io import IOBase
from rpyc.utils.server import Server as _RPyCServer
import robot.utils
import robot.variables.replacer
import robot.variables.assigner
import robot.variables.store
from .RPyCRobotRemoteClient import RPyCRobotRemoteClient as Client
from .RPyCRobotRemoteServer import RPyCRobotRemoteServer as Server # noqa, F401

RPyCRobotRemote = Client

Expand All @@ -20,6 +23,7 @@ class SingleServer(_RPyCServer):
"""

def _accept_method(self, sock):
"""accept method"""
try:
self._authenticate_and_serve_client(sock)
finally:
Expand All @@ -30,6 +34,7 @@ def _accept_method(self, sock):
# Python seems to have a problem with isinstance here
# and throws expcetion
def patch_is_list_like(func):
"""patch is_list_like as it leads to exception with remote namedtuples"""
def is_list_like(item):
if isinstance(item, (str, bytes, bytearray)):
return False
Expand All @@ -54,8 +59,7 @@ def is_list_like(item):
iter(item)
except TypeError:
return False
else:
return True
return True

code = is_list_like.__code__
func.__code__ = func.__code__.replace(
Expand Down
2 changes: 1 addition & 1 deletion test/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import logging
import logging.config
import yaml
import RPyCRobotRemote
from provider import Provider
import RPyCRobotRemote


LOGCONFIG = """
Expand Down

0 comments on commit d52fe60

Please sign in to comment.