Skip to content

Commit fb84454

Browse files
Apply suggestions from code review
Co-Authored-By: Achilleas Koutsou <[email protected]>
1 parent 973eedc commit fb84454

File tree

13 files changed

+43
-43
lines changed

13 files changed

+43
-43
lines changed

odml/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def _get_section_by_path(self, path):
484484

485485
def find(self, key=None, type=None, findAll=False, include_subtype=False):
486486
"""
487-
Return the first subsection named *key* of type *type*.
487+
Returns the first subsection named *key* of type *type*.
488488
489489
:param key: string to search against an odML objects name.
490490
:param type: type of an odML object.
@@ -619,7 +619,7 @@ def clean(self):
619619

620620
def clone(self, children=True, keep_id=False):
621621
"""
622-
Clone this object recursively allowing to copy it independently
622+
Clones this object recursively allowing to copy it independently
623623
to another document.
624624
"""
625625
from odml.section import BaseSection

odml/dtypes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def valid_type(dtype):
123123

124124
def get(string, dtype=None):
125125
"""
126-
Convert *string* to the corresponding *dtype*.
126+
Converts *string* to the corresponding *dtype*.
127127
The appropriate function is derived from the provided dtype.
128128
If no dtype is provided, the string conversion function is used by default.
129129
@@ -142,7 +142,7 @@ def get(string, dtype=None):
142142

143143
def set(value, dtype=None):
144144
"""
145-
Serialize a *value* of type *dtype* to a unicode string.
145+
Serializes a *value* of type *dtype* to a unicode string.
146146
The appropriate function is derived from the provided dtype.
147147
148148
:param value: odml specific value to be converted into a string.
@@ -320,7 +320,7 @@ def boolean_get(string):
320320

321321
def tuple_get(string, count=None):
322322
"""
323-
Parse a tuple string like "(1024;768)" and return a list of strings with the
323+
Parses a tuple string like "(1024;768)" and return a list of strings with the
324324
individual tuple elements.
325325
326326
:param string: string to be parsed into odML style tuples.
@@ -339,7 +339,7 @@ def tuple_get(string, count=None):
339339

340340
def tuple_set(value):
341341
"""
342-
Serialize odml style tuples to a string representation.
342+
Serializes odml style tuples to a string representation.
343343
344344
:param value: odml style tuple values.
345345
:return: string.

odml/property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def dtype(self, new_type):
195195
@property
196196
def parent(self):
197197
"""
198-
Returns the Section containing this Property.
198+
The Section containing this Property.
199199
"""
200200
return self._parent
201201

odml/rdf/fuzzy_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self, graph=None, q_params=None):
1919

2020
def find(self, mode="fuzzy", graph=None, q_str=None, q_params=None):
2121
"""
22-
Apply set of queries to the graph and returns info
22+
Applies set of queries to the graph and returns info
2323
that was retrieved from queries.
2424
2525
:param mode: define the type of parser which will be used for parsing

odml/rdf/query_creator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, q_dict=None):
3939
@abstractmethod
4040
def get_query(self, q_str, q_parser):
4141
"""
42-
Construct a SPARQL query from an input string.
42+
Constructs a SPARQL query from an input string.
4343
4444
:param q_str: input string.
4545
:param q_parser: parser to use on the input string.
@@ -65,7 +65,7 @@ def __init__(self):
6565
@abstractmethod
6666
def parse_query_string(self, q_str):
6767
"""
68-
Parse an input string and return a dictionary consumable by a QueryCreator.
68+
Parses an input string and return a dictionary consumable by a QueryCreator.
6969
"""
7070
pass
7171

odml/section.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def new_id(self, oid=None):
134134
@property
135135
def name(self):
136136
"""
137-
Returns the name of the Section.
137+
The name of the Section.
138138
"""
139139
return self._name
140140

@@ -195,7 +195,7 @@ def include(self, new_value):
195195
@property
196196
def link(self):
197197
"""
198-
Specifies a softlink, i.e. a path within the document.
198+
A softlink, i.e. a path within the document.
199199
When the merge()-method is called, the link will be resolved creating
200200
according copies of the section referenced by the link attribute.
201201
When the unmerge() method is called (happens when running clean())
@@ -236,7 +236,7 @@ def link(self, new_value):
236236
@property
237237
def definition(self):
238238
"""
239-
Returns the definition of the Section.
239+
The definition of the Section.
240240
"""
241241
return self._definition
242242

@@ -292,7 +292,7 @@ def sections(self):
292292
@property
293293
def parent(self):
294294
"""
295-
Returns the parent Section, Document or None.
295+
The parent Section, Document or None.
296296
"""
297297
return self._parent
298298

