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
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/queue.py
python
Queue.put_nowait
(self, item)
return self.put(item, block=False)
Put an item into the queue without blocking. Only enqueue the item if a free slot is immediately available. Otherwise raise the Full exception.
Put an item into the queue without blocking.
[ "Put", "an", "item", "into", "the", "queue", "without", "blocking", "." ]
def put_nowait(self, item): '''Put an item into the queue without blocking. Only enqueue the item if a free slot is immediately available. Otherwise raise the Full exception. ''' return self.put(item, block=False)
[ "def", "put_nowait", "(", "self", ",", "item", ")", ":", "return", "self", ".", "put", "(", "item", ",", "block", "=", "False", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/queue.py#L181-L187
Vector35/binaryninja-api
d9661f34eec6855d495a10eaafc2a8e2679756a7
python/platform.py
python
Platform.fastcall_calling_convention
(self, value)
Sets the fastcall calling convention
Sets the fastcall calling convention
[ "Sets", "the", "fastcall", "calling", "convention" ]
def fastcall_calling_convention(self, value): """ Sets the fastcall calling convention """ core.BNRegisterPlatformFastcallCallingConvention(self.handle, value.handle)
[ "def", "fastcall_calling_convention", "(", "self", ",", "value", ")", ":", "core", ".", "BNRegisterPlatformFastcallCallingConvention", "(", "self", ".", "handle", ",", "value", ".", "handle", ")" ]
https://github.com/Vector35/binaryninja-api/blob/d9661f34eec6855d495a10eaafc2a8e2679756a7/python/platform.py#L205-L209
kubeflow/pipelines
bea751c9259ff0ae85290f873170aae89284ba8e
backend/api/python_http_client/kfp_server_api/api_client.py
python
ApiClient.request
(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)
Makes the HTTP request using RESTClient.
Makes the HTTP request using RESTClient.
[ "Makes", "the", "HTTP", "request", "using", "RESTClient", "." ]
def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": return self.rest_client.GET(url, ...
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "query_params", "=", "None", ",", "headers", "=", "None", ",", "post_params", "=", "None", ",", "body", "=", "None", ",", "_preload_content", "=", "True", ",", "_request_timeout", "=", "None"...
https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/backend/api/python_http_client/kfp_server_api/api_client.py#L384-L441
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/chord/__init__.py
python
Chord.duration
(self, durationObj)
Set a Duration object.
Set a Duration object.
[ "Set", "a", "Duration", "object", "." ]
def duration(self, durationObj): ''' Set a Duration object. ''' if hasattr(durationObj, 'quarterLength'): self._duration = durationObj else: # need to permit Duration object assignment here raise ChordException(f'this must be a Duration object,...
[ "def", "duration", "(", "self", ",", "durationObj", ")", ":", "if", "hasattr", "(", "durationObj", ",", "'quarterLength'", ")", ":", "self", ".", "_duration", "=", "durationObj", "else", ":", "# need to permit Duration object assignment here", "raise", "ChordExcepti...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/chord/__init__.py#L4370-L4378
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/importlib/resources.py
python
path
( package: Package, resource: Resource, )
return ( _path_from_reader(reader, _common.normalize_path(resource)) if reader else _common.as_file( _common.files(package).joinpath(_common.normalize_path(resource)) ) )
A context manager providing a file path object to the resource. If the resource does not already exist on its own on the file system, a temporary file will be created. If the file was created, the file will be deleted upon exiting the context manager (no exception is raised if the file was deleted prio...
A context manager providing a file path object to the resource.
[ "A", "context", "manager", "providing", "a", "file", "path", "object", "to", "the", "resource", "." ]
def path( package: Package, resource: Resource, ) -> 'ContextManager[Path]': """A context manager providing a file path object to the resource. If the resource does not already exist on its own on the file system, a temporary file will be created. If the file was created, the file will be delet...
[ "def", "path", "(", "package", ":", "Package", ",", "resource", ":", "Resource", ",", ")", "->", "'ContextManager[Path]'", ":", "reader", "=", "_common", ".", "get_resource_reader", "(", "_common", ".", "get_package", "(", "package", ")", ")", "return", "(",...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/importlib/resources.py#L107-L126
OpenAgricultureFoundation/openag-device-software
a51d2de399c0a6781ae51d0dcfaae1583d75f346
device/resource/manager.py
python
ResourceManager.free_memory
(self, value: str)
Safely updates value in shared state.
Safely updates value in shared state.
[ "Safely", "updates", "value", "in", "shared", "state", "." ]
def free_memory(self, value: str) -> None: """Safely updates value in shared state.""" with self.state.lock: self.state.resource["free_memory"] = value
[ "def", "free_memory", "(", "self", ",", "value", ":", "str", ")", "->", "None", ":", "with", "self", ".", "state", ".", "lock", ":", "self", ".", "state", ".", "resource", "[", "\"free_memory\"", "]", "=", "value" ]
https://github.com/OpenAgricultureFoundation/openag-device-software/blob/a51d2de399c0a6781ae51d0dcfaae1583d75f346/device/resource/manager.py#L105-L108
implus/PytorchInsight
2864528f8b83f52c3df76f7c3804aa468b91e5cf
classification/imagenet_fast.py
python
train
(train_loader, model, criterion, optimizer, epoch, use_cuda)
return (losses.avg, top1.avg)
[]
def train(train_loader, model, criterion, optimizer, epoch, use_cuda): printflag = False # switch to train mode model.train() torch.set_grad_enabled(True) batch_time = AverageMeter() losses = AverageMeter() top1 = AverageMeter() top5 = AverageMeter() end = time.time() if args.l...
[ "def", "train", "(", "train_loader", ",", "model", ",", "criterion", ",", "optimizer", ",", "epoch", ",", "use_cuda", ")", ":", "printflag", "=", "False", "# switch to train mode", "model", ".", "train", "(", ")", "torch", ".", "set_grad_enabled", "(", "True...
https://github.com/implus/PytorchInsight/blob/2864528f8b83f52c3df76f7c3804aa468b91e5cf/classification/imagenet_fast.py#L465-L575
statsmodels/statsmodels
debbe7ea6ba28fe5bdb78f09f8cac694bef98722
statsmodels/genmod/families/links.py
python
CLogLog.__call__
(self, p)
return np.log(-np.log(1 - p))
C-Log-Log transform link function Parameters ---------- p : ndarray Mean parameters Returns ------- z : ndarray The CLogLog transform of `p` Notes ----- g(p) = log(-log(1-p))
C-Log-Log transform link function
[ "C", "-", "Log", "-", "Log", "transform", "link", "function" ]
def __call__(self, p): """ C-Log-Log transform link function Parameters ---------- p : ndarray Mean parameters Returns ------- z : ndarray The CLogLog transform of `p` Notes ----- g(p) = log(-log(1-p)) ...
[ "def", "__call__", "(", "self", ",", "p", ")", ":", "p", "=", "self", ".", "_clean", "(", "p", ")", "return", "np", ".", "log", "(", "-", "np", ".", "log", "(", "1", "-", "p", ")", ")" ]
https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/genmod/families/links.py#L817-L836
Tuxemon/Tuxemon
ee80708090525391c1dfc43849a6348aca636b22
tuxemon/menu/menu.py
python
Menu.search_items
(self, game_object: Any)
return None
Non-optimised search through menu_items for a particular thing. TODO: address the confusing name "game object". Parameters: game_object: Object to search in the menu. Returns: Menu item containing the object, if any.
Non-optimised search through menu_items for a particular thing.
[ "Non", "-", "optimised", "search", "through", "menu_items", "for", "a", "particular", "thing", "." ]
def search_items(self, game_object: Any) -> Optional[MenuItem[T]]: """ Non-optimised search through menu_items for a particular thing. TODO: address the confusing name "game object". Parameters: game_object: Object to search in the menu. Returns: Menu i...
[ "def", "search_items", "(", "self", ",", "game_object", ":", "Any", ")", "->", "Optional", "[", "MenuItem", "[", "T", "]", "]", ":", "for", "menu_item", "in", "self", ".", "menu_items", ":", "if", "game_object", "==", "menu_item", ".", "game_object", ":"...
https://github.com/Tuxemon/Tuxemon/blob/ee80708090525391c1dfc43849a6348aca636b22/tuxemon/menu/menu.py#L586-L602
frappe/frappe
b64cab6867dfd860f10ccaf41a4ec04bc890b583
frappe/database/database.py
python
Database.count
(self, dt, filters=None, debug=False, cache=False)
Returns `COUNT(*)` for given DocType and filters.
Returns `COUNT(*)` for given DocType and filters.
[ "Returns", "COUNT", "(", "*", ")", "for", "given", "DocType", "and", "filters", "." ]
def count(self, dt, filters=None, debug=False, cache=False): """Returns `COUNT(*)` for given DocType and filters.""" if cache and not filters: cache_count = frappe.cache().get_value('doctype:count:{}'.format(dt)) if cache_count is not None: return cache_count query = self.query.get_sql(table=dt, filters...
[ "def", "count", "(", "self", ",", "dt", ",", "filters", "=", "None", ",", "debug", "=", "False", ",", "cache", "=", "False", ")", ":", "if", "cache", "and", "not", "filters", ":", "cache_count", "=", "frappe", ".", "cache", "(", ")", ".", "get_valu...
https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/database/database.py#L890-L904
pykaldi/pykaldi
b4e7a15a31286e57c01259edfda54d113b5ceb0e
kaldi/fstext/_api.py
python
_FstBase.input_symbols
(self)
return self._input_symbols()
Returns the input symbol table. Returns: The input symbol table. See Also: :meth:`output_symbols`.
Returns the input symbol table.
[ "Returns", "the", "input", "symbol", "table", "." ]
def input_symbols(self): """ Returns the input symbol table. Returns: The input symbol table. See Also: :meth:`output_symbols`. """ return self._input_symbols()
[ "def", "input_symbols", "(", "self", ")", ":", "return", "self", ".", "_input_symbols", "(", ")" ]
https://github.com/pykaldi/pykaldi/blob/b4e7a15a31286e57c01259edfda54d113b5ceb0e/kaldi/fstext/_api.py#L374-L383
davidoren/CuckooSploit
3fce8183bee8f7917e08f765ce2a01c921f86354
utils/db_migration/env.py
python
run_migrations_online
()
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
[ "Run", "migrations", "in", "online", "mode", ".", "In", "this", "scenario", "we", "need", "to", "create", "an", "Engine", "and", "associate", "a", "connection", "with", "the", "context", "." ]
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ engine = create_engine(url, poolclass=pool.NullPool) connection = engine.connect() context.configure(connection=connection, target_m...
[ "def", "run_migrations_online", "(", ")", ":", "engine", "=", "create_engine", "(", "url", ",", "poolclass", "=", "pool", ".", "NullPool", ")", "connection", "=", "engine", ".", "connect", "(", ")", "context", ".", "configure", "(", "connection", "=", "con...
https://github.com/davidoren/CuckooSploit/blob/3fce8183bee8f7917e08f765ce2a01c921f86354/utils/db_migration/env.py#L46-L60
anchore/anchore-engine
bb18b70e0cbcad58beb44cd439d00067d8f7ea8b
anchore_engine/services/policy_engine/engine/tasks.py
python
GrypeDBSyncTask.execute
(self)
Runs the GrypeDBSyncTask by calling the GrypeDBSyncManager.
Runs the GrypeDBSyncTask by calling the GrypeDBSyncManager.
[ "Runs", "the", "GrypeDBSyncTask", "by", "calling", "the", "GrypeDBSyncManager", "." ]
def execute(self): """ Runs the GrypeDBSyncTask by calling the GrypeDBSyncManager. """ with session_scope() as session: try: GrypeDBSyncManager.run_grypedb_sync(session, self.grypedb_file_path) except NoActiveDBSyncError: logger.war...
[ "def", "execute", "(", "self", ")", ":", "with", "session_scope", "(", ")", "as", "session", ":", "try", ":", "GrypeDBSyncManager", ".", "run_grypedb_sync", "(", "session", ",", "self", ".", "grypedb_file_path", ")", "except", "NoActiveDBSyncError", ":", "logg...
https://github.com/anchore/anchore-engine/blob/bb18b70e0cbcad58beb44cd439d00067d8f7ea8b/anchore_engine/services/policy_engine/engine/tasks.py#L575-L585
kiwiz/gkeepapi
229d2981bd18a6b2acc058017f84298af4fbe824
gkeepapi/__init__.py
python
RemindersAPI.history
(self, storage_version)
return self.send( url=self._base_url + 'history', method='POST', json=params )
Get reminder changes. Args: storage_version (str): The local storage version. Returns: ??? Raises: APIException: If the server returns an error.
Get reminder changes.
[ "Get", "reminder", "changes", "." ]
def history(self, storage_version): """Get reminder changes. Args: storage_version (str): The local storage version. Returns: ??? Raises: APIException: If the server returns an error. """ params = { "storageVersion": stor...
[ "def", "history", "(", "self", ",", "storage_version", ")", ":", "params", "=", "{", "\"storageVersion\"", ":", "storage_version", ",", "\"includeSnoozePresetUpdates\"", ":", "True", ",", "}", "params", ".", "update", "(", "self", ".", "static_params", ")", "r...
https://github.com/kiwiz/gkeepapi/blob/229d2981bd18a6b2acc058017f84298af4fbe824/gkeepapi/__init__.py#L598-L620
natanielruiz/deep-head-pose
f7bbb9981c2953c2eca67748d6492a64c8243946
code/hopenet.py
python
ResNet.__init__
(self, block, layers, num_classes=1000)
[]
def __init__(self, block, layers, num_classes=1000): self.inplanes = 64 super(ResNet, self).__init__() self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3, bias=False) self.bn1 = nn.BatchNorm2d(64) self.relu = nn.ReLU(inplace=True) ...
[ "def", "__init__", "(", "self", ",", "block", ",", "layers", ",", "num_classes", "=", "1000", ")", ":", "self", ".", "inplanes", "=", "64", "super", "(", "ResNet", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "conv1", "=", "nn", ".", ...
https://github.com/natanielruiz/deep-head-pose/blob/f7bbb9981c2953c2eca67748d6492a64c8243946/code/hopenet.py#L76-L97
ladybug-tools/honeybee-legacy
bd62af4862fe022801fb87dbc8794fdf1dff73a9
src/Honeybee_Grid Based Simulation.py
python
main
()
return recipe
[]
def main(): # check for Honeybee if not sc.sticky.has_key('honeybee_release'): msg = "You should first let Honeybee to fly..." w = gh.GH_RuntimeMessageLevel.Warning ghenv.Component.AddRuntimeMessage(w, msg) return -1 try: if not sc.sticky['honeybee_release'].isCompat...
[ "def", "main", "(", ")", ":", "# check for Honeybee", "if", "not", "sc", ".", "sticky", ".", "has_key", "(", "'honeybee_release'", ")", ":", "msg", "=", "\"You should first let Honeybee to fly...\"", "w", "=", "gh", ".", "GH_RuntimeMessageLevel", ".", "Warning", ...
https://github.com/ladybug-tools/honeybee-legacy/blob/bd62af4862fe022801fb87dbc8794fdf1dff73a9/src/Honeybee_Grid Based Simulation.py#L61-L87
pulp/pulp
a0a28d804f997b6f81c391378aff2e4c90183df9
agent/pulp/agent/lib/report.py
python
RebootReport.set_succeeded
(self, details=None, num_changes=0)
@param details: The details of the reboot. @type details: dict
[]
def set_succeeded(self, details=None, num_changes=0): """ @param details: The details of the reboot. @type details: dict """ HandlerReport.set_succeeded(self, details, num_changes) self.reboot_scheduled = True
[ "def", "set_succeeded", "(", "self", ",", "details", "=", "None", ",", "num_changes", "=", "0", ")", ":", "HandlerReport", ".", "set_succeeded", "(", "self", ",", "details", ",", "num_changes", ")", "self", ".", "reboot_scheduled", "=", "True" ]
https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/agent/pulp/agent/lib/report.py#L172-L178
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/ssl.py
python
PEM_cert_to_DER_cert
(pem_cert_string)
return base64.decodebytes(d.encode('ASCII', 'strict'))
Takes a certificate in ASCII PEM format and returns the DER-encoded version of it as a byte sequence
Takes a certificate in ASCII PEM format and returns the DER-encoded version of it as a byte sequence
[ "Takes", "a", "certificate", "in", "ASCII", "PEM", "format", "and", "returns", "the", "DER", "-", "encoded", "version", "of", "it", "as", "a", "byte", "sequence" ]
def PEM_cert_to_DER_cert(pem_cert_string): """Takes a certificate in ASCII PEM format and returns the DER-encoded version of it as a byte sequence""" if not pem_cert_string.startswith(PEM_HEADER): raise ValueError("Invalid PEM encoding; must start with %s" % PEM_HEADER) ...
[ "def", "PEM_cert_to_DER_cert", "(", "pem_cert_string", ")", ":", "if", "not", "pem_cert_string", ".", "startswith", "(", "PEM_HEADER", ")", ":", "raise", "ValueError", "(", "\"Invalid PEM encoding; must start with %s\"", "%", "PEM_HEADER", ")", "if", "not", "pem_cert_...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/ssl.py#L1492-L1503
google-research/electra
8a46635f32083ada044d7e9ad09604742600ee7b
model/modeling.py
python
layer_norm
(input_tensor, name=None)
return contrib_layers.layer_norm( inputs=input_tensor, begin_norm_axis=-1, begin_params_axis=-1, scope=name)
Run layer normalization on the last dimension of the tensor.
Run layer normalization on the last dimension of the tensor.
[ "Run", "layer", "normalization", "on", "the", "last", "dimension", "of", "the", "tensor", "." ]
def layer_norm(input_tensor, name=None): """Run layer normalization on the last dimension of the tensor.""" return contrib_layers.layer_norm( inputs=input_tensor, begin_norm_axis=-1, begin_params_axis=-1, scope=name)
[ "def", "layer_norm", "(", "input_tensor", ",", "name", "=", "None", ")", ":", "return", "contrib_layers", ".", "layer_norm", "(", "inputs", "=", "input_tensor", ",", "begin_norm_axis", "=", "-", "1", ",", "begin_params_axis", "=", "-", "1", ",", "scope", "...
https://github.com/google-research/electra/blob/8a46635f32083ada044d7e9ad09604742600ee7b/model/modeling.py#L392-L395
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/logging/config.py
python
DictConfigurator.configure_formatter
(self, config)
return result
Configure a formatter from a dictionary.
Configure a formatter from a dictionary.
[ "Configure", "a", "formatter", "from", "a", "dictionary", "." ]
def configure_formatter(self, config): """Configure a formatter from a dictionary.""" if '()' in config: factory = config['()'] # for use in exception handler try: result = self.configure_custom(config) except TypeError as te: if "'form...
[ "def", "configure_formatter", "(", "self", ",", "config", ")", ":", "if", "'()'", "in", "config", ":", "factory", "=", "config", "[", "'()'", "]", "# for use in exception handler", "try", ":", "result", "=", "self", ".", "configure_custom", "(", "config", ")...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/logging/config.py#L644-L670
Karmenzind/fp-server
931fca8fab9d7397c52cf9e76a76b1c60e190403
src/core/middleware.py
python
Middleware.prepare
(self, request)
在HTTP请求的方法执行之前,执行此函数 @param request HTTP请求实例
在HTTP请求的方法执行之前,执行此函数
[ "在HTTP请求的方法执行之前,执行此函数" ]
async def prepare(self, request): """ 在HTTP请求的方法执行之前,执行此函数 @param request HTTP请求实例 """ pass
[ "async", "def", "prepare", "(", "self", ",", "request", ")", ":", "pass" ]
https://github.com/Karmenzind/fp-server/blob/931fca8fab9d7397c52cf9e76a76b1c60e190403/src/core/middleware.py#L10-L14
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/poplib.py
python
POP3.dele
(self, which)
return self._shortcmd('DELE %s' % which)
Delete message number 'which'. Result is 'response'.
Delete message number 'which'.
[ "Delete", "message", "number", "which", "." ]
def dele(self, which): """Delete message number 'which'. Result is 'response'. """ return self._shortcmd('DELE %s' % which)
[ "def", "dele", "(", "self", ",", "which", ")", ":", "return", "self", ".", "_shortcmd", "(", "'DELE %s'", "%", "which", ")" ]
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/poplib.py#L235-L240
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_session_affinity_config.py
python
V1SessionAffinityConfig.__repr__
(self)
return self.to_str()
For `print` and `pprint`
For `print` and `pprint`
[ "For", "print", "and", "pprint" ]
def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_session_affinity_config.py#L104-L106
nadineproject/nadine
c41c8ef7ffe18f1853029c97eecc329039b4af6c
doors/keymaster/views.py
python
add_key
(request)
return render(request, 'keymaster/add_key.html', context)
[]
def add_key(request): username = request.POST.get("username", "") code = request.POST.get("code", "") # Try and find one and only one user for this username user = None if username: user_search = User.objects.filter(username=username) if not user_search: messages.add_mes...
[ "def", "add_key", "(", "request", ")", ":", "username", "=", "request", ".", "POST", ".", "get", "(", "\"username\"", ",", "\"\"", ")", "code", "=", "request", ".", "POST", ".", "get", "(", "\"code\"", ",", "\"\"", ")", "# Try and find one and only one use...
https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/doors/keymaster/views.py#L96-L133
drckf/paysage
85ef951be2750e13c0b42121b40e530689bdc1f4
paysage/backends/common.py
python
maybe_key
(dictionary, key, default=None, func=do_nothing)
Compute func(dictionary['key']) when dictionary has key key, else return default. Args: dictionary (dict) default (optional; any): default return value func (callable) Returns: func(dictionary[key]) or b if dictionary has no such key
Compute func(dictionary['key']) when dictionary has key key, else return default.
[ "Compute", "func", "(", "dictionary", "[", "key", "]", ")", "when", "dictionary", "has", "key", "key", "else", "return", "default", "." ]
def maybe_key(dictionary, key, default=None, func=do_nothing): """ Compute func(dictionary['key']) when dictionary has key key, else return default. Args: dictionary (dict) default (optional; any): default return value func (callable) Returns: func(dictionary[key]) or b...
[ "def", "maybe_key", "(", "dictionary", ",", "key", ",", "default", "=", "None", ",", "func", "=", "do_nothing", ")", ":", "try", ":", "return", "func", "(", "dictionary", "[", "key", "]", ")", "except", "KeyError", ":", "return", "default" ]
https://github.com/drckf/paysage/blob/85ef951be2750e13c0b42121b40e530689bdc1f4/paysage/backends/common.py#L47-L63
sfyc23/EverydayWechat
6b81d03dde92cfef584428bc1e59d2858e94204e
everyday_wechat/control/calendar/rt_calendar.py
python
get_rtcalendar
(date='')
return None
获取指定日期的节假日及万年历信息 https://github.com/MZCretin/RollToolsApi#指定日期的节假日及万年历信息 :param data: str 日期 格式 yyyyMMdd :rtype str
获取指定日期的节假日及万年历信息 https://github.com/MZCretin/RollToolsApi#指定日期的节假日及万年历信息 :param data: str 日期 格式 yyyyMMdd :rtype str
[ "获取指定日期的节假日及万年历信息", "https", ":", "//", "github", ".", "com", "/", "MZCretin", "/", "RollToolsApi#指定日期的节假日及万年历信息", ":", "param", "data", ":", "str", "日期", "格式", "yyyyMMdd", ":", "rtype", "str" ]
def get_rtcalendar(date=''): """ 获取指定日期的节假日及万年历信息 https://github.com/MZCretin/RollToolsApi#指定日期的节假日及万年历信息 :param data: str 日期 格式 yyyyMMdd :rtype str """ date_ = date or datetime.now().strftime('%Y%m%d') print('获取 {} 的日历...'.format(date_)) try: resp = requests.get('https://...
[ "def", "get_rtcalendar", "(", "date", "=", "''", ")", ":", "date_", "=", "date", "or", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "'%Y%m%d'", ")", "print", "(", "'获取 {} 的日历...'.format(da", "t", "e_))", "", "", "", "", "try", ":", "resp",...
https://github.com/sfyc23/EverydayWechat/blob/6b81d03dde92cfef584428bc1e59d2858e94204e/everyday_wechat/control/calendar/rt_calendar.py#L29-L71
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/whoosh/src/whoosh/support/numeric.py
python
split_range
(valsize, step, start, end)
Splits a range of numbers (from ``start`` to ``end``, inclusive) into a sequence of trie ranges of the form ``(start, end, shift)``. The consumer of these tuples is expected to shift the ``start`` and ``end`` right by ``shift``. This is used for generating term ranges for a numeric field. The queri...
Splits a range of numbers (from ``start`` to ``end``, inclusive) into a sequence of trie ranges of the form ``(start, end, shift)``. The consumer of these tuples is expected to shift the ``start`` and ``end`` right by ``shift``. This is used for generating term ranges for a numeric field. The queri...
[ "Splits", "a", "range", "of", "numbers", "(", "from", "start", "to", "end", "inclusive", ")", "into", "a", "sequence", "of", "trie", "ranges", "of", "the", "form", "(", "start", "end", "shift", ")", ".", "The", "consumer", "of", "these", "tuples", "is"...
def split_range(valsize, step, start, end): """Splits a range of numbers (from ``start`` to ``end``, inclusive) into a sequence of trie ranges of the form ``(start, end, shift)``. The consumer of these tuples is expected to shift the ``start`` and ``end`` right by ``shift``. This is used for ge...
[ "def", "split_range", "(", "valsize", ",", "step", ",", "start", ",", "end", ")", ":", "shift", "=", "0", "while", "True", ":", "diff", "=", "1", "<<", "(", "shift", "+", "step", ")", "mask", "=", "(", "(", "1", "<<", "step", ")", "-", "1", "...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/whoosh/src/whoosh/support/numeric.py#L160-L195
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v8/services/services/campaign_asset_service/transports/base.py
python
CampaignAssetServiceTransport.__init__
( self, *, host: str = "googleads.googleapis.com", credentials: ga_credentials.Credentials = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, )
Instantiate the transport. Args: host (Optional[str]): The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the applicatio...
Instantiate the transport.
[ "Instantiate", "the", "transport", "." ]
def __init__( self, *, host: str = "googleads.googleapis.com", credentials: ga_credentials.Credentials = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. Args: host (Optional[str]):...
[ "def", "__init__", "(", "self", ",", "*", ",", "host", ":", "str", "=", "\"googleads.googleapis.com\"", ",", "credentials", ":", "ga_credentials", ".", "Credentials", "=", "None", ",", "client_info", ":", "gapic_v1", ".", "client_info", ".", "ClientInfo", "=",...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/campaign_asset_service/transports/base.py#L41-L78
natural/java2python
b8037561c542522ae620e0a071ecc7e668461587
java2python/compiler/visitor.py
python
MethodContent.acceptAssert
(self, node, memo)
Accept and process an assert statement.
Accept and process an assert statement.
[ "Accept", "and", "process", "an", "assert", "statement", "." ]
def acceptAssert(self, node, memo): """ Accept and process an assert statement. """ assertStat = self.factory.statement('assert', fs=FS.lsr, parent=self) assertStat.expr.walk(node.firstChild(), memo)
[ "def", "acceptAssert", "(", "self", ",", "node", ",", "memo", ")", ":", "assertStat", "=", "self", ".", "factory", ".", "statement", "(", "'assert'", ",", "fs", "=", "FS", ".", "lsr", ",", "parent", "=", "self", ")", "assertStat", ".", "expr", ".", ...
https://github.com/natural/java2python/blob/b8037561c542522ae620e0a071ecc7e668461587/java2python/compiler/visitor.py#L372-L375
yangyanli/PointCNN
aa551ce5258dbf4f73db0d916826574f054dd3b9
pointnetpp_cls/utils/pointnet_util.py
python
sample_and_group_all
(l3_input_shape,xyz, points, use_xyz=True)
return new_xyz, new_points, idx, grouped_xyz
Inputs: xyz: (batch_size, ndataset, 3) TF tensor points: (batch_size, ndataset, channel) TF tensor, if None will just use xyz as points use_xyz: bool, if True concat XYZ with local point features, otherwise just use point features Outputs: new_xyz: (batch_size, 1, 3) as (0,0,0) ...
Inputs: xyz: (batch_size, ndataset, 3) TF tensor points: (batch_size, ndataset, channel) TF tensor, if None will just use xyz as points use_xyz: bool, if True concat XYZ with local point features, otherwise just use point features Outputs: new_xyz: (batch_size, 1, 3) as (0,0,0) ...
[ "Inputs", ":", "xyz", ":", "(", "batch_size", "ndataset", "3", ")", "TF", "tensor", "points", ":", "(", "batch_size", "ndataset", "channel", ")", "TF", "tensor", "if", "None", "will", "just", "use", "xyz", "as", "points", "use_xyz", ":", "bool", "if", ...
def sample_and_group_all(l3_input_shape,xyz, points, use_xyz=True): ''' Inputs: xyz: (batch_size, ndataset, 3) TF tensor points: (batch_size, ndataset, channel) TF tensor, if None will just use xyz as points use_xyz: bool, if True concat XYZ with local point features, otherwise just use ...
[ "def", "sample_and_group_all", "(", "l3_input_shape", ",", "xyz", ",", "points", ",", "use_xyz", "=", "True", ")", ":", "sess", "=", "tf", ".", "InteractiveSession", "(", ")", "batch_size", "=", "l3_input_shape", "[", "0", "]", "nsample", "=", "l3_input_shap...
https://github.com/yangyanli/PointCNN/blob/aa551ce5258dbf4f73db0d916826574f054dd3b9/pointnetpp_cls/utils/pointnet_util.py#L60-L88
blampe/IbPy
cba912d2ecc669b0bf2980357ea7942e49c0825e
ib/ext/EReader.py
python
EReader.__init__
(self, parent, dis)
generated source for method __init__
generated source for method __init__
[ "generated", "source", "for", "method", "__init__" ]
def __init__(self, parent, dis): """ generated source for method __init__ """ self.__init__("EReader", parent, dis)
[ "def", "__init__", "(", "self", ",", "parent", ",", "dis", ")", ":", "self", ".", "__init__", "(", "\"EReader\"", ",", "parent", ",", "dis", ")" ]
https://github.com/blampe/IbPy/blob/cba912d2ecc669b0bf2980357ea7942e49c0825e/ib/ext/EReader.py#L91-L93
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/chardistribution.py
python
EUCTWDistributionAnalysis.get_order
(self, aBuf)
[]
def get_order(self, aBuf): # for euc-TW encoding, we are interested # first byte range: 0xc4 -- 0xfe # second byte range: 0xa1 -- 0xfe # no validation needed here. State machine has done that first_char = wrap_ord(aBuf[0]) if first_char >= 0xC4: return 94...
[ "def", "get_order", "(", "self", ",", "aBuf", ")", ":", "# for euc-TW encoding, we are interested", "# first byte range: 0xc4 -- 0xfe", "# second byte range: 0xa1 -- 0xfe", "# no validation needed here. State machine has done that", "first_char", "=", "wrap_ord", "(", "aBuf", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/chardistribution.py#L118-L127
dfirtrack/dfirtrack
d405e9e2520f3f95372883e6543fa2aa7dac0121
dfirtrack_main/exporter/markdown/write_report.py
python
write_reason
(django_report, system)
reason
reason
[ "reason" ]
def write_reason(django_report, system): """reason""" django_report.write("## Identification / Reason for investigation\n") emptyline(django_report) if system.reason != None: django_report.write(system.reason.reason_name + "\n") if system.reason.reason_note != '': emptyline(...
[ "def", "write_reason", "(", "django_report", ",", "system", ")", ":", "django_report", ".", "write", "(", "\"## Identification / Reason for investigation\\n\"", ")", "emptyline", "(", "django_report", ")", "if", "system", ".", "reason", "!=", "None", ":", "django_re...
https://github.com/dfirtrack/dfirtrack/blob/d405e9e2520f3f95372883e6543fa2aa7dac0121/dfirtrack_main/exporter/markdown/write_report.py#L120-L133
monologg/KoELECTRA
8c0db734d27ef0c9c1903cebbb4b68b6577e36d2
finetune/processor/ner.py
python
InputExample.to_json_string
(self)
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
Serializes this instance to a JSON string.
Serializes this instance to a JSON string.
[ "Serializes", "this", "instance", "to", "a", "JSON", "string", "." ]
def to_json_string(self): """Serializes this instance to a JSON string.""" return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
[ "def", "to_json_string", "(", "self", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "to_dict", "(", ")", ",", "indent", "=", "2", ",", "sort_keys", "=", "True", ")", "+", "\"\\n\"" ]
https://github.com/monologg/KoELECTRA/blob/8c0db734d27ef0c9c1903cebbb4b68b6577e36d2/finetune/processor/ner.py#L31-L33
Antergos/Cnchi
13ac2209da9432d453e0097cf48a107640b563a9
src/misc/extra.py
python
partition_exists
(partition)
return exists
Check if a partition already exists
Check if a partition already exists
[ "Check", "if", "a", "partition", "already", "exists" ]
def partition_exists(partition): """ Check if a partition already exists """ if "/dev/" in partition: partition = partition[len("/dev/"):] exists = False with open("/proc/partitions") as partitions: if partition in partitions.read(): exists = True return exists
[ "def", "partition_exists", "(", "partition", ")", ":", "if", "\"/dev/\"", "in", "partition", ":", "partition", "=", "partition", "[", "len", "(", "\"/dev/\"", ")", ":", "]", "exists", "=", "False", "with", "open", "(", "\"/proc/partitions\"", ")", "as", "p...
https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/misc/extra.py#L597-L606
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/contrib/gis/db/models/functions.py
python
GeoFunc.name
(self)
return self.__class__.__name__
[]
def name(self): return self.__class__.__name__
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "__class__", ".", "__name__" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/gis/db/models/functions.py#L27-L28
hfslyc/AdvSemiSeg
841d546c927605747594be726622363bf781cefb
evaluate_voc.py
python
main
()
Create the model and start the evaluation process.
Create the model and start the evaluation process.
[ "Create", "the", "model", "and", "start", "the", "evaluation", "process", "." ]
def main(): """Create the model and start the evaluation process.""" args = get_arguments() gpu0 = args.gpu if not os.path.exists(args.save_dir): os.makedirs(args.save_dir) model = Res_Deeplab(num_classes=args.num_classes) if args.pretrained_model != None: args.restore_from ...
[ "def", "main", "(", ")", ":", "args", "=", "get_arguments", "(", ")", "gpu0", "=", "args", ".", "gpu", "if", "not", "os", ".", "path", ".", "exists", "(", "args", ".", "save_dir", ")", ":", "os", ".", "makedirs", "(", "args", ".", "save_dir", ")"...
https://github.com/hfslyc/AdvSemiSeg/blob/841d546c927605747594be726622363bf781cefb/evaluate_voc.py#L178-L235
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/clusterfuzz/_internal/google_cloud_utils/compute_engine.py
python
add_metadata
(instance_name, project, zone, key, value, wait_for_completion)
return _do_operation_with_retries(operation, project, zone, wait_for_completion)
Add metadata to an existing instance. Replaces existing metadata values with the same key.
Add metadata to an existing instance. Replaces existing metadata values with the same key.
[ "Add", "metadata", "to", "an", "existing", "instance", ".", "Replaces", "existing", "metadata", "values", "with", "the", "same", "key", "." ]
def add_metadata(instance_name, project, zone, key, value, wait_for_completion): """Add metadata to an existing instance. Replaces existing metadata values with the same key.""" existing_metadata, fingerprint = _get_metadata_and_fingerprint( instance_name, project, zone) if not existing_metadata: retu...
[ "def", "add_metadata", "(", "instance_name", ",", "project", ",", "zone", ",", "key", ",", "value", ",", "wait_for_completion", ")", ":", "existing_metadata", ",", "fingerprint", "=", "_get_metadata_and_fingerprint", "(", "instance_name", ",", "project", ",", "zon...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/google_cloud_utils/compute_engine.py#L172-L193
Komodo/KomodoEdit
61edab75dce2bdb03943b387b0608ea36f548e8e
contrib/bugsnag-python/2.3.1/configuration.py
python
RequestConfiguration.get_instance
(cls)
return instance
Get this thread's instance of the RequestConfiguration.
Get this thread's instance of the RequestConfiguration.
[ "Get", "this", "thread", "s", "instance", "of", "the", "RequestConfiguration", "." ]
def get_instance(cls): """ Get this thread's instance of the RequestConfiguration. """ instance = getattr(threadlocal, "bugsnag", None) if not instance: instance = RequestConfiguration() setattr(threadlocal, "bugsnag", instance) return instance
[ "def", "get_instance", "(", "cls", ")", ":", "instance", "=", "getattr", "(", "threadlocal", ",", "\"bugsnag\"", ",", "None", ")", "if", "not", "instance", ":", "instance", "=", "RequestConfiguration", "(", ")", "setattr", "(", "threadlocal", ",", "\"bugsnag...
https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/contrib/bugsnag-python/2.3.1/configuration.py#L80-L89
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/words/protocols/irc.py
python
ServerSupportedFeatures.isupport_KICKLEN
(self, params)
return _intOrDefault(params[0])
Maximum length of a kick message a client may provide.
Maximum length of a kick message a client may provide.
[ "Maximum", "length", "of", "a", "kick", "message", "a", "client", "may", "provide", "." ]
def isupport_KICKLEN(self, params): """ Maximum length of a kick message a client may provide. """ return _intOrDefault(params[0])
[ "def", "isupport_KICKLEN", "(", "self", ",", "params", ")", ":", "return", "_intOrDefault", "(", "params", "[", "0", "]", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/words/protocols/irc.py#L890-L894
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/random.py
python
_randbelow_with_getrandbits
(self, n)
return r
Return a random int in the range [0,n). Returns 0 if n==0.
Return a random int in the range [0,n). Returns 0 if n==0.
[ "Return", "a", "random", "int", "in", "the", "range", "[", "0", "n", ")", ".", "Returns", "0", "if", "n", "==", "0", "." ]
def _randbelow_with_getrandbits(self, n): "Return a random int in the range [0,n). Returns 0 if n==0." if not n: return 0 getrandbits = self.getrandbits k = n.bit_length() # don't use (n-1) here because n can be 1 r = getrandbits(k) # 0 <= r < 2**k while r...
[ "def", "_randbelow_with_getrandbits", "(", "self", ",", "n", ")", ":", "if", "not", "n", ":", "return", "0", "getrandbits", "=", "self", ".", "getrandbits", "k", "=", "n", ".", "bit_length", "(", ")", "# don't use (n-1) here because n can be 1", "r", "=", "g...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/random.py#L239-L249
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/RFCN/RFCN-tensorflow/Dataset/CocoDataset.py
python
CocoDataset.__init__
(self, path, set="train2017", normalizeSize=True, randomZoom=True)
[]
def __init__(self, path, set="train2017", normalizeSize=True, randomZoom=True): print(path) self.path=path self.coco=None self.normalizeSize=normalizeSize self.set=set self.randomZoom=randomZoom
[ "def", "__init__", "(", "self", ",", "path", ",", "set", "=", "\"train2017\"", ",", "normalizeSize", "=", "True", ",", "randomZoom", "=", "True", ")", ":", "print", "(", "path", ")", "self", ".", "path", "=", "path", "self", ".", "coco", "=", "None",...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/RFCN/RFCN-tensorflow/Dataset/CocoDataset.py#L25-L31
vindimy/altcointip
83c9fac2dd980ee5a71d3ed4a1cbbcab646e018d
src/ctb/ctb_action.py
python
CtbAction.update
(self, state=None)
return True
Update action state in database
Update action state in database
[ "Update", "action", "state", "in", "database" ]
def update(self, state=None): """ Update action state in database """ lg.debug("> CtbAction::update(%s)", state) if not state: raise Exception("CtbAction::update(): state is null") if not self.type or not self.msg_id: raise Exception("CtbAction::u...
[ "def", "update", "(", "self", ",", "state", "=", "None", ")", ":", "lg", ".", "debug", "(", "\"> CtbAction::update(%s)\"", ",", "state", ")", "if", "not", "state", ":", "raise", "Exception", "(", "\"CtbAction::update(): state is null\"", ")", "if", "not", "s...
https://github.com/vindimy/altcointip/blob/83c9fac2dd980ee5a71d3ed4a1cbbcab646e018d/src/ctb/ctb_action.py#L210-L233
aplpy/aplpy
241f744a33e7dee677718bd690ea52fbba3628d7
aplpy/overlays.py
python
Scalebar._set_scalebar_properties
(self, **kwargs)
Modify the scalebar properties. All arguments are passed to the matplotlib Rectangle class. See the matplotlib documentation for more details.
Modify the scalebar properties.
[ "Modify", "the", "scalebar", "properties", "." ]
def _set_scalebar_properties(self, **kwargs): """ Modify the scalebar properties. All arguments are passed to the matplotlib Rectangle class. See the matplotlib documentation for more details. """ for kwarg, val in kwargs.items(): try: kvpair ...
[ "def", "_set_scalebar_properties", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "kwarg", ",", "val", "in", "kwargs", ".", "items", "(", ")", ":", "try", ":", "kvpair", "=", "{", "kwarg", ":", "val", "}", "self", ".", "_scalebar", ".", "si...
https://github.com/aplpy/aplpy/blob/241f744a33e7dee677718bd690ea52fbba3628d7/aplpy/overlays.py#L259-L272
axcore/tartube
36dd493642923fe8b9190a41db596c30c043ae90
tartube/mainapp.py
python
TartubeApp.update_container_url
(self, data_list)
Called by config.SystemPrefWin.on_container_url_edited(). When the user has confirmed a change to a channel/playlist's source URL, implement that change, and update the window's treeview. Args: data_list (list): A list containing four items: the treeview model, an ...
Called by config.SystemPrefWin.on_container_url_edited().
[ "Called", "by", "config", ".", "SystemPrefWin", ".", "on_container_url_edited", "()", "." ]
def update_container_url(self, data_list): """Called by config.SystemPrefWin.on_container_url_edited(). When the user has confirmed a change to a channel/playlist's source URL, implement that change, and update the window's treeview. Args: data_list (list): A list contain...
[ "def", "update_container_url", "(", "self", ",", "data_list", ")", ":", "if", "DEBUG_FUNC_FLAG", ":", "utils", ".", "debug_time", "(", "'app 13832 update_container_url'", ")", "# Extract values from the argument list", "model", "=", "data_list", ".", "pop", "(", "0", ...
https://github.com/axcore/tartube/blob/36dd493642923fe8b9190a41db596c30c043ae90/tartube/mainapp.py#L16391-L16417
wistbean/fxxkpython
88e16d79d8dd37236ba6ecd0d0ff11d63143968c
vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/locators.py
python
AggregatingLocator.get_distribution_names
(self)
return result
Return all the distribution names known to this locator.
Return all the distribution names known to this locator.
[ "Return", "all", "the", "distribution", "names", "known", "to", "this", "locator", "." ]
def get_distribution_names(self): """ Return all the distribution names known to this locator. """ result = set() for locator in self.locators: try: result |= locator.get_distribution_names() except NotImplementedError: pass...
[ "def", "get_distribution_names", "(", "self", ")", ":", "result", "=", "set", "(", ")", "for", "locator", "in", "self", ".", "locators", ":", "try", ":", "result", "|=", "locator", ".", "get_distribution_names", "(", ")", "except", "NotImplementedError", ":"...
https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/locators.py#L1035-L1045
danecjensen/subscribely
4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0
src/pkg_resources.py
python
WorkingSet.require
(self, *requirements)
return needed
Ensure that distributions matching `requirements` are activated `requirements` must be a string or a (possibly-nested) sequence thereof, specifying the distributions and versions required. The return value is a sequence of the distributions that needed to be activated to fulfill the re...
Ensure that distributions matching `requirements` are activated
[ "Ensure", "that", "distributions", "matching", "requirements", "are", "activated" ]
def require(self, *requirements): """Ensure that distributions matching `requirements` are activated `requirements` must be a string or a (possibly-nested) sequence thereof, specifying the distributions and versions required. The return value is a sequence of the distributions that nee...
[ "def", "require", "(", "self", ",", "*", "requirements", ")", ":", "needed", "=", "self", ".", "resolve", "(", "parse_requirements", "(", "requirements", ")", ")", "for", "dist", "in", "needed", ":", "self", ".", "add", "(", "dist", ")", "return", "nee...
https://github.com/danecjensen/subscribely/blob/4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0/src/pkg_resources.py#L638-L653
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
chap19/monitor/monitor/build/lib.linux-x86_64-2.7/monitor/api/openstack/wsgi.py
python
ResponseObject.__init__
(self, obj, code=None, **serializers)
Binds serializers with an object. Takes keyword arguments akin to the @serializer() decorator for specifying serializers. Serializers specified will be given preference over default serializers or method-specific serializers on return.
Binds serializers with an object.
[ "Binds", "serializers", "with", "an", "object", "." ]
def __init__(self, obj, code=None, **serializers): """Binds serializers with an object. Takes keyword arguments akin to the @serializer() decorator for specifying serializers. Serializers specified will be given preference over default serializers or method-specific serializers...
[ "def", "__init__", "(", "self", ",", "obj", ",", "code", "=", "None", ",", "*", "*", "serializers", ")", ":", "self", ".", "obj", "=", "obj", "self", ".", "serializers", "=", "serializers", "self", ".", "_default_code", "=", "200", "self", ".", "_cod...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/build/lib.linux-x86_64-2.7/monitor/api/openstack/wsgi.py#L405-L420
IQTLabs/poseidon
eee58df1628bb8412f8d19676ddcda9c01ca9535
src/core/core/helpers/rabbit.py
python
Rabbit.make_rabbit_connection
(self, host, port, exchange, keys, total_sleep=float('inf'))
return do_rabbit
Connects to rabbitmq using the given hostname, exchange, and queue. Retries on failure until success. Binds routing keys appropriate for module, and returns the channel and connection.
Connects to rabbitmq using the given hostname, exchange, and queue. Retries on failure until success. Binds routing keys appropriate for module, and returns the channel and connection.
[ "Connects", "to", "rabbitmq", "using", "the", "given", "hostname", "exchange", "and", "queue", ".", "Retries", "on", "failure", "until", "success", ".", "Binds", "routing", "keys", "appropriate", "for", "module", "and", "returns", "the", "channel", "and", "con...
def make_rabbit_connection(self, host, port, exchange, keys, total_sleep=float('inf')): # pragma: no cover ''' Connects to rabbitmq using the given hostname, exchange, and queue. Retries on failure until success. Binds routing keys appropriate for module, ...
[ "def", "make_rabbit_connection", "(", "self", ",", "host", ",", "port", ",", "exchange", ",", "keys", ",", "total_sleep", "=", "float", "(", "'inf'", ")", ")", ":", "# pragma: no cover", "wait", "=", "True", "do_rabbit", "=", "True", "while", "wait", "and"...
https://github.com/IQTLabs/poseidon/blob/eee58df1628bb8412f8d19676ddcda9c01ca9535/src/core/core/helpers/rabbit.py#L30-L77
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/cluster_entity.py
python
ClusterEntity.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "iteritems", "(", "self", ".", "swagger_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", "value", ","...
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/cluster_entity.py#L72-L96
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
python/ray/util/client/server/proxier.py
python
DataServicerProxy.modify_connection_info_resp
(self, init_resp: ray_client_pb2.DataResponse )
return modified_resp
Modify the `num_clients` returned the ConnectionInfoResponse because individual SpecificServers only have **one** client.
Modify the `num_clients` returned the ConnectionInfoResponse because individual SpecificServers only have **one** client.
[ "Modify", "the", "num_clients", "returned", "the", "ConnectionInfoResponse", "because", "individual", "SpecificServers", "only", "have", "**", "one", "**", "client", "." ]
def modify_connection_info_resp(self, init_resp: ray_client_pb2.DataResponse ) -> ray_client_pb2.DataResponse: """ Modify the `num_clients` returned the ConnectionInfoResponse because individual SpecificServers only have **o...
[ "def", "modify_connection_info_resp", "(", "self", ",", "init_resp", ":", "ray_client_pb2", ".", "DataResponse", ")", "->", "ray_client_pb2", ".", "DataResponse", ":", "init_type", "=", "init_resp", ".", "WhichOneof", "(", "\"type\"", ")", "if", "init_type", "!=",...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/python/ray/util/client/server/proxier.py#L570-L584
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
golismero/api/data/information/fingerprint.py
python
OSFingerprint.__init__
(self, cpe, accuracy, name = None, vendor = None, type = None, generation = None, family = None)
:param cpe: CPE (Common Platform Enumeration). Example: "/o:microsoft:windows_xp" :type cpe: str :param accuracy: Accuracy percentage (between 0.0 and 100.0). :type accuracy: float :param name: (Optional) OS name. :type name: str | None :param vendor: (Opti...
:param cpe: CPE (Common Platform Enumeration). Example: "/o:microsoft:windows_xp" :type cpe: str
[ ":", "param", "cpe", ":", "CPE", "(", "Common", "Platform", "Enumeration", ")", ".", "Example", ":", "/", "o", ":", "microsoft", ":", "windows_xp", ":", "type", "cpe", ":", "str" ]
def __init__(self, cpe, accuracy, name = None, vendor = None, type = None, generation = None, family = None): """ :param cpe: CPE (Common Platform Enumeration). Example: "/o:microsoft:windows_xp" :type cpe: str :param accuracy: Accuracy perc...
[ "def", "__init__", "(", "self", ",", "cpe", ",", "accuracy", ",", "name", "=", "None", ",", "vendor", "=", "None", ",", "type", "=", "None", ",", "generation", "=", "None", ",", "family", "=", "None", ")", ":", "# Fix the naming problem.", "os_type", "...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/golismero/api/data/information/fingerprint.py#L98-L163
Instagram/LibCST
13370227703fe3171e94c57bdd7977f3af696b73
libcst/matchers/_matcher_base.py
python
_ExtractMatchingNode.name
(self)
return self._name
The name we will call our captured LibCST node inside the resulting dictionary returned by :func:`extract` or :func:`extractall`.
The name we will call our captured LibCST node inside the resulting dictionary returned by :func:`extract` or :func:`extractall`.
[ "The", "name", "we", "will", "call", "our", "captured", "LibCST", "node", "inside", "the", "resulting", "dictionary", "returned", "by", ":", "func", ":", "extract", "or", ":", "func", ":", "extractall", "." ]
def name(self) -> str: """ The name we will call our captured LibCST node inside the resulting dictionary returned by :func:`extract` or :func:`extractall`. """ return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
https://github.com/Instagram/LibCST/blob/13370227703fe3171e94c57bdd7977f3af696b73/libcst/matchers/_matcher_base.py#L432-L437
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/type_api.py
python
TypeEngine.with_variant
(self, type_, dialect_name)
return Variant(self, {dialect_name: to_instance(type_)})
Produce a new type object that will utilize the given type when applied to the dialect of the given name. e.g.:: from sqlalchemy.types import String from sqlalchemy.dialects import mysql s = String() s = s.with_variant(mysql.VARCHAR(collation='foo'), '...
Produce a new type object that will utilize the given type when applied to the dialect of the given name.
[ "Produce", "a", "new", "type", "object", "that", "will", "utilize", "the", "given", "type", "when", "applied", "to", "the", "dialect", "of", "the", "given", "name", "." ]
def with_variant(self, type_, dialect_name): """Produce a new type object that will utilize the given type when applied to the dialect of the given name. e.g.:: from sqlalchemy.types import String from sqlalchemy.dialects import mysql s = String() ...
[ "def", "with_variant", "(", "self", ",", "type_", ",", "dialect_name", ")", ":", "return", "Variant", "(", "self", ",", "{", "dialect_name", ":", "to_instance", "(", "type_", ")", "}", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/type_api.py#L394-L422
bmuller/twistar
1eb46ff2577473e0a26932ee57473e26203a3db2
twistar/dbobject.py
python
DBObject.refresh
(self)
return self._config.refreshObj(self)
Update the properties for this object from the database. @return: A C{Deferred} object.
Update the properties for this object from the database.
[ "Update", "the", "properties", "for", "this", "object", "from", "the", "database", "." ]
def refresh(self): """ Update the properties for this object from the database. @return: A C{Deferred} object. """ return self._config.refreshObj(self)
[ "def", "refresh", "(", "self", ")", ":", "return", "self", ".", "_config", ".", "refreshObj", "(", "self", ")" ]
https://github.com/bmuller/twistar/blob/1eb46ff2577473e0a26932ee57473e26203a3db2/twistar/dbobject.py#L223-L229
glutanimate/review-heatmap
c758478125b60a81c66c87c35b12b7968ec0a348
src/review_heatmap/libaddon/_vendor/logging/__init__.py
python
Filterer.filter
(self, record)
return rv
Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero. .. versionchanged:: 3.2 Allow filters...
Determine if a record is loggable by consulting all the filters.
[ "Determine", "if", "a", "record", "is", "loggable", "by", "consulting", "all", "the", "filters", "." ]
def filter(self, record): """ Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero. .. ...
[ "def", "filter", "(", "self", ",", "record", ")", ":", "rv", "=", "True", "for", "f", "in", "self", ".", "filters", ":", "if", "hasattr", "(", "f", ",", "'filter'", ")", ":", "result", "=", "f", ".", "filter", "(", "record", ")", "else", ":", "...
https://github.com/glutanimate/review-heatmap/blob/c758478125b60a81c66c87c35b12b7968ec0a348/src/review_heatmap/libaddon/_vendor/logging/__init__.py#L705-L726
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/github/PullRequestReview.py
python
PullRequestReview.body
(self)
return self._body.value
:type: string
:type: string
[ ":", "type", ":", "string" ]
def body(self): """ :type: string """ self._completeIfNotSet(self._body) return self._body.value
[ "def", "body", "(", "self", ")", ":", "self", ".", "_completeIfNotSet", "(", "self", ".", "_body", ")", "return", "self", ".", "_body", ".", "value" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/github/PullRequestReview.py#L62-L67
jobovy/galpy
8e6a230bbe24ce16938db10053f92eb17fe4bb52
galpy/actionAngle/actionAngleAxi.py
python
actionAngleAxi.calcRapRperi
(self,**kwargs)
return self._rperirap
NAME: calcRapRperi PURPOSE: calculate the apocenter and pericenter radii INPUT: OUTPUT: (rperi,rap) HISTORY: 2010-12-01 - Written - Bovy (NYU)
NAME: calcRapRperi PURPOSE: calculate the apocenter and pericenter radii INPUT: OUTPUT: (rperi,rap) HISTORY: 2010-12-01 - Written - Bovy (NYU)
[ "NAME", ":", "calcRapRperi", "PURPOSE", ":", "calculate", "the", "apocenter", "and", "pericenter", "radii", "INPUT", ":", "OUTPUT", ":", "(", "rperi", "rap", ")", "HISTORY", ":", "2010", "-", "12", "-", "01", "-", "Written", "-", "Bovy", "(", "NYU", ")...
def calcRapRperi(self,**kwargs): """ NAME: calcRapRperi PURPOSE: calculate the apocenter and pericenter radii INPUT: OUTPUT: (rperi,rap) HISTORY: 2010-12-01 - Written - Bovy (NYU) """ if hasattr(self,'_rperirap')...
[ "def", "calcRapRperi", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "self", ",", "'_rperirap'", ")", ":", "#pragma: no cover", "return", "self", ".", "_rperirap", "EL", "=", "self", ".", "calcEL", "(", "*", "*", "kwargs", ")", ...
https://github.com/jobovy/galpy/blob/8e6a230bbe24ce16938db10053f92eb17fe4bb52/galpy/actionAngle/actionAngleAxi.py#L263-L327
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
ctree_anchor_t.get_index
(self, *args)
return _idaapi.ctree_anchor_t_get_index(self, *args)
get_index(self) -> int
get_index(self) -> int
[ "get_index", "(", "self", ")", "-", ">", "int" ]
def get_index(self, *args): """ get_index(self) -> int """ return _idaapi.ctree_anchor_t_get_index(self, *args)
[ "def", "get_index", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "ctree_anchor_t_get_index", "(", "self", ",", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L38802-L38806
rlworkgroup/garage
b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507
src/garage/np/_functions.py
python
truncate_tensor_dict
(tensor_dict, truncated_len)
return ret
Truncate dictionary of list of tensor. Args: tensor_dict (dict[numpy.ndarray]): a dictionary of {tensors or dictionary of tensors}. truncated_len (int): Length to truncate. Return: dict: a dictionary of {stacked tensors or dictionary of stacked tensors}
Truncate dictionary of list of tensor.
[ "Truncate", "dictionary", "of", "list", "of", "tensor", "." ]
def truncate_tensor_dict(tensor_dict, truncated_len): """Truncate dictionary of list of tensor. Args: tensor_dict (dict[numpy.ndarray]): a dictionary of {tensors or dictionary of tensors}. truncated_len (int): Length to truncate. Return: dict: a dictionary of {stacked t...
[ "def", "truncate_tensor_dict", "(", "tensor_dict", ",", "truncated_len", ")", ":", "ret", "=", "dict", "(", ")", "for", "k", ",", "v", "in", "tensor_dict", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "ret", "[", ...
https://github.com/rlworkgroup/garage/blob/b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507/src/garage/np/_functions.py#L323-L343
pywinauto/pywinauto
7235e6f83edfd96a7aeb8bbf9fef7b8f3d912512
pywinauto/linux/atspi_element_info.py
python
AtspiElementInfo.__hash__
(self)
return hash((self._pid, self._root_id, self._runtime_id))
Return a unique hash value based on the element's handle
Return a unique hash value based on the element's handle
[ "Return", "a", "unique", "hash", "value", "based", "on", "the", "element", "s", "handle" ]
def __hash__(self): """Return a unique hash value based on the element's handle""" return hash((self._pid, self._root_id, self._runtime_id))
[ "def", "__hash__", "(", "self", ")", ":", "return", "hash", "(", "(", "self", ".", "_pid", ",", "self", ".", "_root_id", ",", "self", ".", "_runtime_id", ")", ")" ]
https://github.com/pywinauto/pywinauto/blob/7235e6f83edfd96a7aeb8bbf9fef7b8f3d912512/pywinauto/linux/atspi_element_info.py#L82-L84
DeepWisdom/AutoDL
48db4eb04d55ce69e93d4a3bdc24592bdb34a868
AutoDL_sample_code_submission/Auto_Image/skeleton/projects/api/model.py
python
Model.__init__
(self, metadata)
:param metadata: an AutoDLMetadata object. Its definition can be found in https://github.com/zhengying-liu/autodl_starting_kit_stable/blob/master/AutoDL_ingestion_program/dataset.py#L41
:param metadata: an AutoDLMetadata object. Its definition can be found in https://github.com/zhengying-liu/autodl_starting_kit_stable/blob/master/AutoDL_ingestion_program/dataset.py#L41
[ ":", "param", "metadata", ":", "an", "AutoDLMetadata", "object", ".", "Its", "definition", "can", "be", "found", "in", "https", ":", "//", "github", ".", "com", "/", "zhengying", "-", "liu", "/", "autodl_starting_kit_stable", "/", "blob", "/", "master", "/...
def __init__(self, metadata): """ :param metadata: an AutoDLMetadata object. Its definition can be found in https://github.com/zhengying-liu/autodl_starting_kit_stable/blob/master/AutoDL_ingestion_program/dataset.py#L41 """ self.metadata = metadata self.done_training...
[ "def", "__init__", "(", "self", ",", "metadata", ")", ":", "self", ".", "metadata", "=", "metadata", "self", ".", "done_training", "=", "False" ]
https://github.com/DeepWisdom/AutoDL/blob/48db4eb04d55ce69e93d4a3bdc24592bdb34a868/AutoDL_sample_code_submission/Auto_Image/skeleton/projects/api/model.py#L6-L13
ahkab/ahkab
1e8939194b689909b8184ce7eba478b485ff9e3a
ahkab/constants.py
python
Material.Eg
(self, T=Tref)
return (self.Eg_0 - self.alpha * T ** 2 / (self.beta + T))
Energy gap of silicon at temperature ``T`` **Parameters:** T : float, optional The temperature at which the thermal voltage is to be evaluated. If not specified, it defaults to ``constants.Tref``. **Returns:** Eg : float The energy gap, expressed i...
Energy gap of silicon at temperature ``T``
[ "Energy", "gap", "of", "silicon", "at", "temperature", "T" ]
def Eg(self, T=Tref): """Energy gap of silicon at temperature ``T`` **Parameters:** T : float, optional The temperature at which the thermal voltage is to be evaluated. If not specified, it defaults to ``constants.Tref``. **Returns:** Eg : float ...
[ "def", "Eg", "(", "self", ",", "T", "=", "Tref", ")", ":", "return", "(", "self", ".", "Eg_0", "-", "self", ".", "alpha", "*", "T", "**", "2", "/", "(", "self", ".", "beta", "+", "T", ")", ")" ]
https://github.com/ahkab/ahkab/blob/1e8939194b689909b8184ce7eba478b485ff9e3a/ahkab/constants.py#L58-L73
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/rfc822.py
python
AddrlistClass.getcomment
(self)
return self.getdelimited('(', ')\r', 1)
Get a parenthesis-delimited fragment from self's field.
Get a parenthesis-delimited fragment from self's field.
[ "Get", "a", "parenthesis", "-", "delimited", "fragment", "from", "self", "s", "field", "." ]
def getcomment(self): """Get a parenthesis-delimited fragment from self's field.""" return self.getdelimited('(', ')\r', 1)
[ "def", "getcomment", "(", "self", ")", ":", "return", "self", ".", "getdelimited", "(", "'('", ",", "')\\r'", ",", "1", ")" ]
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/rfc822.py#L720-L722
zh217/aiochan
1fd9bff74fd1092549c8969ea780cc39d2077497
aiochan/channel.py
python
Chan.to_iterable
(self, buffer_size=1)
return item_gen()
Return an iterable containing the values in the channel. This method is a convenience provided expressly for inter-thread usage. Typically, we will have an asyncio loop on a background thread producing values, and this method can be used as an escape hatch to transport the produced values back ...
Return an iterable containing the values in the channel.
[ "Return", "an", "iterable", "containing", "the", "values", "in", "the", "channel", "." ]
def to_iterable(self, buffer_size=1): """ Return an iterable containing the values in the channel. This method is a convenience provided expressly for inter-thread usage. Typically, we will have an asyncio loop on a background thread producing values, and this method can be used as an e...
[ "def", "to_iterable", "(", "self", ",", "buffer_size", "=", "1", ")", ":", "q", "=", "self", ".", "to_queue", "(", "queue", ".", "Queue", "(", "maxsize", "=", "buffer_size", ")", ")", "def", "item_gen", "(", ")", ":", "while", "True", ":", "item", ...
https://github.com/zh217/aiochan/blob/1fd9bff74fd1092549c8969ea780cc39d2077497/aiochan/channel.py#L772-L806
RealHacker/leetcode-solutions
50b21ea270dd095bef0b21e4e8bd79c1f279a85a
052_n_queens_ii/nqueens_ii.py
python
Solution.totalNQueens
(self, n)
return len(perms)
:type n: int :rtype: int
:type n: int :rtype: int
[ ":", "type", "n", ":", "int", ":", "rtype", ":", "int" ]
def totalNQueens(self, n): """ :type n: int :rtype: int """ perms =[] for perm in itertools.permutations(range(n)): diag = set() tdiag = set() conflict = False for i, c in enumerate(perm): d = i+c ...
[ "def", "totalNQueens", "(", "self", ",", "n", ")", ":", "perms", "=", "[", "]", "for", "perm", "in", "itertools", ".", "permutations", "(", "range", "(", "n", ")", ")", ":", "diag", "=", "set", "(", ")", "tdiag", "=", "set", "(", ")", "conflict",...
https://github.com/RealHacker/leetcode-solutions/blob/50b21ea270dd095bef0b21e4e8bd79c1f279a85a/052_n_queens_ii/nqueens_ii.py#L2-L22
LonamiWebs/Telethon
f9643bf7376a5953da2050a5361c9b465f7ee7d9
telethon/extensions/binaryreader.py
python
BinaryReader.read
(self, length=-1)
return result
Read the given amount of bytes, or -1 to read all remaining.
Read the given amount of bytes, or -1 to read all remaining.
[ "Read", "the", "given", "amount", "of", "bytes", "or", "-", "1", "to", "read", "all", "remaining", "." ]
def read(self, length=-1): """Read the given amount of bytes, or -1 to read all remaining.""" result = self.stream.read(length) if (length >= 0) and (len(result) != length): raise BufferError( 'No more data left to read (need {}, got {}: {}); last read {}' ...
[ "def", "read", "(", "self", ",", "length", "=", "-", "1", ")", ":", "result", "=", "self", ".", "stream", ".", "read", "(", "length", ")", "if", "(", "length", ">=", "0", ")", "and", "(", "len", "(", "result", ")", "!=", "length", ")", ":", "...
https://github.com/LonamiWebs/Telethon/blob/f9643bf7376a5953da2050a5361c9b465f7ee7d9/telethon/extensions/binaryreader.py#L56-L66
soskek/bert-chainer
22cc04afff4d31b6a10e36bb32837216ede22a49
bert-tf/modeling.py
python
BertModel.get_sequence_output
(self)
return self.sequence_output
Gets final hidden layer of encoder. Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the final hidden of the transformer encoder.
Gets final hidden layer of encoder.
[ "Gets", "final", "hidden", "layer", "of", "encoder", "." ]
def get_sequence_output(self): """Gets final hidden layer of encoder. Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the final hidden of the transformer encoder. """ return self.sequence_output
[ "def", "get_sequence_output", "(", "self", ")", ":", "return", "self", ".", "sequence_output" ]
https://github.com/soskek/bert-chainer/blob/22cc04afff4d31b6a10e36bb32837216ede22a49/bert-tf/modeling.py#L238-L245
genforce/idinvert
138266724c7c8709fa4b2565c1f8e648ae5c6641
utils/editor.py
python
mix_style
(style_codes, content_codes, num_layers=1, mix_layers=None, is_style_layerwise=True, is_content_layerwise=True)
return results
Mixes styles from style codes to those of content codes. Each style code or content code consists of `num_layers` codes, each of which is typically fed into a particular layer of the generator. This function mixes styles by partially replacing the codes of `content_codes` from some certain layers with those of...
Mixes styles from style codes to those of content codes.
[ "Mixes", "styles", "from", "style", "codes", "to", "those", "of", "content", "codes", "." ]
def mix_style(style_codes, content_codes, num_layers=1, mix_layers=None, is_style_layerwise=True, is_content_layerwise=True): """Mixes styles from style codes to those of content codes. Each style code or content code consists of `num_layers` co...
[ "def", "mix_style", "(", "style_codes", ",", "content_codes", ",", "num_layers", "=", "1", ",", "mix_layers", "=", "None", ",", "is_style_layerwise", "=", "True", ",", "is_content_layerwise", "=", "True", ")", ":", "if", "not", "is_style_layerwise", ":", "styl...
https://github.com/genforce/idinvert/blob/138266724c7c8709fa4b2565c1f8e648ae5c6641/utils/editor.py#L97-L180
s-leger/archipack
5a6243bf1edf08a6b429661ce291dacb551e5f8a
pygeos/geomgraph.py
python
PlanarGraph.addNode
(self, node)
return self._nodes.addNode(node)
* Add a Node or create a new one when not found * @param: node mixed Node or Coordinate * @return Node
* Add a Node or create a new one when not found *
[ "*", "Add", "a", "Node", "or", "create", "a", "new", "one", "when", "not", "found", "*" ]
def addNode(self, node): """ * Add a Node or create a new one when not found * @param: node mixed Node or Coordinate * @return Node """ logger.debug("PlanarGraph.addNode(%s)\n", node) return self._nodes.addNode(node)
[ "def", "addNode", "(", "self", ",", "node", ")", ":", "logger", ".", "debug", "(", "\"PlanarGraph.addNode(%s)\\n\"", ",", "node", ")", "return", "self", ".", "_nodes", ".", "addNode", "(", "node", ")" ]
https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/geomgraph.py#L522-L529
d2l-ai/d2l-en
39a7d4174534740b2387b0dc5eb22f409b82ee10
d2l/mxnet.py
python
set_axes
(axes, xlabel, ylabel, xlim, ylim, xscale, yscale, legend)
Set the axes for matplotlib. Defined in :numref:`sec_calculus`
Set the axes for matplotlib.
[ "Set", "the", "axes", "for", "matplotlib", "." ]
def set_axes(axes, xlabel, ylabel, xlim, ylim, xscale, yscale, legend): """Set the axes for matplotlib. Defined in :numref:`sec_calculus`""" axes.set_xlabel(xlabel), axes.set_ylabel(ylabel) axes.set_xscale(xscale), axes.set_yscale(yscale) axes.set_xlim(xlim), axes.set_ylim(ylim) if legend: ...
[ "def", "set_axes", "(", "axes", ",", "xlabel", ",", "ylabel", ",", "xlim", ",", "ylim", ",", "xscale", ",", "yscale", ",", "legend", ")", ":", "axes", ".", "set_xlabel", "(", "xlabel", ")", ",", "axes", ".", "set_ylabel", "(", "ylabel", ")", "axes", ...
https://github.com/d2l-ai/d2l-en/blob/39a7d4174534740b2387b0dc5eb22f409b82ee10/d2l/mxnet.py#L74-L83
WebThingsIO/webthing-python
ddb74332eb6742f5d5332de8485060316ad2735e
webthing/property.py
python
Property.get_value
(self)
return self.value.get()
Get the current property value. Returns the value.
Get the current property value.
[ "Get", "the", "current", "property", "value", "." ]
def get_value(self): """ Get the current property value. Returns the value. """ return self.value.get()
[ "def", "get_value", "(", "self", ")", ":", "return", "self", ".", "value", ".", "get", "(", ")" ]
https://github.com/WebThingsIO/webthing-python/blob/ddb74332eb6742f5d5332de8485060316ad2735e/webthing/property.py#L83-L89
baidu/Youtube-8M
5ad9f3957ebedc2d1d572dea48c1fbcb55365249
two_stream_lstm/data_provider.py
python
initHook
(obj, *file_list, **kwargs)
Define the type and size of input feature and label
Define the type and size of input feature and label
[ "Define", "the", "type", "and", "size", "of", "input", "feature", "and", "label" ]
def initHook(obj, *file_list, **kwargs): """ Define the type and size of input feature and label """ obj.feat_size = 1024 obj.audio_size = 128 obj.label_size = 4716 obj.slots = [DenseSlot(obj.feat_size), DenseSlot(obj.audio_size), SparseNonValueSlot(obj.label_size)]
[ "def", "initHook", "(", "obj", ",", "*", "file_list", ",", "*", "*", "kwargs", ")", ":", "obj", ".", "feat_size", "=", "1024", "obj", ".", "audio_size", "=", "128", "obj", ".", "label_size", "=", "4716", "obj", ".", "slots", "=", "[", "DenseSlot", ...
https://github.com/baidu/Youtube-8M/blob/5ad9f3957ebedc2d1d572dea48c1fbcb55365249/two_stream_lstm/data_provider.py#L42-L52
OneDrive/onedrive-sdk-python
e5642f8cad8eea37a4f653c1a23dfcfc06c37110
src/python2/request/subscriptions_collection.py
python
SubscriptionsCollectionRequestBuilder.request
(self, expand=None, select=None, top=None, order_by=None, options=None)
return req
Builds the SubscriptionsCollectionRequest Args: expand (str): Default None, comma-seperated list of relationships to expand in the response. select (str): Default None, comma-seperated list of properties to include in the response. top...
Builds the SubscriptionsCollectionRequest Args: expand (str): Default None, comma-seperated list of relationships to expand in the response. select (str): Default None, comma-seperated list of properties to include in the response. top...
[ "Builds", "the", "SubscriptionsCollectionRequest", "Args", ":", "expand", "(", "str", ")", ":", "Default", "None", "comma", "-", "seperated", "list", "of", "relationships", "to", "expand", "in", "the", "response", ".", "select", "(", "str", ")", ":", "Defaul...
def request(self, expand=None, select=None, top=None, order_by=None, options=None): """Builds the SubscriptionsCollectionRequest Args: expand (str): Default None, comma-seperated list of relationships to expand in the response. select (str): Default None,...
[ "def", "request", "(", "self", ",", "expand", "=", "None", ",", "select", "=", "None", ",", "top", "=", "None", ",", "order_by", "=", "None", ",", "options", "=", "None", ")", ":", "req", "=", "SubscriptionsCollectionRequest", "(", "self", ".", "_reque...
https://github.com/OneDrive/onedrive-sdk-python/blob/e5642f8cad8eea37a4f653c1a23dfcfc06c37110/src/python2/request/subscriptions_collection.py#L76-L96
google/flax
89e1126cc43588c6946bc85506987dc812909575
flax/linen/stochastic.py
python
Dropout.__call__
(self, inputs, deterministic: Optional[bool] = None)
Applies a random dropout mask to the input. Args: inputs: the inputs that should be randomly masked. deterministic: if false the inputs are scaled by `1 / (1 - rate)` and masked, whereas if true, no mask is applied and the inputs are returned as is. Returns: The masked inputs...
Applies a random dropout mask to the input.
[ "Applies", "a", "random", "dropout", "mask", "to", "the", "input", "." ]
def __call__(self, inputs, deterministic: Optional[bool] = None): """Applies a random dropout mask to the input. Args: inputs: the inputs that should be randomly masked. deterministic: if false the inputs are scaled by `1 / (1 - rate)` and masked, whereas if true, no mask is applied and the...
[ "def", "__call__", "(", "self", ",", "inputs", ",", "deterministic", ":", "Optional", "[", "bool", "]", "=", "None", ")", ":", "deterministic", "=", "merge_param", "(", "'deterministic'", ",", "self", ".", "deterministic", ",", "deterministic", ")", "if", ...
https://github.com/google/flax/blob/89e1126cc43588c6946bc85506987dc812909575/flax/linen/stochastic.py#L42-L68
ANSSI-FR/polichombr
e2dc3874ae3d78c3b496e9656c9a6d1b88ae91e1
polichombr/controllers/family.py
python
FamilyController.create
(name, parentfamily=None)
return family
@arg name: family name @arg parentfamily: parent family @arg return None if incorrect arg, family object if created|exists
[]
def create(name, parentfamily=None): """ @arg name: family name @arg parentfamily: parent family @arg return None if incorrect arg, family object if created|exists """ if Family.query.filter_by(name=name).count() != 0: return Family.query.filter_by...
[ "def", "create", "(", "name", ",", "parentfamily", "=", "None", ")", ":", "if", "Family", ".", "query", ".", "filter_by", "(", "name", "=", "name", ")", ".", "count", "(", ")", "!=", "0", ":", "return", "Family", ".", "query", ".", "filter_by", "("...
https://github.com/ANSSI-FR/polichombr/blob/e2dc3874ae3d78c3b496e9656c9a6d1b88ae91e1/polichombr/controllers/family.py#L35-L49
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/chord/__init__.py
python
Chord.pitches
(self)
return pitches
Get or set a list or tuple of all Pitch objects in this Chord. >>> c = chord.Chord(['C4', 'E4', 'G#4']) >>> c.pitches (<music21.pitch.Pitch C4>, <music21.pitch.Pitch E4>, <music21.pitch.Pitch G#4>) >>> [p.midi for p in c.pitches] [60, 64, 68] >>> d = chord.Chord() ...
Get or set a list or tuple of all Pitch objects in this Chord.
[ "Get", "or", "set", "a", "list", "or", "tuple", "of", "all", "Pitch", "objects", "in", "this", "Chord", "." ]
def pitches(self) -> Tuple[pitch.Pitch]: ''' Get or set a list or tuple of all Pitch objects in this Chord. >>> c = chord.Chord(['C4', 'E4', 'G#4']) >>> c.pitches (<music21.pitch.Pitch C4>, <music21.pitch.Pitch E4>, <music21.pitch.Pitch G#4>) >>> [p.midi for p in c.pitc...
[ "def", "pitches", "(", "self", ")", "->", "Tuple", "[", "pitch", ".", "Pitch", "]", ":", "# noinspection PyTypeChecker", "pitches", ":", "Tuple", "[", "pitch", ".", "Pitch", "]", "=", "tuple", "(", "component", ".", "pitch", "for", "component", "in", "se...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/chord/__init__.py#L4996-L5036
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/packaging/specifiers.py
python
Specifier._compare_not_equal
(self, prospective, spec)
return not self._compare_equal(prospective, spec)
[]
def _compare_not_equal(self, prospective, spec): return not self._compare_equal(prospective, spec)
[ "def", "_compare_not_equal", "(", "self", ",", "prospective", ",", "spec", ")", ":", "return", "not", "self", ".", "_compare_equal", "(", "prospective", ",", "spec", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/packaging/specifiers.py#L449-L450
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/longformer/modeling_tf_longformer.py
python
TFLongformerSelfAttention._chunk
(hidden_states, window_overlap)
return chunked_hidden_states
convert into overlapping chunks. Chunk size = 2w, overlap size = w
convert into overlapping chunks. Chunk size = 2w, overlap size = w
[ "convert", "into", "overlapping", "chunks", ".", "Chunk", "size", "=", "2w", "overlap", "size", "=", "w" ]
def _chunk(hidden_states, window_overlap): """convert into overlapping chunks. Chunk size = 2w, overlap size = w""" batch_size, seq_length, hidden_dim = shape_list(hidden_states) num_output_chunks = 2 * (seq_length // (2 * window_overlap)) - 1 # define frame size and frame stride (simil...
[ "def", "_chunk", "(", "hidden_states", ",", "window_overlap", ")", ":", "batch_size", ",", "seq_length", ",", "hidden_dim", "=", "shape_list", "(", "hidden_states", ")", "num_output_chunks", "=", "2", "*", "(", "seq_length", "//", "(", "2", "*", "window_overla...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/longformer/modeling_tf_longformer.py#L1186-L1211
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/pyparsing.py
python
unicode_set.alphas
(cls)
return u''.join(filter(unicode.isalpha, cls._get_chars_for_ranges()))
all alphabetic characters in this range
all alphabetic characters in this range
[ "all", "alphabetic", "characters", "in", "this", "range" ]
def alphas(cls): "all alphabetic characters in this range" return u''.join(filter(unicode.isalpha, cls._get_chars_for_ranges()))
[ "def", "alphas", "(", "cls", ")", ":", "return", "u''", ".", "join", "(", "filter", "(", "unicode", ".", "isalpha", ",", "cls", ".", "_get_chars_for_ranges", "(", ")", ")", ")" ]
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/pyparsing.py#L6748-L6750
openstack/cinder
23494a6d6c51451688191e1847a458f1d3cdcaa5
cinder/quota.py
python
QuotaEngine.__init__
(self, quota_driver_class=None)
Initialize a Quota object.
Initialize a Quota object.
[ "Initialize", "a", "Quota", "object", "." ]
def __init__(self, quota_driver_class=None): """Initialize a Quota object.""" self._resources = {} self._quota_driver_class = quota_driver_class self._driver_class = None
[ "def", "__init__", "(", "self", ",", "quota_driver_class", "=", "None", ")", ":", "self", ".", "_resources", "=", "{", "}", "self", ".", "_quota_driver_class", "=", "quota_driver_class", "self", ".", "_driver_class", "=", "None" ]
https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/quota.py#L574-L579
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/nntplib.py
python
_NNTPBase.date
(self)
return resp, _parse_datetime(date, None)
Process the DATE command. Returns: - resp: server response if successful - date: datetime object
Process the DATE command. Returns: - resp: server response if successful - date: datetime object
[ "Process", "the", "DATE", "command", ".", "Returns", ":", "-", "resp", ":", "server", "response", "if", "successful", "-", "date", ":", "datetime", "object" ]
def date(self): """Process the DATE command. Returns: - resp: server response if successful - date: datetime object """ resp = self._shortcmd("DATE") if not resp.startswith('111'): raise NNTPReplyError(resp) elem = resp.split() if len(e...
[ "def", "date", "(", "self", ")", ":", "resp", "=", "self", ".", "_shortcmd", "(", "\"DATE\"", ")", "if", "not", "resp", ".", "startswith", "(", "'111'", ")", ":", "raise", "NNTPReplyError", "(", "resp", ")", "elem", "=", "resp", ".", "split", "(", ...
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/nntplib.py#L873-L888
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/cluster_algebra_quiver/cluster_seed.py
python
ClusterSeed.reorient
( self, data )
r""" Reorients ``self`` with respect to the given total order, or with respect to an iterator of ordered pairs. WARNING: - This operation might change the mutation type of ``self``. - Ignores ordered pairs `(i,j)` for which neither `(i,j)` nor `(j,i)` is an edge of ``self``. ...
r""" Reorients ``self`` with respect to the given total order, or with respect to an iterator of ordered pairs.
[ "r", "Reorients", "self", "with", "respect", "to", "the", "given", "total", "order", "or", "with", "respect", "to", "an", "iterator", "of", "ordered", "pairs", "." ]
def reorient( self, data ): r""" Reorients ``self`` with respect to the given total order, or with respect to an iterator of ordered pairs. WARNING: - This operation might change the mutation type of ``self``. - Ignores ordered pairs `(i,j)` for which neither `(i,j)` no...
[ "def", "reorient", "(", "self", ",", "data", ")", ":", "if", "not", "self", ".", "_quiver", ":", "self", ".", "quiver", "(", ")", "self", ".", "_quiver", ".", "reorient", "(", "data", ")", "self", ".", "_M", "=", "self", ".", "_quiver", ".", "_M"...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py#L3143-L3180
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/urllib3/response.py
python
HTTPResponse.read
(self, amt=None, decode_content=None, cache_content=False)
return data
Similar to :meth:`httplib.HTTPResponse.read`, but with two additional parameters: ``decode_content`` and ``cache_content``. :param amt: How much of the content to read. If specified, caching is skipped because it doesn't make sense to cache partial content as the full ...
Similar to :meth:`httplib.HTTPResponse.read`, but with two additional parameters: ``decode_content`` and ``cache_content``.
[ "Similar", "to", ":", "meth", ":", "httplib", ".", "HTTPResponse", ".", "read", "but", "with", "two", "additional", "parameters", ":", "decode_content", "and", "cache_content", "." ]
def read(self, amt=None, decode_content=None, cache_content=False): """ Similar to :meth:`httplib.HTTPResponse.read`, but with two additional parameters: ``decode_content`` and ``cache_content``. :param amt: How much of the content to read. If specified, caching is skipped ...
[ "def", "read", "(", "self", ",", "amt", "=", "None", ",", "decode_content", "=", "None", ",", "cache_content", "=", "False", ")", ":", "self", ".", "_init_decoder", "(", ")", "if", "decode_content", "is", "None", ":", "decode_content", "=", "self", ".", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/urllib3/response.py#L346-L413
ethereum/research
f64776763a8687cbe220421e292e6e45db3d9172
mining/python_sha3.py
python
_convertStrToTable
(string, w, b)
return output
Convert a string of hex-chars to its 5x5 matrix representation string: string of bytes of hex-coded bytes (e.g. '9A2C...')
Convert a string of hex-chars to its 5x5 matrix representation
[ "Convert", "a", "string", "of", "hex", "-", "chars", "to", "its", "5x5", "matrix", "representation" ]
def _convertStrToTable(string, w, b): """Convert a string of hex-chars to its 5x5 matrix representation string: string of bytes of hex-coded bytes (e.g. '9A2C...')""" # Check that the input paramaters are expected if w % 8 != 0: raise KeccakError("w is not a multiple of 8") # Each character in the stri...
[ "def", "_convertStrToTable", "(", "string", ",", "w", ",", "b", ")", ":", "# Check that the input paramaters are expected", "if", "w", "%", "8", "!=", "0", ":", "raise", "KeccakError", "(", "\"w is not a multiple of 8\"", ")", "# Each character in the string represents ...
https://github.com/ethereum/research/blob/f64776763a8687cbe220421e292e6e45db3d9172/mining/python_sha3.py#L363-L393
quantopian/quantopian-algos
ec0fac6b5cfc84497957f7cbf3968ec559239d25
pairtrade.py
python
place_orders
(context, data, zscore)
Buy spread if zscore is > 2, sell if zscore < .5.
Buy spread if zscore is > 2, sell if zscore < .5.
[ "Buy", "spread", "if", "zscore", "is", ">", "2", "sell", "if", "zscore", "<", ".", "5", "." ]
def place_orders(context, data, zscore): """Buy spread if zscore is > 2, sell if zscore < .5. """ if zscore >= 2.0 and not context.invested: log.info("buying over zscore") order(sid(5885), int(100000 / data[sid(5885)].price)) order(sid(4283), -int(100000 / data[sid(4283)].price)) ...
[ "def", "place_orders", "(", "context", ",", "data", ",", "zscore", ")", ":", "if", "zscore", ">=", "2.0", "and", "not", "context", ".", "invested", ":", "log", ".", "info", "(", "\"buying over zscore\"", ")", "order", "(", "sid", "(", "5885", ")", ",",...
https://github.com/quantopian/quantopian-algos/blob/ec0fac6b5cfc84497957f7cbf3968ec559239d25/pairtrade.py#L76-L92
RiotGames/cloud-inquisitor
29a26c705381fdba3538b4efedb25b9e09b387ed
backend/cloud_inquisitor/app.py
python
CINQFlask.__register_notifiers
(self)
return notifiers
Lists all notifiers to be able to provide metadata for the frontend Returns: `list` of `dict`
Lists all notifiers to be able to provide metadata for the frontend
[ "Lists", "all", "notifiers", "to", "be", "able", "to", "provide", "metadata", "for", "the", "frontend" ]
def __register_notifiers(self): """Lists all notifiers to be able to provide metadata for the frontend Returns: `list` of `dict` """ notifiers = {} for entry_point in CINQ_PLUGINS['cloud_inquisitor.plugins.notifiers']['plugins']: cls = entry_point.load() ...
[ "def", "__register_notifiers", "(", "self", ")", ":", "notifiers", "=", "{", "}", "for", "entry_point", "in", "CINQ_PLUGINS", "[", "'cloud_inquisitor.plugins.notifiers'", "]", "[", "'plugins'", "]", ":", "cls", "=", "entry_point", ".", "load", "(", ")", "notif...
https://github.com/RiotGames/cloud-inquisitor/blob/29a26c705381fdba3538b4efedb25b9e09b387ed/backend/cloud_inquisitor/app.py#L285-L296
qibinlou/SinaWeibo-Emotion-Classification
f336fc104abd68b0ec4180fe2ed80fafe49cb790
nltk/metrics/association.py
python
BigramAssocMeasures.phi_sq
(cls, *marginals)
return (float((n_ii*n_oo - n_io*n_oi)**2) / ((n_ii + n_io) * (n_ii + n_oi) * (n_io + n_oo) * (n_oi + n_oo)))
Scores bigrams using phi-square, the square of the Pearson correlation coefficient.
Scores bigrams using phi-square, the square of the Pearson correlation coefficient.
[ "Scores", "bigrams", "using", "phi", "-", "square", "the", "square", "of", "the", "Pearson", "correlation", "coefficient", "." ]
def phi_sq(cls, *marginals): """Scores bigrams using phi-square, the square of the Pearson correlation coefficient. """ n_ii, n_io, n_oi, n_oo = cls._contingency(*marginals) return (float((n_ii*n_oo - n_io*n_oi)**2) / ((n_ii + n_io) * (n_ii + n_oi) * (n_io + n_oo...
[ "def", "phi_sq", "(", "cls", ",", "*", "marginals", ")", ":", "n_ii", ",", "n_io", ",", "n_oi", ",", "n_oo", "=", "cls", ".", "_contingency", "(", "*", "marginals", ")", "return", "(", "float", "(", "(", "n_ii", "*", "n_oo", "-", "n_io", "*", "n_...
https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/nltk/metrics/association.py#L194-L201
Voulnet/barq
6f1a68c57a4b6a88c587f7baea8f8b2f076a52ac
barq.py
python
set_aws_creds_inline
(aws_access_key_id, aws_secret_access_key, region_name, aws_session_token)
Set AWS credentials to the target account from the command line arguments directly, no prompts. :param aws_access_key_id: access key id :param aws_secret_access_key: access secret key :param region_name: region name :param aws_session_token: token, if any :return: None
Set AWS credentials to the target account from the command line arguments directly, no prompts. :param aws_access_key_id: access key id :param aws_secret_access_key: access secret key :param region_name: region name :param aws_session_token: token, if any :return: None
[ "Set", "AWS", "credentials", "to", "the", "target", "account", "from", "the", "command", "line", "arguments", "directly", "no", "prompts", ".", ":", "param", "aws_access_key_id", ":", "access", "key", "id", ":", "param", "aws_secret_access_key", ":", "access", ...
def set_aws_creds_inline(aws_access_key_id, aws_secret_access_key, region_name, aws_session_token): """ Set AWS credentials to the target account from the command line arguments directly, no prompts. :param aws_access_key_id: access key id :param aws_secret_access_key: access secret key :param regio...
[ "def", "set_aws_creds_inline", "(", "aws_access_key_id", ",", "aws_secret_access_key", ",", "region_name", ",", "aws_session_token", ")", ":", "global", "my_aws_creds", "if", "aws_session_token", "==", "''", ":", "mysession", "=", "boto3", ".", "session", ".", "Sess...
https://github.com/Voulnet/barq/blob/6f1a68c57a4b6a88c587f7baea8f8b2f076a52ac/barq.py#L1895-L1937
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/decimal.py
python
Decimal.to_integral_exact
(self, rounding=None, context=None)
return ans
Rounds to a nearby integer. If no rounding mode is specified, take the rounding mode from the context. This method raises the Rounded and Inexact flags when appropriate. See also: to_integral_value, which does exactly the same as this method except that it doesn't raise Inexac...
Rounds to a nearby integer.
[ "Rounds", "to", "a", "nearby", "integer", "." ]
def to_integral_exact(self, rounding=None, context=None): """Rounds to a nearby integer. If no rounding mode is specified, take the rounding mode from the context. This method raises the Rounded and Inexact flags when appropriate. See also: to_integral_value, which does exactl...
[ "def", "to_integral_exact", "(", "self", ",", "rounding", "=", "None", ",", "context", "=", "None", ")", ":", "if", "self", ".", "_is_special", ":", "ans", "=", "self", ".", "_check_nans", "(", "context", "=", "context", ")", "if", "ans", ":", "return"...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/decimal.py#L2565-L2592
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/sklearn/utils/arpack.py
python
_aligned_zeros
(shape, dtype=float, order="C", align=None)
return data
Allocate a new ndarray with aligned memory. Primary use case for this currently is working around a f2py issue in Numpy 1.9.1, where dtype.alignment is such that np.zeros() does not necessarily create arrays aligned up to it.
Allocate a new ndarray with aligned memory. Primary use case for this currently is working around a f2py issue in Numpy 1.9.1, where dtype.alignment is such that np.zeros() does not necessarily create arrays aligned up to it.
[ "Allocate", "a", "new", "ndarray", "with", "aligned", "memory", ".", "Primary", "use", "case", "for", "this", "currently", "is", "working", "around", "a", "f2py", "issue", "in", "Numpy", "1", ".", "9", ".", "1", "where", "dtype", ".", "alignment", "is", ...
def _aligned_zeros(shape, dtype=float, order="C", align=None): """Allocate a new ndarray with aligned memory. Primary use case for this currently is working around a f2py issue in Numpy 1.9.1, where dtype.alignment is such that np.zeros() does not necessarily create arrays aligned up to it. """ ...
[ "def", "_aligned_zeros", "(", "shape", ",", "dtype", "=", "float", ",", "order", "=", "\"C\"", ",", "align", "=", "None", ")", ":", "dtype", "=", "np", ".", "dtype", "(", "dtype", ")", "if", "align", "is", "None", ":", "align", "=", "dtype", ".", ...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/sklearn/utils/arpack.py#L288-L309
Netflix/hubcommander
42086c705bb0cf470e6e863ffc6d43047b419823
bot_components/parse_functions.py
python
extract_multiple_repo_names
(plugin_obj, repos, **kwargs)
return parsed_repos
Does what the above does, but does it for a comma separated list of repos. :param plugin_obj: :param repos: :param kwargs: :return:
Does what the above does, but does it for a comma separated list of repos. :param plugin_obj: :param repos: :param kwargs: :return:
[ "Does", "what", "the", "above", "does", "but", "does", "it", "for", "a", "comma", "separated", "list", "of", "repos", ".", ":", "param", "plugin_obj", ":", ":", "param", "repos", ":", ":", "param", "kwargs", ":", ":", "return", ":" ]
def extract_multiple_repo_names(plugin_obj, repos, **kwargs): """ Does what the above does, but does it for a comma separated list of repos. :param plugin_obj: :param repos: :param kwargs: :return: """ repo_list = repos.split(",") parsed_repos = [] for repo in repo_list: ...
[ "def", "extract_multiple_repo_names", "(", "plugin_obj", ",", "repos", ",", "*", "*", "kwargs", ")", ":", "repo_list", "=", "repos", ".", "split", "(", "\",\"", ")", "parsed_repos", "=", "[", "]", "for", "repo", "in", "repo_list", ":", "parsed_repos", ".",...
https://github.com/Netflix/hubcommander/blob/42086c705bb0cf470e6e863ffc6d43047b419823/bot_components/parse_functions.py#L124-L139
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/dev/bdf_vectorized2/cards/elements/masses.py
python
CONM2v.add
(self, eid, nid, mass, cid=0, X=None, I=None, comment='')
Creates a CONM2 card Parameters ---------- eid : int element id nid : int node id mass : float the mass of the CONM2 cid : int; default=0 coordinate frame of the offset (-1=absolute coordinates) X : (3, ) List[float]; d...
Creates a CONM2 card
[ "Creates", "a", "CONM2", "card" ]
def add(self, eid, nid, mass, cid=0, X=None, I=None, comment=''): """ Creates a CONM2 card Parameters ---------- eid : int element id nid : int node id mass : float the mass of the CONM2 cid : int; default=0 coo...
[ "def", "add", "(", "self", ",", "eid", ",", "nid", ",", "mass", ",", "cid", "=", "0", ",", "X", "=", "None", ",", "I", "=", "None", ",", "comment", "=", "''", ")", ":", "self", ".", "model", ".", "rods", ".", "add", "(", "eid", ")", "self",...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized2/cards/elements/masses.py#L191-L222
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/asyncio/events.py
python
_get_running_loop
()
Return the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific.
Return the running event loop or None.
[ "Return", "the", "running", "event", "loop", "or", "None", "." ]
def _get_running_loop(): """Return the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. """ # NOTE: this function is implemented in C (see _asynciomodule.c) running_loop, pid = _running_loop.loop_pid if running_lo...
[ "def", "_get_running_loop", "(", ")", ":", "# NOTE: this function is implemented in C (see _asynciomodule.c)", "running_loop", ",", "pid", "=", "_running_loop", ".", "loop_pid", "if", "running_loop", "is", "not", "None", "and", "pid", "==", "os", ".", "getpid", "(", ...
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/asyncio/events.py#L706-L715
DataDog/datadogpy
c71bd8de53aaeffedc5b1d3dd133354d1fa533b7
datadog/api/metrics.py
python
Metric.send
(cls, metrics=None, attach_host_name=True, compress_payload=False, **single_metric)
return super(Metric, cls).send( attach_host_name=attach_host_name, compress_payload=compress_payload, **metrics_dict )
Submit a metric or a list of metrics to the metric API A metric dictionary should consist of 5 keys: metric, points, host, tags, type (some of which optional), see below: :param metric: the name of the time series :type metric: string :param compress_payload: compress the paylo...
Submit a metric or a list of metrics to the metric API A metric dictionary should consist of 5 keys: metric, points, host, tags, type (some of which optional), see below:
[ "Submit", "a", "metric", "or", "a", "list", "of", "metrics", "to", "the", "metric", "API", "A", "metric", "dictionary", "should", "consist", "of", "5", "keys", ":", "metric", "points", "host", "tags", "type", "(", "some", "of", "which", "optional", ")", ...
def send(cls, metrics=None, attach_host_name=True, compress_payload=False, **single_metric): """ Submit a metric or a list of metrics to the metric API A metric dictionary should consist of 5 keys: metric, points, host, tags, type (some of which optional), see below: :param metr...
[ "def", "send", "(", "cls", ",", "metrics", "=", "None", ",", "attach_host_name", "=", "True", ",", "compress_payload", "=", "False", ",", "*", "*", "single_metric", ")", ":", "# Set the right endpoint", "cls", ".", "_resource_name", "=", "cls", ".", "_METRIC...
https://github.com/DataDog/datadogpy/blob/c71bd8de53aaeffedc5b1d3dd133354d1fa533b7/datadog/api/metrics.py#L54-L111
AndreaCensi/contracts
bf6dac0a2867214d66f560257c773ba30d4a3136
src/contracts/main.py
python
parse_flexible_spec
(spec)
spec can be either a Contract, a type, or a contract string. In the latter case, the usual parsing takes place
spec can be either a Contract, a type, or a contract string. In the latter case, the usual parsing takes place
[ "spec", "can", "be", "either", "a", "Contract", "a", "type", "or", "a", "contract", "string", ".", "In", "the", "latter", "case", "the", "usual", "parsing", "takes", "place" ]
def parse_flexible_spec(spec): """ spec can be either a Contract, a type, or a contract string. In the latter case, the usual parsing takes place""" if isinstance(spec, Contract): return spec elif is_param_string(spec): return parse_contract_string(spec) elif can_be_used_as_a_typ...
[ "def", "parse_flexible_spec", "(", "spec", ")", ":", "if", "isinstance", "(", "spec", ",", "Contract", ")", ":", "return", "spec", "elif", "is_param_string", "(", "spec", ")", ":", "return", "parse_contract_string", "(", "spec", ")", "elif", "can_be_used_as_a_...
https://github.com/AndreaCensi/contracts/blob/bf6dac0a2867214d66f560257c773ba30d4a3136/src/contracts/main.py#L332-L344
Cadene/tensorflow-model-zoo.torch
990b10ffc22d4c8eacb2a502f20415b4f70c74c2
models/research/inception/inception/imagenet_data.py
python
ImagenetData.num_examples_per_epoch
(self)
Returns the number of examples in the data set.
Returns the number of examples in the data set.
[ "Returns", "the", "number", "of", "examples", "in", "the", "data", "set", "." ]
def num_examples_per_epoch(self): """Returns the number of examples in the data set.""" # Bounding box data consists of 615299 bounding boxes for 544546 images. if self.subset == 'train': return 1281167 if self.subset == 'validation': return 50000
[ "def", "num_examples_per_epoch", "(", "self", ")", ":", "# Bounding box data consists of 615299 bounding boxes for 544546 images.", "if", "self", ".", "subset", "==", "'train'", ":", "return", "1281167", "if", "self", ".", "subset", "==", "'validation'", ":", "return", ...
https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/inception/inception/imagenet_data.py#L36-L42
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_manage_node.py
python
Yedit.write
(self)
return (True, self.yaml_dict)
write to file
write to file
[ "write", "to", "file" ]
def write(self): ''' write to file ''' if not self.filename: raise YeditException('Please specify a filename.') if self.backup and self.file_exists(): shutil.copy(self.filename, self.filename + '.orig') # Try to set format attributes if supported try: ...
[ "def", "write", "(", "self", ")", ":", "if", "not", "self", ".", "filename", ":", "raise", "YeditException", "(", "'Please specify a filename.'", ")", "if", "self", ".", "backup", "and", "self", ".", "file_exists", "(", ")", ":", "shutil", ".", "copy", "...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_manage_node.py#L360-L386
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
nb_third_party/jinja2/environment.py
python
Template.is_up_to_date
(self)
return self._uptodate()
If this variable is `False` there is a newer version available.
If this variable is `False` there is a newer version available.
[ "If", "this", "variable", "is", "False", "there", "is", "a", "newer", "version", "available", "." ]
def is_up_to_date(self): """If this variable is `False` there is a newer version available.""" if self._uptodate is None: return True return self._uptodate()
[ "def", "is_up_to_date", "(", "self", ")", ":", "if", "self", ".", "_uptodate", "is", "None", ":", "return", "True", "return", "self", ".", "_uptodate", "(", ")" ]
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/nb_third_party/jinja2/environment.py#L941-L945
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/geometry/polygon.py
python
Triangle.circumcenter
(self)
return a.intersection(b)[0]
The circumcenter of the triangle The circumcenter is the center of the circumcircle. Returns ======= circumcenter : Point See Also ======== sympy.geometry.point.Point Examples ======== >>> from sympy.geometry import Point, Triangle ...
The circumcenter of the triangle
[ "The", "circumcenter", "of", "the", "triangle" ]
def circumcenter(self): """The circumcenter of the triangle The circumcenter is the center of the circumcircle. Returns ======= circumcenter : Point See Also ======== sympy.geometry.point.Point Examples ======== >>> from symp...
[ "def", "circumcenter", "(", "self", ")", ":", "a", ",", "b", ",", "c", "=", "[", "x", ".", "perpendicular_bisector", "(", ")", "for", "x", "in", "self", ".", "sides", "]", "if", "not", "a", ".", "intersection", "(", "b", ")", ":", "print", "(", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/geometry/polygon.py#L2355-L2382