_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q254300 | datetime_from_iso_format | validation | def datetime_from_iso_format(string):
"""
Return a datetime object from an iso 8601 representation.
Return None if string is non conforming.
"""
match = DATE_ISO_REGEX.match(string)
if match:
date = datetime.datetime(year=int(match.group(DATE_ISO_YEAR_GRP)),
month=int(match.group(DATE_ISO_MONTH_GRP)),
day=int(match.group(DATE_ISO_DAY_GRP)),
| python | {
"resource": ""
} |
q254301 | LicenseListParser.build | validation | def build(self, **kwargs):
"""Must be called before parse."""
| python | {
"resource": ""
} |
q254302 | LicenseListParser.parse | validation | def parse(self, data):
"""Parses a license list and returns a License or None if it failed."""
try:
| python | {
"resource": ""
} |
q254303 | write_document | validation | def write_document(document, out, validate=True):
"""
Write an SPDX RDF document.
- document - spdx.document instance.
- out - file like object that will be written to.
Optionally `validate` the document before writing and raise
InvalidDocumentError if document.validate returns False.
"""
if validate:
| python | {
"resource": ""
} |
q254304 | BaseWriter.create_checksum_node | validation | def create_checksum_node(self, chksum):
"""
Return a node representing spdx.checksum.
"""
chksum_node = BNode()
type_triple = (chksum_node, RDF.type, self.spdx_namespace.Checksum)
self.graph.add(type_triple)
algorithm_triple = (chksum_node, self.spdx_namespace.algorithm, | python | {
"resource": ""
} |
q254305 | BaseWriter.to_special_value | validation | def to_special_value(self, value):
"""
Return proper spdx term or Literal
"""
if isinstance(value, utils.NoAssert):
return self.spdx_namespace.noassertion
| python | {
"resource": ""
} |
q254306 | LicenseWriter.licenses_from_tree | validation | def licenses_from_tree(self, tree):
"""
Traverse conjunctions and disjunctions like trees and return a
set of all licenses in it as nodes.
"""
# FIXME: this is unordered!
| python | {
"resource": ""
} |
q254307 | LicenseWriter.create_conjunction_node | validation | def create_conjunction_node(self, conjunction):
"""
Return a node representing a conjunction of licenses.
"""
node = BNode()
type_triple = (node, RDF.type, self.spdx_namespace.ConjunctiveLicenseSet)
self.graph.add(type_triple)
| python | {
"resource": ""
} |
q254308 | LicenseWriter.create_disjunction_node | validation | def create_disjunction_node(self, disjunction):
"""
Return a node representing a disjunction of licenses.
"""
node = BNode()
type_triple = (node, RDF.type, self.spdx_namespace.DisjunctiveLicenseSet)
self.graph.add(type_triple)
| python | {
"resource": ""
} |
q254309 | LicenseWriter.create_extracted_license | validation | def create_extracted_license(self, lic):
"""
Handle extracted license.
Return the license node.
"""
licenses = list(self.graph.triples((None, self.spdx_namespace.licenseId, lic.identifier)))
if len(licenses) != 0:
return licenses[0][0] # return subject in first triple
else:
license_node = BNode()
type_triple = (license_node, RDF.type, self.spdx_namespace.ExtractedLicensingInfo)
self.graph.add(type_triple)
ident_triple = (license_node, self.spdx_namespace.licenseId, Literal(lic.identifier))
self.graph.add(ident_triple)
text_triple = (license_node, self.spdx_namespace.extractedText, Literal(lic.text))
self.graph.add(text_triple)
if lic.full_name is not None:
| python | {
"resource": ""
} |
q254310 | FileWriter.create_file_node | validation | def create_file_node(self, doc_file):
"""
Create a node for spdx.file.
"""
file_node = URIRef('http://www.spdx.org/files#{id}'.format(
id=str(doc_file.spdx_id)))
type_triple = (file_node, RDF.type, self.spdx_namespace.File)
self.graph.add(type_triple)
name_triple = (file_node, self.spdx_namespace.fileName, Literal(doc_file.name))
self.graph.add(name_triple)
if doc_file.has_optional_field('comment'):
comment_triple = (file_node, RDFS.comment, Literal(doc_file.comment))
self.graph.add(comment_triple)
if doc_file.has_optional_field('type'):
ftype = self.spdx_namespace[self.FILE_TYPES[doc_file.type]]
ftype_triple = (file_node, self.spdx_namespace.fileType, ftype)
self.graph.add(ftype_triple)
self.graph.add((file_node, self.spdx_namespace.checksum, self.create_checksum_node(doc_file.chk_sum)))
| python | {
"resource": ""
} |
q254311 | FileWriter.add_file_dependencies_helper | validation | def add_file_dependencies_helper(self, doc_file):
"""
Handle dependencies for a single file.
- doc_file - instance of spdx.file.File.
"""
subj_triples = list(self.graph.triples((None, self.spdx_namespace.fileName, Literal(doc_file.name))))
if len(subj_triples) != 1:
raise InvalidDocumentError('Could not find dependency subject {0}'.format(doc_file.name))
subject_node = subj_triples[0][0]
for dependency in doc_file.dependencies:
dep_triples = list(self.graph.triples((None, self.spdx_namespace.fileName, Literal(dependency))))
if len(dep_triples) == 1:
| python | {
"resource": ""
} |
q254312 | ReviewInfoWriter.create_review_node | validation | def create_review_node(self, review):
"""
Return a review node.
"""
review_node = BNode()
type_triple = (review_node, RDF.type, self.spdx_namespace.Review)
self.graph.add(type_triple)
reviewer_node = Literal(review.reviewer.to_value())
self.graph.add((review_node, self.spdx_namespace.reviewer, reviewer_node)) | python | {
"resource": ""
} |
q254313 | AnnotationInfoWriter.create_annotation_node | validation | def create_annotation_node(self, annotation):
"""
Return an annotation node.
"""
annotation_node = URIRef(str(annotation.spdx_id))
type_triple = (annotation_node, RDF.type, self.spdx_namespace.Annotation)
self.graph.add(type_triple)
annotator_node = Literal(annotation.annotator.to_value())
self.graph.add((annotation_node, self.spdx_namespace.annotator, annotator_node))
annotation_date_node = Literal(annotation.annotation_date_iso_format)
| python | {
"resource": ""
} |
q254314 | PackageWriter.package_verif_node | validation | def package_verif_node(self, package):
"""
Return a node representing package verification code.
"""
verif_node = BNode()
type_triple = (verif_node, RDF.type, self.spdx_namespace.PackageVerificationCode)
self.graph.add(type_triple)
value_triple = (verif_node, self.spdx_namespace.packageVerificationCodeValue, Literal(package.verif_code))
self.graph.add(value_triple)
excl_file_nodes = map(
lambda excl: Literal(excl), | python | {
"resource": ""
} |
q254315 | PackageWriter.handle_pkg_optional_fields | validation | def handle_pkg_optional_fields(self, package, package_node):
"""
Write package optional fields.
"""
self.handle_package_literal_optional(package, package_node, self.spdx_namespace.versionInfo, 'version')
self.handle_package_literal_optional(package, package_node, self.spdx_namespace.packageFileName, 'file_name')
self.handle_package_literal_optional(package, package_node, self.spdx_namespace.supplier, 'supplier')
self.handle_package_literal_optional(package, package_node, self.spdx_namespace.originator, 'originator')
self.handle_package_literal_optional(package, package_node, self.spdx_namespace.sourceInfo, 'source_info')
self.handle_package_literal_optional(package, package_node, self.spdx_namespace.licenseComments, 'license_comment')
self.handle_package_literal_optional(package, package_node, self.spdx_namespace.summary, 'summary')
self.handle_package_literal_optional(package, | python | {
"resource": ""
} |
q254316 | PackageWriter.create_package_node | validation | def create_package_node(self, package):
"""
Return a Node representing the package.
Files must have been added to the graph before this method is called.
"""
package_node = BNode()
type_triple = (package_node, RDF.type, self.spdx_namespace.Package)
self.graph.add(type_triple)
# Handle optional fields:
self.handle_pkg_optional_fields(package, package_node)
# package name
name_triple = (package_node, self.spdx_namespace.name, Literal(package.name))
self.graph.add(name_triple)
# Package download location
down_loc_node = (package_node, self.spdx_namespace.downloadLocation, self.to_special_value(package.download_location))
self.graph.add(down_loc_node)
# Handle package verification
verif_node = self.package_verif_node(package)
verif_triple = (package_node, self.spdx_namespace.packageVerificationCode, verif_node)
self.graph.add(verif_triple)
# Handle concluded license
conc_lic_node = self.license_or_special(package.conc_lics)
conc_lic_triple = (package_node, self.spdx_namespace.licenseConcluded, conc_lic_node)
self.graph.add(conc_lic_triple)
# Handle declared license
| python | {
"resource": ""
} |
q254317 | PackageWriter.handle_package_has_file_helper | validation | def handle_package_has_file_helper(self, pkg_file):
"""
Return node representing pkg_file
pkg_file should be instance of spdx.file.
"""
nodes = list(self.graph.triples((None, self.spdx_namespace.fileName, Literal(pkg_file.name))))
if len(nodes) == 1:
return nodes[0][0]
| python | {
"resource": ""
} |
q254318 | PackageWriter.handle_package_has_file | validation | def handle_package_has_file(self, package, package_node):
"""
Add hasFile triples to graph.
Must be called after files have been added.
"""
file_nodes = map(self.handle_package_has_file_helper, package.files) | python | {
"resource": ""
} |
q254319 | Writer.create_doc | validation | def create_doc(self):
"""
Add and return the root document node to graph.
"""
doc_node = URIRef('http://www.spdx.org/tools#SPDXRef-DOCUMENT')
# Doc type
self.graph.add((doc_node, RDF.type, self.spdx_namespace.SpdxDocument))
# Version
vers_literal = Literal(str(self.document.version))
self.graph.add((doc_node, self.spdx_namespace.specVersion, vers_literal))
# Data license
| python | {
"resource": ""
} |
q254320 | CreationInfo.validate | validation | def validate(self, messages):
"""Returns True if the fields are valid according to the SPDX standard.
Appends user friendly messages to the messages parameter.
"""
| python | {
"resource": ""
} |
q254321 | BaseParser.value_error | validation | def value_error(self, key, bad_value):
"""Reports a value error using ERROR_MESSAGES dict.
key - key to use for ERROR_MESSAGES.
bad_value - is passed to format which is called on what key maps to
in ERROR_MESSAGES.
| python | {
"resource": ""
} |
q254322 | BaseParser.to_special_value | validation | def to_special_value(self, value):
"""Checks if value is a special SPDX value such as
NONE, NOASSERTION or UNKNOWN if so returns proper model.
else returns value"""
if value == self.spdx_namespace.none:
return utils.SPDXNone()
elif value == self.spdx_namespace.noassertion:
| python | {
"resource": ""
} |
q254323 | LicenseParser.handle_lics | validation | def handle_lics(self, lics):
"""
Return a License from a `lics` license resource.
"""
# Handle extracted licensing info type.
if (lics, RDF.type, self.spdx_namespace['ExtractedLicensingInfo']) in self.graph:
return self.parse_only_extr_license(lics)
# Assume resource, hence the path separator
ident_start = lics.rfind('/') + 1
if ident_start == 0:
# special values such as spdx:noassertion
special = self.to_special_value(lics)
if special == lics:
if self.LICS_REF_REGEX.match(lics):
| python | {
"resource": ""
} |
q254324 | LicenseParser.get_extr_license_ident | validation | def get_extr_license_ident(self, extr_lic):
"""
Return an a license identifier from an ExtractedLicense or None.
"""
identifier_tripples = list(self.graph.triples((extr_lic, self.spdx_namespace['licenseId'], None)))
if not identifier_tripples:
self.error = True
msg = 'Extracted license must have licenseId property.'
self.logger.log(msg)
return
if len(identifier_tripples) > | python | {
"resource": ""
} |
q254325 | LicenseParser.get_extr_license_text | validation | def get_extr_license_text(self, extr_lic):
"""
Return extracted text from an ExtractedLicense or None.
"""
text_tripples = list(self.graph.triples((extr_lic, self.spdx_namespace['extractedText'], None)))
if not text_tripples:
| python | {
"resource": ""
} |
q254326 | LicenseParser.get_extr_lic_name | validation | def get_extr_lic_name(self, extr_lic):
"""
Return the license name from an ExtractedLicense or None
"""
extr_name_list = list(self.graph.triples((extr_lic, self.spdx_namespace['licenseName'], None)))
if len(extr_name_list) > 1:
| python | {
"resource": ""
} |
q254327 | LicenseParser.get_extr_lics_xref | validation | def get_extr_lics_xref(self, extr_lic):
"""
Return a list of cross references.
"""
xrefs = list(self.graph.triples((extr_lic, | python | {
"resource": ""
} |
q254328 | LicenseParser.get_extr_lics_comment | validation | def get_extr_lics_comment(self, extr_lics):
"""
Return license comment or None.
"""
comment_list = list(self.graph.triples(
(extr_lics, RDFS.comment, None)))
if len(comment_list) > 1 :
| python | {
"resource": ""
} |
q254329 | LicenseParser.parse_only_extr_license | validation | def parse_only_extr_license(self, extr_lic):
"""
Return an ExtractedLicense object to represent a license object.
But does not add it to the SPDXDocument model.
Return None if failed.
"""
# Grab all possible values
ident = self.get_extr_license_ident(extr_lic)
text = self.get_extr_license_text(extr_lic)
comment = self.get_extr_lics_comment(extr_lic)
xrefs = self.get_extr_lics_xref(extr_lic)
name = self.get_extr_lic_name(extr_lic)
if not ident:
# Must have identifier
return
# | python | {
"resource": ""
} |
q254330 | LicenseParser.handle_extracted_license | validation | def handle_extracted_license(self, extr_lic):
"""
Build and return an ExtractedLicense or None.
Note that this function adds the license to the document.
"""
| python | {
"resource": ""
} |
q254331 | PackageParser.parse_package | validation | def parse_package(self, p_term):
"""Parses package fields."""
# Check there is a pacakge name
if not (p_term, self.spdx_namespace['name'], None) in self.graph:
self.error = True
self.logger.log('Package must have a name.')
# Create dummy package so that we may continue parsing the rest of
# the package fields.
self.builder.create_package(self.doc, 'dummy_package')
else:
for _s, _p, o in self.graph.triples((p_term, self.spdx_namespace['name'], None)):
try:
self.builder.create_package(self.doc, six.text_type(o))
except CardinalityError:
self.more_than_one_error('Package name')
break
self.p_pkg_vinfo(p_term, self.spdx_namespace['versionInfo'])
self.p_pkg_fname(p_term, self.spdx_namespace['packageFileName'])
self.p_pkg_suppl(p_term, self.spdx_namespace['supplier'])
self.p_pkg_originator(p_term, self.spdx_namespace['originator'])
self.p_pkg_down_loc(p_term, self.spdx_namespace['downloadLocation'])
self.p_pkg_homepg(p_term, self.doap_namespace['homepage'])
self.p_pkg_chk_sum(p_term, self.spdx_namespace['checksum'])
| python | {
"resource": ""
} |
q254332 | PackageParser.handle_pkg_lic | validation | def handle_pkg_lic(self, p_term, predicate, builder_func):
"""Handles package lics concluded or declared."""
try:
for _, _, licenses in self.graph.triples((p_term, predicate, None)):
if (licenses, RDF.type, self.spdx_namespace['ConjunctiveLicenseSet']) in self.graph:
lics = self.handle_conjunctive_list(licenses)
builder_func(self.doc, lics)
| python | {
"resource": ""
} |
q254333 | FileParser.get_file_name | validation | def get_file_name(self, f_term):
"""Returns first found fileName property or None if not found.""" | python | {
"resource": ""
} |
q254334 | FileParser.p_file_depends | validation | def p_file_depends(self, f_term, predicate):
"""Sets file dependencies."""
for _, _, other_file in self.graph.triples((f_term, predicate, None)):
name = self.get_file_name(other_file)
if name is not None:
self.builder.add_file_dep(six.text_type(name))
| python | {
"resource": ""
} |
q254335 | FileParser.p_file_contributor | validation | def p_file_contributor(self, f_term, predicate):
"""
Parse all file contributors and adds them to the model.
"""
for | python | {
"resource": ""
} |
q254336 | FileParser.p_file_notice | validation | def p_file_notice(self, f_term, predicate):
"""Sets file notice text."""
try:
for _, _, notice in self.graph.triples((f_term, predicate, None)):
| python | {
"resource": ""
} |
q254337 | FileParser.p_file_comment | validation | def p_file_comment(self, f_term, predicate):
"""Sets file comment text."""
try:
for _, _, comment in self.graph.triples((f_term, predicate, None)):
| python | {
"resource": ""
} |
q254338 | FileParser.p_file_cr_text | validation | def p_file_cr_text(self, f_term, predicate):
"""Sets file copyright text."""
try:
for _, _, cr_text in self.graph.triples((f_term, predicate, None)):
| python | {
"resource": ""
} |
q254339 | FileParser.p_file_comments_on_lics | validation | def p_file_comments_on_lics(self, f_term, predicate):
"""Sets file license comment."""
try:
for _, _, comment in self.graph.triples((f_term, predicate, None)):
| python | {
"resource": ""
} |
q254340 | FileParser.p_file_lic_info | validation | def p_file_lic_info(self, f_term, predicate):
"""Sets file license information."""
for _, _, info in self.graph.triples((f_term, predicate, None)):
lic = self.handle_lics(info)
| python | {
"resource": ""
} |
q254341 | FileParser.p_file_type | validation | def p_file_type(self, f_term, predicate):
"""Sets file type."""
try:
for _, _, ftype in self.graph.triples((f_term, predicate, None)):
try:
if ftype.endswith('binary'):
ftype = 'BINARY'
elif ftype.endswith('source'):
| python | {
"resource": ""
} |
q254342 | FileParser.p_file_chk_sum | validation | def p_file_chk_sum(self, f_term, predicate):
"""Sets file checksum. Assumes SHA1 algorithm without checking."""
try:
for _s, _p, checksum in self.graph.triples((f_term, predicate, None)):
for _, _, value in self.graph.triples((checksum, self.spdx_namespace['checksumValue'], None)):
| python | {
"resource": ""
} |
q254343 | FileParser.p_file_lic_conc | validation | def p_file_lic_conc(self, f_term, predicate):
"""Sets file licenses concluded."""
try:
for _, _, licenses in self.graph.triples((f_term, predicate, None)):
if (licenses, RDF.type, self.spdx_namespace['ConjunctiveLicenseSet']) in self.graph:
lics = self.handle_conjunctive_list(licenses)
self.builder.set_concluded_license(self.doc, lics)
| python | {
"resource": ""
} |
q254344 | ReviewParser.get_review_date | validation | def get_review_date(self, r_term):
"""Returns review date or None if not found.
Reports error on failure.
Note does not check value format.
"""
reviewed_list = list(self.graph.triples((r_term, self.spdx_namespace['reviewDate'], None)))
if len(reviewed_list) != 1:
self.error = True
| python | {
"resource": ""
} |
q254345 | ReviewParser.get_reviewer | validation | def get_reviewer(self, r_term):
"""Returns reviewer as creator object or None if failed.
Reports errors on failure.
"""
reviewer_list = list(self.graph.triples((r_term, self.spdx_namespace['reviewer'], None)))
if len(reviewer_list) != 1:
self.error = True
msg = 'Review must have exactly one reviewer'
self.logger.log(msg)
return
| python | {
"resource": ""
} |
q254346 | AnnotationParser.get_annotation_type | validation | def get_annotation_type(self, r_term):
"""Returns annotation type or None if found none or more than one.
Reports errors on failure."""
for _, _, typ in self.graph.triples((
r_term, self.spdx_namespace['annotationType'], None)):
if typ is not None:
return typ
else:
| python | {
"resource": ""
} |
q254347 | AnnotationParser.get_annotation_comment | validation | def get_annotation_comment(self, r_term):
"""Returns annotation comment or None if found none or more than one.
Reports errors.
"""
comment_list = list(self.graph.triples((r_term, RDFS.comment, None)))
if len(comment_list) > 1:
self.error = True
| python | {
"resource": ""
} |
q254348 | AnnotationParser.get_annotation_date | validation | def get_annotation_date(self, r_term):
"""Returns annotation date or None if not found.
Reports error on failure.
Note does not check value format.
"""
annotation_date_list = list(self.graph.triples((r_term, self.spdx_namespace['annotationDate'], None)))
if len(annotation_date_list) != 1:
self.error = True
| python | {
"resource": ""
} |
q254349 | Parser.parse | validation | def parse(self, fil):
"""Parses a file and returns a document object.
File, a file like object.
"""
self.error = False
self.graph = Graph()
self.graph.parse(file=fil, format='xml')
self.doc = document.Document()
for s, _p, o in self.graph.triples((None, RDF.type, self.spdx_namespace['SpdxDocument'])):
self.parse_doc_fields(s)
for s, _p, o in self.graph.triples((None, RDF.type, self.spdx_namespace['ExternalDocumentRef'])):
self.parse_ext_doc_ref(s)
for s, _p, o in self.graph.triples((None, RDF.type, self.spdx_namespace['CreationInfo'])):
self.parse_creation_info(s)
for s, _p, o in self.graph.triples((None, RDF.type, self.spdx_namespace['Package'])):
self.parse_package(s)
for s, _p, o in self.graph.triples((None, self.spdx_namespace['referencesFile'], None)):
self.parse_file(o)
| python | {
"resource": ""
} |
q254350 | Parser.parse_creation_info | validation | def parse_creation_info(self, ci_term):
"""
Parse creators, created and comment.
"""
for _s, _p, o in self.graph.triples((ci_term, self.spdx_namespace['creator'], None)):
try:
ent = self.builder.create_entity(self.doc, six.text_type(o))
self.builder.add_creator(self.doc, ent)
except SPDXValueError:
self.value_error('CREATOR_VALUE', o)
for _s, _p, o in self.graph.triples((ci_term, self.spdx_namespace['created'], None)):
try:
self.builder.set_created_date(self.doc, six.text_type(o))
except SPDXValueError:
self.value_error('CREATED_VALUE', o)
except CardinalityError:
self.more_than_one_error('created')
break
for _s, _p, o in self.graph.triples((ci_term, RDFS.comment, None)):
try:
self.builder.set_creation_comment(self.doc, six.text_type(o))
except CardinalityError:
| python | {
"resource": ""
} |
q254351 | Parser.parse_doc_fields | validation | def parse_doc_fields(self, doc_term):
"""Parses the version, data license, name, SPDX Identifier, namespace,
and comment."""
try:
self.builder.set_doc_spdx_id(self.doc, doc_term)
except SPDXValueError:
self.value_error('DOC_SPDX_ID_VALUE', doc_term)
try:
if doc_term.count('#', 0, len(doc_term)) <= 1:
doc_namespace = doc_term.split('#')[0]
self.builder.set_doc_namespace(self.doc, doc_namespace)
else:
self.value_error('DOC_NAMESPACE_VALUE', doc_term)
except SPDXValueError:
self.value_error('DOC_NAMESPACE_VALUE', doc_term)
for _s, _p, o in self.graph.triples((doc_term, self.spdx_namespace['specVersion'], None)):
try:
self.builder.set_doc_version(self.doc, six.text_type(o))
except SPDXValueError:
self.value_error('DOC_VERS_VALUE', o)
except CardinalityError:
self.more_than_one_error('specVersion')
break
for _s, _p, o in self.graph.triples((doc_term, self.spdx_namespace['dataLicense'], None)):
try:
self.builder.set_doc_data_lic(self.doc, six.text_type(o))
except SPDXValueError:
| python | {
"resource": ""
} |
q254352 | Parser.parse_ext_doc_ref | validation | def parse_ext_doc_ref(self, ext_doc_ref_term):
"""
Parses the External Document ID, SPDX Document URI and Checksum.
"""
for _s, _p, o in self.graph.triples(
(ext_doc_ref_term,
self.spdx_namespace['externalDocumentId'],
None)):
try:
self.builder.set_ext_doc_id(self.doc, six.text_type(o))
except SPDXValueError:
self.value_error('EXT_DOC_REF_VALUE', 'External Document ID')
break
for _s, _p, o in self.graph.triples(
(ext_doc_ref_term,
self.spdx_namespace['spdxDocument'],
None)):
try:
self.builder.set_spdx_doc_uri(self.doc, six.text_type(o))
except SPDXValueError:
self.value_error('EXT_DOC_REF_VALUE', 'SPDX Document URI')
break
for _s, | python | {
"resource": ""
} |
q254353 | Package.validate | validation | def validate(self, messages):
"""
Validate the package fields.
Append user friendly error messages to the `messages` list.
"""
messages = self.validate_checksum(messages)
messages = self.validate_optional_str_fields(messages)
messages | python | {
"resource": ""
} |
q254354 | Package.validate_str_fields | validation | def validate_str_fields(self, fields, optional, messages):
"""Helper for validate_mandatory_str_field and
validate_optional_str_fields"""
for field_str in fields:
field = getattr(self, field_str)
if field is not None:
# FIXME: this does not make sense???
attr = getattr(field, '__str__', None)
if not callable(attr):
messages = messages + [
| python | {
"resource": ""
} |
q254355 | DocBuilder.set_doc_comment | validation | def set_doc_comment(self, doc, comment):
"""Sets document comment, Raises CardinalityError if
comment already set.
"""
if not self.doc_comment_set:
self.doc_comment_set = True
| python | {
"resource": ""
} |
q254356 | ExternalDocumentRefBuilder.set_chksum | validation | def set_chksum(self, doc, chk_sum):
"""
Sets the external document reference's check sum, if not already set.
chk_sum - The checksum value in the form of a string.
"""
if chk_sum:
| python | {
"resource": ""
} |
q254357 | PackageBuilder.set_pkg_source_info | validation | def set_pkg_source_info(self, doc, text):
"""Sets the package's source information, if not already set.
text - Free form text.
Raises CardinalityError if already defined.
Raises OrderError if no package previously defined.
"""
self.assert_package_exists()
if not self.package_source_info_set:
| python | {
"resource": ""
} |
q254358 | PackageBuilder.set_pkg_verif_code | validation | def set_pkg_verif_code(self, doc, code):
"""Sets the package verification code, if not already set.
code - A string.
Raises CardinalityError if already defined.
Raises OrderError if no package previously defined.
"""
self.assert_package_exists()
if not self.package_verif_set:
| python | {
"resource": ""
} |
q254359 | PackageBuilder.set_pkg_excl_file | validation | def set_pkg_excl_file(self, doc, filename):
"""Sets the package's verification code excluded file.
Raises OrderError if no package previously defined.
| python | {
"resource": ""
} |
q254360 | PackageBuilder.set_pkg_summary | validation | def set_pkg_summary(self, doc, text):
"""Set's the package summary.
Raises CardinalityError if summary already set.
Raises OrderError if no package previously defined.
"""
self.assert_package_exists()
if not self.package_summary_set:
| python | {
"resource": ""
} |
q254361 | PackageBuilder.set_pkg_desc | validation | def set_pkg_desc(self, doc, text):
"""Set's the package's description.
Raises CardinalityError if description already set.
Raises OrderError if no package previously defined.
"""
self.assert_package_exists()
if not self.package_desc_set:
| python | {
"resource": ""
} |
q254362 | FileBuilder.set_file_chksum | validation | def set_file_chksum(self, doc, chk_sum):
"""Sets the file check sum, if not already set.
chk_sum - A string
Raises CardinalityError if already defined.
Raises OrderError if no package previously defined.
"""
if self.has_package(doc) and self.has_file(doc):
if not self.file_chksum_set:
| python | {
"resource": ""
} |
q254363 | FileBuilder.set_file_license_comment | validation | def set_file_license_comment(self, doc, text):
"""
Raises OrderError if no package or file defined.
Raises CardinalityError if more than one per file.
"""
if self.has_package(doc) and self.has_file(doc):
if not self.file_license_comment_set:
self.file_license_comment_set = True
| python | {
"resource": ""
} |
q254364 | FileBuilder.set_file_comment | validation | def set_file_comment(self, doc, text):
"""Raises OrderError if no package or no file defined.
Raises CardinalityError if more than one comment set.
"""
if self.has_package(doc) and self.has_file(doc):
if not self.file_comment_set:
self.file_comment_set = True
| python | {
"resource": ""
} |
q254365 | ReviewBuilder.add_review_comment | validation | def add_review_comment(self, doc, comment):
"""Sets the review comment. Raises CardinalityError if
already set. OrderError if no reviewer defined before.
"""
if len(doc.reviews) != 0:
if not self.review_comment_set:
self.review_comment_set = True | python | {
"resource": ""
} |
q254366 | AnnotationBuilder.add_annotation_comment | validation | def add_annotation_comment(self, doc, comment):
"""Sets the annotation comment. Raises CardinalityError if
already set. OrderError if no annotator defined before.
"""
if len(doc.annotations) != 0:
if not self.annotation_comment_set:
self.annotation_comment_set = True | python | {
"resource": ""
} |
q254367 | AnnotationBuilder.add_annotation_type | validation | def add_annotation_type(self, doc, annotation_type):
"""Sets the annotation type. Raises CardinalityError if
already set. OrderError if no annotator defined before.
"""
if len(doc.annotations) != 0:
if not self.annotation_type_set:
if annotation_type.endswith('annotationType_other'):
self.annotation_type_set = True
doc.annotations[-1].annotation_type = 'OTHER'
return True
elif annotation_type.endswith('annotationType_review'):
| python | {
"resource": ""
} |
q254368 | Document.validate | validation | def validate(self, messages):
"""
Validate all fields of the document and update the
messages list with user friendly error messages for display.
"""
messages = self.validate_version(messages)
messages = self.validate_data_lics(messages)
messages = self.validate_name(messages)
messages = self.validate_spdx_id(messages)
messages = self.validate_namespace(messages)
messages = self.validate_ext_document_references(messages)
| python | {
"resource": ""
} |
q254369 | include | validation | def include(f):
'''
includes the contents of a file on disk.
| python | {
"resource": ""
} |
q254370 | system | validation | def system(cmd, data=None):
'''
pipes the output of a program
'''
import subprocess
s = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, | python | {
"resource": ""
} |
q254371 | unescape | validation | def unescape(data):
'''
unescapes html entities. the opposite of escape.
'''
cc = re.compile(r'&(?:(?:#(\d+))|([^;]+));')
result = []
m = cc.search(data)
while m:
result.append(data[0:m.start()])
d = m.group(1)
if d:
d = int(d)
result.append(unichr(d))
else:
| python | {
"resource": ""
} |
q254372 | attr | validation | def attr(*args, **kwargs):
'''
Set attributes on the current active tag context
'''
ctx = dom_tag._with_contexts[_get_thread_context()]
if ctx and ctx[-1]:
dicts = args + (kwargs,)
for d in dicts:
for attr, value in d.items():
| python | {
"resource": ""
} |
q254373 | dom_tag.set_attribute | validation | def set_attribute(self, key, value):
'''
Add or update the value of an attribute.
'''
if isinstance(key, int):
self.children[key] = value
elif isinstance(key, basestring):
self.attributes[key] = value | python | {
"resource": ""
} |
q254374 | dom_tag.setdocument | validation | def setdocument(self, doc):
'''
Creates a reference to the parent document to allow for partial-tree
validation.
'''
# assume that a document is correct in the subtree
if self.document != doc:
| python | {
"resource": ""
} |
q254375 | dom_tag.add | validation | def add(self, *args):
'''
Add new child tags.
'''
for obj in args:
if isinstance(obj, numbers.Number):
# Convert to string so we fall into next if block
obj = str(obj)
if isinstance(obj, basestring):
obj = escape(obj)
self.children.append(obj)
elif isinstance(obj, dom_tag):
ctx = dom_tag._with_contexts[_get_thread_context()]
if ctx and ctx[-1]:
ctx[-1].used.add(obj)
self.children.append(obj)
obj.parent = self
obj.setdocument(self.document)
elif isinstance(obj, dict):
for attr, value | python | {
"resource": ""
} |
q254376 | dom_tag.get | validation | def get(self, tag=None, **kwargs):
'''
Recursively searches children for tags of a certain
type with matching attributes.
'''
# Stupid workaround since we can not use dom_tag in the method declaration
if tag is None: tag = dom_tag
attrs = [(dom_tag.clean_attribute(attr), value)
for attr, value in kwargs.items()]
results = []
for child in self.children:
if (isinstance(tag, basestring) and type(child).__name__ == tag) or \
(not isinstance(tag, basestring) and isinstance(child, tag)):
if all(child.attributes.get(attribute) == value
for attribute, value in attrs):
# If the child | python | {
"resource": ""
} |
q254377 | dom_tag.clean_attribute | validation | def clean_attribute(attribute):
'''
Normalize attribute names for shorthand and work arounds for limitations
in Python's syntax
'''
# Shorthand
attribute = {
'cls': 'class',
'className': 'class',
'class_name': 'class',
'fr': 'for',
'html_for': 'for',
'htmlFor': 'for',
}.get(attribute, attribute)
# Workaround for Python's reserved words
if attribute[0] == '_':
attribute = attribute[1:]
| python | {
"resource": ""
} |
q254378 | dom_tag.clean_pair | validation | def clean_pair(cls, attribute, value):
'''
This will call `clean_attribute` on the attribute and also allows for the
creation of boolean attributes.
Ex. input(selected=True) is equivalent to input(selected="selected") | python | {
"resource": ""
} |
q254379 | Manager.create_reg_message | validation | def create_reg_message(self):
""" Creates a registration message to identify the worker to the interchange
"""
msg = {'parsl_v': PARSL_VERSION,
'python_v': "{}.{}.{}".format(sys.version_info.major,
sys.version_info.minor,
| python | {
"resource": ""
} |
q254380 | Manager.heartbeat | validation | def heartbeat(self):
""" Send heartbeat to the incoming task queue
"""
heartbeat = (HEARTBEAT_CODE).to_bytes(4, "little")
| python | {
"resource": ""
} |
q254381 | Manager.recv_result_from_workers | validation | def recv_result_from_workers(self):
""" Receives a results from the MPI worker pool and send it out via 0mq
Returns:
--------
result: task result | python | {
"resource": ""
} |
q254382 | Manager.recv_task_request_from_workers | validation | def recv_task_request_from_workers(self):
""" Receives 1 task request from MPI comm
Returns:
--------
worker_rank: worker_rank id
| python | {
"resource": ""
} |
q254383 | Manager.pull_tasks | validation | def pull_tasks(self, kill_event):
""" Pulls tasks from the incoming tasks 0mq pipe onto the internal
pending task queue
Parameters:
-----------
kill_event : threading.Event
Event to let the thread know when it is time to die.
"""
logger.info("[TASK PULL THREAD] starting")
poller = zmq.Poller()
poller.register(self.task_incoming, zmq.POLLIN)
# Send a registration message
msg = self.create_reg_message()
logger.debug("Sending registration message: {}".format(msg))
self.task_incoming.send(msg)
last_beat = time.time()
last_interchange_contact = time.time()
task_recv_counter = 0
poll_timer = 1
while not kill_event.is_set():
time.sleep(LOOP_SLOWDOWN)
ready_worker_count = self.ready_worker_queue.qsize()
pending_task_count = self.pending_task_queue.qsize()
logger.debug("[TASK_PULL_THREAD] ready workers:{}, pending tasks:{}".format(ready_worker_count,
pending_task_count))
if time.time() > last_beat + self.heartbeat_period:
self.heartbeat()
last_beat = time.time()
if pending_task_count < self.max_queue_size and ready_worker_count > 0:
logger.debug("[TASK_PULL_THREAD] Requesting tasks: {}".format(ready_worker_count))
msg = ((ready_worker_count).to_bytes(4, "little"))
self.task_incoming.send(msg)
socks = dict(poller.poll(timeout=poll_timer))
if self.task_incoming in socks and socks[self.task_incoming] == zmq.POLLIN:
_, pkl_msg = self.task_incoming.recv_multipart()
tasks = pickle.loads(pkl_msg)
last_interchange_contact = time.time()
if tasks == 'STOP':
logger.critical("[TASK_PULL_THREAD] Received stop request")
kill_event.set()
break
elif tasks == HEARTBEAT_CODE:
logger.debug("Got heartbeat from interchange")
| python | {
"resource": ""
} |
q254384 | Manager.start | validation | def start(self):
""" Start the Manager process.
The worker loops on this:
1. If the last message sent was older than heartbeat period we send a heartbeat
2.
TODO: Move task receiving to a thread
"""
self.comm.Barrier()
logger.debug("Manager synced with workers")
self._kill_event = threading.Event()
self._task_puller_thread = threading.Thread(target=self.pull_tasks,
args=(self._kill_event,))
self._result_pusher_thread = threading.Thread(target=self.push_results,
args=(self._kill_event,))
self._task_puller_thread.start()
self._result_pusher_thread.start()
start = None
result_counter = 0
task_recv_counter = 0
task_sent_counter = 0
logger.info("Loop start")
while not self._kill_event.is_set():
time.sleep(LOOP_SLOWDOWN)
# In this block we attempt to probe MPI for a set amount of time,
# and if we have exhausted all available MPI events, we move on
# to the next block. The timer and counter trigger balance
# fairness and responsiveness.
timer = time.time() + 0.05
counter = min(10, comm.size)
while time.time() < timer:
info = MPI.Status()
if counter > 10:
logger.debug("Hit max mpi events per round")
break
if not self.comm.Iprobe(status=info):
logger.debug("Timer expired, processed {} mpi events".format(counter))
break
else:
tag = info.Get_tag()
logger.info("Message with tag {} received".format(tag))
counter += 1
if tag == RESULT_TAG:
result = self.recv_result_from_workers()
self.pending_result_queue.put(result)
result_counter += 1
| python | {
"resource": ""
} |
q254385 | async_process | validation | def async_process(fn):
""" Decorator function to launch a function as a separate process """
| python | {
"resource": ""
} |
q254386 | udp_messenger | validation | def udp_messenger(domain_name, UDP_IP, UDP_PORT, sock_timeout, message):
"""Send UDP messages to usage tracker asynchronously
This multiprocessing based messenger was written to overcome the limitations
of signalling/terminating a thread that is blocked on a system call. This
messenger is created as a separate process, and initialized with 2 queues,
to_send to receive messages to be sent to the internet.
Args:
- domain_name (str) : Domain name string
- UDP_IP (str) : IP address YYY.YYY.YYY.YYY
- UDP_PORT (int) : UDP port to send out on
- sock_timeout (int) : Socket timeout
- to_send (multiprocessing.Queue) : Queue of outgoing messages to internet
"""
try:
if message is None:
raise ValueError("message was none")
encoded_message = bytes(message, "utf-8")
if encoded_message is None:
raise ValueError("utf-8 encoding of message failed")
if domain_name:
try:
UDP_IP = socket.gethostbyname(domain_name)
except Exception:
# (False, "Domain lookup failed, defaulting | python | {
"resource": ""
} |
q254387 | UsageTracker.check_tracking_enabled | validation | def check_tracking_enabled(self):
"""By default tracking is enabled.
If Test mode is set via env variable PARSL_TESTING, a test flag is set
Tracking is disabled if :
1. config["globals"]["usageTracking"] is set to False (Bool)
2. Environment variable PARSL_TRACKING is set to false (case insensitive)
"""
track = True # By default we track usage
test = False # By default we are not in testing mode
testvar = str(os.environ.get("PARSL_TESTING", 'None')).lower()
| python | {
"resource": ""
} |
q254388 | UsageTracker.construct_start_message | validation | def construct_start_message(self):
"""Collect preliminary run info at the start of the DFK.
Returns :
- Message dict dumped as json string, ready for UDP
"""
uname = getpass.getuser().encode('latin1')
hashed_username = hashlib.sha256(uname).hexdigest()[0:10]
hname = socket.gethostname().encode('latin1')
hashed_hostname = hashlib.sha256(hname).hexdigest()[0:10]
message = {'uuid': self.uuid,
'uname': hashed_username,
'hname': hashed_hostname,
| python | {
"resource": ""
} |
q254389 | UsageTracker.construct_end_message | validation | def construct_end_message(self):
"""Collect the final run information at the time of DFK cleanup.
Returns:
- Message dict dumped as json string, ready for UDP
"""
app_count = self.dfk.task_count
site_count = len([x for x in self.dfk.config.executors if x.managed])
app_fails = len([t for t in self.dfk.tasks if
self.dfk.tasks[t]['status'] in FINAL_FAILURE_STATES])
message = {'uuid': self.uuid,
| python | {
"resource": ""
} |
q254390 | UsageTracker.send_UDP_message | validation | def send_UDP_message(self, message):
"""Send UDP message."""
x = 0
if self.tracking_enabled:
try:
proc = udp_messenger(self.domain_name, self.UDP_IP, self.UDP_PORT, | python | {
"resource": ""
} |
q254391 | UsageTracker.send_message | validation | def send_message(self):
"""Send message over UDP.
If tracking is disables, the bytes_sent will always be set to -1
Returns:
(bytes_sent, time_taken)
"""
start = time.time()
message = None
if not self.initialized:
| python | {
"resource": ""
} |
q254392 | dbm_starter | validation | def dbm_starter(priority_msgs, resource_msgs, *args, **kwargs):
"""Start the database manager process
The DFK should start this function. The args, kwargs match that of the monitoring config
| python | {
"resource": ""
} |
q254393 | DataFlowKernel._create_task_log_info | validation | def _create_task_log_info(self, task_id, fail_mode=None):
"""
Create the dictionary that will be included in the log.
"""
info_to_monitor = ['func_name', 'fn_hash', 'memoize', 'checkpoint', 'fail_count',
'fail_history', 'status', 'id', 'time_submitted', 'time_returned', 'executor']
task_log_info = {"task_" + k: self.tasks[task_id][k] for k in info_to_monitor}
task_log_info['run_id'] = self.run_id
task_log_info['timestamp'] = datetime.datetime.now()
task_log_info['task_status_name'] = self.tasks[task_id]['status'].name
task_log_info['tasks_failed_count'] = self.tasks_failed_count
task_log_info['tasks_completed_count'] = self.tasks_completed_count
task_log_info['task_inputs'] = str(self.tasks[task_id]['kwargs'].get('inputs', None))
task_log_info['task_outputs'] = str(self.tasks[task_id]['kwargs'].get('outputs', None))
task_log_info['task_stdin'] = self.tasks[task_id]['kwargs'].get('stdin', None)
task_log_info['task_stdout'] = self.tasks[task_id]['kwargs'].get('stdout', None)
task_log_info['task_depends'] = None
if self.tasks[task_id]['depends'] is not | python | {
"resource": ""
} |
q254394 | DataFlowKernel.handle_app_update | validation | def handle_app_update(self, task_id, future, memo_cbk=False):
"""This function is called as a callback when an AppFuture
is in its final state.
It will trigger post-app processing such as checkpointing
and stageout.
Args:
task_id (string) : Task id
future (Future) : The relevant app future (which should be
consistent with the task structure 'app_fu' entry
KWargs:
memo_cbk(Bool) : Indicates that the call is coming from a memo update,
that does not require additional memo updates.
"""
if not self.tasks[task_id]['app_fu'].done():
logger.error("Internal consistency error: app_fu is not done for task {}".format(task_id))
if not self.tasks[task_id]['app_fu'] == future:
logger.error("Internal consistency error: callback future is not the app_fu in task structure, for task {}".format(task_id))
if not memo_cbk:
# Update the memoizer with the new result if this is not a
# result from a memo lookup and the task has reached a terminal state.
self.memoizer.update_memo(task_id, self.tasks[task_id], future)
if self.checkpoint_mode == 'task_exit':
self.checkpoint(tasks=[task_id])
| python | {
"resource": ""
} |
q254395 | DataFlowKernel.launch_task | validation | def launch_task(self, task_id, executable, *args, **kwargs):
"""Handle the actual submission of the task to the executor layer.
If the app task has the executors attributes not set (default=='all')
the task is launched on a randomly selected executor from the
list of executors. This behavior could later be updated to support
binding to executors based on user specified criteria.
If the app task specifies a particular set of executors, it will be
targeted at those specific executors.
Args:
task_id (uuid string) : A uuid string that uniquely identifies the task
executable (callable) : A callable object
args (list of positional args)
kwargs (arbitrary keyword arguments)
Returns:
Future that tracks the execution of the submitted executable
"""
self.tasks[task_id]['time_submitted'] = datetime.datetime.now()
hit, memo_fu = self.memoizer.check_memo(task_id, self.tasks[task_id])
if hit:
logger.info("Reusing cached result for task {}".format(task_id))
return memo_fu
executor_label = self.tasks[task_id]["executor"]
try:
executor = self.executors[executor_label]
except Exception:
logger.exception("Task {} requested invalid executor {}: config is\n{}".format(task_id, executor_label, self._config))
if self.monitoring is not None and self.monitoring.resource_monitoring_enabled:
executable | python | {
"resource": ""
} |
q254396 | DataFlowKernel._add_input_deps | validation | def _add_input_deps(self, executor, args, kwargs):
"""Look for inputs of the app that are remote files. Submit stage_in
apps for such files and replace the file objects in the inputs list with
corresponding DataFuture objects.
Args:
- executor (str) : executor where the app is going to be launched
- args (List) : Positional args to app function
- kwargs (Dict) : Kwargs to app function
"""
# Return if the task is _*_stage_in
if executor == 'data_manager':
return args, kwargs
inputs = kwargs.get('inputs', [])
for idx, f in enumerate(inputs):
if isinstance(f, | python | {
"resource": ""
} |
q254397 | DataFlowKernel._gather_all_deps | validation | def _gather_all_deps(self, args, kwargs):
"""Count the number of unresolved futures on which a task depends.
Args:
- args (List[args]) : The list of args list to the fn
- kwargs (Dict{kwargs}) : The dict of all kwargs passed to the fn
Returns:
- count, [list of dependencies]
"""
# Check the positional args
depends = []
count = 0
for dep in args:
if isinstance(dep, Future):
if self.tasks[dep.tid]['status'] not in FINAL_STATES:
count += 1
depends.extend([dep])
# Check for explicit kwargs ex, fu_1=<fut>
for key in kwargs:
dep = kwargs[key]
if isinstance(dep, Future):
if self.tasks[dep.tid]['status'] not in FINAL_STATES:
| python | {
"resource": ""
} |
q254398 | DataFlowKernel.submit | validation | def submit(self, func, *args, executors='all', fn_hash=None, cache=False, **kwargs):
"""Add task to the dataflow system.
If the app task has the executors attributes not set (default=='all')
the task will be launched on a randomly selected executor from the
list of executors. If the app task specifies a particular set of
executors, it will be targeted at the specified executors.
>>> IF all deps are met:
>>> send to the runnable queue and launch the task
>>> ELSE:
>>> post the task in the pending queue
Args:
- func : A function object
- *args : Args to the function
KWargs :
- executors (list or string) : List of executors this call could go to.
Default='all'
- fn_hash (Str) : Hash of the function and inputs
Default=None
- cache (Bool) : To enable memoization or not
- kwargs (dict) : Rest of the kwargs to the fn passed as dict.
Returns:
(AppFuture) [DataFutures,]
"""
if self.cleanup_called:
raise ValueError("Cannot submit to a DFK that has been cleaned up")
task_id = self.task_count
self.task_count += 1
if isinstance(executors, str) and executors.lower() == 'all':
choices = list(e for e in self.executors if e != 'data_manager')
elif isinstance(executors, list):
choices = executors
executor = random.choice(choices)
# Transform remote input files to data futures
args, kwargs = self._add_input_deps(executor, args, kwargs)
task_def = {'depends': None,
'executor': executor,
'func': func,
'func_name': func.__name__,
'args': args,
'kwargs': kwargs,
'fn_hash': fn_hash,
'memoize': cache,
'callback': None,
'exec_fu': None,
'checkpoint': None,
'fail_count': 0,
'fail_history': [],
'env': None,
'status': States.unsched,
'id': task_id,
'time_submitted': None,
'time_returned': None,
'app_fu': None}
if task_id in self.tasks:
raise DuplicateTaskError(
"internal consistency error: Task {0} already exists in task list".format(task_id))
else:
self.tasks[task_id] = task_def
# Get the dep count and a list of dependencies for the task
dep_cnt, depends = self._gather_all_deps(args, kwargs)
self.tasks[task_id]['depends'] = depends
# Extract stdout and stderr to pass to AppFuture:
task_stdout = kwargs.get('stdout')
task_stderr = kwargs.get('stderr')
logger.info("Task {} submitted for App {}, waiting on tasks {}".format(task_id,
task_def['func_name'],
| python | {
"resource": ""
} |
q254399 | DataFlowKernel.cleanup | validation | def cleanup(self):
"""DataFlowKernel cleanup.
This involves killing resources explicitly and sending die messages to IPP workers.
If the executors are managed (created by the DFK), then we call scale_in on each of
the executors and call executor.shutdown. Otherwise, we do nothing, and executor
cleanup is left to the user.
"""
logger.info("DFK cleanup initiated")
# this check won't detect two DFK cleanups happening from
# different threads extremely close in time because of
# non-atomic read/modify of self.cleanup_called
if self.cleanup_called:
raise Exception("attempt to clean up DFK when it has already been cleaned-up")
self.cleanup_called = True
self.log_task_states()
# Checkpointing takes priority over the rest of the tasks
# checkpoint if any valid checkpoint method is specified
if self.checkpoint_mode is not None:
self.checkpoint()
if self._checkpoint_timer:
logger.info("Stopping checkpoint timer") | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.