Skip to content

Commit ec1df06

Browse files
committed
add pydocstyle
1 parent 9d7fbf4 commit ec1df06

File tree

9 files changed

+28
-10
lines changed

9 files changed

+28
-10
lines changed

.github/workflows/test_release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
run: tox -e black-check
2828
- name: Pylint
2929
run: tox -e pylint
30+
- name: Docstyle
31+
run: tox -e docstyle
3032

3133
test:
3234
runs-on: ubuntu-latest

.pydocstylerc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pydocstyle]
2+
inherit = false
3+
ignore = D104,D107,D202,D203,D205,D209,D212,D213,D214,D400,D401,D404,D406,D407,D411,D413,D414,D415,D417

src/smexperiments/_environment.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111

1212
class EnvironmentType(enum.Enum):
13-
"""
14-
SageMaker jobs which data can be pulled from the environment.
15-
"""
13+
"""SageMaker jobs which data can be pulled from the environment."""
1614

1715
SageMakerTrainingJob = 1
1816
SageMakerProcessingJob = 2

src/smexperiments/api_types.py

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def __init__(self, string_value=None, number_value=None, **kwargs):
104104
)
105105

106106
def __str__(self):
107+
"""String representation of TrialComponentParameterValue"""
107108
if self.string_value is not None:
108109
return self.string_value
109110
if self.number_value is not None:

src/smexperiments/metrics.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
"""Metrics module"""
1314
import datetime
1415
import json
1516
import logging

src/smexperiments/search_expression.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
@unique
1919
class Operator(Enum):
20+
"""Search operators"""
21+
2022
EQUALS = "Equals"
2123
NOT_EQUALS = "NotEquals"
2224
GREATER_THAN = "GreaterThan"
@@ -30,19 +32,22 @@ class Operator(Enum):
3032

3133
@unique
3234
class BooleanOperator(Enum):
35+
"""Boolean search operation enum"""
36+
3337
AND = "And"
3438
OR = "Or"
3539

3640

3741
class SearchObject(ApiObject):
42+
"""SearchObject"""
43+
3844
def to_boto(self):
45+
"""Convert a search object to boto"""
3946
return ApiObject.to_boto(self)
4047

4148

4249
class Filter(SearchObject):
43-
"""
44-
A Python class represent a Search Filter object.
45-
"""
50+
"""A Python class represent a Search Filter object."""
4651

4752
name = None
4853
operator = None
@@ -62,9 +67,7 @@ def __init__(self, name, operator=None, value=None):
6267

6368

6469
class NestedFilter(SearchObject):
65-
"""
66-
A Python class represent a Nested Filter object.
67-
"""
70+
"""A Python class represent a Nested Filter object."""
6871

6972
nested_property_name = None
7073
filters = None

src/smexperiments/tracker.py

+2
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,15 @@ def log_metric(self, metric_name, value, timestamp=None, iteration_number=None):
298298
raise
299299

300300
def __enter__(self):
301+
"""Updates the start time of the tracked trial component."""
301302
self._start_time = datetime.datetime.now(dateutil.tz.tzlocal())
302303
if not self._in_sagemaker_job:
303304
self.trial_component.start_time = self._start_time
304305
self.trial_component.status = api_types.TrialComponentStatus(primary_status="InProgress")
305306
return self
306307

307308
def __exit__(self, exc_type, exc_value, exc_traceback):
309+
"""Updates the end time of the tracked trial component."""
308310
self._end_time = datetime.datetime.now(dateutil.tz.tzlocal())
309311
if not self._in_sagemaker_job:
310312
self.trial_component.end_time = self._end_time

src/smexperiments/training_job.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717

1818
class TrainingJob(_base_types.Record):
19+
"""Search for training jobs"""
20+
1921
@classmethod
2022
def search(
2123
cls,

tox.ini

+7-1
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,10 @@ deps =
134134
passenv =
135135
CODECOV_UPLOAD_TOKEN
136136
commands =
137-
codecov -t {env:CODECOV_UPLOAD_TOKEN:}
137+
codecov -t {env:CODECOV_UPLOAD_TOKEN:}
138+
139+
140+
[testenv:docstyle]
141+
deps = pydocstyle
142+
commands =
143+
pydocstyle src/smexperiments

0 commit comments

Comments
 (0)