Repository navigation
Environment extends map - #35
Conversation
|
|
||
|
|
||
| class Environment(object): | ||
| class Environment(collections.Mapping): |
There was a problem hiding this comment.
what is rationale for this change?
| input_data_config = read_input_data_config() | ||
|
|
||
| sagemaker_hyperparameters, hyperparameters = split_hyperparameters(read_hyperparameters()) | ||
| hps = read_hyperparameters() |
There was a problem hiding this comment.
There was a problem hiding this comment.
ya but we should take opportunity to fix
There was a problem hiding this comment.
Should I move the Environment class to another file them?
What do you suggest @jesterhazy
| @@ -0,0 +1,14 @@ | |||
| def split_by_criteria(dictionary, keys): # type: (dict, set) -> (dict, dict) | |||
There was a problem hiding this comment.
is this function used anywhere except Environment? if not, it should be private method in environment
There was a problem hiding this comment.
Environment by design is a namedtuple, POCO, POJO, (put your plain class of choice here).
Another design decision is that this library is composed by small functions that can be utilized as well. Private methods and classes are only used when necessary.
I have changes outside the scope of this PR that already use split_by_criteria.
| USE_NGINX_ENV = 'SAGEMAKER_USE_NGINX' # type: str | ||
|
|
||
| BASE_PATH = os.environ.get(BASE_PATH_ENV, os.path.join('/opt', 'ml')) # type: str | ||
| BASE_PATH = os.environ.get(BASE_PATH_ENV, os.path.join(os.sep, 'opt', 'ml')) # type: str |
There was a problem hiding this comment.
I remeber when doing
os.path.join(something, '/something_else') it would result in
/something_else instead of something/something_else.
is using os.sep working around it? does it even need to be there?
There was a problem hiding this comment.
if first arg to join has '/' it's ok, but if later ones do then it's trouble. looks like os.sep here is just to avoid platform-specific separator. but '/' should work fine on all platforms and is more readable
|
|
||
|
|
||
| class Environment(object): | ||
| class Environment(collections.Mapping): |
| partial_branches = | ||
| pragma: no cover | ||
| pragma: py3 no cover | ||
| if six.PY3 |
Codecov Report
@@ Coverage Diff @@
## r2.0 #35 +/- ##
=======================================
Coverage ? 99.52%
=======================================
Files ? 4
Lines ? 211
Branches ? 15
=======================================
Hits ? 210
Misses ? 0
Partials ? 1
Continue to review full report at Codecov.
|
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.