Skip to content

Commit 30c1f4e

Browse files
jayvdbnicoweidner
authored andcommitted
Fix spelling and some docstring improvements
Signed-off-by: John Vandenberg <[email protected]>
1 parent a3679d3 commit 30c1f4e

15 files changed

+59
-60
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This library implements SPDX parsers, convertors, validators and handlers in Pyt
1818

1919
- Home: https://github.com/spdx/tools-python
2020
- Issues: https://github.com/spdx/tools-python/issues
21-
- Pypi: https://pypi.python.org/pypi/spdx-tools
21+
- PyPI: https://pypi.python.org/pypi/spdx-tools
2222

2323

2424
# History

Diff for: spdx/creationinfo.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
@total_ordering
2020
class Creator(object):
2121
"""
22-
Creator enity.
22+
Creator entity.
2323
Fields:
2424
- name: creator's name/identifier
2525
"""
2626

2727
def __init__(self, name):
2828
self.name = name
2929

30-
# FIXME: do not overrride eq and not hash
30+
# FIXME: do not override eq and not hash
3131
def __eq__(self, other):
3232
return isinstance(other, Creator) and self.name == other.name
3333

@@ -48,7 +48,7 @@ def __init__(self, name, email=None):
4848
super(Organization, self).__init__(name)
4949
self.email = email
5050

