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
iclavera/learning_to_adapt
bd7d99ba402521c96631e7d09714128f549db0f1
learning_to_adapt/spaces/box.py
python
Box.__init__
(self, low, high, shape=None)
Two kinds of valid input: Box(-1.0, 1.0, (3,4)) # low and high are scalars, and shape is provided Box(np.array([-1.0,-2.0]), np.array([2.0,4.0])) # low and high are arrays of the same shape
Two kinds of valid input: Box(-1.0, 1.0, (3,4)) # low and high are scalars, and shape is provided Box(np.array([-1.0,-2.0]), np.array([2.0,4.0])) # low and high are arrays of the same shape
[ "Two", "kinds", "of", "valid", "input", ":", "Box", "(", "-", "1", ".", "0", "1", ".", "0", "(", "3", "4", "))", "#", "low", "and", "high", "are", "scalars", "and", "shape", "is", "provided", "Box", "(", "np", ".", "array", "(", "[", "-", "1"...
def __init__(self, low, high, shape=None): """ Two kinds of valid input: Box(-1.0, 1.0, (3,4)) # low and high are scalars, and shape is provided Box(np.array([-1.0,-2.0]), np.array([2.0,4.0])) # low and high are arrays of the same shape """ if shape is None: ...
[ "def", "__init__", "(", "self", ",", "low", ",", "high", ",", "shape", "=", "None", ")", ":", "if", "shape", "is", "None", ":", "assert", "low", ".", "shape", "==", "high", ".", "shape", "self", ".", "low", "=", "low", "self", ".", "high", "=", ...
https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/spaces/box.py#L11-L24
DeepLabCut/DeepLabCut
1dd14c54729ae0d8e66ca495aa5baeb83502e1c7
deeplabcut/gui/multiple_individuals_labeling_toolbox.py
python
MainFrame.onClick
(self, event)
This function adds labels and auto advances to the next label.
This function adds labels and auto advances to the next label.
[ "This", "function", "adds", "labels", "and", "auto", "advances", "to", "the", "next", "label", "." ]
def onClick(self, event): """ This function adds labels and auto advances to the next label. """ x1 = event.xdata y1 = event.ydata if event.button == 3: num_indiv = self.individualrdb.GetSelection() indiv = self.individual_names[num_indiv] ...
[ "def", "onClick", "(", "self", ",", "event", ")", ":", "x1", "=", "event", ".", "xdata", "y1", "=", "event", ".", "ydata", "if", "event", ".", "button", "==", "3", ":", "num_indiv", "=", "self", ".", "individualrdb", ".", "GetSelection", "(", ")", ...
https://github.com/DeepLabCut/DeepLabCut/blob/1dd14c54729ae0d8e66ca495aa5baeb83502e1c7/deeplabcut/gui/multiple_individuals_labeling_toolbox.py#L562-L697
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
plexpy/webserve.py
python
WebInterface.get_server_update_params
(self, **kwargs)
return {'plexpass': plexpass, 'pms_platform': common.PMS_PLATFORM_NAME_OVERRIDES.get( plexpy.CONFIG.PMS_PLATFORM, plexpy.CONFIG.PMS_PLATFORM), 'pms_update_channel': plexpy.CONFIG.PMS_UPDATE_CHANNEL, 'pms_update_distro': plexpy.CONFIG.PMS_UPDATE_DISTRO,...
[]
def get_server_update_params(self, **kwargs): plex_tv = plextv.PlexTV() plexpass = plex_tv.get_plexpass_status() update_channel = pmsconnect.PmsConnect().get_server_update_channel() return {'plexpass': plexpass, 'pms_platform': common.PMS_PLATFORM_NAME_OVERRIDES.get( ...
[ "def", "get_server_update_params", "(", "self", ",", "*", "*", "kwargs", ")", ":", "plex_tv", "=", "plextv", ".", "PlexTV", "(", ")", "plexpass", "=", "plex_tv", ".", "get_plexpass_status", "(", ")", "update_channel", "=", "pmsconnect", ".", "PmsConnect", "(...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/webserve.py#L3454-L3466
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/boto/sqs/connection.py
python
SQSConnection.set_queue_attribute
(self, queue, attribute, value)
return self.get_status('SetQueueAttributes', params, queue.id)
Set a new value for an attribute of a Queue. :type queue: A Queue object :param queue: The SQS queue to get attributes for :type attribute: String :param attribute: The name of the attribute you want to set. :param value: The new value for the attribute must be: *...
Set a new value for an attribute of a Queue.
[ "Set", "a", "new", "value", "for", "an", "attribute", "of", "a", "Queue", "." ]
def set_queue_attribute(self, queue, attribute, value): """ Set a new value for an attribute of a Queue. :type queue: A Queue object :param queue: The SQS queue to get attributes for :type attribute: String :param attribute: The name of the attribute you want to set. ...
[ "def", "set_queue_attribute", "(", "self", ",", "queue", ",", "attribute", ",", "value", ")", ":", "params", "=", "{", "'Attribute.Name'", ":", "attribute", ",", "'Attribute.Value'", ":", "value", "}", "return", "self", ".", "get_status", "(", "'SetQueueAttrib...
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/sqs/connection.py#L160-L221
pikpikcu/Pentest-Tools-Framework
cd6e6107764a809943dc4e073cde8149c1a2cd03
modules/xsser/build/lib/core/threadpool.py
python
_handle_thread_exception
(request, exc_info)
Default exception handler callback function. This just prints the exception info via ``traceback.print_exception``.
Default exception handler callback function.
[ "Default", "exception", "handler", "callback", "function", "." ]
def _handle_thread_exception(request, exc_info): """Default exception handler callback function. This just prints the exception info via ``traceback.print_exception``. """ traceback.print_exception(*exc_info)
[ "def", "_handle_thread_exception", "(", "request", ",", "exc_info", ")", ":", "traceback", ".", "print_exception", "(", "*", "exc_info", ")" ]
https://github.com/pikpikcu/Pentest-Tools-Framework/blob/cd6e6107764a809943dc4e073cde8149c1a2cd03/modules/xsser/build/lib/core/threadpool.py#L95-L101
opencobra/cobrapy
0b9ea70cb0ffe78568d445ce3361ad10ec6b02a2
src/cobra/manipulation/delete.py
python
prune_unused_metabolites
(model: "Model")
return output_model, inactive_metabolites
Remove metabolites not involved in any reactions. Parameters ---------- model: cobra.Model The model to remove unused metabolites from. Returns ------- cobra.Model Input model with unused metabolites removed. list of cobra.Metabolite List of metabolites that were re...
Remove metabolites not involved in any reactions.
[ "Remove", "metabolites", "not", "involved", "in", "any", "reactions", "." ]
def prune_unused_metabolites(model: "Model") -> Tuple["Model", List["Metabolite"]]: """Remove metabolites not involved in any reactions. Parameters ---------- model: cobra.Model The model to remove unused metabolites from. Returns ------- cobra.Model Input model with unused...
[ "def", "prune_unused_metabolites", "(", "model", ":", "\"Model\"", ")", "->", "Tuple", "[", "\"Model\"", ",", "List", "[", "\"Metabolite\"", "]", "]", ":", "output_model", "=", "model", ".", "copy", "(", ")", "inactive_metabolites", "=", "[", "m", "for", "...
https://github.com/opencobra/cobrapy/blob/0b9ea70cb0ffe78568d445ce3361ad10ec6b02a2/src/cobra/manipulation/delete.py#L14-L35
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/point/__init__.py
python
MinutPointEntity.device_info
(self)
return DeviceInfo( connections={ (device_registry.CONNECTION_NETWORK_MAC, device["device_mac"]) }, identifiers={(DOMAIN, device["device_id"])}, manufacturer="Minut", model=f"Point v{device['hardware_version']}", name=device["descrip...
Return a device description for device registry.
Return a device description for device registry.
[ "Return", "a", "device", "description", "for", "device", "registry", "." ]
def device_info(self) -> DeviceInfo: """Return a device description for device registry.""" device = self.device.device return DeviceInfo( connections={ (device_registry.CONNECTION_NETWORK_MAC, device["device_mac"]) }, identifiers={(DOMAIN, dev...
[ "def", "device_info", "(", "self", ")", "->", "DeviceInfo", ":", "device", "=", "self", ".", "device", ".", "device", "return", "DeviceInfo", "(", "connections", "=", "{", "(", "device_registry", ".", "CONNECTION_NETWORK_MAC", ",", "device", "[", "\"device_mac...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/point/__init__.py#L315-L328
atomistic-machine-learning/schnetpack
dacf6076d43509dfd8b6694a846ac8453ae39b5e
src/schnetpack/md/simulation_hooks/sampling.py
python
AcceleratedMD.on_step_middle
(self, simulator)
Compute the bias potential and derivatives and use them to update the current state of :obj:`schnetpack.md.System` in the simulator. While the forces are updated, the bias potential itself is stored in the properties dictionary of the system. Args: simulator (schnetpack.md.S...
Compute the bias potential and derivatives and use them to update the current state of :obj:`schnetpack.md.System` in the simulator. While the forces are updated, the bias potential itself is stored in the properties dictionary of the system.
[ "Compute", "the", "bias", "potential", "and", "derivatives", "and", "use", "them", "to", "update", "the", "current", "state", "of", ":", "obj", ":", "schnetpack", ".", "md", ".", "System", "in", "the", "simulator", ".", "While", "the", "forces", "are", "...
def on_step_middle(self, simulator): """ Compute the bias potential and derivatives and use them to update the current state of :obj:`schnetpack.md.System` in the simulator. While the forces are updated, the bias potential itself is stored in the properties dictionary of the syst...
[ "def", "on_step_middle", "(", "self", ",", "simulator", ")", ":", "energies", ",", "forces", "=", "self", ".", "_get_energies_forces", "(", "simulator", ")", "# Compute bias potential and derivatives", "bias_potential", "=", "self", ".", "_function", "(", "energies"...
https://github.com/atomistic-machine-learning/schnetpack/blob/dacf6076d43509dfd8b6694a846ac8453ae39b5e/src/schnetpack/md/simulation_hooks/sampling.py#L82-L100
aiqm/torchani
258e6c36cf2b35a3a672137ebe30cb923db75952
torchani/neurochem/__init__.py
python
load_model_ensemble
(species, prefix, count)
return Ensemble(models)
Returns an instance of :class:`torchani.Ensemble` loaded from NeuroChem's network directories beginning with the given prefix. Arguments: species (:class:`collections.abc.Sequence`): Sequence of strings for chemical symbols of each supported atom type in correct order. prefix (str):...
Returns an instance of :class:`torchani.Ensemble` loaded from NeuroChem's network directories beginning with the given prefix.
[ "Returns", "an", "instance", "of", ":", "class", ":", "torchani", ".", "Ensemble", "loaded", "from", "NeuroChem", "s", "network", "directories", "beginning", "with", "the", "given", "prefix", "." ]
def load_model_ensemble(species, prefix, count): """Returns an instance of :class:`torchani.Ensemble` loaded from NeuroChem's network directories beginning with the given prefix. Arguments: species (:class:`collections.abc.Sequence`): Sequence of strings for chemical symbols of each sup...
[ "def", "load_model_ensemble", "(", "species", ",", "prefix", ",", "count", ")", ":", "models", "=", "[", "]", "for", "i", "in", "range", "(", "count", ")", ":", "network_dir", "=", "os", ".", "path", ".", "join", "(", "'{}{}'", ".", "format", "(", ...
https://github.com/aiqm/torchani/blob/258e6c36cf2b35a3a672137ebe30cb923db75952/torchani/neurochem/__init__.py#L258-L273
yeephycho/nasnet-tensorflow
189e22f2de9d6ee1b4abd0a65275d5e6a6c04c45
nets/nasnet/nasnet.py
python
build_nasnet_mobile
(images, num_classes, is_training=True, final_endpoint=None)
Build NASNet Mobile model for the ImageNet Dataset.
Build NASNet Mobile model for the ImageNet Dataset.
[ "Build", "NASNet", "Mobile", "model", "for", "the", "ImageNet", "Dataset", "." ]
def build_nasnet_mobile(images, num_classes, is_training=True, final_endpoint=None): """Build NASNet Mobile model for the ImageNet Dataset.""" hparams = _mobile_imagenet_config() if tf.test.is_gpu_available() and hparams.data_format == 'NHWC': tf.logging.info('...
[ "def", "build_nasnet_mobile", "(", "images", ",", "num_classes", ",", "is_training", "=", "True", ",", "final_endpoint", "=", "None", ")", ":", "hparams", "=", "_mobile_imagenet_config", "(", ")", "if", "tf", ".", "test", ".", "is_gpu_available", "(", ")", "...
https://github.com/yeephycho/nasnet-tensorflow/blob/189e22f2de9d6ee1b4abd0a65275d5e6a6c04c45/nets/nasnet/nasnet.py#L326-L370
Juniper/py-junos-eznc
fd81d476e37ac1a234b503ab77f76ec658d04590
lib/jnpr/junos/facts/swver.py
python
provides_facts
()
return {}
Doesn't really provide any facts.
Doesn't really provide any facts.
[ "Doesn", "t", "really", "provide", "any", "facts", "." ]
def provides_facts(): """ Doesn't really provide any facts. """ return {}
[ "def", "provides_facts", "(", ")", ":", "return", "{", "}" ]
https://github.com/Juniper/py-junos-eznc/blob/fd81d476e37ac1a234b503ab77f76ec658d04590/lib/jnpr/junos/facts/swver.py#L101-L105
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/db/sqlmap/thirdparty/odict/odict.py
python
Values.__contains__
(self, item)
return item in self._main.values()
[]
def __contains__(self, item): return item in self._main.values()
[ "def", "__contains__", "(", "self", ",", "item", ")", ":", "return", "item", "in", "self", ".", "_main", ".", "values", "(", ")" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/thirdparty/odict/odict.py#L1135-L1135
pySTEPS/pysteps
bd9478538249e1d64036a721ceb934085d6e1da9
pysteps/verification/lifetime.py
python
lifetime_init
(rule="1/e")
return lifetime
Initialize a lifetime object. Parameters ---------- rule: str {'1/e', 'trapz', 'simpson'}, optional Name of the method to integrate the correlation curve. \n '1/e' uses the 1/e rule and assumes an exponential decay. It linearly interpolates the time when the correlation goes below t...
Initialize a lifetime object.
[ "Initialize", "a", "lifetime", "object", "." ]
def lifetime_init(rule="1/e"): """Initialize a lifetime object. Parameters ---------- rule: str {'1/e', 'trapz', 'simpson'}, optional Name of the method to integrate the correlation curve. \n '1/e' uses the 1/e rule and assumes an exponential decay. It linearly interpolates the ...
[ "def", "lifetime_init", "(", "rule", "=", "\"1/e\"", ")", ":", "list_rules", "=", "[", "\"trapz\"", ",", "\"simpson\"", ",", "\"1/e\"", "]", "if", "rule", "not", "in", "list_rules", ":", "raise", "ValueError", "(", "\"Unknown rule %s for integration.\\n\"", "%",...
https://github.com/pySTEPS/pysteps/blob/bd9478538249e1d64036a721ceb934085d6e1da9/pysteps/verification/lifetime.py#L63-L94
tkuanlun350/3DUnet-Tensorflow-Brats18
8f9e49747ea316d0c6777ab090bdaf7d2f8baf93
eval.py
python
eval_brats
(df, detect_func, with_gt=True)
return ret
evalutation
evalutation
[ "evalutation" ]
def eval_brats(df, detect_func, with_gt=True): """ evalutation """ df.reset_state() gts = [] results = [] with tqdm.tqdm(total=df.size(), **get_tqdm_kwargs()) as pbar: for filename, image_id, data in df.get_data(): final_label, probs = detect_func(data) if con...
[ "def", "eval_brats", "(", "df", ",", "detect_func", ",", "with_gt", "=", "True", ")", ":", "df", ".", "reset_state", "(", ")", "gts", "=", "[", "]", "results", "=", "[", "]", "with", "tqdm", ".", "tqdm", "(", "total", "=", "df", ".", "size", "(",...
https://github.com/tkuanlun350/3DUnet-Tensorflow-Brats18/blob/8f9e49747ea316d0c6777ab090bdaf7d2f8baf93/eval.py#L271-L309
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/threading.py
python
current_thread
()
Return the current Thread object, corresponding to the caller's thread of control. If the caller's thread of control was not created through the threading module, a dummy thread object with limited functionality is returned.
Return the current Thread object, corresponding to the caller's thread of control.
[ "Return", "the", "current", "Thread", "object", "corresponding", "to", "the", "caller", "s", "thread", "of", "control", "." ]
def current_thread(): """Return the current Thread object, corresponding to the caller's thread of control. If the caller's thread of control was not created through the threading module, a dummy thread object with limited functionality is returned. """ try: return _active[get_ident()] ...
[ "def", "current_thread", "(", ")", ":", "try", ":", "return", "_active", "[", "get_ident", "(", ")", "]", "except", "KeyError", ":", "return", "_DummyThread", "(", ")" ]
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/threading.py#L1224-L1234
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/tarfile.py
python
_Stream.tell
(self)
return self.pos
Return the stream's file pointer position.
Return the stream's file pointer position.
[ "Return", "the", "stream", "s", "file", "pointer", "position", "." ]
def tell(self): """Return the stream's file pointer position. """ return self.pos
[ "def", "tell", "(", "self", ")", ":", "return", "self", ".", "pos" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/tarfile.py#L505-L508
Netflix/security_monkey
c28592ffd518fa399527d26262683fc860c30eef
security_monkey/watchers/rds/rds_snapshot.py
python
RDSSnapshot.slurp
(self)
return item_list, exception_map
:returns: item_list - list of RDS snapshots in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
:returns: item_list - list of RDS snapshots in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
[ ":", "returns", ":", "item_list", "-", "list", "of", "RDS", "snapshots", "in", "use", "by", "account", ":", "returns", ":", "exception_map", "-", "A", "dict", "where", "the", "keys", "are", "a", "tuple", "containing", "the", "location", "of", "the", "exc...
def slurp(self): """ :returns: item_list - list of RDS snapshots in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() from securi...
[ "def", "slurp", "(", "self", ")", ":", "self", ".", "prep_for_slurp", "(", ")", "from", "security_monkey", ".", "common", ".", "sts_connect", "import", "connect", "item_list", "=", "[", "]", "exception_map", "=", "{", "}", "for", "account", "in", "self", ...
https://github.com/Netflix/security_monkey/blob/c28592ffd518fa399527d26262683fc860c30eef/security_monkey/watchers/rds/rds_snapshot.py#L40-L115
stanfordnlp/stanza-old
920c55d8eaa1e7105971059c66eb448a74c100d6
stanza/monitoring/experiment.py
python
AttrDict.__init__
(self, *args, **kwargs)
[]
def __init__(self, *args, **kwargs): super(AttrDict, self).__init__(*args, **kwargs) self.__dict__ = self
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "AttrDict", ",", "self", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "__dict__", "=", "self" ]
https://github.com/stanfordnlp/stanza-old/blob/920c55d8eaa1e7105971059c66eb448a74c100d6/stanza/monitoring/experiment.py#L23-L25
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/jobs/migrations/0003_auto_20170910_1702.py
python
migrate_customized_jobs_templates
()
Update those jobs templates that are pulled to sites jobs/add.html, jobs/edit.html: ============================= Remove: <fieldset class="boxy-grey" > <legend id="category-title" style="cursor: pointer"><span>+</span> {% trans 'Category' %}</legend> <div id="category-form"> ...
Update those jobs templates that are pulled to sites
[ "Update", "those", "jobs", "templates", "that", "are", "pulled", "to", "sites" ]
def migrate_customized_jobs_templates(): """ Update those jobs templates that are pulled to sites jobs/add.html, jobs/edit.html: ============================= Remove: <fieldset class="boxy-grey" > <legend id="category-title" style="cursor: pointer"><span>+</span> {% trans 'Category' %}</l...
[ "def", "migrate_customized_jobs_templates", "(", ")", ":", "import", "re", "from", "tendenci", ".", "apps", ".", "theme", ".", "utils", "import", "get_theme_root", "dir_path", "=", "get_theme_root", "(", ")", "# jobs/add.html and edit.html", "files_list", "=", "[", ...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/jobs/migrations/0003_auto_20170910_1702.py#L9-L216
gem/oq-engine
1bdb88f3914e390abcbd285600bfd39477aae47c
openquake/hazardlib/gsim/tusa_langer_2016.py
python
_compute_magnitude1
(kind, ctx, C)
return C['a'] + (C['b1'] * (ctx.mag)) + (C['b2'] * (ctx.mag) ** 2)
Compute the magnitude function, equation (9):
Compute the magnitude function, equation (9):
[ "Compute", "the", "magnitude", "function", "equation", "(", "9", ")", ":" ]
def _compute_magnitude1(kind, ctx, C): """ Compute the magnitude function, equation (9): """ return C['a'] + (C['b1'] * (ctx.mag)) + (C['b2'] * (ctx.mag) ** 2)
[ "def", "_compute_magnitude1", "(", "kind", ",", "ctx", ",", "C", ")", ":", "return", "C", "[", "'a'", "]", "+", "(", "C", "[", "'b1'", "]", "*", "(", "ctx", ".", "mag", ")", ")", "+", "(", "C", "[", "'b2'", "]", "*", "(", "ctx", ".", "mag",...
https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hazardlib/gsim/tusa_langer_2016.py#L74-L78
radlab/sparrow
afb8efadeb88524f1394d1abe4ea66c6fd2ac744
deploy/third_party/boto-2.1.1/boto/sdb/item.py
python
Item.delete
(self)
Deletes this item in SDB. .. note:: This local Python object remains in its current state after deletion, this only deletes the remote item in SDB.
Deletes this item in SDB. .. note:: This local Python object remains in its current state after deletion, this only deletes the remote item in SDB.
[ "Deletes", "this", "item", "in", "SDB", ".", "..", "note", "::", "This", "local", "Python", "object", "remains", "in", "its", "current", "state", "after", "deletion", "this", "only", "deletes", "the", "remote", "item", "in", "SDB", "." ]
def delete(self): """ Deletes this item in SDB. .. note:: This local Python object remains in its current state after deletion, this only deletes the remote item in SDB. """ self.domain.delete_item(self)
[ "def", "delete", "(", "self", ")", ":", "self", ".", "domain", ".", "delete_item", "(", "self", ")" ]
https://github.com/radlab/sparrow/blob/afb8efadeb88524f1394d1abe4ea66c6fd2ac744/deploy/third_party/boto-2.1.1/boto/sdb/item.py#L170-L177
metamorphose/metamorphose2
d2bdd6a86340b9668e93b35a6a568894c9909d68
src/mutagen/_util.py
python
dict_match
(d, key, default=None)
return default
Like __getitem__ but works as if the keys() are all filename patterns. Returns the value of any dict key that matches the passed key.
Like __getitem__ but works as if the keys() are all filename patterns. Returns the value of any dict key that matches the passed key.
[ "Like", "__getitem__", "but", "works", "as", "if", "the", "keys", "()", "are", "all", "filename", "patterns", ".", "Returns", "the", "value", "of", "any", "dict", "key", "that", "matches", "the", "passed", "key", "." ]
def dict_match(d, key, default=None): """Like __getitem__ but works as if the keys() are all filename patterns. Returns the value of any dict key that matches the passed key. """ if key in d and "[" not in key: return d[key] else: for pattern, value in iteritems(d): if f...
[ "def", "dict_match", "(", "d", ",", "key", ",", "default", "=", "None", ")", ":", "if", "key", "in", "d", "and", "\"[\"", "not", "in", "key", ":", "return", "d", "[", "key", "]", "else", ":", "for", "pattern", ",", "value", "in", "iteritems", "("...
https://github.com/metamorphose/metamorphose2/blob/d2bdd6a86340b9668e93b35a6a568894c9909d68/src/mutagen/_util.py#L421-L432
kensho-technologies/graphql-compiler
4318443b7b2512a059f3616112bfc40bbf8eec06
graphql_compiler/schema_generation/orientdb/schema_graph_builder.py
python
_get_inherited_property_definitions
(superclass_set, class_name_to_definition)
return list( chain.from_iterable( class_name_to_definition[inherited_class_name]["properties"] for inherited_class_name in superclass_set ) )
Return a class's inherited OrientDB property definitions.
Return a class's inherited OrientDB property definitions.
[ "Return", "a", "class", "s", "inherited", "OrientDB", "property", "definitions", "." ]
def _get_inherited_property_definitions(superclass_set, class_name_to_definition): """Return a class's inherited OrientDB property definitions.""" return list( chain.from_iterable( class_name_to_definition[inherited_class_name]["properties"] for inherited_class_name in superclass...
[ "def", "_get_inherited_property_definitions", "(", "superclass_set", ",", "class_name_to_definition", ")", ":", "return", "list", "(", "chain", ".", "from_iterable", "(", "class_name_to_definition", "[", "inherited_class_name", "]", "[", "\"properties\"", "]", "for", "i...
https://github.com/kensho-technologies/graphql-compiler/blob/4318443b7b2512a059f3616112bfc40bbf8eec06/graphql_compiler/schema_generation/orientdb/schema_graph_builder.py#L318-L325
danilobellini/audiolazy
dba0a278937909980ed40b976d866b8e97c35dee
audiolazy/lazy_midi.py
python
octaves
(freq, fmin=20., fmax=2e4)
return list(it.takewhile(lambda x: x > fmin, (freq * 2 ** harm for harm in it.count(0, -1)) ))[::-1] \ + list(it.takewhile(lambda x: x < fmax, (freq * 2 ** harm for harm in it.count(1)) ))
Given a frequency and a frequency range, returns all frequencies in that range that is an integer number of octaves related to the given frequency. Parameters ---------- freq : Frequency, in any (linear) unit. fmin, fmax : Frequency range, in the same unit of ``freq``. Defaults to 20.0 and 20,000...
Given a frequency and a frequency range, returns all frequencies in that range that is an integer number of octaves related to the given frequency.
[ "Given", "a", "frequency", "and", "a", "frequency", "range", "returns", "all", "frequencies", "in", "that", "range", "that", "is", "an", "integer", "number", "of", "octaves", "related", "to", "the", "given", "frequency", "." ]
def octaves(freq, fmin=20., fmax=2e4): """ Given a frequency and a frequency range, returns all frequencies in that range that is an integer number of octaves related to the given frequency. Parameters ---------- freq : Frequency, in any (linear) unit. fmin, fmax : Frequency range, in the same un...
[ "def", "octaves", "(", "freq", ",", "fmin", "=", "20.", ",", "fmax", "=", "2e4", ")", ":", "# Input validation", "if", "any", "(", "f", "<=", "0", "for", "f", "in", "(", "freq", ",", "fmin", ",", "fmax", ")", ")", ":", "raise", "ValueError", "(",...
https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/audiolazy/lazy_midi.py#L111-L163
barneygale/quarry
eac47471fc55598de6b4723a728a37d035002237
quarry/types/buffer/v1_13.py
python
Buffer1_13.unpack_entity_metadata
(self)
Unpacks entity metadata.
Unpacks entity metadata.
[ "Unpacks", "entity", "metadata", "." ]
def unpack_entity_metadata(self): """ Unpacks entity metadata. """ metadata = {} while True: key = self.unpack('B') if key == 255: return metadata ty = self.unpack('B') if ty == 0: val = self.unpack('b') ...
[ "def", "unpack_entity_metadata", "(", "self", ")", ":", "metadata", "=", "{", "}", "while", "True", ":", "key", "=", "self", ".", "unpack", "(", "'B'", ")", "if", "key", "==", "255", ":", "return", "metadata", "ty", "=", "self", ".", "unpack", "(", ...
https://github.com/barneygale/quarry/blob/eac47471fc55598de6b4723a728a37d035002237/quarry/types/buffer/v1_13.py#L93-L121
morganstanley/treadmill
f18267c665baf6def4374d21170198f63ff1cde4
lib/python/treadmill/bootstrap/install.py
python
install
(package, dst_dir, params, run=None, profile=None)
Installs the services.
Installs the services.
[ "Installs", "the", "services", "." ]
def install(package, dst_dir, params, run=None, profile=None): """Installs the services. """ _LOGGER.info('install: %s - %s, profile: %s', package, dst_dir, profile) packages = [package] module = plugin_manager.load('treadmill.bootstrap', package) extension_module = None if profile: ...
[ "def", "install", "(", "package", ",", "dst_dir", ",", "params", ",", "run", "=", "None", ",", "profile", "=", "None", ")", ":", "_LOGGER", ".", "info", "(", "'install: %s - %s, profile: %s'", ",", "package", ",", "dst_dir", ",", "profile", ")", "packages"...
https://github.com/morganstanley/treadmill/blob/f18267c665baf6def4374d21170198f63ff1cde4/lib/python/treadmill/bootstrap/install.py#L340-L411
llSourcell/AI_Artist
3038c06c2e389b9c919c881c9a169efe2fd7810e
lib/python2.7/site.py
python
setencoding
()
Set the string encoding used by the Unicode implementation. The default is 'ascii', but if you're willing to experiment, you can change this.
Set the string encoding used by the Unicode implementation. The default is 'ascii', but if you're willing to experiment, you can change this.
[ "Set", "the", "string", "encoding", "used", "by", "the", "Unicode", "implementation", ".", "The", "default", "is", "ascii", "but", "if", "you", "re", "willing", "to", "experiment", "you", "can", "change", "this", "." ]
def setencoding(): """Set the string encoding used by the Unicode implementation. The default is 'ascii', but if you're willing to experiment, you can change this.""" encoding = "ascii" # Default value set by _PyUnicode_Init() if 0: # Enable to support locale aware default string encodings....
[ "def", "setencoding", "(", ")", ":", "encoding", "=", "\"ascii\"", "# Default value set by _PyUnicode_Init()", "if", "0", ":", "# Enable to support locale aware default string encodings.", "import", "locale", "loc", "=", "locale", ".", "getdefaultlocale", "(", ")", "if", ...
https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site.py#L525-L542
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/cv/transforms/batch_operators.py
python
BatchCompose.__init__
(self, batch_transforms=None, collate_batch=True)
[]
def __init__(self, batch_transforms=None, collate_batch=True): super(BatchCompose, self).__init__() self.batch_transforms = batch_transforms self.collate_batch = collate_batch
[ "def", "__init__", "(", "self", ",", "batch_transforms", "=", "None", ",", "collate_batch", "=", "True", ")", ":", "super", "(", "BatchCompose", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "batch_transforms", "=", "batch_transforms", "self", ...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/cv/transforms/batch_operators.py#L29-L32
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/lib/xmodule/xmodule/modulestore/__init__.py
python
BulkOperationsMixin._end_outermost_bulk_operation
(self, bulk_ops_record, structure_key)
The outermost nested bulk_operation call: do the actual end of the bulk operation. Implementing classes must override this method; otherwise, the bulk operations are a noop
The outermost nested bulk_operation call: do the actual end of the bulk operation.
[ "The", "outermost", "nested", "bulk_operation", "call", ":", "do", "the", "actual", "end", "of", "the", "bulk", "operation", "." ]
def _end_outermost_bulk_operation(self, bulk_ops_record, structure_key): """ The outermost nested bulk_operation call: do the actual end of the bulk operation. Implementing classes must override this method; otherwise, the bulk operations are a noop """ pass
[ "def", "_end_outermost_bulk_operation", "(", "self", ",", "bulk_ops_record", ",", "structure_key", ")", ":", "pass" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/modulestore/__init__.py#L253-L259
Rhizome-Conifer/conifer
308fbb98c1b9e668ef4facb66b43f0c362c202de
webrecorder/webrecorder/models/base.py
python
RedisUnorderedList.get_objects
(self, cls, load=True)
return obj_list
Return set elements. :param class cls: Redis building block class :param bool load: whether to load Redis entries :returns: set elements :rtype: list
Return set elements.
[ "Return", "set", "elements", "." ]
def get_objects(self, cls, load=True): """Return set elements. :param class cls: Redis building block class :param bool load: whether to load Redis entries :returns: set elements :rtype: list """ all_objs = self.get_keys() obj_list = [] for val...
[ "def", "get_objects", "(", "self", ",", "cls", ",", "load", "=", "True", ")", ":", "all_objs", "=", "self", ".", "get_keys", "(", ")", "obj_list", "=", "[", "]", "for", "val", "in", "all_objs", ":", "obj", "=", "cls", "(", "my_id", "=", "val", ",...
https://github.com/Rhizome-Conifer/conifer/blob/308fbb98c1b9e668ef4facb66b43f0c362c202de/webrecorder/webrecorder/models/base.py#L821-L845
cortex-lab/phy
9a330b9437a3d0b40a37a201d147224e6e7fb462
phy/apps/base.py
python
BaseController._get_firing_rate
(self, cluster_id)
return Bunch(data=st, x_min=0, x_max=dur)
Return the firing rate data of a cluster.
Return the firing rate data of a cluster.
[ "Return", "the", "firing", "rate", "data", "of", "a", "cluster", "." ]
def _get_firing_rate(self, cluster_id): """Return the firing rate data of a cluster.""" st = self.get_spike_times(cluster_id) dur = self.model.duration return Bunch(data=st, x_min=0, x_max=dur)
[ "def", "_get_firing_rate", "(", "self", ",", "cluster_id", ")", ":", "st", "=", "self", ".", "get_spike_times", "(", "cluster_id", ")", "dur", "=", "self", ".", "model", ".", "duration", "return", "Bunch", "(", "data", "=", "st", ",", "x_min", "=", "0"...
https://github.com/cortex-lab/phy/blob/9a330b9437a3d0b40a37a201d147224e6e7fb462/phy/apps/base.py#L1526-L1530
fastai/imagenet-fast
faa0f9dfc9e8e058ffd07a248724bf384f526fae
imagenet_nv/jh_tmp.py
python
top5
(output, target)
return correct_k.mul_(1.0 / batch_size)
Computes the precision@k for the specified values of k
Computes the precision
[ "Computes", "the", "precision" ]
def top5(output, target): """Computes the precision@k for the specified values of k""" top5 = 5 batch_size = target.size(0) _, pred = output.topk(top5, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) correct_k = correct[:top5].view(-1).float().sum(0, keep...
[ "def", "top5", "(", "output", ",", "target", ")", ":", "top5", "=", "5", "batch_size", "=", "target", ".", "size", "(", "0", ")", "_", ",", "pred", "=", "output", ".", "topk", "(", "top5", ",", "1", ",", "True", ",", "True", ")", "pred", "=", ...
https://github.com/fastai/imagenet-fast/blob/faa0f9dfc9e8e058ffd07a248724bf384f526fae/imagenet_nv/jh_tmp.py#L177-L185
wrr/wwwhisper
38a55dd9c828fbb1b5a8234ea3ddf2242e684983
wwwhisper_auth/assets.py
python
HtmlFileView.do_get
(self, body)
return http.HttpResponseOKHtml(body)
[]
def do_get(self, body): return http.HttpResponseOKHtml(body)
[ "def", "do_get", "(", "self", ",", "body", ")", ":", "return", "http", ".", "HttpResponseOKHtml", "(", "body", ")" ]
https://github.com/wrr/wwwhisper/blob/38a55dd9c828fbb1b5a8234ea3ddf2242e684983/wwwhisper_auth/assets.py#L32-L33
tornadomeet/mxnet-face
25d212791908c9dc0ea0c1de8e05af6d56f15e81
detection/symbol/processing.py
python
bbox_transform
(ex_rois, gt_rois)
return targets
compute bounding box regression targets from ex_rois to gt_rois :param ex_rois: [N, 4] :param gt_rois: [N, 4] :return: [N, 4]
compute bounding box regression targets from ex_rois to gt_rois :param ex_rois: [N, 4] :param gt_rois: [N, 4] :return: [N, 4]
[ "compute", "bounding", "box", "regression", "targets", "from", "ex_rois", "to", "gt_rois", ":", "param", "ex_rois", ":", "[", "N", "4", "]", ":", "param", "gt_rois", ":", "[", "N", "4", "]", ":", "return", ":", "[", "N", "4", "]" ]
def bbox_transform(ex_rois, gt_rois): """ compute bounding box regression targets from ex_rois to gt_rois :param ex_rois: [N, 4] :param gt_rois: [N, 4] :return: [N, 4] """ ex_widths = ex_rois[:, 2] - ex_rois[:, 0] + 1.0 ex_heights = ex_rois[:, 3] - ex_rois[:, 1] + 1.0 ex_ctr_x = ex_r...
[ "def", "bbox_transform", "(", "ex_rois", ",", "gt_rois", ")", ":", "ex_widths", "=", "ex_rois", "[", ":", ",", "2", "]", "-", "ex_rois", "[", ":", ",", "0", "]", "+", "1.0", "ex_heights", "=", "ex_rois", "[", ":", ",", "3", "]", "-", "ex_rois", "...
https://github.com/tornadomeet/mxnet-face/blob/25d212791908c9dc0ea0c1de8e05af6d56f15e81/detection/symbol/processing.py#L8-L32
apigee/henchman
13c53c66669800aaa89f1799ac974b45ec473c3d
modules/curl/curl/requests/requests/models.py
python
Response.__iter__
(self)
return self.iter_content(128)
Allows you to use a response as an iterator.
Allows you to use a response as an iterator.
[ "Allows", "you", "to", "use", "a", "response", "as", "an", "iterator", "." ]
def __iter__(self): """Allows you to use a response as an iterator.""" return self.iter_content(128)
[ "def", "__iter__", "(", "self", ")", ":", "return", "self", ".", "iter_content", "(", "128", ")" ]
https://github.com/apigee/henchman/blob/13c53c66669800aaa89f1799ac974b45ec473c3d/modules/curl/curl/requests/requests/models.py#L613-L615
clovaai/voxceleb_trainer
a0466aa285106c631a58c0ddb8ea27805e13ef7b
loss/proto.py
python
LossFunction.forward
(self, x, label=None)
return nloss, prec1
[]
def forward(self, x, label=None): assert x.size()[1] >= 2 out_anchor = torch.mean(x[:,1:,:],1) out_positive = x[:,0,:] stepsize = out_anchor.size()[0] output = -1 * (F.pairwise_distance(out_positive.unsqueeze(-1),out_anchor.unsqueeze(-1).transpose(0,2))...
[ "def", "forward", "(", "self", ",", "x", ",", "label", "=", "None", ")", ":", "assert", "x", ".", "size", "(", ")", "[", "1", "]", ">=", "2", "out_anchor", "=", "torch", ".", "mean", "(", "x", "[", ":", ",", "1", ":", ",", ":", "]", ",", ...
https://github.com/clovaai/voxceleb_trainer/blob/a0466aa285106c631a58c0ddb8ea27805e13ef7b/loss/proto.py#L23-L36
nopernik/mpDNS
b17dc39e7068406df82cb3431b3042e74e520cf9
circuits/web/parsers/multipart.py
python
MultiDict.keys
(self)
return self.dict.keys()
[]
def keys(self): return self.dict.keys()
[ "def", "keys", "(", "self", ")", ":", "return", "self", ".", "dict", ".", "keys", "(", ")" ]
https://github.com/nopernik/mpDNS/blob/b17dc39e7068406df82cb3431b3042e74e520cf9/circuits/web/parsers/multipart.py#L86-L87
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/handler.py
python
_HandleWildcardCases
(first_handler, second_handler)
return merged_handlers
Handle cases with trailing and leading wildcards. This function finds the set of intersections of two handlers where one has a leading wildcard (eg. *foo) in its pattern and at least one has a trailing wildcard (eg. baz*) in its pattern. The arguments are not symmetric. Args: first_handler: A SimpleHandle...
Handle cases with trailing and leading wildcards.
[ "Handle", "cases", "with", "trailing", "and", "leading", "wildcards", "." ]
def _HandleWildcardCases(first_handler, second_handler): """Handle cases with trailing and leading wildcards. This function finds the set of intersections of two handlers where one has a leading wildcard (eg. *foo) in its pattern and at least one has a trailing wildcard (eg. baz*) in its pattern. The arguments...
[ "def", "_HandleWildcardCases", "(", "first_handler", ",", "second_handler", ")", ":", "merged_handlers", "=", "set", "(", ")", "if", "len", "(", "first_handler", ".", "pattern", ")", "<=", "1", "or", "len", "(", "second_handler", ".", "pattern", ")", "<=", ...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/handler.py#L423-L455
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
Lib/decimal.py
python
_format_sign
(is_negative, spec)
Determine sign character.
Determine sign character.
[ "Determine", "sign", "character", "." ]
def _format_sign(is_negative, spec): """Determine sign character.""" if is_negative: return '-' elif spec['sign'] in ' +': return spec['sign'] else: return ''
[ "def", "_format_sign", "(", "is_negative", ",", "spec", ")", ":", "if", "is_negative", ":", "return", "'-'", "elif", "spec", "[", "'sign'", "]", "in", "' +'", ":", "return", "spec", "[", "'sign'", "]", "else", ":", "return", "''" ]
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/Lib/decimal.py#L6102-L6110
namisan/mt-dnn
8564c8cfa971391187bd699116fbe4388438d62d
experiments/xnli/extract_cat.py
python
load_xnli
(file, header=True)
return lang_dict, label_dict
[]
def load_xnli(file, header=True): lang_dict = collections.defaultdict(list) label_dict = {} cnt = 0 label_map = {"contradiction": 0, "neutral": 1, "entailment": 2} with open(file, encoding="utf8") as f: for line in f: if header: header = False cont...
[ "def", "load_xnli", "(", "file", ",", "header", "=", "True", ")", ":", "lang_dict", "=", "collections", ".", "defaultdict", "(", "list", ")", "label_dict", "=", "{", "}", "cnt", "=", "0", "label_map", "=", "{", "\"contradiction\"", ":", "0", ",", "\"ne...
https://github.com/namisan/mt-dnn/blob/8564c8cfa971391187bd699116fbe4388438d62d/experiments/xnli/extract_cat.py#L4-L24
ryu577/pyray
860b71463e2729a85b1319b5c3571c0b8f3ba50c
pyray/shapes/solid/polyhedron.py
python
dodecahedron
(draw, r, shift = [1000,1000,0], scale = 300)
Draws the vertices, faces and edges of a dodecahedron.
Draws the vertices, faces and edges of a dodecahedron.
[ "Draws", "the", "vertices", "faces", "and", "edges", "of", "a", "dodecahedron", "." ]
def dodecahedron(draw, r, shift = [1000,1000,0], scale = 300): """ Draws the vertices, faces and edges of a dodecahedron. """ phi = (1+np.sqrt(5)) / 2 tet_orig = [] for i in [-1,1]: for j in [-1,1]: for k in [-1,1]: tet_orig.append(np.array([i,j,k])) phi =...
[ "def", "dodecahedron", "(", "draw", ",", "r", ",", "shift", "=", "[", "1000", ",", "1000", ",", "0", "]", ",", "scale", "=", "300", ")", ":", "phi", "=", "(", "1", "+", "np", ".", "sqrt", "(", "5", ")", ")", "/", "2", "tet_orig", "=", "[", ...
https://github.com/ryu577/pyray/blob/860b71463e2729a85b1319b5c3571c0b8f3ba50c/pyray/shapes/solid/polyhedron.py#L668-L685
Antergos/Cnchi
13ac2209da9432d453e0097cf48a107640b563a9
src/installation/mkinitcpio.py
python
run
(dest_dir, settings, mount_devices, blvm)
Runs mkinitcpio
Runs mkinitcpio
[ "Runs", "mkinitcpio" ]
def run(dest_dir, settings, mount_devices, blvm): """ Runs mkinitcpio """ swap = 'swap' in mount_devices usr = '/usr' in mount_devices hooks = get_hooks(dest_dir, settings, swap, blvm, usr) modules = get_modules(settings) files = get_files(settings) set_hooks_modules_and_files(dest_dir, ho...
[ "def", "run", "(", "dest_dir", ",", "settings", ",", "mount_devices", ",", "blvm", ")", ":", "swap", "=", "'swap'", "in", "mount_devices", "usr", "=", "'/usr'", "in", "mount_devices", "hooks", "=", "get_hooks", "(", "dest_dir", ",", "settings", ",", "swap"...
https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/installation/mkinitcpio.py#L38-L57
inasafe/inasafe
355eb2ce63f516b9c26af0c86a24f99e53f63f87
safe/gui/tools/print_report_dialog.py
python
PrintReportDialog.__init__
(self, impact_function, iface, dock=None, parent=None)
Constructor for the dialog. :param iface: A Quantum GIS QgisAppInterface instance. :type iface: QgisAppInterface :param parent: Parent widget of this dialog :type parent: QWidget :param dock: Optional dock widget instance that we can notify of changes to the keywor...
Constructor for the dialog.
[ "Constructor", "for", "the", "dialog", "." ]
def __init__(self, impact_function, iface, dock=None, parent=None): """Constructor for the dialog. :param iface: A Quantum GIS QgisAppInterface instance. :type iface: QgisAppInterface :param parent: Parent widget of this dialog :type parent: QWidget :param dock: Option...
[ "def", "__init__", "(", "self", ",", "impact_function", ",", "iface", ",", "dock", "=", "None", ",", "parent", "=", "None", ")", ":", "QtWidgets", ".", "QDialog", ".", "__init__", "(", "self", ",", "parent", ")", "self", ".", "setupUi", "(", "self", ...
https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/gui/tools/print_report_dialog.py#L60-L215
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventTypeArg.is_extended_version_history_change_policy
(self)
return self._tag == 'extended_version_history_change_policy'
Check if the union tag is ``extended_version_history_change_policy``. :rtype: bool
Check if the union tag is ``extended_version_history_change_policy``.
[ "Check", "if", "the", "union", "tag", "is", "extended_version_history_change_policy", "." ]
def is_extended_version_history_change_policy(self): """ Check if the union tag is ``extended_version_history_change_policy``. :rtype: bool """ return self._tag == 'extended_version_history_change_policy'
[ "def", "is_extended_version_history_change_policy", "(", "self", ")", ":", "return", "self", ".", "_tag", "==", "'extended_version_history_change_policy'" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L42951-L42957
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/users/bulk_download.py
python
make_mobile_user_dict
(user, group_names, location_cache, domain, fields_definition)
return user_dict
[]
def make_mobile_user_dict(user, group_names, location_cache, domain, fields_definition): model_data = {} uncategorized_data = {} model_data, uncategorized_data = ( fields_definition.get_model_and_uncategorized(user.metadata) ) role = user.get_role(domain) profile = None if PROFILE_SL...
[ "def", "make_mobile_user_dict", "(", "user", ",", "group_names", ",", "location_cache", ",", "domain", ",", "fields_definition", ")", ":", "model_data", "=", "{", "}", "uncategorized_data", "=", "{", "}", "model_data", ",", "uncategorized_data", "=", "(", "field...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/users/bulk_download.py#L94-L136
cea-hpc/clustershell
c421133ed4baa69e35ff76c476d4097201485344
lib/ClusterShell/Task.py
python
Task.running
(self)
return self._engine and self._engine.running
Return True if the task is running.
Return True if the task is running.
[ "Return", "True", "if", "the", "task", "is", "running", "." ]
def running(self): """ Return True if the task is running. """ return self._engine and self._engine.running
[ "def", "running", "(", "self", ")", ":", "return", "self", ".", "_engine", "and", "self", ".", "_engine", ".", "running" ]
https://github.com/cea-hpc/clustershell/blob/c421133ed4baa69e35ff76c476d4097201485344/lib/ClusterShell/Task.py#L985-L989
hendrycks/outlier-exposure
e6ede98a5474a0620d9befa50b38eaf584df4401
NLP_language_modeling/data.py
python
OODCorpus.tokenize
(self, path, char=False)
return corpus, torch.LongTensor(ids)
Tokenizes a text file.
Tokenizes a text file.
[ "Tokenizes", "a", "text", "file", "." ]
def tokenize(self, path, char=False): """Tokenizes a text file.""" assert os.path.exists(path) # Add words to the dictionary corpus = [] ids = [] with open(path, 'r') as f: for line in f: if len(line) == 1: # end of example ...
[ "def", "tokenize", "(", "self", ",", "path", ",", "char", "=", "False", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "path", ")", "# Add words to the dictionary", "corpus", "=", "[", "]", "ids", "=", "[", "]", "with", "open", "(", "path...
https://github.com/hendrycks/outlier-exposure/blob/e6ede98a5474a0620d9befa50b38eaf584df4401/NLP_language_modeling/data.py#L118-L146
exoplanet-dev/exoplanet
57935f373cf1ead935868e15bb4823b6de93027b
src/exoplanet/light_curves/limb_dark.py
python
LimbDarkLightCurve._compute_light_curve
(self, b, r, los=None)
return tt.switch(tt.gt(los, 0), lc, tt.zeros_like(lc))
Compute the light curve for a set of impact parameters and radii .. note:: The stellar radius is *not* included in this method so the coordinates should be in units of the star's radius. Args: b (tensor): A tensor of impact parameter values. r (tensor): A tensor of ...
Compute the light curve for a set of impact parameters and radii
[ "Compute", "the", "light", "curve", "for", "a", "set", "of", "impact", "parameters", "and", "radii" ]
def _compute_light_curve(self, b, r, los=None): """Compute the light curve for a set of impact parameters and radii .. note:: The stellar radius is *not* included in this method so the coordinates should be in units of the star's radius. Args: b (tensor): A tensor of im...
[ "def", "_compute_light_curve", "(", "self", ",", "b", ",", "r", ",", "los", "=", "None", ")", ":", "b", "=", "as_tensor_variable", "(", "b", ")", "if", "los", "is", "None", ":", "los", "=", "tt", ".", "ones_like", "(", "b", ")", "lc", "=", "quad_...
https://github.com/exoplanet-dev/exoplanet/blob/57935f373cf1ead935868e15bb4823b6de93027b/src/exoplanet/light_curves/limb_dark.py#L237-L255
3DLIRIOUS/MeshLabXML
e19fdc911644474f74463aabba1e6860cfad818e
meshlabxml/transform.py
python
scale2
(script, value=1.0, uniform=True, center_pt='origin', custom_center_pt=None, unit=False, freeze=True, all_layers=False)
return None
Args: script: the FilterScript object or script filename to write the filter to. value (float): Scaling along the X axis. uniform (bool): If selected an uniform scaling (the same for all the', ' three axis) is applied (the X axis value is used). center_pt (str): Choos...
[]
def scale2(script, value=1.0, uniform=True, center_pt='origin', custom_center_pt=None, unit=False, freeze=True, all_layers=False): """ Args: script: the FilterScript object or script filename to write the filter to. value (float): Scaling along the X axis. uniform...
[ "def", "scale2", "(", "script", ",", "value", "=", "1.0", ",", "uniform", "=", "True", ",", "center_pt", "=", "'origin'", ",", "custom_center_pt", "=", "None", ",", "unit", "=", "False", ",", "freeze", "=", "True", ",", "all_layers", "=", "False", ")",...
https://github.com/3DLIRIOUS/MeshLabXML/blob/e19fdc911644474f74463aabba1e6860cfad818e/meshlabxml/transform.py#L223-L317
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
cilium/datadog_checks/cilium/config_models/defaults.py
python
instance_non_cumulative_histogram_buckets
(field, value)
return False
[]
def instance_non_cumulative_histogram_buckets(field, value): return False
[ "def", "instance_non_cumulative_histogram_buckets", "(", "field", ",", "value", ")", ":", "return", "False" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/cilium/datadog_checks/cilium/config_models/defaults.py#L209-L210
jina-ai/jina
c77a492fcd5adba0fc3de5347bea83dd4e7d8087
docarray/math/distance/numpy.py
python
sparse_sqeuclidean
(x_mat: 'ArrayType', y_mat: 'ArrayType')
return np.asarray( y_mat.power(2).sum(axis=1).flatten() + x_mat.power(2).sum(axis=1) - 2 * x_mat.dot(y_mat.T) )
Cosine distance between each row in x_mat and each row in y_mat. :param x_mat: scipy.sparse like array with ndim=2 :param y_mat: scipy.sparse like array with ndim=2 :return: np.ndarray with ndim=2
Cosine distance between each row in x_mat and each row in y_mat.
[ "Cosine", "distance", "between", "each", "row", "in", "x_mat", "and", "each", "row", "in", "y_mat", "." ]
def sparse_sqeuclidean(x_mat: 'ArrayType', y_mat: 'ArrayType') -> 'np.ndarray': """Cosine distance between each row in x_mat and each row in y_mat. :param x_mat: scipy.sparse like array with ndim=2 :param y_mat: scipy.sparse like array with ndim=2 :return: np.ndarray with ndim=2 """ # we nee...
[ "def", "sparse_sqeuclidean", "(", "x_mat", ":", "'ArrayType'", ",", "y_mat", ":", "'ArrayType'", ")", "->", "'np.ndarray'", ":", "# we need the np.asarray otherwise we get a np.matrix object that iterates differently", "return", "np", ".", "asarray", "(", "y_mat", ".", "p...
https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/docarray/math/distance/numpy.py#L58-L70
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/shlex.py
python
split
(s, comments=False, posix=True)
return list(lex)
Split the string *s* using shell-like syntax.
Split the string *s* using shell-like syntax.
[ "Split", "the", "string", "*", "s", "*", "using", "shell", "-", "like", "syntax", "." ]
def split(s, comments=False, posix=True): """Split the string *s* using shell-like syntax.""" lex = shlex(s, posix=posix) lex.whitespace_split = True if not comments: lex.commenters = '' return list(lex)
[ "def", "split", "(", "s", ",", "comments", "=", "False", ",", "posix", "=", "True", ")", ":", "lex", "=", "shlex", "(", "s", ",", "posix", "=", "posix", ")", "lex", ".", "whitespace_split", "=", "True", "if", "not", "comments", ":", "lex", ".", "...
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/shlex.py#L305-L311
facebookresearch/pysparnn
c299c825fd99f263f3957e9b31197daf23a1e7a3
pysparnn/cluster_index.py
python
MultiClusterIndex.insert
(self, feature, record)
Insert a single record into the index. Args: feature: feature vector record: record to return as the result of a search
Insert a single record into the index.
[ "Insert", "a", "single", "record", "into", "the", "index", "." ]
def insert(self, feature, record): """Insert a single record into the index. Args: feature: feature vector record: record to return as the result of a search """ for ind in self.indexes: ind.insert(feature, record)
[ "def", "insert", "(", "self", ",", "feature", ",", "record", ")", ":", "for", "ind", "in", "self", ".", "indexes", ":", "ind", ".", "insert", "(", "feature", ",", "record", ")" ]
https://github.com/facebookresearch/pysparnn/blob/c299c825fd99f263f3957e9b31197daf23a1e7a3/pysparnn/cluster_index.py#L429-L437
aajanki/yle-dl
b0aa1bb5d943fdbd9a18da2604f21bb2094eadd7
yledl/downloader.py
python
YleDlDownloader.pipe
(self, clips, io, filters)
return self.process(clips, pipe_clip, needs_retry, filters)
[]
def pipe(self, clips, io, filters): def pipe_clip(clip, downloader): if not downloader: logger.error('Downloading the stream at %s is not yet ' 'supported.' % clip.webpage) return RD_FAILED downloader.warn_on_unsupported_featur...
[ "def", "pipe", "(", "self", ",", "clips", ",", "io", ",", "filters", ")", ":", "def", "pipe_clip", "(", "clip", ",", "downloader", ")", ":", "if", "not", "downloader", ":", "logger", ".", "error", "(", "'Downloading the stream at %s is not yet '", "'supporte...
https://github.com/aajanki/yle-dl/blob/b0aa1bb5d943fdbd9a18da2604f21bb2094eadd7/yledl/downloader.py#L61-L74
hydroshare/hydroshare
7ba563b55412f283047fb3ef6da367d41dec58c6
hs_tracking/management/commands/tracking_popular.py
python
Command.handle
(self, *args, **options)
[]
def handle(self, *args, **options): days = options['days'] n_resources = options['n_resources'] popular = Variable.popular_resources(days=days, n_resources=n_resources) for v in popular: print("users={} short_id={}" .format(v.users, v.short_id)) ...
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "days", "=", "options", "[", "'days'", "]", "n_resources", "=", "options", "[", "'n_resources'", "]", "popular", "=", "Variable", ".", "popular_resources", "(", "days", ...
https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_tracking/management/commands/tracking_popular.py#L17-L33
jensl/critic
c2d962b909ff7ef2f09bccbeb636333920b3659e
src/api/file.py
python
File.path
(self)
return self._impl.path
The path
The path
[ "The", "path" ]
def path(self): """The path""" return self._impl.path
[ "def", "path", "(", "self", ")", ":", "return", "self", ".", "_impl", ".", "path" ]
https://github.com/jensl/critic/blob/c2d962b909ff7ef2f09bccbeb636333920b3659e/src/api/file.py#L48-L50
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/plexapi/base.py
python
PlexPartialObject.isFullObject
(self)
return not self.key or (self._details_key or self.key) == self._initpath
Returns True if this is already a full object. A full object means all attributes were populated from the api path representing only this item. For example, the search result for a movie often only contain a portion of the attributes a full object (main url) for that movie would cont...
Returns True if this is already a full object. A full object means all attributes were populated from the api path representing only this item. For example, the search result for a movie often only contain a portion of the attributes a full object (main url) for that movie would cont...
[ "Returns", "True", "if", "this", "is", "already", "a", "full", "object", ".", "A", "full", "object", "means", "all", "attributes", "were", "populated", "from", "the", "api", "path", "representing", "only", "this", "item", ".", "For", "example", "the", "sea...
def isFullObject(self): """ Returns True if this is already a full object. A full object means all attributes were populated from the api path representing only this item. For example, the search result for a movie often only contain a portion of the attributes a full object ...
[ "def", "isFullObject", "(", "self", ")", ":", "return", "not", "self", ".", "key", "or", "(", "self", ".", "_details_key", "or", "self", ".", "key", ")", "==", "self", ".", "_initpath" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/plexapi/base.py#L496-L502
florath/rmtoo
6ffe08703451358dca24b232ee4380b1da23bcad
rmtoo/inputs/ReqClass.py
python
ReqClass.rewrite
(self, rid, req)
return self.get_tag(), val
This tag (Class) is mandatory optional (which means: if it's not there, there is a default - but every requirement do own one class)
This tag (Class) is mandatory optional (which means: if it's not there, there is a default - but every requirement do own one class)
[ "This", "tag", "(", "Class", ")", "is", "mandatory", "optional", "(", "which", "means", ":", "if", "it", "s", "not", "there", "there", "is", "a", "default", "-", "but", "every", "requirement", "do", "own", "one", "class", ")" ]
def rewrite(self, rid, req): """This tag (Class) is mandatory optional (which means: if it's not there, there is a default - but every requirement do own one class) """ if self.get_tag() not in req: val = ClassTypeDetailable() else: tcontent = req[...
[ "def", "rewrite", "(", "self", ",", "rid", ",", "req", ")", ":", "if", "self", ".", "get_tag", "(", ")", "not", "in", "req", ":", "val", "=", "ClassTypeDetailable", "(", ")", "else", ":", "tcontent", "=", "req", "[", "self", ".", "get_tag", "(", ...
https://github.com/florath/rmtoo/blob/6ffe08703451358dca24b232ee4380b1da23bcad/rmtoo/inputs/ReqClass.py#L24-L35
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/bulletin_board_dto.py
python
BulletinBoardDTO.generated
(self, generated)
Sets the generated of this BulletinBoardDTO. The timestamp when this report was generated. :param generated: The generated of this BulletinBoardDTO. :type: str
Sets the generated of this BulletinBoardDTO. The timestamp when this report was generated.
[ "Sets", "the", "generated", "of", "this", "BulletinBoardDTO", ".", "The", "timestamp", "when", "this", "report", "was", "generated", "." ]
def generated(self, generated): """ Sets the generated of this BulletinBoardDTO. The timestamp when this report was generated. :param generated: The generated of this BulletinBoardDTO. :type: str """ self._generated = generated
[ "def", "generated", "(", "self", ",", "generated", ")", ":", "self", ".", "_generated", "=", "generated" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/bulletin_board_dto.py#L91-L100
lbryio/lbry-sdk
f78e3825ca0f130834d3876a824f9d380501ced8
lbry/wallet/server/session.py
python
LBRYElectrumX.scripthash_listunspent
(self, scripthash)
return await self.hashX_listunspent(hashX)
Return the list of UTXOs of a scripthash.
Return the list of UTXOs of a scripthash.
[ "Return", "the", "list", "of", "UTXOs", "of", "a", "scripthash", "." ]
async def scripthash_listunspent(self, scripthash): """Return the list of UTXOs of a scripthash.""" hashX = scripthash_to_hashX(scripthash) return await self.hashX_listunspent(hashX)
[ "async", "def", "scripthash_listunspent", "(", "self", ",", "scripthash", ")", ":", "hashX", "=", "scripthash_to_hashX", "(", "scripthash", ")", "return", "await", "self", ".", "hashX_listunspent", "(", "hashX", ")" ]
https://github.com/lbryio/lbry-sdk/blob/f78e3825ca0f130834d3876a824f9d380501ced8/lbry/wallet/server/session.py#L1255-L1258
docker/docker-py
a48a5a9647761406d66e8271f19fab7fa0c5f582
docker/utils/config.py
python
home_dir
()
Get the user's home directory, using the same logic as the Docker Engine client - use %USERPROFILE% on Windows, $HOME/getuid on POSIX.
Get the user's home directory, using the same logic as the Docker Engine client - use %USERPROFILE% on Windows, $HOME/getuid on POSIX.
[ "Get", "the", "user", "s", "home", "directory", "using", "the", "same", "logic", "as", "the", "Docker", "Engine", "client", "-", "use", "%USERPROFILE%", "on", "Windows", "$HOME", "/", "getuid", "on", "POSIX", "." ]
def home_dir(): """ Get the user's home directory, using the same logic as the Docker Engine client - use %USERPROFILE% on Windows, $HOME/getuid on POSIX. """ if IS_WINDOWS_PLATFORM: return os.environ.get('USERPROFILE', '') else: return os.path.expanduser('~')
[ "def", "home_dir", "(", ")", ":", "if", "IS_WINDOWS_PLATFORM", ":", "return", "os", ".", "environ", ".", "get", "(", "'USERPROFILE'", ",", "''", ")", "else", ":", "return", "os", ".", "path", ".", "expanduser", "(", "'~'", ")" ]
https://github.com/docker/docker-py/blob/a48a5a9647761406d66e8271f19fab7fa0c5f582/docker/utils/config.py#L40-L48
isnowfy/pydown
71ecc891868cd2a34b7e5fe662c99474f2d0fd7f
pygments/formatters/latex.py
python
LatexFormatter.format_unencoded
(self, tokensource, outfile)
[]
def format_unencoded(self, tokensource, outfile): # TODO: add support for background colors t2n = self.ttype2name cp = self.commandprefix if self.full: realoutfile = outfile outfile = StringIO() outfile.write(ur'\begin{Verbatim}[commandchars=\\\{\}') ...
[ "def", "format_unencoded", "(", "self", ",", "tokensource", ",", "outfile", ")", ":", "# TODO: add support for background colors", "t2n", "=", "self", ".", "ttype2name", "cp", "=", "self", ".", "commandprefix", "if", "self", ".", "full", ":", "realoutfile", "=",...
https://github.com/isnowfy/pydown/blob/71ecc891868cd2a34b7e5fe662c99474f2d0fd7f/pygments/formatters/latex.py#L300-L378
oracle/oci-cli
2c0932ebd36a155521231ecb2965c14268f018ac
src/oci_cli/util/pymd5.py
python
md5
(arg=None)
return new(arg)
Same as new(). For backward compatibility reasons, this is an alternative name for the new() function.
Same as new(). For backward compatibility reasons, this is an alternative name for the new() function.
[ "Same", "as", "new", "()", ".", "For", "backward", "compatibility", "reasons", "this", "is", "an", "alternative", "name", "for", "the", "new", "()", "function", "." ]
def md5(arg=None): """Same as new(). For backward compatibility reasons, this is an alternative name for the new() function. """ return new(arg)
[ "def", "md5", "(", "arg", "=", "None", ")", ":", "return", "new", "(", "arg", ")" ]
https://github.com/oracle/oci-cli/blob/2c0932ebd36a155521231ecb2965c14268f018ac/src/oci_cli/util/pymd5.py#L437-L442
airbus-cert/regrippy
cdee0d626ec5d7dfe55a82a4fd9d161027e32c7e
regrippy/__init__.py
python
BasePlugin.display_machine
(self, result)
Displays a result for further processing by a machine (piping into mactime for example). :param result: the result to display :type result: regrip.PluginResult
Displays a result for further processing by a machine (piping into mactime for example).
[ "Displays", "a", "result", "for", "further", "processing", "by", "a", "machine", "(", "piping", "into", "mactime", "for", "example", ")", "." ]
def display_machine(self, result): """Displays a result for further processing by a machine (piping into mactime for example). :param result: the result to display :type result: regrip.PluginResult """ print(mactime(name=result.path, mtime=result.mtime))
[ "def", "display_machine", "(", "self", ",", "result", ")", ":", "print", "(", "mactime", "(", "name", "=", "result", ".", "path", ",", "mtime", "=", "result", ".", "mtime", ")", ")" ]
https://github.com/airbus-cert/regrippy/blob/cdee0d626ec5d7dfe55a82a4fd9d161027e32c7e/regrippy/__init__.py#L123-L130
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
pypy/interpreter/eval.py
python
Code.getvarnames
(self)
return self.signature().getallvarnames()
List of names including the arguments, vararg and kwarg, and possibly more locals.
List of names including the arguments, vararg and kwarg, and possibly more locals.
[ "List", "of", "names", "including", "the", "arguments", "vararg", "and", "kwarg", "and", "possibly", "more", "locals", "." ]
def getvarnames(self): """List of names including the arguments, vararg and kwarg, and possibly more locals.""" return self.signature().getallvarnames()
[ "def", "getvarnames", "(", "self", ")", ":", "return", "self", ".", "signature", "(", ")", ".", "getallvarnames", "(", ")" ]
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/interpreter/eval.py#L38-L41
MagicStack/asyncpg
a2f093df6aceec7842709eaf92c5ff9df093efae
asyncpg/connection.py
python
Connection.reload_schema_state
(self)
Indicate that the database schema information must be reloaded. For performance reasons, asyncpg caches certain aspects of the database schema, such as the layout of composite types. Consequently, when the database schema changes, and asyncpg is not able to gracefully recover from an e...
Indicate that the database schema information must be reloaded.
[ "Indicate", "that", "the", "database", "schema", "information", "must", "be", "reloaded", "." ]
async def reload_schema_state(self): """Indicate that the database schema information must be reloaded. For performance reasons, asyncpg caches certain aspects of the database schema, such as the layout of composite types. Consequently, when the database schema changes, and asyncpg is ...
[ "async", "def", "reload_schema_state", "(", "self", ")", ":", "self", ".", "_drop_global_type_cache", "(", ")", "self", ".", "_drop_global_statement_cache", "(", ")" ]
https://github.com/MagicStack/asyncpg/blob/a2f093df6aceec7842709eaf92c5ff9df093efae/asyncpg/connection.py#L1602-L1645
Roger/escrotum
a41d0f11bb6af4f08e724b8ccddf8513d905c0d1
escrotum/main.py
python
Escrotum.event_handler
(self, event)
Handle mouse and keyboard events
Handle mouse and keyboard events
[ "Handle", "mouse", "and", "keyboard", "events" ]
def event_handler(self, event): """ Handle mouse and keyboard events """ if event.type == gdk.EventType.BUTTON_PRESS: if event.button.button != 1: print("Canceled by the user") exit(EXIT_CANCEL) self.started = True sel...
[ "def", "event_handler", "(", "self", ",", "event", ")", ":", "if", "event", ".", "type", "==", "gdk", ".", "EventType", ".", "BUTTON_PRESS", ":", "if", "event", ".", "button", ".", "button", "!=", "1", ":", "print", "(", "\"Canceled by the user\"", ")", ...
https://github.com/Roger/escrotum/blob/a41d0f11bb6af4f08e724b8ccddf8513d905c0d1/escrotum/main.py#L184-L228
xcmyz/FastSpeech
d8bd89790100542fda836b8f3f9342b64ad67e39
audio/stft.py
python
STFT.forward
(self, input_data)
return reconstruction
[]
def forward(self, input_data): self.magnitude, self.phase = self.transform(input_data) reconstruction = self.inverse(self.magnitude, self.phase) return reconstruction
[ "def", "forward", "(", "self", ",", "input_data", ")", ":", "self", ".", "magnitude", ",", "self", ".", "phase", "=", "self", ".", "transform", "(", "input_data", ")", "reconstruction", "=", "self", ".", "inverse", "(", "self", ".", "magnitude", ",", "...
https://github.com/xcmyz/FastSpeech/blob/d8bd89790100542fda836b8f3f9342b64ad67e39/audio/stft.py#L116-L119
fluentpython/notebooks
0f6e1e8d1686743dacd9281df7c5b5921812010a
16-coroutine/taxi_sim0.py
python
Simulator.run
(self, end_time)
Schedule and display events until time is up
Schedule and display events until time is up
[ "Schedule", "and", "display", "events", "until", "time", "is", "up" ]
def run(self, end_time): # <1> """Schedule and display events until time is up""" # schedule the first event for each cab for _, proc in sorted(self.procs.items()): # <2> first_event = next(proc) # <3> self.events.put(first_event) # <4> # main loop of the sim...
[ "def", "run", "(", "self", ",", "end_time", ")", ":", "# <1>", "# schedule the first event for each cab", "for", "_", ",", "proc", "in", "sorted", "(", "self", ".", "procs", ".", "items", "(", ")", ")", ":", "# <2>", "first_event", "=", "next", "(", "pro...
https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/16-coroutine/taxi_sim0.py#L72-L102
yt-project/yt
dc7b24f9b266703db4c843e329c6c8644d47b824
yt/visualization/fixed_resolution_filters.py
python
apply_filter
(f)
return newfunc
[]
def apply_filter(f): @wraps(f) def newfunc(*args, **kwargs): args[0]._filters.append((f.__name__, (args, kwargs))) return args[0] return newfunc
[ "def", "apply_filter", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "newfunc", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "args", "[", "0", "]", ".", "_filters", ".", "append", "(", "(", "f", ".", "__name__", ",", "(", "a...
https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/visualization/fixed_resolution_filters.py#L8-L14
kenfar/DataGristle
248f255d69b41e0c306d0a893c917923f2cb39a3
datagristle/field_misc.py
python
get_field_names
(filename: str, dialect)
return final_names
Determines names of fields Inputs: Outputs: Misc: - if the file is empty it will return None
Determines names of fields Inputs: Outputs: Misc: - if the file is empty it will return None
[ "Determines", "names", "of", "fields", "Inputs", ":", "Outputs", ":", "Misc", ":", "-", "if", "the", "file", "is", "empty", "it", "will", "return", "None" ]
def get_field_names(filename: str, dialect) -> List[str]: """ Determines names of fields Inputs: Outputs: Misc: - if the file is empty it will return None """ reader = csv.reader(open(filename, newline=''), dialect=dialect) for field_names in reader:...
[ "def", "get_field_names", "(", "filename", ":", "str", ",", "dialect", ")", "->", "List", "[", "str", "]", ":", "reader", "=", "csv", ".", "reader", "(", "open", "(", "filename", ",", "newline", "=", "''", ")", ",", "dialect", "=", "dialect", ")", ...
https://github.com/kenfar/DataGristle/blob/248f255d69b41e0c306d0a893c917923f2cb39a3/datagristle/field_misc.py#L56-L76
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/flaskbb/core/auth/registration.py
python
UserValidator.__call__
(self, user_info)
return self.validate(user_info)
[]
def __call__(self, user_info): return self.validate(user_info)
[ "def", "__call__", "(", "self", ",", "user_info", ")", ":", "return", "self", ".", "validate", "(", "user_info", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/flaskbb/core/auth/registration.py#L48-L49
WenRichard/Customer-Chatbot
48508c40574ffac8ced414a5bea799e2c85341ca
xiaotian-chatbot1.0/Rerank/model.py
python
SiameseQACNN._cnn_layer
(self, input)
return cnn_outs
卷积层
卷积层
[ "卷积层" ]
def _cnn_layer(self, input): """ 卷积层 """ all = [] max_len = input.get_shape()[1] for i, filter_size in enumerate(self.window_sizes): with tf.variable_scope('filter{}'.format(filter_size)): # 卷积 cnn_out = tf.layers.conv1d(input, ...
[ "def", "_cnn_layer", "(", "self", ",", "input", ")", ":", "all", "=", "[", "]", "max_len", "=", "input", ".", "get_shape", "(", ")", "[", "1", "]", "for", "i", ",", "filter_size", "in", "enumerate", "(", "self", ".", "window_sizes", ")", ":", "with...
https://github.com/WenRichard/Customer-Chatbot/blob/48508c40574ffac8ced414a5bea799e2c85341ca/xiaotian-chatbot1.0/Rerank/model.py#L86-L104
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/telnetlib.py
python
test
()
Test program for telnetlib. Usage: python telnetlib.py [-d] ... [host [port]] Default host is localhost; default port is 23.
Test program for telnetlib.
[ "Test", "program", "for", "telnetlib", "." ]
def test(): """Test program for telnetlib. Usage: python telnetlib.py [-d] ... [host [port]] Default host is localhost; default port is 23. """ debuglevel = 0 while sys.argv[1:] and sys.argv[1] == '-d': debuglevel = debuglevel+1 del sys.argv[1] host = 'localhost' if sy...
[ "def", "test", "(", ")", ":", "debuglevel", "=", "0", "while", "sys", ".", "argv", "[", "1", ":", "]", "and", "sys", ".", "argv", "[", "1", "]", "==", "'-d'", ":", "debuglevel", "=", "debuglevel", "+", "1", "del", "sys", ".", "argv", "[", "1", ...
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/telnetlib.py#L648-L673
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/PAN-OS/Integrations/Panorama/Panorama.py
python
panorama_delete_custom_url_category_command
(custom_url_category_name: str)
Delete a custom url category
Delete a custom url category
[ "Delete", "a", "custom", "url", "category" ]
def panorama_delete_custom_url_category_command(custom_url_category_name: str): """ Delete a custom url category """ result = panorama_delete_custom_url_category(custom_url_category_name) custom_url_category_output = {'Name': custom_url_category_name} if DEVICE_GROUP: custom_url_categor...
[ "def", "panorama_delete_custom_url_category_command", "(", "custom_url_category_name", ":", "str", ")", ":", "result", "=", "panorama_delete_custom_url_category", "(", "custom_url_category_name", ")", "custom_url_category_output", "=", "{", "'Name'", ":", "custom_url_category_n...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/PAN-OS/Integrations/Panorama/Panorama.py#L2107-L2126
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pywin/Lib/telnetlib.py
python
Telnet.process_rawq
(self)
Transfer from raw queue to cooked queue. Set self.eof when connection is closed. Don't block unless in the midst of an IAC sequence.
Transfer from raw queue to cooked queue.
[ "Transfer", "from", "raw", "queue", "to", "cooked", "queue", "." ]
def process_rawq(self): """Transfer from raw queue to cooked queue. Set self.eof when connection is closed. Don't block unless in the midst of an IAC sequence. """ buf = ['', ''] try: while self.rawq: c = self.rawq_getchar() ...
[ "def", "process_rawq", "(", "self", ")", ":", "buf", "=", "[", "''", ",", "''", "]", "try", ":", "while", "self", ".", "rawq", ":", "c", "=", "self", ".", "rawq_getchar", "(", ")", "if", "not", "self", ".", "iacseq", ":", "if", "c", "==", "theN...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/telnetlib.py#L474-L544
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/vine-1.2.0/vine/funtools.py
python
transform
(filter_, callback, *filter_args, **filter_kwargs)
return P
Filter final argument to a promise. E.g. to coerce callback argument to :class:`int`:: transform(int, callback) or a more complex example extracting something from a dict and coercing the value to :class:`float`: .. code-block:: python def filter_key_value(key, filter_, mapping): ...
Filter final argument to a promise.
[ "Filter", "final", "argument", "to", "a", "promise", "." ]
def transform(filter_, callback, *filter_args, **filter_kwargs): """Filter final argument to a promise. E.g. to coerce callback argument to :class:`int`:: transform(int, callback) or a more complex example extracting something from a dict and coercing the value to :class:`float`: .. code...
[ "def", "transform", "(", "filter_", ",", "callback", ",", "*", "filter_args", ",", "*", "*", "filter_kwargs", ")", ":", "callback", "=", "ensure_promise", "(", "callback", ")", "P", "=", "promise", "(", "_transback", ",", "(", "filter_", ",", "callback", ...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/vine-1.2.0/vine/funtools.py#L66-L91
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Demo/pdist/rcsclient.py
python
RCSProxyClient.__init__
(self, address, verbose = client.VERBOSE)
[]
def __init__(self, address, verbose = client.VERBOSE): client.SecureClient.__init__(self, address, verbose)
[ "def", "__init__", "(", "self", ",", "address", ",", "verbose", "=", "client", ".", "VERBOSE", ")", ":", "client", ".", "SecureClient", ".", "__init__", "(", "self", ",", "address", ",", "verbose", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Demo/pdist/rcsclient.py#L25-L26
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
rpython/rlib/rsiphash.py
python
siphash24
(s)
s' is a normal string. Returns its siphash-2-4 as a r_uint64. Don't forget to cast the result to a regular integer if needed, e.g. with rarithmetic.intmask().
s' is a normal string. Returns its siphash-2-4 as a r_uint64. Don't forget to cast the result to a regular integer if needed, e.g. with rarithmetic.intmask().
[ "s", "is", "a", "normal", "string", ".", "Returns", "its", "siphash", "-", "2", "-", "4", "as", "a", "r_uint64", ".", "Don", "t", "forget", "to", "cast", "the", "result", "to", "a", "regular", "integer", "if", "needed", "e", ".", "g", ".", "with", ...
def siphash24(s): """'s' is a normal string. Returns its siphash-2-4 as a r_uint64. Don't forget to cast the result to a regular integer if needed, e.g. with rarithmetic.intmask(). """ with rffi.scoped_nonmovingbuffer(s) as p: return _siphash24(llmemory.cast_ptr_to_adr(p), len(s))
[ "def", "siphash24", "(", "s", ")", ":", "with", "rffi", ".", "scoped_nonmovingbuffer", "(", "s", ")", "as", "p", ":", "return", "_siphash24", "(", "llmemory", ".", "cast_ptr_to_adr", "(", "p", ")", ",", "len", "(", "s", ")", ")" ]
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/rpython/rlib/rsiphash.py#L321-L327
mtrazzi/rl-book-challenge
83a9b7608c805189a39b4ef81893f6ebe982f9e1
chapter5/mc.py
python
OffPolicyMCPrediction.weighted_is
(self, n_episodes, start_state=None, step_list=None)
Weighted Importance Sampling when start_state happens once per episode.
Weighted Importance Sampling when start_state happens once per episode.
[ "Weighted", "Importance", "Sampling", "when", "start_state", "happens", "once", "per", "episode", "." ]
def weighted_is(self, n_episodes, start_state=None, step_list=None): """Weighted Importance Sampling when start_state happens once per episode.""" step_list = [] if step_list is None else step_list q_steps = [] for episode in range(n_episodes + 1): trajs = self.generate_trajectory(start_state=star...
[ "def", "weighted_is", "(", "self", ",", "n_episodes", ",", "start_state", "=", "None", ",", "step_list", "=", "None", ")", ":", "step_list", "=", "[", "]", "if", "step_list", "is", "None", "else", "step_list", "q_steps", "=", "[", "]", "for", "episode", ...
https://github.com/mtrazzi/rl-book-challenge/blob/83a9b7608c805189a39b4ef81893f6ebe982f9e1/chapter5/mc.py#L198-L214
gurnec/btcrecover
129c09d653bd21e0eb0989a53c0e15949e37cfff
progressbar/widgets.py
python
Bar.__init__
(self, marker='#', left='|', right='|', fill=' ', fill_left=True)
Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use for the empty part of the progress bar fill_l...
Creates a customizable progress bar.
[ "Creates", "a", "customizable", "progress", "bar", "." ]
def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True): '''Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to ...
[ "def", "__init__", "(", "self", ",", "marker", "=", "'#'", ",", "left", "=", "'|'", ",", "right", "=", "'|'", ",", "fill", "=", "' '", ",", "fill_left", "=", "True", ")", ":", "self", ".", "marker", "=", "marker", "self", ".", "left", "=", "left"...
https://github.com/gurnec/btcrecover/blob/129c09d653bd21e0eb0989a53c0e15949e37cfff/progressbar/widgets.py#L236-L250
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/network/lib/tinyhttp.py
python
NullHandler.http_open
(self, req)
return self.do_open(build, req)
[]
def http_open(self, req): def build(host, port=None, strict=None, timeout=0): with self.lock: return NullConnection(self.table[host], timeout, host) return self.do_open(build, req)
[ "def", "http_open", "(", "self", ",", "req", ")", ":", "def", "build", "(", "host", ",", "port", "=", "None", ",", "strict", "=", "None", ",", "timeout", "=", "0", ")", ":", "with", "self", ".", "lock", ":", "return", "NullConnection", "(", "self",...
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/network/lib/tinyhttp.py#L213-L218
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/notifications/management/commands/send_dingtalk_notifications.py
python
CommandLogMixin.log_info
(self, msg)
[]
def log_info(self, msg): logger.info(msg) self.println(msg)
[ "def", "log_info", "(", "self", ",", "msg", ")", ":", "logger", ".", "info", "(", "msg", ")", "self", ".", "println", "(", "msg", ")" ]
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/notifications/management/commands/send_dingtalk_notifications.py#L51-L53
iskandr/fancyimpute
36374f84b14a0e870049815bd0b2bc4792d697a1
fancyimpute/scaler.py
python
BiScaler.transform
(self, X)
return X
[]
def transform(self, X): X = np.asarray(X).copy() X = self.center(X, self.row_means, self.column_means, inplace=True) X = self.rescale(X, self.row_scales, self.column_scales, inplace=True) return X
[ "def", "transform", "(", "self", ",", "X", ")", ":", "X", "=", "np", ".", "asarray", "(", "X", ")", ".", "copy", "(", ")", "X", "=", "self", ".", "center", "(", "X", ",", "self", ".", "row_means", ",", "self", ".", "column_means", ",", "inplace...
https://github.com/iskandr/fancyimpute/blob/36374f84b14a0e870049815bd0b2bc4792d697a1/fancyimpute/scaler.py#L379-L383
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/scipy/weave/bytecodecompiler.py
python
ByteCodeMeaning.INPLACE_POWER
(self,pc)
Implements in-place TOS = TOS1 ** TOS.
Implements in-place TOS = TOS1 ** TOS.
[ "Implements", "in", "-", "place", "TOS", "=", "TOS1", "**", "TOS", "." ]
def INPLACE_POWER(self,pc): "Implements in-place TOS = TOS1 ** TOS." raise NotImplementedError
[ "def", "INPLACE_POWER", "(", "self", ",", "pc", ")", ":", "raise", "NotImplementedError" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/scipy/weave/bytecodecompiler.py#L361-L363
aneisch/home-assistant-config
86e381fde9609cb8871c439c433c12989e4e225d
custom_components/alexa_media/media_player.py
python
AlexaClient.async_media_next_track
(self)
Send next track command.
Send next track command.
[ "Send", "next", "track", "command", "." ]
async def async_media_next_track(self): """Send next track command.""" if not (self.state in [STATE_PLAYING, STATE_PAUSED] and self.available): return if self._playing_parent: await self._playing_parent.async_media_next_track() else: if self.hass: ...
[ "async", "def", "async_media_next_track", "(", "self", ")", ":", "if", "not", "(", "self", ".", "state", "in", "[", "STATE_PLAYING", ",", "STATE_PAUSED", "]", "and", "self", ".", "available", ")", ":", "return", "if", "self", ".", "_playing_parent", ":", ...
https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_components/alexa_media/media_player.py#L1218-L1232
awslabs/sockeye
ec2d13f7beb42d8c4f389dba0172250dc9154d5a
sockeye/inference_pt.py
python
_reduce_nbest_translations
(nbest_translations_list: List[Translation])
return Translation(best_translation.target_ids, best_translation.scores, nbest_translations, best_translation.estimated_reference_length)
Combines Translation objects that are nbest translations of the same sentence. :param nbest_translations_list: A list of Translation objects, all of them translations of the same source sentence. :return: A single Translation object where nbest lists are collapsed.
Combines Translation objects that are nbest translations of the same sentence.
[ "Combines", "Translation", "objects", "that", "are", "nbest", "translations", "of", "the", "same", "sentence", "." ]
def _reduce_nbest_translations(nbest_translations_list: List[Translation]) -> Translation: """ Combines Translation objects that are nbest translations of the same sentence. :param nbest_translations_list: A list of Translation objects, all of them translations of the same source sentence. :ret...
[ "def", "_reduce_nbest_translations", "(", "nbest_translations_list", ":", "List", "[", "Translation", "]", ")", "->", "Translation", ":", "best_translation", "=", "nbest_translations_list", "[", "0", "]", "sequences", "=", "[", "translation", ".", "target_ids", "for...
https://github.com/awslabs/sockeye/blob/ec2d13f7beb42d8c4f389dba0172250dc9154d5a/sockeye/inference_pt.py#L515-L533
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/urllib/request.py
python
FancyURLopener.retry_https_basic_auth
(self, url, realm, data=None)
[]
def retry_https_basic_auth(self, url, realm, data=None): host, selector = _splithost(url) i = host.find('@') + 1 host = host[i:] user, passwd = self.get_user_passwd(host, realm, i) if not (user or passwd): return None host = "%s:%s@%s" % (quote(user, safe=''), ...
[ "def", "retry_https_basic_auth", "(", "self", ",", "url", ",", "realm", ",", "data", "=", "None", ")", ":", "host", ",", "selector", "=", "_splithost", "(", "url", ")", "i", "=", "host", ".", "find", "(", "'@'", ")", "+", "1", "host", "=", "host", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/urllib/request.py#L2314-L2326
intrig-unicamp/mininet-wifi
3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba
examples/cluster.py
python
RemoteMixin.popen
( self, *args, **kwargs )
return super( RemoteMixin, self).popen( *args, tt=False, **kwargs )
Override: disable -tt
Override: disable -tt
[ "Override", ":", "disable", "-", "tt" ]
def popen( self, *args, **kwargs ): "Override: disable -tt" return super( RemoteMixin, self).popen( *args, tt=False, **kwargs )
[ "def", "popen", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "RemoteMixin", ",", "self", ")", ".", "popen", "(", "*", "args", ",", "tt", "=", "False", ",", "*", "*", "kwargs", ")" ]
https://github.com/intrig-unicamp/mininet-wifi/blob/3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba/examples/cluster.py#L284-L286
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexes/interval.py
python
IntervalIndex._maybe_cast_indexed
(self, key)
return key
we need to cast the key, which could be a scalar or an array-like to the type of our subtype
we need to cast the key, which could be a scalar or an array-like to the type of our subtype
[ "we", "need", "to", "cast", "the", "key", "which", "could", "be", "a", "scalar", "or", "an", "array", "-", "like", "to", "the", "type", "of", "our", "subtype" ]
def _maybe_cast_indexed(self, key): """ we need to cast the key, which could be a scalar or an array-like to the type of our subtype """ if isinstance(key, IntervalIndex): return key subtype = self.dtype.subtype if is_float_dtype(subtype): ...
[ "def", "_maybe_cast_indexed", "(", "self", ",", "key", ")", ":", "if", "isinstance", "(", "key", ",", "IntervalIndex", ")", ":", "return", "key", "subtype", "=", "self", ".", "dtype", ".", "subtype", "if", "is_float_dtype", "(", "subtype", ")", ":", "if"...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexes/interval.py#L586-L604
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/utils/autoreload.py
python
gen_filenames
(only_new=False)
Returns a list of filenames referenced in sys.modules and translation files.
Returns a list of filenames referenced in sys.modules and translation files.
[ "Returns", "a", "list", "of", "filenames", "referenced", "in", "sys", ".", "modules", "and", "translation", "files", "." ]
def gen_filenames(only_new=False): """ Returns a list of filenames referenced in sys.modules and translation files. """ # N.B. ``list(...)`` is needed, because this runs in parallel with # application code which might be mutating ``sys.modules``, and this will # fail with RuntimeError: canno...
[ "def", "gen_filenames", "(", "only_new", "=", "False", ")", ":", "# N.B. ``list(...)`` is needed, because this runs in parallel with", "# application code which might be mutating ``sys.modules``, and this will", "# fail with RuntimeError: cannot mutate dictionary while iterating", "global", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/utils/autoreload.py#L82-L127
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_container_status.py
python
V1ContainerStatus.image_id
(self, image_id)
Sets the image_id of this V1ContainerStatus. ImageID of the container's image. # noqa: E501 :param image_id: The image_id of this V1ContainerStatus. # noqa: E501 :type: str
Sets the image_id of this V1ContainerStatus.
[ "Sets", "the", "image_id", "of", "this", "V1ContainerStatus", "." ]
def image_id(self, image_id): """Sets the image_id of this V1ContainerStatus. ImageID of the container's image. # noqa: E501 :param image_id: The image_id of this V1ContainerStatus. # noqa: E501 :type: str """ if self.local_vars_configuration.client_side_validation an...
[ "def", "image_id", "(", "self", ",", "image_id", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "image_id", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid value for `image_id`, must not be `None`...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_container_status.py#L150-L161
bjmayor/hacker
e3ce2ad74839c2733b27dac6c0f495e0743e1866
venv/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py
python
Session.get_adapter
(self, url)
Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter
Returns the appropriate connection adapter for the given URL.
[ "Returns", "the", "appropriate", "connection", "adapter", "for", "the", "given", "URL", "." ]
def get_adapter(self, url): """ Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter """ for (prefix, adapter) in self.adapters.items(): if url.lower().startswith(prefix): return adapter # Nothi...
[ "def", "get_adapter", "(", "self", ",", "url", ")", ":", "for", "(", "prefix", ",", "adapter", ")", "in", "self", ".", "adapters", ".", "items", "(", ")", ":", "if", "url", ".", "lower", "(", ")", ".", "startswith", "(", "prefix", ")", ":", "retu...
https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py#L660-L672
CPJKU/madmom
3bc8334099feb310acfce884ebdb76a28e01670d
madmom/ml/nn/layers.py
python
ReshapeLayer.activate
(self, data, **kwargs)
return np.reshape(data, self.newshape, self.order)
Activate ReshapeLayer. Parameters ---------- data : numpy array Activate with this data. Returns ------- numpy array Reshaped data.
Activate ReshapeLayer.
[ "Activate", "ReshapeLayer", "." ]
def activate(self, data, **kwargs): """ Activate ReshapeLayer. Parameters ---------- data : numpy array Activate with this data. Returns ------- numpy array Reshaped data. """ return np.reshape(data, self.newshape...
[ "def", "activate", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "return", "np", ".", "reshape", "(", "data", ",", "self", ".", "newshape", ",", "self", ".", "order", ")" ]
https://github.com/CPJKU/madmom/blob/3bc8334099feb310acfce884ebdb76a28e01670d/madmom/ml/nn/layers.py#L1209-L1224
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/nest/config_flow.py
python
NestFlowHandler.async_oauth_create_entry
(self, data: dict[str, Any])
return await self.async_step_pubsub()
Complete OAuth setup and finish pubsub or finish.
Complete OAuth setup and finish pubsub or finish.
[ "Complete", "OAuth", "setup", "and", "finish", "pubsub", "or", "finish", "." ]
async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResult: """Complete OAuth setup and finish pubsub or finish.""" assert self.config_mode != ConfigMode.LEGACY, "Step only supported for SDM API" self._data.update(data) if not self._configure_pubsub(): _LOGG...
[ "async", "def", "async_oauth_create_entry", "(", "self", ",", "data", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "FlowResult", ":", "assert", "self", ".", "config_mode", "!=", "ConfigMode", ".", "LEGACY", ",", "\"Step only supported for SDM API\"", "...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/nest/config_flow.py#L181-L188
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/tkinter/tix.py
python
TList.insert
(self, index, cnf={}, **kw)
[]
def insert(self, index, cnf={}, **kw): self.tk.call(self._w, 'insert', index, *self._options(cnf, kw))
[ "def", "insert", "(", "self", ",", "index", ",", "cnf", "=", "{", "}", ",", "*", "*", "kw", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'insert'", ",", "index", ",", "*", "self", ".", "_options", "(", "cnf", ",", ...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/tkinter/tix.py#L1459-L1460
veekun/pokedex
cc483e1877f22b8c19ac27ec0ff5fafd09c5cd5b
pokedex/struct/_pokemon_struct.py
python
LittleEndianBitStruct
(*args)
return Buffered( BitStruct(*args), encoder=lambda s: s[::-1], decoder=lambda s: s[::-1], resizer=lambda _: _, )
Construct's bit structs read a byte at a time in the order they appear, reading each bit from most to least significant. Alas, this doesn't work at all for a 32-bit bit field, because the bytes are 'backwards' in little-endian files. So this acts as a bit struct, but reverses the order of bytes before...
Construct's bit structs read a byte at a time in the order they appear, reading each bit from most to least significant. Alas, this doesn't work at all for a 32-bit bit field, because the bytes are 'backwards' in little-endian files.
[ "Construct", "s", "bit", "structs", "read", "a", "byte", "at", "a", "time", "in", "the", "order", "they", "appear", "reading", "each", "bit", "from", "most", "to", "least", "significant", ".", "Alas", "this", "doesn", "t", "work", "at", "all", "for", "...
def LittleEndianBitStruct(*args): """Construct's bit structs read a byte at a time in the order they appear, reading each bit from most to least significant. Alas, this doesn't work at all for a 32-bit bit field, because the bytes are 'backwards' in little-endian files. So this acts as a bit struc...
[ "def", "LittleEndianBitStruct", "(", "*", "args", ")", ":", "return", "Buffered", "(", "BitStruct", "(", "*", "args", ")", ",", "encoder", "=", "lambda", "s", ":", "s", "[", ":", ":", "-", "1", "]", ",", "decoder", "=", "lambda", "s", ":", "s", "...
https://github.com/veekun/pokedex/blob/cc483e1877f22b8c19ac27ec0ff5fafd09c5cd5b/pokedex/struct/_pokemon_struct.py#L476-L490
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/pickle.py
python
_Unpickler.load_long1
(self)
[]
def load_long1(self): n = self.read(1)[0] data = self.read(n) self.append(decode_long(data))
[ "def", "load_long1", "(", "self", ")", ":", "n", "=", "self", ".", "read", "(", "1", ")", "[", "0", "]", "data", "=", "self", ".", "read", "(", "n", ")", "self", ".", "append", "(", "decode_long", "(", "data", ")", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/pickle.py#L1299-L1302
ctpbee/ctpbee
c504e141c0a6fb2c5509bb6a77494c592997c0d4
ctpbee/jsond/tag.py
python
PollenTag.check
(self, data)
检查类型
检查类型
[ "检查类型" ]
def check(self, data): """检查类型""" pass
[ "def", "check", "(", "self", ",", "data", ")", ":", "pass" ]
https://github.com/ctpbee/ctpbee/blob/c504e141c0a6fb2c5509bb6a77494c592997c0d4/ctpbee/jsond/tag.py#L22-L24
vim-scripts/UltiSnips
5f88199e373a7eea4644b8dc1ff433688e8f2ebd
pythonx/UltiSnips/text_objects/_python_code.py
python
SnippetUtil.opt
(self, option, default=None)
return default
Gets a Vim variable.
Gets a Vim variable.
[ "Gets", "a", "Vim", "variable", "." ]
def opt(self, option, default=None): # pylint:disable=no-self-use """Gets a Vim variable.""" if _vim.eval("exists('%s')" % option) == '1': try: return _vim.eval(option) except _vim.error: pass return default
[ "def", "opt", "(", "self", ",", "option", ",", "default", "=", "None", ")", ":", "# pylint:disable=no-self-use", "if", "_vim", ".", "eval", "(", "\"exists('%s')\"", "%", "option", ")", "==", "'1'", ":", "try", ":", "return", "_vim", ".", "eval", "(", "...
https://github.com/vim-scripts/UltiSnips/blob/5f88199e373a7eea4644b8dc1ff433688e8f2ebd/pythonx/UltiSnips/text_objects/_python_code.py#L206-L213