Commit 12b38eb1 authored by Anton Pershin's avatar Anton Pershin

Massive refactoring of class Research: (1) enabled static type-checking using…

Massive refactoring of class Research: (1) enabled static type-checking using module 'typing' and package 'mypy', (2) changed class member names to more sensible ones and (3) introduced three properties, namely, local_research_path, remote_research_path, research_dir (they are the only public data members of the class now)
parent 5318918b
...@@ -2,6 +2,7 @@ from comsdk.comaux import find_dir_by_named_regexp ...@@ -2,6 +2,7 @@ from comsdk.comaux import find_dir_by_named_regexp
from functools import partial from functools import partial
import os import os
class DistributedStorage: class DistributedStorage:
""" """
Distributed storage is a set of sources contaning the data. The sources must be accessible by the OS API. Distributed storage is a set of sources contaning the data. The sources must be accessible by the OS API.
...@@ -18,8 +19,8 @@ class DistributedStorage: ...@@ -18,8 +19,8 @@ class DistributedStorage:
""" """
Returns the full path to dir_ or None if dir_ is absent. Returns the full path to dir_ or None if dir_ is absent.
""" """
dir_path_tuple = self.lookup_through_dir(dir_, \ dir_path_tuple = self.lookup_through_dir(dir_, lambda dir_path: (dir_path, dir_path)
lambda dir_path: (dir_path, dir_path) if os.path.exists(dir_path) else None) if os.path.exists(dir_path) else None)
return dir_path_tuple[0] if dir_path_tuple is not None else None return dir_path_tuple[0] if dir_path_tuple is not None else None
def make_dir(self, dir_): def make_dir(self, dir_):
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment