Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Added .coveragerc to exclude some lines #4455

Merged
merged 1 commit into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[report]
exclude_lines =
pragma: no cover
raise NotImplementedError
if __name__ == .__main__.:
19 changes: 6 additions & 13 deletions golem/core/fileencrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
from io import IOBase


class abstractclassmethod(classmethod):

__isabstractmethod__ = True

def __init__(self, func):
func.__isabstractmethod__ = True
super(abstractclassmethod, self).__init__(func)


class FileHelper(object):

def __init__(self, param, mode):
Expand Down Expand Up @@ -46,13 +37,15 @@ def gen_secret(cls, min_length, max_length):
n_chars = cls.__strong_random.randrange(min_length, max_length)
return Random.new().read(n_chars)

@abstractclassmethod
@classmethod
@abc.abstractmethod
def encrypt(cls, file_in, file_out, key_or_secret):
pass
raise NotImplementedError

@abstractclassmethod
@classmethod
@abc.abstractmethod
def decrypt(cls, file_in, file_out, key_or_secret):
pass
raise NotImplementedError


class AESFileEncryptor(FileEncryptor):
Expand Down
6 changes: 3 additions & 3 deletions golem/core/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ class IService(ABC):

@abstractmethod
def start(self) -> None:
pass
raise NotImplementedError

@abstractmethod
def stop(self) -> None:
pass
raise NotImplementedError

@abstractmethod
def running(self) -> bool:
pass
raise NotImplementedError