@@ -350,7 +350,7 @@ def get_terminology_equivalent(self):
350350

351351
def get_merged_equivalent(self):
352352
"""
353-
Return the merged object or None.
353+
Returns the merged object or None.
354354
"""
355355
return self._merged
356356

@@ -659,7 +659,7 @@ def create_property(self, name, value=None, dtype=None, oid=None):
659659

660660
def pprint(self, indent=2, max_depth=1, max_length=80, current_depth=0):
661661
"""
662-
Pretty print method to visualize Section-Property trees.
662+
Pretty prints Section-Property trees for nicer visualization.
663663
664664
:param indent: number of leading spaces for every child Section or Property.
665665
:param max_depth: number of maximum child section layers to traverse and print.
@@ -687,7 +687,7 @@ def pprint(self, indent=2, max_depth=1, max_length=80, current_depth=0):
687687

688688
def export_leaf(self):
689689
"""
690-
Export only the path from this section to the root.
690+
Exports only the path from this section to the root.
691691
Include all properties for all sections, but no other subsections.
692692
693693
:returns: cloned odml tree to the root of the current document.

odml/terminology.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
def cache_load(url):
2828
"""
29-
Load the url and store it in a temporary cache directory
29+
Loads the url and store it in a temporary cache directory
3030
subsequent requests for this url will use the cached version.
3131
3232
:param url: URL from where to load an odML terminology file from.
@@ -67,7 +67,7 @@ class Terminologies(dict):
6767

6868
def load(self, url):
6969
"""
70-
Load and cache an odML XML file from a URL.
70+
Loads and caches an odML XML file from a URL.
7171
7272
:param url: location of an odML XML file.
7373
:return: The odML document loaded from url.
@@ -108,7 +108,7 @@ def _load(self, url):
108108

109109
def deferred_load(self, url):
110110
"""
111-
Start a background thread to load an odML XML file from a URL.
111+
Starts a background thread to load an odML XML file from a URL.
112112
113113
:param url: location of an odML XML file.
114114
"""

odml/tools/converters/format_converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FormatConverter(object):
5454
@classmethod
5555
def convert(cls, args=None):
5656
"""
57-
Enable usage of the argparse for calling convert_dir(...)
57+
Enables usage of the argparse for calling convert_dir(...)
5858
5959
Usage:
6060
python -m <in_dir> <odml_out_format> [-out <out_dir>] [-r]
@@ -131,7 +131,7 @@ def convert_dir(cls, input_dir, output_dir, parse_subdirs, res_format):
131131
@classmethod
132132
def _convert_file(cls, input_path, output_path, res_format):
133133
"""
134-
Convert a file from given input_path to res_format. Will raise a ValueError
134+
Converts a file from given input_path to res_format. Will raise a ValueError
135135
if the provided output format (res_format) is not supported.
136136
137137
:param input_path: full path including file name of the file to be converted.

odml/tools/converters/version_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _handle_repository(self, element):
276276

277277
def _handle_properties(self, root):
278278
"""
279-
Method removes all property elements w/o name attribute, converts Value
279+
Removes all property elements without name attribute, converts Value
280280
elements from v1.0 to v1.1 style and removes unsupported Property elements.
281281
282282
:param root: lxml.ElementTree containing a v1.0 odML property list.

odml/tools/dumper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
def get_props(obj, props):
99
"""
10-
get_props retrieves the values of a list of provided properties
10+
Retrieves the values of a list of provided properties
1111
from an object and returns all values as a concatenated string.
1212
1313
:param obj: odml object from which to retrieve specific property values.
@@ -29,7 +29,7 @@ def get_props(obj, props):
2929

3030
def dump_property(prop, indent=1):
3131
"""
32-
dump_property prints the content of an odml.Property.
32+
Prints the content of an odml.Property.
3333
3434
:param prop: odml.Property
3535
:param indent: number of prepended whitespaces. Default is 1.
@@ -42,7 +42,7 @@ def dump_property(prop, indent=1):
4242

4343
def dump_section(section, indent=1):
4444
"""
45-
dump_section prints the content of an odml.Section including any subsections
45+
Prints the content of an odml.Section including any subsections
4646
and odml.Properties.
4747
4848
:param section: odml.Section
@@ -64,7 +64,7 @@ def dump_section(section, indent=1):
6464

6565
def dump_doc(doc):
6666
"""
67-
dump_doc prints the content of an odml.Document including any subsections
67+
Prints the content of an odml.Document including any subsections
6868
and odml.Properties.
6969
7070
:param doc: odml.Section

0 commit comments

Comments
 (0)