nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
honeynet/droidbot
2c7a66bda17c4cc33b4b4d9c98f27f822a81a6bd
droidbot/input_policy.py
python
InputPolicy.start
(self, input_manager)
start producing events :param input_manager: instance of InputManager
start producing events :param input_manager: instance of InputManager
[ "start", "producing", "events", ":", "param", "input_manager", ":", "instance", "of", "InputManager" ]
def start(self, input_manager): """ start producing events :param input_manager: instance of InputManager """ self.action_count = 0 while input_manager.enabled and self.action_count < input_manager.event_count: try: # # make sure the first even...
[ "def", "start", "(", "self", ",", "input_manager", ")", ":", "self", ".", "action_count", "=", "0", "while", "input_manager", ".", "enabled", "and", "self", ".", "action_count", "<", "input_manager", ".", "event_count", ":", "try", ":", "# # make sure the firs...
https://github.com/honeynet/droidbot/blob/2c7a66bda17c4cc33b4b4d9c98f27f822a81a6bd/droidbot/input_policy.py#L55-L87
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/core/utils.py
python
set_namedtuple_defaults
(namedtuple, default=None)
return namedtuple
Set *all* of the fields for a given nametuple to a singular value. Additionally removes the default docstring for each field. Modifies the tuple in place, but returns it anyway. More info: https://stackoverflow.com/a/18348004 :param namedtuple: A constructed collections.namedtuple :param defa...
Set *all* of the fields for a given nametuple to a singular value.
[ "Set", "*", "all", "*", "of", "the", "fields", "for", "a", "given", "nametuple", "to", "a", "singular", "value", "." ]
def set_namedtuple_defaults(namedtuple, default=None): """ Set *all* of the fields for a given nametuple to a singular value. Additionally removes the default docstring for each field. Modifies the tuple in place, but returns it anyway. More info: https://stackoverflow.com/a/18348004 :par...
[ "def", "set_namedtuple_defaults", "(", "namedtuple", ",", "default", "=", "None", ")", ":", "namedtuple", ".", "__new__", ".", "__defaults__", "=", "(", "default", ",", ")", "*", "len", "(", "namedtuple", ".", "_fields", ")", "for", "f", "in", "namedtuple"...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/core/utils.py#L1073-L1091
PaddlePaddle/PGL
e48545f2814523c777b8a9a9188bf5a7f00d6e52
pgl/utils/stream_pool.py
python
async_read
(src, dst, index, cpu_buffer, offset, count)
This api provides a way to read from pieces of source tensor to destination tensor asynchronously. In which, we use `index`, `offset` and `count` to determine where to read. `index` means the index position of src tensor we want to read. `offset` and `count` means the begin points and length of pieces of...
This api provides a way to read from pieces of source tensor to destination tensor asynchronously. In which, we use `index`, `offset` and `count` to determine where to read. `index` means the index position of src tensor we want to read. `offset` and `count` means the begin points and length of pieces of...
[ "This", "api", "provides", "a", "way", "to", "read", "from", "pieces", "of", "source", "tensor", "to", "destination", "tensor", "asynchronously", ".", "In", "which", "we", "use", "index", "offset", "and", "count", "to", "determine", "where", "to", "read", ...
def async_read(src, dst, index, cpu_buffer, offset, count): """This api provides a way to read from pieces of source tensor to destination tensor asynchronously. In which, we use `index`, `offset` and `count` to determine where to read. `index` means the index position of src tensor we want to read. `offs...
[ "def", "async_read", "(", "src", ",", "dst", ",", "index", ",", "cpu_buffer", ",", "offset", ",", "count", ")", ":", "core", ".", "async_read", "(", "src", ",", "dst", ",", "index", ",", "cpu_buffer", ",", "offset", ",", "count", ")" ]
https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/pgl/utils/stream_pool.py#L131-L186
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/cmds.py
python
ResetMode.do
(self)
[]
def do(self): super(ResetMode, self).do() self.model.update_file_status()
[ "def", "do", "(", "self", ")", ":", "super", "(", "ResetMode", ",", "self", ")", ".", "do", "(", ")", "self", ".", "model", ".", "update_file_status", "(", ")" ]
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/cmds.py#L469-L471
quantumlib/OpenFermion-Cirq
655b00fee21c94cc96c343c63f7c52ea1aa329dc
openfermioncirq/optimization/algorithm.py
python
OptimizationAlgorithm.name
(self)
return type(self).__name__
A name for the optimization algorithm.
A name for the optimization algorithm.
[ "A", "name", "for", "the", "optimization", "algorithm", "." ]
def name(self) -> str: """A name for the optimization algorithm.""" return type(self).__name__
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "type", "(", "self", ")", ".", "__name__" ]
https://github.com/quantumlib/OpenFermion-Cirq/blob/655b00fee21c94cc96c343c63f7c52ea1aa329dc/openfermioncirq/optimization/algorithm.py#L73-L75
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/template/defaulttags.py
python
CycleNode.render
(self, context)
return render_value_in_context(value, context)
[]
def render(self, context): if self not in context.render_context: # First time the node is rendered in template context.render_context[self] = itertools_cycle(self.cyclevars) cycle_iter = context.render_context[self] value = next(cycle_iter).resolve(context) if se...
[ "def", "render", "(", "self", ",", "context", ")", ":", "if", "self", "not", "in", "context", ".", "render_context", ":", "# First time the node is rendered in template", "context", ".", "render_context", "[", "self", "]", "=", "itertools_cycle", "(", "self", "....
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/template/defaulttags.py#L78-L88
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.2/django/contrib/localflavor/se/utils.py
python
id_number_checksum
(gd)
return (((s / 10) + 1) * 10) - s
Calculates a Swedish ID number checksum, using the "Luhn"-algoritm
Calculates a Swedish ID number checksum, using the "Luhn"-algoritm
[ "Calculates", "a", "Swedish", "ID", "number", "checksum", "using", "the", "Luhn", "-", "algoritm" ]
def id_number_checksum(gd): """ Calculates a Swedish ID number checksum, using the "Luhn"-algoritm """ n = s = 0 for c in (gd['year'] + gd['month'] + gd['day'] + gd['serial']): tmp = ((n % 2) and 1 or 2) * int(c) if tmp > 9: tmp = sum([int(i) for i in str(tmp)]) ...
[ "def", "id_number_checksum", "(", "gd", ")", ":", "n", "=", "s", "=", "0", "for", "c", "in", "(", "gd", "[", "'year'", "]", "+", "gd", "[", "'month'", "]", "+", "gd", "[", "'day'", "]", "+", "gd", "[", "'serial'", "]", ")", ":", "tmp", "=", ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/contrib/localflavor/se/utils.py#L4-L22
uqfoundation/multiprocess
028cc73f02655e6451d92e5147d19d8c10aebe50
py3.10/multiprocess/connection.py
python
arbitrary_address
(family)
Return an arbitrary free address for the given family
Return an arbitrary free address for the given family
[ "Return", "an", "arbitrary", "free", "address", "for", "the", "given", "family" ]
def arbitrary_address(family): ''' Return an arbitrary free address for the given family ''' if family == 'AF_INET': return ('localhost', 0) elif family == 'AF_UNIX': # Prefer abstract sockets if possible to avoid problems with the address # size. When coding portable applic...
[ "def", "arbitrary_address", "(", "family", ")", ":", "if", "family", "==", "'AF_INET'", ":", "return", "(", "'localhost'", ",", "0", ")", "elif", "family", "==", "'AF_UNIX'", ":", "# Prefer abstract sockets if possible to avoid problems with the address", "# size. When...
https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.10/multiprocess/connection.py#L72-L89
akkana/scripts
bb59210acd3cef9a7eaccf5e082feff9d2b1b97d
astro/epicycles.py
python
EclipticPoleWindow.planet_segment
(self, ctx, ra, dist, drawp)
Draw (if drawp) or move to the appropriate place on the screen for the given ra and dist coordinates.
Draw (if drawp) or move to the appropriate place on the screen for the given ra and dist coordinates.
[ "Draw", "(", "if", "drawp", ")", "or", "move", "to", "the", "appropriate", "place", "on", "the", "screen", "for", "the", "given", "ra", "and", "dist", "coordinates", "." ]
def planet_segment(self, ctx, ra, dist, drawp): """Draw (if drawp) or move to the appropriate place on the screen for the given ra and dist coordinates. """ x = dist * self.dist_scale * math.cos(ra) + self.halfwidth y = dist * self.dist_scale * math.sin(ra) + self.halfheight ...
[ "def", "planet_segment", "(", "self", ",", "ctx", ",", "ra", ",", "dist", ",", "drawp", ")", ":", "x", "=", "dist", "*", "self", ".", "dist_scale", "*", "math", ".", "cos", "(", "ra", ")", "+", "self", ".", "halfwidth", "y", "=", "dist", "*", "...
https://github.com/akkana/scripts/blob/bb59210acd3cef9a7eaccf5e082feff9d2b1b97d/astro/epicycles.py#L155-L164
tensorflow/addons
37a368adfea1d0ec4cb85998946f458e9d565818
tensorflow_addons/seq2seq/beam_search_decoder.py
python
BeamSearchDecoderMixin._maybe_split_batch_beams
(self, t, s)
Maybe splits the tensor from a batch by beams into a batch of beams. We do this so that we can use nest and not run into problems with shapes. Args: t: `Tensor`, either scalar or shaped `[batch_size * beam_width] + s`. s: `Tensor`, Python int, or `TensorShape`. Ret...
Maybe splits the tensor from a batch by beams into a batch of beams.
[ "Maybe", "splits", "the", "tensor", "from", "a", "batch", "by", "beams", "into", "a", "batch", "of", "beams", "." ]
def _maybe_split_batch_beams(self, t, s): """Maybe splits the tensor from a batch by beams into a batch of beams. We do this so that we can use nest and not run into problems with shapes. Args: t: `Tensor`, either scalar or shaped `[batch_size * beam_width] + s`. s:...
[ "def", "_maybe_split_batch_beams", "(", "self", ",", "t", ",", "s", ")", ":", "if", "isinstance", "(", "t", ",", "tf", ".", "TensorArray", ")", ":", "return", "t", "_check_ndims", "(", "t", ")", "if", "t", ".", "shape", ".", "ndims", ">=", "1", ":"...
https://github.com/tensorflow/addons/blob/37a368adfea1d0ec4cb85998946f458e9d565818/tensorflow_addons/seq2seq/beam_search_decoder.py#L588-L612
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/process_group_status_dto.py
python
ProcessGroupStatusDTO.aggregate_snapshot
(self)
return self._aggregate_snapshot
Gets the aggregate_snapshot of this ProcessGroupStatusDTO. The aggregate status of all nodes in the cluster :return: The aggregate_snapshot of this ProcessGroupStatusDTO. :rtype: ProcessGroupStatusSnapshotDTO
Gets the aggregate_snapshot of this ProcessGroupStatusDTO. The aggregate status of all nodes in the cluster
[ "Gets", "the", "aggregate_snapshot", "of", "this", "ProcessGroupStatusDTO", ".", "The", "aggregate", "status", "of", "all", "nodes", "in", "the", "cluster" ]
def aggregate_snapshot(self): """ Gets the aggregate_snapshot of this ProcessGroupStatusDTO. The aggregate status of all nodes in the cluster :return: The aggregate_snapshot of this ProcessGroupStatusDTO. :rtype: ProcessGroupStatusSnapshotDTO """ return self._agg...
[ "def", "aggregate_snapshot", "(", "self", ")", ":", "return", "self", ".", "_aggregate_snapshot" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/process_group_status_dto.py#L141-L149
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/lib2to3/fixes/fix_types.py
python
FixTypes.transform
(self, node, results)
return None
[]
def transform(self, node, results): new_value = _TYPE_MAPPING.get(results["name"].value) if new_value: return Name(new_value, prefix=node.prefix) return None
[ "def", "transform", "(", "self", ",", "node", ",", "results", ")", ":", "new_value", "=", "_TYPE_MAPPING", ".", "get", "(", "results", "[", "\"name\"", "]", ".", "value", ")", "if", "new_value", ":", "return", "Name", "(", "new_value", ",", "prefix", "...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/lib2to3/fixes/fix_types.py#L57-L61
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/lib-tk/ttk.py
python
Notebook.__init__
(self, master=None, **kw)
Construct a Ttk Notebook with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS height, padding, width TAB OPTIONS state, sticky, padding, text, image, compound, underl...
Construct a Ttk Notebook with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS height, padding, width TAB OPTIONS state, sticky, padding, text, image, compound, underl...
[ "Construct", "a", "Ttk", "Notebook", "with", "parent", "master", ".", "STANDARD", "OPTIONS", "class", "cursor", "style", "takefocus", "WIDGET", "-", "SPECIFIC", "OPTIONS", "height", "padding", "width", "TAB", "OPTIONS", "state", "sticky", "padding", "text", "ima...
def __init__(self, master=None, **kw): """Construct a Ttk Notebook with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS height, padding, width TAB OPTIONS sta...
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "*", "*", "kw", ")", ":", "Widget", ".", "__init__", "(", "self", ",", "master", ",", "'ttk::notebook'", ",", "kw", ")" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/lib-tk/ttk.py#L726-L755
aws/sagemaker-python-sdk
9d259b316f7f43838c16f35c10e98a110b56735b
src/sagemaker/tuner.py
python
HyperparameterTuner._extract_hyperparameters_from_parameter_ranges
(cls, parameter_ranges)
return hyperparameters
Placeholder docstring
Placeholder docstring
[ "Placeholder", "docstring" ]
def _extract_hyperparameters_from_parameter_ranges(cls, parameter_ranges): """Placeholder docstring""" hyperparameters = {} for parameter in parameter_ranges["CategoricalParameterRanges"]: hyperparameters[parameter["Name"]] = parameter["Values"][0] for parameter in paramete...
[ "def", "_extract_hyperparameters_from_parameter_ranges", "(", "cls", ",", "parameter_ranges", ")", ":", "hyperparameters", "=", "{", "}", "for", "parameter", "in", "parameter_ranges", "[", "\"CategoricalParameterRanges\"", "]", ":", "hyperparameters", "[", "parameter", ...
https://github.com/aws/sagemaker-python-sdk/blob/9d259b316f7f43838c16f35c10e98a110b56735b/src/sagemaker/tuner.py#L1016-L1029
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/outtakes/PropMgrBaseClass.py
python
PropertyManager_common.getTitleButtonPalette
(self)
return self.getPalette(None, QPalette.Button, pmGrpBoxButtonColor)
Return a palette for a GroupBox title button.
Return a palette for a GroupBox title button.
[ "Return", "a", "palette", "for", "a", "GroupBox", "title", "button", "." ]
def getTitleButtonPalette(self): # note: used only by MessageGroupBox as of 070621 """ Return a palette for a GroupBox title button. """ return self.getPalette(None, QPalette.Button, pmGrpBoxButtonColor)
[ "def", "getTitleButtonPalette", "(", "self", ")", ":", "# note: used only by MessageGroupBox as of 070621", "return", "self", ".", "getPalette", "(", "None", ",", "QPalette", ".", "Button", ",", "pmGrpBoxButtonColor", ")" ]
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/outtakes/PropMgrBaseClass.py#L267-L272
dit/dit
2853cb13110c5a5b2fa7ad792e238e2177013da2
dit/npdist.py
python
Distribution.to_string
(self, digits=None, exact=None, tol=1e-9, show_mask=False, str_outcomes=False)
return s
Returns a string representation of the distribution. Parameters ---------- digits : int or None The probabilities will be rounded to the specified number of digits, using NumPy's around function. If `None`, then no rounding is performed. Note, if the number o...
Returns a string representation of the distribution.
[ "Returns", "a", "string", "representation", "of", "the", "distribution", "." ]
def to_string(self, digits=None, exact=None, tol=1e-9, show_mask=False, str_outcomes=False): """ Returns a string representation of the distribution. Parameters ---------- digits : int or None The probabilities will be rounded to the specified...
[ "def", "to_string", "(", "self", ",", "digits", "=", "None", ",", "exact", "=", "None", ",", "tol", "=", "1e-9", ",", "show_mask", "=", "False", ",", "str_outcomes", "=", "False", ")", ":", "from", ".", "distribution", "import", "prepare_string", "from",...
https://github.com/dit/dit/blob/2853cb13110c5a5b2fa7ad792e238e2177013da2/dit/npdist.py#L1432-L1542
wizyoung/googletranslate.popclipext
a3c465685a5a75213e2ec8517eb98d336984bc50
src/h2/stream.py
python
H2Stream.remotely_pushed
(self, pushed_headers)
return [], events
Mark this stream as one that was pushed by the remote peer. Must be called immediately after initialization. Sends no frames, simply updates the state machine.
Mark this stream as one that was pushed by the remote peer. Must be called immediately after initialization. Sends no frames, simply updates the state machine.
[ "Mark", "this", "stream", "as", "one", "that", "was", "pushed", "by", "the", "remote", "peer", ".", "Must", "be", "called", "immediately", "after", "initialization", ".", "Sends", "no", "frames", "simply", "updates", "the", "state", "machine", "." ]
def remotely_pushed(self, pushed_headers): """ Mark this stream as one that was pushed by the remote peer. Must be called immediately after initialization. Sends no frames, simply updates the state machine. """ self.config.logger.debug("%r pushed by remote peer", self) ...
[ "def", "remotely_pushed", "(", "self", ",", "pushed_headers", ")", ":", "self", ".", "config", ".", "logger", ".", "debug", "(", "\"%r pushed by remote peer\"", ",", "self", ")", "events", "=", "self", ".", "state_machine", ".", "process_input", "(", "StreamIn...
https://github.com/wizyoung/googletranslate.popclipext/blob/a3c465685a5a75213e2ec8517eb98d336984bc50/src/h2/stream.py#L1013-L1024
Vector35/binaryninja-api
d9661f34eec6855d495a10eaafc2a8e2679756a7
python/workflow.py
python
Workflow.insert
(self, activity:ActivityType, activities:List[str])
return core.BNWorkflowInsert(self.handle, str(activity), input_list, len(activities))
``insert`` Insert the list of ``activities`` before the specified ``activity`` and at the same level. :param str activity: the Activity node for which to insert ``activities`` before :param list[str] activities: the list of Activities to insert :return: True on success, False otherwise :rtype: bool
``insert`` Insert the list of ``activities`` before the specified ``activity`` and at the same level.
[ "insert", "Insert", "the", "list", "of", "activities", "before", "the", "specified", "activity", "and", "at", "the", "same", "level", "." ]
def insert(self, activity:ActivityType, activities:List[str]) -> bool: """ ``insert`` Insert the list of ``activities`` before the specified ``activity`` and at the same level. :param str activity: the Activity node for which to insert ``activities`` before :param list[str] activities: the list of Activities t...
[ "def", "insert", "(", "self", ",", "activity", ":", "ActivityType", ",", "activities", ":", "List", "[", "str", "]", ")", "->", "bool", ":", "input_list", "=", "(", "ctypes", ".", "c_char_p", "*", "len", "(", "activities", ")", ")", "(", ")", "for", ...
https://github.com/Vector35/binaryninja-api/blob/d9661f34eec6855d495a10eaafc2a8e2679756a7/python/workflow.py#L357-L369
cisco/mindmeld
809c36112e9ea8019fe29d54d136ca14eb4fd8db
mindmeld/text_preparation/normalizers.py
python
Lowercase.normalize
(self, text)
return text.lower()
Args: text (str): Input text. Returns: normalized_text (str): Normalized Text.
Args: text (str): Input text. Returns: normalized_text (str): Normalized Text.
[ "Args", ":", "text", "(", "str", ")", ":", "Input", "text", ".", "Returns", ":", "normalized_text", "(", "str", ")", ":", "Normalized", "Text", "." ]
def normalize(self, text): """ Args: text (str): Input text. Returns: normalized_text (str): Normalized Text. """ return text.lower()
[ "def", "normalize", "(", "self", ",", "text", ")", ":", "return", "text", ".", "lower", "(", ")" ]
https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/text_preparation/normalizers.py#L229-L236
Ultimaker/Cura
a1622c77ea7259ecb956acd6de07b7d34b7ac52b
plugins/VersionUpgrade/VersionUpgrade460to462/VersionUpgrade460to462.py
python
VersionUpgrade460to462.upgradeStack
(self, serialized: str, filename: str)
return result_filenames, result_serialized
Upgrades stacks to have the new version number. This upgrades Deltacomb printers to their new profile structure, and gives them 4 extruders. :param serialized: The original contents of the stack. :param filename: The original file name of the stack. :return: A list of new file n...
Upgrades stacks to have the new version number.
[ "Upgrades", "stacks", "to", "have", "the", "new", "version", "number", "." ]
def upgradeStack(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]: """ Upgrades stacks to have the new version number. This upgrades Deltacomb printers to their new profile structure, and gives them 4 extruders. :param serialized: The original contents of the...
[ "def", "upgradeStack", "(", "self", ",", "serialized", ":", "str", ",", "filename", ":", "str", ")", "->", "Tuple", "[", "List", "[", "str", "]", ",", "List", "[", "str", "]", "]", ":", "parser", "=", "configparser", ".", "ConfigParser", "(", "interp...
https://github.com/Ultimaker/Cura/blob/a1622c77ea7259ecb956acd6de07b7d34b7ac52b/plugins/VersionUpgrade/VersionUpgrade460to462/VersionUpgrade460to462.py#L155-L220
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/plugins/trezor/clientbase.py
python
TrezorClientBase.show_address
(self, address_str, script_type, multisig=None)
[]
def show_address(self, address_str, script_type, multisig=None): coin_name = self.plugin.get_coin_name() address_n = parse_path(address_str) with self.run_flow(): return trezorlib.btc.get_address( self.client, coin_name, address_n, ...
[ "def", "show_address", "(", "self", ",", "address_str", ",", "script_type", ",", "multisig", "=", "None", ")", ":", "coin_name", "=", "self", ".", "plugin", ".", "get_coin_name", "(", ")", "address_n", "=", "parse_path", "(", "address_str", ")", "with", "s...
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/plugins/trezor/clientbase.py#L218-L228
evhub/coconut
27a4af9dc06667870f736f20c862930001b8cbb2
coconut/compiler/compiler.py
python
special_starred_import_handle
(imp_all=False)
return out
Handles the [from *] import * Coconut Easter egg.
Handles the [from *] import * Coconut Easter egg.
[ "Handles", "the", "[", "from", "*", "]", "import", "*", "Coconut", "Easter", "egg", "." ]
def special_starred_import_handle(imp_all=False): """Handles the [from *] import * Coconut Easter egg.""" out = handle_indentation( """ import imp as _coconut_imp try: _coconut_norm_file = _coconut.os.path.normpath(_coconut.os.path.realpath(__file__)) _coconut_norm_dir = _coconut.os.path.normpat...
[ "def", "special_starred_import_handle", "(", "imp_all", "=", "False", ")", ":", "out", "=", "handle_indentation", "(", "\"\"\"\nimport imp as _coconut_imp\ntry:\n _coconut_norm_file = _coconut.os.path.normpath(_coconut.os.path.realpath(__file__))\n _coconut_norm_dir = _coconut.os.path....
https://github.com/evhub/coconut/blob/27a4af9dc06667870f736f20c862930001b8cbb2/coconut/compiler/compiler.py#L162-L219
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/ex-submodules/casexml/apps/phone/models.py
python
_reverse_index_map
(index_map)
return dict(reverse_indices)
[]
def _reverse_index_map(index_map): reverse_indices = defaultdict(set) for case_id, indices in index_map.items(): for indexed_case_id in indices.values(): reverse_indices[indexed_case_id].add(case_id) return dict(reverse_indices)
[ "def", "_reverse_index_map", "(", "index_map", ")", ":", "reverse_indices", "=", "defaultdict", "(", "set", ")", "for", "case_id", ",", "indices", "in", "index_map", ".", "items", "(", ")", ":", "for", "indexed_case_id", "in", "indices", ".", "values", "(", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/ex-submodules/casexml/apps/phone/models.py#L619-L624
AstusRush/AMaDiA
e2ad87318d9dd30bc24428e05c29cb32a29c83aa
External_Libraries/python_control_master/control/flatsys/linflat.py
python
LinearFlatSystem.__init__
(self, linsys, inputs=None, outputs=None, states=None, name=None)
Define a flat system from a SISO LTI system. Given a reachable, single-input/single-output, linear time-invariant system, create a differentially flat system representation. Parameters ---------- linsys : StateSpace LTI StateSpace system to be converted inpu...
Define a flat system from a SISO LTI system.
[ "Define", "a", "flat", "system", "from", "a", "SISO", "LTI", "system", "." ]
def __init__(self, linsys, inputs=None, outputs=None, states=None, name=None): """Define a flat system from a SISO LTI system. Given a reachable, single-input/single-output, linear time-invariant system, create a differentially flat system representation. Parameters ...
[ "def", "__init__", "(", "self", ",", "linsys", ",", "inputs", "=", "None", ",", "outputs", "=", "None", ",", "states", "=", "None", ",", "name", "=", "None", ")", ":", "# Make sure we can handle the system", "if", "(", "not", "control", ".", "isctime", "...
https://github.com/AstusRush/AMaDiA/blob/e2ad87318d9dd30bc24428e05c29cb32a29c83aa/External_Libraries/python_control_master/control/flatsys/linflat.py#L45-L110
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/backend_managers.py
python
ToolManager.toolmanager_disconnect
(self, cid)
return self._callbacks.disconnect(cid)
Disconnect callback id *cid* Example usage:: cid = toolmanager.toolmanager_connect('tool_trigger_zoom', on_press) #...later toolmanager.toolmanager_disconnect(cid)
Disconnect callback id *cid*
[ "Disconnect", "callback", "id", "*", "cid", "*" ]
def toolmanager_disconnect(self, cid): """ Disconnect callback id *cid* Example usage:: cid = toolmanager.toolmanager_connect('tool_trigger_zoom', on_press) #...later toolmanager.toolmanager_disconnect(cid) ...
[ "def", "toolmanager_disconnect", "(", "self", ",", "cid", ")", ":", "return", "self", ".", "_callbacks", ".", "disconnect", "(", "cid", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/backend_managers.py#L137-L148
mila-iqia/blocks
c69c2dc2b9c90a8eac9e432690eb59ff99d2f28a
blocks/utils/utils.py
python
repr_attrs
(instance, *attrs)
r"""Prints a representation of an object with certain attributes. Parameters ---------- instance : object The object of which to print the string representation \*attrs Names of attributes that should be printed. Examples -------- >>> class A(object): ... def __init...
r"""Prints a representation of an object with certain attributes.
[ "r", "Prints", "a", "representation", "of", "an", "object", "with", "certain", "attributes", "." ]
def repr_attrs(instance, *attrs): r"""Prints a representation of an object with certain attributes. Parameters ---------- instance : object The object of which to print the string representation \*attrs Names of attributes that should be printed. Examples -------- >>> c...
[ "def", "repr_attrs", "(", "instance", ",", "*", "attrs", ")", ":", "orig_repr_template", "=", "(", "\"<{0.__class__.__module__}.{0.__class__.__name__} \"", "\"object at {1:#x}\"", ")", "if", "attrs", ":", "repr_template", "=", "(", "orig_repr_template", "+", "\": \"", ...
https://github.com/mila-iqia/blocks/blob/c69c2dc2b9c90a8eac9e432690eb59ff99d2f28a/blocks/utils/utils.py#L206-L239
uber/doubles
15e68dcf98f709b19a581915fa6af5ef49ebdd8a
doubles/target.py
python
Target.get_callable_attr
(self, attr_name)
return attr
Used to double methods added to an object after creation :param str attr_name: the name of the original attribute to return :return: Attribute or None. :rtype: func
Used to double methods added to an object after creation
[ "Used", "to", "double", "methods", "added", "to", "an", "object", "after", "creation" ]
def get_callable_attr(self, attr_name): """Used to double methods added to an object after creation :param str attr_name: the name of the original attribute to return :return: Attribute or None. :rtype: func """ if not hasattr(self.doubled_obj, attr_name): r...
[ "def", "get_callable_attr", "(", "self", ",", "attr_name", ")", ":", "if", "not", "hasattr", "(", "self", ".", "doubled_obj", ",", "attr_name", ")", ":", "return", "None", "func", "=", "getattr", "(", "self", ".", "doubled_obj", ",", "attr_name", ")", "i...
https://github.com/uber/doubles/blob/15e68dcf98f709b19a581915fa6af5ef49ebdd8a/doubles/target.py#L137-L158
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py
python
ApiCallRouterWithApprovalChecks._GetHuntObj
(self, hunt_id, context=None)
[]
def _GetHuntObj(self, hunt_id, context=None): try: return data_store.REL_DB.ReadHuntObject(str(hunt_id)) except db.UnknownHuntError: raise api_call_handler_base.ResourceNotFoundError( "Hunt with id %s could not be found" % hunt_id)
[ "def", "_GetHuntObj", "(", "self", ",", "hunt_id", ",", "context", "=", "None", ")", ":", "try", ":", "return", "data_store", ".", "REL_DB", ".", "ReadHuntObject", "(", "str", "(", "hunt_id", ")", ")", "except", "db", ".", "UnknownHuntError", ":", "raise...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L654-L659
lxtGH/OctaveConv_pytorch
079f7da29d55c2eeed8985d33f0b2f765d7a469e
libs/nn/resnet_sk.py
python
sk_resnet101
(pretrained=False, **kwargs)
return model
Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
[ "Constructs", "a", "ResNet", "-", "101", "model", ".", "Args", ":", "pretrained", "(", "bool", ")", ":", "If", "True", "returns", "a", "model", "pre", "-", "trained", "on", "ImageNet" ]
def sk_resnet101(pretrained=False, **kwargs): """Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNet(Bottleneck, [3, 4, 23, 3], **kwargs) return model
[ "def", "sk_resnet101", "(", "pretrained", "=", "False", ",", "*", "*", "kwargs", ")", ":", "model", "=", "ResNet", "(", "Bottleneck", ",", "[", "3", ",", "4", ",", "23", ",", "3", "]", ",", "*", "*", "kwargs", ")", "return", "model" ]
https://github.com/lxtGH/OctaveConv_pytorch/blob/079f7da29d55c2eeed8985d33f0b2f765d7a469e/libs/nn/resnet_sk.py#L211-L217
STVIR/pysot
9b07c521fd370ba38d35f35f76b275156564a681
vot_iter/vot_iter.py
python
setup_tracker
()
return tracker
[]
def setup_tracker(): cfg.merge_from_file(cfg_file) model = ModelBuilder() model = load_pretrain(model, model_file).cuda().eval() tracker = build_tracker(model) warmup(model) return tracker
[ "def", "setup_tracker", "(", ")", ":", "cfg", ".", "merge_from_file", "(", "cfg_file", ")", "model", "=", "ModelBuilder", "(", ")", "model", "=", "load_pretrain", "(", "model", ",", "model_file", ")", ".", "cuda", "(", ")", ".", "eval", "(", ")", "trac...
https://github.com/STVIR/pysot/blob/9b07c521fd370ba38d35f35f76b275156564a681/vot_iter/vot_iter.py#L30-L38
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_pvc.py
python
Yedit.valid_key
(key, sep='.')
return True
validate the incoming key
validate the incoming key
[ "validate", "the", "incoming", "key" ]
def valid_key(key, sep='.'): '''validate the incoming key''' common_separators = list(Yedit.com_sep - set([sep])) if not re.match(Yedit.re_valid_key.format(''.join(common_separators)), key): return False return True
[ "def", "valid_key", "(", "key", ",", "sep", "=", "'.'", ")", ":", "common_separators", "=", "list", "(", "Yedit", ".", "com_sep", "-", "set", "(", "[", "sep", "]", ")", ")", "if", "not", "re", ".", "match", "(", "Yedit", ".", "re_valid_key", ".", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_pvc.py#L204-L210
flennerhag/mlens
6cbc11354b5f9500a33d9cefb700a1bba9d3199a
mlens/parallel/learner.py
python
Learner.scorer
(self, scorer)
Copy of scorer
Copy of scorer
[ "Copy", "of", "scorer" ]
def scorer(self, scorer): """Copy of scorer""" self._scorer = scorer
[ "def", "scorer", "(", "self", ",", "scorer", ")", ":", "self", ".", "_scorer", "=", "scorer" ]
https://github.com/flennerhag/mlens/blob/6cbc11354b5f9500a33d9cefb700a1bba9d3199a/mlens/parallel/learner.py#L867-L869
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/coil.py
python
CoilSkein.getCraftedGcode
(self, gcodeText, repository)
return self.distanceFeedRate.output.getvalue()
Parse gcode text and store the coil gcode.
Parse gcode text and store the coil gcode.
[ "Parse", "gcode", "text", "and", "store", "the", "coil", "gcode", "." ]
def getCraftedGcode(self, gcodeText, repository): "Parse gcode text and store the coil gcode." self.repository = repository self.lines = archive.getTextLines(gcodeText) self.parseInitialization() self.parseBoundaries() self.parseUntilLayer() self.addCoilLayers() self.distanceFeedRate.addLines( self.shut...
[ "def", "getCraftedGcode", "(", "self", ",", "gcodeText", ",", "repository", ")", ":", "self", ".", "repository", "=", "repository", "self", ".", "lines", "=", "archive", ".", "getTextLines", "(", "gcodeText", ")", "self", ".", "parseInitialization", "(", ")"...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/coil.py#L200-L209
psd-tools/psd-tools
00241f3aed2ca52a8012e198a0f390ff7d8edca9
src/psd_tools/api/psd_image.py
python
PSDImage.compose
(self, force=False, bbox=None, layer_filter=None)
return image
Deprecated, use :py:func:`~psd_tools.PSDImage.composite`. Compose the PSD image. :param bbox: Viewport tuple (left, top, right, bottom). :return: :py:class:`PIL.Image`, or `None` if there is no pixel.
Deprecated, use :py:func:`~psd_tools.PSDImage.composite`.
[ "Deprecated", "use", ":", "py", ":", "func", ":", "~psd_tools", ".", "PSDImage", ".", "composite", "." ]
def compose(self, force=False, bbox=None, layer_filter=None): """ Deprecated, use :py:func:`~psd_tools.PSDImage.composite`. Compose the PSD image. :param bbox: Viewport tuple (left, top, right, bottom). :return: :py:class:`PIL.Image`, or `None` if there is no pixel. """...
[ "def", "compose", "(", "self", ",", "force", "=", "False", ",", "bbox", "=", "None", ",", "layer_filter", "=", "None", ")", ":", "from", "psd_tools", ".", "composer", "import", "compose", "image", "=", "None", "if", "(", "not", "force", "or", "len", ...
https://github.com/psd-tools/psd-tools/blob/00241f3aed2ca52a8012e198a0f390ff7d8edca9/src/psd_tools/api/psd_image.py#L138-L160
boston-dynamics/spot-sdk
5ffa12e6943a47323c7279d86e30346868755f52
python/examples/mission_recorder/mission_recorder.py
python
RecorderInterface.drive
(self, stdscr)
User interface to control the robot via the passed-in curses screen interface object.
User interface to control the robot via the passed-in curses screen interface object.
[ "User", "interface", "to", "control", "the", "robot", "via", "the", "passed", "-", "in", "curses", "screen", "interface", "object", "." ]
def drive(self, stdscr): """User interface to control the robot via the passed-in curses screen interface object.""" with LeaseKeepAlive(self._lease_client) as lease_keep_alive, \ ExitCheck() as self._exit_check: curses_handler = CursesHandler(self) curses_handler.se...
[ "def", "drive", "(", "self", ",", "stdscr", ")", ":", "with", "LeaseKeepAlive", "(", "self", ".", "_lease_client", ")", "as", "lease_keep_alive", ",", "ExitCheck", "(", ")", "as", "self", ".", "_exit_check", ":", "curses_handler", "=", "CursesHandler", "(", ...
https://github.com/boston-dynamics/spot-sdk/blob/5ffa12e6943a47323c7279d86e30346868755f52/python/examples/mission_recorder/mission_recorder.py#L256-L290
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Django/django/core/serializers/__init__.py
python
_load_serializers
()
Register built-in and settings-defined serializers. This is done lazily so that user code has a chance to (e.g.) set up custom settings without needing to be careful of import order.
Register built-in and settings-defined serializers. This is done lazily so that user code has a chance to (e.g.) set up custom settings without needing to be careful of import order.
[ "Register", "built", "-", "in", "and", "settings", "-", "defined", "serializers", ".", "This", "is", "done", "lazily", "so", "that", "user", "code", "has", "a", "chance", "to", "(", "e", ".", "g", ".", ")", "set", "up", "custom", "settings", "without",...
def _load_serializers(): """ Register built-in and settings-defined serializers. This is done lazily so that user code has a chance to (e.g.) set up custom settings without needing to be careful of import order. """ global _serializers serializers = {} for format in BUILTIN_SERIALIZERS: ...
[ "def", "_load_serializers", "(", ")", ":", "global", "_serializers", "serializers", "=", "{", "}", "for", "format", "in", "BUILTIN_SERIALIZERS", ":", "register_serializer", "(", "format", ",", "BUILTIN_SERIALIZERS", "[", "format", "]", ",", "serializers", ")", "...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/core/serializers/__init__.py#L112-L125
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/notpip/_vendor/distlib/_backport/sysconfig.py
python
_get_default_scheme
()
return os.name
[]
def _get_default_scheme(): if os.name == 'posix': # the default scheme for posix is posix_prefix return 'posix_prefix' return os.name
[ "def", "_get_default_scheme", "(", ")", ":", "if", "os", ".", "name", "==", "'posix'", ":", "# the default scheme for posix is posix_prefix", "return", "'posix_prefix'", "return", "os", ".", "name" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/distlib/_backport/sysconfig.py#L177-L181
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/contrib/contenttypes/fields.py
python
GenericRelation.get_path_info
(self)
[]
def get_path_info(self): opts = self.remote_field.model._meta object_id_field = opts.get_field(self.object_id_field_name) if object_id_field.model != opts.model: return self._get_path_info_with_parent() else: target = opts.pk return [PathInfo(self.mode...
[ "def", "get_path_info", "(", "self", ")", ":", "opts", "=", "self", ".", "remote_field", ".", "model", ".", "_meta", "object_id_field", "=", "opts", ".", "get_field", "(", "self", ".", "object_id_field_name", ")", "if", "object_id_field", ".", "model", "!=",...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/contrib/contenttypes/fields.py#L389-L396
enthought/mayavi
2103a273568b8f0bd62328801aafbd6252543ae8
mayavi/core/module_manager.py
python
ModuleManager.stop
(self)
Invoked when this object is removed from the mayavi pipeline.
Invoked when this object is removed from the mayavi pipeline.
[ "Invoked", "when", "this", "object", "is", "removed", "from", "the", "mayavi", "pipeline", "." ]
def stop(self): """Invoked when this object is removed from the mayavi pipeline. """ if not self.running: return # Teardown event handlers. self._teardown_event_handlers() # Stop all our children. for obj in self.children: obj.sto...
[ "def", "stop", "(", "self", ")", ":", "if", "not", "self", ".", "running", ":", "return", "# Teardown event handlers.", "self", ".", "_teardown_event_handlers", "(", ")", "# Stop all our children.", "for", "obj", "in", "self", ".", "children", ":", "obj", ".",...
https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/mayavi/core/module_manager.py#L182-L199
da4089/simplefix
9886fcbd7f5703ac6a8815033b0f1c0ede78bf2b
tools/fix_enums.py
python
FixElement.set_updated
(self, updated: str)
return updated
Set FIX version element definition last updated.
Set FIX version element definition last updated.
[ "Set", "FIX", "version", "element", "definition", "last", "updated", "." ]
def set_updated(self, updated: str) -> str: """Set FIX version element definition last updated.""" self._updated = updated return updated
[ "def", "set_updated", "(", "self", ",", "updated", ":", "str", ")", "->", "str", ":", "self", ".", "_updated", "=", "updated", "return", "updated" ]
https://github.com/da4089/simplefix/blob/9886fcbd7f5703ac6a8815033b0f1c0ede78bf2b/tools/fix_enums.py#L56-L59
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/sqlalchemy/engine/base.py
python
Transaction.rollback
(self)
Roll back this :class:`.Transaction`.
Roll back this :class:`.Transaction`.
[ "Roll", "back", "this", ":", "class", ":", ".", "Transaction", "." ]
def rollback(self): """Roll back this :class:`.Transaction`. """ if not self._parent.is_active: return self._do_rollback() self.is_active = False
[ "def", "rollback", "(", "self", ")", ":", "if", "not", "self", ".", "_parent", ".", "is_active", ":", "return", "self", ".", "_do_rollback", "(", ")", "self", ".", "is_active", "=", "False" ]
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/engine/base.py#L1250-L1257
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/plotting/pygletplot/color_scheme.py
python
ColorScheme._sort_args
(self, args)
return atoms, lists
[]
def _sort_args(self, args): atoms, lists = [], [] for a in args: if isinstance(a, (tuple, list)): lists.append(a) else: atoms.append(a) return atoms, lists
[ "def", "_sort_args", "(", "self", ",", "args", ")", ":", "atoms", ",", "lists", "=", "[", "]", ",", "[", "]", "for", "a", "in", "args", ":", "if", "isinstance", "(", "a", ",", "(", "tuple", ",", "list", ")", ")", ":", "lists", ".", "append", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/plotting/pygletplot/color_scheme.py#L204-L211
spectacles/CodeComplice
8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62
libs/codeintel2/oop/driver.py
python
Environment.add_pref_observer
(self, name, callback)
[]
def add_pref_observer(self, name, callback): self.log.debug("Adding pref observer for %s", name) try: self._observers[name].add(callback) except KeyError: self._observers[name] = set([callback]) if self._send: self._send(command="global-prefs-o...
[ "def", "add_pref_observer", "(", "self", ",", "name", ",", "callback", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Adding pref observer for %s\"", ",", "name", ")", "try", ":", "self", ".", "_observers", "[", "name", "]", ".", "add", "(", "callba...
https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/oop/driver.py#L978-L988
JetBrains/python-skeletons
95ad24b666e475998e5d1cc02ed53a2188036167
__builtin__.py
python
float.__floordiv__
(self, y)
return 0.0
Floored quotient of x and y. :type y: numbers.Number :rtype: float
Floored quotient of x and y.
[ "Floored", "quotient", "of", "x", "and", "y", "." ]
def __floordiv__(self, y): """Floored quotient of x and y. :type y: numbers.Number :rtype: float """ return 0.0
[ "def", "__floordiv__", "(", "self", ",", "y", ")", ":", "return", "0.0" ]
https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/__builtin__.py#L986-L992
maxpumperla/betago
ff06b467e16d7a7a22555d14181b723d853e1a70
betago/gosgf/sgf_grammar.py
python
tokenise
(s, start_position=0)
return result, i
Tokenise a string containing SGF data. s -- 8-bit string start_position -- index into 's' Skips leading junk. Returns a list of pairs of strings (token type, contents), and also the index in 's' of the start of the unprocessed 'tail'. token types and contents: I -- PropIde...
Tokenise a string containing SGF data.
[ "Tokenise", "a", "string", "containing", "SGF", "data", "." ]
def tokenise(s, start_position=0): """Tokenise a string containing SGF data. s -- 8-bit string start_position -- index into 's' Skips leading junk. Returns a list of pairs of strings (token type, contents), and also the index in 's' of the start of the unprocessed 'tail'. to...
[ "def", "tokenise", "(", "s", ",", "start_position", "=", "0", ")", ":", "result", "=", "[", "]", "m", "=", "_find_start_re", ".", "search", "(", "s", ",", "start_position", ")", "if", "not", "m", ":", "return", "[", "]", ",", "0", "i", "=", "m", ...
https://github.com/maxpumperla/betago/blob/ff06b467e16d7a7a22555d14181b723d853e1a70/betago/gosgf/sgf_grammar.py#L75-L119
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/sqli/thirdparty/beautifulsoup/beautifulsoup.py
python
Tag.decompose
(self)
Recursively destroys the contents of this tree.
Recursively destroys the contents of this tree.
[ "Recursively", "destroys", "the", "contents", "of", "this", "tree", "." ]
def decompose(self): """Recursively destroys the contents of this tree.""" self.extract() if len(self.contents) == 0: return current = self.contents[0] while current is not None: next = current.next if isinstance(current, Tag): ...
[ "def", "decompose", "(", "self", ")", ":", "self", ".", "extract", "(", ")", "if", "len", "(", "self", ".", "contents", ")", "==", "0", ":", "return", "current", "=", "self", ".", "contents", "[", "0", "]", "while", "current", "is", "not", "None", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/thirdparty/beautifulsoup/beautifulsoup.py#L778-L793
PyHDI/veriloggen
2382d200deabf59cfcfd741f5eba371010aaf2bb
veriloggen/verilog/to_verilog.py
python
VerilogCommonVisitor.visit_Reg
(self, node)
return vast.Identifier(name)
[]
def visit_Reg(self, node): name = node.name return vast.Identifier(name)
[ "def", "visit_Reg", "(", "self", ",", "node", ")", ":", "name", "=", "node", ".", "name", "return", "vast", ".", "Identifier", "(", "name", ")" ]
https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/verilog/to_verilog.py#L184-L186
usb-tools/ViewSB
0318dc7b3d7da290a841b1681e62a0654c8c82e6
viewsb/frontends/tui.py
python
TUIFrontend.schedule_next_communication
(self)
Schedules the next comms check; which handles periodic loading of received packets into the UI.
Schedules the next comms check; which handles periodic loading of received packets into the UI.
[ "Schedules", "the", "next", "comms", "check", ";", "which", "handles", "periodic", "loading", "of", "received", "packets", "into", "the", "UI", "." ]
def schedule_next_communication(self): """ Schedules the next comms check; which handles periodic loading of received packets into the UI. """ # Ask the main loop to call our comms handler after a REFRESH_INTERVAL delay. self.loop.set_alarm_in(self.BACKGROUND_REFRESH_INTERVAL, lambda _, __ : se...
[ "def", "schedule_next_communication", "(", "self", ")", ":", "# Ask the main loop to call our comms handler after a REFRESH_INTERVAL delay.", "self", ".", "loop", ".", "set_alarm_in", "(", "self", ".", "BACKGROUND_REFRESH_INTERVAL", ",", "lambda", "_", ",", "__", ":", "se...
https://github.com/usb-tools/ViewSB/blob/0318dc7b3d7da290a841b1681e62a0654c8c82e6/viewsb/frontends/tui.py#L288-L292
rlworkgroup/garage
b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507
src/garage/tf/models/sequential.py
python
Sequential.input
(self)
return self._first_network.input
tf.Tensor: input of the model by default.
tf.Tensor: input of the model by default.
[ "tf", ".", "Tensor", ":", "input", "of", "the", "model", "by", "default", "." ]
def input(self): """tf.Tensor: input of the model by default.""" return self._first_network.input
[ "def", "input", "(", "self", ")", ":", "return", "self", ".", "_first_network", ".", "input" ]
https://github.com/rlworkgroup/garage/blob/b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507/src/garage/tf/models/sequential.py#L48-L50
stephenhky/PyShortTextCategorization
4fa46a148a3eeb923885a7d70c789e988554f758
shorttext/utils/dtm.py
python
DocumentTermMatrix.generate_dtm
(self, corpus, tfidf=False)
Generate the inside document-term matrix and other peripherical information objects. This is run when the class is instantiated. :param corpus: corpus. :param tfidf: whether to weigh using tf-idf. (Default: False) :return: None :type corpus: list :type tfidf: bool
Generate the inside document-term matrix and other peripherical information objects. This is run when the class is instantiated.
[ "Generate", "the", "inside", "document", "-", "term", "matrix", "and", "other", "peripherical", "information", "objects", ".", "This", "is", "run", "when", "the", "class", "is", "instantiated", "." ]
def generate_dtm(self, corpus, tfidf=False): """ Generate the inside document-term matrix and other peripherical information objects. This is run when the class is instantiated. :param corpus: corpus. :param tfidf: whether to weigh using tf-idf. (Default: False) :return: None ...
[ "def", "generate_dtm", "(", "self", ",", "corpus", ",", "tfidf", "=", "False", ")", ":", "self", ".", "dictionary", "=", "Dictionary", "(", "corpus", ")", "self", ".", "dtm", "=", "dok_matrix", "(", "(", "len", "(", "corpus", ")", ",", "len", "(", ...
https://github.com/stephenhky/PyShortTextCategorization/blob/4fa46a148a3eeb923885a7d70c789e988554f758/shorttext/utils/dtm.py#L58-L76
minerllabs/minerl
0123527c334c96ebb3f0cf313df1552fa4302691
minerl/herobraine/env_specs/survival_specs.py
python
Survival.create_agent_start
(self)
return []
[]
def create_agent_start(self) -> List[Handler]: return []
[ "def", "create_agent_start", "(", "self", ")", "->", "List", "[", "Handler", "]", ":", "return", "[", "]" ]
https://github.com/minerllabs/minerl/blob/0123527c334c96ebb3f0cf313df1552fa4302691/minerl/herobraine/env_specs/survival_specs.py#L49-L50
Instagram/LibCST
13370227703fe3171e94c57bdd7977f3af696b73
libcst/matchers/_visitors.py
python
MatcherDecoratableTransformer.matches
( self, node: Union[cst.MaybeSentinel, cst.RemovalSentinel, cst.CSTNode], matcher: BaseMatcherNode, )
return matches(node, matcher, metadata_resolver=self)
A convenience method to call :func:`~libcst.matchers.matches` without requiring an explicit parameter for metadata. Since our instance is an instance of :class:`libcst.MetadataDependent`, we work as a metadata resolver. Please see documentation for :func:`~libcst.matchers.matches` as it is ident...
A convenience method to call :func:`~libcst.matchers.matches` without requiring an explicit parameter for metadata. Since our instance is an instance of :class:`libcst.MetadataDependent`, we work as a metadata resolver. Please see documentation for :func:`~libcst.matchers.matches` as it is ident...
[ "A", "convenience", "method", "to", "call", ":", "func", ":", "~libcst", ".", "matchers", ".", "matches", "without", "requiring", "an", "explicit", "parameter", "for", "metadata", ".", "Since", "our", "instance", "is", "an", "instance", "of", ":", "class", ...
def matches( self, node: Union[cst.MaybeSentinel, cst.RemovalSentinel, cst.CSTNode], matcher: BaseMatcherNode, ) -> bool: """ A convenience method to call :func:`~libcst.matchers.matches` without requiring an explicit parameter for metadata. Since our instance is an i...
[ "def", "matches", "(", "self", ",", "node", ":", "Union", "[", "cst", ".", "MaybeSentinel", ",", "cst", ".", "RemovalSentinel", ",", "cst", ".", "CSTNode", "]", ",", "matcher", ":", "BaseMatcherNode", ",", ")", "->", "bool", ":", "return", "matches", "...
https://github.com/Instagram/LibCST/blob/13370227703fe3171e94c57bdd7977f3af696b73/libcst/matchers/_visitors.py#L565-L577
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/live/v20180801/live_client.py
python
LiveClient.CreateLiveTranscodeRule
(self, request)
创建转码规则,需要先调用[CreateLiveTranscodeTemplate](/document/product/267/32646)接口创建转码模板,将返回的模板id绑定到流使用。 <br>转码相关文档:[直播转封装及转码](/document/product/267/32736)。 :param request: Request instance for CreateLiveTranscodeRule. :type request: :class:`tencentcloud.live.v20180801.models.CreateLiveTranscodeRuleReque...
创建转码规则,需要先调用[CreateLiveTranscodeTemplate](/document/product/267/32646)接口创建转码模板,将返回的模板id绑定到流使用。 <br>转码相关文档:[直播转封装及转码](/document/product/267/32736)。
[ "创建转码规则,需要先调用", "[", "CreateLiveTranscodeTemplate", "]", "(", "/", "document", "/", "product", "/", "267", "/", "32646", ")", "接口创建转码模板,将返回的模板id绑定到流使用。", "<br", ">", "转码相关文档:", "[", "直播转封装及转码", "]", "(", "/", "document", "/", "product", "/", "267", "/", "327...
def CreateLiveTranscodeRule(self, request): """创建转码规则,需要先调用[CreateLiveTranscodeTemplate](/document/product/267/32646)接口创建转码模板,将返回的模板id绑定到流使用。 <br>转码相关文档:[直播转封装及转码](/document/product/267/32736)。 :param request: Request instance for CreateLiveTranscodeRule. :type request: :class:`tencentc...
[ "def", "CreateLiveTranscodeRule", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"CreateLiveTranscodeRule\"", ",", "params", ")", "response", "=", "json", "...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/live/v20180801/live_client.py#L486-L512
harvard-lil/capstone
f15c98fce0b50b74616c40f862146d858b54be5d
capstone/scripts/refactor_xml.py
python
strip_bracketnum_hyphens
(text)
return text
Tags like <bracketnum>[4---]</bracketnum> mess up our process because some of the hyphens get redacted and some get edited out. We end up editing out the redacted one and letting an unredacted hyphen slip through. Since hyphens next to the bracket are typos anyway, filter them out. Note that hyphens not...
Tags like <bracketnum>[4---]</bracketnum> mess up our process because some of the hyphens get redacted and some get edited out. We end up editing out the redacted one and letting an unredacted hyphen slip through. Since hyphens next to the bracket are typos anyway, filter them out. Note that hyphens not...
[ "Tags", "like", "<bracketnum", ">", "[", "4", "---", "]", "<", "/", "bracketnum", ">", "mess", "up", "our", "process", "because", "some", "of", "the", "hyphens", "get", "redacted", "and", "some", "get", "edited", "out", ".", "We", "end", "up", "editing...
def strip_bracketnum_hyphens(text): """ Tags like <bracketnum>[4---]</bracketnum> mess up our process because some of the hyphens get redacted and some get edited out. We end up editing out the redacted one and letting an unredacted hyphen slip through. Since hyphens next to the bracket are ...
[ "def", "strip_bracketnum_hyphens", "(", "text", ")", ":", "text", "=", "re", ".", "sub", "(", "r'\\[[-\\xad]+'", ",", "'['", ",", "text", ")", "text", "=", "re", ".", "sub", "(", "r'[-\\xad]+]'", ",", "']'", ",", "text", ")", "return", "text" ]
https://github.com/harvard-lil/capstone/blob/f15c98fce0b50b74616c40f862146d858b54be5d/capstone/scripts/refactor_xml.py#L605-L614
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/contrib/pynumero/interfaces/nlp.py
python
ExtendedNLP.nnz_jacobian_ineq
(self)
Returns number of nonzero values in jacobian of inequality constraints
Returns number of nonzero values in jacobian of inequality constraints
[ "Returns", "number", "of", "nonzero", "values", "in", "jacobian", "of", "inequality", "constraints" ]
def nnz_jacobian_ineq(self): """ Returns number of nonzero values in jacobian of inequality constraints """ pass
[ "def", "nnz_jacobian_ineq", "(", "self", ")", ":", "pass" ]
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/pynumero/interfaces/nlp.py#L398-L402
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/words/protocols/irc.py
python
IRCClient.notice
(self, user, message)
Send a notice to a user. Notices are like normal message, but should never get automated replies. @type user: C{str} @param user: The user to send a notice to. @type message: C{str} @param message: The contents of the notice to send.
Send a notice to a user.
[ "Send", "a", "notice", "to", "a", "user", "." ]
def notice(self, user, message): """ Send a notice to a user. Notices are like normal message, but should never get automated replies. @type user: C{str} @param user: The user to send a notice to. @type message: C{str} @param message: The contents of the...
[ "def", "notice", "(", "self", ",", "user", ",", "message", ")", ":", "self", ".", "sendLine", "(", "f\"NOTICE {user} :{message}\"", ")" ]
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/words/protocols/irc.py#L1753-L1765
viewvc/viewvc
d85819dac65c5f45b563c2c3c02956ae585576b4
lib/vclib/__init__.py
python
Repository.itemlog
(self, path_parts, rev, sortby, first, limit, options)
Retrieve an item's log information The result is a list of Revision objects The path is specified as a list of components, relative to the root of the repository. e.g. ["subdir1", "subdir2", "filename"] rev is the revision of the item to return information about sortby indica...
Retrieve an item's log information
[ "Retrieve", "an", "item", "s", "log", "information" ]
def itemlog(self, path_parts, rev, sortby, first, limit, options): """Retrieve an item's log information The result is a list of Revision objects The path is specified as a list of components, relative to the root of the repository. e.g. ["subdir1", "subdir2", "filename"] rev ...
[ "def", "itemlog", "(", "self", ",", "path_parts", ",", "rev", ",", "sortby", ",", "first", ",", "limit", ",", "options", ")", ":" ]
https://github.com/viewvc/viewvc/blob/d85819dac65c5f45b563c2c3c02956ae585576b4/lib/vclib/__init__.py#L129-L149
JiangWenPL/multiperson
e8ae029cc691f3f9c3958a23f762f3d72cf65c54
mmdetection/mmdet/core/anchor/guided_anchor_target.py
python
ga_shape_target
(approx_list, inside_flag_list, square_list, gt_bboxes_list, img_metas, approxs_per_octave, cfg, gt_bboxes_ignore_list=None, sampling=True, ...
return (bbox_anchors_list, bbox_gts_list, bbox_weights_list, num_total_pos, num_total_neg)
Compute guided anchoring targets. Args: approx_list (list[list]): Multi level approxs of each image. inside_flag_list (list[list]): Multi level inside flags of each image. square_list (list[list]): Multi level squares of each image. gt_bboxes_list (list[Tensor]): Ground truth bboxes...
Compute guided anchoring targets.
[ "Compute", "guided", "anchoring", "targets", "." ]
def ga_shape_target(approx_list, inside_flag_list, square_list, gt_bboxes_list, img_metas, approxs_per_octave, cfg, gt_bboxes_ignore_list=None, sampling=True, ...
[ "def", "ga_shape_target", "(", "approx_list", ",", "inside_flag_list", ",", "square_list", ",", "gt_bboxes_list", ",", "img_metas", ",", "approxs_per_octave", ",", "cfg", ",", "gt_bboxes_ignore_list", "=", "None", ",", "sampling", "=", "True", ",", "unmap_outputs", ...
https://github.com/JiangWenPL/multiperson/blob/e8ae029cc691f3f9c3958a23f762f3d72cf65c54/mmdetection/mmdet/core/anchor/guided_anchor_target.py#L132-L200
nonebot/aiocqhttp
eaa850e8d7432e04394194b3d82bb88570390732
aiocqhttp/message.py
python
Message.reduce
(self)
化简消息,即去除多余消息段、合并相邻纯文本消息段。 由于 `Message` 类基于 `list`,此方法时间复杂度为 O(n)。
化简消息,即去除多余消息段、合并相邻纯文本消息段。
[ "化简消息,即去除多余消息段、合并相邻纯文本消息段。" ]
def reduce(self) -> None: """ 化简消息,即去除多余消息段、合并相邻纯文本消息段。 由于 `Message` 类基于 `list`,此方法时间复杂度为 O(n)。 """ idx = 0 while idx < len(self): if idx > 0 and \ self[idx - 1].type == 'text' and self[idx].type == 'text': self[idx - 1].da...
[ "def", "reduce", "(", "self", ")", "->", "None", ":", "idx", "=", "0", "while", "idx", "<", "len", "(", "self", ")", ":", "if", "idx", ">", "0", "and", "self", "[", "idx", "-", "1", "]", ".", "type", "==", "'text'", "and", "self", "[", "idx",...
https://github.com/nonebot/aiocqhttp/blob/eaa850e8d7432e04394194b3d82bb88570390732/aiocqhttp/message.py#L534-L547
autopkg/autopkg
1b0031c108f055e1f72e6588776936e4ab797222
Code/autopkglib/__init__.py
python
Processor.inject
(self, arguments)
Update environment data with arguments.
Update environment data with arguments.
[ "Update", "environment", "data", "with", "arguments", "." ]
def inject(self, arguments): """Update environment data with arguments.""" for key, value in list(arguments.items()): update_data(self.env, key, value)
[ "def", "inject", "(", "self", ",", "arguments", ")", ":", "for", "key", ",", "value", "in", "list", "(", "arguments", ".", "items", "(", ")", ")", ":", "update_data", "(", "self", ".", "env", ",", "key", ",", "value", ")" ]
https://github.com/autopkg/autopkg/blob/1b0031c108f055e1f72e6588776936e4ab797222/Code/autopkglib/__init__.py#L605-L608
mapproxy/mapproxy
45ae81b3dd6c8a1a0b473ba8c669afd0ec7ecd10
mapproxy/grid.py
python
MetaGrid._meta_bbox
(self, tile_coord=None, tiles=None, limit_to_bbox=True)
return self._buffered_bbox(bbox, level, limit_to_bbox)
Returns the bbox of the metatile that contains `tile_coord`. :type tile_coord: ``(x, y, z)`` >>> mgrid = MetaGrid(grid=TileGrid(), meta_size=(2, 2)) >>> [round(x, 2) for x in mgrid._meta_bbox((0, 0, 2))[0]] [-20037508.34, -20037508.34, 0.0, 0.0] >>> mgrid = MetaGrid(grid=TileGr...
Returns the bbox of the metatile that contains `tile_coord`.
[ "Returns", "the", "bbox", "of", "the", "metatile", "that", "contains", "tile_coord", "." ]
def _meta_bbox(self, tile_coord=None, tiles=None, limit_to_bbox=True): """ Returns the bbox of the metatile that contains `tile_coord`. :type tile_coord: ``(x, y, z)`` >>> mgrid = MetaGrid(grid=TileGrid(), meta_size=(2, 2)) >>> [round(x, 2) for x in mgrid._meta_bbox((0, 0, 2))[...
[ "def", "_meta_bbox", "(", "self", ",", "tile_coord", "=", "None", ",", "tiles", "=", "None", ",", "limit_to_bbox", "=", "True", ")", ":", "if", "tiles", ":", "assert", "tile_coord", "is", "None", "level", "=", "tiles", "[", "0", "]", "[", "2", "]", ...
https://github.com/mapproxy/mapproxy/blob/45ae81b3dd6c8a1a0b473ba8c669afd0ec7ecd10/mapproxy/grid.py#L735-L755
mozman/ezdxf
59d0fc2ea63f5cf82293428f5931da7e9f9718e9
src/ezdxf/addons/drawing/pyqt.py
python
_matrix_to_qtransform
(matrix: Matrix44)
return qg.QTransform(*matrix.get_2d_transformation())
Qt also uses row-vectors so the translation elements are placed in the bottom row. This is only a simple conversion which assumes that although the transformation is 4x4,it does not involve the z axis. A more correct transformation could be implemented like so: https://stackoverflow.com/questions/...
Qt also uses row-vectors so the translation elements are placed in the bottom row.
[ "Qt", "also", "uses", "row", "-", "vectors", "so", "the", "translation", "elements", "are", "placed", "in", "the", "bottom", "row", "." ]
def _matrix_to_qtransform(matrix: Matrix44) -> qg.QTransform: """Qt also uses row-vectors so the translation elements are placed in the bottom row. This is only a simple conversion which assumes that although the transformation is 4x4,it does not involve the z axis. A more correct transformation c...
[ "def", "_matrix_to_qtransform", "(", "matrix", ":", "Matrix44", ")", "->", "qg", ".", "QTransform", ":", "return", "qg", ".", "QTransform", "(", "*", "matrix", ".", "get_2d_transformation", "(", ")", ")" ]
https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/addons/drawing/pyqt.py#L415-L425
nettitude/scrounger
dd393666aa1ba1117d1c472cfdef4d0b18216904
scrounger/core/device.py
python
IOSDevice._translate_keychain_value
(self, value)
return value
Translates a value from the keychain dumper to a python equivalent :param str value: the value to translate :return: the translated value
Translates a value from the keychain dumper to a python equivalent
[ "Translates", "a", "value", "from", "the", "keychain", "dumper", "to", "a", "python", "equivalent" ]
def _translate_keychain_value(self, value): """ Translates a value from the keychain dumper to a python equivalent :param str value: the value to translate :return: the translated value """ value = value.strip() if not value: return None val...
[ "def", "_translate_keychain_value", "(", "self", ",", "value", ")", ":", "value", "=", "value", ".", "strip", "(", ")", "if", "not", "value", ":", "return", "None", "valid_hex", "=", "\"0123456789abdef\"", "if", "value", "[", "0", "]", "==", "\"<\"", "an...
https://github.com/nettitude/scrounger/blob/dd393666aa1ba1117d1c472cfdef4d0b18216904/scrounger/core/device.py#L362-L382
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/internals/construction.py
python
_validate_or_indexify_columns
( content: list[np.ndarray], columns: Index | None )
return columns
If columns is None, make numbers as column names; Otherwise, validate that columns have valid length. Parameters ---------- content : list of np.ndarrays columns : Index or None Returns ------- Index If columns is None, assign positional column index value as columns. Rais...
If columns is None, make numbers as column names; Otherwise, validate that columns have valid length.
[ "If", "columns", "is", "None", "make", "numbers", "as", "column", "names", ";", "Otherwise", "validate", "that", "columns", "have", "valid", "length", "." ]
def _validate_or_indexify_columns( content: list[np.ndarray], columns: Index | None ) -> Index: """ If columns is None, make numbers as column names; Otherwise, validate that columns have valid length. Parameters ---------- content : list of np.ndarrays columns : Index or None Retu...
[ "def", "_validate_or_indexify_columns", "(", "content", ":", "list", "[", "np", ".", "ndarray", "]", ",", "columns", ":", "Index", "|", "None", ")", "->", "Index", ":", "if", "columns", "is", "None", ":", "columns", "=", "default_index", "(", "len", "(",...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/internals/construction.py#L987-L1042
NVIDIA/Megatron-LM
9a8b89acd8f6ba096860170d0e30ddc0bc2bacd4
megatron/optimizer/optimizer.py
python
Float16OptimizerWithFloat16Params.zero_grad
(self, set_to_none=True)
We only need to zero the model related parameters, i.e., float16_groups & fp32_from_fp32_groups. We additionally zero fp32_from_float16_groups as a memory optimization to reduce fragmentation; in the case of set_to_none==True, the space used by this field can be safely deallocated at thi...
We only need to zero the model related parameters, i.e., float16_groups & fp32_from_fp32_groups. We additionally zero fp32_from_float16_groups as a memory optimization to reduce fragmentation; in the case of set_to_none==True, the space used by this field can be safely deallocated at thi...
[ "We", "only", "need", "to", "zero", "the", "model", "related", "parameters", "i", ".", "e", ".", "float16_groups", "&", "fp32_from_fp32_groups", ".", "We", "additionally", "zero", "fp32_from_float16_groups", "as", "a", "memory", "optimization", "to", "reduce", "...
def zero_grad(self, set_to_none=True): """We only need to zero the model related parameters, i.e., float16_groups & fp32_from_fp32_groups. We additionally zero fp32_from_float16_groups as a memory optimization to reduce fragmentation; in the case of set_to_none==True, the space u...
[ "def", "zero_grad", "(", "self", ",", "set_to_none", "=", "True", ")", ":", "for", "group", "in", "self", ".", "float16_groups", ":", "_zero_grad_group_helper", "(", "group", ",", "set_to_none", ")", "for", "group", "in", "self", ".", "fp32_from_float16_groups...
https://github.com/NVIDIA/Megatron-LM/blob/9a8b89acd8f6ba096860170d0e30ddc0bc2bacd4/megatron/optimizer/optimizer.py#L290-L301
bokeh/bokeh
a00e59da76beb7b9f83613533cfd3aced1df5f06
examples/howto/events_app.py
python
display_event
(div, attributes=[])
return CustomJS(args=dict(div=div), code=""" const {to_string} = Bokeh.require("core/util/pretty") const attrs = %s; const args = []; for (let i = 0; i<attrs.length; i++ ) { const val = to_string(cb_obj[attrs[i]], {precision: 2}) args.push(attrs[i] + '=' + val) ...
Function to build a suitable CustomJS to display the current event in the div model.
Function to build a suitable CustomJS to display the current event in the div model.
[ "Function", "to", "build", "a", "suitable", "CustomJS", "to", "display", "the", "current", "event", "in", "the", "div", "model", "." ]
def display_event(div, attributes=[]): """ Function to build a suitable CustomJS to display the current event in the div model. """ style = 'float: left; clear: left; font-size: 13px' return CustomJS(args=dict(div=div), code=""" const {to_string} = Bokeh.require("core/util/pretty") ...
[ "def", "display_event", "(", "div", ",", "attributes", "=", "[", "]", ")", ":", "style", "=", "'float: left; clear: left; font-size: 13px'", "return", "CustomJS", "(", "args", "=", "dict", "(", "div", "=", "div", ")", ",", "code", "=", "\"\"\"\n const {...
https://github.com/bokeh/bokeh/blob/a00e59da76beb7b9f83613533cfd3aced1df5f06/examples/howto/events_app.py#L16-L36
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/_pyio.py
python
BytesIO.getbuffer
(self)
return memoryview(self._buffer)
Return a readable and writable view of the buffer.
Return a readable and writable view of the buffer.
[ "Return", "a", "readable", "and", "writable", "view", "of", "the", "buffer", "." ]
def getbuffer(self): """Return a readable and writable view of the buffer. """ if self.closed: raise ValueError("getbuffer on closed file") return memoryview(self._buffer)
[ "def", "getbuffer", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "\"getbuffer on closed file\"", ")", "return", "memoryview", "(", "self", ".", "_buffer", ")" ]
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/_pyio.py#L926-L931
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/inspect.py
python
getmodulename
(path)
Return the module name for a given file, or None.
Return the module name for a given file, or None.
[ "Return", "the", "module", "name", "for", "a", "given", "file", "or", "None", "." ]
def getmodulename(path): """Return the module name for a given file, or None.""" info = getmoduleinfo(path) if info: return info[0]
[ "def", "getmodulename", "(", "path", ")", ":", "info", "=", "getmoduleinfo", "(", "path", ")", "if", "info", ":", "return", "info", "[", "0", "]" ]
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/inspect.py#L387-L390
jamesli1618/Obj-GAN
44b442ff1a1588bcf7c4855aaca2e6a4c26b10ed
box_generation/seq2seq/loss/loss.py
python
Loss.eval_batch
(self, outputs, target)
Evaluate and accumulate loss given outputs and expected results. This method is called after each batch with the batch outputs and the target (expected) results. The loss and normalization term are accumulated in this method. Override it to define your own accumulation method. ...
Evaluate and accumulate loss given outputs and expected results.
[ "Evaluate", "and", "accumulate", "loss", "given", "outputs", "and", "expected", "results", "." ]
def eval_batch(self, outputs, target): """ Evaluate and accumulate loss given outputs and expected results. This method is called after each batch with the batch outputs and the target (expected) results. The loss and normalization term are accumulated in this method. Override it to d...
[ "def", "eval_batch", "(", "self", ",", "outputs", ",", "target", ")", ":", "raise", "NotImplementedError" ]
https://github.com/jamesli1618/Obj-GAN/blob/44b442ff1a1588bcf7c4855aaca2e6a4c26b10ed/box_generation/seq2seq/loss/loss.py#L64-L76
muricoca/crab
beb355538acc419b82beae3c6845d1e1cff5d26b
scikits/crab/recommenders/knn/base.py
python
ItemRecommender.most_similar_items
(self, item_id, how_many=None)
Return the most similar items to the given item, ordered from most similar to least. Parameters ----------- item_id: int or string ID of item for which to find most similar other items how_many: int Desired number of most similar items to find
Return the most similar items to the given item, ordered from most similar to least.
[ "Return", "the", "most", "similar", "items", "to", "the", "given", "item", "ordered", "from", "most", "similar", "to", "least", "." ]
def most_similar_items(self, item_id, how_many=None): ''' Return the most similar items to the given item, ordered from most similar to least. Parameters ----------- item_id: int or string ID of item for which to find most similar other items how_ma...
[ "def", "most_similar_items", "(", "self", ",", "item_id", ",", "how_many", "=", "None", ")", ":", "raise", "NotImplementedError", "(", "\"ItemRecommender is an abstract class.\"", ")" ]
https://github.com/muricoca/crab/blob/beb355538acc419b82beae3c6845d1e1cff5d26b/scikits/crab/recommenders/knn/base.py#L25-L38
nfvlabs/openmano
b09eabec0a168aeda8adc3ea99f734e45e810205
openvim/httpserver.py
python
http_post_server_action
(tenant_id, server_id)
return http_server_action(server_id, tenant_id, http_content)
take an action over a server
take an action over a server
[ "take", "an", "action", "over", "a", "server" ]
def http_post_server_action(tenant_id, server_id): '''take an action over a server''' my = config_dic['http_threads'][ threading.current_thread().name ] #check valid tenant_id result,content = check_valid_tenant(my, tenant_id) if result != 0: bottle.abort(result, content) return ...
[ "def", "http_post_server_action", "(", "tenant_id", ",", "server_id", ")", ":", "my", "=", "config_dic", "[", "'http_threads'", "]", "[", "threading", ".", "current_thread", "(", ")", ".", "name", "]", "#check valid tenant_id", "result", ",", "content", "=", "...
https://github.com/nfvlabs/openmano/blob/b09eabec0a168aeda8adc3ea99f734e45e810205/openvim/httpserver.py#L1553-L1565
FarMcKon/gitmarks_2
44c04494627c422d85ac3d836715fa9944c779e0
bottle.py
python
Response.bind
(self)
Resets the Response object to its factory defaults.
Resets the Response object to its factory defaults.
[ "Resets", "the", "Response", "object", "to", "its", "factory", "defaults", "." ]
def bind(self): """ Resets the Response object to its factory defaults. """ self._COOKIES = None self.status = 200 self.headers = HeaderDict() self.content_type = 'text/html; charset=UTF-8'
[ "def", "bind", "(", "self", ")", ":", "self", ".", "_COOKIES", "=", "None", "self", ".", "status", "=", "200", "self", ".", "headers", "=", "HeaderDict", "(", ")", "self", ".", "content_type", "=", "'text/html; charset=UTF-8'" ]
https://github.com/FarMcKon/gitmarks_2/blob/44c04494627c422d85ac3d836715fa9944c779e0/bottle.py#L895-L900
ufal/neuralmonkey
8b1465270f6bb28d5417a85cec492f7179036ede
neuralmonkey/nn/noisy_gru_cell.py
python
noisy_activation
(x, generic, linearized, training, alpha: float = 1.1, c: float = 0.5)
return activation
Apply the noisy activation. Implements the noisy activation with Half-Normal Noise for Hard-Saturation functions. See http://arxiv.org/abs/1603.00391, Algorithm 1. Args: x: Tensor which is an input to the activation function generic: The generic formulation of the activation functio...
Apply the noisy activation.
[ "Apply", "the", "noisy", "activation", "." ]
def noisy_activation(x, generic, linearized, training, alpha: float = 1.1, c: float = 0.5): """Apply the noisy activation. Implements the noisy activation with Half-Normal Noise for Hard-Saturation functions. See http://arxiv.org/abs/1603.00391, Algorithm 1. Args: x:...
[ "def", "noisy_activation", "(", "x", ",", "generic", ",", "linearized", ",", "training", ",", "alpha", ":", "float", "=", "1.1", ",", "c", ":", "float", "=", "0.5", ")", ":", "# pylint: disable=invalid-unary-operand-type", "# to enable 'minus tf.Tensor'", "delta",...
https://github.com/ufal/neuralmonkey/blob/8b1465270f6bb28d5417a85cec492f7179036ede/neuralmonkey/nn/noisy_gru_cell.py#L48-L89
google-research/rigl
f18abc7d82ae3acc6736068408a0186c9efa575c
rigl/experimental/jax/datasets/mnist.py
python
MNISTDataset.preprocess
( self, data)
return data
Normalizes MNIST images: `uint8` -> `float32`. Args: data: Data sample. Returns: Data after being augmented/normalized/transformed.
Normalizes MNIST images: `uint8` -> `float32`.
[ "Normalizes", "MNIST", "images", ":", "uint8", "-", ">", "float32", "." ]
def preprocess( self, data): """Normalizes MNIST images: `uint8` -> `float32`. Args: data: Data sample. Returns: Data after being augmented/normalized/transformed. """ data = super().preprocess(data) data['image'] = (tf.cast(data['image'], tf.float32) / 255.) - 0.5 return d...
[ "def", "preprocess", "(", "self", ",", "data", ")", ":", "data", "=", "super", "(", ")", ".", "preprocess", "(", "data", ")", "data", "[", "'image'", "]", "=", "(", "tf", ".", "cast", "(", "data", "[", "'image'", "]", ",", "tf", ".", "float32", ...
https://github.com/google-research/rigl/blob/f18abc7d82ae3acc6736068408a0186c9efa575c/rigl/experimental/jax/datasets/mnist.py#L55-L67
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/splom/marker/_colorbar.py
python
ColorBar.ypad
(self)
return self["ypad"]
Sets the amount of padding (in px) along the y direction. The 'ypad' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the amount of padding (in px) along the y direction. The 'ypad' property is a number and may be specified as: - An int or float in the interval [0, inf]
[ "Sets", "the", "amount", "of", "padding", "(", "in", "px", ")", "along", "the", "y", "direction", ".", "The", "ypad", "property", "is", "a", "number", "and", "may", "be", "specified", "as", ":", "-", "An", "int", "or", "float", "in", "the", "interval...
def ypad(self): """ Sets the amount of padding (in px) along the y direction. The 'ypad' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["ypad"]
[ "def", "ypad", "(", "self", ")", ":", "return", "self", "[", "\"ypad\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/splom/marker/_colorbar.py#L1371-L1382
emesene/emesene
4548a4098310e21b16437bb36223a7f632a4f7bc
emesene/e3/papylib/papyon/papyon/sip/core.py
python
SIPCore.answer
(self, request, status, tag=None, extra_headers={}, content=None)
return self.send(response)
Create response with given status and send to transaction layer.
Create response with given status and send to transaction layer.
[ "Create", "response", "with", "given", "status", "and", "send", "to", "transaction", "layer", "." ]
def answer(self, request, status, tag=None, extra_headers={}, content=None): """Create response with given status and send to transaction layer.""" response = self.create_response(request, status, tag=tag) for (name, value) in extra_headers: response.add_header(name, value) i...
[ "def", "answer", "(", "self", ",", "request", ",", "status", ",", "tag", "=", "None", ",", "extra_headers", "=", "{", "}", ",", "content", "=", "None", ")", ":", "response", "=", "self", ".", "create_response", "(", "request", ",", "status", ",", "ta...
https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/papylib/papyon/papyon/sip/core.py#L98-L105
joxeankoret/pyew
8eb3e49a9bf57c0787fa79ecae0671129ef3f2e8
vtrace/util.py
python
TraceManager.fireLocalNotifiers
(self, event, trace)
Deliver a local event to the DistributedNotifier managing the traces. (used to locally bump notifiers)
Deliver a local event to the DistributedNotifier managing the traces. (used to locally bump notifiers)
[ "Deliver", "a", "local", "event", "to", "the", "DistributedNotifier", "managing", "the", "traces", ".", "(", "used", "to", "locally", "bump", "notifiers", ")" ]
def fireLocalNotifiers(self, event, trace): """ Deliver a local event to the DistributedNotifier managing the traces. (used to locally bump notifiers) """ self.dnotif.notify(event, trace)
[ "def", "fireLocalNotifiers", "(", "self", ",", "event", ",", "trace", ")", ":", "self", ".", "dnotif", ".", "notify", "(", "event", ",", "trace", ")" ]
https://github.com/joxeankoret/pyew/blob/8eb3e49a9bf57c0787fa79ecae0671129ef3f2e8/vtrace/util.py#L72-L77
facebookincubator/submitit
e37899bce0c7c58e3cc46ecb5b7fa8ce941fc3d7
submitit/slurm/slurm.py
python
SlurmExecutor._internal_update_parameters
(self, **kwargs: Any)
Updates sbatch submission file parameters Parameters ---------- See slurm documentation for most parameters. Most useful parameters are: time, mem, gpus_per_node, cpus_per_task, partition Below are the parameters that differ from slurm documentation: signal_delay_s: int...
Updates sbatch submission file parameters
[ "Updates", "sbatch", "submission", "file", "parameters" ]
def _internal_update_parameters(self, **kwargs: Any) -> None: """Updates sbatch submission file parameters Parameters ---------- See slurm documentation for most parameters. Most useful parameters are: time, mem, gpus_per_node, cpus_per_task, partition Below are the para...
[ "def", "_internal_update_parameters", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "defaults", "=", "_get_default_parameters", "(", ")", "in_valid_parameters", "=", "sorted", "(", "set", "(", "kwargs", ")", "-", "set", "(", "de...
https://github.com/facebookincubator/submitit/blob/e37899bce0c7c58e3cc46ecb5b7fa8ce941fc3d7/submitit/slurm/slurm.py#L271-L307
flipkart-incubator/watchdog
295eb5ea8ad9973591e1afffd5a0f7f5bffafa81
Tools/wapiti-2.3.0/wapitiCore/net/crawlerpersister.py
python
CrawlerPersister.saveXML
(self, fileName)
Exports the crawler parameters to an XML file. @param fileName The file where is loaded the crawler data
Exports the crawler parameters to an XML file.
[ "Exports", "the", "crawler", "parameters", "to", "an", "XML", "file", "." ]
def saveXML(self, fileName): """ Exports the crawler parameters to an XML file. @param fileName The file where is loaded the crawler data """ xml = Document() root = xml.createElement("root") xml.appendChild(root) rootUrlEl = xml.createElement(self.ROOT_U...
[ "def", "saveXML", "(", "self", ",", "fileName", ")", ":", "xml", "=", "Document", "(", ")", "root", "=", "xml", ".", "createElement", "(", "\"root\"", ")", "xml", ".", "appendChild", "(", "root", ")", "rootUrlEl", "=", "xml", ".", "createElement", "(",...
https://github.com/flipkart-incubator/watchdog/blob/295eb5ea8ad9973591e1afffd5a0f7f5bffafa81/Tools/wapiti-2.3.0/wapitiCore/net/crawlerpersister.py#L89-L204
gxcuizy/Python
72167d12439a615a8fd4b935eae1fb6516ed4e69
自动登陆邮箱/login.py
python
LoginMail.login_outlook
(self, account, pwd)
登陆微软Outlook邮箱
登陆微软Outlook邮箱
[ "登陆微软Outlook邮箱" ]
def login_outlook(self, account, pwd): """登陆微软Outlook邮箱""" try: self.driver = webdriver.Chrome(executable_path=self.chrome_driver, chrome_options=self.chrome_option) self.driver.maximize_window() self.driver.get(self.outlook_url) time.sleep(1) ...
[ "def", "login_outlook", "(", "self", ",", "account", ",", "pwd", ")", ":", "try", ":", "self", ".", "driver", "=", "webdriver", ".", "Chrome", "(", "executable_path", "=", "self", ".", "chrome_driver", ",", "chrome_options", "=", "self", ".", "chrome_optio...
https://github.com/gxcuizy/Python/blob/72167d12439a615a8fd4b935eae1fb6516ed4e69/自动登陆邮箱/login.py#L105-L123
google/brain-tokyo-workshop
faf12f6bbae773fbe535c7a6cf357dc662c6c1d8
WANNRelease/prettyNeatWann/neat_train.py
python
checkBest
(data)
return data
Checks better performing individual if it performs over many trials. Test a new 'best' individual with many different seeds to see if it really outperforms the current best. Args: data - (DataGatherer) - collected run data Return: data - (DataGatherer) - collected run data with best individual updated...
Checks better performing individual if it performs over many trials. Test a new 'best' individual with many different seeds to see if it really outperforms the current best.
[ "Checks", "better", "performing", "individual", "if", "it", "performs", "over", "many", "trials", ".", "Test", "a", "new", "best", "individual", "with", "many", "different", "seeds", "to", "see", "if", "it", "really", "outperforms", "the", "current", "best", ...
def checkBest(data): """Checks better performing individual if it performs over many trials. Test a new 'best' individual with many different seeds to see if it really outperforms the current best. Args: data - (DataGatherer) - collected run data Return: data - (DataGatherer) - collected run data wi...
[ "def", "checkBest", "(", "data", ")", ":", "global", "filename", ",", "hyp", "if", "data", ".", "newBest", "is", "True", ":", "bestReps", "=", "max", "(", "hyp", "[", "'bestReps'", "]", ",", "(", "nWorker", "-", "1", ")", ")", "rep", "=", "np", "...
https://github.com/google/brain-tokyo-workshop/blob/faf12f6bbae773fbe535c7a6cf357dc662c6c1d8/WANNRelease/prettyNeatWann/neat_train.py#L71-L100
ahmetcemturan/SFACT
7576e29ba72b33e5058049b77b7b558875542747
skeinforge_application/skeinforge_plugins/craft_plugins/lash.py
python
LashSkein.getCraftedGcode
( self, gcodeText, lashRepository )
return self.distanceFeedRate.output.getvalue()
Parse gcode text and store the lash gcode.
Parse gcode text and store the lash gcode.
[ "Parse", "gcode", "text", "and", "store", "the", "lash", "gcode", "." ]
def getCraftedGcode( self, gcodeText, lashRepository ): "Parse gcode text and store the lash gcode." self.lines = archive.getTextLines(gcodeText) self.lashRepository = lashRepository self.xBacklash = lashRepository.xBacklash.value self.yBacklash = lashRepository.yBacklash.value self.parseInitialization() ...
[ "def", "getCraftedGcode", "(", "self", ",", "gcodeText", ",", "lashRepository", ")", ":", "self", ".", "lines", "=", "archive", ".", "getTextLines", "(", "gcodeText", ")", "self", ".", "lashRepository", "=", "lashRepository", "self", ".", "xBacklash", "=", "...
https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/lash.py#L112-L122
allenai/allennlp
a3d71254fcc0f3615910e9c3d48874515edf53e0
allennlp/common/logging.py
python
prepare_global_logging
( serialization_dir: Union[str, PathLike], rank: int = 0, world_size: int = 1, )
[]
def prepare_global_logging( serialization_dir: Union[str, PathLike], rank: int = 0, world_size: int = 1, ) -> None: root_logger = logging.getLogger() # create handlers if world_size == 1: log_file = os.path.join(serialization_dir, "out.log") formatter = logging.Formatter("%(asct...
[ "def", "prepare_global_logging", "(", "serialization_dir", ":", "Union", "[", "str", ",", "PathLike", "]", ",", "rank", ":", "int", "=", "0", ",", "world_size", ":", "int", "=", "1", ",", ")", "->", "None", ":", "root_logger", "=", "logging", ".", "get...
https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/common/logging.py#L70-L132
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/smtplib.py
python
SMTP.close
(self)
Close the connection to the SMTP server.
Close the connection to the SMTP server.
[ "Close", "the", "connection", "to", "the", "SMTP", "server", "." ]
def close(self): """Close the connection to the SMTP server.""" if self.file: self.file.close() self.file = None if self.sock: self.sock.close() self.sock = None
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "file", ":", "self", ".", "file", ".", "close", "(", ")", "self", ".", "file", "=", "None", "if", "self", ".", "sock", ":", "self", ".", "sock", ".", "close", "(", ")", "self", ".", "s...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/smtplib.py#L733-L740
xiepaup/dbatools
8549f2571aaee6a39f5c6f32179ac9c5d301a9aa
mysqlTools/mysql_utilities/mysql/utilities/common/tools.py
python
show_file_statistics
(file_name, wild=False, out_format="GRID")
Show file statistics for file name specified file_name[in] target file name and path wild[in] if True, get file statistics for all files with prefix of file_name. Default is False out_format[in] output format to print file statistics. Default is GRID.
Show file statistics for file name specified
[ "Show", "file", "statistics", "for", "file", "name", "specified" ]
def show_file_statistics(file_name, wild=False, out_format="GRID"): """Show file statistics for file name specified file_name[in] target file name and path wild[in] if True, get file statistics for all files with prefix of file_name. Default is False out_format[in] out...
[ "def", "show_file_statistics", "(", "file_name", ",", "wild", "=", "False", ",", "out_format", "=", "\"GRID\"", ")", ":", "def", "_get_file_stats", "(", "path", ",", "file_name", ")", ":", "stats", "=", "os", ".", "stat", "(", "os", ".", "path", ".", "...
https://github.com/xiepaup/dbatools/blob/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/utilities/common/tools.py#L235-L260
justdark/dml
4a547a26a171262a869b18e56e8e2abdd4c8c8ed
build/lib/dml/CLUSTER/hierarchicalCluster.py
python
HierarchicalClusterC.__init__
(self,X,option='complete',measure=None)
[]
def __init__(self,X,option='complete',measure=None): if measure==None: self.measure=EuclidDistance_dml_hiC else: self.measure=measure if str(option)=='single': self.pdist=lambda a,b:HiSmallest(a,b,self.measure) elif str(option)=='complete': self.pdist=lambda a,b:HiLargest(a,b,self.measure) elif s...
[ "def", "__init__", "(", "self", ",", "X", ",", "option", "=", "'complete'", ",", "measure", "=", "None", ")", ":", "if", "measure", "==", "None", ":", "self", ".", "measure", "=", "EuclidDistance_dml_hiC", "else", ":", "self", ".", "measure", "=", "mea...
https://github.com/justdark/dml/blob/4a547a26a171262a869b18e56e8e2abdd4c8c8ed/build/lib/dml/CLUSTER/hierarchicalCluster.py#L53-L76
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/Lib/email/message.py
python
Message.set_param
(self, param, value, header='Content-Type', requote=True, charset=None, language='')
Set a parameter in the Content-Type header. If the parameter already exists in the header, its value will be replaced with the new value. If header is Content-Type and has not yet been defined for this message, it will be set to "text/plain" and the new parameter and value will...
Set a parameter in the Content-Type header.
[ "Set", "a", "parameter", "in", "the", "Content", "-", "Type", "header", "." ]
def set_param(self, param, value, header='Content-Type', requote=True, charset=None, language=''): """Set a parameter in the Content-Type header. If the parameter already exists in the header, its value will be replaced with the new value. If header is Content-Type an...
[ "def", "set_param", "(", "self", ",", "param", ",", "value", ",", "header", "=", "'Content-Type'", ",", "requote", "=", "True", ",", "charset", "=", "None", ",", "language", "=", "''", ")", ":", "if", "not", "isinstance", "(", "value", ",", "tuple", ...
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/email/message.py#L571-L617
imagr/imagr
e54bcf3f0f951babcd2fa153de2dd8556aa3506d
Imagr/gmacpyutil/gmacpyutil.py
python
GetPlist
(plist)
Returns a dictionary from a given plist. Args: plist: plist to operate on Returns: Contents of the plist as a dict-like object. Raises: MissingImportsError: if NSDictionary is missing
Returns a dictionary from a given plist.
[ "Returns", "a", "dictionary", "from", "a", "given", "plist", "." ]
def GetPlist(plist): """Returns a dictionary from a given plist. Args: plist: plist to operate on Returns: Contents of the plist as a dict-like object. Raises: MissingImportsError: if NSDictionary is missing """ if NSDictionary: return NSDictionary.dictionaryWithContentsOfFile_(plist) els...
[ "def", "GetPlist", "(", "plist", ")", ":", "if", "NSDictionary", ":", "return", "NSDictionary", ".", "dictionaryWithContentsOfFile_", "(", "plist", ")", "else", ":", "raise", "MissingImportsError", "(", "'NSDictionary not imported successfully.'", ")" ]
https://github.com/imagr/imagr/blob/e54bcf3f0f951babcd2fa153de2dd8556aa3506d/Imagr/gmacpyutil/gmacpyutil.py#L629-L642
dateutil/dateutil
83ec82cb5e032ab31e5aae49902cf61be38ddfc2
src/dateutil/tz/tz.py
python
_datetime_to_timestamp
(dt)
return (dt.replace(tzinfo=None) - EPOCH).total_seconds()
Convert a :class:`datetime.datetime` object to an epoch timestamp in seconds since January 1, 1970, ignoring the time zone.
Convert a :class:`datetime.datetime` object to an epoch timestamp in seconds since January 1, 1970, ignoring the time zone.
[ "Convert", "a", ":", "class", ":", "datetime", ".", "datetime", "object", "to", "an", "epoch", "timestamp", "in", "seconds", "since", "January", "1", "1970", "ignoring", "the", "time", "zone", "." ]
def _datetime_to_timestamp(dt): """ Convert a :class:`datetime.datetime` object to an epoch timestamp in seconds since January 1, 1970, ignoring the time zone. """ return (dt.replace(tzinfo=None) - EPOCH).total_seconds()
[ "def", "_datetime_to_timestamp", "(", "dt", ")", ":", "return", "(", "dt", ".", "replace", "(", "tzinfo", "=", "None", ")", "-", "EPOCH", ")", ".", "total_seconds", "(", ")" ]
https://github.com/dateutil/dateutil/blob/83ec82cb5e032ab31e5aae49902cf61be38ddfc2/src/dateutil/tz/tz.py#L1809-L1814
GNOME/gnome-music
b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e
gnomemusic/grilowrappers/grltrackerwrapper.py
python
GrlTrackerWrapper._check_artist_change
(self)
[]
def _check_artist_change(self) -> None: artist_ids: Dict[str, CoreArtist] = {} query = """ SELECT ?type ?id ?artist WHERE { SERVICE <dbus:%(miner_fs_busname)s> { GRAPH tracker:Audio { SELECT %(media_type)s AS ?type ...
[ "def", "_check_artist_change", "(", "self", ")", "->", "None", ":", "artist_ids", ":", "Dict", "[", "str", ",", "CoreArtist", "]", "=", "{", "}", "query", "=", "\"\"\"\n SELECT ?type ?id ?artist\n WHERE {\n SERVICE <dbus:%(miner_fs_busname)s> {\n ...
https://github.com/GNOME/gnome-music/blob/b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e/gnomemusic/grilowrappers/grltrackerwrapper.py#L320-L393
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Engine/Devices/editable_device.py
python
EditableDevice.__init__
(self, name, active: bool, device_type: DeviceType, editable_headers: Dict[str, GCProp], non_editable_attributes: List[str], properties_with_profile: Dict[str, Optional[Any]], idtag=None, code='')
Class to generalize any editable device :param name: Asset's name :param active: is active :param editable_headers: dictionary of header properties {'magnitude': (unit, type)} :param device_type: DeviceType instance :param non_editable_attributes: list of non editable magnitudes ...
Class to generalize any editable device :param name: Asset's name :param active: is active :param editable_headers: dictionary of header properties {'magnitude': (unit, type)} :param device_type: DeviceType instance :param non_editable_attributes: list of non editable magnitudes ...
[ "Class", "to", "generalize", "any", "editable", "device", ":", "param", "name", ":", "Asset", "s", "name", ":", "param", "active", ":", "is", "active", ":", "param", "editable_headers", ":", "dictionary", "of", "header", "properties", "{", "magnitude", ":", ...
def __init__(self, name, active: bool, device_type: DeviceType, editable_headers: Dict[str, GCProp], non_editable_attributes: List[str], properties_with_profile: Dict[str, Optional[Any]], idtag=None, code=''): """ Class to generalize an...
[ "def", "__init__", "(", "self", ",", "name", ",", "active", ":", "bool", ",", "device_type", ":", "DeviceType", ",", "editable_headers", ":", "Dict", "[", "str", ",", "GCProp", "]", ",", "non_editable_attributes", ":", "List", "[", "str", "]", ",", "prop...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/Devices/editable_device.py#L48-L87
pyscf/pyscf
0adfb464333f5ceee07b664f291d4084801bae64
pyscf/pbc/mp/kmp2.py
python
get_nmo
(mp, per_kpoint=False)
return nmo
Number of orbitals for k-point calculations. Number of orbitals for use in a calculation with k-points, taking into account frozen orbitals. Note: If `per_kpoint` is False, then the number of orbitals here is equal to max(nocc) + max(nvir), where each max is done over all k-points. Otherw...
Number of orbitals for k-point calculations.
[ "Number", "of", "orbitals", "for", "k", "-", "point", "calculations", "." ]
def get_nmo(mp, per_kpoint=False): '''Number of orbitals for k-point calculations. Number of orbitals for use in a calculation with k-points, taking into account frozen orbitals. Note: If `per_kpoint` is False, then the number of orbitals here is equal to max(nocc) + max(nvir), where e...
[ "def", "get_nmo", "(", "mp", ",", "per_kpoint", "=", "False", ")", ":", "if", "mp", ".", "_nmo", "is", "not", "None", ":", "return", "mp", ".", "_nmo", "if", "mp", ".", "frozen", "is", "None", ":", "nmo", "=", "[", "len", "(", "mp", ".", "mo_oc...
https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/pbc/mp/kmp2.py#L452-L505
HazyResearch/metal
b54631e9b94a3dcf55f6043c53ec181e12f29eb1
metal/end_model/end_model.py
python
EndModel.update_config
(self, update_dict)
Updates self.config with the values in a given update dictionary
Updates self.config with the values in a given update dictionary
[ "Updates", "self", ".", "config", "with", "the", "values", "in", "a", "given", "update", "dictionary" ]
def update_config(self, update_dict): """Updates self.config with the values in a given update dictionary""" self.config = recursive_merge_dicts(self.config, update_dict)
[ "def", "update_config", "(", "self", ",", "update_dict", ")", ":", "self", ".", "config", "=", "recursive_merge_dicts", "(", "self", ".", "config", ",", "update_dict", ")" ]
https://github.com/HazyResearch/metal/blob/b54631e9b94a3dcf55f6043c53ec181e12f29eb1/metal/end_model/end_model.py#L175-L177
daoluan/decode-Django
d46a858b45b56de48b0355f50dd9e45402d04cfd
Django-1.5.1/django/contrib/sessions/backends/base.py
python
SessionBase.get_expiry_date
(self, **kwargs)
return modification + timedelta(seconds=expiry)
Get session the expiry date (as a datetime object). Optionally, this function accepts `modification` and `expiry` keyword arguments specifying the modification and expiry of the session.
Get session the expiry date (as a datetime object).
[ "Get", "session", "the", "expiry", "date", "(", "as", "a", "datetime", "object", ")", "." ]
def get_expiry_date(self, **kwargs): """Get session the expiry date (as a datetime object). Optionally, this function accepts `modification` and `expiry` keyword arguments specifying the modification and expiry of the session. """ try: modification = kwargs['modifica...
[ "def", "get_expiry_date", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "modification", "=", "kwargs", "[", "'modification'", "]", "except", "KeyError", ":", "modification", "=", "timezone", ".", "now", "(", ")", "# Same comment as in get_expiry_...
https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/contrib/sessions/backends/base.py#L198-L218
minimaxir/gpt-2-simple
d1e97f580cfbd53eee95066c7efed8d4476de943
gpt_2_simple/gpt_2.py
python
is_mounted
()
Checks if the Google Drive is mounted.
Checks if the Google Drive is mounted.
[ "Checks", "if", "the", "Google", "Drive", "is", "mounted", "." ]
def is_mounted(): """Checks if the Google Drive is mounted.""" assert os.path.isdir('/content/drive'), "You must mount first using mount_gdrive()"
[ "def", "is_mounted", "(", ")", ":", "assert", "os", ".", "path", ".", "isdir", "(", "'/content/drive'", ")", ",", "\"You must mount first using mount_gdrive()\"" ]
https://github.com/minimaxir/gpt-2-simple/blob/d1e97f580cfbd53eee95066c7efed8d4476de943/gpt_2_simple/gpt_2.py#L564-L566
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/tornado/web.py
python
StaticFileHandler.set_extra_headers
(self, path: str)
For subclass to add extra headers to the response
For subclass to add extra headers to the response
[ "For", "subclass", "to", "add", "extra", "headers", "to", "the", "response" ]
def set_extra_headers(self, path: str) -> None: """For subclass to add extra headers to the response""" pass
[ "def", "set_extra_headers", "(", "self", ",", "path", ":", "str", ")", "->", "None", ":", "pass" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tornado/web.py#L2901-L2903
udacity/ud330
fc0cf20871b64bc252179e1a3cca17d0224de3d5
Lesson2/step7/project.py
python
newMenuItem
(restaurant_id)
[]
def newMenuItem(restaurant_id): if 'username' not in login_session: return redirect('/login') restaurant = session.query(Restaurant).filter_by(id=restaurant_id).one() if request.method == 'POST': newItem = MenuItem(name=request.form['name'], description=request.form[ ...
[ "def", "newMenuItem", "(", "restaurant_id", ")", ":", "if", "'username'", "not", "in", "login_session", ":", "return", "redirect", "(", "'/login'", ")", "restaurant", "=", "session", ".", "query", "(", "Restaurant", ")", ".", "filter_by", "(", "id", "=", "...
https://github.com/udacity/ud330/blob/fc0cf20871b64bc252179e1a3cca17d0224de3d5/Lesson2/step7/project.py#L247-L259
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/internet/process.py
python
_BaseProcess._fork
(self, path, uid, gid, executable, args, environment, **kwargs)
Fork and then exec sub-process. @param path: the path where to run the new process. @type path: L{bytes} or L{unicode} @param uid: if defined, the uid used to run the new process. @type uid: L{int} @param gid: if defined, the gid used to run the new process. @type gid: L...
Fork and then exec sub-process.
[ "Fork", "and", "then", "exec", "sub", "-", "process", "." ]
def _fork(self, path, uid, gid, executable, args, environment, **kwargs): """ Fork and then exec sub-process. @param path: the path where to run the new process. @type path: L{bytes} or L{unicode} @param uid: if defined, the uid used to run the new process. @type uid: L{...
[ "def", "_fork", "(", "self", ",", "path", ",", "uid", ",", "gid", ",", "executable", ",", "args", ",", "environment", ",", "*", "*", "kwargs", ")", ":", "collectorEnabled", "=", "gc", ".", "isenabled", "(", ")", "gc", ".", "disable", "(", ")", "try...
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/internet/process.py#L352-L445
wbond/package_control
cfaaeb57612023e3679ecb7f8cd7ceac9f57990d
package_control/deps/oscrypto/_mac/tls.py
python
TLSSocket.close
(self)
Shuts down the TLS session and socket and forcibly closes it
Shuts down the TLS session and socket and forcibly closes it
[ "Shuts", "down", "the", "TLS", "session", "and", "socket", "and", "forcibly", "closes", "it" ]
def close(self): """ Shuts down the TLS session and socket and forcibly closes it """ try: self.shutdown() finally: if self._socket: try: self._socket.close() except (socket_.error): ...
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "shutdown", "(", ")", "finally", ":", "if", "self", ".", "_socket", ":", "try", ":", "self", ".", "_socket", ".", "close", "(", ")", "except", "(", "socket_", ".", "error", ")", ":",...
https://github.com/wbond/package_control/blob/cfaaeb57612023e3679ecb7f8cd7ceac9f57990d/package_control/deps/oscrypto/_mac/tls.py#L1322-L1339
openrazer/openrazer
1615f8516e8014bad7f78c781c91e6529679718f
pylib/openrazer/client/devices/__init__.py
python
RazerDevice.keyboard_layout
(self)
return self._kbd_layout
Device's keyboard layout :return: Keyboard layout :rtype: str
Device's keyboard layout
[ "Device", "s", "keyboard", "layout" ]
def keyboard_layout(self) -> str: """ Device's keyboard layout :return: Keyboard layout :rtype: str """ return self._kbd_layout
[ "def", "keyboard_layout", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_kbd_layout" ]
https://github.com/openrazer/openrazer/blob/1615f8516e8014bad7f78c781c91e6529679718f/pylib/openrazer/client/devices/__init__.py#L342-L349