class LoopingCallService(IService):
Expand Down
2 changes: 1 addition & 1 deletion golem/diag/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DiagnosticsOutputFormat(object):
class DiagnosticsProvider(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def get_diagnostics(self, output_format):
pass
raise NotImplementedError

@staticmethod
def _format_diagnostics(data, output_format):
Expand Down
8 changes: 4 additions & 4 deletions golem/docker/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,22 @@ def get_container_config(self) -> Dict:
@property
@abc.abstractmethod
def DOCKER_IMAGE(cls):
pass
raise NotImplementedError

@property
@abc.abstractmethod
def DOCKER_TAG(cls):
pass
raise NotImplementedError

@property
@abc.abstractmethod
def ENV_ID(cls):
pass
raise NotImplementedError

@property
@abc.abstractmethod
def SHORT_DESCRIPTION(cls):
pass
raise NotImplementedError

@classmethod
def get_id(cls):
Expand Down
2 changes: 1 addition & 1 deletion golem/envs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from enum import Enum
from logging import Logger, getLogger
from threading import RLock
from pathlib import Path

from typing import Any, Callable, Dict, List, Optional, NamedTuple, Union, \
Sequence, Iterable, ContextManager, Set, Tuple
Expand Down Expand Up @@ -123,6 +122,7 @@ def close(self):
a closed input won't do anything.
NOTE: If there are many open input handles for a single Runtime
then closing one of them will effectively close all the other. """
raise NotImplementedError

def __enter__(self) -> 'RuntimeInput':
return self
Expand Down
2 changes: 1 addition & 1 deletion golem/interface/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def clear_argument(self, arg_dict):

@abc.abstractmethod
def format(self, result):
pass
raise NotImplementedError

@staticmethod
def _initial_format(result):
Expand Down
2 changes: 1 addition & 1 deletion golem/monitor/model/modelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ModelBase(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def dict_repr(self):
"""Returns dictionary representation of the current instance"""
pass
raise NotImplementedError


class BasicModel(ModelBase):
Expand Down
16 changes: 7 additions & 9 deletions golem/network/transport/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
class Network(abc.ABC):
@abc.abstractmethod
def connect(self, connect_info: TCPConnectInfo) -> None:
return
raise NotImplementedError

@abc.abstractmethod
def listen(self, listen_info: TCPListenInfo) -> None:
return
raise NotImplementedError

@abc.abstractmethod
def stop_listening(self, listening_info: TCPListeningInfo):
return
raise NotImplementedError


class SessionFactory(object):
Expand Down Expand Up @@ -115,19 +115,17 @@ class Session(object, metaclass=abc.ABCMeta):
CONN_TYPE_CLIENT = 1
CONN_TYPE_SERVER = 2

@abc.abstractmethod
def __init__(self, conn):
def __init__(self):
self.conn_type = None
return

@abc.abstractmethod
def dropped(self):
return
raise NotImplementedError

@abc.abstractmethod
def interpret(self, msg):
return
raise NotImplementedError

@abc.abstractmethod
def disconnect(self, reason):
return
raise NotImplementedError
8 changes: 4 additions & 4 deletions golem/network/transport/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class FileSession(Session, metaclass=abc.ABCMeta):

@abc.abstractmethod
def data_sent(self, extra_data=None):
return
raise NotImplementedError

@abc.abstractmethod
def full_data_received(self, extra_data=None):
return
raise NotImplementedError

@abc.abstractmethod
def production_failed(self, extra_data=None):
return
raise NotImplementedError


class BasicSession(FileSession):
Expand All @@ -41,7 +41,7 @@ def __init__(self, conn):
:param Protocol conn: connection protocol implementation that
this session should enhance.
"""
Session.__init__(self, conn)
Session.__init__(self)
self.conn = conn

pp = conn.transport.getPeer()
Expand Down
12 changes: 6 additions & 6 deletions golem/network/upnp/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@ class IPortMapper(ABC):
@property
@abstractmethod
def available(self) -> bool:
pass
raise NotImplementedError

@property
@abstractmethod
def network(self) -> dict:
pass
raise NotImplementedError

@abstractmethod
def discover(self) -> str:
pass
raise NotImplementedError

@abstractmethod
def get_mapping(self,
external_port: int,
protocol: str = 'TCP') -> Optional[Tuple[str, int, bool]]:
pass
raise NotImplementedError

@abstractmethod
def create_mapping(self,
local_port: int,
external_port: int = None,
protocol: str = 'TCP',
lease_duration: int = None) -> Optional[int]:
pass
raise NotImplementedError

@abstractmethod
def remove_mapping(self,
port: int,
external_port: int,
protocol: str = 'TCP') -> bool:
pass
raise NotImplementedError


class PortMapperManager(IPortMapper):
Expand Down
4 changes: 2 additions & 2 deletions golem/task/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class DenyReason(Enum):
class Acl(abc.ABC):
@abc.abstractmethod
def is_allowed(self, node_id: str) -> Tuple[bool, Optional[DenyReason]]:
pass
raise NotImplementedError

@abc.abstractmethod
def disallow(self, node_id: str, timeout_seconds: int, persist: bool) \
-> None:
pass
raise NotImplementedError


class _DenyAcl(Acl):
Expand Down
2 changes: 1 addition & 1 deletion golem/task/appcallbacks/appcallbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def create_payload(
command: str,
port: int,
) -> RuntimePayload:
raise NotImplementedError()
raise NotImplementedError


class EnvironmentCallbacks(AppCallbacks):
Expand Down
4 changes: 2 additions & 2 deletions golem/task/result/resultmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def __init__(self, resource_manager):

@abc.abstractmethod
def create(self, node, task_result, **kwargs):
pass
raise NotImplementedError

@abc.abstractmethod
def extract(self, path, output_dir=None, **kwargs):
pass
raise NotImplementedError


class EncryptedResultPackageManager(TaskResultPackageManager):
Expand Down
8 changes: 4 additions & 4 deletions golem/task/result/resultpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ def _prepare_file_dict(cls, disk_files) -> Dict[str, str]:

@abc.abstractmethod
def extract(self, input_path, output_dir=None):
pass
raise NotImplementedError

@abc.abstractmethod
def generator(self, output_path):
pass
raise NotImplementedError

@abc.abstractmethod
def package_name(self, file_path):
pass
raise NotImplementedError

@abc.abstractmethod
def write_disk_file(self, package_file, src_path, target_path):
pass
raise NotImplementedError


class ZipPackager(Packager):
Expand Down
Loading