partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | GetConcreteSubclassMixin.get_concrete_class | This method provides easier access to all writers inheriting Writer class
:param class_name: name of the parser (name of the parser class which should be used)
:type class_name: str
:return: Writer subclass specified by parser_name
:rtype: Writer subclass
:raise ValueError: | hepdata_converter/common.py | def get_concrete_class(cls, class_name):
"""This method provides easier access to all writers inheriting Writer class
:param class_name: name of the parser (name of the parser class which should be used)
:type class_name: str
:return: Writer subclass specified by parser_name
:rt... | def get_concrete_class(cls, class_name):
"""This method provides easier access to all writers inheriting Writer class
:param class_name: name of the parser (name of the parser class which should be used)
:type class_name: str
:return: Writer subclass specified by parser_name
:rt... | [
"This",
"method",
"provides",
"easier",
"access",
"to",
"all",
"writers",
"inheriting",
"Writer",
"class"
] | HEPData/hepdata-converter | python | https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/common.py#L92-L115 | [
"def",
"get_concrete_class",
"(",
"cls",
",",
"class_name",
")",
":",
"def",
"recurrent_class_lookup",
"(",
"cls",
")",
":",
"for",
"cls",
"in",
"cls",
".",
"__subclasses__",
"(",
")",
":",
"if",
"lower",
"(",
"cls",
".",
"__name__",
")",
"==",
"lower",
... | 354271448980efba86f2f3d27b99d818e75fd90d |
train | GetPupil | Retrieve pupil data | pyzos/zos_obj_override/ilensdataeditor_methods.py | def GetPupil(self):
"""Retrieve pupil data
"""
pupil_data = _co.namedtuple('pupil_data', ['ZemaxApertureType',
'ApertureValue',
'entrancePupilDiameter',
'entrancePupil... | def GetPupil(self):
"""Retrieve pupil data
"""
pupil_data = _co.namedtuple('pupil_data', ['ZemaxApertureType',
'ApertureValue',
'entrancePupilDiameter',
'entrancePupil... | [
"Retrieve",
"pupil",
"data"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos_obj_override/ilensdataeditor_methods.py#L21-L33 | [
"def",
"GetPupil",
"(",
"self",
")",
":",
"pupil_data",
"=",
"_co",
".",
"namedtuple",
"(",
"'pupil_data'",
",",
"[",
"'ZemaxApertureType'",
",",
"'ApertureValue'",
",",
"'entrancePupilDiameter'",
",",
"'entrancePupilPosition'",
",",
"'exitPupilDiameter'",
",",
"'ex... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | FastPing.ping | Attempt to ping a list of hosts or networks (can be a single host)
:param targets: List - Name(s) or IP(s) of the host(s).
:param filename: String - name of the file containing hosts to ping
:param status: String - if one of ['alive', 'dead', 'noip'] then only
return results that have th... | fping/fping.py | def ping(self, targets=list(), filename=str(), status=str()):
"""
Attempt to ping a list of hosts or networks (can be a single host)
:param targets: List - Name(s) or IP(s) of the host(s).
:param filename: String - name of the file containing hosts to ping
:param status: String -... | def ping(self, targets=list(), filename=str(), status=str()):
"""
Attempt to ping a list of hosts or networks (can be a single host)
:param targets: List - Name(s) or IP(s) of the host(s).
:param filename: String - name of the file containing hosts to ping
:param status: String -... | [
"Attempt",
"to",
"ping",
"a",
"list",
"of",
"hosts",
"or",
"networks",
"(",
"can",
"be",
"a",
"single",
"host",
")",
":",
"param",
"targets",
":",
"List",
"-",
"Name",
"(",
"s",
")",
"or",
"IP",
"(",
"s",
")",
"of",
"the",
"host",
"(",
"s",
")"... | NetworkEng/fping.py | python | https://github.com/NetworkEng/fping.py/blob/991507889561aa6eb9ee2ad821adf460883a9c5d/fping/fping.py#L63-L196 | [
"def",
"ping",
"(",
"self",
",",
"targets",
"=",
"list",
"(",
")",
",",
"filename",
"=",
"str",
"(",
")",
",",
"status",
"=",
"str",
"(",
")",
")",
":",
"if",
"targets",
"and",
"filename",
":",
"raise",
"SyntaxError",
"(",
"\"You must specify only one ... | 991507889561aa6eb9ee2ad821adf460883a9c5d |
train | FastPing.get_results | def get_results(cmd: list) -> str:
return lines
Get the ping results using fping.
:param cmd: List - the fping command and its options
:return: String - raw string output containing csv fping results
including the newline characters | fping/fping.py | def get_results(cmd):
"""
def get_results(cmd: list) -> str:
return lines
Get the ping results using fping.
:param cmd: List - the fping command and its options
:return: String - raw string output containing csv fping results
including the newline characters
... | def get_results(cmd):
"""
def get_results(cmd: list) -> str:
return lines
Get the ping results using fping.
:param cmd: List - the fping command and its options
:return: String - raw string output containing csv fping results
including the newline characters
... | [
"def",
"get_results",
"(",
"cmd",
":",
"list",
")",
"-",
">",
"str",
":",
"return",
"lines",
"Get",
"the",
"ping",
"results",
"using",
"fping",
".",
":",
"param",
"cmd",
":",
"List",
"-",
"the",
"fping",
"command",
"and",
"its",
"options",
":",
"retu... | NetworkEng/fping.py | python | https://github.com/NetworkEng/fping.py/blob/991507889561aa6eb9ee2ad821adf460883a9c5d/fping/fping.py#L199-L211 | [
"def",
"get_results",
"(",
"cmd",
")",
":",
"try",
":",
"return",
"subprocess",
".",
"check_output",
"(",
"cmd",
")",
"except",
"subprocess",
".",
"CalledProcessError",
"as",
"e",
":",
"return",
"e",
".",
"output"
] | 991507889561aa6eb9ee2ad821adf460883a9c5d |
train | FastPing.read_file | Reads the lines of a file into a list, and returns the list
:param filename: String - path and name of the file
:return: List - lines within the file | fping/fping.py | def read_file(filename):
"""
Reads the lines of a file into a list, and returns the list
:param filename: String - path and name of the file
:return: List - lines within the file
"""
lines = []
with open(filename) as f:
for line in f:
i... | def read_file(filename):
"""
Reads the lines of a file into a list, and returns the list
:param filename: String - path and name of the file
:return: List - lines within the file
"""
lines = []
with open(filename) as f:
for line in f:
i... | [
"Reads",
"the",
"lines",
"of",
"a",
"file",
"into",
"a",
"list",
"and",
"returns",
"the",
"list",
":",
"param",
"filename",
":",
"String",
"-",
"path",
"and",
"name",
"of",
"the",
"file",
":",
"return",
":",
"List",
"-",
"lines",
"within",
"the",
"fi... | NetworkEng/fping.py | python | https://github.com/NetworkEng/fping.py/blob/991507889561aa6eb9ee2ad821adf460883a9c5d/fping/fping.py#L214-L225 | [
"def",
"read_file",
"(",
"filename",
")",
":",
"lines",
"=",
"[",
"]",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"len",
"(",
"line",
".",
"strip",
"(",
")",
")",
"!=",
"0",
":",
"lines",
".",
"... | 991507889561aa6eb9ee2ad821adf460883a9c5d |
train | ROOT._prepare_outputs | Open a ROOT file with option 'RECREATE' to create a new file (the file will
be overwritten if it already exists), and using the ZLIB compression algorithm
(with compression level 1) for better compatibility with older ROOT versions
(see https://root.cern.ch/doc/v614/release-notes.html#important-... | hepdata_converter/writers/root_writer.py | def _prepare_outputs(self, data_out, outputs):
""" Open a ROOT file with option 'RECREATE' to create a new file (the file will
be overwritten if it already exists), and using the ZLIB compression algorithm
(with compression level 1) for better compatibility with older ROOT versions
(see ... | def _prepare_outputs(self, data_out, outputs):
""" Open a ROOT file with option 'RECREATE' to create a new file (the file will
be overwritten if it already exists), and using the ZLIB compression algorithm
(with compression level 1) for better compatibility with older ROOT versions
(see ... | [
"Open",
"a",
"ROOT",
"file",
"with",
"option",
"RECREATE",
"to",
"create",
"a",
"new",
"file",
"(",
"the",
"file",
"will",
"be",
"overwritten",
"if",
"it",
"already",
"exists",
")",
"and",
"using",
"the",
"ZLIB",
"compression",
"algorithm",
"(",
"with",
... | HEPData/hepdata-converter | python | https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/writers/root_writer.py#L405-L425 | [
"def",
"_prepare_outputs",
"(",
"self",
",",
"data_out",
",",
"outputs",
")",
":",
"compress",
"=",
"ROOTModule",
".",
"ROOT",
".",
"CompressionSettings",
"(",
"ROOTModule",
".",
"ROOT",
".",
"kZLIB",
",",
"1",
")",
"if",
"isinstance",
"(",
"data_out",
","... | 354271448980efba86f2f3d27b99d818e75fd90d |
train | ROOT.write | :param data_in:
:type data_in: hepconverter.parsers.ParsedData
:param data_out: filelike object
:type data_out: file
:param args:
:param kwargs: | hepdata_converter/writers/root_writer.py | def write(self, data_in, data_out, *args, **kwargs):
"""
:param data_in:
:type data_in: hepconverter.parsers.ParsedData
:param data_out: filelike object
:type data_out: file
:param args:
:param kwargs:
"""
self._get_tables(data_in)
self.fi... | def write(self, data_in, data_out, *args, **kwargs):
"""
:param data_in:
:type data_in: hepconverter.parsers.ParsedData
:param data_out: filelike object
:type data_out: file
:param args:
:param kwargs:
"""
self._get_tables(data_in)
self.fi... | [
":",
"param",
"data_in",
":",
":",
"type",
"data_in",
":",
"hepconverter",
".",
"parsers",
".",
"ParsedData",
":",
"param",
"data_out",
":",
"filelike",
"object",
":",
"type",
"data_out",
":",
"file",
":",
"param",
"args",
":",
":",
"param",
"kwargs",
":... | HEPData/hepdata-converter | python | https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/writers/root_writer.py#L427-L457 | [
"def",
"write",
"(",
"self",
",",
"data_in",
",",
"data_out",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_get_tables",
"(",
"data_in",
")",
"self",
".",
"file_emulation",
"=",
"False",
"outputs",
"=",
"[",
"]",
"self",
".",
... | 354271448980efba86f2f3d27b99d818e75fd90d |
train | _pairwise | itertools recipe
"s -> (s0,s1), (s1,s2), (s2, s3), ... | biggus/_init.py | def _pairwise(iterable):
"""
itertools recipe
"s -> (s0,s1), (s1,s2), (s2, s3), ...
"""
a, b = itertools.tee(iterable)
next(b, None)
return zip(a, b) | def _pairwise(iterable):
"""
itertools recipe
"s -> (s0,s1), (s1,s2), (s2, s3), ...
"""
a, b = itertools.tee(iterable)
next(b, None)
return zip(a, b) | [
"itertools",
"recipe",
"s",
"-",
">",
"(",
"s0",
"s1",
")",
"(",
"s1",
"s2",
")",
"(",
"s2",
"s3",
")",
"..."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L1577-L1585 | [
"def",
"_pairwise",
"(",
"iterable",
")",
":",
"a",
",",
"b",
"=",
"itertools",
".",
"tee",
"(",
"iterable",
")",
"next",
"(",
"b",
",",
"None",
")",
"return",
"zip",
"(",
"a",
",",
"b",
")"
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | _groups_of | Return an iterator of tuples for slicing, in 'length' chunks.
Parameters
----------
length : int
Length of each chunk.
total_length : int
Length of the object we are slicing
Returns
-------
iterable of tuples
Values defining a slice range resulting in length 'length... | biggus/_init.py | def _groups_of(length, total_length):
"""
Return an iterator of tuples for slicing, in 'length' chunks.
Parameters
----------
length : int
Length of each chunk.
total_length : int
Length of the object we are slicing
Returns
-------
iterable of tuples
Values ... | def _groups_of(length, total_length):
"""
Return an iterator of tuples for slicing, in 'length' chunks.
Parameters
----------
length : int
Length of each chunk.
total_length : int
Length of the object we are slicing
Returns
-------
iterable of tuples
Values ... | [
"Return",
"an",
"iterator",
"of",
"tuples",
"for",
"slicing",
"in",
"length",
"chunks",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L1588-L1606 | [
"def",
"_groups_of",
"(",
"length",
",",
"total_length",
")",
":",
"indices",
"=",
"tuple",
"(",
"range",
"(",
"0",
",",
"total_length",
",",
"length",
")",
")",
"+",
"(",
"None",
",",
")",
"return",
"_pairwise",
"(",
"indices",
")"
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | save | Save the numeric results of each source into its corresponding target.
Parameters
----------
sources: list
The list of source arrays for saving from; limited to length 1.
targets: list
The list of target arrays for saving to; limited to length 1.
masked: boolean
Uses a maske... | biggus/_init.py | def save(sources, targets, masked=False):
"""
Save the numeric results of each source into its corresponding target.
Parameters
----------
sources: list
The list of source arrays for saving from; limited to length 1.
targets: list
The list of target arrays for saving to; limited... | def save(sources, targets, masked=False):
"""
Save the numeric results of each source into its corresponding target.
Parameters
----------
sources: list
The list of source arrays for saving from; limited to length 1.
targets: list
The list of target arrays for saving to; limited... | [
"Save",
"the",
"numeric",
"results",
"of",
"each",
"source",
"into",
"its",
"corresponding",
"target",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2163-L2196 | [
"def",
"save",
"(",
"sources",
",",
"targets",
",",
"masked",
"=",
"False",
")",
":",
"# TODO: Remove restriction",
"assert",
"len",
"(",
"sources",
")",
"==",
"1",
"and",
"len",
"(",
"targets",
")",
"==",
"1",
"array",
"=",
"sources",
"[",
"0",
"]",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | count | Count the non-masked elements of the array along the given axis.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
over all the dimensions of the inp... | biggus/_init.py | def count(a, axis=None):
"""
Count the non-masked elements of the array along the given axis.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
... | def count(a, axis=None):
"""
Count the non-masked elements of the array along the given axis.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
... | [
"Count",
"the",
"non",
"-",
"masked",
"elements",
"of",
"the",
"array",
"along",
"the",
"given",
"axis",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2700-L2724 | [
"def",
"count",
"(",
"a",
",",
"axis",
"=",
"None",
")",
":",
"axes",
"=",
"_normalise_axis",
"(",
"axis",
",",
"a",
")",
"if",
"axes",
"is",
"None",
"or",
"len",
"(",
"axes",
")",
"!=",
"1",
":",
"msg",
"=",
"\"This operation is currently limited to a... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | min | Request the minimum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose minimum is to be found.
axis : None, or int, or iterable of ints
Axis or axes along which the operation is per... | biggus/_init.py | def min(a, axis=None):
"""
Request the minimum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose minimum is to be found.
axis : None, or int, or iterable of ints
Axis or ax... | def min(a, axis=None):
"""
Request the minimum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose minimum is to be found.
axis : None, or int, or iterable of ints
Axis or ax... | [
"Request",
"the",
"minimum",
"of",
"an",
"Array",
"over",
"any",
"number",
"of",
"axes",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2728-L2754 | [
"def",
"min",
"(",
"a",
",",
"axis",
"=",
"None",
")",
":",
"axes",
"=",
"_normalise_axis",
"(",
"axis",
",",
"a",
")",
"assert",
"axes",
"is",
"not",
"None",
"and",
"len",
"(",
"axes",
")",
"==",
"1",
"return",
"_Aggregation",
"(",
"a",
",",
"ax... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | max | Request the maximum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose maximum is to be found.
axis : None, or int, or iterable of ints
Axis or axes along which the operation is per... | biggus/_init.py | def max(a, axis=None):
"""
Request the maximum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose maximum is to be found.
axis : None, or int, or iterable of ints
Axis or ax... | def max(a, axis=None):
"""
Request the maximum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose maximum is to be found.
axis : None, or int, or iterable of ints
Axis or ax... | [
"Request",
"the",
"maximum",
"of",
"an",
"Array",
"over",
"any",
"number",
"of",
"axes",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2758-L2784 | [
"def",
"max",
"(",
"a",
",",
"axis",
"=",
"None",
")",
":",
"axes",
"=",
"_normalise_axis",
"(",
"axis",
",",
"a",
")",
"assert",
"axes",
"is",
"not",
"None",
"and",
"len",
"(",
"axes",
")",
"==",
"1",
"return",
"_Aggregation",
"(",
"a",
",",
"ax... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | sum | Request the sum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose summation is to be found.
axis : None, or int, or iterable of ints
Axis or axes along which the operation is perfo... | biggus/_init.py | def sum(a, axis=None):
"""
Request the sum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose summation is to be found.
axis : None, or int, or iterable of ints
Axis or axes... | def sum(a, axis=None):
"""
Request the sum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose summation is to be found.
axis : None, or int, or iterable of ints
Axis or axes... | [
"Request",
"the",
"sum",
"of",
"an",
"Array",
"over",
"any",
"number",
"of",
"axes",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2788-L2814 | [
"def",
"sum",
"(",
"a",
",",
"axis",
"=",
"None",
")",
":",
"axes",
"=",
"_normalise_axis",
"(",
"axis",
",",
"a",
")",
"assert",
"axes",
"is",
"not",
"None",
"and",
"len",
"(",
"axes",
")",
"==",
"1",
"return",
"_Aggregation",
"(",
"a",
",",
"ax... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | mean | Request the mean of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
over all the dimensions of the input array.
... | biggus/_init.py | def mean(a, axis=None, mdtol=1):
"""
Request the mean of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
... | def mean(a, axis=None, mdtol=1):
"""
Request the mean of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
... | [
"Request",
"the",
"mean",
"of",
"an",
"Array",
"over",
"any",
"number",
"of",
"axes",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2818-L2852 | [
"def",
"mean",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"mdtol",
"=",
"1",
")",
":",
"axes",
"=",
"_normalise_axis",
"(",
"axis",
",",
"a",
")",
"if",
"axes",
"is",
"None",
"or",
"len",
"(",
"axes",
")",
"!=",
"1",
":",
"msg",
"=",
"\"This oper... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | std | Request the standard deviation of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
over all the dimensions of the ... | biggus/_init.py | def std(a, axis=None, ddof=0):
"""
Request the standard deviation of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
... | def std(a, axis=None, ddof=0):
"""
Request the standard deviation of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
... | [
"Request",
"the",
"standard",
"deviation",
"of",
"an",
"Array",
"over",
"any",
"number",
"of",
"axes",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2856-L2884 | [
"def",
"std",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"ddof",
"=",
"0",
")",
":",
"axes",
"=",
"_normalise_axis",
"(",
"axis",
",",
"a",
")",
"if",
"axes",
"is",
"None",
"or",
"len",
"(",
"axes",
")",
"!=",
"1",
":",
"msg",
"=",
"\"This operat... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | var | Request the variance of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
over all the dimensions of the input arra... | biggus/_init.py | def var(a, axis=None, ddof=0):
"""
Request the variance of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
... | def var(a, axis=None, ddof=0):
"""
Request the variance of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
... | [
"Request",
"the",
"variance",
"of",
"an",
"Array",
"over",
"any",
"number",
"of",
"axes",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2888-L2916 | [
"def",
"var",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"ddof",
"=",
"0",
")",
":",
"axes",
"=",
"_normalise_axis",
"(",
"axis",
",",
"a",
")",
"if",
"axes",
"is",
"None",
"or",
"len",
"(",
"axes",
")",
"!=",
"1",
":",
"msg",
"=",
"\"This operat... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | _ufunc_wrapper | A function to generate the top level biggus ufunc wrappers. | biggus/_init.py | def _ufunc_wrapper(ufunc, name=None):
"""
A function to generate the top level biggus ufunc wrappers.
"""
if not isinstance(ufunc, np.ufunc):
raise TypeError('{} is not a ufunc'.format(ufunc))
ufunc_name = ufunc.__name__
# Get hold of the masked array equivalent, if it exists.
ma_u... | def _ufunc_wrapper(ufunc, name=None):
"""
A function to generate the top level biggus ufunc wrappers.
"""
if not isinstance(ufunc, np.ufunc):
raise TypeError('{} is not a ufunc'.format(ufunc))
ufunc_name = ufunc.__name__
# Get hold of the masked array equivalent, if it exists.
ma_u... | [
"A",
"function",
"to",
"generate",
"the",
"top",
"level",
"biggus",
"ufunc",
"wrappers",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L3081-L3102 | [
"def",
"_ufunc_wrapper",
"(",
"ufunc",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"ufunc",
",",
"np",
".",
"ufunc",
")",
":",
"raise",
"TypeError",
"(",
"'{} is not a ufunc'",
".",
"format",
"(",
"ufunc",
")",
")",
"ufunc_name",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | _sliced_shape | Returns the shape that results from slicing an array of the given
shape by the given keys.
>>> _sliced_shape(shape=(52350, 70, 90, 180),
... keys=(np.newaxis, slice(None, 10), 3,
... slice(None), slice(2, 3)))
(1, 10, 90, 1) | biggus/_init.py | def _sliced_shape(shape, keys):
"""
Returns the shape that results from slicing an array of the given
shape by the given keys.
>>> _sliced_shape(shape=(52350, 70, 90, 180),
... keys=(np.newaxis, slice(None, 10), 3,
... slice(None), slice(2, 3)))
(1, 10, 90,... | def _sliced_shape(shape, keys):
"""
Returns the shape that results from slicing an array of the given
shape by the given keys.
>>> _sliced_shape(shape=(52350, 70, 90, 180),
... keys=(np.newaxis, slice(None, 10), 3,
... slice(None), slice(2, 3)))
(1, 10, 90,... | [
"Returns",
"the",
"shape",
"that",
"results",
"from",
"slicing",
"an",
"array",
"of",
"the",
"given",
"shape",
"by",
"the",
"given",
"keys",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L3198-L3232 | [
"def",
"_sliced_shape",
"(",
"shape",
",",
"keys",
")",
":",
"keys",
"=",
"_full_keys",
"(",
"keys",
",",
"len",
"(",
"shape",
")",
")",
"sliced_shape",
"=",
"[",
"]",
"shape_dim",
"=",
"-",
"1",
"for",
"key",
"in",
"keys",
":",
"shape_dim",
"+=",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | _full_keys | Given keys such as those passed to ``__getitem__`` for an
array of ndim, return a fully expanded tuple of keys.
In all instances, the result of this operation should follow:
array[keys] == array[_full_keys(keys, array.ndim)] | biggus/_init.py | def _full_keys(keys, ndim):
"""
Given keys such as those passed to ``__getitem__`` for an
array of ndim, return a fully expanded tuple of keys.
In all instances, the result of this operation should follow:
array[keys] == array[_full_keys(keys, array.ndim)]
"""
if not isinstance(keys, ... | def _full_keys(keys, ndim):
"""
Given keys such as those passed to ``__getitem__`` for an
array of ndim, return a fully expanded tuple of keys.
In all instances, the result of this operation should follow:
array[keys] == array[_full_keys(keys, array.ndim)]
"""
if not isinstance(keys, ... | [
"Given",
"keys",
"such",
"as",
"those",
"passed",
"to",
"__getitem__",
"for",
"an",
"array",
"of",
"ndim",
"return",
"a",
"fully",
"expanded",
"tuple",
"of",
"keys",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L3235-L3285 | [
"def",
"_full_keys",
"(",
"keys",
",",
"ndim",
")",
":",
"if",
"not",
"isinstance",
"(",
"keys",
",",
"tuple",
")",
":",
"keys",
"=",
"(",
"keys",
",",
")",
"# Make keys mutable, and take a copy.",
"keys",
"=",
"list",
"(",
"keys",
")",
"# Count the number... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | ensure_array | Assert that the given array is an Array subclass (or numpy array).
If the given array is a numpy.ndarray an appropriate NumpyArrayAdapter
instance is created, otherwise the passed array must be a subclass of
:class:`Array` else a TypeError will be raised. | biggus/_init.py | def ensure_array(array):
"""
Assert that the given array is an Array subclass (or numpy array).
If the given array is a numpy.ndarray an appropriate NumpyArrayAdapter
instance is created, otherwise the passed array must be a subclass of
:class:`Array` else a TypeError will be raised.
"""
i... | def ensure_array(array):
"""
Assert that the given array is an Array subclass (or numpy array).
If the given array is a numpy.ndarray an appropriate NumpyArrayAdapter
instance is created, otherwise the passed array must be a subclass of
:class:`Array` else a TypeError will be raised.
"""
i... | [
"Assert",
"that",
"the",
"given",
"array",
"is",
"an",
"Array",
"subclass",
"(",
"or",
"numpy",
"array",
")",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L3289-L3306 | [
"def",
"ensure_array",
"(",
"array",
")",
":",
"if",
"not",
"isinstance",
"(",
"array",
",",
"Array",
")",
":",
"if",
"isinstance",
"(",
"array",
",",
"np",
".",
"ndarray",
")",
":",
"array",
"=",
"NumpyArrayAdapter",
"(",
"array",
")",
"elif",
"np",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | size | Return a human-readable description of the number of bytes required
to store the data of the given array.
For example::
>>> array.nbytes
14000000
>> biggus.size(array)
'13.35 MiB'
Parameters
----------
array : array-like object
The array object must provide... | biggus/_init.py | def size(array):
"""
Return a human-readable description of the number of bytes required
to store the data of the given array.
For example::
>>> array.nbytes
14000000
>> biggus.size(array)
'13.35 MiB'
Parameters
----------
array : array-like object
... | def size(array):
"""
Return a human-readable description of the number of bytes required
to store the data of the given array.
For example::
>>> array.nbytes
14000000
>> biggus.size(array)
'13.35 MiB'
Parameters
----------
array : array-like object
... | [
"Return",
"a",
"human",
"-",
"readable",
"description",
"of",
"the",
"number",
"of",
"bytes",
"required",
"to",
"store",
"the",
"data",
"of",
"the",
"given",
"array",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L3310-L3344 | [
"def",
"size",
"(",
"array",
")",
":",
"nbytes",
"=",
"array",
".",
"nbytes",
"if",
"nbytes",
"<",
"(",
"1",
"<<",
"10",
")",
":",
"size",
"=",
"'{} B'",
".",
"format",
"(",
"nbytes",
")",
"elif",
"nbytes",
"<",
"(",
"1",
"<<",
"20",
")",
":",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | Node.output | Dispatch the given Chunk onto all the registered output queues.
If the chunk is None, it is silently ignored. | biggus/_init.py | def output(self, chunk):
"""
Dispatch the given Chunk onto all the registered output queues.
If the chunk is None, it is silently ignored.
"""
if chunk is not None:
for queue in self.output_queues:
queue.put(chunk) | def output(self, chunk):
"""
Dispatch the given Chunk onto all the registered output queues.
If the chunk is None, it is silently ignored.
"""
if chunk is not None:
for queue in self.output_queues:
queue.put(chunk) | [
"Dispatch",
"the",
"given",
"Chunk",
"onto",
"all",
"the",
"registered",
"output",
"queues",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L115-L124 | [
"def",
"output",
"(",
"self",
",",
"chunk",
")",
":",
"if",
"chunk",
"is",
"not",
"None",
":",
"for",
"queue",
"in",
"self",
".",
"output_queues",
":",
"queue",
".",
"put",
"(",
"chunk",
")"
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | ProducerNode.run | Emit the Chunk instances which cover the underlying Array.
The Array is divided into chunks with a size limit of
MAX_CHUNK_SIZE which are emitted into all registered output
queues. | biggus/_init.py | def run(self):
"""
Emit the Chunk instances which cover the underlying Array.
The Array is divided into chunks with a size limit of
MAX_CHUNK_SIZE which are emitted into all registered output
queues.
"""
try:
chunk_index = self.chunk_index_gen(self.a... | def run(self):
"""
Emit the Chunk instances which cover the underlying Array.
The Array is divided into chunks with a size limit of
MAX_CHUNK_SIZE which are emitted into all registered output
queues.
"""
try:
chunk_index = self.chunk_index_gen(self.a... | [
"Emit",
"the",
"Chunk",
"instances",
"which",
"cover",
"the",
"underlying",
"Array",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L175-L204 | [
"def",
"run",
"(",
"self",
")",
":",
"try",
":",
"chunk_index",
"=",
"self",
".",
"chunk_index_gen",
"(",
"self",
".",
"array",
".",
"shape",
",",
"self",
".",
"iteration_order",
")",
"for",
"key",
"in",
"chunk_index",
":",
"# Now we have the slices that des... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | ConsumerNode.add_input_nodes | Set the given nodes as inputs for this node.
Creates a limited-size queue.Queue for each input node and
registers each queue as an output of its corresponding node. | biggus/_init.py | def add_input_nodes(self, input_nodes):
"""
Set the given nodes as inputs for this node.
Creates a limited-size queue.Queue for each input node and
registers each queue as an output of its corresponding node.
"""
self.input_queues = [queue.Queue(maxsize=3) for _ in inpu... | def add_input_nodes(self, input_nodes):
"""
Set the given nodes as inputs for this node.
Creates a limited-size queue.Queue for each input node and
registers each queue as an output of its corresponding node.
"""
self.input_queues = [queue.Queue(maxsize=3) for _ in inpu... | [
"Set",
"the",
"given",
"nodes",
"as",
"inputs",
"for",
"this",
"node",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L222-L232 | [
"def",
"add_input_nodes",
"(",
"self",
",",
"input_nodes",
")",
":",
"self",
".",
"input_queues",
"=",
"[",
"queue",
".",
"Queue",
"(",
"maxsize",
"=",
"3",
")",
"for",
"_",
"in",
"input_nodes",
"]",
"for",
"input_node",
",",
"input_queue",
"in",
"zip",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | ConsumerNode.run | Process the input queues in lock-step, and push any results to
the registered output queues. | biggus/_init.py | def run(self):
"""
Process the input queues in lock-step, and push any results to
the registered output queues.
"""
try:
while True:
input_chunks = [input.get() for input in self.input_queues]
for input in self.input_queues:
... | def run(self):
"""
Process the input queues in lock-step, and push any results to
the registered output queues.
"""
try:
while True:
input_chunks = [input.get() for input in self.input_queues]
for input in self.input_queues:
... | [
"Process",
"the",
"input",
"queues",
"in",
"lock",
"-",
"step",
"and",
"push",
"any",
"results",
"to",
"the",
"registered",
"output",
"queues",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L253-L278 | [
"def",
"run",
"(",
"self",
")",
":",
"try",
":",
"while",
"True",
":",
"input_chunks",
"=",
"[",
"input",
".",
"get",
"(",
")",
"for",
"input",
"in",
"self",
".",
"input_queues",
"]",
"for",
"input",
"in",
"self",
".",
"input_queues",
":",
"input",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | NdarrayNode.process_chunks | Store the incoming chunk at the corresponding position in the
result array. | biggus/_init.py | def process_chunks(self, chunks):
"""
Store the incoming chunk at the corresponding position in the
result array.
"""
chunk, = chunks
if chunk.keys:
self.result[chunk.keys] = chunk.data
else:
self.result[...] = chunk.data | def process_chunks(self, chunks):
"""
Store the incoming chunk at the corresponding position in the
result array.
"""
chunk, = chunks
if chunk.keys:
self.result[chunk.keys] = chunk.data
else:
self.result[...] = chunk.data | [
"Store",
"the",
"incoming",
"chunk",
"at",
"the",
"corresponding",
"position",
"in",
"the",
"result",
"array",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L324-L334 | [
"def",
"process_chunks",
"(",
"self",
",",
"chunks",
")",
":",
"chunk",
",",
"=",
"chunks",
"if",
"chunk",
".",
"keys",
":",
"self",
".",
"result",
"[",
"chunk",
".",
"keys",
"]",
"=",
"chunk",
".",
"data",
"else",
":",
"self",
".",
"result",
"[",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | _ArrayAdapter._cleanup_new_key | Return a key of type int, slice, or tuple that is guaranteed
to be valid for the given dimension size.
Raises IndexError/TypeError for invalid keys. | biggus/_init.py | def _cleanup_new_key(self, key, size, axis):
"""
Return a key of type int, slice, or tuple that is guaranteed
to be valid for the given dimension size.
Raises IndexError/TypeError for invalid keys.
"""
if _is_scalar(key):
if key >= size or key < -size:
... | def _cleanup_new_key(self, key, size, axis):
"""
Return a key of type int, slice, or tuple that is guaranteed
to be valid for the given dimension size.
Raises IndexError/TypeError for invalid keys.
"""
if _is_scalar(key):
if key >= size or key < -size:
... | [
"Return",
"a",
"key",
"of",
"type",
"int",
"slice",
"or",
"tuple",
"that",
"is",
"guaranteed",
"to",
"be",
"valid",
"for",
"the",
"given",
"dimension",
"size",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L1347-L1380 | [
"def",
"_cleanup_new_key",
"(",
"self",
",",
"key",
",",
"size",
",",
"axis",
")",
":",
"if",
"_is_scalar",
"(",
"key",
")",
":",
"if",
"key",
">=",
"size",
"or",
"key",
"<",
"-",
"size",
":",
"msg",
"=",
"'index {0} is out of bounds for axis {1} with'",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | _ArrayAdapter._remap_new_key | Return a key of type int, slice, or tuple that represents the
combination of new_key with the given indices.
Raises IndexError/TypeError for invalid keys. | biggus/_init.py | def _remap_new_key(self, indices, new_key, axis):
"""
Return a key of type int, slice, or tuple that represents the
combination of new_key with the given indices.
Raises IndexError/TypeError for invalid keys.
"""
size = len(indices)
if _is_scalar(new_key):
... | def _remap_new_key(self, indices, new_key, axis):
"""
Return a key of type int, slice, or tuple that represents the
combination of new_key with the given indices.
Raises IndexError/TypeError for invalid keys.
"""
size = len(indices)
if _is_scalar(new_key):
... | [
"Return",
"a",
"key",
"of",
"type",
"int",
"slice",
"or",
"tuple",
"that",
"represents",
"the",
"combination",
"of",
"new_key",
"with",
"the",
"given",
"indices",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L1382-L1421 | [
"def",
"_remap_new_key",
"(",
"self",
",",
"indices",
",",
"new_key",
",",
"axis",
")",
":",
"size",
"=",
"len",
"(",
"indices",
")",
"if",
"_is_scalar",
"(",
"new_key",
")",
":",
"if",
"new_key",
">=",
"size",
"or",
"new_key",
"<",
"-",
"size",
":",... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | TransposedArray._apply_axes_mapping | Apply the transposition to the target iterable.
Parameters
----------
target - iterable
The iterable to transpose. This would be suitable for things
such as a shape as well as a list of ``__getitem__`` keys.
inverse - bool
Whether to map old dimension... | biggus/_init.py | def _apply_axes_mapping(self, target, inverse=False):
"""
Apply the transposition to the target iterable.
Parameters
----------
target - iterable
The iterable to transpose. This would be suitable for things
such as a shape as well as a list of ``__getitem... | def _apply_axes_mapping(self, target, inverse=False):
"""
Apply the transposition to the target iterable.
Parameters
----------
target - iterable
The iterable to transpose. This would be suitable for things
such as a shape as well as a list of ``__getitem... | [
"Apply",
"the",
"transposition",
"to",
"the",
"target",
"iterable",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L1635-L1667 | [
"def",
"_apply_axes_mapping",
"(",
"self",
",",
"target",
",",
"inverse",
"=",
"False",
")",
":",
"if",
"len",
"(",
"target",
")",
"!=",
"self",
".",
"ndim",
":",
"raise",
"ValueError",
"(",
"'The target iterable is of length {}, but '",
"'should be of length {}.'... | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | _AggregationStreamsHandler.output_keys | Given input chunk keys, compute what keys will be needed to put
the result into the result array.
As an example of where this gets used - when we aggregate on a
particular axis, the source keys may be ``(0:2, None:None)``, but for
an aggregation on axis 0, they would result in target va... | biggus/_init.py | def output_keys(self, source_keys):
"""
Given input chunk keys, compute what keys will be needed to put
the result into the result array.
As an example of where this gets used - when we aggregate on a
particular axis, the source keys may be ``(0:2, None:None)``, but for
... | def output_keys(self, source_keys):
"""
Given input chunk keys, compute what keys will be needed to put
the result into the result array.
As an example of where this gets used - when we aggregate on a
particular axis, the source keys may be ``(0:2, None:None)``, but for
... | [
"Given",
"input",
"chunk",
"keys",
"compute",
"what",
"keys",
"will",
"be",
"needed",
"to",
"put",
"the",
"result",
"into",
"the",
"result",
"array",
"."
] | SciTools/biggus | python | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/_init.py#L2254-L2268 | [
"def",
"output_keys",
"(",
"self",
",",
"source_keys",
")",
":",
"keys",
"=",
"list",
"(",
"source_keys",
")",
"# Remove the aggregated axis from the keys.",
"del",
"keys",
"[",
"self",
".",
"axis",
"]",
"return",
"tuple",
"(",
"keys",
")"
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 |
train | scalarmult_B | Implements scalarmult(B, e) more efficiently. | securesystemslib/_vendor/ed25519/ed25519.py | def scalarmult_B(e):
"""
Implements scalarmult(B, e) more efficiently.
"""
# scalarmult(B, l) is the identity
e = e % l
P = ident
for i in range(253):
if e & 1:
P = edwards_add(P, Bpow[i])
e = e // 2
assert e == 0, e
return P | def scalarmult_B(e):
"""
Implements scalarmult(B, e) more efficiently.
"""
# scalarmult(B, l) is the identity
e = e % l
P = ident
for i in range(253):
if e & 1:
P = edwards_add(P, Bpow[i])
e = e // 2
assert e == 0, e
return P | [
"Implements",
"scalarmult",
"(",
"B",
"e",
")",
"more",
"efficiently",
"."
] | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/_vendor/ed25519/ed25519.py#L181-L193 | [
"def",
"scalarmult_B",
"(",
"e",
")",
":",
"# scalarmult(B, l) is the identity",
"e",
"=",
"e",
"%",
"l",
"P",
"=",
"ident",
"for",
"i",
"in",
"range",
"(",
"253",
")",
":",
"if",
"e",
"&",
"1",
":",
"P",
"=",
"edwards_add",
"(",
"P",
",",
"Bpow",
... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | publickey_unsafe | Not safe to use with secret keys or secret data.
See module docstring. This function should be used for testing only. | securesystemslib/_vendor/ed25519/ed25519.py | def publickey_unsafe(sk):
"""
Not safe to use with secret keys or secret data.
See module docstring. This function should be used for testing only.
"""
h = H(sk)
a = 2 ** (b - 2) + sum(2 ** i * bit(h, i) for i in range(3, b - 2))
A = scalarmult_B(a)
return encodepoint(A) | def publickey_unsafe(sk):
"""
Not safe to use with secret keys or secret data.
See module docstring. This function should be used for testing only.
"""
h = H(sk)
a = 2 ** (b - 2) + sum(2 ** i * bit(h, i) for i in range(3, b - 2))
A = scalarmult_B(a)
return encodepoint(A) | [
"Not",
"safe",
"to",
"use",
"with",
"secret",
"keys",
"or",
"secret",
"data",
"."
] | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/_vendor/ed25519/ed25519.py#L220-L229 | [
"def",
"publickey_unsafe",
"(",
"sk",
")",
":",
"h",
"=",
"H",
"(",
"sk",
")",
"a",
"=",
"2",
"**",
"(",
"b",
"-",
"2",
")",
"+",
"sum",
"(",
"2",
"**",
"i",
"*",
"bit",
"(",
"h",
",",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"3",
",",... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | generate_public_and_private | <Purpose>
Generate a pair of ed25519 public and private keys with PyNaCl. The public
and private keys returned conform to
'securesystemslib.formats.ED25519PULIC_SCHEMA' and
'securesystemslib.formats.ED25519SEED_SCHEMA', respectively, and have the
form:
'\xa2F\x99\xe0\x86\x80%\xc8\xee\x11\xb95T... | securesystemslib/ed25519_keys.py | def generate_public_and_private():
"""
<Purpose>
Generate a pair of ed25519 public and private keys with PyNaCl. The public
and private keys returned conform to
'securesystemslib.formats.ED25519PULIC_SCHEMA' and
'securesystemslib.formats.ED25519SEED_SCHEMA', respectively, and have the
form:
... | def generate_public_and_private():
"""
<Purpose>
Generate a pair of ed25519 public and private keys with PyNaCl. The public
and private keys returned conform to
'securesystemslib.formats.ED25519PULIC_SCHEMA' and
'securesystemslib.formats.ED25519SEED_SCHEMA', respectively, and have the
form:
... | [
"<Purpose",
">",
"Generate",
"a",
"pair",
"of",
"ed25519",
"public",
"and",
"private",
"keys",
"with",
"PyNaCl",
".",
"The",
"public",
"and",
"private",
"keys",
"returned",
"conform",
"to",
"securesystemslib",
".",
"formats",
".",
"ED25519PULIC_SCHEMA",
"and",
... | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/ed25519_keys.py#L119-L177 | [
"def",
"generate_public_and_private",
"(",
")",
":",
"# Generate ed25519's seed key by calling os.urandom(). The random bytes",
"# returned should be suitable for cryptographic use and is OS-specific.",
"# Raise 'NotImplementedError' if a randomness source is not found.",
"# ed25519 seed keys are f... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | create_signature | <Purpose>
Return a (signature, scheme) tuple, where the signature scheme is 'ed25519'
and is always generated by PyNaCl (i.e., 'nacl'). The signature returned
conforms to 'securesystemslib.formats.ED25519SIGNATURE_SCHEMA', and has the
form:
'\xae\xd7\x9f\xaf\x95{bP\x9e\xa8YO Z\x86\x9d...'
A s... | securesystemslib/ed25519_keys.py | def create_signature(public_key, private_key, data, scheme):
"""
<Purpose>
Return a (signature, scheme) tuple, where the signature scheme is 'ed25519'
and is always generated by PyNaCl (i.e., 'nacl'). The signature returned
conforms to 'securesystemslib.formats.ED25519SIGNATURE_SCHEMA', and has the
... | def create_signature(public_key, private_key, data, scheme):
"""
<Purpose>
Return a (signature, scheme) tuple, where the signature scheme is 'ed25519'
and is always generated by PyNaCl (i.e., 'nacl'). The signature returned
conforms to 'securesystemslib.formats.ED25519SIGNATURE_SCHEMA', and has the
... | [
"<Purpose",
">",
"Return",
"a",
"(",
"signature",
"scheme",
")",
"tuple",
"where",
"the",
"signature",
"scheme",
"is",
"ed25519",
"and",
"is",
"always",
"generated",
"by",
"PyNaCl",
"(",
"i",
".",
"e",
".",
"nacl",
")",
".",
"The",
"signature",
"returned... | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/ed25519_keys.py#L183-L283 | [
"def",
"create_signature",
"(",
"public_key",
",",
"private_key",
",",
"data",
",",
"scheme",
")",
":",
"# Does 'public_key' have the correct format?",
"# This check will ensure 'public_key' conforms to",
"# 'securesystemslib.formats.ED25519PUBLIC_SCHEMA', which must have length 32",
"... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | verify_signature | <Purpose>
Determine whether the private key corresponding to 'public_key' produced
'signature'. verify_signature() will use the public key, the 'scheme' and
'sig', and 'data' arguments to complete the verification.
>>> public, private = generate_public_and_private()
>>> data = b'The quick brown fo... | securesystemslib/ed25519_keys.py | def verify_signature(public_key, scheme, signature, data, use_pynacl=False):
"""
<Purpose>
Determine whether the private key corresponding to 'public_key' produced
'signature'. verify_signature() will use the public key, the 'scheme' and
'sig', and 'data' arguments to complete the verification.
>>... | def verify_signature(public_key, scheme, signature, data, use_pynacl=False):
"""
<Purpose>
Determine whether the private key corresponding to 'public_key' produced
'signature'. verify_signature() will use the public key, the 'scheme' and
'sig', and 'data' arguments to complete the verification.
>>... | [
"<Purpose",
">",
"Determine",
"whether",
"the",
"private",
"key",
"corresponding",
"to",
"public_key",
"produced",
"signature",
".",
"verify_signature",
"()",
"will",
"use",
"the",
"public",
"key",
"the",
"scheme",
"and",
"sig",
"and",
"data",
"arguments",
"to",... | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/ed25519_keys.py#L289-L404 | [
"def",
"verify_signature",
"(",
"public_key",
",",
"scheme",
",",
"signature",
",",
"data",
",",
"use_pynacl",
"=",
"False",
")",
":",
"# Does 'public_key' have the correct format?",
"# This check will ensure 'public_key' conforms to",
"# 'securesystemslib.formats.ED25519PUBLIC_S... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | _delete_file | Cleanly deletes a file in `n` attempts (if necessary) | pyzos/zos.py | def _delete_file(fileName, n=10):
"""Cleanly deletes a file in `n` attempts (if necessary)"""
status = False
count = 0
while not status and count < n:
try:
_os.remove(fileName)
except OSError:
count += 1
_time.sleep(0.2)
else:
statu... | def _delete_file(fileName, n=10):
"""Cleanly deletes a file in `n` attempts (if necessary)"""
status = False
count = 0
while not status and count < n:
try:
_os.remove(fileName)
except OSError:
count += 1
_time.sleep(0.2)
else:
statu... | [
"Cleanly",
"deletes",
"a",
"file",
"in",
"n",
"attempts",
"(",
"if",
"necessary",
")"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L53-L65 | [
"def",
"_delete_file",
"(",
"fileName",
",",
"n",
"=",
"10",
")",
":",
"status",
"=",
"False",
"count",
"=",
"0",
"while",
"not",
"status",
"and",
"count",
"<",
"n",
":",
"try",
":",
"_os",
".",
"remove",
"(",
"fileName",
")",
"except",
"OSError",
... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | _PyZDDE.zDDEInit | Initiates link with OpticStudio DDE server | pyzos/zos.py | def zDDEInit(self):
"""Initiates link with OpticStudio DDE server"""
self.pyver = _get_python_version()
# do this only one time or when there is no channel
if _PyZDDE.liveCh==0:
try:
_PyZDDE.server = _dde.CreateServer()
_PyZDDE.server.Create("Z... | def zDDEInit(self):
"""Initiates link with OpticStudio DDE server"""
self.pyver = _get_python_version()
# do this only one time or when there is no channel
if _PyZDDE.liveCh==0:
try:
_PyZDDE.server = _dde.CreateServer()
_PyZDDE.server.Create("Z... | [
"Initiates",
"link",
"with",
"OpticStudio",
"DDE",
"server"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L80-L103 | [
"def",
"zDDEInit",
"(",
"self",
")",
":",
"self",
".",
"pyver",
"=",
"_get_python_version",
"(",
")",
"# do this only one time or when there is no channel",
"if",
"_PyZDDE",
".",
"liveCh",
"==",
"0",
":",
"try",
":",
"_PyZDDE",
".",
"server",
"=",
"_dde",
".",... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | _PyZDDE.zDDEClose | Close the DDE link with Zemax server | pyzos/zos.py | def zDDEClose(self):
"""Close the DDE link with Zemax server"""
if _PyZDDE.server and not _PyZDDE.liveCh:
_PyZDDE.server.Shutdown(self.conversation)
_PyZDDE.server = 0
elif _PyZDDE.server and self.connection and _PyZDDE.liveCh == 1:
_PyZDDE.server.Shutdown(sel... | def zDDEClose(self):
"""Close the DDE link with Zemax server"""
if _PyZDDE.server and not _PyZDDE.liveCh:
_PyZDDE.server.Shutdown(self.conversation)
_PyZDDE.server = 0
elif _PyZDDE.server and self.connection and _PyZDDE.liveCh == 1:
_PyZDDE.server.Shutdown(sel... | [
"Close",
"the",
"DDE",
"link",
"with",
"Zemax",
"server"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L105-L121 | [
"def",
"zDDEClose",
"(",
"self",
")",
":",
"if",
"_PyZDDE",
".",
"server",
"and",
"not",
"_PyZDDE",
".",
"liveCh",
":",
"_PyZDDE",
".",
"server",
".",
"Shutdown",
"(",
"self",
".",
"conversation",
")",
"_PyZDDE",
".",
"server",
"=",
"0",
"elif",
"_PyZD... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | _PyZDDE.setTimeout | Set global timeout value, in seconds, for all DDE calls | pyzos/zos.py | def setTimeout(self, time):
"""Set global timeout value, in seconds, for all DDE calls"""
self.conversation.SetDDETimeout(round(time))
return self.conversation.GetDDETimeout() | def setTimeout(self, time):
"""Set global timeout value, in seconds, for all DDE calls"""
self.conversation.SetDDETimeout(round(time))
return self.conversation.GetDDETimeout() | [
"Set",
"global",
"timeout",
"value",
"in",
"seconds",
"for",
"all",
"DDE",
"calls"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L123-L126 | [
"def",
"setTimeout",
"(",
"self",
",",
"time",
")",
":",
"self",
".",
"conversation",
".",
"SetDDETimeout",
"(",
"round",
"(",
"time",
")",
")",
"return",
"self",
".",
"conversation",
".",
"GetDDETimeout",
"(",
")"
] | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | _PyZDDE._sendDDEcommand | Send command to DDE client | pyzos/zos.py | def _sendDDEcommand(self, cmd, timeout=None):
"""Send command to DDE client"""
reply = self.conversation.Request(cmd, timeout)
if self.pyver > 2:
reply = reply.decode('ascii').rstrip()
return reply | def _sendDDEcommand(self, cmd, timeout=None):
"""Send command to DDE client"""
reply = self.conversation.Request(cmd, timeout)
if self.pyver > 2:
reply = reply.decode('ascii').rstrip()
return reply | [
"Send",
"command",
"to",
"DDE",
"client"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L128-L133 | [
"def",
"_sendDDEcommand",
"(",
"self",
",",
"cmd",
",",
"timeout",
"=",
"None",
")",
":",
"reply",
"=",
"self",
".",
"conversation",
".",
"Request",
"(",
"cmd",
",",
"timeout",
")",
"if",
"self",
".",
"pyver",
">",
"2",
":",
"reply",
"=",
"reply",
... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | _PyZDDE.zGetUpdate | Update the lens | pyzos/zos.py | def zGetUpdate(self):
"""Update the lens"""
status,ret = -998, None
ret = self._sendDDEcommand("GetUpdate")
if ret != None:
status = int(ret) #Note: Zemax returns -1 if GetUpdate fails.
return status | def zGetUpdate(self):
"""Update the lens"""
status,ret = -998, None
ret = self._sendDDEcommand("GetUpdate")
if ret != None:
status = int(ret) #Note: Zemax returns -1 if GetUpdate fails.
return status | [
"Update",
"the",
"lens"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L152-L158 | [
"def",
"zGetUpdate",
"(",
"self",
")",
":",
"status",
",",
"ret",
"=",
"-",
"998",
",",
"None",
"ret",
"=",
"self",
".",
"_sendDDEcommand",
"(",
"\"GetUpdate\"",
")",
"if",
"ret",
"!=",
"None",
":",
"status",
"=",
"int",
"(",
"ret",
")",
"#Note: Zema... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | _PyZDDE.zLoadFile | Loads a zmx file into the DDE server | pyzos/zos.py | def zLoadFile(self, fileName, append=None):
"""Loads a zmx file into the DDE server"""
reply = None
if append:
cmd = "LoadFile,{},{}".format(fileName, append)
else:
cmd = "LoadFile,{}".format(fileName)
reply = self._sendDDEcommand(cmd)
if reply:
... | def zLoadFile(self, fileName, append=None):
"""Loads a zmx file into the DDE server"""
reply = None
if append:
cmd = "LoadFile,{},{}".format(fileName, append)
else:
cmd = "LoadFile,{}".format(fileName)
reply = self._sendDDEcommand(cmd)
if reply:
... | [
"Loads",
"a",
"zmx",
"file",
"into",
"the",
"DDE",
"server"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L164-L175 | [
"def",
"zLoadFile",
"(",
"self",
",",
"fileName",
",",
"append",
"=",
"None",
")",
":",
"reply",
"=",
"None",
"if",
"append",
":",
"cmd",
"=",
"\"LoadFile,{},{}\"",
".",
"format",
"(",
"fileName",
",",
"append",
")",
"else",
":",
"cmd",
"=",
"\"LoadFil... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | _PyZDDE.zPushLens | Copy lens in the Zemax DDE server into LDE | pyzos/zos.py | def zPushLens(self, update=None, timeout=None):
"""Copy lens in the Zemax DDE server into LDE"""
reply = None
if update == 1:
reply = self._sendDDEcommand('PushLens,1', timeout)
elif update == 0 or update is None:
reply = self._sendDDEcommand('PushLens,0', timeout... | def zPushLens(self, update=None, timeout=None):
"""Copy lens in the Zemax DDE server into LDE"""
reply = None
if update == 1:
reply = self._sendDDEcommand('PushLens,1', timeout)
elif update == 0 or update is None:
reply = self._sendDDEcommand('PushLens,0', timeout... | [
"Copy",
"lens",
"in",
"the",
"Zemax",
"DDE",
"server",
"into",
"LDE"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L177-L189 | [
"def",
"zPushLens",
"(",
"self",
",",
"update",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"reply",
"=",
"None",
"if",
"update",
"==",
"1",
":",
"reply",
"=",
"self",
".",
"_sendDDEcommand",
"(",
"'PushLens,1'",
",",
"timeout",
")",
"elif",
... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | _PyZDDE.zSaveFile | Saves the lens currently loaded in the server to a Zemax file | pyzos/zos.py | def zSaveFile(self, fileName):
"""Saves the lens currently loaded in the server to a Zemax file """
cmd = "SaveFile,{}".format(fileName)
reply = self._sendDDEcommand(cmd)
return int(float(reply.rstrip())) | def zSaveFile(self, fileName):
"""Saves the lens currently loaded in the server to a Zemax file """
cmd = "SaveFile,{}".format(fileName)
reply = self._sendDDEcommand(cmd)
return int(float(reply.rstrip())) | [
"Saves",
"the",
"lens",
"currently",
"loaded",
"in",
"the",
"server",
"to",
"a",
"Zemax",
"file"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L196-L200 | [
"def",
"zSaveFile",
"(",
"self",
",",
"fileName",
")",
":",
"cmd",
"=",
"\"SaveFile,{}\"",
".",
"format",
"(",
"fileName",
")",
"reply",
"=",
"self",
".",
"_sendDDEcommand",
"(",
"cmd",
")",
"return",
"int",
"(",
"float",
"(",
"reply",
".",
"rstrip",
"... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | OpticalSystem.zSyncWithUI | Turn on sync-with-ui | pyzos/zos.py | def zSyncWithUI(self):
"""Turn on sync-with-ui"""
if not OpticalSystem._dde_link:
OpticalSystem._dde_link = _get_new_dde_link()
if not self._sync_ui_file:
self._sync_ui_file = _get_sync_ui_filename()
self._sync_ui = True | def zSyncWithUI(self):
"""Turn on sync-with-ui"""
if not OpticalSystem._dde_link:
OpticalSystem._dde_link = _get_new_dde_link()
if not self._sync_ui_file:
self._sync_ui_file = _get_sync_ui_filename()
self._sync_ui = True | [
"Turn",
"on",
"sync",
"-",
"with",
"-",
"ui"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L323-L329 | [
"def",
"zSyncWithUI",
"(",
"self",
")",
":",
"if",
"not",
"OpticalSystem",
".",
"_dde_link",
":",
"OpticalSystem",
".",
"_dde_link",
"=",
"_get_new_dde_link",
"(",
")",
"if",
"not",
"self",
".",
"_sync_ui_file",
":",
"self",
".",
"_sync_ui_file",
"=",
"_get_... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | OpticalSystem.zPushLens | Push lens in ZOS COM server to UI | pyzos/zos.py | def zPushLens(self, update=None):
"""Push lens in ZOS COM server to UI"""
self.SaveAs(self._sync_ui_file)
OpticalSystem._dde_link.zLoadFile(self._sync_ui_file)
OpticalSystem._dde_link.zPushLens(update) | def zPushLens(self, update=None):
"""Push lens in ZOS COM server to UI"""
self.SaveAs(self._sync_ui_file)
OpticalSystem._dde_link.zLoadFile(self._sync_ui_file)
OpticalSystem._dde_link.zPushLens(update) | [
"Push",
"lens",
"in",
"ZOS",
"COM",
"server",
"to",
"UI"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L331-L335 | [
"def",
"zPushLens",
"(",
"self",
",",
"update",
"=",
"None",
")",
":",
"self",
".",
"SaveAs",
"(",
"self",
".",
"_sync_ui_file",
")",
"OpticalSystem",
".",
"_dde_link",
".",
"zLoadFile",
"(",
"self",
".",
"_sync_ui_file",
")",
"OpticalSystem",
".",
"_dde_l... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | OpticalSystem.zGetRefresh | Copy lens in UI to headless ZOS COM server | pyzos/zos.py | def zGetRefresh(self):
"""Copy lens in UI to headless ZOS COM server"""
OpticalSystem._dde_link.zGetRefresh()
OpticalSystem._dde_link.zSaveFile(self._sync_ui_file)
self._iopticalsystem.LoadFile (self._sync_ui_file, False) | def zGetRefresh(self):
"""Copy lens in UI to headless ZOS COM server"""
OpticalSystem._dde_link.zGetRefresh()
OpticalSystem._dde_link.zSaveFile(self._sync_ui_file)
self._iopticalsystem.LoadFile (self._sync_ui_file, False) | [
"Copy",
"lens",
"in",
"UI",
"to",
"headless",
"ZOS",
"COM",
"server"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L337-L341 | [
"def",
"zGetRefresh",
"(",
"self",
")",
":",
"OpticalSystem",
".",
"_dde_link",
".",
"zGetRefresh",
"(",
")",
"OpticalSystem",
".",
"_dde_link",
".",
"zSaveFile",
"(",
"self",
".",
"_sync_ui_file",
")",
"self",
".",
"_iopticalsystem",
".",
"LoadFile",
"(",
"... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | OpticalSystem.SaveAs | Saves the current system to the specified file.
@param filename: absolute path (string)
@return: None
@raise: ValueError if path (excluding the zemax file name) is not valid
All future calls to `Save()` will use the same file. | pyzos/zos.py | def SaveAs(self, filename):
"""Saves the current system to the specified file.
@param filename: absolute path (string)
@return: None
@raise: ValueError if path (excluding the zemax file name) is not valid
All future calls to `Save()` will use the same file.
"""
... | def SaveAs(self, filename):
"""Saves the current system to the specified file.
@param filename: absolute path (string)
@return: None
@raise: ValueError if path (excluding the zemax file name) is not valid
All future calls to `Save()` will use the same file.
"""
... | [
"Saves",
"the",
"current",
"system",
"to",
"the",
"specified",
"file",
"."
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L344-L361 | [
"def",
"SaveAs",
"(",
"self",
",",
"filename",
")",
":",
"directory",
",",
"zfile",
"=",
"_os",
".",
"path",
".",
"split",
"(",
"filename",
")",
"if",
"zfile",
".",
"startswith",
"(",
"'pyzos_ui_sync_file'",
")",
":",
"self",
".",
"_iopticalsystem",
".",... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | OpticalSystem.Save | Saves the current system | pyzos/zos.py | def Save(self):
"""Saves the current system"""
# This method is intercepted to allow ui_sync
if self._file_to_save_on_Save:
self._iopticalsystem.SaveAs(self._file_to_save_on_Save)
else:
self._iopticalsystem.Save() | def Save(self):
"""Saves the current system"""
# This method is intercepted to allow ui_sync
if self._file_to_save_on_Save:
self._iopticalsystem.SaveAs(self._file_to_save_on_Save)
else:
self._iopticalsystem.Save() | [
"Saves",
"the",
"current",
"system"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L363-L369 | [
"def",
"Save",
"(",
"self",
")",
":",
"# This method is intercepted to allow ui_sync",
"if",
"self",
".",
"_file_to_save_on_Save",
":",
"self",
".",
"_iopticalsystem",
".",
"SaveAs",
"(",
"self",
".",
"_file_to_save_on_Save",
")",
"else",
":",
"self",
".",
"_iopti... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | OpticalSystem.zGetSurfaceData | Return surface data | pyzos/zos.py | def zGetSurfaceData(self, surfNum):
"""Return surface data"""
if self.pMode == 0: # Sequential mode
surf_data = _co.namedtuple('surface_data', ['radius', 'thick', 'material', 'semidia',
'conic', 'comment'])
surf = self.pLDE... | def zGetSurfaceData(self, surfNum):
"""Return surface data"""
if self.pMode == 0: # Sequential mode
surf_data = _co.namedtuple('surface_data', ['radius', 'thick', 'material', 'semidia',
'conic', 'comment'])
surf = self.pLDE... | [
"Return",
"surface",
"data"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L378-L387 | [
"def",
"zGetSurfaceData",
"(",
"self",
",",
"surfNum",
")",
":",
"if",
"self",
".",
"pMode",
"==",
"0",
":",
"# Sequential mode",
"surf_data",
"=",
"_co",
".",
"namedtuple",
"(",
"'surface_data'",
",",
"[",
"'radius'",
",",
"'thick'",
",",
"'material'",
",... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | OpticalSystem.zSetSurfaceData | Sets surface data | pyzos/zos.py | def zSetSurfaceData(self, surfNum, radius=None, thick=None, material=None, semidia=None,
conic=None, comment=None):
"""Sets surface data"""
if self.pMode == 0: # Sequential mode
surf = self.pLDE.GetSurfaceAt(surfNum)
if radius is not None:
... | def zSetSurfaceData(self, surfNum, radius=None, thick=None, material=None, semidia=None,
conic=None, comment=None):
"""Sets surface data"""
if self.pMode == 0: # Sequential mode
surf = self.pLDE.GetSurfaceAt(surfNum)
if radius is not None:
... | [
"Sets",
"surface",
"data"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L396-L414 | [
"def",
"zSetSurfaceData",
"(",
"self",
",",
"surfNum",
",",
"radius",
"=",
"None",
",",
"thick",
"=",
"None",
",",
"material",
"=",
"None",
",",
"semidia",
"=",
"None",
",",
"conic",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"if",
"self",
... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | OpticalSystem.zSetDefaultMeritFunctionSEQ | Sets the default merit function for Sequential Merit Function Editor
Parameters
----------
ofType : integer
optimization function type (0=RMS, ...)
ofData : integer
optimization function data (0=Wavefront, 1=Spot Radius, ...)
ofRef : integer
... | pyzos/zos.py | def zSetDefaultMeritFunctionSEQ(self, ofType=0, ofData=0, ofRef=0, pupilInteg=0, rings=0,
arms=0, obscuration=0, grid=0, delVignetted=False, useGlass=False,
glassMin=0, glassMax=1000, glassEdge=0, useAir=False, airMin=0,
... | def zSetDefaultMeritFunctionSEQ(self, ofType=0, ofData=0, ofRef=0, pupilInteg=0, rings=0,
arms=0, obscuration=0, grid=0, delVignetted=False, useGlass=False,
glassMin=0, glassMax=1000, glassEdge=0, useAir=False, airMin=0,
... | [
"Sets",
"the",
"default",
"merit",
"function",
"for",
"Sequential",
"Merit",
"Function",
"Editor"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/zos.py#L416-L499 | [
"def",
"zSetDefaultMeritFunctionSEQ",
"(",
"self",
",",
"ofType",
"=",
"0",
",",
"ofData",
"=",
"0",
",",
"ofRef",
"=",
"0",
",",
"pupilInteg",
"=",
"0",
",",
"rings",
"=",
"0",
",",
"arms",
"=",
"0",
",",
"obscuration",
"=",
"0",
",",
"grid",
"=",... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | datetime_to_unix_timestamp | <Purpose>
Convert 'datetime_object' (in datetime.datetime()) format) to a Unix/POSIX
timestamp. For example, Python's time.time() returns a Unix timestamp, and
includes the number of microseconds. 'datetime_object' is converted to UTC.
>>> datetime_object = datetime.datetime(1985, 10, 26, 1, 22)
... | securesystemslib/formats.py | def datetime_to_unix_timestamp(datetime_object):
"""
<Purpose>
Convert 'datetime_object' (in datetime.datetime()) format) to a Unix/POSIX
timestamp. For example, Python's time.time() returns a Unix timestamp, and
includes the number of microseconds. 'datetime_object' is converted to UTC.
>>> date... | def datetime_to_unix_timestamp(datetime_object):
"""
<Purpose>
Convert 'datetime_object' (in datetime.datetime()) format) to a Unix/POSIX
timestamp. For example, Python's time.time() returns a Unix timestamp, and
includes the number of microseconds. 'datetime_object' is converted to UTC.
>>> date... | [
"<Purpose",
">",
"Convert",
"datetime_object",
"(",
"in",
"datetime",
".",
"datetime",
"()",
")",
"format",
")",
"to",
"a",
"Unix",
"/",
"POSIX",
"timestamp",
".",
"For",
"example",
"Python",
"s",
"time",
".",
"time",
"()",
"returns",
"a",
"Unix",
"times... | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/formats.py#L533-L568 | [
"def",
"datetime_to_unix_timestamp",
"(",
"datetime_object",
")",
":",
"# Is 'datetime_object' a datetime.datetime() object?",
"# Raise 'securesystemslib.exceptions.FormatError' if not.",
"if",
"not",
"isinstance",
"(",
"datetime_object",
",",
"datetime",
".",
"datetime",
")",
":... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | unix_timestamp_to_datetime | <Purpose>
Convert 'unix_timestamp' (i.e., POSIX time, in UNIX_TIMESTAMP_SCHEMA format)
to a datetime.datetime() object. 'unix_timestamp' is the number of seconds
since the epoch (January 1, 1970.)
>>> datetime_object = unix_timestamp_to_datetime(1445455680)
>>> datetime_object
datetime.datetim... | securesystemslib/formats.py | def unix_timestamp_to_datetime(unix_timestamp):
"""
<Purpose>
Convert 'unix_timestamp' (i.e., POSIX time, in UNIX_TIMESTAMP_SCHEMA format)
to a datetime.datetime() object. 'unix_timestamp' is the number of seconds
since the epoch (January 1, 1970.)
>>> datetime_object = unix_timestamp_to_datetime(... | def unix_timestamp_to_datetime(unix_timestamp):
"""
<Purpose>
Convert 'unix_timestamp' (i.e., POSIX time, in UNIX_TIMESTAMP_SCHEMA format)
to a datetime.datetime() object. 'unix_timestamp' is the number of seconds
since the epoch (January 1, 1970.)
>>> datetime_object = unix_timestamp_to_datetime(... | [
"<Purpose",
">",
"Convert",
"unix_timestamp",
"(",
"i",
".",
"e",
".",
"POSIX",
"time",
"in",
"UNIX_TIMESTAMP_SCHEMA",
"format",
")",
"to",
"a",
"datetime",
".",
"datetime",
"()",
"object",
".",
"unix_timestamp",
"is",
"the",
"number",
"of",
"seconds",
"sinc... | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/formats.py#L573-L613 | [
"def",
"unix_timestamp_to_datetime",
"(",
"unix_timestamp",
")",
":",
"# Is 'unix_timestamp' properly formatted?",
"# Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch.",
"securesystemslib",
".",
"formats",
".",
"UNIX_TIMESTAMP_SCHEMA",
".",
"check_match",
"(",
"... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | format_base64 | <Purpose>
Return the base64 encoding of 'data' with whitespace and '=' signs omitted.
<Arguments>
data:
Binary or buffer of data to convert.
<Exceptions>
securesystemslib.exceptions.FormatError, if the base64 encoding fails or the
argument is invalid.
<Side Effects>
None.
<Returns>... | securesystemslib/formats.py | def format_base64(data):
"""
<Purpose>
Return the base64 encoding of 'data' with whitespace and '=' signs omitted.
<Arguments>
data:
Binary or buffer of data to convert.
<Exceptions>
securesystemslib.exceptions.FormatError, if the base64 encoding fails or the
argument is invalid.
<Sid... | def format_base64(data):
"""
<Purpose>
Return the base64 encoding of 'data' with whitespace and '=' signs omitted.
<Arguments>
data:
Binary or buffer of data to convert.
<Exceptions>
securesystemslib.exceptions.FormatError, if the base64 encoding fails or the
argument is invalid.
<Sid... | [
"<Purpose",
">",
"Return",
"the",
"base64",
"encoding",
"of",
"data",
"with",
"whitespace",
"and",
"=",
"signs",
"omitted",
"."
] | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/formats.py#L618-L643 | [
"def",
"format_base64",
"(",
"data",
")",
":",
"try",
":",
"return",
"binascii",
".",
"b2a_base64",
"(",
"data",
")",
".",
"decode",
"(",
"'utf-8'",
")",
".",
"rstrip",
"(",
"'=\\n '",
")",
"except",
"(",
"TypeError",
",",
"binascii",
".",
"Error",
")"... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | parse_base64 | <Purpose>
Parse a base64 encoding with whitespace and '=' signs omitted.
<Arguments>
base64_string:
A string holding a base64 value.
<Exceptions>
securesystemslib.exceptions.FormatError, if 'base64_string' cannot be parsed
due to an invalid base64 encoding.
<Side Effects>
None.
<Re... | securesystemslib/formats.py | def parse_base64(base64_string):
"""
<Purpose>
Parse a base64 encoding with whitespace and '=' signs omitted.
<Arguments>
base64_string:
A string holding a base64 value.
<Exceptions>
securesystemslib.exceptions.FormatError, if 'base64_string' cannot be parsed
due to an invalid base64 enc... | def parse_base64(base64_string):
"""
<Purpose>
Parse a base64 encoding with whitespace and '=' signs omitted.
<Arguments>
base64_string:
A string holding a base64 value.
<Exceptions>
securesystemslib.exceptions.FormatError, if 'base64_string' cannot be parsed
due to an invalid base64 enc... | [
"<Purpose",
">",
"Parse",
"a",
"base64",
"encoding",
"with",
"whitespace",
"and",
"=",
"signs",
"omitted",
"."
] | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/formats.py#L648-L683 | [
"def",
"parse_base64",
"(",
"base64_string",
")",
":",
"if",
"not",
"isinstance",
"(",
"base64_string",
",",
"six",
".",
"string_types",
")",
":",
"message",
"=",
"'Invalid argument: '",
"+",
"repr",
"(",
"base64_string",
")",
"raise",
"securesystemslib",
".",
... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | encode_canonical | <Purpose>
Encode 'object' in canonical JSON form, as specified at
http://wiki.laptop.org/go/Canonical_JSON . It's a restricted
dialect of JSON in which keys are always lexically sorted,
there is no whitespace, floats aren't allowed, and only quote
and backslash get escaped. The result is encoded i... | securesystemslib/formats.py | def encode_canonical(object, output_function=None):
"""
<Purpose>
Encode 'object' in canonical JSON form, as specified at
http://wiki.laptop.org/go/Canonical_JSON . It's a restricted
dialect of JSON in which keys are always lexically sorted,
there is no whitespace, floats aren't allowed, and only q... | def encode_canonical(object, output_function=None):
"""
<Purpose>
Encode 'object' in canonical JSON form, as specified at
http://wiki.laptop.org/go/Canonical_JSON . It's a restricted
dialect of JSON in which keys are always lexically sorted,
there is no whitespace, floats aren't allowed, and only q... | [
"<Purpose",
">",
"Encode",
"object",
"in",
"canonical",
"JSON",
"form",
"as",
"specified",
"at",
"http",
":",
"//",
"wiki",
".",
"laptop",
".",
"org",
"/",
"go",
"/",
"Canonical_JSON",
".",
"It",
"s",
"a",
"restricted",
"dialect",
"of",
"JSON",
"in",
"... | secure-systems-lab/securesystemslib | python | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/formats.py#L752-L820 | [
"def",
"encode_canonical",
"(",
"object",
",",
"output_function",
"=",
"None",
")",
":",
"result",
"=",
"None",
"# If 'output_function' is unset, treat it as",
"# appending to a list.",
"if",
"output_function",
"is",
"None",
":",
"result",
"=",
"[",
"]",
"output_funct... | beb3109d5bb462e5a60eed88fb40ed1167bd354e |
train | ArrayWriter.process_error_labels | Process the error labels of a dependent variable 'value' to ensure uniqueness. | hepdata_converter/writers/array_writer.py | def process_error_labels(value):
""" Process the error labels of a dependent variable 'value' to ensure uniqueness. """
observed_error_labels = {}
for error in value.get('errors', []):
label = error.get('label', 'error')
if label not in observed_error_labels:
... | def process_error_labels(value):
""" Process the error labels of a dependent variable 'value' to ensure uniqueness. """
observed_error_labels = {}
for error in value.get('errors', []):
label = error.get('label', 'error')
if label not in observed_error_labels:
... | [
"Process",
"the",
"error",
"labels",
"of",
"a",
"dependent",
"variable",
"value",
"to",
"ensure",
"uniqueness",
"."
] | HEPData/hepdata-converter | python | https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/writers/array_writer.py#L140-L160 | [
"def",
"process_error_labels",
"(",
"value",
")",
":",
"observed_error_labels",
"=",
"{",
"}",
"for",
"error",
"in",
"value",
".",
"get",
"(",
"'errors'",
",",
"[",
"]",
")",
":",
"label",
"=",
"error",
".",
"get",
"(",
"'label'",
",",
"'error'",
")",
... | 354271448980efba86f2f3d27b99d818e75fd90d |
train | raw | Returns a raw string representation of text | luaparser/printers.py | def raw(text):
"""Returns a raw string representation of text"""
new_string = ''
for char in text:
try:
new_string += escape_dict[char]
except KeyError:
new_string += char
return new_string | def raw(text):
"""Returns a raw string representation of text"""
new_string = ''
for char in text:
try:
new_string += escape_dict[char]
except KeyError:
new_string += char
return new_string | [
"Returns",
"a",
"raw",
"string",
"representation",
"of",
"text"
] | boolangery/py-lua-parser | python | https://github.com/boolangery/py-lua-parser/blob/578f2bf75f6f84c4b52c2affba56a4ec569d7ce7/luaparser/printers.py#L139-L147 | [
"def",
"raw",
"(",
"text",
")",
":",
"new_string",
"=",
"''",
"for",
"char",
"in",
"text",
":",
"try",
":",
"new_string",
"+=",
"escape_dict",
"[",
"char",
"]",
"except",
"KeyError",
":",
"new_string",
"+=",
"char",
"return",
"new_string"
] | 578f2bf75f6f84c4b52c2affba56a4ec569d7ce7 |
train | get_winfunc | Retrieve a function from a library/DLL, and set the data types. | pyzos/ddeclient.py | def get_winfunc(libname, funcname, restype=None, argtypes=(), _libcache={}):
"""Retrieve a function from a library/DLL, and set the data types."""
if libname not in _libcache:
_libcache[libname] = windll.LoadLibrary(libname)
func = getattr(_libcache[libname], funcname)
func.argtypes = argtypes
... | def get_winfunc(libname, funcname, restype=None, argtypes=(), _libcache={}):
"""Retrieve a function from a library/DLL, and set the data types."""
if libname not in _libcache:
_libcache[libname] = windll.LoadLibrary(libname)
func = getattr(_libcache[libname], funcname)
func.argtypes = argtypes
... | [
"Retrieve",
"a",
"function",
"from",
"a",
"library",
"/",
"DLL",
"and",
"set",
"the",
"data",
"types",
"."
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/ddeclient.py#L237-L244 | [
"def",
"get_winfunc",
"(",
"libname",
",",
"funcname",
",",
"restype",
"=",
"None",
",",
"argtypes",
"=",
"(",
")",
",",
"_libcache",
"=",
"{",
"}",
")",
":",
"if",
"libname",
"not",
"in",
"_libcache",
":",
"_libcache",
"[",
"libname",
"]",
"=",
"win... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | WinMSGLoop | Run the main windows message loop. | pyzos/ddeclient.py | def WinMSGLoop():
"""Run the main windows message loop."""
LPMSG = POINTER(MSG)
LRESULT = c_ulong
GetMessage = get_winfunc("user32", "GetMessageW", BOOL, (LPMSG, HWND, UINT, UINT))
TranslateMessage = get_winfunc("user32", "TranslateMessage", BOOL, (LPMSG,))
# restype = LRESULT
DispatchMessag... | def WinMSGLoop():
"""Run the main windows message loop."""
LPMSG = POINTER(MSG)
LRESULT = c_ulong
GetMessage = get_winfunc("user32", "GetMessageW", BOOL, (LPMSG, HWND, UINT, UINT))
TranslateMessage = get_winfunc("user32", "TranslateMessage", BOOL, (LPMSG,))
# restype = LRESULT
DispatchMessag... | [
"Run",
"the",
"main",
"windows",
"message",
"loop",
"."
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/ddeclient.py#L384-L397 | [
"def",
"WinMSGLoop",
"(",
")",
":",
"LPMSG",
"=",
"POINTER",
"(",
"MSG",
")",
"LRESULT",
"=",
"c_ulong",
"GetMessage",
"=",
"get_winfunc",
"(",
"\"user32\"",
",",
"\"GetMessageW\"",
",",
"BOOL",
",",
"(",
"LPMSG",
",",
"HWND",
",",
"UINT",
",",
"UINT",
... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | CreateConversation.ConnectTo | Exceptional error is handled in zdde Init() method, so the exception
must be re-raised | pyzos/ddeclient.py | def ConnectTo(self, appName, data=None):
"""Exceptional error is handled in zdde Init() method, so the exception
must be re-raised"""
global number_of_apps_communicating
self.ddeServerName = appName
try:
self.ddec = DDEClient(self.ddeServerName, self.ddeClientName) # ... | def ConnectTo(self, appName, data=None):
"""Exceptional error is handled in zdde Init() method, so the exception
must be re-raised"""
global number_of_apps_communicating
self.ddeServerName = appName
try:
self.ddec = DDEClient(self.ddeServerName, self.ddeClientName) # ... | [
"Exceptional",
"error",
"is",
"handled",
"in",
"zdde",
"Init",
"()",
"method",
"so",
"the",
"exception",
"must",
"be",
"re",
"-",
"raised"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/ddeclient.py#L191-L201 | [
"def",
"ConnectTo",
"(",
"self",
",",
"appName",
",",
"data",
"=",
"None",
")",
":",
"global",
"number_of_apps_communicating",
"self",
".",
"ddeServerName",
"=",
"appName",
"try",
":",
"self",
".",
"ddec",
"=",
"DDEClient",
"(",
"self",
".",
"ddeServerName",... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | CreateConversation.Request | Request DDE client
timeout in seconds
Note ... handle the exception within this function. | pyzos/ddeclient.py | def Request(self, item, timeout=None):
"""Request DDE client
timeout in seconds
Note ... handle the exception within this function.
"""
if not timeout:
timeout = self.ddetimeout
try:
reply = self.ddec.request(item, int(timeout*1000)) # convert time... | def Request(self, item, timeout=None):
"""Request DDE client
timeout in seconds
Note ... handle the exception within this function.
"""
if not timeout:
timeout = self.ddetimeout
try:
reply = self.ddec.request(item, int(timeout*1000)) # convert time... | [
"Request",
"DDE",
"client",
"timeout",
"in",
"seconds",
"Note",
"...",
"handle",
"the",
"exception",
"within",
"this",
"function",
"."
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/ddeclient.py#L204-L222 | [
"def",
"Request",
"(",
"self",
",",
"item",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"not",
"timeout",
":",
"timeout",
"=",
"self",
".",
"ddetimeout",
"try",
":",
"reply",
"=",
"self",
".",
"ddec",
".",
"request",
"(",
"item",
",",
"int",
"(",
... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | DDEClient.advise | Request updates when DDE data changes. | pyzos/ddeclient.py | def advise(self, item, stop=False):
"""Request updates when DDE data changes."""
hszItem = DDE.CreateStringHandle(self._idInst, item, CP_WINUNICODE)
hDdeData = DDE.ClientTransaction(LPBYTE(), 0, self._hConv, hszItem, CF_TEXT, XTYP_ADVSTOP if stop else XTYP_ADVSTART, TIMEOUT_ASYNC, LPDWORD())
... | def advise(self, item, stop=False):
"""Request updates when DDE data changes."""
hszItem = DDE.CreateStringHandle(self._idInst, item, CP_WINUNICODE)
hDdeData = DDE.ClientTransaction(LPBYTE(), 0, self._hConv, hszItem, CF_TEXT, XTYP_ADVSTOP if stop else XTYP_ADVSTART, TIMEOUT_ASYNC, LPDWORD())
... | [
"Request",
"updates",
"when",
"DDE",
"data",
"changes",
"."
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/ddeclient.py#L305-L312 | [
"def",
"advise",
"(",
"self",
",",
"item",
",",
"stop",
"=",
"False",
")",
":",
"hszItem",
"=",
"DDE",
".",
"CreateStringHandle",
"(",
"self",
".",
"_idInst",
",",
"item",
",",
"CP_WINUNICODE",
")",
"hDdeData",
"=",
"DDE",
".",
"ClientTransaction",
"(",
... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | DDEClient.execute | Execute a DDE command. | pyzos/ddeclient.py | def execute(self, command):
"""Execute a DDE command."""
pData = c_char_p(command)
cbData = DWORD(len(command) + 1)
hDdeData = DDE.ClientTransaction(pData, cbData, self._hConv, HSZ(), CF_TEXT, XTYP_EXECUTE, TIMEOUT_ASYNC, LPDWORD())
if not hDdeData:
raise DDEError("Un... | def execute(self, command):
"""Execute a DDE command."""
pData = c_char_p(command)
cbData = DWORD(len(command) + 1)
hDdeData = DDE.ClientTransaction(pData, cbData, self._hConv, HSZ(), CF_TEXT, XTYP_EXECUTE, TIMEOUT_ASYNC, LPDWORD())
if not hDdeData:
raise DDEError("Un... | [
"Execute",
"a",
"DDE",
"command",
"."
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/ddeclient.py#L314-L321 | [
"def",
"execute",
"(",
"self",
",",
"command",
")",
":",
"pData",
"=",
"c_char_p",
"(",
"command",
")",
"cbData",
"=",
"DWORD",
"(",
"len",
"(",
"command",
")",
"+",
"1",
")",
"hDdeData",
"=",
"DDE",
".",
"ClientTransaction",
"(",
"pData",
",",
"cbDa... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | DDEClient.request | Request data from DDE service. | pyzos/ddeclient.py | def request(self, item, timeout=5000):
"""Request data from DDE service."""
hszItem = DDE.CreateStringHandle(self._idInst, item, CP_WINUNICODE)
#hDdeData = DDE.ClientTransaction(LPBYTE(), 0, self._hConv, hszItem, CF_TEXT, XTYP_REQUEST, timeout, LPDWORD())
pdwResult = DWORD(0)
hDd... | def request(self, item, timeout=5000):
"""Request data from DDE service."""
hszItem = DDE.CreateStringHandle(self._idInst, item, CP_WINUNICODE)
#hDdeData = DDE.ClientTransaction(LPBYTE(), 0, self._hConv, hszItem, CF_TEXT, XTYP_REQUEST, timeout, LPDWORD())
pdwResult = DWORD(0)
hDd... | [
"Request",
"data",
"from",
"DDE",
"service",
"."
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/ddeclient.py#L323-L343 | [
"def",
"request",
"(",
"self",
",",
"item",
",",
"timeout",
"=",
"5000",
")",
":",
"hszItem",
"=",
"DDE",
".",
"CreateStringHandle",
"(",
"self",
".",
"_idInst",
",",
"item",
",",
"CP_WINUNICODE",
")",
"#hDdeData = DDE.ClientTransaction(LPBYTE(), 0, self._hConv, h... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | DDEClient._callback | DdeCallback callback function for processing Dynamic Data Exchange (DDE)
transactions sent by DDEML in response to DDE events
Parameters
----------
wType : transaction type (UINT)
uFmt : clipboard data format (UINT)
hConv : handle to conversation (HCONV)
... | pyzos/ddeclient.py | def _callback(self, wType, uFmt, hConv, hsz1, hsz2, hDdeData, dwData1, dwData2):
"""DdeCallback callback function for processing Dynamic Data Exchange (DDE)
transactions sent by DDEML in response to DDE events
Parameters
----------
wType : transaction type (UINT)
uFmt... | def _callback(self, wType, uFmt, hConv, hsz1, hsz2, hDdeData, dwData1, dwData2):
"""DdeCallback callback function for processing Dynamic Data Exchange (DDE)
transactions sent by DDEML in response to DDE events
Parameters
----------
wType : transaction type (UINT)
uFmt... | [
"DdeCallback",
"callback",
"function",
"for",
"processing",
"Dynamic",
"Data",
"Exchange",
"(",
"DDE",
")",
"transactions",
"sent",
"by",
"DDEML",
"in",
"response",
"to",
"DDE",
"events"
] | indranilsinharoy/pyzos | python | https://github.com/indranilsinharoy/pyzos/blob/da6bf3296b0154ccee44ad9a4286055ae031ecc7/pyzos/ddeclient.py#L349-L382 | [
"def",
"_callback",
"(",
"self",
",",
"wType",
",",
"uFmt",
",",
"hConv",
",",
"hsz1",
",",
"hsz2",
",",
"hDdeData",
",",
"dwData1",
",",
"dwData2",
")",
":",
"if",
"wType",
"==",
"XTYP_ADVDATA",
":",
"# value of the data item has changed [hsz1 = topic; hsz2 = i... | da6bf3296b0154ccee44ad9a4286055ae031ecc7 |
train | YAML.parse | :param data_in: path to submission.yaml
:param args:
:param kwargs:
:raise ValueError: | hepdata_converter/parsers/yaml_parser.py | def parse(self, data_in, *args, **kwargs):
"""
:param data_in: path to submission.yaml
:param args:
:param kwargs:
:raise ValueError:
"""
if not os.path.exists(data_in):
raise ValueError("File / Directory does not exist: %s" % data_in)
if os.p... | def parse(self, data_in, *args, **kwargs):
"""
:param data_in: path to submission.yaml
:param args:
:param kwargs:
:raise ValueError:
"""
if not os.path.exists(data_in):
raise ValueError("File / Directory does not exist: %s" % data_in)
if os.p... | [
":",
"param",
"data_in",
":",
"path",
"to",
"submission",
".",
"yaml",
":",
"param",
"args",
":",
":",
"param",
"kwargs",
":",
":",
"raise",
"ValueError",
":"
] | HEPData/hepdata-converter | python | https://github.com/HEPData/hepdata-converter/blob/354271448980efba86f2f3d27b99d818e75fd90d/hepdata_converter/parsers/yaml_parser.py#L42-L109 | [
"def",
"parse",
"(",
"self",
",",
"data_in",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"data_in",
")",
":",
"raise",
"ValueError",
"(",
"\"File / Directory does not exist: %s\"",
"%",
"data_i... | 354271448980efba86f2f3d27b99d818e75fd90d |
train | generate_ai_request | generate_ai_request
:param predict_rows: list of predict rows to build into the request
:param req_dict: request dictionary to update - for long-running clients
:param req_file: file holding a request dict to update - one-off tests
:param features: features to process in the data
:param ignore_feat... | antinex_client/generate_ai_request.py | def generate_ai_request(
predict_rows,
req_dict=None,
req_file=ANTINEX_PUBLISH_REQUEST_FILE,
features=ANTINEX_FEATURES_TO_PROCESS,
ignore_features=ANTINEX_IGNORE_FEATURES,
sort_values=ANTINEX_SORT_VALUES,
ml_type=ANTINEX_ML_TYPE,
use_model_name=ANTINEX_USE... | def generate_ai_request(
predict_rows,
req_dict=None,
req_file=ANTINEX_PUBLISH_REQUEST_FILE,
features=ANTINEX_FEATURES_TO_PROCESS,
ignore_features=ANTINEX_IGNORE_FEATURES,
sort_values=ANTINEX_SORT_VALUES,
ml_type=ANTINEX_ML_TYPE,
use_model_name=ANTINEX_USE... | [
"generate_ai_request"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/generate_ai_request.py#L44-L256 | [
"def",
"generate_ai_request",
"(",
"predict_rows",
",",
"req_dict",
"=",
"None",
",",
"req_file",
"=",
"ANTINEX_PUBLISH_REQUEST_FILE",
",",
"features",
"=",
"ANTINEX_FEATURES_TO_PROCESS",
",",
"ignore_features",
"=",
"ANTINEX_IGNORE_FEATURES",
",",
"sort_values",
"=",
"... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | get_ml_job | get_ml_job
Get an ``MLJob`` by database id. | antinex_client/scripts/ai_get_job.py | def get_ml_job():
"""get_ml_job
Get an ``MLJob`` by database id.
"""
parser = argparse.ArgumentParser(
description=("Python client get AI Job by ID"))
parser.add_argument(
"-u",
help="username",
required=False,
dest="user")
parser.add_argument(
... | def get_ml_job():
"""get_ml_job
Get an ``MLJob`` by database id.
"""
parser = argparse.ArgumentParser(
description=("Python client get AI Job by ID"))
parser.add_argument(
"-u",
help="username",
required=False,
dest="user")
parser.add_argument(
... | [
"get_ml_job"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/scripts/ai_get_job.py#L20-L251 | [
"def",
"get_ml_job",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"(",
"\"Python client get AI Job by ID\"",
")",
")",
"parser",
".",
"add_argument",
"(",
"\"-u\"",
",",
"help",
"=",
"\"username\"",
",",
"required",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | get_molo_comments | Get a limited set of comments for a given object.
Defaults to a limit of 5. Setting the limit to -1 disables limiting.
Set the amount of comments to
usage:
{% get_molo_comments for object as variable_name %}
{% get_molo_comments for object as variable_name limit amount %}
{% get_mo... | molo/commenting/templatetags/molo_commenting_tags.py | def get_molo_comments(parser, token):
"""
Get a limited set of comments for a given object.
Defaults to a limit of 5. Setting the limit to -1 disables limiting.
Set the amount of comments to
usage:
{% get_molo_comments for object as variable_name %}
{% get_molo_comments for object ... | def get_molo_comments(parser, token):
"""
Get a limited set of comments for a given object.
Defaults to a limit of 5. Setting the limit to -1 disables limiting.
Set the amount of comments to
usage:
{% get_molo_comments for object as variable_name %}
{% get_molo_comments for object ... | [
"Get",
"a",
"limited",
"set",
"of",
"comments",
"for",
"a",
"given",
"object",
".",
"Defaults",
"to",
"a",
"limit",
"of",
"5",
".",
"Setting",
"the",
"limit",
"to",
"-",
"1",
"disables",
"limiting",
".",
"Set",
"the",
"amount",
"of",
"comments",
"to"
] | praekeltfoundation/molo.commenting | python | https://github.com/praekeltfoundation/molo.commenting/blob/94549bd75e4a5c5b3db43149e32d636330b3969c/molo/commenting/templatetags/molo_commenting_tags.py#L13-L48 | [
"def",
"get_molo_comments",
"(",
"parser",
",",
"token",
")",
":",
"keywords",
"=",
"token",
".",
"contents",
".",
"split",
"(",
")",
"if",
"len",
"(",
"keywords",
")",
"!=",
"5",
"and",
"len",
"(",
"keywords",
")",
"!=",
"7",
"and",
"len",
"(",
"k... | 94549bd75e4a5c5b3db43149e32d636330b3969c |
train | get_comments_content_object | Get a limited set of comments for a given object.
Defaults to a limit of 5. Setting the limit to -1 disables limiting.
usage:
{% get_comments_content_object for form_object as variable_name %} | molo/commenting/templatetags/molo_commenting_tags.py | def get_comments_content_object(parser, token):
"""
Get a limited set of comments for a given object.
Defaults to a limit of 5. Setting the limit to -1 disables limiting.
usage:
{% get_comments_content_object for form_object as variable_name %}
"""
keywords = token.contents.split()
... | def get_comments_content_object(parser, token):
"""
Get a limited set of comments for a given object.
Defaults to a limit of 5. Setting the limit to -1 disables limiting.
usage:
{% get_comments_content_object for form_object as variable_name %}
"""
keywords = token.contents.split()
... | [
"Get",
"a",
"limited",
"set",
"of",
"comments",
"for",
"a",
"given",
"object",
".",
"Defaults",
"to",
"a",
"limit",
"of",
"5",
".",
"Setting",
"the",
"limit",
"to",
"-",
"1",
"disables",
"limiting",
"."
] | praekeltfoundation/molo.commenting | python | https://github.com/praekeltfoundation/molo.commenting/blob/94549bd75e4a5c5b3db43149e32d636330b3969c/molo/commenting/templatetags/molo_commenting_tags.py#L75-L95 | [
"def",
"get_comments_content_object",
"(",
"parser",
",",
"token",
")",
":",
"keywords",
"=",
"token",
".",
"contents",
".",
"split",
"(",
")",
"if",
"len",
"(",
"keywords",
")",
"!=",
"5",
":",
"raise",
"template",
".",
"TemplateSyntaxError",
"(",
"\"'%s'... | 94549bd75e4a5c5b3db43149e32d636330b3969c |
train | report | Flags a comment on GET.
Redirects to whatever is provided in request.REQUEST['next']. | molo/commenting/views.py | def report(request, comment_id):
"""
Flags a comment on GET.
Redirects to whatever is provided in request.REQUEST['next'].
"""
comment = get_object_or_404(
django_comments.get_model(), pk=comment_id, site__pk=settings.SITE_ID)
if comment.parent is not None:
messages.info(reques... | def report(request, comment_id):
"""
Flags a comment on GET.
Redirects to whatever is provided in request.REQUEST['next'].
"""
comment = get_object_or_404(
django_comments.get_model(), pk=comment_id, site__pk=settings.SITE_ID)
if comment.parent is not None:
messages.info(reques... | [
"Flags",
"a",
"comment",
"on",
"GET",
"."
] | praekeltfoundation/molo.commenting | python | https://github.com/praekeltfoundation/molo.commenting/blob/94549bd75e4a5c5b3db43149e32d636330b3969c/molo/commenting/views.py#L21-L37 | [
"def",
"report",
"(",
"request",
",",
"comment_id",
")",
":",
"comment",
"=",
"get_object_or_404",
"(",
"django_comments",
".",
"get_model",
"(",
")",
",",
"pk",
"=",
"comment_id",
",",
"site__pk",
"=",
"settings",
".",
"SITE_ID",
")",
"if",
"comment",
"."... | 94549bd75e4a5c5b3db43149e32d636330b3969c |
train | post_molo_comment | Allows for posting of a Molo Comment, this allows comments to
be set with the "user_name" as "Anonymous" | molo/commenting/views.py | def post_molo_comment(request, next=None, using=None):
"""
Allows for posting of a Molo Comment, this allows comments to
be set with the "user_name" as "Anonymous"
"""
data = request.POST.copy()
if 'submit_anonymously' in data:
data['name'] = 'Anonymous'
# replace with our changed PO... | def post_molo_comment(request, next=None, using=None):
"""
Allows for posting of a Molo Comment, this allows comments to
be set with the "user_name" as "Anonymous"
"""
data = request.POST.copy()
if 'submit_anonymously' in data:
data['name'] = 'Anonymous'
# replace with our changed PO... | [
"Allows",
"for",
"posting",
"of",
"a",
"Molo",
"Comment",
"this",
"allows",
"comments",
"to",
"be",
"set",
"with",
"the",
"user_name",
"as",
"Anonymous"
] | praekeltfoundation/molo.commenting | python | https://github.com/praekeltfoundation/molo.commenting/blob/94549bd75e4a5c5b3db43149e32d636330b3969c/molo/commenting/views.py#L41-L55 | [
"def",
"post_molo_comment",
"(",
"request",
",",
"next",
"=",
"None",
",",
"using",
"=",
"None",
")",
":",
"data",
"=",
"request",
".",
"POST",
".",
"copy",
"(",
")",
"if",
"'submit_anonymously'",
"in",
"data",
":",
"data",
"[",
"'name'",
"]",
"=",
"... | 94549bd75e4a5c5b3db43149e32d636330b3969c |
train | build_ai_client_from_env | build_ai_client_from_env
Use environment variables to build a client
:param verbose: verbose logging
:param debug: debug internal client calls
:param ca_dir: optional path to CA bundle dir
:param cert_file: optional path to x509 ssl cert file
:param key_file: optional path to x509 ssl key file | antinex_client/build_ai_client_from_env.py | def build_ai_client_from_env(
verbose=ANTINEX_CLIENT_VERBOSE,
debug=ANTINEX_CLIENT_DEBUG,
ca_dir=None,
cert_file=None,
key_file=None):
"""build_ai_client_from_env
Use environment variables to build a client
:param verbose: verbose logging
:param debug: debug int... | def build_ai_client_from_env(
verbose=ANTINEX_CLIENT_VERBOSE,
debug=ANTINEX_CLIENT_DEBUG,
ca_dir=None,
cert_file=None,
key_file=None):
"""build_ai_client_from_env
Use environment variables to build a client
:param verbose: verbose logging
:param debug: debug int... | [
"build_ai_client_from_env"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/build_ai_client_from_env.py#L19-L78 | [
"def",
"build_ai_client_from_env",
"(",
"verbose",
"=",
"ANTINEX_CLIENT_VERBOSE",
",",
"debug",
"=",
"ANTINEX_CLIENT_DEBUG",
",",
"ca_dir",
"=",
"None",
",",
"cert_file",
"=",
"None",
",",
"key_file",
"=",
"None",
")",
":",
"if",
"not",
"ANTINEX_PUBLISH_ENABLED",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | train_new_deep_neural_network | train_new_deep_neural_network
Train a new deep neural network and store the results as a new:
``MLJob`` and ``MLJobResult`` database records. | antinex_client/scripts/ai_train_dnn.py | def train_new_deep_neural_network():
"""train_new_deep_neural_network
Train a new deep neural network and store the results as a new:
``MLJob`` and ``MLJobResult`` database records.
"""
parser = argparse.ArgumentParser(
description=(
"Python client to Train a Deep Neural Netwo... | def train_new_deep_neural_network():
"""train_new_deep_neural_network
Train a new deep neural network and store the results as a new:
``MLJob`` and ``MLJobResult`` database records.
"""
parser = argparse.ArgumentParser(
description=(
"Python client to Train a Deep Neural Netwo... | [
"train_new_deep_neural_network"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/scripts/ai_train_dnn.py#L22-L329 | [
"def",
"train_new_deep_neural_network",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"(",
"\"Python client to Train a Deep Neural Network \"",
"\"with AntiNex Django Rest Framework\"",
")",
")",
"parser",
".",
"add_argument",
"("... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | prepare_new_dataset | prepare_new_dataset
Prepare a new ``MLPrepare`` record and dataset files on disk. | antinex_client/scripts/ai_prepare_dataset.py | def prepare_new_dataset():
"""prepare_new_dataset
Prepare a new ``MLPrepare`` record and dataset files on disk.
"""
parser = argparse.ArgumentParser(
description=(
"Python client to Prepare a dataset"))
parser.add_argument(
"-u",
help="username",
requir... | def prepare_new_dataset():
"""prepare_new_dataset
Prepare a new ``MLPrepare`` record and dataset files on disk.
"""
parser = argparse.ArgumentParser(
description=(
"Python client to Prepare a dataset"))
parser.add_argument(
"-u",
help="username",
requir... | [
"prepare_new_dataset"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/scripts/ai_prepare_dataset.py#L21-L276 | [
"def",
"prepare_new_dataset",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"(",
"\"Python client to Prepare a dataset\"",
")",
")",
"parser",
".",
"add_argument",
"(",
"\"-u\"",
",",
"help",
"=",
"\"username\"",
",",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | drape | Convert a 2D feature to a 3D feature by sampling a raster
Parameters:
raster (rasterio): raster to provide the z coordinate
feature (dict): fiona feature record to convert
Returns:
result (Point or Linestring): shapely Point or LineString of xyz coordinate triples | drapery/ops/sample.py | def drape(raster, feature):
"""Convert a 2D feature to a 3D feature by sampling a raster
Parameters:
raster (rasterio): raster to provide the z coordinate
feature (dict): fiona feature record to convert
Returns:
result (Point or Linestring): shapely Point or LineString of xyz coord... | def drape(raster, feature):
"""Convert a 2D feature to a 3D feature by sampling a raster
Parameters:
raster (rasterio): raster to provide the z coordinate
feature (dict): fiona feature record to convert
Returns:
result (Point or Linestring): shapely Point or LineString of xyz coord... | [
"Convert",
"a",
"2D",
"feature",
"to",
"a",
"3D",
"feature",
"by",
"sampling",
"a",
"raster"
] | mrahnis/drapery | python | https://github.com/mrahnis/drapery/blob/c0c0906fb5ff846cf591cb9fe8a9eaee68e8820c/drapery/ops/sample.py#L6-L30 | [
"def",
"drape",
"(",
"raster",
",",
"feature",
")",
":",
"coords",
"=",
"feature",
"[",
"'geometry'",
"]",
"[",
"'coordinates'",
"]",
"geom_type",
"=",
"feature",
"[",
"'geometry'",
"]",
"[",
"'type'",
"]",
"if",
"geom_type",
"==",
"'Point'",
":",
"xyz",... | c0c0906fb5ff846cf591cb9fe8a9eaee68e8820c |
train | sample | Sample a raster at given coordinates
Given a list of coordinates, return a list of x,y,z triples with z coordinates sampled from an input raster
Parameters:
raster (rasterio): raster dataset to sample
coords: array of tuples containing coordinate pairs (x,y) or triples (x,y,z)
Returns:
... | drapery/ops/sample.py | def sample(raster, coords):
"""Sample a raster at given coordinates
Given a list of coordinates, return a list of x,y,z triples with z coordinates sampled from an input raster
Parameters:
raster (rasterio): raster dataset to sample
coords: array of tuples containing coordinate pairs (x,y) ... | def sample(raster, coords):
"""Sample a raster at given coordinates
Given a list of coordinates, return a list of x,y,z triples with z coordinates sampled from an input raster
Parameters:
raster (rasterio): raster dataset to sample
coords: array of tuples containing coordinate pairs (x,y) ... | [
"Sample",
"a",
"raster",
"at",
"given",
"coordinates"
] | mrahnis/drapery | python | https://github.com/mrahnis/drapery/blob/c0c0906fb5ff846cf591cb9fe8a9eaee68e8820c/drapery/ops/sample.py#L32-L53 | [
"def",
"sample",
"(",
"raster",
",",
"coords",
")",
":",
"if",
"len",
"(",
"coords",
"[",
"0",
"]",
")",
"==",
"3",
":",
"logging",
".",
"info",
"(",
"'Input is a 3D geometry, z coordinate will be updated.'",
")",
"z",
"=",
"raster",
".",
"sample",
"(",
... | c0c0906fb5ff846cf591cb9fe8a9eaee68e8820c |
train | setup_logging | setup_logging
Setup logging configuration
:param default_level: level to log
:param default_path: path to config (optional)
:param env_key: path to config in this env var
:param config_name: filename for config | antinex_client/log/setup_logging.py | def setup_logging(
default_level=logging.INFO,
default_path="{}/logging.json".format(
os.getenv(
"LOG_DIR",
os.path.dirname(os.path.realpath(__file__)))),
env_key="LOG_CFG",
config_name=None):
"""setup_logging
Setup logging configurati... | def setup_logging(
default_level=logging.INFO,
default_path="{}/logging.json".format(
os.getenv(
"LOG_DIR",
os.path.dirname(os.path.realpath(__file__)))),
env_key="LOG_CFG",
config_name=None):
"""setup_logging
Setup logging configurati... | [
"setup_logging"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/log/setup_logging.py#L6-L59 | [
"def",
"setup_logging",
"(",
"default_level",
"=",
"logging",
".",
"INFO",
",",
"default_path",
"=",
"\"{}/logging.json\"",
".",
"format",
"(",
"os",
".",
"getenv",
"(",
"\"LOG_DIR\"",
",",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | build_logger | build_logger
:param name: name that shows in the logger
:param config: name of the config file
:param log_level: level to log
:param log_config_path: path to log config file | antinex_client/log/setup_logging.py | def build_logger(
name=os.getenv(
"LOG_NAME",
"client"),
config="logging.json",
log_level=logging.INFO,
log_config_path="{}/logging.json".format(
os.getenv(
"LOG_CFG",
os.path.dirname(os.path.realpath(__file__))))):
"""build_logger
:param name: na... | def build_logger(
name=os.getenv(
"LOG_NAME",
"client"),
config="logging.json",
log_level=logging.INFO,
log_config_path="{}/logging.json".format(
os.getenv(
"LOG_CFG",
os.path.dirname(os.path.realpath(__file__))))):
"""build_logger
:param name: na... | [
"build_logger"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/log/setup_logging.py#L63-L94 | [
"def",
"build_logger",
"(",
"name",
"=",
"os",
".",
"getenv",
"(",
"\"LOG_NAME\"",
",",
"\"client\"",
")",
",",
"config",
"=",
"\"logging.json\"",
",",
"log_level",
"=",
"logging",
".",
"INFO",
",",
"log_config_path",
"=",
"\"{}/logging.json\"",
".",
"format",... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | build_colorized_logger | build_colorized_logger
:param name: name that shows in the logger
:param config: name of the config file
:param log_level: level to log
:param log_config_path: path to log config file | antinex_client/log/setup_logging.py | def build_colorized_logger(
name=os.getenv(
"LOG_NAME",
"client"),
config="colors-logging.json",
log_level=logging.INFO,
log_config_path="{}/logging.json".format(
os.getenv(
"LOG_CFG",
os.path.dirname(os.path.realpath(__file__))))):
"""build_colorized_... | def build_colorized_logger(
name=os.getenv(
"LOG_NAME",
"client"),
config="colors-logging.json",
log_level=logging.INFO,
log_config_path="{}/logging.json".format(
os.getenv(
"LOG_CFG",
os.path.dirname(os.path.realpath(__file__))))):
"""build_colorized_... | [
"build_colorized_logger"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/log/setup_logging.py#L98-L169 | [
"def",
"build_colorized_logger",
"(",
"name",
"=",
"os",
".",
"getenv",
"(",
"\"LOG_NAME\"",
",",
"\"client\"",
")",
",",
"config",
"=",
"\"colors-logging.json\"",
",",
"log_level",
"=",
"logging",
".",
"INFO",
",",
"log_config_path",
"=",
"\"{}/logging.json\"",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | BaseAuthService.authenticate | Your AuhtService should override this method for request authentication, otherwise means no authentication.
:param request: HttpRequest Django's HttpRequest object
:param auth_route: str User's resqueted route
:param actual_params: User's url parameters
:return: bool | rinzler/auth/base_auth_service.py | def authenticate(self, request: HttpRequest, auth_route: str, actual_params: dict) -> bool:
"""
Your AuhtService should override this method for request authentication, otherwise means no authentication.
:param request: HttpRequest Django's HttpRequest object
:param auth_route: str User'... | def authenticate(self, request: HttpRequest, auth_route: str, actual_params: dict) -> bool:
"""
Your AuhtService should override this method for request authentication, otherwise means no authentication.
:param request: HttpRequest Django's HttpRequest object
:param auth_route: str User'... | [
"Your",
"AuhtService",
"should",
"override",
"this",
"method",
"for",
"request",
"authentication",
"otherwise",
"means",
"no",
"authentication",
".",
":",
"param",
"request",
":",
"HttpRequest",
"Django",
"s",
"HttpRequest",
"object",
":",
"param",
"auth_route",
"... | feliphebueno/Rinzler | python | https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/auth/base_auth_service.py#L13-L23 | [
"def",
"authenticate",
"(",
"self",
",",
"request",
":",
"HttpRequest",
",",
"auth_route",
":",
"str",
",",
"actual_params",
":",
"dict",
")",
"->",
"bool",
":",
"if",
"auth_route",
"and",
"actual_params",
":",
"self",
".",
"auth_data",
"=",
"{",
"}",
"r... | 7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8 |
train | cli | Converts 2D geometries to 3D using GEOS sample through fiona.
\b
Example:
drape point.shp elevation.tif -o point_z.shp | drapery/cli/drape.py | def cli(source_f, raster_f, output, verbose):
"""
Converts 2D geometries to 3D using GEOS sample through fiona.
\b
Example:
drape point.shp elevation.tif -o point_z.shp
"""
with fiona.open(source_f, 'r') as source:
source_driver = source.driver
source_crs = source.crs
... | def cli(source_f, raster_f, output, verbose):
"""
Converts 2D geometries to 3D using GEOS sample through fiona.
\b
Example:
drape point.shp elevation.tif -o point_z.shp
"""
with fiona.open(source_f, 'r') as source:
source_driver = source.driver
source_crs = source.crs
... | [
"Converts",
"2D",
"geometries",
"to",
"3D",
"using",
"GEOS",
"sample",
"through",
"fiona",
"."
] | mrahnis/drapery | python | https://github.com/mrahnis/drapery/blob/c0c0906fb5ff846cf591cb9fe8a9eaee68e8820c/drapery/cli/drape.py#L21-L67 | [
"def",
"cli",
"(",
"source_f",
",",
"raster_f",
",",
"output",
",",
"verbose",
")",
":",
"with",
"fiona",
".",
"open",
"(",
"source_f",
",",
"'r'",
")",
"as",
"source",
":",
"source_driver",
"=",
"source",
".",
"driver",
"source_crs",
"=",
"source",
".... | c0c0906fb5ff846cf591cb9fe8a9eaee68e8820c |
train | MoloCommentManager.for_model | QuerySet for all comments for a particular model (either an instance or
a class). | molo/commenting/managers.py | def for_model(self, model):
"""
QuerySet for all comments for a particular model (either an instance or
a class).
"""
ct = ContentType.objects.get_for_model(model)
qs = self.get_queryset().filter(content_type=ct)
if isinstance(model, models.Model):
qs ... | def for_model(self, model):
"""
QuerySet for all comments for a particular model (either an instance or
a class).
"""
ct = ContentType.objects.get_for_model(model)
qs = self.get_queryset().filter(content_type=ct)
if isinstance(model, models.Model):
qs ... | [
"QuerySet",
"for",
"all",
"comments",
"for",
"a",
"particular",
"model",
"(",
"either",
"an",
"instance",
"or",
"a",
"class",
")",
"."
] | praekeltfoundation/molo.commenting | python | https://github.com/praekeltfoundation/molo.commenting/blob/94549bd75e4a5c5b3db43149e32d636330b3969c/molo/commenting/managers.py#L9-L18 | [
"def",
"for_model",
"(",
"self",
",",
"model",
")",
":",
"ct",
"=",
"ContentType",
".",
"objects",
".",
"get_for_model",
"(",
"model",
")",
"qs",
"=",
"self",
".",
"get_queryset",
"(",
")",
".",
"filter",
"(",
"content_type",
"=",
"ct",
")",
"if",
"i... | 94549bd75e4a5c5b3db43149e32d636330b3969c |
train | RemotePage.eval | Blocking call, returns the value of the execution in JS | skink/remote.py | def eval(self, command):
'Blocking call, returns the value of the execution in JS'
event = threading.Event()
# TODO: Add event to server
#job_id = str(id(command))
import random
job_id = str(random.random())
server.EVALUATIONS[job_id] = event
message = '?... | def eval(self, command):
'Blocking call, returns the value of the execution in JS'
event = threading.Event()
# TODO: Add event to server
#job_id = str(id(command))
import random
job_id = str(random.random())
server.EVALUATIONS[job_id] = event
message = '?... | [
"Blocking",
"call",
"returns",
"the",
"value",
"of",
"the",
"execution",
"in",
"JS"
] | oksome/Skink | python | https://github.com/oksome/Skink/blob/77560fb92749c1a21924cbd0017b8481a727be3e/skink/remote.py#L132-L158 | [
"def",
"eval",
"(",
"self",
",",
"command",
")",
":",
"event",
"=",
"threading",
".",
"Event",
"(",
")",
"# TODO: Add event to server",
"#job_id = str(id(command))",
"import",
"random",
"job_id",
"=",
"str",
"(",
"random",
".",
"random",
"(",
")",
")",
"serv... | 77560fb92749c1a21924cbd0017b8481a727be3e |
train | RemotePage.register | Register a callback on server and on connected clients. | skink/remote.py | def register(self, callback, name):
'Register a callback on server and on connected clients.'
server.CALLBACKS[name] = callback
self.run('''
window.skink.%s = function(args=[]) {
window.skink.call("%s", args);
}''' % (name, name)) | def register(self, callback, name):
'Register a callback on server and on connected clients.'
server.CALLBACKS[name] = callback
self.run('''
window.skink.%s = function(args=[]) {
window.skink.call("%s", args);
}''' % (name, name)) | [
"Register",
"a",
"callback",
"on",
"server",
"and",
"on",
"connected",
"clients",
"."
] | oksome/Skink | python | https://github.com/oksome/Skink/blob/77560fb92749c1a21924cbd0017b8481a727be3e/skink/remote.py#L160-L166 | [
"def",
"register",
"(",
"self",
",",
"callback",
",",
"name",
")",
":",
"server",
".",
"CALLBACKS",
"[",
"name",
"]",
"=",
"callback",
"self",
".",
"run",
"(",
"'''\n window.skink.%s = function(args=[]) {\n window.skink.call(\"%s\", args);\n ... | 77560fb92749c1a21924cbd0017b8481a727be3e |
train | launch_exception | Launch a Python exception from an error that took place in the browser.
messsage format:
- name: str
- description: str | skink/server.py | def launch_exception(message):
"""
Launch a Python exception from an error that took place in the browser.
messsage format:
- name: str
- description: str
"""
error_name = message['name']
error_descr = message['description']
mapping = {
'ReferenceError': Name... | def launch_exception(message):
"""
Launch a Python exception from an error that took place in the browser.
messsage format:
- name: str
- description: str
"""
error_name = message['name']
error_descr = message['description']
mapping = {
'ReferenceError': Name... | [
"Launch",
"a",
"Python",
"exception",
"from",
"an",
"error",
"that",
"took",
"place",
"in",
"the",
"browser",
"."
] | oksome/Skink | python | https://github.com/oksome/Skink/blob/77560fb92749c1a21924cbd0017b8481a727be3e/skink/server.py#L42-L58 | [
"def",
"launch_exception",
"(",
"message",
")",
":",
"error_name",
"=",
"message",
"[",
"'name'",
"]",
"error_descr",
"=",
"message",
"[",
"'description'",
"]",
"mapping",
"=",
"{",
"'ReferenceError'",
":",
"NameError",
",",
"}",
"if",
"message",
"[",
"'name... | 77560fb92749c1a21924cbd0017b8481a727be3e |
train | start_predictions | start_predictions
Using environment variables, create an AntiNex AI Client.
You can also use command line args if you want.
This can train a new deep neural network if it does not
exist or it can use an existing pre-trained deep neural
network within the AntiNex Core to make new predictions. | antinex_client/scripts/ai_env_predict.py | def start_predictions():
"""start_predictions
Using environment variables, create an AntiNex AI Client.
You can also use command line args if you want.
This can train a new deep neural network if it does not
exist or it can use an existing pre-trained deep neural
network within the AntiNex Cor... | def start_predictions():
"""start_predictions
Using environment variables, create an AntiNex AI Client.
You can also use command line args if you want.
This can train a new deep neural network if it does not
exist or it can use an existing pre-trained deep neural
network within the AntiNex Cor... | [
"start_predictions"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/scripts/ai_env_predict.py#L23-L288 | [
"def",
"start_predictions",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"(",
"\"Python client to make Predictions \"",
"\"using a Pre-trained Deep Neural Network \"",
"\"with AntiNex Django Rest Framework\"",
")",
")",
"parser",
"... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | AIClient.login | login | antinex_client/ai_client.py | def login(
self):
"""login"""
auth_url = self.api_urls["login"]
if self.verbose:
log.info(("log in user={} url={} ca_dir={} cert={}")
.format(
self.user,
auth_url,
self.ca_dir,
... | def login(
self):
"""login"""
auth_url = self.api_urls["login"]
if self.verbose:
log.info(("log in user={} url={} ca_dir={} cert={}")
.format(
self.user,
auth_url,
self.ca_dir,
... | [
"login"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/ai_client.py#L121-L186 | [
"def",
"login",
"(",
"self",
")",
":",
"auth_url",
"=",
"self",
".",
"api_urls",
"[",
"\"login\"",
"]",
"if",
"self",
".",
"verbose",
":",
"log",
".",
"info",
"(",
"(",
"\"log in user={} url={} ca_dir={} cert={}\"",
")",
".",
"format",
"(",
"self",
".",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | AIClient.build_response | build_response
:param status: status code
:param error: error message
:param data: dictionary to send back | antinex_client/ai_client.py | def build_response(
self,
status=NOT_SET,
error="",
data=None):
"""build_response
:param status: status code
:param error: error message
:param data: dictionary to send back
"""
res_node = {
"status": status,
... | def build_response(
self,
status=NOT_SET,
error="",
data=None):
"""build_response
:param status: status code
:param error: error message
:param data: dictionary to send back
"""
res_node = {
"status": status,
... | [
"build_response"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/ai_client.py#L211-L228 | [
"def",
"build_response",
"(",
"self",
",",
"status",
"=",
"NOT_SET",
",",
"error",
"=",
"\"\"",
",",
"data",
"=",
"None",
")",
":",
"res_node",
"=",
"{",
"\"status\"",
":",
"status",
",",
"\"error\"",
":",
"error",
",",
"\"data\"",
":",
"data",
"}",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | AIClient.retry_login | retry_login | antinex_client/ai_client.py | def retry_login(
self):
"""retry_login"""
if not self.user or not self.password:
return self.build_response(
status=ERROR,
error="please set the user and password")
retry = 0
not_done = True
while not_done:
if ... | def retry_login(
self):
"""retry_login"""
if not self.user or not self.password:
return self.build_response(
status=ERROR,
error="please set the user and password")
retry = 0
not_done = True
while not_done:
if ... | [
"retry_login"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/ai_client.py#L231-L273 | [
"def",
"retry_login",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"user",
"or",
"not",
"self",
".",
"password",
":",
"return",
"self",
".",
"build_response",
"(",
"status",
"=",
"ERROR",
",",
"error",
"=",
"\"please set the user and password\"",
")",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | AIClient.get_prepare_by_id | get_prepare_by_id
:param prepare_id: MLJob.id in the database | antinex_client/ai_client.py | def get_prepare_by_id(
self,
prepare_id=None):
"""get_prepare_by_id
:param prepare_id: MLJob.id in the database
"""
if not prepare_id:
log.error("missing prepare_id for get_prepare_by_id")
return self.build_response(
statu... | def get_prepare_by_id(
self,
prepare_id=None):
"""get_prepare_by_id
:param prepare_id: MLJob.id in the database
"""
if not prepare_id:
log.error("missing prepare_id for get_prepare_by_id")
return self.build_response(
statu... | [
"get_prepare_by_id"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/ai_client.py#L276-L377 | [
"def",
"get_prepare_by_id",
"(",
"self",
",",
"prepare_id",
"=",
"None",
")",
":",
"if",
"not",
"prepare_id",
":",
"log",
".",
"error",
"(",
"\"missing prepare_id for get_prepare_by_id\"",
")",
"return",
"self",
".",
"build_response",
"(",
"status",
"=",
"ERROR"... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | AIClient.wait_for_job_to_finish | wait_for_job_to_finish
:param job_id: MLJob.id to wait on
:param sec_to_sleep: seconds to sleep during polling
:param max_retries: max retires until stopping | antinex_client/ai_client.py | def wait_for_job_to_finish(
self,
job_id,
sec_to_sleep=5.0,
max_retries=100000):
"""wait_for_job_to_finish
:param job_id: MLJob.id to wait on
:param sec_to_sleep: seconds to sleep during polling
:param max_retries: max retires until stoppi... | def wait_for_job_to_finish(
self,
job_id,
sec_to_sleep=5.0,
max_retries=100000):
"""wait_for_job_to_finish
:param job_id: MLJob.id to wait on
:param sec_to_sleep: seconds to sleep during polling
:param max_retries: max retires until stoppi... | [
"wait_for_job_to_finish"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/ai_client.py#L726-L870 | [
"def",
"wait_for_job_to_finish",
"(",
"self",
",",
"job_id",
",",
"sec_to_sleep",
"=",
"5.0",
",",
"max_retries",
"=",
"100000",
")",
":",
"not_done",
"=",
"True",
"retry_attempt",
"=",
"1",
"while",
"not_done",
":",
"if",
"self",
".",
"debug",
":",
"log",... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | AIClient.wait_for_prepare_to_finish | wait_for_prepare_to_finish
:param prepare_id: MLPrepare.id to wait on
:param sec_to_sleep: seconds to sleep during polling
:param max_retries: max retires until stopping | antinex_client/ai_client.py | def wait_for_prepare_to_finish(
self,
prepare_id,
sec_to_sleep=5.0,
max_retries=100000):
"""wait_for_prepare_to_finish
:param prepare_id: MLPrepare.id to wait on
:param sec_to_sleep: seconds to sleep during polling
:param max_retries: max ... | def wait_for_prepare_to_finish(
self,
prepare_id,
sec_to_sleep=5.0,
max_retries=100000):
"""wait_for_prepare_to_finish
:param prepare_id: MLPrepare.id to wait on
:param sec_to_sleep: seconds to sleep during polling
:param max_retries: max ... | [
"wait_for_prepare_to_finish"
] | jay-johnson/antinex-client | python | https://github.com/jay-johnson/antinex-client/blob/850ba2a2fe21c836e071def618dcecc9caf5d59c/antinex_client/ai_client.py#L985-L1065 | [
"def",
"wait_for_prepare_to_finish",
"(",
"self",
",",
"prepare_id",
",",
"sec_to_sleep",
"=",
"5.0",
",",
"max_retries",
"=",
"100000",
")",
":",
"not_done",
"=",
"True",
"retry_attempt",
"=",
"1",
"while",
"not_done",
":",
"if",
"self",
".",
"debug",
":",
... | 850ba2a2fe21c836e071def618dcecc9caf5d59c |
train | MoloCommentForm.get_comment_object | NB: Overridden to remove dupe comment check for admins (necessary for
canned responses)
Return a new (unsaved) comment object based on the information in this
form. Assumes that the form is already validated and will throw a
ValueError if not.
Does not set any of the fields tha... | molo/commenting/forms.py | def get_comment_object(self):
"""
NB: Overridden to remove dupe comment check for admins (necessary for
canned responses)
Return a new (unsaved) comment object based on the information in this
form. Assumes that the form is already validated and will throw a
ValueError i... | def get_comment_object(self):
"""
NB: Overridden to remove dupe comment check for admins (necessary for
canned responses)
Return a new (unsaved) comment object based on the information in this
form. Assumes that the form is already validated and will throw a
ValueError i... | [
"NB",
":",
"Overridden",
"to",
"remove",
"dupe",
"comment",
"check",
"for",
"admins",
"(",
"necessary",
"for",
"canned",
"responses",
")"
] | praekeltfoundation/molo.commenting | python | https://github.com/praekeltfoundation/molo.commenting/blob/94549bd75e4a5c5b3db43149e32d636330b3969c/molo/commenting/forms.py#L31-L59 | [
"def",
"get_comment_object",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_valid",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"get_comment_object may only be called on valid forms\"",
")",
"CommentModel",
"=",
"self",
".",
"get_comment_model",
"(",
")",
"... | 94549bd75e4a5c5b3db43149e32d636330b3969c |
train | boot | Start Rinzler App
:param app_name: str Application's identifier
:return: dict | rinzler/__init__.py | def boot(app_name) -> Rinzler:
"""
Start Rinzler App
:param app_name: str Application's identifier
:return: dict
"""
app = Rinzler(app_name)
app.log.info("App booted =)")
return app | def boot(app_name) -> Rinzler:
"""
Start Rinzler App
:param app_name: str Application's identifier
:return: dict
"""
app = Rinzler(app_name)
app.log.info("App booted =)")
return app | [
"Start",
"Rinzler",
"App",
":",
"param",
"app_name",
":",
"str",
"Application",
"s",
"identifier",
":",
"return",
":",
"dict"
] | feliphebueno/Rinzler | python | https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L391-L400 | [
"def",
"boot",
"(",
"app_name",
")",
"->",
"Rinzler",
":",
"app",
"=",
"Rinzler",
"(",
"app_name",
")",
"app",
".",
"log",
".",
"info",
"(",
"\"App booted =)\"",
")",
"return",
"app"
] | 7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8 |
train | Rinzler.mount | Maps a route namespace with the given params and point it's requests to the especified controller.
:param route: str Namespace route to be mapped
:param controller: callback Controller callable to map end-points
:rtype: url | rinzler/__init__.py | def mount(self, route: str, controller: callable) -> url:
"""
Maps a route namespace with the given params and point it's requests to the especified controller.
:param route: str Namespace route to be mapped
:param controller: callback Controller callable to map end-points
:rtype... | def mount(self, route: str, controller: callable) -> url:
"""
Maps a route namespace with the given params and point it's requests to the especified controller.
:param route: str Namespace route to be mapped
:param controller: callback Controller callable to map end-points
:rtype... | [
"Maps",
"a",
"route",
"namespace",
"with",
"the",
"given",
"params",
"and",
"point",
"it",
"s",
"requests",
"to",
"the",
"especified",
"controller",
".",
":",
"param",
"route",
":",
"str",
"Namespace",
"route",
"to",
"be",
"mapped",
":",
"param",
"controll... | feliphebueno/Rinzler | python | https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L52-L68 | [
"def",
"mount",
"(",
"self",
",",
"route",
":",
"str",
",",
"controller",
":",
"callable",
")",
"->",
"url",
":",
"if",
"issubclass",
"(",
"controller",
",",
"TemplateView",
")",
":",
"return",
"url",
"(",
"r\"%s\"",
"%",
"route",
",",
"Router",
"(",
... | 7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8 |
train | Rinzler.set_auth_service | Sets the authentication service
:param auth_service: BaseAuthService Authentication service
:raises: TypeError If the auth_service object is not a subclass of rinzler.auth.BaseAuthService
:rtype: Rinzler | rinzler/__init__.py | def set_auth_service(self, auth_service: BaseAuthService):
"""
Sets the authentication service
:param auth_service: BaseAuthService Authentication service
:raises: TypeError If the auth_service object is not a subclass of rinzler.auth.BaseAuthService
:rtype: Rinzler
"""
... | def set_auth_service(self, auth_service: BaseAuthService):
"""
Sets the authentication service
:param auth_service: BaseAuthService Authentication service
:raises: TypeError If the auth_service object is not a subclass of rinzler.auth.BaseAuthService
:rtype: Rinzler
"""
... | [
"Sets",
"the",
"authentication",
"service",
":",
"param",
"auth_service",
":",
"BaseAuthService",
"Authentication",
"service",
":",
"raises",
":",
"TypeError",
"If",
"the",
"auth_service",
"object",
"is",
"not",
"a",
"subclass",
"of",
"rinzler",
".",
"auth",
"."... | feliphebueno/Rinzler | python | https://github.com/feliphebueno/Rinzler/blob/7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8/rinzler/__init__.py#L88-L99 | [
"def",
"set_auth_service",
"(",
"self",
",",
"auth_service",
":",
"BaseAuthService",
")",
":",
"if",
"issubclass",
"(",
"auth_service",
".",
"__class__",
",",
"BaseAuthService",
")",
":",
"self",
".",
"auth_service",
"=",
"auth_service",
"return",
"self",
"else"... | 7f6d5445b5662cba2e8938bb82c7f3ef94e5ded8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.