repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
calmjs/calmjs | src/calmjs/loaderplugin.py | ModuleLoaderRegistry.store_records_for_package | def store_records_for_package(self, entry_point, records):
"""
Given that records are based on the parent, and the same entry
point(s) will reference those same records multiple times, the
actual stored records must be limited.
"""
pkg_records_entry = self._dist_to_packa... | python | def store_records_for_package(self, entry_point, records):
"""
Given that records are based on the parent, and the same entry
point(s) will reference those same records multiple times, the
actual stored records must be limited.
"""
pkg_records_entry = self._dist_to_packa... | [
"def",
"store_records_for_package",
"(",
"self",
",",
"entry_point",
",",
"records",
")",
":",
"pkg_records_entry",
"=",
"self",
".",
"_dist_to_package_module_map",
"(",
"entry_point",
")",
"pkg_records_entry",
".",
"extend",
"(",
"rec",
"for",
"rec",
"in",
"recor... | Given that records are based on the parent, and the same entry
point(s) will reference those same records multiple times, the
actual stored records must be limited. | [
"Given",
"that",
"records",
"are",
"based",
"on",
"the",
"parent",
"and",
"the",
"same",
"entry",
"point",
"(",
"s",
")",
"will",
"reference",
"those",
"same",
"records",
"multiple",
"times",
"the",
"actual",
"stored",
"records",
"must",
"be",
"limited",
"... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/loaderplugin.py#L236-L252 |
weso/CWR-DataApi | cwr/parser/encoder/file.py | default_file_encoder | def default_file_encoder():
"""
Get default encoder cwr file
:return:
"""
config = CWRConfiguration()
field_configs = config.load_field_config('table')
field_configs.update(config.load_field_config('common'))
field_values = CWRTables()
for entry in field_configs.values():
i... | python | def default_file_encoder():
"""
Get default encoder cwr file
:return:
"""
config = CWRConfiguration()
field_configs = config.load_field_config('table')
field_configs.update(config.load_field_config('common'))
field_values = CWRTables()
for entry in field_configs.values():
i... | [
"def",
"default_file_encoder",
"(",
")",
":",
"config",
"=",
"CWRConfiguration",
"(",
")",
"field_configs",
"=",
"config",
".",
"load_field_config",
"(",
"'table'",
")",
"field_configs",
".",
"update",
"(",
"config",
".",
"load_field_config",
"(",
"'common'",
")... | Get default encoder cwr file
:return: | [
"Get",
"default",
"encoder",
"cwr",
"file",
":",
"return",
":"
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/encoder/file.py#L187-L204 |
weso/CWR-DataApi | cwr/parser/encoder/file.py | BaseCWRFileNameEncoder.encode | def encode(self, tag):
"""
Parses a CWR file name from a FileTag object.
The result will be a string following the format CWyynnnnsss_rrr.Vxx,
where the numeric sequence will have the length set on the encoder's
constructor.
:param tag: FileTag to parse
:return:... | python | def encode(self, tag):
"""
Parses a CWR file name from a FileTag object.
The result will be a string following the format CWyynnnnsss_rrr.Vxx,
where the numeric sequence will have the length set on the encoder's
constructor.
:param tag: FileTag to parse
:return:... | [
"def",
"encode",
"(",
"self",
",",
"tag",
")",
":",
"# Acquires sequence number",
"sequence",
"=",
"str",
"(",
"tag",
".",
"sequence_n",
")",
"# If the sequence is bigger the max, it is cut",
"if",
"len",
"(",
"sequence",
")",
">",
"self",
".",
"_sequence_l",
":... | Parses a CWR file name from a FileTag object.
The result will be a string following the format CWyynnnnsss_rrr.Vxx,
where the numeric sequence will have the length set on the encoder's
constructor.
:param tag: FileTag to parse
:return: a string file name parsed from the FileTag | [
"Parses",
"a",
"CWR",
"file",
"name",
"from",
"a",
"FileTag",
"object",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/encoder/file.py#L100-L145 |
weso/CWR-DataApi | cwr/parser/encoder/file.py | CwrFileEncoder.encode | def encode(self, transmission):
"""
Encodes the data, creating a CWR structure from an instance from the
domain model.
:param entity: the instance to encode
:return: a cwr string structure created from the received data
"""
data = ''
data += self._record_... | python | def encode(self, transmission):
"""
Encodes the data, creating a CWR structure from an instance from the
domain model.
:param entity: the instance to encode
:return: a cwr string structure created from the received data
"""
data = ''
data += self._record_... | [
"def",
"encode",
"(",
"self",
",",
"transmission",
")",
":",
"data",
"=",
"''",
"data",
"+=",
"self",
".",
"_record_encode",
"(",
"transmission",
".",
"header",
")",
"for",
"group",
"in",
"transmission",
".",
"groups",
":",
"data",
"+=",
"self",
".",
"... | Encodes the data, creating a CWR structure from an instance from the
domain model.
:param entity: the instance to encode
:return: a cwr string structure created from the received data | [
"Encodes",
"the",
"data",
"creating",
"a",
"CWR",
"structure",
"from",
"an",
"instance",
"from",
"the",
"domain",
"model",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/encoder/file.py#L167-L184 |
pandeylab/pythomics | pythomics/proteomics/parsers.py | PepXMLIterator.getScans | def getScans(self, modifications=True, fdr=True):
"""
get a random scan
"""
if not self.scans:
for i in self:
yield i
else:
for i in self.scans.values():
yield i
yield None | python | def getScans(self, modifications=True, fdr=True):
"""
get a random scan
"""
if not self.scans:
for i in self:
yield i
else:
for i in self.scans.values():
yield i
yield None | [
"def",
"getScans",
"(",
"self",
",",
"modifications",
"=",
"True",
",",
"fdr",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"scans",
":",
"for",
"i",
"in",
"self",
":",
"yield",
"i",
"else",
":",
"for",
"i",
"in",
"self",
".",
"scans",
".",
... | get a random scan | [
"get",
"a",
"random",
"scan"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L656-L666 |
pandeylab/pythomics | pythomics/proteomics/parsers.py | MGFIterator.getScan | def getScan(self, title, peptide=None):
"""
allows random lookup
"""
if self.ra.has_key(title):
self.filename.seek(self.ra[title][0],0)
toRead = self.ra[title][1]-self.ra[title][0]
info = self.filename.read(toRead)
scan = self.parseScan(inf... | python | def getScan(self, title, peptide=None):
"""
allows random lookup
"""
if self.ra.has_key(title):
self.filename.seek(self.ra[title][0],0)
toRead = self.ra[title][1]-self.ra[title][0]
info = self.filename.read(toRead)
scan = self.parseScan(inf... | [
"def",
"getScan",
"(",
"self",
",",
"title",
",",
"peptide",
"=",
"None",
")",
":",
"if",
"self",
".",
"ra",
".",
"has_key",
"(",
"title",
")",
":",
"self",
".",
"filename",
".",
"seek",
"(",
"self",
".",
"ra",
"[",
"title",
"]",
"[",
"0",
"]",... | allows random lookup | [
"allows",
"random",
"lookup"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L962-L973 |
pandeylab/pythomics | pythomics/proteomics/parsers.py | MGFIterator.parseScan | def parseScan(self, scan):
"""
All input follows the BEGIN IONS row and ends before END IONS
"""
setupScan = True
foundCharge = False
foundMass = False
foundTitle = False
scanObj = ScanObject()
scanObj.ms_level = 2
for row in scan.split('\n... | python | def parseScan(self, scan):
"""
All input follows the BEGIN IONS row and ends before END IONS
"""
setupScan = True
foundCharge = False
foundMass = False
foundTitle = False
scanObj = ScanObject()
scanObj.ms_level = 2
for row in scan.split('\n... | [
"def",
"parseScan",
"(",
"self",
",",
"scan",
")",
":",
"setupScan",
"=",
"True",
"foundCharge",
"=",
"False",
"foundMass",
"=",
"False",
"foundTitle",
"=",
"False",
"scanObj",
"=",
"ScanObject",
"(",
")",
"scanObj",
".",
"ms_level",
"=",
"2",
"for",
"ro... | All input follows the BEGIN IONS row and ends before END IONS | [
"All",
"input",
"follows",
"the",
"BEGIN",
"IONS",
"row",
"and",
"ends",
"before",
"END",
"IONS"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L975-L1012 |
pandeylab/pythomics | pythomics/proteomics/parsers.py | ThermoMSFIterator.getScan | def getScan(self, specId, peptide=None):
"""
get a random scan
"""
sql = self.base_sql + " where sh.SpectrumID = %d and p.Sequence = '%s'"%(int(specId),peptide)
self.cur.execute(sql)
i = self.cur.fetchone()
if not i:
return None
scan = self.par... | python | def getScan(self, specId, peptide=None):
"""
get a random scan
"""
sql = self.base_sql + " where sh.SpectrumID = %d and p.Sequence = '%s'"%(int(specId),peptide)
self.cur.execute(sql)
i = self.cur.fetchone()
if not i:
return None
scan = self.par... | [
"def",
"getScan",
"(",
"self",
",",
"specId",
",",
"peptide",
"=",
"None",
")",
":",
"sql",
"=",
"self",
".",
"base_sql",
"+",
"\" where sh.SpectrumID = %d and p.Sequence = '%s'\"",
"%",
"(",
"int",
"(",
"specId",
")",
",",
"peptide",
")",
"self",
".",
"cu... | get a random scan | [
"get",
"a",
"random",
"scan"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L1477-L1488 |
pandeylab/pythomics | pythomics/proteomics/parsers.py | ThermoMSFIterator.getScans | def getScans(self, modifications=False, fdr=True):
"""
get a random scan
"""
if fdr:
sql = self.base_sql+"WHERE p.ConfidenceLevel >= {} and p.SearchEngineRank <= {} {}".format(self.clvl, self.srank, self.extra)
try:
self.cur.execute(sql)
... | python | def getScans(self, modifications=False, fdr=True):
"""
get a random scan
"""
if fdr:
sql = self.base_sql+"WHERE p.ConfidenceLevel >= {} and p.SearchEngineRank <= {} {}".format(self.clvl, self.srank, self.extra)
try:
self.cur.execute(sql)
... | [
"def",
"getScans",
"(",
"self",
",",
"modifications",
"=",
"False",
",",
"fdr",
"=",
"True",
")",
":",
"if",
"fdr",
":",
"sql",
"=",
"self",
".",
"base_sql",
"+",
"\"WHERE p.ConfidenceLevel >= {} and p.SearchEngineRank <= {} {}\"",
".",
"format",
"(",
"self",
... | get a random scan | [
"get",
"a",
"random",
"scan"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L1490-L1526 |
pandeylab/pythomics | pythomics/proteomics/parsers.py | ThermoMSFIterator.parseFullScan | def parseFullScan(self, i, modifications=False):
"""
parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml
"""
scanObj = PeptideObject()
peptide = str(i[1])
pid=i[2]
scanObj.acc = self.protein_map.get(i... | python | def parseFullScan(self, i, modifications=False):
"""
parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml
"""
scanObj = PeptideObject()
peptide = str(i[1])
pid=i[2]
scanObj.acc = self.protein_map.get(i... | [
"def",
"parseFullScan",
"(",
"self",
",",
"i",
",",
"modifications",
"=",
"False",
")",
":",
"scanObj",
"=",
"PeptideObject",
"(",
")",
"peptide",
"=",
"str",
"(",
"i",
"[",
"1",
"]",
")",
"pid",
"=",
"i",
"[",
"2",
"]",
"scanObj",
".",
"acc",
"=... | parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml | [
"parses",
"scan",
"info",
"for",
"giving",
"a",
"Spectrum",
"Obj",
"for",
"plotting",
".",
"takes",
"significantly",
"longer",
"since",
"it",
"has",
"to",
"unzip",
"/",
"parse",
"xml"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L1635-L1664 |
pandeylab/pythomics | pythomics/proteomics/parsers.py | MQIterator.getScans | def getScans(self, modifications=True, fdr=True):
"""
get a random scan
"""
if fdr:
sql = "select sp.Spectrum, p.Sequence, p.PeptideID, p.SpectrumID from spectrumheaders sh left join spectra sp on (sp.UniqueSpectrumID=sh.UniqueSpectrumID) left join peptides p on (sh.SpectrumI... | python | def getScans(self, modifications=True, fdr=True):
"""
get a random scan
"""
if fdr:
sql = "select sp.Spectrum, p.Sequence, p.PeptideID, p.SpectrumID from spectrumheaders sh left join spectra sp on (sp.UniqueSpectrumID=sh.UniqueSpectrumID) left join peptides p on (sh.SpectrumI... | [
"def",
"getScans",
"(",
"self",
",",
"modifications",
"=",
"True",
",",
"fdr",
"=",
"True",
")",
":",
"if",
"fdr",
":",
"sql",
"=",
"\"select sp.Spectrum, p.Sequence, p.PeptideID, p.SpectrumID from spectrumheaders sh left join spectra sp on (sp.UniqueSpectrumID=sh.UniqueSpectru... | get a random scan | [
"get",
"a",
"random",
"scan"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L1774-L1796 |
pandeylab/pythomics | pythomics/proteomics/parsers.py | MQIterator.parseFullScan | def parseFullScan(self, i, modifications=True):
"""
parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml
"""
scanObj = PeptideObject()
peptide = str(i[1])
pid=i[2]
if modifications:
sql = '... | python | def parseFullScan(self, i, modifications=True):
"""
parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml
"""
scanObj = PeptideObject()
peptide = str(i[1])
pid=i[2]
if modifications:
sql = '... | [
"def",
"parseFullScan",
"(",
"self",
",",
"i",
",",
"modifications",
"=",
"True",
")",
":",
"scanObj",
"=",
"PeptideObject",
"(",
")",
"peptide",
"=",
"str",
"(",
"i",
"[",
"1",
"]",
")",
"pid",
"=",
"i",
"[",
"2",
"]",
"if",
"modifications",
":",
... | parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml | [
"parses",
"scan",
"info",
"for",
"giving",
"a",
"Spectrum",
"Obj",
"for",
"plotting",
".",
"takes",
"significantly",
"longer",
"since",
"it",
"has",
"to",
"unzip",
"/",
"parse",
"xml"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L1901-L1915 |
calmjs/calmjs | src/calmjs/artifact.py | _cls_lookup_dist | def _cls_lookup_dist(cls):
"""
Attempt to resolve the distribution from the provided class in the
most naive way - this assumes the Python module path to the class
contains the name of the package that provided the module and class.
"""
frags = cls.__module__.split('.')
for name in ('.'.joi... | python | def _cls_lookup_dist(cls):
"""
Attempt to resolve the distribution from the provided class in the
most naive way - this assumes the Python module path to the class
contains the name of the package that provided the module and class.
"""
frags = cls.__module__.split('.')
for name in ('.'.joi... | [
"def",
"_cls_lookup_dist",
"(",
"cls",
")",
":",
"frags",
"=",
"cls",
".",
"__module__",
".",
"split",
"(",
"'.'",
")",
"for",
"name",
"in",
"(",
"'.'",
".",
"join",
"(",
"frags",
"[",
":",
"x",
"]",
")",
"for",
"x",
"in",
"range",
"(",
"len",
... | Attempt to resolve the distribution from the provided class in the
most naive way - this assumes the Python module path to the class
contains the name of the package that provided the module and class. | [
"Attempt",
"to",
"resolve",
"the",
"distribution",
"from",
"the",
"provided",
"class",
"in",
"the",
"most",
"naive",
"way",
"-",
"this",
"assumes",
"the",
"Python",
"module",
"path",
"to",
"the",
"class",
"contains",
"the",
"name",
"of",
"the",
"package",
... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L155-L166 |
calmjs/calmjs | src/calmjs/artifact.py | verify_builder | def verify_builder(builder):
"""
To ensure that the provided builder has a signature that is at least
compatible.
"""
try:
d = getcallargs(builder, package_names=[], export_target='some_path')
except TypeError:
return False
return d == {'package_names': [], 'export_target': ... | python | def verify_builder(builder):
"""
To ensure that the provided builder has a signature that is at least
compatible.
"""
try:
d = getcallargs(builder, package_names=[], export_target='some_path')
except TypeError:
return False
return d == {'package_names': [], 'export_target': ... | [
"def",
"verify_builder",
"(",
"builder",
")",
":",
"try",
":",
"d",
"=",
"getcallargs",
"(",
"builder",
",",
"package_names",
"=",
"[",
"]",
",",
"export_target",
"=",
"'some_path'",
")",
"except",
"TypeError",
":",
"return",
"False",
"return",
"d",
"==",
... | To ensure that the provided builder has a signature that is at least
compatible. | [
"To",
"ensure",
"that",
"the",
"provided",
"builder",
"has",
"a",
"signature",
"that",
"is",
"at",
"least",
"compatible",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L169-L179 |
calmjs/calmjs | src/calmjs/artifact.py | extract_builder_result | def extract_builder_result(builder_result, toolchain_cls=Toolchain):
"""
Extract the builder result to produce a ``Toolchain`` and ``Spec``
instance.
"""
try:
toolchain, spec = builder_result
except Exception:
return None, None
if not isinstance(toolchain, toolchain_cls) or ... | python | def extract_builder_result(builder_result, toolchain_cls=Toolchain):
"""
Extract the builder result to produce a ``Toolchain`` and ``Spec``
instance.
"""
try:
toolchain, spec = builder_result
except Exception:
return None, None
if not isinstance(toolchain, toolchain_cls) or ... | [
"def",
"extract_builder_result",
"(",
"builder_result",
",",
"toolchain_cls",
"=",
"Toolchain",
")",
":",
"try",
":",
"toolchain",
",",
"spec",
"=",
"builder_result",
"except",
"Exception",
":",
"return",
"None",
",",
"None",
"if",
"not",
"isinstance",
"(",
"t... | Extract the builder result to produce a ``Toolchain`` and ``Spec``
instance. | [
"Extract",
"the",
"builder",
"result",
"to",
"produce",
"a",
"Toolchain",
"and",
"Spec",
"instance",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L182-L194 |
calmjs/calmjs | src/calmjs/artifact.py | trace_toolchain | def trace_toolchain(toolchain):
"""
Trace the versions of the involved packages for the provided
toolchain instance.
"""
pkgs = []
for cls in getmro(type(toolchain)):
if not issubclass(cls, Toolchain):
continue
dist = _cls_lookup_dist(cls)
value = {
... | python | def trace_toolchain(toolchain):
"""
Trace the versions of the involved packages for the provided
toolchain instance.
"""
pkgs = []
for cls in getmro(type(toolchain)):
if not issubclass(cls, Toolchain):
continue
dist = _cls_lookup_dist(cls)
value = {
... | [
"def",
"trace_toolchain",
"(",
"toolchain",
")",
":",
"pkgs",
"=",
"[",
"]",
"for",
"cls",
"in",
"getmro",
"(",
"type",
"(",
"toolchain",
")",
")",
":",
"if",
"not",
"issubclass",
"(",
"cls",
",",
"Toolchain",
")",
":",
"continue",
"dist",
"=",
"_cls... | Trace the versions of the involved packages for the provided
toolchain instance. | [
"Trace",
"the",
"versions",
"of",
"the",
"involved",
"packages",
"for",
"the",
"provided",
"toolchain",
"instance",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L197-L214 |
calmjs/calmjs | src/calmjs/artifact.py | BaseArtifactRegistry.get_artifact_filename | def get_artifact_filename(self, package_name, artifact_name):
"""
Similar to pkg_resources.resource_filename, however this works
with the information cached in this registry instance, and
arguments are not quite the same.
Arguments:
package_name
The name of ... | python | def get_artifact_filename(self, package_name, artifact_name):
"""
Similar to pkg_resources.resource_filename, however this works
with the information cached in this registry instance, and
arguments are not quite the same.
Arguments:
package_name
The name of ... | [
"def",
"get_artifact_filename",
"(",
"self",
",",
"package_name",
",",
"artifact_name",
")",
":",
"project_name",
"=",
"self",
".",
"packages",
".",
"normalize",
"(",
"package_name",
")",
"return",
"self",
".",
"records",
".",
"get",
"(",
"(",
"project_name",
... | Similar to pkg_resources.resource_filename, however this works
with the information cached in this registry instance, and
arguments are not quite the same.
Arguments:
package_name
The name of the package to get the artifact from
artifact_name
The exact n... | [
"Similar",
"to",
"pkg_resources",
".",
"resource_filename",
"however",
"this",
"works",
"with",
"the",
"information",
"cached",
"in",
"this",
"registry",
"instance",
"and",
"arguments",
"are",
"not",
"quite",
"the",
"same",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L344-L362 |
calmjs/calmjs | src/calmjs/artifact.py | BaseArtifactRegistry.resolve_artifacts_by_builder_compat | def resolve_artifacts_by_builder_compat(
self, package_names, builder_name, dependencies=False):
"""
Yield the list of paths to the artifacts in the order of the
dependency resolution
Arguments:
package_names
The names of the packages to probe the depend... | python | def resolve_artifacts_by_builder_compat(
self, package_names, builder_name, dependencies=False):
"""
Yield the list of paths to the artifacts in the order of the
dependency resolution
Arguments:
package_names
The names of the packages to probe the depend... | [
"def",
"resolve_artifacts_by_builder_compat",
"(",
"self",
",",
"package_names",
",",
"builder_name",
",",
"dependencies",
"=",
"False",
")",
":",
"paths",
"=",
"self",
".",
"compat_builders",
".",
"get",
"(",
"builder_name",
")",
"if",
"not",
"paths",
":",
"#... | Yield the list of paths to the artifacts in the order of the
dependency resolution
Arguments:
package_names
The names of the packages to probe the dependency graph, to
be provided as a list of strings.
artifact_name
The exact name of the artifact.
... | [
"Yield",
"the",
"list",
"of",
"paths",
"to",
"the",
"artifacts",
"in",
"the",
"order",
"of",
"the",
"dependency",
"resolution"
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L364-L399 |
calmjs/calmjs | src/calmjs/artifact.py | BaseArtifactRegistry.get_artifact_metadata | def get_artifact_metadata(self, package_name):
"""
Return metadata of the artifacts built through this registry.
"""
filename = self.metadata.get(package_name)
if not filename or not exists(filename):
return {}
with open(filename, encoding='utf8') as fd:
... | python | def get_artifact_metadata(self, package_name):
"""
Return metadata of the artifacts built through this registry.
"""
filename = self.metadata.get(package_name)
if not filename or not exists(filename):
return {}
with open(filename, encoding='utf8') as fd:
... | [
"def",
"get_artifact_metadata",
"(",
"self",
",",
"package_name",
")",
":",
"filename",
"=",
"self",
".",
"metadata",
".",
"get",
"(",
"package_name",
")",
"if",
"not",
"filename",
"or",
"not",
"exists",
"(",
"filename",
")",
":",
"return",
"{",
"}",
"wi... | Return metadata of the artifacts built through this registry. | [
"Return",
"metadata",
"of",
"the",
"artifacts",
"built",
"through",
"this",
"registry",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L401-L418 |
calmjs/calmjs | src/calmjs/artifact.py | BaseArtifactRegistry.generate_metadata_entry | def generate_metadata_entry(self, entry_point, toolchain, spec):
"""
After the toolchain and spec have been executed, this may be
called to generate the artifact export entry for persistence
into the metadata file.
"""
export_target = spec['export_target']
toolch... | python | def generate_metadata_entry(self, entry_point, toolchain, spec):
"""
After the toolchain and spec have been executed, this may be
called to generate the artifact export entry for persistence
into the metadata file.
"""
export_target = spec['export_target']
toolch... | [
"def",
"generate_metadata_entry",
"(",
"self",
",",
"entry_point",
",",
"toolchain",
",",
"spec",
")",
":",
"export_target",
"=",
"spec",
"[",
"'export_target'",
"]",
"toolchain_bases",
"=",
"trace_toolchain",
"(",
"toolchain",
")",
"toolchain_bin_path",
"=",
"spe... | After the toolchain and spec have been executed, this may be
called to generate the artifact export entry for persistence
into the metadata file. | [
"After",
"the",
"toolchain",
"and",
"spec",
"have",
"been",
"executed",
"this",
"may",
"be",
"called",
"to",
"generate",
"the",
"artifact",
"export",
"entry",
"for",
"persistence",
"into",
"the",
"metadata",
"file",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L420-L440 |
calmjs/calmjs | src/calmjs/artifact.py | BaseArtifactRegistry.iter_records_for | def iter_records_for(self, package_name):
"""
Iterate records for a specific package.
"""
entry_points = self.packages.get(package_name, NotImplemented)
if entry_points is NotImplemented:
logger.debug(
"package '%s' has not declared any entry points f... | python | def iter_records_for(self, package_name):
"""
Iterate records for a specific package.
"""
entry_points = self.packages.get(package_name, NotImplemented)
if entry_points is NotImplemented:
logger.debug(
"package '%s' has not declared any entry points f... | [
"def",
"iter_records_for",
"(",
"self",
",",
"package_name",
")",
":",
"entry_points",
"=",
"self",
".",
"packages",
".",
"get",
"(",
"package_name",
",",
"NotImplemented",
")",
"if",
"entry_points",
"is",
"NotImplemented",
":",
"logger",
".",
"debug",
"(",
... | Iterate records for a specific package. | [
"Iterate",
"records",
"for",
"a",
"specific",
"package",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L461-L480 |
calmjs/calmjs | src/calmjs/artifact.py | BaseArtifactRegistry.generate_builder | def generate_builder(self, entry_point, export_target):
"""
Yields exactly one builder if both the provided entry point and
export target satisfies the checks required.
"""
try:
builder = entry_point.resolve()
except ImportError:
logger.error(
... | python | def generate_builder(self, entry_point, export_target):
"""
Yields exactly one builder if both the provided entry point and
export target satisfies the checks required.
"""
try:
builder = entry_point.resolve()
except ImportError:
logger.error(
... | [
"def",
"generate_builder",
"(",
"self",
",",
"entry_point",
",",
"export_target",
")",
":",
"try",
":",
"builder",
"=",
"entry_point",
".",
"resolve",
"(",
")",
"except",
"ImportError",
":",
"logger",
".",
"error",
"(",
"\"unable to import the target builder for t... | Yields exactly one builder if both the provided entry point and
export target satisfies the checks required. | [
"Yields",
"exactly",
"one",
"builder",
"if",
"both",
"the",
"provided",
"entry",
"point",
"and",
"export",
"target",
"satisfies",
"the",
"checks",
"required",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L520-L585 |
calmjs/calmjs | src/calmjs/artifact.py | BaseArtifactRegistry.execute_builder | def execute_builder(self, entry_point, toolchain, spec):
"""
Accepts the arguments provided by the builder and executes them.
"""
toolchain(spec)
if not exists(spec['export_target']):
logger.error(
"the entry point '%s' from package '%s' failed to "
... | python | def execute_builder(self, entry_point, toolchain, spec):
"""
Accepts the arguments provided by the builder and executes them.
"""
toolchain(spec)
if not exists(spec['export_target']):
logger.error(
"the entry point '%s' from package '%s' failed to "
... | [
"def",
"execute_builder",
"(",
"self",
",",
"entry_point",
",",
"toolchain",
",",
"spec",
")",
":",
"toolchain",
"(",
"spec",
")",
"if",
"not",
"exists",
"(",
"spec",
"[",
"'export_target'",
"]",
")",
":",
"logger",
".",
"error",
"(",
"\"the entry point '%... | Accepts the arguments provided by the builder and executes them. | [
"Accepts",
"the",
"arguments",
"provided",
"by",
"the",
"builder",
"and",
"executes",
"them",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L594-L607 |
calmjs/calmjs | src/calmjs/artifact.py | ArtifactRegistry.process_package | def process_package(self, package_name):
"""
Build artifacts declared for the given package.
"""
metadata = super(ArtifactRegistry, self).process_package(package_name)
if metadata:
self.update_artifact_metadata(package_name, metadata) | python | def process_package(self, package_name):
"""
Build artifacts declared for the given package.
"""
metadata = super(ArtifactRegistry, self).process_package(package_name)
if metadata:
self.update_artifact_metadata(package_name, metadata) | [
"def",
"process_package",
"(",
"self",
",",
"package_name",
")",
":",
"metadata",
"=",
"super",
"(",
"ArtifactRegistry",
",",
"self",
")",
".",
"process_package",
"(",
"package_name",
")",
"if",
"metadata",
":",
"self",
".",
"update_artifact_metadata",
"(",
"p... | Build artifacts declared for the given package. | [
"Build",
"artifacts",
"declared",
"for",
"the",
"given",
"package",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L622-L629 |
weso/CWR-DataApi | cwr/grammar/field/filename.py | alphanum_variable | def alphanum_variable(min_size, max_size, name=None):
"""
Creates the grammar for an alphanumeric code where the size ranges between
two values.
:param min_size: minimum size
:param max_size: maximum size
:param name: name for the field
:return: grammar for an alphanumeric field of a variab... | python | def alphanum_variable(min_size, max_size, name=None):
"""
Creates the grammar for an alphanumeric code where the size ranges between
two values.
:param min_size: minimum size
:param max_size: maximum size
:param name: name for the field
:return: grammar for an alphanumeric field of a variab... | [
"def",
"alphanum_variable",
"(",
"min_size",
",",
"max_size",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Alphanumeric Field'",
"if",
"min_size",
"<",
"0",
":",
"# Can't have negative min",
"raise",
"BaseException",
"(",... | Creates the grammar for an alphanumeric code where the size ranges between
two values.
:param min_size: minimum size
:param max_size: maximum size
:param name: name for the field
:return: grammar for an alphanumeric field of a variable size | [
"Creates",
"the",
"grammar",
"for",
"an",
"alphanumeric",
"code",
"where",
"the",
"size",
"ranges",
"between",
"two",
"values",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/filename.py#L17-L49 |
weso/CWR-DataApi | cwr/grammar/field/filename.py | year | def year(columns, name=None):
"""
Creates the grammar for a field containing a year.
:param columns: the number of columns for the year
:param name: the name of the field
:return:
"""
if columns < 0:
# Can't have negative size
raise BaseException()
field = numeric(colu... | python | def year(columns, name=None):
"""
Creates the grammar for a field containing a year.
:param columns: the number of columns for the year
:param name: the name of the field
:return:
"""
if columns < 0:
# Can't have negative size
raise BaseException()
field = numeric(colu... | [
"def",
"year",
"(",
"columns",
",",
"name",
"=",
"None",
")",
":",
"if",
"columns",
"<",
"0",
":",
"# Can't have negative size",
"raise",
"BaseException",
"(",
")",
"field",
"=",
"numeric",
"(",
"columns",
",",
"name",
")",
"# Parse action",
"field",
".",
... | Creates the grammar for a field containing a year.
:param columns: the number of columns for the year
:param name: the name of the field
:return: | [
"Creates",
"the",
"grammar",
"for",
"a",
"field",
"containing",
"a",
"year",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/filename.py#L52-L70 |
calmjs/calmjs | src/calmjs/dist.py | is_json_compat | def is_json_compat(value):
"""
Check that the value is either a JSON decodable string or a dict
that can be encoded into a JSON.
Raises ValueError when validation fails.
"""
try:
value = json.loads(value)
except ValueError as e:
raise ValueError('JSON decoding error: ' + st... | python | def is_json_compat(value):
"""
Check that the value is either a JSON decodable string or a dict
that can be encoded into a JSON.
Raises ValueError when validation fails.
"""
try:
value = json.loads(value)
except ValueError as e:
raise ValueError('JSON decoding error: ' + st... | [
"def",
"is_json_compat",
"(",
"value",
")",
":",
"try",
":",
"value",
"=",
"json",
".",
"loads",
"(",
"value",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"ValueError",
"(",
"'JSON decoding error: '",
"+",
"str",
"(",
"e",
")",
")",
"except",
... | Check that the value is either a JSON decodable string or a dict
that can be encoded into a JSON.
Raises ValueError when validation fails. | [
"Check",
"that",
"the",
"value",
"is",
"either",
"a",
"JSON",
"decodable",
"string",
"or",
"a",
"dict",
"that",
"can",
"be",
"encoded",
"into",
"a",
"JSON",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L37-L63 |
calmjs/calmjs | src/calmjs/dist.py | validate_json_field | def validate_json_field(dist, attr, value):
"""
Check for json validity.
"""
try:
is_json_compat(value)
except ValueError as e:
raise DistutilsSetupError("%r %s" % (attr, e))
return True | python | def validate_json_field(dist, attr, value):
"""
Check for json validity.
"""
try:
is_json_compat(value)
except ValueError as e:
raise DistutilsSetupError("%r %s" % (attr, e))
return True | [
"def",
"validate_json_field",
"(",
"dist",
",",
"attr",
",",
"value",
")",
":",
"try",
":",
"is_json_compat",
"(",
"value",
")",
"except",
"ValueError",
"as",
"e",
":",
"raise",
"DistutilsSetupError",
"(",
"\"%r %s\"",
"%",
"(",
"attr",
",",
"e",
")",
")... | Check for json validity. | [
"Check",
"for",
"json",
"validity",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L66-L76 |
calmjs/calmjs | src/calmjs/dist.py | validate_line_list | def validate_line_list(dist, attr, value):
"""
Validate that the value is compatible
"""
# does not work as reliably in Python 2.
if isinstance(value, str):
value = value.split()
value = list(value)
try:
check = (' '.join(value)).split()
if check == value:
... | python | def validate_line_list(dist, attr, value):
"""
Validate that the value is compatible
"""
# does not work as reliably in Python 2.
if isinstance(value, str):
value = value.split()
value = list(value)
try:
check = (' '.join(value)).split()
if check == value:
... | [
"def",
"validate_line_list",
"(",
"dist",
",",
"attr",
",",
"value",
")",
":",
"# does not work as reliably in Python 2.",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"value",
"=",
"value",
".",
"split",
"(",
")",
"value",
"=",
"list",
"(",
"va... | Validate that the value is compatible | [
"Validate",
"that",
"the",
"value",
"is",
"compatible"
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L79-L95 |
calmjs/calmjs | src/calmjs/dist.py | write_json_file | def write_json_file(argname, cmd, basename, filename):
"""
Write JSON captured from the defined argname into the package's
egg-info directory using the specified filename.
"""
value = getattr(cmd.distribution, argname, None)
if isinstance(value, dict):
value = json.dumps(
v... | python | def write_json_file(argname, cmd, basename, filename):
"""
Write JSON captured from the defined argname into the package's
egg-info directory using the specified filename.
"""
value = getattr(cmd.distribution, argname, None)
if isinstance(value, dict):
value = json.dumps(
v... | [
"def",
"write_json_file",
"(",
"argname",
",",
"cmd",
",",
"basename",
",",
"filename",
")",
":",
"value",
"=",
"getattr",
"(",
"cmd",
".",
"distribution",
",",
"argname",
",",
"None",
")",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"valu... | Write JSON captured from the defined argname into the package's
egg-info directory using the specified filename. | [
"Write",
"JSON",
"captured",
"from",
"the",
"defined",
"argname",
"into",
"the",
"package",
"s",
"egg",
"-",
"info",
"directory",
"using",
"the",
"specified",
"filename",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L98-L110 |
calmjs/calmjs | src/calmjs/dist.py | write_line_list | def write_line_list(argname, cmd, basename, filename):
"""
Write out the retrieved value as list of lines.
"""
values = getattr(cmd.distribution, argname, None)
if isinstance(values, list):
values = '\n'.join(values)
cmd.write_or_delete_file(argname, filename, values, force=True) | python | def write_line_list(argname, cmd, basename, filename):
"""
Write out the retrieved value as list of lines.
"""
values = getattr(cmd.distribution, argname, None)
if isinstance(values, list):
values = '\n'.join(values)
cmd.write_or_delete_file(argname, filename, values, force=True) | [
"def",
"write_line_list",
"(",
"argname",
",",
"cmd",
",",
"basename",
",",
"filename",
")",
":",
"values",
"=",
"getattr",
"(",
"cmd",
".",
"distribution",
",",
"argname",
",",
"None",
")",
"if",
"isinstance",
"(",
"values",
",",
"list",
")",
":",
"va... | Write out the retrieved value as list of lines. | [
"Write",
"out",
"the",
"retrieved",
"value",
"as",
"list",
"of",
"lines",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L113-L121 |
calmjs/calmjs | src/calmjs/dist.py | find_pkg_dist | def find_pkg_dist(pkg_name, working_set=None):
"""
Locate a package's distribution by its name.
"""
working_set = working_set or default_working_set
req = Requirement.parse(pkg_name)
return working_set.find(req) | python | def find_pkg_dist(pkg_name, working_set=None):
"""
Locate a package's distribution by its name.
"""
working_set = working_set or default_working_set
req = Requirement.parse(pkg_name)
return working_set.find(req) | [
"def",
"find_pkg_dist",
"(",
"pkg_name",
",",
"working_set",
"=",
"None",
")",
":",
"working_set",
"=",
"working_set",
"or",
"default_working_set",
"req",
"=",
"Requirement",
".",
"parse",
"(",
"pkg_name",
")",
"return",
"working_set",
".",
"find",
"(",
"req",... | Locate a package's distribution by its name. | [
"Locate",
"a",
"package",
"s",
"distribution",
"by",
"its",
"name",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L124-L131 |
calmjs/calmjs | src/calmjs/dist.py | convert_package_names | def convert_package_names(package_names):
"""
Convert package names, which can be a string of a number of package
names or requirements separated by spaces.
"""
results = []
errors = []
for name in (
package_names.split()
if hasattr(package_names, 'split') else pack... | python | def convert_package_names(package_names):
"""
Convert package names, which can be a string of a number of package
names or requirements separated by spaces.
"""
results = []
errors = []
for name in (
package_names.split()
if hasattr(package_names, 'split') else pack... | [
"def",
"convert_package_names",
"(",
"package_names",
")",
":",
"results",
"=",
"[",
"]",
"errors",
"=",
"[",
"]",
"for",
"name",
"in",
"(",
"package_names",
".",
"split",
"(",
")",
"if",
"hasattr",
"(",
"package_names",
",",
"'split'",
")",
"else",
"pac... | Convert package names, which can be a string of a number of package
names or requirements separated by spaces. | [
"Convert",
"package",
"names",
"which",
"can",
"be",
"a",
"string",
"of",
"a",
"number",
"of",
"package",
"names",
"or",
"requirements",
"separated",
"by",
"spaces",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L134-L153 |
calmjs/calmjs | src/calmjs/dist.py | find_packages_requirements_dists | def find_packages_requirements_dists(pkg_names, working_set=None):
"""
Return the entire list of dependency requirements, reversed from the
bottom.
"""
working_set = working_set or default_working_set
requirements = [
r for r in (Requirement.parse(req) for req in pkg_names)
if w... | python | def find_packages_requirements_dists(pkg_names, working_set=None):
"""
Return the entire list of dependency requirements, reversed from the
bottom.
"""
working_set = working_set or default_working_set
requirements = [
r for r in (Requirement.parse(req) for req in pkg_names)
if w... | [
"def",
"find_packages_requirements_dists",
"(",
"pkg_names",
",",
"working_set",
"=",
"None",
")",
":",
"working_set",
"=",
"working_set",
"or",
"default_working_set",
"requirements",
"=",
"[",
"r",
"for",
"r",
"in",
"(",
"Requirement",
".",
"parse",
"(",
"req",... | Return the entire list of dependency requirements, reversed from the
bottom. | [
"Return",
"the",
"entire",
"list",
"of",
"dependency",
"requirements",
"reversed",
"from",
"the",
"bottom",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L162-L173 |
calmjs/calmjs | src/calmjs/dist.py | find_packages_parents_requirements_dists | def find_packages_parents_requirements_dists(pkg_names, working_set=None):
"""
Leverages the `find_packages_requirements_dists` but strip out the
distributions that matches pkg_names.
"""
dists = []
# opting for a naive implementation
targets = set(pkg_names)
for dist in find_packages_r... | python | def find_packages_parents_requirements_dists(pkg_names, working_set=None):
"""
Leverages the `find_packages_requirements_dists` but strip out the
distributions that matches pkg_names.
"""
dists = []
# opting for a naive implementation
targets = set(pkg_names)
for dist in find_packages_r... | [
"def",
"find_packages_parents_requirements_dists",
"(",
"pkg_names",
",",
"working_set",
"=",
"None",
")",
":",
"dists",
"=",
"[",
"]",
"# opting for a naive implementation",
"targets",
"=",
"set",
"(",
"pkg_names",
")",
"for",
"dist",
"in",
"find_packages_requirement... | Leverages the `find_packages_requirements_dists` but strip out the
distributions that matches pkg_names. | [
"Leverages",
"the",
"find_packages_requirements_dists",
"but",
"strip",
"out",
"the",
"distributions",
"that",
"matches",
"pkg_names",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L176-L189 |
calmjs/calmjs | src/calmjs/dist.py | read_dist_egginfo_json | def read_dist_egginfo_json(dist, filename=DEFAULT_JSON):
"""
Safely get a json within an egginfo from a distribution.
"""
# use the given package's distribution to acquire the json file.
if not dist.has_metadata(filename):
logger.debug("no '%s' for '%s'", filename, dist)
return
... | python | def read_dist_egginfo_json(dist, filename=DEFAULT_JSON):
"""
Safely get a json within an egginfo from a distribution.
"""
# use the given package's distribution to acquire the json file.
if not dist.has_metadata(filename):
logger.debug("no '%s' for '%s'", filename, dist)
return
... | [
"def",
"read_dist_egginfo_json",
"(",
"dist",
",",
"filename",
"=",
"DEFAULT_JSON",
")",
":",
"# use the given package's distribution to acquire the json file.",
"if",
"not",
"dist",
".",
"has_metadata",
"(",
"filename",
")",
":",
"logger",
".",
"debug",
"(",
"\"no '%... | Safely get a json within an egginfo from a distribution. | [
"Safely",
"get",
"a",
"json",
"within",
"an",
"egginfo",
"from",
"a",
"distribution",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L192-L216 |
calmjs/calmjs | src/calmjs/dist.py | read_egginfo_json | def read_egginfo_json(pkg_name, filename=DEFAULT_JSON, working_set=None):
"""
Read json from egginfo of a package identified by `pkg_name` that's
already installed within the current Python environment.
"""
working_set = working_set or default_working_set
dist = find_pkg_dist(pkg_name, working_... | python | def read_egginfo_json(pkg_name, filename=DEFAULT_JSON, working_set=None):
"""
Read json from egginfo of a package identified by `pkg_name` that's
already installed within the current Python environment.
"""
working_set = working_set or default_working_set
dist = find_pkg_dist(pkg_name, working_... | [
"def",
"read_egginfo_json",
"(",
"pkg_name",
",",
"filename",
"=",
"DEFAULT_JSON",
",",
"working_set",
"=",
"None",
")",
":",
"working_set",
"=",
"working_set",
"or",
"default_working_set",
"dist",
"=",
"find_pkg_dist",
"(",
"pkg_name",
",",
"working_set",
"=",
... | Read json from egginfo of a package identified by `pkg_name` that's
already installed within the current Python environment. | [
"Read",
"json",
"from",
"egginfo",
"of",
"a",
"package",
"identified",
"by",
"pkg_name",
"that",
"s",
"already",
"installed",
"within",
"the",
"current",
"Python",
"environment",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L219-L227 |
calmjs/calmjs | src/calmjs/dist.py | flatten_dist_egginfo_json | def flatten_dist_egginfo_json(
source_dists, filename=DEFAULT_JSON, dep_keys=DEP_KEYS,
working_set=None):
"""
Flatten a distribution's egginfo json, with the depended keys to be
flattened.
Originally this was done for this:
Resolve a distribution's (dev)dependencies through the wor... | python | def flatten_dist_egginfo_json(
source_dists, filename=DEFAULT_JSON, dep_keys=DEP_KEYS,
working_set=None):
"""
Flatten a distribution's egginfo json, with the depended keys to be
flattened.
Originally this was done for this:
Resolve a distribution's (dev)dependencies through the wor... | [
"def",
"flatten_dist_egginfo_json",
"(",
"source_dists",
",",
"filename",
"=",
"DEFAULT_JSON",
",",
"dep_keys",
"=",
"DEP_KEYS",
",",
"working_set",
"=",
"None",
")",
":",
"working_set",
"=",
"working_set",
"or",
"default_working_set",
"obj",
"=",
"{",
"}",
"# T... | Flatten a distribution's egginfo json, with the depended keys to be
flattened.
Originally this was done for this:
Resolve a distribution's (dev)dependencies through the working set
and generate a flattened version package.json, returned as a dict,
from the resolved distributions.
Default work... | [
"Flatten",
"a",
"distribution",
"s",
"egginfo",
"json",
"with",
"the",
"depended",
"keys",
"to",
"be",
"flattened",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L245-L301 |
calmjs/calmjs | src/calmjs/dist.py | flatten_egginfo_json | def flatten_egginfo_json(
pkg_names, filename=DEFAULT_JSON, dep_keys=DEP_KEYS, working_set=None):
"""
A shorthand calling convention where the package name is supplied
instead of a distribution.
Originally written for this:
Generate a flattened package.json with packages `pkg_names` that a... | python | def flatten_egginfo_json(
pkg_names, filename=DEFAULT_JSON, dep_keys=DEP_KEYS, working_set=None):
"""
A shorthand calling convention where the package name is supplied
instead of a distribution.
Originally written for this:
Generate a flattened package.json with packages `pkg_names` that a... | [
"def",
"flatten_egginfo_json",
"(",
"pkg_names",
",",
"filename",
"=",
"DEFAULT_JSON",
",",
"dep_keys",
"=",
"DEP_KEYS",
",",
"working_set",
"=",
"None",
")",
":",
"working_set",
"=",
"working_set",
"or",
"default_working_set",
"# Ensure only grabbing packages that exis... | A shorthand calling convention where the package name is supplied
instead of a distribution.
Originally written for this:
Generate a flattened package.json with packages `pkg_names` that are
already installed within the current Python environment (defaults
to the current global working_set which s... | [
"A",
"shorthand",
"calling",
"convention",
"where",
"the",
"package",
"name",
"is",
"supplied",
"instead",
"of",
"a",
"distribution",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L304-L323 |
calmjs/calmjs | src/calmjs/dist.py | build_helpers_egginfo_json | def build_helpers_egginfo_json(
json_field, json_key_registry, json_filename=None):
"""
Return a tuple of functions that will provide the usage of the
JSON egginfo based around the provided field.
"""
json_filename = (
json_field + '.json' if json_filename is None else json_filename... | python | def build_helpers_egginfo_json(
json_field, json_key_registry, json_filename=None):
"""
Return a tuple of functions that will provide the usage of the
JSON egginfo based around the provided field.
"""
json_filename = (
json_field + '.json' if json_filename is None else json_filename... | [
"def",
"build_helpers_egginfo_json",
"(",
"json_field",
",",
"json_key_registry",
",",
"json_filename",
"=",
"None",
")",
":",
"json_filename",
"=",
"(",
"json_field",
"+",
"'.json'",
"if",
"json_filename",
"is",
"None",
"else",
"json_filename",
")",
"# Default calm... | Return a tuple of functions that will provide the usage of the
JSON egginfo based around the provided field. | [
"Return",
"a",
"tuple",
"of",
"functions",
"that",
"will",
"provide",
"the",
"usage",
"of",
"the",
"JSON",
"egginfo",
"based",
"around",
"the",
"provided",
"field",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L326-L390 |
calmjs/calmjs | src/calmjs/dist.py | build_helpers_module_registry_dependencies | def build_helpers_module_registry_dependencies(registry_name='calmjs.module'):
"""
Return a tuple of funtions that will provide the functions that
return the relevant sets of module registry records based on the
dependencies defined for the provided packages.
"""
def get_module_registry_depende... | python | def build_helpers_module_registry_dependencies(registry_name='calmjs.module'):
"""
Return a tuple of funtions that will provide the functions that
return the relevant sets of module registry records based on the
dependencies defined for the provided packages.
"""
def get_module_registry_depende... | [
"def",
"build_helpers_module_registry_dependencies",
"(",
"registry_name",
"=",
"'calmjs.module'",
")",
":",
"def",
"get_module_registry_dependencies",
"(",
"pkg_names",
",",
"registry_name",
"=",
"registry_name",
",",
"working_set",
"=",
"None",
")",
":",
"\"\"\"\n ... | Return a tuple of funtions that will provide the functions that
return the relevant sets of module registry records based on the
dependencies defined for the provided packages. | [
"Return",
"a",
"tuple",
"of",
"funtions",
"that",
"will",
"provide",
"the",
"functions",
"that",
"return",
"the",
"relevant",
"sets",
"of",
"module",
"registry",
"records",
"based",
"on",
"the",
"dependencies",
"defined",
"for",
"the",
"provided",
"packages",
... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L398-L484 |
calmjs/calmjs | src/calmjs/dist.py | has_calmjs_artifact_declarations | def has_calmjs_artifact_declarations(cmd, registry_name='calmjs.artifacts'):
"""
For a distutils command to verify that the artifact build step is
possible.
"""
return any(get(registry_name).iter_records_for(
cmd.distribution.get_name())) | python | def has_calmjs_artifact_declarations(cmd, registry_name='calmjs.artifacts'):
"""
For a distutils command to verify that the artifact build step is
possible.
"""
return any(get(registry_name).iter_records_for(
cmd.distribution.get_name())) | [
"def",
"has_calmjs_artifact_declarations",
"(",
"cmd",
",",
"registry_name",
"=",
"'calmjs.artifacts'",
")",
":",
"return",
"any",
"(",
"get",
"(",
"registry_name",
")",
".",
"iter_records_for",
"(",
"cmd",
".",
"distribution",
".",
"get_name",
"(",
")",
")",
... | For a distutils command to verify that the artifact build step is
possible. | [
"For",
"a",
"distutils",
"command",
"to",
"verify",
"that",
"the",
"artifact",
"build",
"step",
"is",
"possible",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L551-L558 |
calmjs/calmjs | src/calmjs/dist.py | build_calmjs_artifacts | def build_calmjs_artifacts(dist, key, value, cmdclass=BuildCommand):
"""
Trigger the artifact build process through the setuptools.
"""
if value is not True:
return
build_cmd = dist.get_command_obj('build')
if not isinstance(build_cmd, cmdclass):
logger.error(
"'bui... | python | def build_calmjs_artifacts(dist, key, value, cmdclass=BuildCommand):
"""
Trigger the artifact build process through the setuptools.
"""
if value is not True:
return
build_cmd = dist.get_command_obj('build')
if not isinstance(build_cmd, cmdclass):
logger.error(
"'bui... | [
"def",
"build_calmjs_artifacts",
"(",
"dist",
",",
"key",
",",
"value",
",",
"cmdclass",
"=",
"BuildCommand",
")",
":",
"if",
"value",
"is",
"not",
"True",
":",
"return",
"build_cmd",
"=",
"dist",
".",
"get_command_obj",
"(",
"'build'",
")",
"if",
"not",
... | Trigger the artifact build process through the setuptools. | [
"Trigger",
"the",
"artifact",
"build",
"process",
"through",
"the",
"setuptools",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/dist.py#L561-L577 |
weso/CWR-DataApi | cwr/grammar/factory/rule.py | FieldRuleFactory.get_rule | def get_rule(self, field_id):
"""
Returns the rule for the field identified by the id.
If it is set as not being compulsory, the rule will be adapted to
accept string composed only of white characters.
:param field_id: unique id in the system for the field
:return: the ... | python | def get_rule(self, field_id):
"""
Returns the rule for the field identified by the id.
If it is set as not being compulsory, the rule will be adapted to
accept string composed only of white characters.
:param field_id: unique id in the system for the field
:return: the ... | [
"def",
"get_rule",
"(",
"self",
",",
"field_id",
")",
":",
"if",
"field_id",
"in",
"self",
".",
"_fields",
":",
"# Field already exists",
"field",
"=",
"self",
".",
"_fields",
"[",
"field_id",
"]",
"else",
":",
"# Field does not exist",
"# It is created",
"fie... | Returns the rule for the field identified by the id.
If it is set as not being compulsory, the rule will be adapted to
accept string composed only of white characters.
:param field_id: unique id in the system for the field
:return: the rule of a field | [
"Returns",
"the",
"rule",
"for",
"the",
"field",
"identified",
"by",
"the",
"id",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/factory/rule.py#L41-L63 |
weso/CWR-DataApi | cwr/grammar/factory/rule.py | FieldRuleFactory._create_field | def _create_field(self, field_id):
"""
Creates the field with the specified parameters.
:param field_id: identifier for the field
:return: the basic rule for the field
"""
# Field configuration info
config = self._field_configs[field_id]
adapter = self._... | python | def _create_field(self, field_id):
"""
Creates the field with the specified parameters.
:param field_id: identifier for the field
:return: the basic rule for the field
"""
# Field configuration info
config = self._field_configs[field_id]
adapter = self._... | [
"def",
"_create_field",
"(",
"self",
",",
"field_id",
")",
":",
"# Field configuration info",
"config",
"=",
"self",
".",
"_field_configs",
"[",
"field_id",
"]",
"adapter",
"=",
"self",
".",
"_adapters",
"[",
"config",
"[",
"'type'",
"]",
"]",
"if",
"'name'"... | Creates the field with the specified parameters.
:param field_id: identifier for the field
:return: the basic rule for the field | [
"Creates",
"the",
"field",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/factory/rule.py#L65-L99 |
weso/CWR-DataApi | data_cwr/accessor.py | _FileReader.read_csv_file | def read_csv_file(self, file_name):
"""
Parses a CSV file into a list.
:param file_name: name of the CSV file
:return: a list with the file's contents
"""
result = []
with open(os.path.join(self.__path(), os.path.basename(file_name)),
'rt') as c... | python | def read_csv_file(self, file_name):
"""
Parses a CSV file into a list.
:param file_name: name of the CSV file
:return: a list with the file's contents
"""
result = []
with open(os.path.join(self.__path(), os.path.basename(file_name)),
'rt') as c... | [
"def",
"read_csv_file",
"(",
"self",
",",
"file_name",
")",
":",
"result",
"=",
"[",
"]",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"__path",
"(",
")",
",",
"os",
".",
"path",
".",
"basename",
"(",
"file_name",
")",
"... | Parses a CSV file into a list.
:param file_name: name of the CSV file
:return: a list with the file's contents | [
"Parses",
"a",
"CSV",
"file",
"into",
"a",
"list",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/data_cwr/accessor.py#L39-L53 |
weso/CWR-DataApi | data_cwr/accessor.py | _FileReader.read_yaml_file | def read_yaml_file(self, file_name):
"""
Parses a YAML file into a matrix.
:param file_name: name of the YAML file
:return: a matrix with the file's contents
"""
with open(os.path.join(self.__path(), os.path.basename(file_name)),
'rt') as yamlfile:
... | python | def read_yaml_file(self, file_name):
"""
Parses a YAML file into a matrix.
:param file_name: name of the YAML file
:return: a matrix with the file's contents
"""
with open(os.path.join(self.__path(), os.path.basename(file_name)),
'rt') as yamlfile:
... | [
"def",
"read_yaml_file",
"(",
"self",
",",
"file_name",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"__path",
"(",
")",
",",
"os",
".",
"path",
".",
"basename",
"(",
"file_name",
")",
")",
",",
"'rt'",
")",
"a... | Parses a YAML file into a matrix.
:param file_name: name of the YAML file
:return: a matrix with the file's contents | [
"Parses",
"a",
"YAML",
"file",
"into",
"a",
"matrix",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/data_cwr/accessor.py#L55-L64 |
weso/CWR-DataApi | data_cwr/accessor.py | CWRTables.get_data | def get_data(self, file_id):
"""
Acquires the data from the table identified by the id.
The file is read only once, consecutive calls to this method will
return the sale collection.
:param file_id: identifier for the table
:return: all the values from the table
... | python | def get_data(self, file_id):
"""
Acquires the data from the table identified by the id.
The file is read only once, consecutive calls to this method will
return the sale collection.
:param file_id: identifier for the table
:return: all the values from the table
... | [
"def",
"get_data",
"(",
"self",
",",
"file_id",
")",
":",
"if",
"file_id",
"not",
"in",
"self",
".",
"_file_values",
":",
"file_contents",
"=",
"'cwr_%s.csv'",
"%",
"file_id",
"self",
".",
"_file_values",
"[",
"file_id",
"]",
"=",
"self",
".",
"_reader",
... | Acquires the data from the table identified by the id.
The file is read only once, consecutive calls to this method will
return the sale collection.
:param file_id: identifier for the table
:return: all the values from the table | [
"Acquires",
"the",
"data",
"from",
"the",
"table",
"identified",
"by",
"the",
"id",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/data_cwr/accessor.py#L82-L97 |
weso/CWR-DataApi | cwr/grammar/field/record.py | record_type | def record_type(values):
"""
Creates a record type field.
These serve as the header field on records, identifying them.
Usually this field can be only an specific value, but sometimes a small
range of codes is allowed. This is specified by the 'values' parameter.
While it is possible to set t... | python | def record_type(values):
"""
Creates a record type field.
These serve as the header field on records, identifying them.
Usually this field can be only an specific value, but sometimes a small
range of codes is allowed. This is specified by the 'values' parameter.
While it is possible to set t... | [
"def",
"record_type",
"(",
"values",
")",
":",
"field",
"=",
"basic",
".",
"lookup",
"(",
"values",
",",
"name",
"=",
"'Record Type (one of %s)'",
"%",
"values",
")",
"return",
"field",
".",
"setResultsName",
"(",
"'record_type'",
")"
] | Creates a record type field.
These serve as the header field on records, identifying them.
Usually this field can be only an specific value, but sometimes a small
range of codes is allowed. This is specified by the 'values' parameter.
While it is possible to set this field as optional, it is expected... | [
"Creates",
"a",
"record",
"type",
"field",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/record.py#L25-L42 |
weso/CWR-DataApi | cwr/grammar/field/record.py | record_prefix | def record_prefix(required_type, factory):
"""
Creates a record prefix for the specified record type.
:param required_type: the type of the record using this prefix
:param factory: field factory
:return: the record prefix
"""
field = record_type(required_type)
field += factory.get_rule(... | python | def record_prefix(required_type, factory):
"""
Creates a record prefix for the specified record type.
:param required_type: the type of the record using this prefix
:param factory: field factory
:return: the record prefix
"""
field = record_type(required_type)
field += factory.get_rule(... | [
"def",
"record_prefix",
"(",
"required_type",
",",
"factory",
")",
":",
"field",
"=",
"record_type",
"(",
"required_type",
")",
"field",
"+=",
"factory",
".",
"get_rule",
"(",
"'transaction_sequence_n'",
")",
"field",
"+=",
"factory",
".",
"get_rule",
"(",
"'r... | Creates a record prefix for the specified record type.
:param required_type: the type of the record using this prefix
:param factory: field factory
:return: the record prefix | [
"Creates",
"a",
"record",
"prefix",
"for",
"the",
"specified",
"record",
"type",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/record.py#L46-L60 |
weso/CWR-DataApi | cwr/parser/encoder/standart/field.py | CwrFieldEncoder.expand_entity | def expand_entity(self, entity):
"""
Search and return entity or sub entity that contain value of this field.
:param entity:
:return: entity
:raise KeyError
"""
if self.name in entity:
return entity
for key, value in entity.items():
... | python | def expand_entity(self, entity):
"""
Search and return entity or sub entity that contain value of this field.
:param entity:
:return: entity
:raise KeyError
"""
if self.name in entity:
return entity
for key, value in entity.items():
... | [
"def",
"expand_entity",
"(",
"self",
",",
"entity",
")",
":",
"if",
"self",
".",
"name",
"in",
"entity",
":",
"return",
"entity",
"for",
"key",
",",
"value",
"in",
"entity",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
... | Search and return entity or sub entity that contain value of this field.
:param entity:
:return: entity
:raise KeyError | [
"Search",
"and",
"return",
"entity",
"or",
"sub",
"entity",
"that",
"contain",
"value",
"of",
"this",
"field",
".",
":",
"param",
"entity",
":",
":",
"return",
":",
"entity",
":",
"raise",
"KeyError"
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/encoder/standart/field.py#L43-L56 |
weso/CWR-DataApi | cwr/parser/encoder/standart/field.py | CwrFieldEncoder.encode | def encode(self, entity):
"""
Encode this
:param entity:
:return: cwr string
"""
entity = self.expand_entity(entity)
value = entity[self.name]
result = self.format(value)
return result | python | def encode(self, entity):
"""
Encode this
:param entity:
:return: cwr string
"""
entity = self.expand_entity(entity)
value = entity[self.name]
result = self.format(value)
return result | [
"def",
"encode",
"(",
"self",
",",
"entity",
")",
":",
"entity",
"=",
"self",
".",
"expand_entity",
"(",
"entity",
")",
"value",
"=",
"entity",
"[",
"self",
".",
"name",
"]",
"result",
"=",
"self",
".",
"format",
"(",
"value",
")",
"return",
"result"... | Encode this
:param entity:
:return: cwr string | [
"Encode",
"this",
":",
"param",
"entity",
":",
":",
"return",
":",
"cwr",
"string"
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/encoder/standart/field.py#L58-L67 |
weso/CWR-DataApi | config_cwr/accessor.py | _FileReader.read_config_file | def read_config_file(self, file_name):
"""
Reads a CWR grammar config file.
:param file_name: name of the text file
:return: the file's contents
"""
with open(os.path.join(self.__path(), os.path.basename(file_name)),
'rt') as file_config:
re... | python | def read_config_file(self, file_name):
"""
Reads a CWR grammar config file.
:param file_name: name of the text file
:return: the file's contents
"""
with open(os.path.join(self.__path(), os.path.basename(file_name)),
'rt') as file_config:
re... | [
"def",
"read_config_file",
"(",
"self",
",",
"file_name",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"__path",
"(",
")",
",",
"os",
".",
"path",
".",
"basename",
"(",
"file_name",
")",
")",
",",
"'rt'",
")",
... | Reads a CWR grammar config file.
:param file_name: name of the text file
:return: the file's contents | [
"Reads",
"a",
"CWR",
"grammar",
"config",
"file",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/config_cwr/accessor.py#L48-L57 |
weso/CWR-DataApi | config_cwr/accessor.py | CWRConfiguration._load_cwr_defaults | def _load_cwr_defaults(self):
"""
Loads the CWR default values file, creating a matrix from it, and then
returns this data.
The file will only be loaded once.
:return: the CWR default values matrix
"""
if self._cwr_defaults is None:
self._cwr_default... | python | def _load_cwr_defaults(self):
"""
Loads the CWR default values file, creating a matrix from it, and then
returns this data.
The file will only be loaded once.
:return: the CWR default values matrix
"""
if self._cwr_defaults is None:
self._cwr_default... | [
"def",
"_load_cwr_defaults",
"(",
"self",
")",
":",
"if",
"self",
".",
"_cwr_defaults",
"is",
"None",
":",
"self",
".",
"_cwr_defaults",
"=",
"self",
".",
"_reader",
".",
"read_yaml_file",
"(",
"self",
".",
"_file_defaults",
")",
"return",
"self",
".",
"_c... | Loads the CWR default values file, creating a matrix from it, and then
returns this data.
The file will only be loaded once.
:return: the CWR default values matrix | [
"Loads",
"the",
"CWR",
"default",
"values",
"file",
"creating",
"a",
"matrix",
"from",
"it",
"and",
"then",
"returns",
"this",
"data",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/config_cwr/accessor.py#L82-L95 |
weso/CWR-DataApi | config_cwr/accessor.py | CWRConfiguration.load_field_config | def load_field_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._field_configs:
self._field_configs[file_id] = self._reader.read_yaml_f... | python | def load_field_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._field_configs:
self._field_configs[file_id] = self._reader.read_yaml_f... | [
"def",
"load_field_config",
"(",
"self",
",",
"file_id",
")",
":",
"if",
"file_id",
"not",
"in",
"self",
".",
"_field_configs",
":",
"self",
".",
"_field_configs",
"[",
"file_id",
"]",
"=",
"self",
".",
"_reader",
".",
"read_yaml_file",
"(",
"'field_config_%... | Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration | [
"Loads",
"the",
"configuration",
"fields",
"file",
"for",
"the",
"id",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/config_cwr/accessor.py#L97-L108 |
weso/CWR-DataApi | config_cwr/accessor.py | CWRConfiguration.load_group_config | def load_group_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._group_configs:
self._group_configs[file_id] = self._reader.read_config... | python | def load_group_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._group_configs:
self._group_configs[file_id] = self._reader.read_config... | [
"def",
"load_group_config",
"(",
"self",
",",
"file_id",
")",
":",
"if",
"file_id",
"not",
"in",
"self",
".",
"_group_configs",
":",
"self",
".",
"_group_configs",
"[",
"file_id",
"]",
"=",
"self",
".",
"_reader",
".",
"read_config_file",
"(",
"'group_config... | Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration | [
"Loads",
"the",
"configuration",
"fields",
"file",
"for",
"the",
"id",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/config_cwr/accessor.py#L110-L121 |
weso/CWR-DataApi | config_cwr/accessor.py | CWRConfiguration.load_record_config | def load_record_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._record_configs:
self._record_configs[file_id] = self._reader.read_con... | python | def load_record_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._record_configs:
self._record_configs[file_id] = self._reader.read_con... | [
"def",
"load_record_config",
"(",
"self",
",",
"file_id",
")",
":",
"if",
"file_id",
"not",
"in",
"self",
".",
"_record_configs",
":",
"self",
".",
"_record_configs",
"[",
"file_id",
"]",
"=",
"self",
".",
"_reader",
".",
"read_config_file",
"(",
"'record_co... | Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration | [
"Loads",
"the",
"configuration",
"fields",
"file",
"for",
"the",
"id",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/config_cwr/accessor.py#L123-L134 |
weso/CWR-DataApi | config_cwr/accessor.py | CWRConfiguration.load_transaction_config | def load_transaction_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._transaction_configs:
self._transaction_configs[file_id] = self._... | python | def load_transaction_config(self, file_id):
"""
Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration
"""
if file_id not in self._transaction_configs:
self._transaction_configs[file_id] = self._... | [
"def",
"load_transaction_config",
"(",
"self",
",",
"file_id",
")",
":",
"if",
"file_id",
"not",
"in",
"self",
".",
"_transaction_configs",
":",
"self",
".",
"_transaction_configs",
"[",
"file_id",
"]",
"=",
"self",
".",
"_reader",
".",
"read_config_file",
"("... | Loads the configuration fields file for the id.
:param file_id: the id for the field
:return: the fields configuration | [
"Loads",
"the",
"configuration",
"fields",
"file",
"for",
"the",
"id",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/config_cwr/accessor.py#L136-L147 |
weso/CWR-DataApi | config_cwr/accessor.py | CWRConfiguration.load_acknowledge_config | def load_acknowledge_config(self, file_id):
"""
Loads the CWR acknowledge config
:return: the values matrix
"""
if self._cwr_defaults is None:
self._cwr_defaults = self._reader.read_yaml_file(
'acknowledge_config_%s.yml' % file_id)
return self... | python | def load_acknowledge_config(self, file_id):
"""
Loads the CWR acknowledge config
:return: the values matrix
"""
if self._cwr_defaults is None:
self._cwr_defaults = self._reader.read_yaml_file(
'acknowledge_config_%s.yml' % file_id)
return self... | [
"def",
"load_acknowledge_config",
"(",
"self",
",",
"file_id",
")",
":",
"if",
"self",
".",
"_cwr_defaults",
"is",
"None",
":",
"self",
".",
"_cwr_defaults",
"=",
"self",
".",
"_reader",
".",
"read_yaml_file",
"(",
"'acknowledge_config_%s.yml'",
"%",
"file_id",
... | Loads the CWR acknowledge config
:return: the values matrix | [
"Loads",
"the",
"CWR",
"acknowledge",
"config",
":",
"return",
":",
"the",
"values",
"matrix"
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/config_cwr/accessor.py#L157-L166 |
calmjs/calmjs | src/calmjs/argparse.py | ArgumentParser.soft_error | def soft_error(self, message):
"""
Same as error, without the dying in a fire part.
"""
self.print_usage(sys.stderr)
args = {'prog': self.prog, 'message': message}
self._print_message(
_('%(prog)s: error: %(message)s\n') % args, sys.stderr) | python | def soft_error(self, message):
"""
Same as error, without the dying in a fire part.
"""
self.print_usage(sys.stderr)
args = {'prog': self.prog, 'message': message}
self._print_message(
_('%(prog)s: error: %(message)s\n') % args, sys.stderr) | [
"def",
"soft_error",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"print_usage",
"(",
"sys",
".",
"stderr",
")",
"args",
"=",
"{",
"'prog'",
":",
"self",
".",
"prog",
",",
"'message'",
":",
"message",
"}",
"self",
".",
"_print_message",
"(",
"... | Same as error, without the dying in a fire part. | [
"Same",
"as",
"error",
"without",
"the",
"dying",
"in",
"a",
"fire",
"part",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/argparse.py#L262-L270 |
weso/CWR-DataApi | cwr/parser/decoder/file.py | default_filename_decoder | def default_filename_decoder():
"""
Creates a decoder which parses CWR filenames following the old or the new
convention.
:return: a CWR filename decoder for the old and the new conventions
"""
factory = default_filename_grammar_factory()
grammar_old = factory.get_rule('filename_old')
... | python | def default_filename_decoder():
"""
Creates a decoder which parses CWR filenames following the old or the new
convention.
:return: a CWR filename decoder for the old and the new conventions
"""
factory = default_filename_grammar_factory()
grammar_old = factory.get_rule('filename_old')
... | [
"def",
"default_filename_decoder",
"(",
")",
":",
"factory",
"=",
"default_filename_grammar_factory",
"(",
")",
"grammar_old",
"=",
"factory",
".",
"get_rule",
"(",
"'filename_old'",
")",
"grammar_new",
"=",
"factory",
".",
"get_rule",
"(",
"'filename_new'",
")",
... | Creates a decoder which parses CWR filenames following the old or the new
convention.
:return: a CWR filename decoder for the old and the new conventions | [
"Creates",
"a",
"decoder",
"which",
"parses",
"CWR",
"filenames",
"following",
"the",
"old",
"or",
"the",
"new",
"convention",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/decoder/file.py#L252-L264 |
weso/CWR-DataApi | cwr/parser/decoder/file.py | FileDecoder.decode | def decode(self, data):
"""
Parses the file, creating a CWRFile from it.
It requires a dictionary with two values:
- filename, containing the filename
- contents, containing the file contents
:param data: dictionary with the data to parse
:return: a CWRFile inst... | python | def decode(self, data):
"""
Parses the file, creating a CWRFile from it.
It requires a dictionary with two values:
- filename, containing the filename
- contents, containing the file contents
:param data: dictionary with the data to parse
:return: a CWRFile inst... | [
"def",
"decode",
"(",
"self",
",",
"data",
")",
":",
"file_name",
"=",
"self",
".",
"_filename_decoder",
".",
"decode",
"(",
"data",
"[",
"'filename'",
"]",
")",
"file_data",
"=",
"data",
"[",
"'contents'",
"]",
"i",
"=",
"0",
"max_size",
"=",
"len",
... | Parses the file, creating a CWRFile from it.
It requires a dictionary with two values:
- filename, containing the filename
- contents, containing the file contents
:param data: dictionary with the data to parse
:return: a CWRFile instance | [
"Parses",
"the",
"file",
"creating",
"a",
"CWRFile",
"from",
"it",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/decoder/file.py#L287-L310 |
weso/CWR-DataApi | cwr/parser/decoder/file.py | FileNameDecoder.decode | def decode(self, file_name):
"""
Parses the filename, creating a FileTag from it.
It will try both the old and the new conventions, if the filename does
not conform any of them, then an empty FileTag will be returned.
:param file_name: filename to parse
:return: a FileT... | python | def decode(self, file_name):
"""
Parses the filename, creating a FileTag from it.
It will try both the old and the new conventions, if the filename does
not conform any of them, then an empty FileTag will be returned.
:param file_name: filename to parse
:return: a FileT... | [
"def",
"decode",
"(",
"self",
",",
"file_name",
")",
":",
"try",
":",
"file_tag",
"=",
"self",
".",
"_filename_decoder_new",
".",
"decode",
"(",
"file_name",
")",
"except",
":",
"try",
":",
"file_tag",
"=",
"self",
".",
"_filename_decoder_old",
".",
"decod... | Parses the filename, creating a FileTag from it.
It will try both the old and the new conventions, if the filename does
not conform any of them, then an empty FileTag will be returned.
:param file_name: filename to parse
:return: a FileTag instance | [
"Parses",
"the",
"filename",
"creating",
"a",
"FileTag",
"from",
"it",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/decoder/file.py#L329-L347 |
calmjs/calmjs | src/calmjs/utils.py | enable_pretty_logging | def enable_pretty_logging(logger='calmjs', level=logging.DEBUG, stream=None):
"""
Shorthand to enable pretty logging
"""
def cleanup():
logger.removeHandler(handler)
logger.level = old_level
if not isinstance(logger, logging.Logger):
logger = logging.getLogger(logger)
... | python | def enable_pretty_logging(logger='calmjs', level=logging.DEBUG, stream=None):
"""
Shorthand to enable pretty logging
"""
def cleanup():
logger.removeHandler(handler)
logger.level = old_level
if not isinstance(logger, logging.Logger):
logger = logging.getLogger(logger)
... | [
"def",
"enable_pretty_logging",
"(",
"logger",
"=",
"'calmjs'",
",",
"level",
"=",
"logging",
".",
"DEBUG",
",",
"stream",
"=",
"None",
")",
":",
"def",
"cleanup",
"(",
")",
":",
"logger",
".",
"removeHandler",
"(",
"handler",
")",
"logger",
".",
"level"... | Shorthand to enable pretty logging | [
"Shorthand",
"to",
"enable",
"pretty",
"logging"
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/utils.py#L53-L71 |
calmjs/calmjs | src/calmjs/utils.py | finalize_env | def finalize_env(env):
"""
Produce a platform specific env for passing into subprocess.Popen
family of external process calling methods, and the supplied env
will be updated on top of it. Returns a new env.
"""
keys = _PLATFORM_ENV_KEYS.get(sys.platform, [])
if 'PATH' not in keys:
... | python | def finalize_env(env):
"""
Produce a platform specific env for passing into subprocess.Popen
family of external process calling methods, and the supplied env
will be updated on top of it. Returns a new env.
"""
keys = _PLATFORM_ENV_KEYS.get(sys.platform, [])
if 'PATH' not in keys:
... | [
"def",
"finalize_env",
"(",
"env",
")",
":",
"keys",
"=",
"_PLATFORM_ENV_KEYS",
".",
"get",
"(",
"sys",
".",
"platform",
",",
"[",
"]",
")",
"if",
"'PATH'",
"not",
"in",
"keys",
":",
"# this MUST be available due to Node.js (and others really)",
"# needing somethi... | Produce a platform specific env for passing into subprocess.Popen
family of external process calling methods, and the supplied env
will be updated on top of it. Returns a new env. | [
"Produce",
"a",
"platform",
"specific",
"env",
"for",
"passing",
"into",
"subprocess",
".",
"Popen",
"family",
"of",
"external",
"process",
"calling",
"methods",
"and",
"the",
"supplied",
"env",
"will",
"be",
"updated",
"on",
"top",
"of",
"it",
".",
"Returns... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/utils.py#L83-L100 |
calmjs/calmjs | src/calmjs/utils.py | fork_exec | def fork_exec(args, stdin='', **kwargs):
"""
Do a fork-exec through the subprocess.Popen abstraction in a way
that takes a stdin and return stdout.
"""
as_bytes = isinstance(stdin, bytes)
source = stdin if as_bytes else stdin.encode(locale)
p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PI... | python | def fork_exec(args, stdin='', **kwargs):
"""
Do a fork-exec through the subprocess.Popen abstraction in a way
that takes a stdin and return stdout.
"""
as_bytes = isinstance(stdin, bytes)
source = stdin if as_bytes else stdin.encode(locale)
p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PI... | [
"def",
"fork_exec",
"(",
"args",
",",
"stdin",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"as_bytes",
"=",
"isinstance",
"(",
"stdin",
",",
"bytes",
")",
"source",
"=",
"stdin",
"if",
"as_bytes",
"else",
"stdin",
".",
"encode",
"(",
"locale",
")",... | Do a fork-exec through the subprocess.Popen abstraction in a way
that takes a stdin and return stdout. | [
"Do",
"a",
"fork",
"-",
"exec",
"through",
"the",
"subprocess",
".",
"Popen",
"abstraction",
"in",
"a",
"way",
"that",
"takes",
"a",
"stdin",
"and",
"return",
"stdout",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/utils.py#L103-L115 |
calmjs/calmjs | src/calmjs/utils.py | raise_os_error | def raise_os_error(_errno, path=None):
"""
Helper for raising the correct exception under Python 3 while still
being able to raise the same common exception class in Python 2.7.
"""
msg = "%s: '%s'" % (strerror(_errno), path) if path else strerror(_errno)
raise OSError(_errno, msg) | python | def raise_os_error(_errno, path=None):
"""
Helper for raising the correct exception under Python 3 while still
being able to raise the same common exception class in Python 2.7.
"""
msg = "%s: '%s'" % (strerror(_errno), path) if path else strerror(_errno)
raise OSError(_errno, msg) | [
"def",
"raise_os_error",
"(",
"_errno",
",",
"path",
"=",
"None",
")",
":",
"msg",
"=",
"\"%s: '%s'\"",
"%",
"(",
"strerror",
"(",
"_errno",
")",
",",
"path",
")",
"if",
"path",
"else",
"strerror",
"(",
"_errno",
")",
"raise",
"OSError",
"(",
"_errno",... | Helper for raising the correct exception under Python 3 while still
being able to raise the same common exception class in Python 2.7. | [
"Helper",
"for",
"raising",
"the",
"correct",
"exception",
"under",
"Python",
"3",
"while",
"still",
"being",
"able",
"to",
"raise",
"the",
"same",
"common",
"exception",
"class",
"in",
"Python",
"2",
".",
"7",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/utils.py#L118-L125 |
calmjs/calmjs | src/calmjs/utils.py | which | def which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""
Given cmd, check where it is on PATH.
Loosely based on the version in python 3.3.
"""
if os.path.dirname(cmd):
if os.path.isfile(cmd) and os.access(cmd, mode):
return cmd
if path is None:
path = os.environ.get(... | python | def which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""
Given cmd, check where it is on PATH.
Loosely based on the version in python 3.3.
"""
if os.path.dirname(cmd):
if os.path.isfile(cmd) and os.access(cmd, mode):
return cmd
if path is None:
path = os.environ.get(... | [
"def",
"which",
"(",
"cmd",
",",
"mode",
"=",
"os",
".",
"F_OK",
"|",
"os",
".",
"X_OK",
",",
"path",
"=",
"None",
")",
":",
"if",
"os",
".",
"path",
".",
"dirname",
"(",
"cmd",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"cmd",
... | Given cmd, check where it is on PATH.
Loosely based on the version in python 3.3. | [
"Given",
"cmd",
"check",
"where",
"it",
"is",
"on",
"PATH",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/utils.py#L128-L173 |
calmjs/calmjs | src/calmjs/registry.py | Registry._init | def _init(self):
"""
Turn the records into actual usable keys.
"""
self._entry_points = {}
for entry_point in self.raw_entry_points:
if entry_point.dist.project_name != self.reserved.get(
entry_point.name, entry_point.dist.project_name):
... | python | def _init(self):
"""
Turn the records into actual usable keys.
"""
self._entry_points = {}
for entry_point in self.raw_entry_points:
if entry_point.dist.project_name != self.reserved.get(
entry_point.name, entry_point.dist.project_name):
... | [
"def",
"_init",
"(",
"self",
")",
":",
"self",
".",
"_entry_points",
"=",
"{",
"}",
"for",
"entry_point",
"in",
"self",
".",
"raw_entry_points",
":",
"if",
"entry_point",
".",
"dist",
".",
"project_name",
"!=",
"self",
".",
"reserved",
".",
"get",
"(",
... | Turn the records into actual usable keys. | [
"Turn",
"the",
"records",
"into",
"actual",
"usable",
"keys",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/registry.py#L66-L96 |
calmjs/calmjs | src/calmjs/toolchain.py | dict_update_overwrite_check | def dict_update_overwrite_check(base, fresh):
"""
For updating a base dict with a fresh one, returning a list of
3-tuples containing the key, previous value (base[key]) and the
fresh value (fresh[key]) for all colliding changes (reassignment of
identical values are omitted).
"""
result = [
... | python | def dict_update_overwrite_check(base, fresh):
"""
For updating a base dict with a fresh one, returning a list of
3-tuples containing the key, previous value (base[key]) and the
fresh value (fresh[key]) for all colliding changes (reassignment of
identical values are omitted).
"""
result = [
... | [
"def",
"dict_update_overwrite_check",
"(",
"base",
",",
"fresh",
")",
":",
"result",
"=",
"[",
"(",
"key",
",",
"base",
"[",
"key",
"]",
",",
"fresh",
"[",
"key",
"]",
")",
"for",
"key",
"in",
"set",
"(",
"base",
".",
"keys",
"(",
")",
")",
"&",
... | For updating a base dict with a fresh one, returning a list of
3-tuples containing the key, previous value (base[key]) and the
fresh value (fresh[key]) for all colliding changes (reassignment of
identical values are omitted). | [
"For",
"updating",
"a",
"base",
"dict",
"with",
"a",
"fresh",
"one",
"returning",
"a",
"list",
"of",
"3",
"-",
"tuples",
"containing",
"the",
"key",
"previous",
"value",
"(",
"base",
"[",
"key",
"]",
")",
"and",
"the",
"fresh",
"value",
"(",
"fresh",
... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L256-L270 |
calmjs/calmjs | src/calmjs/toolchain.py | spec_update_loaderplugin_registry | def spec_update_loaderplugin_registry(spec, default=None):
"""
Resolve a BasePluginLoaderRegistry instance from spec, and update
spec[CALMJS_LOADERPLUGIN_REGISTRY] with that value before returning
it.
"""
registry = spec.get(CALMJS_LOADERPLUGIN_REGISTRY)
if isinstance(registry, BaseLoaderPl... | python | def spec_update_loaderplugin_registry(spec, default=None):
"""
Resolve a BasePluginLoaderRegistry instance from spec, and update
spec[CALMJS_LOADERPLUGIN_REGISTRY] with that value before returning
it.
"""
registry = spec.get(CALMJS_LOADERPLUGIN_REGISTRY)
if isinstance(registry, BaseLoaderPl... | [
"def",
"spec_update_loaderplugin_registry",
"(",
"spec",
",",
"default",
"=",
"None",
")",
":",
"registry",
"=",
"spec",
".",
"get",
"(",
"CALMJS_LOADERPLUGIN_REGISTRY",
")",
"if",
"isinstance",
"(",
"registry",
",",
"BaseLoaderPluginRegistry",
")",
":",
"logger",... | Resolve a BasePluginLoaderRegistry instance from spec, and update
spec[CALMJS_LOADERPLUGIN_REGISTRY] with that value before returning
it. | [
"Resolve",
"a",
"BasePluginLoaderRegistry",
"instance",
"from",
"spec",
"and",
"update",
"spec",
"[",
"CALMJS_LOADERPLUGIN_REGISTRY",
"]",
"with",
"that",
"value",
"before",
"returning",
"it",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L282-L327 |
calmjs/calmjs | src/calmjs/toolchain.py | spec_update_sourcepath_filter_loaderplugins | def spec_update_sourcepath_filter_loaderplugins(
spec, sourcepath_map, sourcepath_map_key,
loaderplugin_sourcepath_map_key=LOADERPLUGIN_SOURCEPATH_MAPS):
"""
Take an existing spec and a sourcepath mapping (that could be
produced via calmjs.dist.*_module_registry_dependencies functions)
a... | python | def spec_update_sourcepath_filter_loaderplugins(
spec, sourcepath_map, sourcepath_map_key,
loaderplugin_sourcepath_map_key=LOADERPLUGIN_SOURCEPATH_MAPS):
"""
Take an existing spec and a sourcepath mapping (that could be
produced via calmjs.dist.*_module_registry_dependencies functions)
a... | [
"def",
"spec_update_sourcepath_filter_loaderplugins",
"(",
"spec",
",",
"sourcepath_map",
",",
"sourcepath_map_key",
",",
"loaderplugin_sourcepath_map_key",
"=",
"LOADERPLUGIN_SOURCEPATH_MAPS",
")",
":",
"default",
"=",
"dict_setget_dict",
"(",
"spec",
",",
"sourcepath_map_ke... | Take an existing spec and a sourcepath mapping (that could be
produced via calmjs.dist.*_module_registry_dependencies functions)
and split out the keys that does not contain loaderplugin syntax and
assign it to the spec under sourcepath_key.
For the parts with loader plugin syntax (i.e. modnames (keys)... | [
"Take",
"an",
"existing",
"spec",
"and",
"a",
"sourcepath",
"mapping",
"(",
"that",
"could",
"be",
"produced",
"via",
"calmjs",
".",
"dist",
".",
"*",
"_module_registry_dependencies",
"functions",
")",
"and",
"split",
"out",
"the",
"keys",
"that",
"does",
"n... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L330-L409 |
calmjs/calmjs | src/calmjs/toolchain.py | toolchain_spec_prepare_loaderplugins | def toolchain_spec_prepare_loaderplugins(
toolchain, spec,
loaderplugin_read_key,
handler_sourcepath_key,
loaderplugin_sourcepath_map_key=LOADERPLUGIN_SOURCEPATH_MAPS):
"""
A standard helper function for combining the filtered (e.g. using
``spec_update_sourcepath_filter_loade... | python | def toolchain_spec_prepare_loaderplugins(
toolchain, spec,
loaderplugin_read_key,
handler_sourcepath_key,
loaderplugin_sourcepath_map_key=LOADERPLUGIN_SOURCEPATH_MAPS):
"""
A standard helper function for combining the filtered (e.g. using
``spec_update_sourcepath_filter_loade... | [
"def",
"toolchain_spec_prepare_loaderplugins",
"(",
"toolchain",
",",
"spec",
",",
"loaderplugin_read_key",
",",
"handler_sourcepath_key",
",",
"loaderplugin_sourcepath_map_key",
"=",
"LOADERPLUGIN_SOURCEPATH_MAPS",
")",
":",
"# ensure the registry is applied to the spec",
"registr... | A standard helper function for combining the filtered (e.g. using
``spec_update_sourcepath_filter_loaderplugins``) loaderplugin
sourcepath mappings back into one that is usable with the standard
``toolchain_spec_compile_entries`` function.
Arguments:
toolchain
The toolchain
spec
... | [
"A",
"standard",
"helper",
"function",
"for",
"combining",
"the",
"filtered",
"(",
"e",
".",
"g",
".",
"using",
"spec_update_sourcepath_filter_loaderplugins",
")",
"loaderplugin",
"sourcepath",
"mappings",
"back",
"into",
"one",
"that",
"is",
"usable",
"with",
"th... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L412-L483 |
calmjs/calmjs | src/calmjs/toolchain.py | toolchain_spec_compile_entries | def toolchain_spec_compile_entries(
toolchain, spec, entries, process_name, overwrite_log=None):
"""
The standardized Toolchain Spec Entries compile function
This function accepts a toolchain instance, the spec to be operated
with and the entries provided for the process name. The standard
... | python | def toolchain_spec_compile_entries(
toolchain, spec, entries, process_name, overwrite_log=None):
"""
The standardized Toolchain Spec Entries compile function
This function accepts a toolchain instance, the spec to be operated
with and the entries provided for the process name. The standard
... | [
"def",
"toolchain_spec_compile_entries",
"(",
"toolchain",
",",
"spec",
",",
"entries",
",",
"process_name",
",",
"overwrite_log",
"=",
"None",
")",
":",
"processor",
"=",
"getattr",
"(",
"toolchain",
",",
"'compile_%s_entry'",
"%",
"process_name",
")",
"modpath_l... | The standardized Toolchain Spec Entries compile function
This function accepts a toolchain instance, the spec to be operated
with and the entries provided for the process name. The standard
flow is to deferr the actual processing to the toolchain method
`compile_{process_name}_entry` for each entry in... | [
"The",
"standardized",
"Toolchain",
"Spec",
"Entries",
"compile",
"function"
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L486-L526 |
calmjs/calmjs | src/calmjs/toolchain.py | process_compile_entries | def process_compile_entries(
processor, spec, entries, modpath_logger=None, targetpath_logger=None):
"""
The generalized raw spec entry process invocation loop.
"""
# Contains a mapping of the module name to the compiled file's
# relative path starting from the base build_dir.
all_modpa... | python | def process_compile_entries(
processor, spec, entries, modpath_logger=None, targetpath_logger=None):
"""
The generalized raw spec entry process invocation loop.
"""
# Contains a mapping of the module name to the compiled file's
# relative path starting from the base build_dir.
all_modpa... | [
"def",
"process_compile_entries",
"(",
"processor",
",",
"spec",
",",
"entries",
",",
"modpath_logger",
"=",
"None",
",",
"targetpath_logger",
"=",
"None",
")",
":",
"# Contains a mapping of the module name to the compiled file's",
"# relative path starting from the base build_... | The generalized raw spec entry process invocation loop. | [
"The",
"generalized",
"raw",
"spec",
"entry",
"process",
"invocation",
"loop",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L529-L556 |
calmjs/calmjs | src/calmjs/toolchain.py | Spec.update_selected | def update_selected(self, other, selected):
"""
Like update, however a list of selected keys must be provided.
"""
self.update({k: other[k] for k in selected}) | python | def update_selected(self, other, selected):
"""
Like update, however a list of selected keys must be provided.
"""
self.update({k: other[k] for k in selected}) | [
"def",
"update_selected",
"(",
"self",
",",
"other",
",",
"selected",
")",
":",
"self",
".",
"update",
"(",
"{",
"k",
":",
"other",
"[",
"k",
"]",
"for",
"k",
"in",
"selected",
"}",
")"
] | Like update, however a list of selected keys must be provided. | [
"Like",
"update",
"however",
"a",
"list",
"of",
"selected",
"keys",
"must",
"be",
"provided",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L639-L644 |
calmjs/calmjs | src/calmjs/toolchain.py | Spec.__advice_stack_frame_protection | def __advice_stack_frame_protection(self, frame):
"""
Overriding of this is only permitted if and only if your name is
Megumin and you have a pet/familiar named Chomusuke.
"""
if frame is None:
logger.debug(
'currentframe() returned None; frame protec... | python | def __advice_stack_frame_protection(self, frame):
"""
Overriding of this is only permitted if and only if your name is
Megumin and you have a pet/familiar named Chomusuke.
"""
if frame is None:
logger.debug(
'currentframe() returned None; frame protec... | [
"def",
"__advice_stack_frame_protection",
"(",
"self",
",",
"frame",
")",
":",
"if",
"frame",
"is",
"None",
":",
"logger",
".",
"debug",
"(",
"'currentframe() returned None; frame protection disabled'",
")",
"return",
"f_back",
"=",
"frame",
".",
"f_back",
"while",
... | Overriding of this is only permitted if and only if your name is
Megumin and you have a pet/familiar named Chomusuke. | [
"Overriding",
"of",
"this",
"is",
"only",
"permitted",
"if",
"and",
"only",
"if",
"your",
"name",
"is",
"Megumin",
"and",
"you",
"have",
"a",
"pet",
"/",
"familiar",
"named",
"Chomusuke",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L646-L664 |
calmjs/calmjs | src/calmjs/toolchain.py | Spec.advise | def advise(self, name, f, *a, **kw):
"""
Add an advice that will be handled later by the handle method.
Arguments:
name
The name of the advice group
f
A callable method or function.
The rest of the arguments will be passed as arguments and
... | python | def advise(self, name, f, *a, **kw):
"""
Add an advice that will be handled later by the handle method.
Arguments:
name
The name of the advice group
f
A callable method or function.
The rest of the arguments will be passed as arguments and
... | [
"def",
"advise",
"(",
"self",
",",
"name",
",",
"f",
",",
"*",
"a",
",",
"*",
"*",
"kw",
")",
":",
"if",
"name",
"is",
"None",
":",
"return",
"advice",
"=",
"(",
"f",
",",
"a",
",",
"kw",
")",
"debug",
"=",
"self",
".",
"get",
"(",
"DEBUG",... | Add an advice that will be handled later by the handle method.
Arguments:
name
The name of the advice group
f
A callable method or function.
The rest of the arguments will be passed as arguments and
keyword arguments to f when it's invoked. | [
"Add",
"an",
"advice",
"that",
"will",
"be",
"handled",
"later",
"by",
"the",
"handle",
"method",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L666-L706 |
calmjs/calmjs | src/calmjs/toolchain.py | Spec.handle | def handle(self, name):
"""
Call all advices at the provided name.
This has an analogue in the join point in aspected oriented
programming, but the analogy is a weak one as we don't have the
proper metaobject protocol to support this. Implementation that
make use of thi... | python | def handle(self, name):
"""
Call all advices at the provided name.
This has an analogue in the join point in aspected oriented
programming, but the analogy is a weak one as we don't have the
proper metaobject protocol to support this. Implementation that
make use of thi... | [
"def",
"handle",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_called",
":",
"logger",
".",
"warning",
"(",
"\"advice group '%s' has been called for this spec %r\"",
",",
"name",
",",
"self",
",",
")",
"# only now ensure checking",
"self... | Call all advices at the provided name.
This has an analogue in the join point in aspected oriented
programming, but the analogy is a weak one as we don't have the
proper metaobject protocol to support this. Implementation that
make use of this system should make it clear that they will... | [
"Call",
"all",
"advices",
"at",
"the",
"provided",
"name",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L708-L831 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.realpath | def realpath(self, spec, key):
"""
Resolve and update the path key in the spec with its realpath,
based on the working directory.
"""
if key not in spec:
# do nothing for now
return
if not spec[key]:
logger.warning(
"c... | python | def realpath(self, spec, key):
"""
Resolve and update the path key in the spec with its realpath,
based on the working directory.
"""
if key not in spec:
# do nothing for now
return
if not spec[key]:
logger.warning(
"c... | [
"def",
"realpath",
"(",
"self",
",",
"spec",
",",
"key",
")",
":",
"if",
"key",
"not",
"in",
"spec",
":",
"# do nothing for now",
"return",
"if",
"not",
"spec",
"[",
"key",
"]",
":",
"logger",
".",
"warning",
"(",
"\"cannot resolve realpath of '%s' as it is ... | Resolve and update the path key in the spec with its realpath,
based on the working directory. | [
"Resolve",
"and",
"update",
"the",
"path",
"key",
"in",
"the",
"spec",
"with",
"its",
"realpath",
"based",
"on",
"the",
"working",
"directory",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L960-L982 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.setup_prefix_suffix | def setup_prefix_suffix(self):
"""
Set up the compile prefix, sourcepath and the targetpath suffix
attributes, which are the prefix to the function name and the
suffixes to retrieve the values from for creating the generator
function.
"""
self.compile_prefix = 'c... | python | def setup_prefix_suffix(self):
"""
Set up the compile prefix, sourcepath and the targetpath suffix
attributes, which are the prefix to the function name and the
suffixes to retrieve the values from for creating the generator
function.
"""
self.compile_prefix = 'c... | [
"def",
"setup_prefix_suffix",
"(",
"self",
")",
":",
"self",
".",
"compile_prefix",
"=",
"'compile_'",
"self",
".",
"sourcepath_suffix",
"=",
"'_sourcepath'",
"self",
".",
"modpath_suffix",
"=",
"'_modpaths'",
"self",
".",
"targetpath_suffix",
"=",
"'_targetpaths'"
... | Set up the compile prefix, sourcepath and the targetpath suffix
attributes, which are the prefix to the function name and the
suffixes to retrieve the values from for creating the generator
function. | [
"Set",
"up",
"the",
"compile",
"prefix",
"sourcepath",
"and",
"the",
"targetpath",
"suffix",
"attributes",
"which",
"are",
"the",
"prefix",
"to",
"the",
"function",
"name",
"and",
"the",
"suffixes",
"to",
"retrieve",
"the",
"values",
"from",
"for",
"creating",... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1002-L1013 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain._validate_build_target | def _validate_build_target(self, spec, target):
"""
Essentially validate that the target is inside the build_dir.
"""
if not realpath(target).startswith(spec[BUILD_DIR]):
raise ValueError('build_target %s is outside build_dir' % target) | python | def _validate_build_target(self, spec, target):
"""
Essentially validate that the target is inside the build_dir.
"""
if not realpath(target).startswith(spec[BUILD_DIR]):
raise ValueError('build_target %s is outside build_dir' % target) | [
"def",
"_validate_build_target",
"(",
"self",
",",
"spec",
",",
"target",
")",
":",
"if",
"not",
"realpath",
"(",
"target",
")",
".",
"startswith",
"(",
"spec",
"[",
"BUILD_DIR",
"]",
")",
":",
"raise",
"ValueError",
"(",
"'build_target %s is outside build_dir... | Essentially validate that the target is inside the build_dir. | [
"Essentially",
"validate",
"that",
"the",
"target",
"is",
"inside",
"the",
"build_dir",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1100-L1106 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.transpile_modname_source_target | def transpile_modname_source_target(self, spec, modname, source, target):
"""
The function that gets called by compile_transpile_entry for
processing the provided JavaScript source file provided by some
Python package through the transpiler instance.
"""
if not isinstanc... | python | def transpile_modname_source_target(self, spec, modname, source, target):
"""
The function that gets called by compile_transpile_entry for
processing the provided JavaScript source file provided by some
Python package through the transpiler instance.
"""
if not isinstanc... | [
"def",
"transpile_modname_source_target",
"(",
"self",
",",
"spec",
",",
"modname",
",",
"source",
",",
"target",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"transpiler",
",",
"BaseUnparser",
")",
":",
"_deprecation_warning",
"(",
"'transpiler callab... | The function that gets called by compile_transpile_entry for
processing the provided JavaScript source file provided by some
Python package through the transpiler instance. | [
"The",
"function",
"that",
"gets",
"called",
"by",
"compile_transpile_entry",
"for",
"processing",
"the",
"provided",
"JavaScript",
"source",
"file",
"provided",
"by",
"some",
"Python",
"package",
"through",
"the",
"transpiler",
"instance",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1122-L1145 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.simple_transpile_modname_source_target | def simple_transpile_modname_source_target(
self, spec, modname, source, target):
"""
The original simple transpile method called by compile_transpile
on each target.
"""
opener = self.opener
bd_target = self._generate_transpile_target(spec, target)
l... | python | def simple_transpile_modname_source_target(
self, spec, modname, source, target):
"""
The original simple transpile method called by compile_transpile
on each target.
"""
opener = self.opener
bd_target = self._generate_transpile_target(spec, target)
l... | [
"def",
"simple_transpile_modname_source_target",
"(",
"self",
",",
"spec",
",",
"modname",
",",
"source",
",",
"target",
")",
":",
"opener",
"=",
"self",
".",
"opener",
"bd_target",
"=",
"self",
".",
"_generate_transpile_target",
"(",
"spec",
",",
"target",
")... | The original simple transpile method called by compile_transpile
on each target. | [
"The",
"original",
"simple",
"transpile",
"method",
"called",
"by",
"compile_transpile",
"on",
"each",
"target",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1160-L1186 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.compile_transpile_entry | def compile_transpile_entry(self, spec, entry):
"""
Handler for each entry for the transpile method of the compile
process. This invokes the transpiler that was set up to
transpile the input files into the build directory.
"""
modname, source, target, modpath = entry
... | python | def compile_transpile_entry(self, spec, entry):
"""
Handler for each entry for the transpile method of the compile
process. This invokes the transpiler that was set up to
transpile the input files into the build directory.
"""
modname, source, target, modpath = entry
... | [
"def",
"compile_transpile_entry",
"(",
"self",
",",
"spec",
",",
"entry",
")",
":",
"modname",
",",
"source",
",",
"target",
",",
"modpath",
"=",
"entry",
"transpiled_modpath",
"=",
"{",
"modname",
":",
"modpath",
"}",
"transpiled_target",
"=",
"{",
"modname... | Handler for each entry for the transpile method of the compile
process. This invokes the transpiler that was set up to
transpile the input files into the build directory. | [
"Handler",
"for",
"each",
"entry",
"for",
"the",
"transpile",
"method",
"of",
"the",
"compile",
"process",
".",
"This",
"invokes",
"the",
"transpiler",
"that",
"was",
"set",
"up",
"to",
"transpile",
"the",
"input",
"files",
"into",
"the",
"build",
"directory... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1188-L1200 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.compile_bundle_entry | def compile_bundle_entry(self, spec, entry):
"""
Handler for each entry for the bundle method of the compile
process. This copies the source file or directory into the
build directory.
"""
modname, source, target, modpath = entry
bundled_modpath = {modname: modp... | python | def compile_bundle_entry(self, spec, entry):
"""
Handler for each entry for the bundle method of the compile
process. This copies the source file or directory into the
build directory.
"""
modname, source, target, modpath = entry
bundled_modpath = {modname: modp... | [
"def",
"compile_bundle_entry",
"(",
"self",
",",
"spec",
",",
"entry",
")",
":",
"modname",
",",
"source",
",",
"target",
",",
"modpath",
"=",
"entry",
"bundled_modpath",
"=",
"{",
"modname",
":",
"modpath",
"}",
"bundled_target",
"=",
"{",
"modname",
":",... | Handler for each entry for the bundle method of the compile
process. This copies the source file or directory into the
build directory. | [
"Handler",
"for",
"each",
"entry",
"for",
"the",
"bundle",
"method",
"of",
"the",
"compile",
"process",
".",
"This",
"copies",
"the",
"source",
"file",
"or",
"directory",
"into",
"the",
"build",
"directory",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1202-L1223 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.compile_loaderplugin_entry | def compile_loaderplugin_entry(self, spec, entry):
"""
Generic loader plugin entry handler.
The default implementation assumes that everything up to the
first '!' symbol resolves to some known loader plugin within
the registry.
The registry instance responsible for the ... | python | def compile_loaderplugin_entry(self, spec, entry):
"""
Generic loader plugin entry handler.
The default implementation assumes that everything up to the
first '!' symbol resolves to some known loader plugin within
the registry.
The registry instance responsible for the ... | [
"def",
"compile_loaderplugin_entry",
"(",
"self",
",",
"spec",
",",
"entry",
")",
":",
"modname",
",",
"source",
",",
"target",
",",
"modpath",
"=",
"entry",
"handler",
"=",
"spec",
"[",
"CALMJS_LOADERPLUGIN_REGISTRY",
"]",
".",
"get",
"(",
"modname",
")",
... | Generic loader plugin entry handler.
The default implementation assumes that everything up to the
first '!' symbol resolves to some known loader plugin within
the registry.
The registry instance responsible for the resolution of the
loader plugin handlers must be available in t... | [
"Generic",
"loader",
"plugin",
"entry",
"handler",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1225-L1244 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.modname_source_to_target | def modname_source_to_target(self, spec, modname, source):
"""
Create a target file name from the input module name and its
source file name. The result should be a path relative to the
build_dir, and this is derived directly from the modname with NO
implicit convers of path sep... | python | def modname_source_to_target(self, spec, modname, source):
"""
Create a target file name from the input module name and its
source file name. The result should be a path relative to the
build_dir, and this is derived directly from the modname with NO
implicit convers of path sep... | [
"def",
"modname_source_to_target",
"(",
"self",
",",
"spec",
",",
"modname",
",",
"source",
")",
":",
"loaderplugin_registry",
"=",
"spec",
".",
"get",
"(",
"CALMJS_LOADERPLUGIN_REGISTRY",
")",
"if",
"'!'",
"in",
"modname",
"and",
"loaderplugin_registry",
":",
"... | Create a target file name from the input module name and its
source file name. The result should be a path relative to the
build_dir, and this is derived directly from the modname with NO
implicit convers of path separators (i.e. '/' or any other) into
a system or OS specific form (e.g.... | [
"Create",
"a",
"target",
"file",
"name",
"from",
"the",
"input",
"module",
"name",
"and",
"its",
"source",
"file",
"name",
".",
"The",
"result",
"should",
"be",
"a",
"path",
"relative",
"to",
"the",
"build_dir",
"and",
"this",
"is",
"derived",
"directly",
... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1279-L1321 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.modname_source_target_modnamesource_to_modpath | def modname_source_target_modnamesource_to_modpath(
self, spec, modname, source, target, modname_source):
"""
Typical JavaScript tools will get confused if '.js' is added, so
by default the same modname is returned as path rather than the
target file for the module path to be... | python | def modname_source_target_modnamesource_to_modpath(
self, spec, modname, source, target, modname_source):
"""
Typical JavaScript tools will get confused if '.js' is added, so
by default the same modname is returned as path rather than the
target file for the module path to be... | [
"def",
"modname_source_target_modnamesource_to_modpath",
"(",
"self",
",",
"spec",
",",
"modname",
",",
"source",
",",
"target",
",",
"modname_source",
")",
":",
"return",
"self",
".",
"modname_source_target_to_modpath",
"(",
"spec",
",",
"modname",
",",
"source",
... | Typical JavaScript tools will get confused if '.js' is added, so
by default the same modname is returned as path rather than the
target file for the module path to be written to the output file
for linkage by tools. Some other tools may desire the target to
be returned instead, or const... | [
"Typical",
"JavaScript",
"tools",
"will",
"get",
"confused",
"if",
".",
"js",
"is",
"added",
"so",
"by",
"default",
"the",
"same",
"modname",
"is",
"returned",
"as",
"path",
"rather",
"than",
"the",
"target",
"file",
"for",
"the",
"module",
"path",
"to",
... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1341-L1362 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain._gen_modname_source_target_modpath | def _gen_modname_source_target_modpath(self, spec, d):
"""
Private generator that will consume those above functions. This
should NOT be overridden.
Produces the following 4-tuple on iteration with the input dict;
the definition is written at the module level documention for
... | python | def _gen_modname_source_target_modpath(self, spec, d):
"""
Private generator that will consume those above functions. This
should NOT be overridden.
Produces the following 4-tuple on iteration with the input dict;
the definition is written at the module level documention for
... | [
"def",
"_gen_modname_source_target_modpath",
"(",
"self",
",",
"spec",
",",
"d",
")",
":",
"for",
"modname_source",
"in",
"d",
".",
"items",
"(",
")",
":",
"try",
":",
"modname",
"=",
"self",
".",
"modname_source_to_modname",
"(",
"spec",
",",
"*",
"modnam... | Private generator that will consume those above functions. This
should NOT be overridden.
Produces the following 4-tuple on iteration with the input dict;
the definition is written at the module level documention for
calmjs.toolchain, but in brief:
modname
The Java... | [
"Private",
"generator",
"that",
"will",
"consume",
"those",
"above",
"functions",
".",
"This",
"should",
"NOT",
"be",
"overridden",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1366-L1420 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.compile | def compile(self, spec):
"""
Generic step that compiles from a spec to build the specified
things into the build directory `build_dir`, by gathering all
the files and feed them through the transpilation process or by
simple copying.
"""
spec[EXPORT_MODULE_NAMES] ... | python | def compile(self, spec):
"""
Generic step that compiles from a spec to build the specified
things into the build directory `build_dir`, by gathering all
the files and feed them through the transpilation process or by
simple copying.
"""
spec[EXPORT_MODULE_NAMES] ... | [
"def",
"compile",
"(",
"self",
",",
"spec",
")",
":",
"spec",
"[",
"EXPORT_MODULE_NAMES",
"]",
"=",
"export_module_names",
"=",
"spec",
".",
"get",
"(",
"EXPORT_MODULE_NAMES",
",",
"[",
"]",
")",
"if",
"not",
"isinstance",
"(",
"export_module_names",
",",
... | Generic step that compiles from a spec to build the specified
things into the build directory `build_dir`, by gathering all
the files and feed them through the transpilation process or by
simple copying. | [
"Generic",
"step",
"that",
"compiles",
"from",
"a",
"spec",
"to",
"build",
"the",
"specified",
"things",
"into",
"the",
"build",
"directory",
"build_dir",
"by",
"gathering",
"all",
"the",
"files",
"and",
"feed",
"them",
"through",
"the",
"transpilation",
"proc... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1433-L1506 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain._calf | def _calf(self, spec):
"""
The main call, assuming the base spec is prepared.
Also, no advices will be triggered.
"""
self.prepare(spec)
self.compile(spec)
self.assemble(spec)
self.link(spec)
self.finalize(spec) | python | def _calf(self, spec):
"""
The main call, assuming the base spec is prepared.
Also, no advices will be triggered.
"""
self.prepare(spec)
self.compile(spec)
self.assemble(spec)
self.link(spec)
self.finalize(spec) | [
"def",
"_calf",
"(",
"self",
",",
"spec",
")",
":",
"self",
".",
"prepare",
"(",
"spec",
")",
"self",
".",
"compile",
"(",
"spec",
")",
"self",
".",
"assemble",
"(",
"spec",
")",
"self",
".",
"link",
"(",
"spec",
")",
"self",
".",
"finalize",
"("... | The main call, assuming the base spec is prepared.
Also, no advices will be triggered. | [
"The",
"main",
"call",
"assuming",
"the",
"base",
"spec",
"is",
"prepared",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1540-L1551 |
calmjs/calmjs | src/calmjs/toolchain.py | Toolchain.calf | def calf(self, spec):
"""
Typical safe usage is this, which sets everything that could be
problematic up.
Requires the filename which everything will be produced to.
"""
if not isinstance(spec, Spec):
raise TypeError('spec must be of type Spec')
if ... | python | def calf(self, spec):
"""
Typical safe usage is this, which sets everything that could be
problematic up.
Requires the filename which everything will be produced to.
"""
if not isinstance(spec, Spec):
raise TypeError('spec must be of type Spec')
if ... | [
"def",
"calf",
"(",
"self",
",",
"spec",
")",
":",
"if",
"not",
"isinstance",
"(",
"spec",
",",
"Spec",
")",
":",
"raise",
"TypeError",
"(",
"'spec must be of type Spec'",
")",
"if",
"not",
"spec",
".",
"get",
"(",
"BUILD_DIR",
")",
":",
"tempdir",
"="... | Typical safe usage is this, which sets everything that could be
problematic up.
Requires the filename which everything will be produced to. | [
"Typical",
"safe",
"usage",
"is",
"this",
"which",
"sets",
"everything",
"that",
"could",
"be",
"problematic",
"up",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1553-L1595 |
calmjs/calmjs | src/calmjs/toolchain.py | NullToolchain.transpile_modname_source_target | def transpile_modname_source_target(self, spec, modname, source, target):
"""
Calls the original version.
"""
return self.simple_transpile_modname_source_target(
spec, modname, source, target) | python | def transpile_modname_source_target(self, spec, modname, source, target):
"""
Calls the original version.
"""
return self.simple_transpile_modname_source_target(
spec, modname, source, target) | [
"def",
"transpile_modname_source_target",
"(",
"self",
",",
"spec",
",",
"modname",
",",
"source",
",",
"target",
")",
":",
"return",
"self",
".",
"simple_transpile_modname_source_target",
"(",
"spec",
",",
"modname",
",",
"source",
",",
"target",
")"
] | Calls the original version. | [
"Calls",
"the",
"original",
"version",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1617-L1623 |
calmjs/calmjs | src/calmjs/cli.py | get_bin_version_str | def get_bin_version_str(bin_path, version_flag='-v', kw={}):
"""
Get the version string through the binary.
"""
try:
prog = _get_exec_binary(bin_path, kw)
version_str = version_expr.search(
check_output([prog, version_flag], **kw).decode(locale)
).groups()[0]
exc... | python | def get_bin_version_str(bin_path, version_flag='-v', kw={}):
"""
Get the version string through the binary.
"""
try:
prog = _get_exec_binary(bin_path, kw)
version_str = version_expr.search(
check_output([prog, version_flag], **kw).decode(locale)
).groups()[0]
exc... | [
"def",
"get_bin_version_str",
"(",
"bin_path",
",",
"version_flag",
"=",
"'-v'",
",",
"kw",
"=",
"{",
"}",
")",
":",
"try",
":",
"prog",
"=",
"_get_exec_binary",
"(",
"bin_path",
",",
"kw",
")",
"version_str",
"=",
"version_expr",
".",
"search",
"(",
"ch... | Get the version string through the binary. | [
"Get",
"the",
"version",
"string",
"through",
"the",
"binary",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/cli.py#L46-L66 |
calmjs/calmjs | src/calmjs/cli.py | get_bin_version | def get_bin_version(bin_path, version_flag='-v', kw={}):
"""
Get the version string through the binary and return a tuple of
integers.
"""
version_str = get_bin_version_str(bin_path, version_flag, kw)
if version_str:
return tuple(int(i) for i in version_str.split('.')) | python | def get_bin_version(bin_path, version_flag='-v', kw={}):
"""
Get the version string through the binary and return a tuple of
integers.
"""
version_str = get_bin_version_str(bin_path, version_flag, kw)
if version_str:
return tuple(int(i) for i in version_str.split('.')) | [
"def",
"get_bin_version",
"(",
"bin_path",
",",
"version_flag",
"=",
"'-v'",
",",
"kw",
"=",
"{",
"}",
")",
":",
"version_str",
"=",
"get_bin_version_str",
"(",
"bin_path",
",",
"version_flag",
",",
"kw",
")",
"if",
"version_str",
":",
"return",
"tuple",
"... | Get the version string through the binary and return a tuple of
integers. | [
"Get",
"the",
"version",
"string",
"through",
"the",
"binary",
"and",
"return",
"a",
"tuple",
"of",
"integers",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/cli.py#L69-L77 |
calmjs/calmjs | src/calmjs/cli.py | NodeDriver.node | def node(self, source, args=(), env={}):
"""
Calls node with an inline source.
Returns decoded output of stdout and stderr; decoding determine
by locale.
"""
return self._exec(self.node_bin, source, args=args, env=env) | python | def node(self, source, args=(), env={}):
"""
Calls node with an inline source.
Returns decoded output of stdout and stderr; decoding determine
by locale.
"""
return self._exec(self.node_bin, source, args=args, env=env) | [
"def",
"node",
"(",
"self",
",",
"source",
",",
"args",
"=",
"(",
")",
",",
"env",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_exec",
"(",
"self",
".",
"node_bin",
",",
"source",
",",
"args",
"=",
"args",
",",
"env",
"=",
"env",
")"
] | Calls node with an inline source.
Returns decoded output of stdout and stderr; decoding determine
by locale. | [
"Calls",
"node",
"with",
"an",
"inline",
"source",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/cli.py#L119-L127 |
calmjs/calmjs | src/calmjs/cli.py | PackageManagerDriver.create_for_module_vars | def create_for_module_vars(cls, scope_vars):
"""
This was originally designed to be invoked at the module level
for packages that implement specific support, but this can be
used to create an instance that has the Node.js backed
executable be found via current directory's node_mo... | python | def create_for_module_vars(cls, scope_vars):
"""
This was originally designed to be invoked at the module level
for packages that implement specific support, but this can be
used to create an instance that has the Node.js backed
executable be found via current directory's node_mo... | [
"def",
"create_for_module_vars",
"(",
"cls",
",",
"scope_vars",
")",
":",
"inst",
"=",
"cls",
"(",
")",
"if",
"not",
"inst",
".",
"_set_env_path_with_node_modules",
"(",
")",
":",
"import",
"warnings",
"msg",
"=",
"(",
"\"Unable to locate the '%(binary)s' binary o... | This was originally designed to be invoked at the module level
for packages that implement specific support, but this can be
used to create an instance that has the Node.js backed
executable be found via current directory's node_modules or
NODE_PATH. | [
"This",
"was",
"originally",
"designed",
"to",
"be",
"invoked",
"at",
"the",
"module",
"level",
"for",
"packages",
"that",
"implement",
"specific",
"support",
"but",
"this",
"can",
"be",
"used",
"to",
"create",
"an",
"instance",
"that",
"has",
"the",
"Node",... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/cli.py#L204-L237 |
calmjs/calmjs | src/calmjs/cli.py | PackageManagerDriver.pkg_manager_view | def pkg_manager_view(
self, package_names, stream=None, explicit=False, **kw):
"""
Returns the manifest JSON for the Python package name. Default
npm implementation calls for package.json.
If this class is initiated using standard procedures, this will
mimic the fun... | python | def pkg_manager_view(
self, package_names, stream=None, explicit=False, **kw):
"""
Returns the manifest JSON for the Python package name. Default
npm implementation calls for package.json.
If this class is initiated using standard procedures, this will
mimic the fun... | [
"def",
"pkg_manager_view",
"(",
"self",
",",
"package_names",
",",
"stream",
"=",
"None",
",",
"explicit",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"# For looking up the pkg_name to dist converter for explicit",
"to_dists",
"=",
"{",
"False",
":",
"find_packag... | Returns the manifest JSON for the Python package name. Default
npm implementation calls for package.json.
If this class is initiated using standard procedures, this will
mimic the functionality of ``npm view`` but mostly for showing
the dependencies. This is done as a default action.
... | [
"Returns",
"the",
"manifest",
"JSON",
"for",
"the",
"Python",
"package",
"name",
".",
"Default",
"npm",
"implementation",
"calls",
"for",
"package",
".",
"json",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/cli.py#L243-L310 |
calmjs/calmjs | src/calmjs/cli.py | PackageManagerDriver.pkg_manager_init | def pkg_manager_init(
self, package_names, overwrite=False, merge=False,
callback=None, **kw):
"""
Note: default implementation calls for npm and package.json,
please note that it may not be the case for this instance of
Driver.
If this class is initiated... | python | def pkg_manager_init(
self, package_names, overwrite=False, merge=False,
callback=None, **kw):
"""
Note: default implementation calls for npm and package.json,
please note that it may not be the case for this instance of
Driver.
If this class is initiated... | [
"def",
"pkg_manager_init",
"(",
"self",
",",
"package_names",
",",
"overwrite",
"=",
"False",
",",
"merge",
"=",
"False",
",",
"callback",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"# this will be modified in place",
"original_json",
"=",
"{",
"}",
"pkgdef... | Note: default implementation calls for npm and package.json,
please note that it may not be the case for this instance of
Driver.
If this class is initiated using standard procedures, this will
emulate the functionality of ``npm init`` for the generation of
a working ``package.j... | [
"Note",
":",
"default",
"implementation",
"calls",
"for",
"npm",
"and",
"package",
".",
"json",
"please",
"note",
"that",
"it",
"may",
"not",
"be",
"the",
"case",
"for",
"this",
"instance",
"of",
"Driver",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/cli.py#L312-L413 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.