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
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32/lib/win32timezone.py
python
TimeZoneInfo.get_sorted_time_zone_names
()
return [get_standard_name(tz) for tz in tzs]
Return a list of time zone names that can be used to initialize TimeZoneInfo instances
Return a list of time zone names that can be used to initialize TimeZoneInfo instances
[ "Return", "a", "list", "of", "time", "zone", "names", "that", "can", "be", "used", "to", "initialize", "TimeZoneInfo", "instances" ]
def get_sorted_time_zone_names(): "Return a list of time zone names that can be used to initialize TimeZoneInfo instances" tzs = TimeZoneInfo.get_sorted_time_zones() get_standard_name = lambda tzi: tzi.standardName return [get_standard_name(tz) for tz in tzs]
[ "def", "get_sorted_time_zone_names", "(", ")", ":", "tzs", "=", "TimeZoneInfo", ".", "get_sorted_time_zones", "(", ")", "get_standard_name", "=", "lambda", "tzi", ":", "tzi", ".", "standardName", "return", "[", "get_standard_name", "(", "tz", ")", "for", "tz", ...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32/lib/win32timezone.py#L586-L590
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/physics/link_physics_randomizer.py
python
LinkPhysicsRandomizer.get_properties
(self)
return {link: {'mass': info[0], 'local_inertia_diagonal': info[2], 'local_inertia_position': info[3], 'local_inertia_orientation': info[4], 'lateral_friction': info[1], 'spinning_friction': info[7], 'rolling_friction': info[6], 'restitution': info[5], 'contact_stiffness': i...
Get the current physics properties. Returns: dict: current physical property values {physic property name: corresponding value}.
Get the current physics properties.
[ "Get", "the", "current", "physics", "properties", "." ]
def get_properties(self): """ Get the current physics properties. Returns: dict: current physical property values {physic property name: corresponding value}. """ infos = [self.simulator.get_dynamics_info(body_id=self.body.id, link_id=link) for link in self.links] ...
[ "def", "get_properties", "(", "self", ")", ":", "infos", "=", "[", "self", ".", "simulator", ".", "get_dynamics_info", "(", "body_id", "=", "self", ".", "body", ".", "id", ",", "link_id", "=", "link", ")", "for", "link", "in", "self", ".", "links", "...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/physics/link_physics_randomizer.py#L381-L394
Tencent/bk-bcs-saas
2b437bf2f5fd5ce2078f7787c3a12df609f7679d
bcs-app/backend/uniapps/application/views.py
python
CreateInstance.get_instance_conf
(self, info)
return conf
获取instance conf
获取instance conf
[ "获取instance", "conf" ]
def get_instance_conf(self, info): """获取instance conf""" try: conf = json.loads(info.config) except Exception as error: logger.error(u"解析instance config异常,id为 %s, 详情: %s" % (info.id, error)) raise error_codes.JSONParseError(_("Instance config解析异常")) re...
[ "def", "get_instance_conf", "(", "self", ",", "info", ")", ":", "try", ":", "conf", "=", "json", ".", "loads", "(", "info", ".", "config", ")", "except", "Exception", "as", "error", ":", "logger", ".", "error", "(", "u\"解析instance config异常,id为 %s, 详情: %s\" %...
https://github.com/Tencent/bk-bcs-saas/blob/2b437bf2f5fd5ce2078f7787c3a12df609f7679d/bcs-app/backend/uniapps/application/views.py#L1020-L1027
easezyc/deep-transfer-learning
9af0921f4f21bc2ccea61be53cf8e8a49873d613
MUDA/MFSAN/MFSAN_3src/mmd.py
python
guassian_kernel
(source, target, kernel_mul=2.0, kernel_num=5, fix_sigma=None)
return sum(kernel_val)
[]
def guassian_kernel(source, target, kernel_mul=2.0, kernel_num=5, fix_sigma=None): n_samples = int(source.size()[0])+int(target.size()[0]) total = torch.cat([source, target], dim=0) total0 = total.unsqueeze(0).expand(int(total.size(0)), int(total.size(0)), int(total.size(1))) total1 = total.unsqueeze(1)...
[ "def", "guassian_kernel", "(", "source", ",", "target", ",", "kernel_mul", "=", "2.0", ",", "kernel_num", "=", "5", ",", "fix_sigma", "=", "None", ")", ":", "n_samples", "=", "int", "(", "source", ".", "size", "(", ")", "[", "0", "]", ")", "+", "in...
https://github.com/easezyc/deep-transfer-learning/blob/9af0921f4f21bc2ccea61be53cf8e8a49873d613/MUDA/MFSAN/MFSAN_3src/mmd.py#L7-L20
pyinstaller/pyinstaller
872312500a8a324d25fb405f85117f7966a0ebd5
PyInstaller/utils/win32/versioninfo.py
python
getRaw
(text)
return text.encode('UTF-16LE')
Encodes text as UTF-16LE (Microsoft 'Unicode') for use in structs.
Encodes text as UTF-16LE (Microsoft 'Unicode') for use in structs.
[ "Encodes", "text", "as", "UTF", "-", "16LE", "(", "Microsoft", "Unicode", ")", "for", "use", "in", "structs", "." ]
def getRaw(text): """ Encodes text as UTF-16LE (Microsoft 'Unicode') for use in structs. """ return text.encode('UTF-16LE')
[ "def", "getRaw", "(", "text", ")", ":", "return", "text", ".", "encode", "(", "'UTF-16LE'", ")" ]
https://github.com/pyinstaller/pyinstaller/blob/872312500a8a324d25fb405f85117f7966a0ebd5/PyInstaller/utils/win32/versioninfo.py#L49-L53
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
lib-python/2.7/rfc822.py
python
Message.readheaders
(self)
Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over i...
Read header lines.
[ "Read", "header", "lines", "." ]
def readheaders(self): """Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an a...
[ "def", "readheaders", "(", "self", ")", ":", "self", ".", "dict", "=", "{", "}", "self", ".", "unixfrom", "=", "''", "self", ".", "headers", "=", "lst", "=", "[", "]", "self", ".", "status", "=", "''", "headerseen", "=", "\"\"", "firstline", "=", ...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/rfc822.py#L122-L200
rucio/rucio
6d0d358e04f5431f0b9a98ae40f31af0ddff4833
lib/rucio/db/sqla/migrate_repo/versions/5f139f77382a_added_child_rule_id_column.py
python
upgrade
()
Upgrade the database to this revision
Upgrade the database to this revision
[ "Upgrade", "the", "database", "to", "this", "revision" ]
def upgrade(): ''' Upgrade the database to this revision ''' if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']: schema = context.get_context().version_table_schema if context.get_context().version_table_schema else '' add_column('rules', sa.Column('child_rule_id...
[ "def", "upgrade", "(", ")", ":", "if", "context", ".", "get_context", "(", ")", ".", "dialect", ".", "name", "in", "[", "'oracle'", ",", "'mysql'", ",", "'postgresql'", "]", ":", "schema", "=", "context", ".", "get_context", "(", ")", ".", "version_tab...
https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/db/sqla/migrate_repo/versions/5f139f77382a_added_child_rule_id_column.py#L36-L48
arizvisa/ida-minsc
8627a60f047b5e55d3efeecde332039cd1a16eea
base/database.py
python
address.prevstack
(cls, delta)
return cls.prevstack(ui.current.address(), delta)
Return the previous instruction from the current one that is past the specified sp `delta`.
Return the previous instruction from the current one that is past the specified sp `delta`.
[ "Return", "the", "previous", "instruction", "from", "the", "current", "one", "that", "is", "past", "the", "specified", "sp", "delta", "." ]
def prevstack(cls, delta): '''Return the previous instruction from the current one that is past the specified sp `delta`.''' return cls.prevstack(ui.current.address(), delta)
[ "def", "prevstack", "(", "cls", ",", "delta", ")", ":", "return", "cls", ".", "prevstack", "(", "ui", ".", "current", ".", "address", "(", ")", ",", "delta", ")" ]
https://github.com/arizvisa/ida-minsc/blob/8627a60f047b5e55d3efeecde332039cd1a16eea/base/database.py#L2927-L2929
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
set_segm_class
(*args)
return _idaapi.set_segm_class(*args)
set_segm_class(s, sclass) -> int
set_segm_class(s, sclass) -> int
[ "set_segm_class", "(", "s", "sclass", ")", "-", ">", "int" ]
def set_segm_class(*args): """ set_segm_class(s, sclass) -> int """ return _idaapi.set_segm_class(*args)
[ "def", "set_segm_class", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "set_segm_class", "(", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L48240-L48244
lisa-lab/pylearn2
af81e5c362f0df4df85c3e54e23b2adeec026055
pylearn2/models/rbm.py
python
RBM.mean_v_given_h
(self, h)
Compute the mean activation of the visibles given hidden unit configurations for a set of training examples. Parameters ---------- h : tensor_like or list of tensor_likes Theano symbolic (or list thereof) representing the hidden unit states for a batch (or severa...
Compute the mean activation of the visibles given hidden unit configurations for a set of training examples.
[ "Compute", "the", "mean", "activation", "of", "the", "visibles", "given", "hidden", "unit", "configurations", "for", "a", "set", "of", "training", "examples", "." ]
def mean_v_given_h(self, h): """ Compute the mean activation of the visibles given hidden unit configurations for a set of training examples. Parameters ---------- h : tensor_like or list of tensor_likes Theano symbolic (or list thereof) representing the hidd...
[ "def", "mean_v_given_h", "(", "self", ",", "h", ")", ":", "if", "isinstance", "(", "h", ",", "tensor", ".", "Variable", ")", ":", "return", "nnet", ".", "sigmoid", "(", "self", ".", "input_to_v_from_h", "(", "h", ")", ")", "else", ":", "return", "[",...
https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/models/rbm.py#L746-L769
forrestbao/pyeeg
a6c18bb093e4748f9d9c208535a6ae024a0802b8
pyeeg/hjorth_mobility_complexity.py
python
hjorth
(X, D=None)
return numpy.sqrt(M2 / TP), numpy.sqrt( float(M4) * TP / M2 / M2 )
Compute Hjorth mobility and complexity of a time series from either two cases below: 1. X, the time series of type list (default) 2. D, a first order differential sequence of X (if D is provided, recommended to speed up) In case 1, D is computed using Numpy's Difference function. ...
Compute Hjorth mobility and complexity of a time series from either two cases below: 1. X, the time series of type list (default) 2. D, a first order differential sequence of X (if D is provided, recommended to speed up)
[ "Compute", "Hjorth", "mobility", "and", "complexity", "of", "a", "time", "series", "from", "either", "two", "cases", "below", ":", "1", ".", "X", "the", "time", "series", "of", "type", "list", "(", "default", ")", "2", ".", "D", "a", "first", "order", ...
def hjorth(X, D=None): """ Compute Hjorth mobility and complexity of a time series from either two cases below: 1. X, the time series of type list (default) 2. D, a first order differential sequence of X (if D is provided, recommended to speed up) In case 1, D is computed using N...
[ "def", "hjorth", "(", "X", ",", "D", "=", "None", ")", ":", "if", "D", "is", "None", ":", "D", "=", "numpy", ".", "diff", "(", "X", ")", "D", "=", "D", ".", "tolist", "(", ")", "D", ".", "insert", "(", "0", ",", "X", "[", "0", "]", ")",...
https://github.com/forrestbao/pyeeg/blob/a6c18bb093e4748f9d9c208535a6ae024a0802b8/pyeeg/hjorth_mobility_complexity.py#L4-L59
nucypher/nucypher
f420caeb1c974f511f689fd1e5a9c6bbdf97f2d7
nucypher/config/util.py
python
cast_paths_from
(cls, payload)
return payload
A serialization helper. Iterates over constructor arguments of `cls` and `cls` parents. Finds arguments of type `pathlib.Path` or `Optional[pathlib.Path]`. Based on this, it casts corresponding values in `payload` from `str` to `pathlib.Path` or None.
A serialization helper. Iterates over constructor arguments of `cls` and `cls` parents. Finds arguments of type `pathlib.Path` or `Optional[pathlib.Path]`. Based on this, it casts corresponding values in `payload` from `str` to `pathlib.Path` or None.
[ "A", "serialization", "helper", ".", "Iterates", "over", "constructor", "arguments", "of", "cls", "and", "cls", "parents", ".", "Finds", "arguments", "of", "type", "pathlib", ".", "Path", "or", "Optional", "[", "pathlib", ".", "Path", "]", ".", "Based", "o...
def cast_paths_from(cls, payload): """ A serialization helper. Iterates over constructor arguments of `cls` and `cls` parents. Finds arguments of type `pathlib.Path` or `Optional[pathlib.Path]`. Based on this, it casts corresponding values in `payload` from `str` to `pathlib.Path` or None. """ ...
[ "def", "cast_paths_from", "(", "cls", ",", "payload", ")", ":", "constructor_args", "=", "get_type_hints", "(", "cls", ".", "__init__", ")", "for", "ancestor", "in", "cls", ".", "__mro__", ":", "constructor_args", ".", "update", "(", "get_type_hints", "(", "...
https://github.com/nucypher/nucypher/blob/f420caeb1c974f511f689fd1e5a9c6bbdf97f2d7/nucypher/config/util.py#L22-L39
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/jinja2/compiler.py
python
CodeGenerator.visit_ScopedEvalContextModifier
(self, node, frame)
[]
def visit_ScopedEvalContextModifier(self, node, frame): old_ctx_name = self.temporary_identifier() saved_ctx = frame.eval_ctx.save() self.writeline('%s = context.eval_ctx.save()' % old_ctx_name) self.visit_EvalContextModifier(node, frame) for child in node.body: self....
[ "def", "visit_ScopedEvalContextModifier", "(", "self", ",", "node", ",", "frame", ")", ":", "old_ctx_name", "=", "self", ".", "temporary_identifier", "(", ")", "saved_ctx", "=", "frame", ".", "eval_ctx", ".", "save", "(", ")", "self", ".", "writeline", "(", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/jinja2/compiler.py#L1713-L1721
cobbler/cobbler
eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc
cobbler/items/image.py
python
Image.virt_auto_boot
(self)
return self._virt_auto_boot
r""" Whether the VM should be booted when booting the host or not. :getter: ``True`` means autoboot is enabled, otherwise VM is not booted automatically. :setter: The new state for the property.
r""" Whether the VM should be booted when booting the host or not.
[ "r", "Whether", "the", "VM", "should", "be", "booted", "when", "booting", "the", "host", "or", "not", "." ]
def virt_auto_boot(self) -> bool: r""" Whether the VM should be booted when booting the host or not. :getter: ``True`` means autoboot is enabled, otherwise VM is not booted automatically. :setter: The new state for the property. """ return self._virt_auto_boot
[ "def", "virt_auto_boot", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_virt_auto_boot" ]
https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/items/image.py#L335-L342
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/idna/compat.py
python
ToASCII
(label)
return encode(label)
[]
def ToASCII(label): return encode(label)
[ "def", "ToASCII", "(", "label", ")", ":", "return", "encode", "(", "label", ")" ]
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/idna/compat.py#L4-L5
hyperledger/indy-plenum
7566f960f86d8ce74a26fa6ccbd534b942fc4223
plenum/server/node.py
python
Node.service_observer
(self, limit)
return await self._observer.serviceQueues(limit)
Service the observer's inBox and outBox :return: the number of messages successfully serviced
Service the observer's inBox and outBox
[ "Service", "the", "observer", "s", "inBox", "and", "outBox" ]
async def service_observer(self, limit) -> int: """ Service the observer's inBox and outBox :return: the number of messages successfully serviced """ if not self.isReady(): return 0 return await self._observer.serviceQueues(limit)
[ "async", "def", "service_observer", "(", "self", ",", "limit", ")", "->", "int", ":", "if", "not", "self", ".", "isReady", "(", ")", ":", "return", "0", "return", "await", "self", ".", "_observer", ".", "serviceQueues", "(", "limit", ")" ]
https://github.com/hyperledger/indy-plenum/blob/7566f960f86d8ce74a26fa6ccbd534b942fc4223/plenum/server/node.py#L1159-L1167
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/collections.py
python
MappedCollection._convert
(self, dictlike)
Validate and convert a dict-like object into values for set()ing. This is called behind the scenes when a MappedCollection is replaced entirely by another collection, as in:: myobj.mappedcollection = {'a':obj1, 'b': obj2} # ... Raises a TypeError if the key in any (key, value) pair ...
Validate and convert a dict-like object into values for set()ing.
[ "Validate", "and", "convert", "a", "dict", "-", "like", "object", "into", "values", "for", "set", "()", "ing", "." ]
def _convert(self, dictlike): """Validate and convert a dict-like object into values for set()ing. This is called behind the scenes when a MappedCollection is replaced entirely by another collection, as in:: myobj.mappedcollection = {'a':obj1, 'b': obj2} # ... Raises a TypeE...
[ "def", "_convert", "(", "self", ",", "dictlike", ")", ":", "for", "incoming_key", ",", "value", "in", "util", ".", "dictlike_iteritems", "(", "dictlike", ")", ":", "new_key", "=", "self", ".", "keyfunc", "(", "value", ")", "if", "incoming_key", "!=", "ne...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/orm/collections.py#L1521-L1542
stevearc/pypicloud
046126f0b2a692b7bd382ae5cd3bf7af2f58103c
pypicloud/util.py
python
normalize_name
(name: str)
return re.sub(r"[-_.]+", "-", name).lower()
Normalize a python package name
Normalize a python package name
[ "Normalize", "a", "python", "package", "name" ]
def normalize_name(name: str) -> str: """Normalize a python package name""" # Lifted directly from PEP503: # https://www.python.org/dev/peps/pep-0503/#id4 return re.sub(r"[-_.]+", "-", name).lower()
[ "def", "normalize_name", "(", "name", ":", "str", ")", "->", "str", ":", "# Lifted directly from PEP503:", "# https://www.python.org/dev/peps/pep-0503/#id4", "return", "re", ".", "sub", "(", "r\"[-_.]+\"", ",", "\"-\"", ",", "name", ")", ".", "lower", "(", ")" ]
https://github.com/stevearc/pypicloud/blob/046126f0b2a692b7bd382ae5cd3bf7af2f58103c/pypicloud/util.py#L67-L71
Robot-Will/Stino
a94831cd1bf40a59587a7b6cc2e9b5c4306b1bf2
libs/base_utils/task_queue.py
python
ActionQueue._start
(self)
.
.
[ "." ]
def _start(self): """.""" if not self._is_alive: self._is_alive = True thread = threading.Thread(target=self._run) thread.start()
[ "def", "_start", "(", "self", ")", ":", "if", "not", "self", ".", "_is_alive", ":", "self", ".", "_is_alive", "=", "True", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_run", ")", "thread", ".", "start", "(", ")" ]
https://github.com/Robot-Will/Stino/blob/a94831cd1bf40a59587a7b6cc2e9b5c4306b1bf2/libs/base_utils/task_queue.py#L31-L36
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmenters/pillike.py
python
Affine._augment_batch_
(self, batch, random_state, parents, hooks)
return super(Affine, self)._augment_batch_( batch, random_state, parents, hooks)
[]
def _augment_batch_(self, batch, random_state, parents, hooks): cols = batch.get_column_names() assert len(cols) == 0 or (len(cols) == 1 and "images" in cols), ( "pillike.Affine can currently only process image data. Got a " "batch containing: %s. Use imgaug.augmenters.geometric....
[ "def", "_augment_batch_", "(", "self", ",", "batch", ",", "random_state", ",", "parents", ",", "hooks", ")", ":", "cols", "=", "batch", ".", "get_column_names", "(", ")", "assert", "len", "(", "cols", ")", "==", "0", "or", "(", "len", "(", "cols", ")...
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/pillike.py#L2461-L2469
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/celery/celery/worker/buckets.py
python
TaskBucket.get_bucket_for_type
(self, task_name)
return self.buckets[task_name]
Get the bucket for a particular task type.
Get the bucket for a particular task type.
[ "Get", "the", "bucket", "for", "a", "particular", "task", "type", "." ]
def get_bucket_for_type(self, task_name): """Get the bucket for a particular task type.""" if task_name not in self.buckets: return self.add_bucket_for_type(task_name) return self.buckets[task_name]
[ "def", "get_bucket_for_type", "(", "self", ",", "task_name", ")", ":", "if", "task_name", "not", "in", "self", ".", "buckets", ":", "return", "self", ".", "add_bucket_for_type", "(", "task_name", ")", "return", "self", ".", "buckets", "[", "task_name", "]" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/celery/celery/worker/buckets.py#L162-L166
wechatpy/wechatpy
5f693a7e90156786c2540ad3c941d12cdf6d88ef
wechatpy/crypto/__init__.py
python
RefundCrypto.encrypt
(self, text)
return self._encrypt(text)
[]
def encrypt(self, text): return self._encrypt(text)
[ "def", "encrypt", "(", "self", ",", "text", ")", ":", "return", "self", ".", "_encrypt", "(", "text", ")" ]
https://github.com/wechatpy/wechatpy/blob/5f693a7e90156786c2540ad3c941d12cdf6d88ef/wechatpy/crypto/__init__.py#L115-L116
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/mpl_toolkits/mplot3d/art3d.py
python
text_2d_to_3d
(obj, z=0, zdir='z')
Convert a Text to a Text3D object.
Convert a Text to a Text3D object.
[ "Convert", "a", "Text", "to", "a", "Text3D", "object", "." ]
def text_2d_to_3d(obj, z=0, zdir='z'): """Convert a Text to a Text3D object.""" obj.__class__ = Text3D obj.set_3d_properties(z, zdir)
[ "def", "text_2d_to_3d", "(", "obj", ",", "z", "=", "0", ",", "zdir", "=", "'z'", ")", ":", "obj", ".", "__class__", "=", "Text3D", "obj", ".", "set_3d_properties", "(", "z", ",", "zdir", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/mpl_toolkits/mplot3d/art3d.py#L86-L89
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/curves/constructor.py
python
_is_irreducible_and_reduced
(F)
return len(factors) == 1 and factors[0][1] == 1
Check if the polynomial F is irreducible and reduced. TESTS:: sage: R.<x,y> = QQ[] sage: F = x^2 + y^2 sage: from sage.schemes.curves.constructor import _is_irreducible_and_reduced sage: _is_irreducible_and_reduced(F) True
Check if the polynomial F is irreducible and reduced.
[ "Check", "if", "the", "polynomial", "F", "is", "irreducible", "and", "reduced", "." ]
def _is_irreducible_and_reduced(F): """ Check if the polynomial F is irreducible and reduced. TESTS:: sage: R.<x,y> = QQ[] sage: F = x^2 + y^2 sage: from sage.schemes.curves.constructor import _is_irreducible_and_reduced sage: _is_irreducible_and_reduced(F) True ...
[ "def", "_is_irreducible_and_reduced", "(", "F", ")", ":", "factors", "=", "F", ".", "factor", "(", ")", "return", "len", "(", "factors", ")", "==", "1", "and", "factors", "[", "0", "]", "[", "1", "]", "==", "1" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/curves/constructor.py#L80-L93
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/logging/__init__.py
python
PlaceHolder.__init__
(self, alogger)
Initialize with the specified logger being a child of this placeholder.
Initialize with the specified logger being a child of this placeholder.
[ "Initialize", "with", "the", "specified", "logger", "being", "a", "child", "of", "this", "placeholder", "." ]
def __init__(self, alogger): """ Initialize with the specified logger being a child of this placeholder. """ self.loggerMap = { alogger : None }
[ "def", "__init__", "(", "self", ",", "alogger", ")", ":", "self", ".", "loggerMap", "=", "{", "alogger", ":", "None", "}" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/logging/__init__.py#L1046-L1050
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/locale.py
python
_strcoll
(a,b)
return (a > b) - (a < b)
strcoll(string,string) -> int. Compares two strings according to the locale.
strcoll(string,string) -> int. Compares two strings according to the locale.
[ "strcoll", "(", "string", "string", ")", "-", ">", "int", ".", "Compares", "two", "strings", "according", "to", "the", "locale", "." ]
def _strcoll(a,b): """ strcoll(string,string) -> int. Compares two strings according to the locale. """ return (a > b) - (a < b)
[ "def", "_strcoll", "(", "a", ",", "b", ")", ":", "return", "(", "a", ">", "b", ")", "-", "(", "a", "<", "b", ")" ]
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/locale.py#L34-L38
mypaint/mypaint
90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33
lib/palette.py
python
Palette.sequence_changed
(self)
Event: the color ordering or palette length was changed.
Event: the color ordering or palette length was changed.
[ "Event", ":", "the", "color", "ordering", "or", "palette", "length", "was", "changed", "." ]
def sequence_changed(self): """Event: the color ordering or palette length was changed."""
[ "def", "sequence_changed", "(", "self", ")", ":" ]
https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/lib/palette.py#L769-L770
Lausannen/NAS-FCOS
d586b28c0fae72a9f30119797732e614a2517de5
maskrcnn_benchmark/modeling/detector/generalized_rcnn.py
python
GeneralizedRCNN.forward
(self, images, targets=None)
return result
Arguments: images (list[Tensor] or ImageList): images to be processed targets (list[BoxList]): ground-truth boxes present in the image (optional) Returns: result (list[BoxList] or dict[Tensor]): the output from the model. During training, it returns a dict[Te...
Arguments: images (list[Tensor] or ImageList): images to be processed targets (list[BoxList]): ground-truth boxes present in the image (optional)
[ "Arguments", ":", "images", "(", "list", "[", "Tensor", "]", "or", "ImageList", ")", ":", "images", "to", "be", "processed", "targets", "(", "list", "[", "BoxList", "]", ")", ":", "ground", "-", "truth", "boxes", "present", "in", "the", "image", "(", ...
def forward(self, images, targets=None): """ Arguments: images (list[Tensor] or ImageList): images to be processed targets (list[BoxList]): ground-truth boxes present in the image (optional) Returns: result (list[BoxList] or dict[Tensor]): the output from the...
[ "def", "forward", "(", "self", ",", "images", ",", "targets", "=", "None", ")", ":", "if", "self", ".", "training", "and", "targets", "is", "None", ":", "raise", "ValueError", "(", "\"In training mode, targets should be passed\"", ")", "images", "=", "to_image...
https://github.com/Lausannen/NAS-FCOS/blob/d586b28c0fae72a9f30119797732e614a2517de5/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py#L49-L81
DataBiosphere/toil
2e148eee2114ece8dcc3ec8a83f36333266ece0d
src/toil/utils/toilStats.py
python
buildElement
(element: Expando, items: List[Job], itemName: str)
return element[itemName]
Create an element for output.
Create an element for output.
[ "Create", "an", "element", "for", "output", "." ]
def buildElement(element: Expando, items: List[Job], itemName: str) -> Expando: """ Create an element for output. """ def assertNonnegative(i: float, name: str) -> float: if i < 0: raise RuntimeError("Negative value %s reported for %s" %(i,name) ) else: return float(i...
[ "def", "buildElement", "(", "element", ":", "Expando", ",", "items", ":", "List", "[", "Job", "]", ",", "itemName", ":", "str", ")", "->", "Expando", ":", "def", "assertNonnegative", "(", "i", ":", "float", ",", "name", ":", "str", ")", "->", "float"...
https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/src/toil/utils/toilStats.py#L363-L422
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py
python
exchange_partitions_result.__init__
(self, success=None, o1=None, o2=None, o3=None, o4=None,)
[]
def __init__(self, success=None, o1=None, o2=None, o3=None, o4=None,): self.success = success self.o1 = o1 self.o2 = o2 self.o3 = o3 self.o4 = o4
[ "def", "__init__", "(", "self", ",", "success", "=", "None", ",", "o1", "=", "None", ",", "o2", "=", "None", ",", "o3", "=", "None", ",", "o4", "=", "None", ",", ")", ":", "self", ".", "success", "=", "success", "self", ".", "o1", "=", "o1", ...
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L19541-L19546
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/ui/gui/xkl_wrapper.py
python
XklWrapper.replace_layouts
(self, layouts_list)
Method that replaces the layouts defined in the current X configuration with the new ones given. :param layouts_list: list of layouts defined as either 'layout' or 'layout (variant)' :raise XklWrapperError: if layouts cannot be replaced with the new ones
Method that replaces the layouts defined in the current X configuration with the new ones given.
[ "Method", "that", "replaces", "the", "layouts", "defined", "in", "the", "current", "X", "configuration", "with", "the", "new", "ones", "given", "." ]
def replace_layouts(self, layouts_list): """ Method that replaces the layouts defined in the current X configuration with the new ones given. :param layouts_list: list of layouts defined as either 'layout' or 'layout (variant)' :raise XklWrapperError...
[ "def", "replace_layouts", "(", "self", ",", "layouts_list", ")", ":", "new_layouts", "=", "list", "(", ")", "new_variants", "=", "list", "(", ")", "for", "layout_variant", "in", "layouts_list", ":", "(", "layout", ",", "variant", ")", "=", "parse_layout_vari...
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/ui/gui/xkl_wrapper.py#L357-L381
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/metagoofil/hachoir_metadata/audio.py
python
computeComprRate
(meta, size)
[]
def computeComprRate(meta, size): if not meta.has("duration") \ or not meta.has("sample_rate") \ or not meta.has("bits_per_sample") \ or not meta.has("nb_channel") \ or not size: return orig_size = timedelta2seconds(meta.get("duration")) * meta.get('sample_rate') * meta.get('bits_per_sam...
[ "def", "computeComprRate", "(", "meta", ",", "size", ")", ":", "if", "not", "meta", ".", "has", "(", "\"duration\"", ")", "or", "not", "meta", ".", "has", "(", "\"sample_rate\"", ")", "or", "not", "meta", ".", "has", "(", "\"bits_per_sample\"", ")", "o...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_metadata/audio.py#L11-L19
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/urllib3/contrib/ntlmpool.py
python
NTLMConnectionPool.__init__
(self, user, pw, authurl, *args, **kwargs)
authurl is a random URL on the server that is protected by NTLM. user is the Windows user, probably in the DOMAIN\\username format. pw is the password for the user.
authurl is a random URL on the server that is protected by NTLM. user is the Windows user, probably in the DOMAIN\\username format. pw is the password for the user.
[ "authurl", "is", "a", "random", "URL", "on", "the", "server", "that", "is", "protected", "by", "NTLM", ".", "user", "is", "the", "Windows", "user", "probably", "in", "the", "DOMAIN", "\\\\", "username", "format", ".", "pw", "is", "the", "password", "for"...
def __init__(self, user, pw, authurl, *args, **kwargs): """ authurl is a random URL on the server that is protected by NTLM. user is the Windows user, probably in the DOMAIN\\username format. pw is the password for the user. """ super(NTLMConnectionPool, self).__init__(*a...
[ "def", "__init__", "(", "self", ",", "user", ",", "pw", ",", "authurl", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "NTLMConnectionPool", ",", "self", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "s...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/urllib3/contrib/ntlmpool.py#L34-L46
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py
python
SessionRedirectMixin.get_redirect_target
(self, resp)
return None
Receives a Response. Returns a redirect URI or ``None``
Receives a Response. Returns a redirect URI or ``None``
[ "Receives", "a", "Response", ".", "Returns", "a", "redirect", "URI", "or", "None" ]
def get_redirect_target(self, resp): """Receives a Response. Returns a redirect URI or ``None``""" # Due to the nature of how requests processes redirects this method will # be called at least once upon the original response and at least twice # on each subsequent redirect response (if a...
[ "def", "get_redirect_target", "(", "self", ",", "resp", ")", ":", "# Due to the nature of how requests processes redirects this method will", "# be called at least once upon the original response and at least twice", "# on each subsequent redirect response (if any).", "# If a custom mixin is u...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py#L97-L116
quentinhardy/odat
364b94cc662dcbb95a0b28880c6a71ddfc66dd6b
ServiceNameGuesser.py
python
ServiceNameGuesser.__testIfAGoodServiceName__
(self)
Test if it is a good Service Name
Test if it is a good Service Name
[ "Test", "if", "it", "is", "a", "good", "Service", "Name" ]
def __testIfAGoodServiceName__(self): ''' Test if it is a good Service Name ''' no_good_service_name_found = False self.__generateConnectionString__(username=self.__generateRandomString__(nb=15), password=self.__generateRandomString__(nb=5)) logging.debug("Try to connect with the {0} Service Name ({1})".for...
[ "def", "__testIfAGoodServiceName__", "(", "self", ")", ":", "no_good_service_name_found", "=", "False", "self", ".", "__generateConnectionString__", "(", "username", "=", "self", ".", "__generateRandomString__", "(", "nb", "=", "15", ")", ",", "password", "=", "se...
https://github.com/quentinhardy/odat/blob/364b94cc662dcbb95a0b28880c6a71ddfc66dd6b/ServiceNameGuesser.py#L57-L76
svenkreiss/pysparkling
f0e8e8d039f3313c2693b7c7576cb1b7ba5a6d78
pysparkling/sql/functions.py
python
dayofmonth
(e)
return col(DayOfMonth(ensure_column(e)))
:rtype: Column
:rtype: Column
[ ":", "rtype", ":", "Column" ]
def dayofmonth(e): """ :rtype: Column """ return col(DayOfMonth(ensure_column(e)))
[ "def", "dayofmonth", "(", "e", ")", ":", "return", "col", "(", "DayOfMonth", "(", "ensure_column", "(", "e", ")", ")", ")" ]
https://github.com/svenkreiss/pysparkling/blob/f0e8e8d039f3313c2693b7c7576cb1b7ba5a6d78/pysparkling/sql/functions.py#L1756-L1760
tooxie/shiva-server
4d169aae8d4cb01133f62701b14610695e48c297
shiva/utils.py
python
MetadataManager.title
(self)
return self._getter('title')
[]
def title(self): return self._getter('title')
[ "def", "title", "(", "self", ")", ":", "return", "self", ".", "_getter", "(", "'title'", ")" ]
https://github.com/tooxie/shiva-server/blob/4d169aae8d4cb01133f62701b14610695e48c297/shiva/utils.py#L118-L119
snakeztc/NeuralDialog-ZSDG
1d1548457a16a2e07567dc8532ea8b2fba178540
zsdg/models/model_bases.py
python
BaseModel.ptr_loss
(self, dec_ctx, labels)
return avg_attn_loss
[]
def ptr_loss(self, dec_ctx, labels): # find attention loss g = dec_ctx[DecoderPointerGen.KEY_G] ptr_softmax = dec_ctx[DecoderPointerGen.KEY_PTR_SOFTMAX] flat_ptr = ptr_softmax.view(-1, self.vocab_size) label_mask = labels.view(-1, 1) == self.rev_vocab[PAD] label_ptr = fla...
[ "def", "ptr_loss", "(", "self", ",", "dec_ctx", ",", "labels", ")", ":", "# find attention loss", "g", "=", "dec_ctx", "[", "DecoderPointerGen", ".", "KEY_G", "]", "ptr_softmax", "=", "dec_ctx", "[", "DecoderPointerGen", ".", "KEY_PTR_SOFTMAX", "]", "flat_ptr", ...
https://github.com/snakeztc/NeuralDialog-ZSDG/blob/1d1548457a16a2e07567dc8532ea8b2fba178540/zsdg/models/model_bases.py#L139-L154
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /scripts/sshbackdoors/rpyc/utils/classic.py
python
upload
(conn, localpath, remotepath, filter = None, ignore_invalid = False, chunk_size = 16000)
uploads a file or a directory to the given remote path :param localpath: the local file or directory :param remotepath: the remote path :param filter: a predicate that accepts the filename and determines whether it should be uploaded; None means any file :param chunk_size: the IO...
uploads a file or a directory to the given remote path :param localpath: the local file or directory :param remotepath: the remote path :param filter: a predicate that accepts the filename and determines whether it should be uploaded; None means any file :param chunk_size: the IO...
[ "uploads", "a", "file", "or", "a", "directory", "to", "the", "given", "remote", "path", ":", "param", "localpath", ":", "the", "local", "file", "or", "directory", ":", "param", "remotepath", ":", "the", "remote", "path", ":", "param", "filter", ":", "a",...
def upload(conn, localpath, remotepath, filter = None, ignore_invalid = False, chunk_size = 16000): """uploads a file or a directory to the given remote path :param localpath: the local file or directory :param remotepath: the remote path :param filter: a predicate that accepts the filename and det...
[ "def", "upload", "(", "conn", ",", "localpath", ",", "remotepath", ",", "filter", "=", "None", ",", "ignore_invalid", "=", "False", ",", "chunk_size", "=", "16000", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "localpath", ")", ":", "upload_di...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /scripts/sshbackdoors/rpyc/utils/classic.py#L151-L166
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Tools/bgen/bgen/bgenBuffer.py
python
StructInputOutputBufferType.getOutputBufferDeclarations
(self, name, constmode=False, outmode=False)
return ["%s%s %s__out__" % (self.type, out, name)]
[]
def getOutputBufferDeclarations(self, name, constmode=False, outmode=False): if constmode: raise RuntimeError, "Cannot use const output buffer" if outmode: out = "*" else: out = "" return ["%s%s %s__out__" % (self.type, out, name)]
[ "def", "getOutputBufferDeclarations", "(", "self", ",", "name", ",", "constmode", "=", "False", ",", "outmode", "=", "False", ")", ":", "if", "constmode", ":", "raise", "RuntimeError", ",", "\"Cannot use const output buffer\"", "if", "outmode", ":", "out", "=", ...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Tools/bgen/bgen/bgenBuffer.py#L217-L224
pyansys/pymapdl
c07291fc062b359abf0e92b95a92d753a95ef3d7
ansys/mapdl/core/_commands/preproc/coupled_dof.py
python
CoupledDOF.cpngen
(self, nset="", lab="", node1="", node2="", ninc="", **kwargs)
return self.run(command, **kwargs)
Defines, modifies, or adds to a set of coupled degrees of freedom. APDL Command: CPNGEN Parameters ---------- nset Set reference number [CP]. lab Degree of freedom label [CP]. node1, node2, ninc Include in coupled set nodes NODE1 to...
Defines, modifies, or adds to a set of coupled degrees of freedom.
[ "Defines", "modifies", "or", "adds", "to", "a", "set", "of", "coupled", "degrees", "of", "freedom", "." ]
def cpngen(self, nset="", lab="", node1="", node2="", ninc="", **kwargs): """Defines, modifies, or adds to a set of coupled degrees of freedom. APDL Command: CPNGEN Parameters ---------- nset Set reference number [CP]. lab Degree of freedom labe...
[ "def", "cpngen", "(", "self", ",", "nset", "=", "\"\"", ",", "lab", "=", "\"\"", ",", "node1", "=", "\"\"", ",", "node2", "=", "\"\"", ",", "ninc", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "command", "=", "f\"CPNGEN,{nset},{lab},{node1},{node2},...
https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/preproc/coupled_dof.py#L290-L318
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_zabbix/build/lib/base.py
python
Utils.get_priority
(priority)
return prior
determine priority
determine priority
[ "determine", "priority" ]
def get_priority(priority): ''' determine priority ''' prior = 0 if 'info' in priority: prior = 1 elif 'warn' in priority: prior = 2 elif 'avg' == priority or 'ave' in priority: prior = 3 elif 'high' in priority: prior = 4 ...
[ "def", "get_priority", "(", "priority", ")", ":", "prior", "=", "0", "if", "'info'", "in", "priority", ":", "prior", "=", "1", "elif", "'warn'", "in", "priority", ":", "prior", "=", "2", "elif", "'avg'", "==", "priority", "or", "'ave'", "in", "priority...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_zabbix/build/lib/base.py#L15-L29
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/query/positional.py
python
Sequence.__eq__
(self, other)
return (other and type(self) is type(other) and self.subqueries == other.subqueries and self.boost == other.boost)
[]
def __eq__(self, other): return (other and type(self) is type(other) and self.subqueries == other.subqueries and self.boost == other.boost)
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "return", "(", "other", "and", "type", "(", "self", ")", "is", "type", "(", "other", ")", "and", "self", ".", "subqueries", "==", "other", ".", "subqueries", "and", "self", ".", "boost", "==", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/query/positional.py#L65-L68
Azure/azure-storage-python
4306898850dd21617644fc537a57d025e833db74
azure-storage-blob/azure/storage/blob/baseblobservice.py
python
BaseBlobService.get_blob_to_path
( self, container_name, blob_name, file_path, open_mode='wb', snapshot=None, start_range=None, end_range=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if...
return blob
Downloads a blob to a file path, with automatic chunking and progress notifications. Returns an instance of :class:`~azure.storage.blob.models.Blob` with properties and metadata. :param str container_name: Name of existing container. :param str blob_name: Name of...
Downloads a blob to a file path, with automatic chunking and progress notifications. Returns an instance of :class:`~azure.storage.blob.models.Blob` with properties and metadata.
[ "Downloads", "a", "blob", "to", "a", "file", "path", "with", "automatic", "chunking", "and", "progress", "notifications", ".", "Returns", "an", "instance", "of", ":", "class", ":", "~azure", ".", "storage", ".", "blob", ".", "models", ".", "Blob", "with", ...
def get_blob_to_path( self, container_name, blob_name, file_path, open_mode='wb', snapshot=None, start_range=None, end_range=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=Non...
[ "def", "get_blob_to_path", "(", "self", ",", "container_name", ",", "blob_name", ",", "file_path", ",", "open_mode", "=", "'wb'", ",", "snapshot", "=", "None", ",", "start_range", "=", "None", ",", "end_range", "=", "None", ",", "validate_content", "=", "Fal...
https://github.com/Azure/azure-storage-python/blob/4306898850dd21617644fc537a57d025e833db74/azure-storage-blob/azure/storage/blob/baseblobservice.py#L1889-L2016
meduza-corp/interstellar
40a801ccd7856491726f5a126621d9318cabe2e1
gsutil/third_party/boto/boto/ec2/cloudwatch/__init__.py
python
CloudWatchConnection.put_metric_alarm
(self, alarm)
return self.get_status('PutMetricAlarm', params)
Creates or updates an alarm and associates it with the specified Amazon CloudWatch metric. Optionally, this operation can associate one or more Amazon Simple Notification Service resources with the alarm. When this operation creates an alarm, the alarm state is immediately set to INSUFF...
Creates or updates an alarm and associates it with the specified Amazon CloudWatch metric. Optionally, this operation can associate one or more Amazon Simple Notification Service resources with the alarm.
[ "Creates", "or", "updates", "an", "alarm", "and", "associates", "it", "with", "the", "specified", "Amazon", "CloudWatch", "metric", ".", "Optionally", "this", "operation", "can", "associate", "one", "or", "more", "Amazon", "Simple", "Notification", "Service", "r...
def put_metric_alarm(self, alarm): """ Creates or updates an alarm and associates it with the specified Amazon CloudWatch metric. Optionally, this operation can associate one or more Amazon Simple Notification Service resources with the alarm. When this operation creates an alar...
[ "def", "put_metric_alarm", "(", "self", ",", "alarm", ")", ":", "params", "=", "{", "'AlarmName'", ":", "alarm", ".", "name", ",", "'MetricName'", ":", "alarm", ".", "metric", ",", "'Namespace'", ":", "alarm", ".", "namespace", ",", "'Statistic'", ":", "...
https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/boto/boto/ec2/cloudwatch/__init__.py#L484-L528
nettitude/scrounger
dd393666aa1ba1117d1c472cfdef4d0b18216904
scrounger/utils/general.py
python
pretty_multiline_grep
(needle, haystack, no_lines, after=True)
return findings
Returns a well formatted dict with the results of grepping the needle in the haystack :param str needle: the needle to look for - needs to be a regex :param str haystack: the haystack to look in :param int no_lines: number of lines to be displayed :param Bool after: True if lines to display are aft...
Returns a well formatted dict with the results of grepping the needle in the haystack
[ "Returns", "a", "well", "formatted", "dict", "with", "the", "results", "of", "grepping", "the", "needle", "in", "the", "haystack" ]
def pretty_multiline_grep(needle, haystack, no_lines, after=True): """ Returns a well formatted dict with the results of grepping the needle in the haystack :param str needle: the needle to look for - needs to be a regex :param str haystack: the haystack to look in :param int no_lines: number o...
[ "def", "pretty_multiline_grep", "(", "needle", ",", "haystack", ",", "no_lines", ",", "after", "=", "True", ")", ":", "additional_modifiers", "=", "\"-{} {}\"", ".", "format", "(", "\"A\"", "if", "after", "else", "\"B\"", ",", "int", "(", "no_lines", ")", ...
https://github.com/nettitude/scrounger/blob/dd393666aa1ba1117d1c472cfdef4d0b18216904/scrounger/utils/general.py#L106-L146
JacquesLucke/animation_nodes
b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1
animation_nodes/tree_info/network.py
python
NodeNetwork.getNodes
(self, nodeByID = None)
[]
def getNodes(self, nodeByID = None): if nodeByID is None: return [idToNode(nodeID) for nodeID in self.nodeIDs] else: return [nodeByID[nodeID] for nodeID in self.nodeIDs]
[ "def", "getNodes", "(", "self", ",", "nodeByID", "=", "None", ")", ":", "if", "nodeByID", "is", "None", ":", "return", "[", "idToNode", "(", "nodeID", ")", "for", "nodeID", "in", "self", ".", "nodeIDs", "]", "else", ":", "return", "[", "nodeByID", "[...
https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/tree_info/network.py#L110-L114
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/objects/petri/embed_stochastic_map.py
python
apply
(smap, parameters=None)
Embed the stochastic map into the Petri net Parameters --------------- smap Stochastic map parameters Possible parameters of the algorithm Returns --------------- void
Embed the stochastic map into the Petri net
[ "Embed", "the", "stochastic", "map", "into", "the", "Petri", "net" ]
def apply(smap, parameters=None): """ Embed the stochastic map into the Petri net Parameters --------------- smap Stochastic map parameters Possible parameters of the algorithm Returns --------------- void """ if parameters is None: parameters = {} ...
[ "def", "apply", "(", "smap", ",", "parameters", "=", "None", ")", ":", "if", "parameters", "is", "None", ":", "parameters", "=", "{", "}", "for", "t", "in", "smap", ":", "t", ".", "properties", "[", "STOCHASTIC_DISTRIBUTION", "]", "=", "smap", "[", "...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/objects/petri/embed_stochastic_map.py#L20-L39
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-35/fabmetheus_utilities/geometry/solids/trianglemesh.py
python
TriangleMesh.setCarveIsCorrectMesh
( self, isCorrectMesh )
Set the is correct mesh flag.
Set the is correct mesh flag.
[ "Set", "the", "is", "correct", "mesh", "flag", "." ]
def setCarveIsCorrectMesh( self, isCorrectMesh ): "Set the is correct mesh flag." self.isCorrectMesh = isCorrectMesh
[ "def", "setCarveIsCorrectMesh", "(", "self", ",", "isCorrectMesh", ")", ":", "self", ".", "isCorrectMesh", "=", "isCorrectMesh" ]
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/fabmetheus_utilities/geometry/solids/trianglemesh.py#L793-L795
marinho/geraldo
868ebdce67176d9b6205cddc92476f642c783fff
site/newsite/django_1_0/django/views/decorators/http.py
python
require_http_methods
(request_method_list)
return decorator
Decorator to make a view only accept particular request methods. Usage:: @require_http_methods(["GET", "POST"]) def my_view(request): # I can assume now that only GET or POST requests make it this far # ... Note that request methods should be in uppercase.
Decorator to make a view only accept particular request methods. Usage::
[ "Decorator", "to", "make", "a", "view", "only", "accept", "particular", "request", "methods", ".", "Usage", "::" ]
def require_http_methods(request_method_list): """ Decorator to make a view only accept particular request methods. Usage:: @require_http_methods(["GET", "POST"]) def my_view(request): # I can assume now that only GET or POST requests make it this far # ... Note th...
[ "def", "require_http_methods", "(", "request_method_list", ")", ":", "def", "decorator", "(", "func", ")", ":", "def", "inner", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "request", ".", "method", "not", "in", "request_met...
https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/django_1_0/django/views/decorators/http.py#L16-L33
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py
python
HTTPConnectionPool._validate_conn
(self, conn)
Called right before a request is made, after the socket is created.
Called right before a request is made, after the socket is created.
[ "Called", "right", "before", "a", "request", "is", "made", "after", "the", "socket", "is", "created", "." ]
def _validate_conn(self, conn): """ Called right before a request is made, after the socket is created. """ pass
[ "def", "_validate_conn", "(", "self", ",", "conn", ")", ":", "pass" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py#L287-L291
rotki/rotki
aafa446815cdd5e9477436d1b02bee7d01b398c8
rotkehlchen/exchanges/coinbase.py
python
trade_from_conversion
(trade_a: Dict[str, Any], trade_b: Dict[str, Any])
return Trade( timestamp=timestamp, location=Location.COINBASE, # in coinbase you are buying/selling tx_asset for native_asset base_asset=tx_asset, quote_asset=native_asset, trade_type=TradeType.SELL, amount=amount, rate=rate, fee=fee_amount, ...
Turn information from a conversion into a trade Mary raise: - UnknownAsset due to Asset instantiation - DeserializationError due to unexpected format of dict entries - KeyError due to dict entries missing an expected entry
Turn information from a conversion into a trade
[ "Turn", "information", "from", "a", "conversion", "into", "a", "trade" ]
def trade_from_conversion(trade_a: Dict[str, Any], trade_b: Dict[str, Any]) -> Optional[Trade]: """Turn information from a conversion into a trade Mary raise: - UnknownAsset due to Asset instantiation - DeserializationError due to unexpected format of dict entries - KeyError due to dict entries mis...
[ "def", "trade_from_conversion", "(", "trade_a", ":", "Dict", "[", "str", ",", "Any", "]", ",", "trade_b", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Optional", "[", "Trade", "]", ":", "# Check that the status is complete", "if", "trade_a", "[", ...
https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/rotkehlchen/exchanges/coinbase.py#L105-L156
SPFlow/SPFlow
68ce7dac0f41bd3cf86ccb56555a29ef1368fe69
src/spn/structure/Base.py
python
eval_spn_bottom_up
(node, eval_functions, all_results=None, debug=False, **args)
return all_results[node]
Evaluates the spn bottom up :param node: spn root :param eval_functions: is a dictionary that contains k:Class of the node, v:lambda function that receives as parameters (node, args**) for leave nodes and (node, [children results], args**) :param all_results: is a dictionary that contains k:Class of the n...
Evaluates the spn bottom up
[ "Evaluates", "the", "spn", "bottom", "up" ]
def eval_spn_bottom_up(node, eval_functions, all_results=None, debug=False, **args): """ Evaluates the spn bottom up :param node: spn root :param eval_functions: is a dictionary that contains k:Class of the node, v:lambda function that receives as parameters (node, args**) for leave nodes and (node, [...
[ "def", "eval_spn_bottom_up", "(", "node", ",", "eval_functions", ",", "all_results", "=", "None", ",", "debug", "=", "False", ",", "*", "*", "args", ")", ":", "nodes", "=", "get_topological_order", "(", "node", ")", "if", "debug", ":", "from", "tqdm", "i...
https://github.com/SPFlow/SPFlow/blob/68ce7dac0f41bd3cf86ccb56555a29ef1368fe69/src/spn/structure/Base.py#L348-L413
google-research/uda
960684e363251772a5938451d4d2bc0f1da9e24b
text/utils/tokenization.py
python
whitespace_tokenize
(text)
return tokens
Runs basic whitespace cleaning and splitting on a peice of text.
Runs basic whitespace cleaning and splitting on a peice of text.
[ "Runs", "basic", "whitespace", "cleaning", "and", "splitting", "on", "a", "peice", "of", "text", "." ]
def whitespace_tokenize(text): """Runs basic whitespace cleaning and splitting on a peice of text.""" text = text.strip() if not text: return [] tokens = text.split() return tokens
[ "def", "whitespace_tokenize", "(", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "if", "not", "text", ":", "return", "[", "]", "tokens", "=", "text", ".", "split", "(", ")", "return", "tokens" ]
https://github.com/google-research/uda/blob/960684e363251772a5938451d4d2bc0f1da9e24b/text/utils/tokenization.py#L56-L62
allenai/longformer
caefee668e39cacdece7dd603a0bebf24df6d8ca
scripts/triviaqa.py
python
TriviaQADataset._get_qid
(self, qid)
all input qids are formatted uniqueID__evidenceFile, but for wikipedia, qid = uniqueID, and for web, qid = uniqueID__evidenceFile. This function takes care of this conversion.
all input qids are formatted uniqueID__evidenceFile, but for wikipedia, qid = uniqueID, and for web, qid = uniqueID__evidenceFile. This function takes care of this conversion.
[ "all", "input", "qids", "are", "formatted", "uniqueID__evidenceFile", "but", "for", "wikipedia", "qid", "=", "uniqueID", "and", "for", "web", "qid", "=", "uniqueID__evidenceFile", ".", "This", "function", "takes", "care", "of", "this", "conversion", "." ]
def _get_qid(self, qid): """all input qids are formatted uniqueID__evidenceFile, but for wikipedia, qid = uniqueID, and for web, qid = uniqueID__evidenceFile. This function takes care of this conversion. """ if 'wikipedia' in self.file_path: # for evaluation on wikipedia, eve...
[ "def", "_get_qid", "(", "self", ",", "qid", ")", ":", "if", "'wikipedia'", "in", "self", ".", "file_path", ":", "# for evaluation on wikipedia, every question has one answer even if multiple evidence documents are given", "return", "qid", ".", "split", "(", "'--'", ")", ...
https://github.com/allenai/longformer/blob/caefee668e39cacdece7dd603a0bebf24df6d8ca/scripts/triviaqa.py#L253-L266
hyperspy/hyperspy
1ffb3fab33e607045a37f30c1463350b72617e10
hyperspy/drawing/widget.py
python
ResizersMixin._get_resizer_pos
(self)
return positions
Get the positions of the resizer handles.
Get the positions of the resizer handles.
[ "Get", "the", "positions", "of", "the", "resizer", "handles", "." ]
def _get_resizer_pos(self): """Get the positions of the resizer handles. """ invtrans = self.ax.transData.inverted() border = self.border_thickness # Transform the border thickness into data values dl = np.abs(invtrans.transform((border, border)) - inv...
[ "def", "_get_resizer_pos", "(", "self", ")", ":", "invtrans", "=", "self", ".", "ax", ".", "transData", ".", "inverted", "(", ")", "border", "=", "self", ".", "border_thickness", "# Transform the border thickness into data values", "dl", "=", "np", ".", "abs", ...
https://github.com/hyperspy/hyperspy/blob/1ffb3fab33e607045a37f30c1463350b72617e10/hyperspy/drawing/widget.py#L928-L949
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/zmq/log/handlers.py
python
PUBHandler.format
(self,record)
return self.formatters[record.levelno].format(record)
Format a record.
Format a record.
[ "Format", "a", "record", "." ]
def format(self,record): """Format a record.""" return self.formatters[record.levelno].format(record)
[ "def", "format", "(", "self", ",", "record", ")", ":", "return", "self", ".", "formatters", "[", "record", ".", "levelno", "]", ".", "format", "(", "record", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/zmq/log/handlers.py#L83-L85
enthought/traitsui
b7c38c7a47bf6ae7971f9ddab70c8a358647dd25
traitsui/qt4/range_editor.py
python
LargeRangeSliderEditor.reduce_range
(self)
Reduces the extent of the displayed range.
Reduces the extent of the displayed range.
[ "Reduces", "the", "extent", "of", "the", "displayed", "range", "." ]
def reduce_range(self): """Reduces the extent of the displayed range.""" low, high = self.low, self.high if abs(self.cur_low) < 10: self.cur_low = max(-10, low) self.cur_high = min(10, high) elif self.cur_low > 0: self.cur_high = self.cur_low ...
[ "def", "reduce_range", "(", "self", ")", ":", "low", ",", "high", "=", "self", ".", "low", ",", "self", ".", "high", "if", "abs", "(", "self", ".", "cur_low", ")", "<", "10", ":", "self", ".", "cur_low", "=", "max", "(", "-", "10", ",", "low", ...
https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/qt4/range_editor.py#L515-L531
pgq/skytools-legacy
8b7e6c118572a605d28b7a3403c96aeecfd0d272
python/londiste/handlers/dispatch.py
python
BaseBulkCollectingLoader.flush
(self, curs)
[]
def flush(self, curs): op_map = self.collect_data() self.bulk_flush(curs, op_map)
[ "def", "flush", "(", "self", ",", "curs", ")", ":", "op_map", "=", "self", ".", "collect_data", "(", ")", "self", ".", "bulk_flush", "(", "curs", ",", "op_map", ")" ]
https://github.com/pgq/skytools-legacy/blob/8b7e6c118572a605d28b7a3403c96aeecfd0d272/python/londiste/handlers/dispatch.py#L296-L298
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/_vendor/idna/uts46data.py
python
_seg_24
()
return [ (0x24BA, 'M', u'e'), (0x24BB, 'M', u'f'), (0x24BC, 'M', u'g'), (0x24BD, 'M', u'h'), (0x24BE, 'M', u'i'), (0x24BF, 'M', u'j'), (0x24C0, 'M', u'k'), (0x24C1, 'M', u'l'), (0x24C2, 'M', u'm'), (0x24C3, 'M', u'n'), (0x24C4, 'M', u'o'), (0x24C5, 'M', u'p'), (0x24C6...
[]
def _seg_24(): return [ (0x24BA, 'M', u'e'), (0x24BB, 'M', u'f'), (0x24BC, 'M', u'g'), (0x24BD, 'M', u'h'), (0x24BE, 'M', u'i'), (0x24BF, 'M', u'j'), (0x24C0, 'M', u'k'), (0x24C1, 'M', u'l'), (0x24C2, 'M', u'm'), (0x24C3, 'M', u'n'), (0x24C4, 'M', u'o'), (0x24C5, 'M',...
[ "def", "_seg_24", "(", ")", ":", "return", "[", "(", "0x24BA", ",", "'M'", ",", "u'e'", ")", ",", "(", "0x24BB", ",", "'M'", ",", "u'f'", ")", ",", "(", "0x24BC", ",", "'M'", ",", "u'g'", ")", ",", "(", "0x24BD", ",", "'M'", ",", "u'h'", ")",...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/_vendor/idna/uts46data.py#L2509-L2611
sqlmapproject/sqlmap
3b07b70864624dff4c29dcaa8a61c78e7f9189f7
lib/core/agent.py
python
Agent.suffixQuery
(self, expression, comment=None, suffix=None, where=None, trimEmpty=True)
return re.sub(r";\W*;", ";", expression) if trimEmpty else expression
This method appends the DBMS comment to the SQL injection request
This method appends the DBMS comment to the SQL injection request
[ "This", "method", "appends", "the", "DBMS", "comment", "to", "the", "SQL", "injection", "request" ]
def suffixQuery(self, expression, comment=None, suffix=None, where=None, trimEmpty=True): """ This method appends the DBMS comment to the SQL injection request """ if conf.direct: return self.payloadDirect(expression) if expression is None: retur...
[ "def", "suffixQuery", "(", "self", ",", "expression", ",", "comment", "=", "None", ",", "suffix", "=", "None", ",", "where", "=", "None", ",", "trimEmpty", "=", "True", ")", ":", "if", "conf", ".", "direct", ":", "return", "self", ".", "payloadDirect",...
https://github.com/sqlmapproject/sqlmap/blob/3b07b70864624dff4c29dcaa8a61c78e7f9189f7/lib/core/agent.py#L301-L340
tuckerbalch/QSTK
4981506c37227a72404229d5e1e0887f797a5d57
qstkutil/DataAccess.py
python
DataAccess.get_info
(self)
return retstr
@summary: Returns and prints a string that describes the datastore. @return: A string.
[]
def get_info (self): ''' @summary: Returns and prints a string that describes the datastore. @return: A string. ''' if (self.source == DataSource.NORGATE): retstr = "Norgate:\n" retstr = retstr + "Daily price and volume data from Norgate (premiumdata.net)...
[ "def", "get_info", "(", "self", ")", ":", "if", "(", "self", ".", "source", "==", "DataSource", ".", "NORGATE", ")", ":", "retstr", "=", "\"Norgate:\\n\"", "retstr", "=", "retstr", "+", "\"Daily price and volume data from Norgate (premiumdata.net)\\n\"", "retstr", ...
https://github.com/tuckerbalch/QSTK/blob/4981506c37227a72404229d5e1e0887f797a5d57/qstkutil/DataAccess.py#L652-L702
PyThaiNLP/pythainlp
de38b8507bf0934540aa5094e5f7f57d7f67e2dc
pythainlp/tokenize/core.py
python
sent_tokenize
( text: str, engine: str = DEFAULT_SENT_TOKENIZE_ENGINE, keep_whitespace: bool = True, )
return segments
Sentence tokenizer. Tokenizes running text into "sentences" :param str text: the text to be tokenized :param str engine: choose among *'crfcut'*, *'whitespace'*, \ *'whitespace+newline'* :return: list of splited sentences :rtype: list[str] **Options for engine** * *crfcut* - (defau...
Sentence tokenizer.
[ "Sentence", "tokenizer", "." ]
def sent_tokenize( text: str, engine: str = DEFAULT_SENT_TOKENIZE_ENGINE, keep_whitespace: bool = True, ) -> List[str]: """ Sentence tokenizer. Tokenizes running text into "sentences" :param str text: the text to be tokenized :param str engine: choose among *'crfcut'*, *'whitespace'*, ...
[ "def", "sent_tokenize", "(", "text", ":", "str", ",", "engine", ":", "str", "=", "DEFAULT_SENT_TOKENIZE_ENGINE", ",", "keep_whitespace", ":", "bool", "=", "True", ",", ")", "->", "List", "[", "str", "]", ":", "if", "not", "text", "or", "not", "isinstance...
https://github.com/PyThaiNLP/pythainlp/blob/de38b8507bf0934540aa5094e5f7f57d7f67e2dc/pythainlp/tokenize/core.py#L221-L311
iniqua/plecost
ef0d89bfdf1ef870bd11b1d8bdf93a8ce9ec6ca0
plecost_lib/libs/helpers.py
python
is_remote_a_wordpress
(base_url, error_page, downloader)
This functions checks if remote host contains a WordPress installation. :param base_url: Base url :type base_url: basestring :param error_page: error page content :type error_page: basestring :param downloader: download function. This function must accept only one parameter: the URL :type dow...
This functions checks if remote host contains a WordPress installation.
[ "This", "functions", "checks", "if", "remote", "host", "contains", "a", "WordPress", "installation", "." ]
def is_remote_a_wordpress(base_url, error_page, downloader): """ This functions checks if remote host contains a WordPress installation. :param base_url: Base url :type base_url: basestring :param error_page: error page content :type error_page: basestring :param downloader: download func...
[ "def", "is_remote_a_wordpress", "(", "base_url", ",", "error_page", ",", "downloader", ")", ":", "total_urls", "=", "0", "urls_found", "=", "0", "for", "url", "in", "update_progress", "(", "get_wordlist", "(", "\"wordpress_detection.txt\"", ")", ",", "prefix_text"...
https://github.com/iniqua/plecost/blob/ef0d89bfdf1ef870bd11b1d8bdf93a8ce9ec6ca0/plecost_lib/libs/helpers.py#L61-L132
CellProfiler/CellProfiler
a90e17e4d258c6f3900238be0f828e0b4bd1b293
cellprofiler/modules/exporttodatabase.py
python
ExportToDatabase.make_full_filename
(self, file_name, workspace=None, image_set_index=None)
return os.path.join(path, file)
Convert a file name into an absolute path We do a few things here: * apply metadata from an image set to the file name if an image set is specified * change the relative path into an absolute one using the "." and "&" convention * Create any directories along the pat...
Convert a file name into an absolute path
[ "Convert", "a", "file", "name", "into", "an", "absolute", "path" ]
def make_full_filename(self, file_name, workspace=None, image_set_index=None): """Convert a file name into an absolute path We do a few things here: * apply metadata from an image set to the file name if an image set is specified * change the relative path into an absolute one...
[ "def", "make_full_filename", "(", "self", ",", "file_name", ",", "workspace", "=", "None", ",", "image_set_index", "=", "None", ")", ":", "if", "image_set_index", "is", "not", "None", "and", "workspace", "is", "not", "None", ":", "file_name", "=", "workspace...
https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/modules/exporttodatabase.py#L2311-L2331
WyAtu/CVE-2018-20250
5a2df20fe3d28137ab4553153294abfb3c059be9
acefile.py
python
AceArchive.getmember
(self, member)
Return an :class:`AceMember` object corresponding to archive member *member*. Raise :class:`KeyError` or :class:`IndexError` if *member* is not found in archive. *Member* can refer to an :class:`AceMember` object, a member name or an index into the archive member list. If...
Return an :class:`AceMember` object corresponding to archive member *member*. Raise :class:`KeyError` or :class:`IndexError` if *member* is not found in archive. *Member* can refer to an :class:`AceMember` object, a member name or an index into the archive member list. If...
[ "Return", "an", ":", "class", ":", "AceMember", "object", "corresponding", "to", "archive", "member", "*", "member", "*", ".", "Raise", ":", "class", ":", "KeyError", "or", ":", "class", ":", "IndexError", "if", "*", "member", "*", "is", "not", "found", ...
def getmember(self, member): """ Return an :class:`AceMember` object corresponding to archive member *member*. Raise :class:`KeyError` or :class:`IndexError` if *member* is not found in archive. *Member* can refer to an :class:`AceMember` object, a member name or ...
[ "def", "getmember", "(", "self", ",", "member", ")", ":", "if", "isinstance", "(", "member", ",", "int", ")", ":", "return", "self", ".", "_getmember_byidx", "(", "member", ")", "elif", "isinstance", "(", "member", ",", "AceMember", ")", ":", "return", ...
https://github.com/WyAtu/CVE-2018-20250/blob/5a2df20fe3d28137ab4553153294abfb3c059be9/acefile.py#L3399-L3417
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractBoredtranslationsWordpressCom.py
python
extractBoredtranslationsWordpressCom
(item)
return False
Parser for 'boredtranslations.wordpress.com'
Parser for 'boredtranslations.wordpress.com'
[ "Parser", "for", "boredtranslations", ".", "wordpress", ".", "com" ]
def extractBoredtranslationsWordpressCom(item): ''' Parser for 'boredtranslations.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', 'translat...
[ "def", "extractBoredtranslationsWordpressCom", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractBoredtranslationsWordpressCom.py#L2-L21
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/redis_model/models/attributes.py
python
Attribute.__set__
(self,instance,val)
set the object's name value param: instance:the name type is string val: the value type is string
set the object's name value param: instance:the name type is string val: the value type is string
[ "set", "the", "object", "s", "name", "value", "param", ":", "instance", ":", "the", "name", "type", "is", "string", "val", ":", "the", "value", "type", "is", "string" ]
def __set__(self,instance,val): """ set the object's name value param: instance:the name type is string val: the value type is string """ val = self.typecast_for_read(val) setattr(instance,"_"+self.name,val)
[ "def", "__set__", "(", "self", ",", "instance", ",", "val", ")", ":", "val", "=", "self", ".", "typecast_for_read", "(", "val", ")", "setattr", "(", "instance", ",", "\"_\"", "+", "self", ".", "name", ",", "val", ")" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/redis_model/models/attributes.py#L99-L107
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/ssl.py
python
SSLSocket.read
(self, len=1024)
Read up to LEN bytes and return them. Return zero-length string on EOF.
Read up to LEN bytes and return them. Return zero-length string on EOF.
[ "Read", "up", "to", "LEN", "bytes", "and", "return", "them", ".", "Return", "zero", "-", "length", "string", "on", "EOF", "." ]
def read(self, len=1024): """Read up to LEN bytes and return them. Return zero-length string on EOF.""" try: return self._sslobj.read(len) except SSLError, x: if x.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs: return '' else...
[ "def", "read", "(", "self", ",", "len", "=", "1024", ")", ":", "try", ":", "return", "self", ".", "_sslobj", ".", "read", "(", "len", ")", "except", "SSLError", ",", "x", ":", "if", "x", ".", "args", "[", "0", "]", "==", "SSL_ERROR_EOF", "and", ...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/ssl.py#L145-L156
holoviz/panel
5e25cb09447d8edf0b316f130ee1318a2aeb880f
panel/pane/vtk/vtk.py
python
VTKVolume.register_serializer
(cls, class_type, serializer)
Register a seriliazer for a given type of class. A serializer is a function which take an instance of `class_type` (like a vtk.vtkImageData) as input and return a numpy array of the data
Register a seriliazer for a given type of class. A serializer is a function which take an instance of `class_type` (like a vtk.vtkImageData) as input and return a numpy array of the data
[ "Register", "a", "seriliazer", "for", "a", "given", "type", "of", "class", ".", "A", "serializer", "is", "a", "function", "which", "take", "an", "instance", "of", "class_type", "(", "like", "a", "vtk", ".", "vtkImageData", ")", "as", "input", "and", "ret...
def register_serializer(cls, class_type, serializer): """ Register a seriliazer for a given type of class. A serializer is a function which take an instance of `class_type` (like a vtk.vtkImageData) as input and return a numpy array of the data """ cls._serializers.update...
[ "def", "register_serializer", "(", "cls", ",", "class_type", ",", "serializer", ")", ":", "cls", ".", "_serializers", ".", "update", "(", "{", "class_type", ":", "serializer", "}", ")" ]
https://github.com/holoviz/panel/blob/5e25cb09447d8edf0b316f130ee1318a2aeb880f/panel/pane/vtk/vtk.py#L682-L688
psychopy/psychopy
01b674094f38d0e0bd51c45a6f66f671d7041696
psychopy/projects/pavlovia.py
python
refreshSession
()
return _existingSession
Restarts the session with the same user logged in
Restarts the session with the same user logged in
[ "Restarts", "the", "session", "with", "the", "same", "user", "logged", "in" ]
def refreshSession(): """Restarts the session with the same user logged in""" global _existingSession if _existingSession and _existingSession.getToken(): _existingSession = PavloviaSession( token=_existingSession.getToken() ) else: _existingSession = PavloviaSess...
[ "def", "refreshSession", "(", ")", ":", "global", "_existingSession", "if", "_existingSession", "and", "_existingSession", ".", "getToken", "(", ")", ":", "_existingSession", "=", "PavloviaSession", "(", "token", "=", "_existingSession", ".", "getToken", "(", ")",...
https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/projects/pavlovia.py#L1155-L1164
inducer/loopy
55143b21711a534c07bbb14aaa63ff3879a93433
loopy/transform/diff.py
python
DifferentiationContext.get_diff_var
(self, var_name)
return new_var_name
:return: a string containing the name of a new variable holding the derivative of *var_name* by the desired *diff_context.by_name*, or *None* if no dependency exists.
:return: a string containing the name of a new variable holding the derivative of *var_name* by the desired *diff_context.by_name*, or *None* if no dependency exists.
[ ":", "return", ":", "a", "string", "containing", "the", "name", "of", "a", "new", "variable", "holding", "the", "derivative", "of", "*", "var_name", "*", "by", "the", "desired", "*", "diff_context", ".", "by_name", "*", "or", "*", "None", "*", "if", "n...
def get_diff_var(self, var_name): """ :return: a string containing the name of a new variable holding the derivative of *var_name* by the desired *diff_context.by_name*, or *None* if no dependency exists. """ new_var_name = self.rule_mapping_context.make_unique_va...
[ "def", "get_diff_var", "(", "self", ",", "var_name", ")", ":", "new_var_name", "=", "self", ".", "rule_mapping_context", ".", "make_unique_var_name", "(", "var_name", "+", "\"_d\"", "+", "self", ".", "by_name", ")", "writers", "=", "self", ".", "kernel", "."...
https://github.com/inducer/loopy/blob/55143b21711a534c07bbb14aaa63ff3879a93433/loopy/transform/diff.py#L269-L365
elfi-dev/elfi
07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c
elfi/model/extensions.py
python
ModelPrior.gradient_logpdf
(self, x, stepsize=None)
return grads
Return the gradient of log density of the joint prior at x. Parameters ---------- x : float or np.ndarray stepsize : float or list Stepsize or stepsizes for the dimensions
Return the gradient of log density of the joint prior at x.
[ "Return", "the", "gradient", "of", "log", "density", "of", "the", "joint", "prior", "at", "x", "." ]
def gradient_logpdf(self, x, stepsize=None): """Return the gradient of log density of the joint prior at x. Parameters ---------- x : float or np.ndarray stepsize : float or list Stepsize or stepsizes for the dimensions """ x = np.asanyarray(x) ...
[ "def", "gradient_logpdf", "(", "self", ",", "x", ",", "stepsize", "=", "None", ")", ":", "x", "=", "np", ".", "asanyarray", "(", "x", ")", "ndim", "=", "x", ".", "ndim", "x", "=", "x", ".", "reshape", "(", "(", "-", "1", ",", "self", ".", "di...
https://github.com/elfi-dev/elfi/blob/07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c/elfi/model/extensions.py#L203-L228
titusjan/argos
5a9c31a8a9a2ca825bbf821aa1e685740e3682d7
argos/utils/logs.py
python
initLogging
(configFileName=None, streamLogLevel=None)
Configures logging given a (JSON) config file name. If configFileName is None, the default logging (from iriscc/lib/default_logging.yaml) is used. :param configFileName: JSON file with log config. :param streamLogLevel: If given it overrides the log level of StreamHandlers in the confi...
Configures logging given a (JSON) config file name.
[ "Configures", "logging", "given", "a", "(", "JSON", ")", "config", "file", "name", "." ]
def initLogging(configFileName=None, streamLogLevel=None): """ Configures logging given a (JSON) config file name. If configFileName is None, the default logging (from iriscc/lib/default_logging.yaml) is used. :param configFileName: JSON file with log config. :param streamLogLevel:...
[ "def", "initLogging", "(", "configFileName", "=", "None", ",", "streamLogLevel", "=", "None", ")", ":", "if", "configFileName", "is", "None", ":", "configFileName", "=", "os", ".", "path", ".", "join", "(", "THIS_MODULE_DIR", ",", "\"default_logging.json\"", "...
https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/utils/logs.py#L110-L149
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/inspect.py
python
isbuiltin
(object)
return isinstance(object, types.BuiltinFunctionType)
Return true if the object is a built-in function or method. Built-in functions and methods provide these attributes: __doc__ documentation string __name__ original name of this function or method __self__ instance to which a method is bound, or None
Return true if the object is a built-in function or method.
[ "Return", "true", "if", "the", "object", "is", "a", "built", "-", "in", "function", "or", "method", "." ]
def isbuiltin(object): """Return true if the object is a built-in function or method. Built-in functions and methods provide these attributes: __doc__ documentation string __name__ original name of this function or method __self__ instance to which a method is boun...
[ "def", "isbuiltin", "(", "object", ")", ":", "return", "isinstance", "(", "object", ",", "types", ".", "BuiltinFunctionType", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/inspect.py#L227-L234
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/tkinter/__init__.py
python
Entry.index
(self, index)
return self.tk.getint(self.tk.call( self._w, 'index', index))
Return position of cursor.
Return position of cursor.
[ "Return", "position", "of", "cursor", "." ]
def index(self, index): """Return position of cursor.""" return self.tk.getint(self.tk.call( self._w, 'index', index))
[ "def", "index", "(", "self", ",", "index", ")", ":", "return", "self", ".", "tk", ".", "getint", "(", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'index'", ",", "index", ")", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/tkinter/__init__.py#L3044-L3047
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/plat-freebsd8/IN.py
python
__STRING
(x)
return
[]
def __STRING(x): return
[ "def", "__STRING", "(", "x", ")", ":", "return" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/plat-freebsd8/IN.py#L28-L28
mozilla/kitsune
7c7cf9baed57aa776547aea744243ccad6ca91fb
kitsune/dashboards/views.py
python
aggregated_metrics
(request)
return render( request, "dashboards/aggregated_metrics.html", { "locales_json": json.dumps(settings.SUMO_LANGUAGES), "locales": locales, "product": product, "products": Product.objects.filter(visible=True), }, )
The aggregated (all locales) kb metrics dashboard.
The aggregated (all locales) kb metrics dashboard.
[ "The", "aggregated", "(", "all", "locales", ")", "kb", "metrics", "dashboard", "." ]
def aggregated_metrics(request): """The aggregated (all locales) kb metrics dashboard.""" today = date.today() locales = get_locales_by_visit(today - timedelta(days=30), today) product = _get_product(request) return render( request, "dashboards/aggregated_metrics.html", { ...
[ "def", "aggregated_metrics", "(", "request", ")", ":", "today", "=", "date", ".", "today", "(", ")", "locales", "=", "get_locales_by_visit", "(", "today", "-", "timedelta", "(", "days", "=", "30", ")", ",", "today", ")", "product", "=", "_get_product", "...
https://github.com/mozilla/kitsune/blob/7c7cf9baed57aa776547aea744243ccad6ca91fb/kitsune/dashboards/views.py#L235-L250
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/sms/models.py
python
MessagingEvent.get_recipient_doc_type
(self)
return MessagingEvent._get_recipient_doc_type(self.recipient_type)
[]
def get_recipient_doc_type(self): return MessagingEvent._get_recipient_doc_type(self.recipient_type)
[ "def", "get_recipient_doc_type", "(", "self", ")", ":", "return", "MessagingEvent", ".", "_get_recipient_doc_type", "(", "self", ".", "recipient_type", ")" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/sms/models.py#L1174-L1175
dvlab-research/3DSSD
8bc7605d4d3a6ec9051e7689e96a23bdac4c4cd9
lib/utils/kitti_object.py
python
kitti_object.get_lidar
(self, idx)
return utils.load_velo_scan(lidar_filename)
[]
def get_lidar(self, idx): assert(idx<self.num_samples) lidar_filename = os.path.join(self.lidar_dir, '%06d.bin'%(idx)) return utils.load_velo_scan(lidar_filename)
[ "def", "get_lidar", "(", "self", ",", "idx", ")", ":", "assert", "(", "idx", "<", "self", ".", "num_samples", ")", "lidar_filename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "lidar_dir", ",", "'%06d.bin'", "%", "(", "idx", ")", ")", "...
https://github.com/dvlab-research/3DSSD/blob/8bc7605d4d3a6ec9051e7689e96a23bdac4c4cd9/lib/utils/kitti_object.py#L54-L57
OpenTransitTools/gtfsdb
8638a9d83747f1ac6c8953119239b42dd3628b29
gtfsdb/model/stop.py
python
CurrentStops.post_process
(cls, db, **kwargs)
will update the current 'view' of this data
will update the current 'view' of this data
[ "will", "update", "the", "current", "view", "of", "this", "data" ]
def post_process(cls, db, **kwargs): """ will update the current 'view' of this data """ session = db.session() try: session.query(CurrentStops).delete() # import pdb; pdb.set_trace() for s in Stop.query_active_stops(session): ...
[ "def", "post_process", "(", "cls", ",", "db", ",", "*", "*", "kwargs", ")", ":", "session", "=", "db", ".", "session", "(", ")", "try", ":", "session", ".", "query", "(", "CurrentStops", ")", ".", "delete", "(", ")", "# import pdb; pdb.set_trace()", "f...
https://github.com/OpenTransitTools/gtfsdb/blob/8638a9d83747f1ac6c8953119239b42dd3628b29/gtfsdb/model/stop.py#L245-L265
GoogleCloudPlatform/PerfKitBenchmarker
6e3412d7d5e414b8ca30ed5eaf970cef1d919a67
perfkitbenchmarker/linux_packages/oldisim_dependencies.py
python
YumInstall
(vm)
Installs oldisim dependencies on the VM.
Installs oldisim dependencies on the VM.
[ "Installs", "oldisim", "dependencies", "on", "the", "VM", "." ]
def YumInstall(vm): """Installs oldisim dependencies on the VM.""" vm.InstallEpelRepo() _Install(vm, YUM_PACKAGES)
[ "def", "YumInstall", "(", "vm", ")", ":", "vm", ".", "InstallEpelRepo", "(", ")", "_Install", "(", "vm", ",", "YUM_PACKAGES", ")" ]
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/linux_packages/oldisim_dependencies.py#L39-L42
eirannejad/pyRevit
49c0b7eb54eb343458ce1365425e6552d0c47d44
site-packages/werkzeug/datastructures.py
python
ETags.is_weak
(self, etag)
return etag in self._weak
Check if an etag is weak.
Check if an etag is weak.
[ "Check", "if", "an", "etag", "is", "weak", "." ]
def is_weak(self, etag): """Check if an etag is weak.""" return etag in self._weak
[ "def", "is_weak", "(", "self", ",", "etag", ")", ":", "return", "etag", "in", "self", ".", "_weak" ]
https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/werkzeug/datastructures.py#L2170-L2172
moskytw/mosql
730b2bd859306cd333cc4dc97708bcec6005973c
mosql/mysql.py
python
format_param
(s='')
return '%s'
This function always returns ``'%s'``, so it makes you can use the prepare statement with MySQLdb.
This function always returns ``'%s'``, so it makes you can use the prepare statement with MySQLdb.
[ "This", "function", "always", "returns", "%s", "so", "it", "makes", "you", "can", "use", "the", "prepare", "statement", "with", "MySQLdb", "." ]
def format_param(s=''): '''This function always returns ``'%s'``, so it makes you can use the prepare statement with MySQLdb.''' return '%s'
[ "def", "format_param", "(", "s", "=", "''", ")", ":", "return", "'%s'" ]
https://github.com/moskytw/mosql/blob/730b2bd859306cd333cc4dc97708bcec6005973c/mosql/mysql.py#L70-L73
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/rlcompleter.py
python
Completer.__init__
(self, namespace = None)
Create a new completer for the command line. Completer([namespace]) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technically, __main__.__dict__). Namespaces should be given as dictionaries. Completer instances should...
Create a new completer for the command line.
[ "Create", "a", "new", "completer", "for", "the", "command", "line", "." ]
def __init__(self, namespace = None): """Create a new completer for the command line. Completer([namespace]) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technically, __main__.__dict__). Namespaces should be given as ...
[ "def", "__init__", "(", "self", ",", "namespace", "=", "None", ")", ":", "if", "namespace", "and", "not", "isinstance", "(", "namespace", ",", "dict", ")", ":", "raise", "TypeError", ",", "'namespace must be a dictionary'", "# Don't bind to namespace quite yet, but ...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/rlcompleter.py#L44-L69
mitogen-hq/mitogen
5b505f524a7ae170fe68613841ab92b299613d3f
mitogen/service.py
python
FileService._prefix_is_authorized
(self, path)
return False
Return the set of all possible directory prefixes for `path`. :func:`os.path.abspath` is used to ensure the path is absolute. :param str path: The path. :returns: Set of prefixes.
Return the set of all possible directory prefixes for `path`. :func:`os.path.abspath` is used to ensure the path is absolute.
[ "Return", "the", "set", "of", "all", "possible", "directory", "prefixes", "for", "path", ".", ":", "func", ":", "os", ".", "path", ".", "abspath", "is", "used", "to", "ensure", "the", "path", "is", "absolute", "." ]
def _prefix_is_authorized(self, path): """ Return the set of all possible directory prefixes for `path`. :func:`os.path.abspath` is used to ensure the path is absolute. :param str path: The path. :returns: Set of prefixes. """ path = os.path.abspath(p...
[ "def", "_prefix_is_authorized", "(", "self", ",", "path", ")", ":", "path", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "while", "True", ":", "if", "path", "in", "self", ".", "_prefixes", ":", "return", "True", "if", "path", "==", "'/'"...
https://github.com/mitogen-hq/mitogen/blob/5b505f524a7ae170fe68613841ab92b299613d3f/mitogen/service.py#L1014-L1030
nameko/nameko
17ecee2bcfa90cb0f3a2f3328c5004f48e4e02a3
nameko/messaging.py
python
Publisher.amqp_uri
(self)
return self.container.config[AMQP_URI_CONFIG_KEY]
[]
def amqp_uri(self): return self.container.config[AMQP_URI_CONFIG_KEY]
[ "def", "amqp_uri", "(", "self", ")", ":", "return", "self", ".", "container", ".", "config", "[", "AMQP_URI_CONFIG_KEY", "]" ]
https://github.com/nameko/nameko/blob/17ecee2bcfa90cb0f3a2f3328c5004f48e4e02a3/nameko/messaging.py#L146-L147
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/gluon/tools.py
python
Auth.archive
(form, archive_table=None, current_record='current_record', archive_current=False, fields=None)
return id
If you have a table (db.mytable) that needs full revision history you can just do:: form = crud.update(db.mytable, myrecord, onaccept=auth.archive) or:: form = SQLFORM(db.mytable, myrecord).process(onaccept=auth.archive) crud.archive will define a new table "mytable_a...
If you have a table (db.mytable) that needs full revision history you can just do::
[ "If", "you", "have", "a", "table", "(", "db", ".", "mytable", ")", "that", "needs", "full", "revision", "history", "you", "can", "just", "do", "::" ]
def archive(form, archive_table=None, current_record='current_record', archive_current=False, fields=None): """ If you have a table (db.mytable) that needs full revision history you can just do:: form = crud.update(db.m...
[ "def", "archive", "(", "form", ",", "archive_table", "=", "None", ",", "current_record", "=", "'current_record'", ",", "archive_current", "=", "False", ",", "fields", "=", "None", ")", ":", "if", "not", "archive_current", "and", "not", "form", ".", "record",...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/gluon/tools.py#L4638-L4716
andresriancho/enumerate-iam
4529114002d1571035c31980162e401112f356da
enumerate-iam.py
python
main
()
[]
def main(): parser = argparse.ArgumentParser(description='Enumerate IAM permissions') parser.add_argument('--access-key', help='AWS access key', required=True) parser.add_argument('--secret-key', help='AWS secret key', required=True) parser.add_argument('--session-token', help='STS session token') ...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Enumerate IAM permissions'", ")", "parser", ".", "add_argument", "(", "'--access-key'", ",", "help", "=", "'AWS access key'", ",", "required", "=", "True",...
https://github.com/andresriancho/enumerate-iam/blob/4529114002d1571035c31980162e401112f356da/enumerate-iam.py#L7-L20
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/app_manager/models.py
python
Application.ensure_module_unique_ids
(self, should_save=False)
Creates unique_ids for modules that don't have unique_id attributes should_save: the doc will be saved only if should_save is set to True WARNING: If called on the same doc in different requests without saving, this function will set different uuid each time, likely caus...
Creates unique_ids for modules that don't have unique_id attributes should_save: the doc will be saved only if should_save is set to True
[ "Creates", "unique_ids", "for", "modules", "that", "don", "t", "have", "unique_id", "attributes", "should_save", ":", "the", "doc", "will", "be", "saved", "only", "if", "should_save", "is", "set", "to", "True" ]
def ensure_module_unique_ids(self, should_save=False): """ Creates unique_ids for modules that don't have unique_id attributes should_save: the doc will be saved only if should_save is set to True WARNING: If called on the same doc in different requests without saving, ...
[ "def", "ensure_module_unique_ids", "(", "self", ",", "should_save", "=", "False", ")", ":", "if", "any", "(", "not", "mod", ".", "unique_id", "for", "mod", "in", "self", ".", "modules", ")", ":", "for", "mod", "in", "self", ".", "modules", ":", "mod", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/app_manager/models.py#L4938-L4951
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/scatterternary/marker/_colorbar.py
python
ColorBar.outlinewidth
(self)
return self["outlinewidth"]
Sets the width (in px) of the axis line. The 'outlinewidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the width (in px) of the axis line. The 'outlinewidth' property is a number and may be specified as: - An int or float in the interval [0, inf]
[ "Sets", "the", "width", "(", "in", "px", ")", "of", "the", "axis", "line", ".", "The", "outlinewidth", "property", "is", "a", "number", "and", "may", "be", "specified", "as", ":", "-", "An", "int", "or", "float", "in", "the", "interval", "[", "0", ...
def outlinewidth(self): """ Sets the width (in px) of the axis line. The 'outlinewidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["outlinewidth"]
[ "def", "outlinewidth", "(", "self", ")", ":", "return", "self", "[", "\"outlinewidth\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatterternary/marker/_colorbar.py#L435-L446
lazylibrarian/LazyLibrarian
ae3c14e9db9328ce81765e094ab2a14ed7155624
mako/util.py
python
restore__ast
(_ast)
Attempt to restore the required classes to the _ast module if it appears to be missing them
Attempt to restore the required classes to the _ast module if it appears to be missing them
[ "Attempt", "to", "restore", "the", "required", "classes", "to", "the", "_ast", "module", "if", "it", "appears", "to", "be", "missing", "them" ]
def restore__ast(_ast): """Attempt to restore the required classes to the _ast module if it appears to be missing them """ if hasattr(_ast, 'AST'): return _ast.PyCF_ONLY_AST = 2 << 9 m = compile("""\ def foo(): pass class Bar(object): pass if False: pass baz = 'mako' 1 + 2 - 3 * 4 / 5 6 ...
[ "def", "restore__ast", "(", "_ast", ")", ":", "if", "hasattr", "(", "_ast", ",", "'AST'", ")", ":", "return", "_ast", ".", "PyCF_ONLY_AST", "=", "2", "<<", "9", "m", "=", "compile", "(", "\"\"\"\\\ndef foo(): pass\nclass Bar(object): pass\nif False: pass\nbaz = 'm...
https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/mako/util.py#L288-L361
openembedded/bitbake
98407efc8c670abd71d3fa88ec3776ee9b5c38f3
lib/toaster/toastergui/tablefilter.py
python
TableFilterActionDateRange.set_filter_params
(self, params)
This filter depends on the user selecting some input, so it needs to have its parameters set before its queryset is filtered params: (str) a string of extra parameters for the filtering in the format "2015-12-09,2015-12-11" (from,to); this is passed in the querystring and used to set th...
This filter depends on the user selecting some input, so it needs to have its parameters set before its queryset is filtered
[ "This", "filter", "depends", "on", "the", "user", "selecting", "some", "input", "so", "it", "needs", "to", "have", "its", "parameters", "set", "before", "its", "queryset", "is", "filtered" ]
def set_filter_params(self, params): """ This filter depends on the user selecting some input, so it needs to have its parameters set before its queryset is filtered params: (str) a string of extra parameters for the filtering in the format "2015-12-09,2015-12-11" (from,to); thi...
[ "def", "set_filter_params", "(", "self", ",", "params", ")", ":", "# if params are invalid, return immediately, resetting criteria", "# on the QuerysetFilter", "try", ":", "date_from_str", ",", "date_to_str", "=", "params", ".", "split", "(", "','", ")", "except", "Valu...
https://github.com/openembedded/bitbake/blob/98407efc8c670abd71d3fa88ec3776ee9b5c38f3/lib/toaster/toastergui/tablefilter.py#L215-L240
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/protocol/message.py
python
Message.send
(self, conn)
Send the message on the given connection. Args: conn (WebSocketHandler) : a WebSocketHandler to send messages Returns: int : number of bytes sent
Send the message on the given connection.
[ "Send", "the", "message", "on", "the", "given", "connection", "." ]
def send(self, conn): ''' Send the message on the given connection. Args: conn (WebSocketHandler) : a WebSocketHandler to send messages Returns: int : number of bytes sent ''' if conn is None: raise ValueError("Cannot send to connection None...
[ "def", "send", "(", "self", ",", "conn", ")", ":", "if", "conn", "is", "None", ":", "raise", "ValueError", "(", "\"Cannot send to connection None\"", ")", "with", "(", "yield", "conn", ".", "write_lock", ".", "acquire", "(", ")", ")", ":", "sent", "=", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/protocol/message.py#L248-L281
Cadene/tensorflow-model-zoo.torch
990b10ffc22d4c8eacb2a502f20415b4f70c74c2
models/research/syntaxnet/dragnn/python/spec_builder.py
python
ComponentSpecBuilder.__init__
(self, name, builder='DynamicComponentBuilder', backend='SyntaxNetComponent')
Initializes the ComponentSpec with some defaults for SyntaxNet. Args: name: The name of this Component in the pipeline. builder: The component builder type. backend: The component backend type.
Initializes the ComponentSpec with some defaults for SyntaxNet.
[ "Initializes", "the", "ComponentSpec", "with", "some", "defaults", "for", "SyntaxNet", "." ]
def __init__(self, name, builder='DynamicComponentBuilder', backend='SyntaxNetComponent'): """Initializes the ComponentSpec with some defaults for SyntaxNet. Args: name: The name of this Component in the pipeline. builder: The component builder type. ...
[ "def", "__init__", "(", "self", ",", "name", ",", "builder", "=", "'DynamicComponentBuilder'", ",", "backend", "=", "'SyntaxNetComponent'", ")", ":", "self", ".", "spec", "=", "spec_pb2", ".", "ComponentSpec", "(", "name", "=", "name", ",", "backend", "=", ...
https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/syntaxnet/dragnn/python/spec_builder.py#L39-L53
ytisf/PyExfil
0297b46dcbb135b2e2ade07ee040557a31cef04c
pyexfil/includes/image_manipulation.py
python
_openImage
(image_path)
return imgObj, ImageWidth, ImageHeight, TotalPixels
Opens image path as PIL Image Object :param image_path: String, image path :return: imgObj, ImageWidth, ImageHeight, TotalPixels
Opens image path as PIL Image Object :param image_path: String, image path :return: imgObj, ImageWidth, ImageHeight, TotalPixels
[ "Opens", "image", "path", "as", "PIL", "Image", "Object", ":", "param", "image_path", ":", "String", "image", "path", ":", "return", ":", "imgObj", "ImageWidth", "ImageHeight", "TotalPixels" ]
def _openImage(image_path): """ Opens image path as PIL Image Object :param image_path: String, image path :return: imgObj, ImageWidth, ImageHeight, TotalPixels """ imgObj = Image.open(image_path) ImageWidth, ImageHeight = imgObj.size TotalPixels = ImageWidth * ImageHeight return imgObj, ImageWidth, ImageHeigh...
[ "def", "_openImage", "(", "image_path", ")", ":", "imgObj", "=", "Image", ".", "open", "(", "image_path", ")", "ImageWidth", ",", "ImageHeight", "=", "imgObj", ".", "size", "TotalPixels", "=", "ImageWidth", "*", "ImageHeight", "return", "imgObj", ",", "Image...
https://github.com/ytisf/PyExfil/blob/0297b46dcbb135b2e2ade07ee040557a31cef04c/pyexfil/includes/image_manipulation.py#L4-L13
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/logging/__init__.py
python
BufferingFormatter.formatHeader
(self, records)
return ''
Return the header string for the specified records.
Return the header string for the specified records.
[ "Return", "the", "header", "string", "for", "the", "specified", "records", "." ]
def formatHeader(self, records): """ Return the header string for the specified records. """ return ''
[ "def", "formatHeader", "(", "self", ",", "records", ")", ":", "return", "''" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/logging/__init__.py#L415-L419
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/tool_util/deps/docker_util.py
python
_docker_prefix
( docker_cmd=DEFAULT_DOCKER_COMMAND, sudo=DEFAULT_SUDO, sudo_cmd=DEFAULT_SUDO_COMMAND, host=DEFAULT_HOST, **kwds )
return command_parts
Prefix to issue a docker command.
Prefix to issue a docker command.
[ "Prefix", "to", "issue", "a", "docker", "command", "." ]
def _docker_prefix( docker_cmd=DEFAULT_DOCKER_COMMAND, sudo=DEFAULT_SUDO, sudo_cmd=DEFAULT_SUDO_COMMAND, host=DEFAULT_HOST, **kwds ): """Prefix to issue a docker command.""" command_parts = [] if sudo: command_parts.append(sudo_cmd) command_parts.append(docker_cmd) if hos...
[ "def", "_docker_prefix", "(", "docker_cmd", "=", "DEFAULT_DOCKER_COMMAND", ",", "sudo", "=", "DEFAULT_SUDO", ",", "sudo_cmd", "=", "DEFAULT_SUDO_COMMAND", ",", "host", "=", "DEFAULT_HOST", ",", "*", "*", "kwds", ")", ":", "command_parts", "=", "[", "]", "if", ...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/tool_util/deps/docker_util.py#L207-L221
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/coding/information_set_decoder.py
python
InformationSetAlgorithm._repr_
(self)
return "ISD Algorithm ({}) for {} decoding {} errors ".format(self._algorithm_name, self.code(), _format_decoding_interval(self.decoding_interval()))
r""" Returns a string representation of this ISD algorithm. EXAMPLES:: sage: C = codes.GolayCode(GF(2)) sage: from sage.coding.information_set_decoder import LeeBrickellISDAlgorithm sage: A = LeeBrickellISDAlgorithm(C, (0,4)) sage: A ISD Algo...
r""" Returns a string representation of this ISD algorithm.
[ "r", "Returns", "a", "string", "representation", "of", "this", "ISD", "algorithm", "." ]
def _repr_(self): r""" Returns a string representation of this ISD algorithm. EXAMPLES:: sage: C = codes.GolayCode(GF(2)) sage: from sage.coding.information_set_decoder import LeeBrickellISDAlgorithm sage: A = LeeBrickellISDAlgorithm(C, (0,4)) sa...
[ "def", "_repr_", "(", "self", ")", ":", "return", "\"ISD Algorithm ({}) for {} decoding {} errors \"", ".", "format", "(", "self", ".", "_algorithm_name", ",", "self", ".", "code", "(", ")", ",", "_format_decoding_interval", "(", "self", ".", "decoding_interval", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/coding/information_set_decoder.py#L315-L327
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/loadbalancer/base.py
python
Driver.update_balancer
(self, balancer, **kwargs)
Sets the name, algorithm, protocol, or port on a load balancer. :param balancer: LoadBalancer which should be used :type balancer: :class:`LoadBalancer` :param name: New load balancer name :type name: ``str`` :param algorithm: New load balancer algorithm :type ...
Sets the name, algorithm, protocol, or port on a load balancer.
[ "Sets", "the", "name", "algorithm", "protocol", "or", "port", "on", "a", "load", "balancer", "." ]
def update_balancer(self, balancer, **kwargs): """ Sets the name, algorithm, protocol, or port on a load balancer. :param balancer: LoadBalancer which should be used :type balancer: :class:`LoadBalancer` :param name: New load balancer name :type name: ``str`` ...
[ "def", "update_balancer", "(", "self", ",", "balancer", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"update_balancer not implemented for this driver\"", ")" ]
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/loadbalancer/base.py#L221-L242