51-
# FIXME: do not overrride eq and not hash
51+
# FIXME: do not override eq and not hash
5252
def __eq__(self, other):
5353
return isinstance(other, Organization) and (self.name, self.email) == (
5454
other.name,
@@ -84,7 +84,7 @@ def __init__(self, name, email=None):
8484
super(Person, self).__init__(name)
8585
self.email = email
8686

87-
# FIXME: do not overrride eq and not hash
87+
# FIXME: do not override eq and not hash
8888
def __eq__(self, other):
8989
return isinstance(other, Person) and (self.name, self.email) == (
9090
other.name,

Diff for: spdx/document.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def from_identifier(cls, identifier):
101101
@classmethod
102102
def from_full_name(cls, full_name):
103103
"""
104-
Returna new License for a full_name. If the full_name exists in
104+
Return a new License for a full_name. If the full_name exists in
105105
config.LICENSE_MAP the identifier is retrieved from it.
106106
Otherwise the identifier is the same as the full_name.
107107
"""
@@ -286,7 +286,7 @@ class Document(object):
286286
- annotations: SPDX document annotation information, Optional zero or more.
287287
Type: Annotation.
288288
- snippet: Snippet information. Optional zero or more. Type: Snippet.
289-
- relationships : Relationship between two SPDX elements. Optional zero or more.
289+
- relationships: Relationship between two SPDX elements. Optional zero or more.
290290
Type: Relationship.
291291
"""
292292

Diff for: spdx/package.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Package(object):
2424
"""
2525
Represent an analyzed Package.
2626
Fields:
27-
- name : Mandatory, string.
27+
- name: Mandatory, string.
2828
- spdx_id: Uniquely identify any element in an SPDX document which may be
2929
referenced by other elements. Mandatory, one. Type: str.
3030
- version: Optional, string.
@@ -47,21 +47,21 @@ class Package(object):
4747
- source_info: Optional string.
4848
- conc_lics: Mandatory spdx.document.License or spdx.utils.SPDXNone or
4949
- spdx.utils.NoAssert.
50-
- license_declared : Mandatory spdx.document.License or spdx.utils.SPDXNone or
51-
- spdx.utils.NoAssert.
52-
- license_comment : optional string.
50+
- license_declared: Mandatory spdx.document.License or spdx.utils.SPDXNone or
51+
spdx.utils.NoAssert.
52+
- license_comment: optional string.
5353
- licenses_from_files: list of spdx.document.License or spdx.utils.SPDXNone or
5454
- spdx.utils.NoAssert.
5555
- cr_text: Copyright text, string , utils.NoAssert or utils.SPDXNone. Mandatory.
5656
- summary: Optional str.
5757
- description: Optional str.
5858
- comment: Comments about the package being described, optional one.
5959
Type: str
60-
- files: List of files in package, atleast one.
61-
- verif_exc_files : list of file names excluded from verification code or None.
62-
- ext_pkg_refs : External references referenced within the given package.
60+
- files: List of files in package, at least one.
61+
- verif_exc_files: list of file names excluded from verification code or None.
62+
- ext_pkg_refs: External references referenced within the given package.
6363
Optional, one or many. Type: ExternalPackageRef
64-
- attribution_text : optional string.
64+
- attribution_text: optional string.
6565
"""
6666

6767
def __init__(

Diff for: spdx/parsers/jsonyamlxml.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def parse_relationships(self, relationships):
452452
def parse_relationship(self, spdxelementid, relationshiptype, relatedspdxelement):
453453
"""
454454
Parse Relationshiptype, spdxElementId and relatedSpdxElement
455-
- relationship : Python str/unicode
455+
- relationship: Python str/unicode
456456
"""
457457
if isinstance(relationshiptype, str):
458458
relate = spdxelementid + " " + relationshiptype + " " + relatedspdxelement
@@ -555,7 +555,7 @@ def parse_snippet_comment(self, snippet_comment):
555555
def parse_snippet_attribution_text(self, snippet_attribution_texts):
556556
"""
557557
Parse Snippet attribution texts
558-
- snippet_attribution_texts : list in yaml, json and string in xml format
558+
- snippet_attribution_texts: list in yaml, json and string in xml format
559559
"""
560560
if isinstance(snippet_attribution_texts, list) or isinstance(
561561
snippet_attribution_texts, str
@@ -882,7 +882,7 @@ def parse_file_license_comments(self, license_comments):
882882
def parse_file_attribution_text(self, file_attribution_texts):
883883
"""
884884
Parse File attribution texts
885-
- file_attribution_texts : list in yaml, json and string in xml format
885+
- file_attribution_texts: list in yaml, json and string in xml format
886886
"""
887887
if isinstance(file_attribution_texts, list) or isinstance(
888888
file_attribution_texts, str
@@ -1357,7 +1357,7 @@ def parse_pkg_license_info_from_files(self, license_info_from_files):
13571357
def parse_pkg_attribution_text(self, pkg_attribution_texts):
13581358
"""
13591359
Parse Package attribution texts
1360-
- pkg_attribution_texts : list in yaml, json and string in xml format
1360+
- pkg_attribution_texts: list in yaml, json and string in xml format
13611361
"""
13621362
if isinstance(pkg_attribution_texts, list) or isinstance(
13631363
pkg_attribution_texts, str
@@ -1579,7 +1579,7 @@ def parse(self):
15791579

15801580
validation_messages = ErrorMessages()
15811581
# Report extra errors if self.error is False otherwise there will be
1582-
# redundent messages
1582+
# redundant messages
15831583
validation_messages = self.document.validate(validation_messages)
15841584
if not self.error:
15851585
if validation_messages:

Diff for: spdx/parsers/loggers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self):
3030
self.context = []
3131

3232
def push_context(self, context):
33-
"""push some context information to better indentify where is the problem"""
33+
"""push some context information to better identify where is the problem"""
3434
self.context.append(context)
3535

3636
def pop_context(self):

Diff for: spdx/parsers/parse_anything.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222

2323

2424
def parse_file(fn):
25-
buildermodule = jsonyamlxmlbuilders
25+
builder_module = jsonyamlxmlbuilders
2626
read_data = False
2727
if fn.endswith(".rdf") or fn.endswith(".rdf.xml"):
2828
parsing_module = rdf
29-
buildermodule = rdfbuilders
29+
builder_module = rdfbuilders
3030
elif fn.endswith(".tag") or fn.endswith(".spdx"):
3131
parsing_module = tagvalue
32-
buildermodule = tagvaluebuilders
32+
builder_module = tagvaluebuilders
3333
read_data = True
3434
elif fn.endswith(".json"):
3535
parsing_module = jsonparser
@@ -40,7 +40,7 @@ def parse_file(fn):
4040
else:
4141
raise FileTypeError("FileType Not Supported" + str(fn))
4242

43-
p = parsing_module.Parser(buildermodule.Builder(), StandardLogger())
43+
p = parsing_module.Parser(builder_module.Builder(), StandardLogger())
4444
if hasattr(p, "build"):
4545
p.build()
4646
with open(fn) as f:

Diff for: spdx/parsers/rdf.py

+17-17
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"PKG_DOWN_LOC": "Invalid package download location value '{0}' must be a url or NONE or NOASSERTION",
4444
"PKG_FILES_ANALYZED_VALUE": "FilesAnalyzed must be a boolean value, line: {0}",
4545
"PKG_CONC_LIST": "Package concluded license list must have more than one member",
46-
"LICS_LIST_MEMBER": "Declaritive or Conjunctive license set member must be a license url or identifier",
46+
"LICS_LIST_MEMBER": "Declarative or Conjunctive license set member must be a license url or identifier",
4747
"PKG_SINGLE_LICS": "Package concluded license must be a license url or spdx:noassertion or spdx:none.",
4848
"PKG_LICS_INFO_FILES": "Package licenseInfoFromFiles must be a license or spdx:none or spdx:noassertion",
4949
"FILE_SPDX_ID_VALUE": 'SPDXID must be "SPDXRef-[idstring]" where [idstring] is a unique string containing '
@@ -159,43 +159,43 @@ def get_extr_license_ident(self, extr_lic):
159159
"""
160160
Return a license identifier from an ExtractedLicense or None.
161161
"""
162-
identifier_tripples = list(
162+
identifier_triples = list(
163163
self.graph.triples((extr_lic, self.spdx_namespace["licenseId"], None))
164164
)
165165

166-
if not identifier_tripples:
166+
if not identifier_triples:
167167
self.error = True
168168
msg = "Extracted license must have licenseId property."
169169
self.logger.log(msg)
170170
return
171171

172-
if len(identifier_tripples) > 1:
173-
self.more_than_one_error("extracted license identifier_tripples")
172+
if len(identifier_triples) > 1:
173+
self.more_than_one_error("extracted license identifier_triples")
174174
return
175175

176-
identifier_tripple = identifier_tripples[0]
177-
_s, _p, identifier = identifier_tripple
176+
identifier_triple = identifier_triples[0]
177+
_s, _p, identifier = identifier_triple
178178
return str(identifier)
179179

180180
def get_extr_license_text(self, extr_lic):
181181
"""
182182
Return extracted text from an ExtractedLicense or None.
183183
"""
184-
text_tripples = list(
184+
text_triples = list(
185185
self.graph.triples((extr_lic, self.spdx_namespace["extractedText"], None))
186186
)
187-
if not text_tripples:
187+
if not text_triples:
188188
self.error = True
189189
msg = "Extracted license must have extractedText property"
190190
self.logger.log(msg)
191191
return
192192

193-
if len(text_tripples) > 1:
193+
if len(text_triples) > 1:
194194
self.more_than_one_error("extracted license text")
195195
return
196196

197-
text_tripple = text_tripples[0]
198-
_s, _p, text = text_tripple
197+
text_triple = text_triples[0]
198+
_s, _p, text = text_triple
199199
return str(text)
200200

201201
def get_extr_lic_name(self, extr_lic):
@@ -250,7 +250,7 @@ def parse_only_extr_license(self, extr_lic):
250250
return
251251

252252
# Set fields
253-
# FIXME: the constructor of the license should alwas accept a name
253+
# FIXME: the constructor of the license should always accept a name
254254
lic = document.ExtractedLicense(ident)
255255
if text is not None:
256256
lic.text = text
@@ -318,7 +318,7 @@ def parse_package(self, p_term):
318318
"""
319319
Parse package fields.
320320
"""
321-
# Check there is a pacakge name
321+
# Check there is a package name
322322
if not (p_term, self.spdx_namespace["name"], None) in self.graph:
323323
self.error = True
324324
self.logger.log("Package must have a name.")
@@ -478,7 +478,7 @@ def p_pkg_verif_code(self, p_term, predicate):
478478
try:
479479
self.builder.set_pkg_verif_code(self.doc, str(code))
480480
except CardinalityError:
481-
self.more_than_one_error("package verificaton code")
481+
self.more_than_one_error("package verification code")
482482
break
483483
# Parse excluded file
484484
for _, _, filename in self.graph.triples(
@@ -491,7 +491,7 @@ def p_pkg_verif_code(self, p_term, predicate):
491491
try:
492492
self.builder.set_pkg_excl_file(self.doc, str(filename))
493493
except CardinalityError:
494-
self.more_than_one_error("package verificaton code excluded file")
494+
self.more_than_one_error("package verification code excluded file")
495495
break
496496

497497
def p_pkg_src_info(self, p_term, predicate):
@@ -979,7 +979,7 @@ def get_review_date(self, r_term):
979979
)
980980
if len(reviewed_list) != 1:
981981
self.error = True
982-
msg = "Review must have exactlyone review date"
982+
msg = "Review must have exactly one review date"
983983
self.logger.log(msg)
984984
return
985985
return str(reviewed_list[0][2])

Diff for: spdx/parsers/tagvalue.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"FILE_CONTRIB_VALUE": "FileContributor must be a single line, line: {0}",
9393
"FILE_DEP_VALUE": "FileDependency must be a single line, line: {0}",
9494
"ART_PRJ_NAME_VALUE": "ArtifactOfProjectName must be a single line, line: {0}",
95-
"FILE_ART_OPT_ORDER": "ArtificatOfProjectHomePage and ArtificatOfProjectURI must immediatly follow ArtifactOfProjectName, line: {0}",
95+
"FILE_ART_OPT_ORDER": "ArtificatOfProjectHomePage and ArtificatOfProjectURI must immediately follow ArtifactOfProjectName, line: {0}",
9696
"ART_PRJ_HOME_VALUE": "ArtificatOfProjectHomePage must be a URL or UNKNOWN, line: {0}",
9797
"ART_PRJ_URI_VALUE": "ArtificatOfProjectURI must be a URI or UNKNOWN, line: {0}",
9898
"UNKNOWN_TAG": "Found unknown tag : {0} at line: {1}",
@@ -310,7 +310,7 @@ def p_extr_lic_id_2(self, p):
310310
msg = ERROR_MESSAGES["LICS_ID_VALUE"].format(p.lineno(1))
311311
self.logger.log(msg)
312312

313-
def p_uknown_tag(self, p):
313+
def p_unknown_tag(self, p):
314314
"""unknown_tag : UNKNOWN_TAG LINE"""
315315
self.error = True
316316
msg = ERROR_MESSAGES["UNKNOWN_TAG"].format(p[1], p.lineno(1))
@@ -322,7 +322,7 @@ def p_file_artifact_1(self, p):
322322
"""
323323
pass
324324

325-
def p_file_artificat_2(self, p):
325+
def p_file_artifact_2(self, p):
326326
"""file_artifact : prj_name_art error"""
327327
self.error = True
328328
msg = ERROR_MESSAGES["FILE_ART_OPT_ORDER"].format(p.lineno(2))

Diff for: spdx/parsers/tagvaluebuilders.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def build_org(self, doc, entity):
233233
"""
234234
Build an organization object of of a string representation.
235235
Return built organization.
236-
Raise SPDXValueError if failed to extractname.
236+
Raise SPDXValueError if failed to extract name.
237237
"""
238238
match = self.org_re.match(entity)
239239
if match and validations.validate_org_name(match.group(self.ORG_NAME_GROUP)):
@@ -359,7 +359,7 @@ def reset_reviews(self):
359359
def add_reviewer(self, doc, reviewer):
360360
"""
361361
Adds a reviewer to the SPDX Document.
362-
Reviwer is an entity created by an EntityBuilder.
362+
Reviewer is an entity created by an EntityBuilder.
363363
Raise SPDXValueError if not a valid reviewer type.
364364
"""
365365
# Each reviewer marks the start of a new review object.
@@ -644,7 +644,7 @@ def set_pkg_file_name(self, doc, name):
644644
Set the package file name, if not already set.
645645
name - Any string.
646646
Raise CardinalityError if already has a file_name.
647-
Raise OrderError if no pacakge previously defined.
647+
Raise OrderError if no package previously defined.
648648
"""
649649
self.assert_package_exists()
650650
if not self.package_file_name_set:
@@ -800,7 +800,7 @@ def set_pkg_source_info(self, doc, text):
800800
doc.packages[-1].source_info = str_from_text(text)
801801
return True
802802
else:
803-
raise SPDXValueError("Pacckage::SourceInfo")
803+
raise SPDXValueError("Package::SourceInfo")
804804
else:
805805
raise CardinalityError("Package::SourceInfo")
806806

@@ -1248,13 +1248,13 @@ def add_file_dep(self, doc, value):
12481248

12491249
def set_file_atrificat_of_project(self, doc, symbol, value):
12501250
"""
1251-
Set a file name, uri or home artificat.
1251+
Set a file name, uri or home artifact.
12521252
Raise OrderError if no package or file defined.
12531253
"""
12541254
if self.has_package(doc) and self.has_file(doc):
12551255
self.file(doc).add_artifact(symbol, value)
12561256
else:
1257-
raise OrderError("File::Artificat")
1257+
raise OrderError("File::Artifact")
12581258

12591259
def file(self, doc):
12601260
"""

Diff for: spdx/relationship.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Relationship(object):
7575
Document relationship information
7676
Fields:
7777
- relationship: provides information about the relationship between two SPDX elements.
78-
- relationship_comment : place for the SPDX file creator to record any general comments. Optional, One
78+
- relationship_comment: place for the SPDX file creator to record any general comments. Optional, One
7979
"""
8080

8181
def __init__(self, relationship=None, relationship_comment=None):

Diff for: spdx/snippet.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ class Snippet(object):
2727
in to arriving at the Concluded License for a snippet. Optional, one.
2828
- snip_from_file_spdxid: Uniquely identify the file in an SPDX document
2929
which this snippet is associated with. Mandatory, one. Type: str.
30-
Type: str.
3130
- conc_lics: Contains the license the SPDX file creator has concluded as
3231
governing the snippet or alternative values if the governing license
3332
cannot be determined. Mandatory one. Type: document.License or
3433
utils.NoAssert or utils.SPDXNone.
3534
- licenses_in_snippet: The list of licenses found in the snippet.
3635
Mandatory, one or more. Type: document.License or utils.SPDXNone or
3736
utils.NoAssert.
38-
- attribution_text : optional string.
37+
- attribution_text: optional string.
3938
"""
4039

4140
def __init__(

0 commit comments

Comments
 (0)