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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/urllib/request.py | python | getproxies_environment | () | return proxies | Return a dictionary of scheme -> proxy server URL mappings.
Scan the environment for variables named <scheme>_proxy;
this seems to be the standard convention. If you need a
different way, you can pass a proxies dictionary to the
[Fancy]URLopener constructor. | Return a dictionary of scheme -> proxy server URL mappings. | [
"Return",
"a",
"dictionary",
"of",
"scheme",
"-",
">",
"proxy",
"server",
"URL",
"mappings",
"."
] | def getproxies_environment():
"""Return a dictionary of scheme -> proxy server URL mappings.
Scan the environment for variables named <scheme>_proxy;
this seems to be the standard convention. If you need a
different way, you can pass a proxies dictionary to the
[Fancy]URLopener constructor.
"... | [
"def",
"getproxies_environment",
"(",
")",
":",
"proxies",
"=",
"{",
"}",
"# in order to prefer lowercase variables, process environment in",
"# two passes: first matches any, second pass matches lowercase only",
"for",
"name",
",",
"value",
"in",
"os",
".",
"environ",
".",
"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/urllib/request.py#L2456-L2485 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/ssl.py | python | SSLSocket.read | (self, len=0, buffer=None) | Read up to LEN bytes and return them.
Return zero-length string on EOF. | Read up to LEN bytes and return them.
Return zero-length string on EOF. | [
"Read",
"up",
"to",
"LEN",
"bytes",
"and",
"return",
"them",
".",
"Return",
"zero",
"-",
"length",
"string",
"on",
"EOF",
"."
] | def read(self, len=0, buffer=None):
"""Read up to LEN bytes and return them.
Return zero-length string on EOF."""
self._checkClosed()
if not self._sslobj:
raise ValueError("Read on closed or unwrapped SSL socket.")
try:
if buffer is not None:
... | [
"def",
"read",
"(",
"self",
",",
"len",
"=",
"0",
",",
"buffer",
"=",
"None",
")",
":",
"self",
".",
"_checkClosed",
"(",
")",
"if",
"not",
"self",
".",
"_sslobj",
":",
"raise",
"ValueError",
"(",
"\"Read on closed or unwrapped SSL socket.\"",
")",
"try",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/ssl.py#L597-L617 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/logging/config.py | python | _install_handlers | (cp, formatters) | return handlers | Install and return handlers | Install and return handlers | [
"Install",
"and",
"return",
"handlers"
] | def _install_handlers(cp, formatters):
"""Install and return handlers"""
hlist = cp["handlers"]["keys"]
if not len(hlist):
return {}
hlist = hlist.split(",")
hlist = _strip_spaces(hlist)
handlers = {}
fixups = [] #for inter-handler references
for hand in hlist:
section = ... | [
"def",
"_install_handlers",
"(",
"cp",
",",
"formatters",
")",
":",
"hlist",
"=",
"cp",
"[",
"\"handlers\"",
"]",
"[",
"\"keys\"",
"]",
"if",
"not",
"len",
"(",
"hlist",
")",
":",
"return",
"{",
"}",
"hlist",
"=",
"hlist",
".",
"split",
"(",
"\",\"",... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/logging/config.py#L124-L159 | |
Liusifei/UVC | 36bc6b2c99366a6d1a6033229d395f3c88ff656b | libs/train_utils.py | python | save_vis | (pred2, gt2, frame1, frame2, savedir, new_c=None) | INPUTS:
- pred: predicted patch, a 3xpatch_sizexpatch_size tensor
- gt2: GT patch, a 3xhxw tensor
- gt1: first GT frame, a 3xhxw tensor
- gt_grey: whether to use ground trught L channel in predicted image | INPUTS:
- pred: predicted patch, a 3xpatch_sizexpatch_size tensor
- gt2: GT patch, a 3xhxw tensor
- gt1: first GT frame, a 3xhxw tensor
- gt_grey: whether to use ground trught L channel in predicted image | [
"INPUTS",
":",
"-",
"pred",
":",
"predicted",
"patch",
"a",
"3xpatch_sizexpatch_size",
"tensor",
"-",
"gt2",
":",
"GT",
"patch",
"a",
"3xhxw",
"tensor",
"-",
"gt1",
":",
"first",
"GT",
"frame",
"a",
"3xhxw",
"tensor",
"-",
"gt_grey",
":",
"whether",
"to"... | def save_vis(pred2, gt2, frame1, frame2, savedir, new_c=None):
"""
INPUTS:
- pred: predicted patch, a 3xpatch_sizexpatch_size tensor
- gt2: GT patch, a 3xhxw tensor
- gt1: first GT frame, a 3xhxw tensor
- gt_grey: whether to use ground trught L channel in predicted image
"""
b = pred2.size(0)
pred2 = pred2... | [
"def",
"save_vis",
"(",
"pred2",
",",
"gt2",
",",
"frame1",
",",
"frame2",
",",
"savedir",
",",
"new_c",
"=",
"None",
")",
":",
"b",
"=",
"pred2",
".",
"size",
"(",
"0",
")",
"pred2",
"=",
"pred2",
"*",
"128",
"+",
"128",
"gt2",
"=",
"gt2",
"*"... | https://github.com/Liusifei/UVC/blob/36bc6b2c99366a6d1a6033229d395f3c88ff656b/libs/train_utils.py#L28-L66 | ||
CLUEbenchmark/CLUEPretrainedModels | b384fd41665a8261f9c689c940cf750b3bc21fce | baselines/models_pytorch/classifier_pytorch/transformers/modeling_xlnet.py | python | load_tf_weights_in_xlnet | (model, config, tf_path) | return model | Load tf checkpoints in a pytorch model | Load tf checkpoints in a pytorch model | [
"Load",
"tf",
"checkpoints",
"in",
"a",
"pytorch",
"model"
] | def load_tf_weights_in_xlnet(model, config, tf_path):
""" Load tf checkpoints in a pytorch model
"""
try:
import numpy as np
import tensorflow as tf
except ImportError:
logger.error("Loading a TensorFlow models in PyTorch, requires TensorFlow to be installed. Please see "
... | [
"def",
"load_tf_weights_in_xlnet",
"(",
"model",
",",
"config",
",",
"tf_path",
")",
":",
"try",
":",
"import",
"numpy",
"as",
"np",
"import",
"tensorflow",
"as",
"tf",
"except",
"ImportError",
":",
"logger",
".",
"error",
"(",
"\"Loading a TensorFlow models in ... | https://github.com/CLUEbenchmark/CLUEPretrainedModels/blob/b384fd41665a8261f9c689c940cf750b3bc21fce/baselines/models_pytorch/classifier_pytorch/transformers/modeling_xlnet.py#L115-L172 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/eafm/sensor.py | python | Measurement.__init__ | (self, coordinator, key) | Initialise the gauge with a data instance and station. | Initialise the gauge with a data instance and station. | [
"Initialise",
"the",
"gauge",
"with",
"a",
"data",
"instance",
"and",
"station",
"."
] | def __init__(self, coordinator, key):
"""Initialise the gauge with a data instance and station."""
super().__init__(coordinator)
self.key = key | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"key",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"key",
"=",
"key"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/eafm/sensor.py#L95-L98 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/progress/__init__.py | python | Progress.start | (self) | [] | def start(self):
self.update() | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"update",
"(",
")"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/progress/__init__.py#L107-L108 | ||||
tribe29/checkmk | 6260f2512e159e311f426e16b84b19d0b8e9ad0c | cmk/gui/plugins/openapi/endpoints/bi.py | python | get_bi_packs | (params) | return constructors.serve_json(collection_object) | Show all BI packs | Show all BI packs | [
"Show",
"all",
"BI",
"packs"
] | def get_bi_packs(params):
"""Show all BI packs"""
bi_packs = get_cached_bi_packs()
bi_packs.load_config()
packs = [
constructors.collection_item(
domain_type="bi_pack",
obj={
"id": pack.id,
"title": pack.title,
},
)
... | [
"def",
"get_bi_packs",
"(",
"params",
")",
":",
"bi_packs",
"=",
"get_cached_bi_packs",
"(",
")",
"bi_packs",
".",
"load_config",
"(",
")",
"packs",
"=",
"[",
"constructors",
".",
"collection_item",
"(",
"domain_type",
"=",
"\"bi_pack\"",
",",
"obj",
"=",
"{... | https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/gui/plugins/openapi/endpoints/bi.py#L305-L326 | |
gtimelog/gtimelog | 50aeccbd3aa8ac2dde4419b033b2467444186213 | src/gtimelog/main.py | python | LogView._scroll_to_end | (self) | [] | def _scroll_to_end(self):
buffer = self.get_buffer()
self.scroll_to_iter(buffer.get_end_iter(), 0, False, 0, 0) | [
"def",
"_scroll_to_end",
"(",
"self",
")",
":",
"buffer",
"=",
"self",
".",
"get_buffer",
"(",
")",
"self",
".",
"scroll_to_iter",
"(",
"buffer",
".",
"get_end_iter",
"(",
")",
",",
"0",
",",
"False",
",",
"0",
",",
"0",
")"
] | https://github.com/gtimelog/gtimelog/blob/50aeccbd3aa8ac2dde4419b033b2467444186213/src/gtimelog/main.py#L1494-L1496 | ||||
openstack/openstacksdk | 58384268487fa854f21c470b101641ab382c9897 | openstack/identity/v3/_proxy.py | python | Proxy.create_registered_limit | (self, **attrs) | return self._create(_registered_limit.RegisteredLimit, **attrs) | Create a new registered_limit from attributes
:param dict attrs: Keyword arguments which will be used to create
a :class:`~openstack.identity.v3.registered_limit.RegisteredLimit`,
comprised of the properties on the RegisteredLimit class.
:returns: The results of registered_limi... | Create a new registered_limit from attributes | [
"Create",
"a",
"new",
"registered_limit",
"from",
"attributes"
] | def create_registered_limit(self, **attrs):
"""Create a new registered_limit from attributes
:param dict attrs: Keyword arguments which will be used to create
a :class:`~openstack.identity.v3.registered_limit.RegisteredLimit`,
comprised of the properties on the RegisteredLimit c... | [
"def",
"create_registered_limit",
"(",
"self",
",",
"*",
"*",
"attrs",
")",
":",
"return",
"self",
".",
"_create",
"(",
"_registered_limit",
".",
"RegisteredLimit",
",",
"*",
"*",
"attrs",
")"
] | https://github.com/openstack/openstacksdk/blob/58384268487fa854f21c470b101641ab382c9897/openstack/identity/v3/_proxy.py#L1007-L1018 | |
Trust-Code/odoo-brasil | ba18dfe1931e03935ce00338c3295527668e1953 | l10n_br_nfe_import/models/eletronic_document.py | python | EletronicDocument.get_partner_nfe | (self, nfe, destinatary, partner_automation) | return dict(partner_id=partner_id.id) | Importação da sessão <emit> do xml | Importação da sessão <emit> do xml | [
"Importação",
"da",
"sessão",
"<emit",
">",
"do",
"xml"
] | def get_partner_nfe(self, nfe, destinatary, partner_automation):
'''Importação da sessão <emit> do xml'''
tag_nfe = None
if destinatary:
tag_nfe = nfe.NFe.infNFe.emit
else:
tag_nfe = nfe.NFe.infNFe.dest
if hasattr(tag_nfe, 'CNPJ'):
cnpj_cpf = ... | [
"def",
"get_partner_nfe",
"(",
"self",
",",
"nfe",
",",
"destinatary",
",",
"partner_automation",
")",
":",
"tag_nfe",
"=",
"None",
"if",
"destinatary",
":",
"tag_nfe",
"=",
"nfe",
".",
"NFe",
".",
"infNFe",
".",
"emit",
"else",
":",
"tag_nfe",
"=",
"nfe... | https://github.com/Trust-Code/odoo-brasil/blob/ba18dfe1931e03935ce00338c3295527668e1953/l10n_br_nfe_import/models/eletronic_document.py#L115-L137 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/future/backports/misc.py | python | recursive_repr | (fillvalue='...') | return decorating_function | Decorator to make a repr function return fillvalue for a recursive call | Decorator to make a repr function return fillvalue for a recursive call | [
"Decorator",
"to",
"make",
"a",
"repr",
"function",
"return",
"fillvalue",
"for",
"a",
"recursive",
"call"
] | def recursive_repr(fillvalue='...'):
'Decorator to make a repr function return fillvalue for a recursive call'
def decorating_function(user_function):
repr_running = set()
def wrapper(self):
key = id(self), get_ident()
if key in repr_running:
return fill... | [
"def",
"recursive_repr",
"(",
"fillvalue",
"=",
"'...'",
")",
":",
"def",
"decorating_function",
"(",
"user_function",
")",
":",
"repr_running",
"=",
"set",
"(",
")",
"def",
"wrapper",
"(",
"self",
")",
":",
"key",
"=",
"id",
"(",
"self",
")",
",",
"ge... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/future/backports/misc.py#L61-L85 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/xlwt/Worksheet.py | python | Worksheet.get_paper_size_code | (self) | return self.__paper_size_code | [] | def get_paper_size_code(self):
return self.__paper_size_code | [
"def",
"get_paper_size_code",
"(",
"self",
")",
":",
"return",
"self",
".",
"__paper_size_code"
] | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/xlwt/Worksheet.py#L813-L814 | |||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | __builtin__.py | python | hasattr | (object, name) | return False | Return whether the object has an attribute with the given name.
:type name: string
:rtype: bool | Return whether the object has an attribute with the given name. | [
"Return",
"whether",
"the",
"object",
"has",
"an",
"attribute",
"with",
"the",
"given",
"name",
"."
] | def hasattr(object, name):
"""Return whether the object has an attribute with the given name.
:type name: string
:rtype: bool
"""
return False | [
"def",
"hasattr",
"(",
"object",
",",
"name",
")",
":",
"return",
"False"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/__builtin__.py#L120-L126 | |
python-telegram-bot/python-telegram-bot | ade1529986f5b6d394a65372d6a27045a70725b2 | telegram/message.py | python | Message.reply_game | (
self,
game_short_name: str,
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: 'InlineKeyboardMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_repl... | return self.bot.send_game(
chat_id=self.chat_id,
game_short_name=game_short_name,
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
timeout=timeout,
api_kwargs=api_kwargs,
... | Shortcut for::
bot.send_game(update.effective_message.chat_id, *args, **kwargs)
For the documentation of the arguments, please see :meth:`telegram.Bot.send_game`.
Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the game is sent as an actual
reply to... | Shortcut for:: | [
"Shortcut",
"for",
"::"
] | def reply_game(
self,
game_short_name: str,
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: 'InlineKeyboardMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sendin... | [
"def",
"reply_game",
"(",
"self",
",",
"game_short_name",
":",
"str",
",",
"disable_notification",
":",
"DVInput",
"[",
"bool",
"]",
"=",
"DEFAULT_NONE",
",",
"reply_to_message_id",
":",
"int",
"=",
"None",
",",
"reply_markup",
":",
"'InlineKeyboardMarkup'",
"="... | https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/message.py#L1713-L1754 | |
pytorch/opacus | 5c83d59fc169e93667946204f7a6859827a38ace | opacus/scripts/compute_dp_sgd_privacy.py | python | _apply_dp_sgd_analysis | (
*,
sample_rate: float,
noise_multiplier: float,
steps: int,
alphas: List[float],
delta: float,
verbose: bool = True,
) | return eps, opt_alpha | Computes the privacy Epsilon at a given delta via RDP accounting and
converting to an (epsilon, delta) guarantee for a target Delta.
Args:
sample_rate : The sample rate in SGD
noise_multiplier : The ratio of the standard deviation of the Gaussian
noise to the L2-sensitivity of the f... | Computes the privacy Epsilon at a given delta via RDP accounting and
converting to an (epsilon, delta) guarantee for a target Delta. | [
"Computes",
"the",
"privacy",
"Epsilon",
"at",
"a",
"given",
"delta",
"via",
"RDP",
"accounting",
"and",
"converting",
"to",
"an",
"(",
"epsilon",
"delta",
")",
"guarantee",
"for",
"a",
"target",
"Delta",
"."
] | def _apply_dp_sgd_analysis(
*,
sample_rate: float,
noise_multiplier: float,
steps: int,
alphas: List[float],
delta: float,
verbose: bool = True,
) -> Tuple[float, float]:
"""
Computes the privacy Epsilon at a given delta via RDP accounting and
converting to an (epsilon, delta) gu... | [
"def",
"_apply_dp_sgd_analysis",
"(",
"*",
",",
"sample_rate",
":",
"float",
",",
"noise_multiplier",
":",
"float",
",",
"steps",
":",
"int",
",",
"alphas",
":",
"List",
"[",
"float",
"]",
",",
"delta",
":",
"float",
",",
"verbose",
":",
"bool",
"=",
"... | https://github.com/pytorch/opacus/blob/5c83d59fc169e93667946204f7a6859827a38ace/opacus/scripts/compute_dp_sgd_privacy.py#L37-L80 | |
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | core/src/autogluon/core/metrics/__init__.py | python | _ThresholdScorer.needs_quantile | (self) | return False | [] | def needs_quantile(self):
return False | [
"def",
"needs_quantile",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/core/src/autogluon/core/metrics/__init__.py#L246-L247 | |||
GoogleCloudPlatform/gsutil | 5be882803e76608e2fd29cf8c504ccd1fe0a7746 | gslib/commands/versioning.py | python | VersioningCommand._SetVersioning | (self) | Gets versioning configuration for a bucket. | Gets versioning configuration for a bucket. | [
"Gets",
"versioning",
"configuration",
"for",
"a",
"bucket",
"."
] | def _SetVersioning(self):
"""Gets versioning configuration for a bucket."""
versioning_arg = self.args[0].lower()
if versioning_arg not in ('on', 'off'):
raise CommandException('Argument to "%s set" must be either <on|off>' %
(self.command_name))
url_args = self.args[1... | [
"def",
"_SetVersioning",
"(",
"self",
")",
":",
"versioning_arg",
"=",
"self",
".",
"args",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"if",
"versioning_arg",
"not",
"in",
"(",
"'on'",
",",
"'off'",
")",
":",
"raise",
"CommandException",
"(",
"'Argument to \... | https://github.com/GoogleCloudPlatform/gsutil/blob/5be882803e76608e2fd29cf8c504ccd1fe0a7746/gslib/commands/versioning.py#L120-L151 | ||
scrtlabs/catalyst | 2e8029780f2381da7a0729f7b52505e5db5f535b | catalyst/utils/range.py | python | merge | (a, b) | return range(min(a.start, b.start), max(a.stop, b.stop)) | Merge two ranges with step == 1.
Parameters
----------
a : range
The first range.
b : range
The second range. | Merge two ranges with step == 1. | [
"Merge",
"two",
"ranges",
"with",
"step",
"==",
"1",
"."
] | def merge(a, b):
"""Merge two ranges with step == 1.
Parameters
----------
a : range
The first range.
b : range
The second range.
"""
_check_steps(a, b)
return range(min(a.start, b.start), max(a.stop, b.stop)) | [
"def",
"merge",
"(",
"a",
",",
"b",
")",
":",
"_check_steps",
"(",
"a",
",",
"b",
")",
"return",
"range",
"(",
"min",
"(",
"a",
".",
"start",
",",
"b",
".",
"start",
")",
",",
"max",
"(",
"a",
".",
"stop",
",",
"b",
".",
"stop",
")",
")"
] | https://github.com/scrtlabs/catalyst/blob/2e8029780f2381da7a0729f7b52505e5db5f535b/catalyst/utils/range.py#L259-L270 | |
postgres/pgadmin4 | 374c5e952fa594d749fadf1f88076c1cba8c5f64 | web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py | python | SynonymView._fetch_properties | (self, scid, syid) | This function is used to fetch the properties of the specified object
:param scid:
:param syid:
:return: | This function is used to fetch the properties of the specified object
:param scid:
:param syid:
:return: | [
"This",
"function",
"is",
"used",
"to",
"fetch",
"the",
"properties",
"of",
"the",
"specified",
"object",
":",
"param",
"scid",
":",
":",
"param",
"syid",
":",
":",
"return",
":"
] | def _fetch_properties(self, scid, syid):
"""
This function is used to fetch the properties of the specified object
:param scid:
:param syid:
:return:
"""
try:
SQL = render_template("/".join([self.template_path,
... | [
"def",
"_fetch_properties",
"(",
"self",
",",
"scid",
",",
"syid",
")",
":",
"try",
":",
"SQL",
"=",
"render_template",
"(",
"\"/\"",
".",
"join",
"(",
"[",
"self",
".",
"template_path",
",",
"self",
".",
"_PROPERTIES_SQL",
"]",
")",
",",
"scid",
"=",
... | https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py#L412-L435 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/cisco-ise/Integrations/cisco-ise/cisco-ise.py | python | create_policy | () | Create ANC Policy | Create ANC Policy | [
"Create",
"ANC",
"Policy"
] | def create_policy():
"""
Create ANC Policy
"""
policy_name = demisto.args().get('policy_name')
policy_actions = demisto.args().get('policy_actions', '')
data = {
'ErsAncPolicy': {
'name': policy_name,
'actions': [policy_actions]
}
}
create_policy_... | [
"def",
"create_policy",
"(",
")",
":",
"policy_name",
"=",
"demisto",
".",
"args",
"(",
")",
".",
"get",
"(",
"'policy_name'",
")",
"policy_actions",
"=",
"demisto",
".",
"args",
"(",
")",
".",
"get",
"(",
"'policy_actions'",
",",
"''",
")",
"data",
"=... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/cisco-ise/Integrations/cisco-ise/cisco-ise.py#L567-L590 | ||
haiwen/seahub | e92fcd44e3e46260597d8faa9347cb8222b8b10d | seahub/options/models.py | python | UserOptionsManager.is_force_2fa | (self, username) | return True if len(r) > 0 else False | [] | def is_force_2fa(self, username):
r = super(UserOptionsManager, self).filter(email=username,
option_key=KEY_FORCE_2FA)
return True if len(r) > 0 else False | [
"def",
"is_force_2fa",
"(",
"self",
",",
"username",
")",
":",
"r",
"=",
"super",
"(",
"UserOptionsManager",
",",
"self",
")",
".",
"filter",
"(",
"email",
"=",
"username",
",",
"option_key",
"=",
"KEY_FORCE_2FA",
")",
"return",
"True",
"if",
"len",
"(",... | https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/options/models.py#L231-L234 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/classify.py | python | Expander.add_text | (self, string) | [] | def add_text(self, string):
# Unfortunately since field.index() yields bytes texts, and we want
# unicode, we end up encoding and decoding unnecessarily.
#
# TODO: Find a way around this
field = self.ixreader.schema[self.fieldname]
from_bytes = field.from_bytes
s... | [
"def",
"add_text",
"(",
"self",
",",
"string",
")",
":",
"# Unfortunately since field.index() yields bytes texts, and we want",
"# unicode, we end up encoding and decoding unnecessarily.",
"#",
"# TODO: Find a way around this",
"field",
"=",
"self",
".",
"ixreader",
".",
"schema"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/classify.py#L151-L160 | ||||
numenta/numenta-apps | 02903b0062c89c2c259b533eea2df6e8bb44eaf3 | htmengine/htmengine/adapters/datasource/datasource_adapter_iface.py | python | DatasourceAdapterIface.registerDatasourceAdapter | (cls, clientCls) | return clientCls | Decorator for registering derived Datasource Adapter classes with the
factory.
NOTE: The derived Datasource Adapter classes must have a class-level
variable named _DATASOURCE that is initialized with the adapter's unique
datasource name (e.g., "cloudwatch", "autostack", "custom") | Decorator for registering derived Datasource Adapter classes with the
factory. | [
"Decorator",
"for",
"registering",
"derived",
"Datasource",
"Adapter",
"classes",
"with",
"the",
"factory",
"."
] | def registerDatasourceAdapter(cls, clientCls):
""" Decorator for registering derived Datasource Adapter classes with the
factory.
NOTE: The derived Datasource Adapter classes must have a class-level
variable named _DATASOURCE that is initialized with the adapter's unique
datasource name (e.g., ... | [
"def",
"registerDatasourceAdapter",
"(",
"cls",
",",
"clientCls",
")",
":",
"key",
"=",
"clientCls",
".",
"_DATASOURCE",
"#pylint: disable=W0212",
"assert",
"key",
"not",
"in",
"cls",
".",
"_adapterRegistry",
",",
"(",
"clientCls",
",",
"key",
",",
"cls",
".",... | https://github.com/numenta/numenta-apps/blob/02903b0062c89c2c259b533eea2df6e8bb44eaf3/htmengine/htmengine/adapters/datasource/datasource_adapter_iface.py#L175-L189 | |
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/templates/historic/DRKCM/dvr.py | python | dvr_DocEntityRepresent.__init__ | (self,
case_label=None,
case_group_label=None,
activity_label=None,
use_sector=True,
use_need=False,
show_link=False,
) | Constructor
@param case_label: label for cases (default: "Case")
@param case_group_label: label for case groups (default: "Case Group")
@param activity_label: label for case activities
(default: "Activity")
@param use_need: use need if ... | Constructor | [
"Constructor"
] | def __init__(self,
case_label=None,
case_group_label=None,
activity_label=None,
use_sector=True,
use_need=False,
show_link=False,
):
"""
Constructor
@param case_label: ... | [
"def",
"__init__",
"(",
"self",
",",
"case_label",
"=",
"None",
",",
"case_group_label",
"=",
"None",
",",
"activity_label",
"=",
"None",
",",
"use_sector",
"=",
"True",
",",
"use_need",
"=",
"False",
",",
"show_link",
"=",
"False",
",",
")",
":",
"super... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/historic/DRKCM/dvr.py#L6755-L6798 | ||
coto/gae-boilerplate | 470f2b61fcb0238c1ad02cc1f97e6017acbe9628 | bp_includes/external/requests/packages/urllib3/util.py | python | Url.hostname | (self) | return self.host | For backwards-compatibility with urlparse. We're nice like that. | For backwards-compatibility with urlparse. We're nice like that. | [
"For",
"backwards",
"-",
"compatibility",
"with",
"urlparse",
".",
"We",
"re",
"nice",
"like",
"that",
"."
] | def hostname(self):
"""For backwards-compatibility with urlparse. We're nice like that."""
return self.host | [
"def",
"hostname",
"(",
"self",
")",
":",
"return",
"self",
".",
"host"
] | https://github.com/coto/gae-boilerplate/blob/470f2b61fcb0238c1ad02cc1f97e6017acbe9628/bp_includes/external/requests/packages/urllib3/util.py#L280-L282 | |
mkorman90/VolatilityBot | b31ef29e42fa820d2e1afc99e9e7c318174bb591 | lib/common/utils.py | python | calc_imphash | (filename) | return 'failed' | try:
pe = pefile.PE(filename)
return pe.get_imphash()
except PEFormatError:
return 'failed' | try:
pe = pefile.PE(filename)
return pe.get_imphash()
except PEFormatError:
return 'failed' | [
"try",
":",
"pe",
"=",
"pefile",
".",
"PE",
"(",
"filename",
")",
"return",
"pe",
".",
"get_imphash",
"()",
"except",
"PEFormatError",
":",
"return",
"failed"
] | def calc_imphash(filename):
# There is a bug in pefile implenation of imphash in Py3.5. To be fixed
"""
try:
pe = pefile.PE(filename)
return pe.get_imphash()
except PEFormatError:
return 'failed'
"""
return 'failed' | [
"def",
"calc_imphash",
"(",
"filename",
")",
":",
"# There is a bug in pefile implenation of imphash in Py3.5. To be fixed",
"return",
"'failed'"
] | https://github.com/mkorman90/VolatilityBot/blob/b31ef29e42fa820d2e1afc99e9e7c318174bb591/lib/common/utils.py#L194-L203 | |
alanhamlett/pip-update-requirements | ce875601ef278c8ce00ad586434a978731525561 | pur/packages/pip/_vendor/html5lib/treebuilders/base.py | python | TreeBuilder.getFragment | (self) | return fragment | Return the final fragment | Return the final fragment | [
"Return",
"the",
"final",
"fragment"
] | def getFragment(self):
"""Return the final fragment"""
# assert self.innerHTML
fragment = self.fragmentClass()
self.openElements[0].reparentChildren(fragment)
return fragment | [
"def",
"getFragment",
"(",
"self",
")",
":",
"# assert self.innerHTML",
"fragment",
"=",
"self",
".",
"fragmentClass",
"(",
")",
"self",
".",
"openElements",
"[",
"0",
"]",
".",
"reparentChildren",
"(",
"fragment",
")",
"return",
"fragment"
] | https://github.com/alanhamlett/pip-update-requirements/blob/ce875601ef278c8ce00ad586434a978731525561/pur/packages/pip/_vendor/html5lib/treebuilders/base.py#L404-L409 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/core/utils.py | python | ThreadLocalStack.__init__ | (self) | [] | def __init__(self):
# This class must not be used directly.
assert type(self) is not ThreadLocalStack
tls = self._tls
attr = f"stack_{self.stack_name}"
try:
tls_stack = getattr(tls, attr)
except AttributeError:
tls_stack = list()
setatt... | [
"def",
"__init__",
"(",
"self",
")",
":",
"# This class must not be used directly.",
"assert",
"type",
"(",
"self",
")",
"is",
"not",
"ThreadLocalStack",
"tls",
"=",
"self",
".",
"_tls",
"attr",
"=",
"f\"stack_{self.stack_name}\"",
"try",
":",
"tls_stack",
"=",
... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/utils.py#L215-L226 | ||||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/memberships/models.py | python | MembershipDefault.set_join_dt | (self) | Looks through old memberships to discover join dt | Looks through old memberships to discover join dt | [
"Looks",
"through",
"old",
"memberships",
"to",
"discover",
"join",
"dt"
] | def set_join_dt(self):
"""
Looks through old memberships to discover join dt
"""
# cannot set renew dt if approved dt
# does not exist (DNE)
if not self.application_approved_dt:
return None
# memberships with join date
memberships = self.qs_m... | [
"def",
"set_join_dt",
"(",
"self",
")",
":",
"# cannot set renew dt if approved dt",
"# does not exist (DNE)",
"if",
"not",
"self",
".",
"application_approved_dt",
":",
"return",
"None",
"# memberships with join date",
"memberships",
"=",
"self",
".",
"qs_memberships",
"(... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/memberships/models.py#L1701-L1723 | ||
selinon/selinon | 3613153566d454022a138639f0375c63f490c4cb | selinon/config.py | python | Config.should_propagate_node_args | (cls, node_name, dst_node_name) | return cls._should_config(node_name, dst_node_name, cls.propagate_node_args) | Check whether node arguments should be propagated.
:param node_name: node name that should be checked for propagate_node_args
:param dst_node_name: destination node to which configuration should be propagated
:return: True if should propagate_node_args | Check whether node arguments should be propagated. | [
"Check",
"whether",
"node",
"arguments",
"should",
"be",
"propagated",
"."
] | def should_propagate_node_args(cls, node_name, dst_node_name):
"""Check whether node arguments should be propagated.
:param node_name: node name that should be checked for propagate_node_args
:param dst_node_name: destination node to which configuration should be propagated
:return: Tru... | [
"def",
"should_propagate_node_args",
"(",
"cls",
",",
"node_name",
",",
"dst_node_name",
")",
":",
"return",
"cls",
".",
"_should_config",
"(",
"node_name",
",",
"dst_node_name",
",",
"cls",
".",
"propagate_node_args",
")"
] | https://github.com/selinon/selinon/blob/3613153566d454022a138639f0375c63f490c4cb/selinon/config.py#L261-L268 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/distutils/unixccompiler.py | python | UnixCCompiler.runtime_library_dir_option | (self, dir) | [] | def runtime_library_dir_option(self, dir):
# XXX Hackish, at the very least. See Python bug #445902:
# http://sourceforge.net/tracker/index.php
# ?func=detail&aid=445902&group_id=5470&atid=105470
# Linkers on different platforms need different options to
# specify that directo... | [
"def",
"runtime_library_dir_option",
"(",
"self",
",",
"dir",
")",
":",
"# XXX Hackish, at the very least. See Python bug #445902:",
"# http://sourceforge.net/tracker/index.php",
"# ?func=detail&aid=445902&group_id=5470&atid=105470",
"# Linkers on different platforms need different options ... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/distutils/unixccompiler.py#L221-L261 | ||||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/file_utils.py | python | is_tf_available | () | return _tf_available | [] | def is_tf_available():
return _tf_available | [
"def",
"is_tf_available",
"(",
")",
":",
"return",
"_tf_available"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/file_utils.py#L424-L425 | |||
bsolomon1124/pyfinance | c6fd88ba4fb5c9f083ebc3ff60960a1b4df76c55 | pyfinance/utils.py | python | cumargmax | (a) | return x | Cumulative argmax.
Parameters
----------
a : np.ndarray
Returns
-------
np.ndarray | Cumulative argmax. | [
"Cumulative",
"argmax",
"."
] | def cumargmax(a):
"""Cumulative argmax.
Parameters
----------
a : np.ndarray
Returns
-------
np.ndarray
"""
# Thank you @Alex Riley
# https://stackoverflow.com/a/40675969/7954504
m = np.asarray(np.maximum.accumulate(a))
if a.ndim == 1:
x = np.arange(a.shape[0]... | [
"def",
"cumargmax",
"(",
"a",
")",
":",
"# Thank you @Alex Riley",
"# https://stackoverflow.com/a/40675969/7954504",
"m",
"=",
"np",
".",
"asarray",
"(",
"np",
".",
"maximum",
".",
"accumulate",
"(",
"a",
")",
")",
"if",
"a",
".",
"ndim",
"==",
"1",
":",
"... | https://github.com/bsolomon1124/pyfinance/blob/c6fd88ba4fb5c9f083ebc3ff60960a1b4df76c55/pyfinance/utils.py#L311-L334 | |
Sha-Lab/FEAT | 47bdc7c1672e00b027c67469d0291e7502918950 | model/networks/res18.py | python | conv1x1 | (in_planes, out_planes, stride=1) | return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) | 1x1 convolution | 1x1 convolution | [
"1x1",
"convolution"
] | def conv1x1(in_planes, out_planes, stride=1):
"""1x1 convolution"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) | [
"def",
"conv1x1",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"1",
",",
"stride",
"=",
"stride",
",",
"bias",
"=",
"False",
")"
] | https://github.com/Sha-Lab/FEAT/blob/47bdc7c1672e00b027c67469d0291e7502918950/model/networks/res18.py#L13-L15 | |
google/glazier | 8a7f3dacb8be8a73a15d988d02a3c14e306d8f6e | glazier/lib/policies/device_model.py | python | DeviceModel._ModelSupportPrompt | (self, message: str, this_model: str) | return False | Prompts the user whether to halt an unsupported build.
Args:
message: A message to be displayed to the user.
this_model: The hardware model that failed validation.
Returns:
true if the user wishes to proceed anyway, else false. | Prompts the user whether to halt an unsupported build. | [
"Prompts",
"the",
"user",
"whether",
"to",
"halt",
"an",
"unsupported",
"build",
"."
] | def _ModelSupportPrompt(self, message: str, this_model: str) -> bool:
"""Prompts the user whether to halt an unsupported build.
Args:
message: A message to be displayed to the user.
this_model: The hardware model that failed validation.
Returns:
true if the user wishes to proceed anyway,... | [
"def",
"_ModelSupportPrompt",
"(",
"self",
",",
"message",
":",
"str",
",",
"this_model",
":",
"str",
")",
"->",
"bool",
":",
"warning",
"=",
"message",
"%",
"this_model",
"print",
"(",
"warning",
")",
"answer",
"=",
"input",
"(",
"'Do you still want to proc... | https://github.com/google/glazier/blob/8a7f3dacb8be8a73a15d988d02a3c14e306d8f6e/glazier/lib/policies/device_model.py#L49-L65 | |
UsergeTeam/Userge | aa0cb4b452d2887321170a52f99f8eb88d33fada | userge/core/types/new/manager.py | python | Manager.enabled_commands | (self) | return {cmd.name: cmd for _, cmd in self.commands.items() if cmd.is_enabled} | returns all enabled commands | returns all enabled commands | [
"returns",
"all",
"enabled",
"commands"
] | def enabled_commands(self) -> Dict[str, Command]:
""" returns all enabled commands """
return {cmd.name: cmd for _, cmd in self.commands.items() if cmd.is_enabled} | [
"def",
"enabled_commands",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Command",
"]",
":",
"return",
"{",
"cmd",
".",
"name",
":",
"cmd",
"for",
"_",
",",
"cmd",
"in",
"self",
".",
"commands",
".",
"items",
"(",
")",
"if",
"cmd",
".",
"is_e... | https://github.com/UsergeTeam/Userge/blob/aa0cb4b452d2887321170a52f99f8eb88d33fada/userge/core/types/new/manager.py#L39-L41 | |
SciTools/iris | a12d0b15bab3377b23a148e891270b13a0419c38 | lib/iris/_merge.py | python | ProtoCube.merge | (self, unique=True) | return merged_cubes | Returns the list of cubes resulting from merging the registered
source-cubes.
Kwargs:
* unique:
If True, raises `iris.exceptions.DuplicateDataError` if
duplicate cubes are detected.
Returns:
A :class:`iris.cube.CubeList` of merged cubes. | Returns the list of cubes resulting from merging the registered
source-cubes. | [
"Returns",
"the",
"list",
"of",
"cubes",
"resulting",
"from",
"merging",
"the",
"registered",
"source",
"-",
"cubes",
"."
] | def merge(self, unique=True):
"""
Returns the list of cubes resulting from merging the registered
source-cubes.
Kwargs:
* unique:
If True, raises `iris.exceptions.DuplicateDataError` if
duplicate cubes are detected.
Returns:
A :class... | [
"def",
"merge",
"(",
"self",
",",
"unique",
"=",
"True",
")",
":",
"positions",
"=",
"[",
"{",
"i",
":",
"v",
"for",
"i",
",",
"v",
"in",
"enumerate",
"(",
"skeleton",
".",
"scalar_values",
")",
"}",
"for",
"skeleton",
"in",
"self",
".",
"_skeleton... | https://github.com/SciTools/iris/blob/a12d0b15bab3377b23a148e891270b13a0419c38/lib/iris/_merge.py#L1231-L1328 | |
django-nonrel/django-nonrel | 4fbfe7344481a5eab8698f79207f09124310131b | django/utils/dateformat.py | python | DateFormat.D | (self) | return WEEKDAYS_ABBR[self.data.weekday()] | Day of the week, textual, 3 letters; e.g. 'Fri | Day of the week, textual, 3 letters; e.g. 'Fri | [
"Day",
"of",
"the",
"week",
"textual",
"3",
"letters",
";",
"e",
".",
"g",
".",
"Fri"
] | def D(self):
"Day of the week, textual, 3 letters; e.g. 'Fri'"
return WEEKDAYS_ABBR[self.data.weekday()] | [
"def",
"D",
"(",
"self",
")",
":",
"return",
"WEEKDAYS_ABBR",
"[",
"self",
".",
"data",
".",
"weekday",
"(",
")",
"]"
] | https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/utils/dateformat.py#L137-L139 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/core/paginator.py | python | Page.__len__ | (self) | return len(self.object_list) | [] | def __len__(self):
return len(self.object_list) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"object_list",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/core/paginator.py#L90-L91 | |||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/db/backends/oracle/operations.py | python | DatabaseOperations._get_trigger_name | (self, table) | return '%s_TR' % truncate_name(strip_quotes(table), name_length).upper() | [] | def _get_trigger_name(self, table):
name_length = self.max_name_length() - 3
return '%s_TR' % truncate_name(strip_quotes(table), name_length).upper() | [
"def",
"_get_trigger_name",
"(",
"self",
",",
"table",
")",
":",
"name_length",
"=",
"self",
".",
"max_name_length",
"(",
")",
"-",
"3",
"return",
"'%s_TR'",
"%",
"truncate_name",
"(",
"strip_quotes",
"(",
"table",
")",
",",
"name_length",
")",
".",
"upper... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/backends/oracle/operations.py#L527-L529 | |||
dictation-toolbox/aenea | dfd679720b90f92340d4a8cbd4603cab37f18804 | server/linux_wayland/abstractKeyboardMapping.py | python | AbstractKeyboardMapping.solo | (self) | A solo key is a key which is different
than qwerty keyboard or which needs a modifier
(i.e. you don't need to release a key during the sequence) | A solo key is a key which is different
than qwerty keyboard or which needs a modifier
(i.e. you don't need to release a key during the sequence) | [
"A",
"solo",
"key",
"is",
"a",
"key",
"which",
"is",
"different",
"than",
"qwerty",
"keyboard",
"or",
"which",
"needs",
"a",
"modifier",
"(",
"i",
".",
"e",
".",
"you",
"don",
"t",
"need",
"to",
"release",
"a",
"key",
"during",
"the",
"sequence",
")"... | def solo(self):
"""
A solo key is a key which is different
than qwerty keyboard or which needs a modifier
(i.e. you don't need to release a key during the sequence)
"""
raise NotImplementedError() | [
"def",
"solo",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/dictation-toolbox/aenea/blob/dfd679720b90f92340d4a8cbd4603cab37f18804/server/linux_wayland/abstractKeyboardMapping.py#L6-L12 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/oceanus/v20190422/models.py | python | ResourceItem.__init__ | (self) | r"""
:param ResourceId: 资源ID
:type ResourceId: str
:param Name: 资源名称
:type Name: str
:param ResourceType: 资源类型
:type ResourceType: int
:param ResourceLoc: 资源位置
:type ResourceLoc: :class:`tencentcloud.oceanus.v20190422.models.ResourceLoc`
:param Reg... | r"""
:param ResourceId: 资源ID
:type ResourceId: str
:param Name: 资源名称
:type Name: str
:param ResourceType: 资源类型
:type ResourceType: int
:param ResourceLoc: 资源位置
:type ResourceLoc: :class:`tencentcloud.oceanus.v20190422.models.ResourceLoc`
:param Reg... | [
"r",
":",
"param",
"ResourceId",
":",
"资源ID",
":",
"type",
"ResourceId",
":",
"str",
":",
"param",
"Name",
":",
"资源名称",
":",
"type",
"Name",
":",
"str",
":",
"param",
"ResourceType",
":",
"资源类型",
":",
"type",
"ResourceType",
":",
"int",
":",
"param",
... | def __init__(self):
r"""
:param ResourceId: 资源ID
:type ResourceId: str
:param Name: 资源名称
:type Name: str
:param ResourceType: 资源类型
:type ResourceType: int
:param ResourceLoc: 资源位置
:type ResourceLoc: :class:`tencentcloud.oceanus.v20190422.models.Res... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ResourceId",
"=",
"None",
"self",
".",
"Name",
"=",
"None",
"self",
".",
"ResourceType",
"=",
"None",
"self",
".",
"ResourceLoc",
"=",
"None",
"self",
".",
"Region",
"=",
"None",
"self",
".",
"A... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/oceanus/v20190422/models.py#L1326-L1373 | ||
huggingface/datasets | 249b4a38390bf1543f5b6e2f3dc208b5689c1c13 | datasets/dbrd/dbrd.py | python | DBRDConfig.__init__ | (self, **kwargs) | BuilderConfig for DBRD.
Args:
**kwargs: keyword arguments forwarded to super. | BuilderConfig for DBRD. | [
"BuilderConfig",
"for",
"DBRD",
"."
] | def __init__(self, **kwargs):
"""BuilderConfig for DBRD.
Args:
**kwargs: keyword arguments forwarded to super.
"""
super(DBRDConfig, self).__init__(version=datasets.Version("3.0.0", ""), **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"DBRDConfig",
",",
"self",
")",
".",
"__init__",
"(",
"version",
"=",
"datasets",
".",
"Version",
"(",
"\"3.0.0\"",
",",
"\"\"",
")",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/dbrd/dbrd.py#L55-L61 | ||
plone/Products.CMFPlone | 83137764e3e7e4fe60d03c36dfc6ba9c7c543324 | Products/CMFPlone/interfaces/syndication.py | python | IFeed._brains | () | return list of brains | return list of brains | [
"return",
"list",
"of",
"brains"
] | def _brains():
"""
return list of brains
""" | [
"def",
"_brains",
"(",
")",
":"
] | https://github.com/plone/Products.CMFPlone/blob/83137764e3e7e4fe60d03c36dfc6ba9c7c543324/Products/CMFPlone/interfaces/syndication.py#L88-L91 | ||
mahyarnajibi/SNIPER | 66d7d5bff7f2e1e45e7e299c570e43e8698311aa | lib/dataset/coco.py | python | coco.evaluate_detections | (self, detections, ann_type='bbox', all_masks=None, extra_path='') | detections_val2014_results.json | detections_val2014_results.json | [
"detections_val2014_results",
".",
"json"
] | def evaluate_detections(self, detections, ann_type='bbox', all_masks=None, extra_path=''):
""" detections_val2014_results.json """
res_folder = os.path.join(self.result_path + extra_path, 'results')
if not os.path.exists(res_folder):
os.makedirs(res_folder)
res_file = os.path... | [
"def",
"evaluate_detections",
"(",
"self",
",",
"detections",
",",
"ann_type",
"=",
"'bbox'",
",",
"all_masks",
"=",
"None",
",",
"extra_path",
"=",
"''",
")",
":",
"res_folder",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"result_path",
"+",
... | https://github.com/mahyarnajibi/SNIPER/blob/66d7d5bff7f2e1e45e7e299c570e43e8698311aa/lib/dataset/coco.py#L264-L273 | ||
aws/aws-sam-cli | 2aa7bf01b2e0b0864ef63b1898a8b30577443acc | samcli/local/docker/container.py | python | Container.stop | (self, time=3) | Stop a container, with a given number of seconds between sending SIGTERM and SIGKILL.
Parameters
----------
time
Optional. Number of seconds between SIGTERM and SIGKILL. Effectively, the amount of time
the container has to perform shutdown steps. Default: 3 | Stop a container, with a given number of seconds between sending SIGTERM and SIGKILL. | [
"Stop",
"a",
"container",
"with",
"a",
"given",
"number",
"of",
"seconds",
"between",
"sending",
"SIGTERM",
"and",
"SIGKILL",
"."
] | def stop(self, time=3):
"""
Stop a container, with a given number of seconds between sending SIGTERM and SIGKILL.
Parameters
----------
time
Optional. Number of seconds between SIGTERM and SIGKILL. Effectively, the amount of time
the container has to perf... | [
"def",
"stop",
"(",
"self",
",",
"time",
"=",
"3",
")",
":",
"if",
"not",
"self",
".",
"is_created",
"(",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Container was not created, cannot run stop.\"",
")",
"return",
"try",
":",
"self",
".",
"docker_client",
".",
... | https://github.com/aws/aws-sam-cli/blob/2aa7bf01b2e0b0864ef63b1898a8b30577443acc/samcli/local/docker/container.py#L197-L224 | ||
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/matplotlib/backend_bases.py | python | NavigationToolbar2.pan | (self, *args) | Toggle the pan/zoom tool.
Pan with left button, zoom with right. | Toggle the pan/zoom tool. | [
"Toggle",
"the",
"pan",
"/",
"zoom",
"tool",
"."
] | def pan(self, *args):
"""
Toggle the pan/zoom tool.
Pan with left button, zoom with right.
"""
if self.mode == _Mode.PAN:
self.mode = _Mode.NONE
self.canvas.widgetlock.release(self)
else:
self.mode = _Mode.PAN
self.canvas.w... | [
"def",
"pan",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"mode",
"==",
"_Mode",
".",
"PAN",
":",
"self",
".",
"mode",
"=",
"_Mode",
".",
"NONE",
"self",
".",
"canvas",
".",
"widgetlock",
".",
"release",
"(",
"self",
")",
"else",
... | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/backend_bases.py#L3023-L3037 | ||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/site-packages/pip/_internal/vcs/versioncontrol.py | python | VersionControl.should_add_vcs_url_prefix | (cls, remote_url) | return not remote_url.lower().startswith('{}:'.format(cls.name)) | Return whether the vcs prefix (e.g. "git+") should be added to a
repository's remote url when used in a requirement. | Return whether the vcs prefix (e.g. "git+") should be added to a
repository's remote url when used in a requirement. | [
"Return",
"whether",
"the",
"vcs",
"prefix",
"(",
"e",
".",
"g",
".",
"git",
"+",
")",
"should",
"be",
"added",
"to",
"a",
"repository",
"s",
"remote",
"url",
"when",
"used",
"in",
"a",
"requirement",
"."
] | def should_add_vcs_url_prefix(cls, remote_url):
"""
Return whether the vcs prefix (e.g. "git+") should be added to a
repository's remote url when used in a requirement.
"""
return not remote_url.lower().startswith('{}:'.format(cls.name)) | [
"def",
"should_add_vcs_url_prefix",
"(",
"cls",
",",
"remote_url",
")",
":",
"return",
"not",
"remote_url",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"'{}:'",
".",
"format",
"(",
"cls",
".",
"name",
")",
")"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_internal/vcs/versioncontrol.py#L209-L214 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pip/locations.py | python | distutils_scheme | (dist_name, user=False, home=None, root=None,
isolated=False, prefix=None) | return scheme | Return a distutils install scheme | Return a distutils install scheme | [
"Return",
"a",
"distutils",
"install",
"scheme"
] | def distutils_scheme(dist_name, user=False, home=None, root=None,
isolated=False, prefix=None):
"""
Return a distutils install scheme
"""
from distutils.dist import Distribution
scheme = {}
if isolated:
extra_dist_args = {"script_args": ["--no-user-cfg"]}
else:... | [
"def",
"distutils_scheme",
"(",
"dist_name",
",",
"user",
"=",
"False",
",",
"home",
"=",
"None",
",",
"root",
"=",
"None",
",",
"isolated",
"=",
"False",
",",
"prefix",
"=",
"None",
")",
":",
"from",
"distutils",
".",
"dist",
"import",
"Distribution",
... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pip/locations.py#L124-L182 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/core/types/containers.py | python | is_homogeneous | (*tys) | Are the types homogeneous? | Are the types homogeneous? | [
"Are",
"the",
"types",
"homogeneous?"
] | def is_homogeneous(*tys):
"""Are the types homogeneous?
"""
if tys:
first, tys = tys[0], tys[1:]
return not any(t != first for t in tys)
else:
# *tys* is empty.
return False | [
"def",
"is_homogeneous",
"(",
"*",
"tys",
")",
":",
"if",
"tys",
":",
"first",
",",
"tys",
"=",
"tys",
"[",
"0",
"]",
",",
"tys",
"[",
"1",
":",
"]",
"return",
"not",
"any",
"(",
"t",
"!=",
"first",
"for",
"t",
"in",
"tys",
")",
"else",
":",
... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/types/containers.py#L128-L136 | ||
microsoft/msticpy | 2a401444ee529114004f496f4c0376ff25b5268a | msticpy/nbtools/data_viewer.py | python | DataTableFilter.filtered_dataframe | (self) | return self.data[self.bool_filters] | Return current filtered DataFrame. | Return current filtered DataFrame. | [
"Return",
"current",
"filtered",
"DataFrame",
"."
] | def filtered_dataframe(self) -> pd.DataFrame:
"""Return current filtered DataFrame."""
return self.data[self.bool_filters] | [
"def",
"filtered_dataframe",
"(",
"self",
")",
"->",
"pd",
".",
"DataFrame",
":",
"return",
"self",
".",
"data",
"[",
"self",
".",
"bool_filters",
"]"
] | https://github.com/microsoft/msticpy/blob/2a401444ee529114004f496f4c0376ff25b5268a/msticpy/nbtools/data_viewer.py#L360-L362 | |
Yuliang-Liu/Box_Discretization_Network | 5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6 | maskrcnn_benchmark/modeling/rpn/fcos/inference.py | python | make_fcos_postprocessor | (config, is_train=False) | return box_selector | [] | def make_fcos_postprocessor(config, is_train=False):
pre_nms_thresh = config.MODEL.FCOS.INFERENCE_TH
pre_nms_top_n = config.MODEL.FCOS.PRE_NMS_TOP_N
nms_thresh = config.MODEL.FCOS.NMS_TH
fpn_post_nms_top_n = config.TEST.DETECTIONS_PER_IMG
if is_train:
fpn_post_nms_top_n = config.MODEL.RPN.F... | [
"def",
"make_fcos_postprocessor",
"(",
"config",
",",
"is_train",
"=",
"False",
")",
":",
"pre_nms_thresh",
"=",
"config",
".",
"MODEL",
".",
"FCOS",
".",
"INFERENCE_TH",
"pre_nms_top_n",
"=",
"config",
".",
"MODEL",
".",
"FCOS",
".",
"PRE_NMS_TOP_N",
"nms_thr... | https://github.com/Yuliang-Liu/Box_Discretization_Network/blob/5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6/maskrcnn_benchmark/modeling/rpn/fcos/inference.py#L189-L209 | |||
POSTECH-CVLab/PyTorch-StudioGAN | bebb33f612759b86a224392f6fe941d0cc81d3c4 | src/sync_batchnorm/batchnorm.py | python | convert_model | (module) | return mod | Traverse the input module and its child recursively
and replace all instance of torch.nn.modules.batchnorm.BatchNorm*N*d
to SynchronizedBatchNorm*N*d
Args:
module: the input module needs to be convert to SyncBN model
Examples:
>>> import torch.nn as nn
>>> import torchvis... | Traverse the input module and its child recursively
and replace all instance of torch.nn.modules.batchnorm.BatchNorm*N*d
to SynchronizedBatchNorm*N*d | [
"Traverse",
"the",
"input",
"module",
"and",
"its",
"child",
"recursively",
"and",
"replace",
"all",
"instance",
"of",
"torch",
".",
"nn",
".",
"modules",
".",
"batchnorm",
".",
"BatchNorm",
"*",
"N",
"*",
"d",
"to",
"SynchronizedBatchNorm",
"*",
"N",
"*",... | def convert_model(module):
"""Traverse the input module and its child recursively
and replace all instance of torch.nn.modules.batchnorm.BatchNorm*N*d
to SynchronizedBatchNorm*N*d
Args:
module: the input module needs to be convert to SyncBN model
Examples:
>>> import torch.nn... | [
"def",
"convert_model",
"(",
"module",
")",
":",
"if",
"isinstance",
"(",
"module",
",",
"torch",
".",
"nn",
".",
"DataParallel",
")",
":",
"mod",
"=",
"module",
".",
"module",
"mod",
"=",
"convert_model",
"(",
"mod",
")",
"mod",
"=",
"DataParallelWithCa... | https://github.com/POSTECH-CVLab/PyTorch-StudioGAN/blob/bebb33f612759b86a224392f6fe941d0cc81d3c4/src/sync_batchnorm/batchnorm.py#L374-L413 | |
huawei-noah/vega | d9f13deede7f2b584e4b1d32ffdb833856129989 | vega/datasets/common/utils/auto_lane_spline_interp.py | python | spline_interp | (lane, step_t=1) | return interp_lane | Interp target lane.
:param lane: the lane without interp.
:type lane: list of dict
:param step_t: interp step
:type step_t: float
:return: the lane which is prrocessed
:rtype: list of dict | Interp target lane. | [
"Interp",
"target",
"lane",
"."
] | def spline_interp(lane, step_t=1):
"""Interp target lane.
:param lane: the lane without interp.
:type lane: list of dict
:param step_t: interp step
:type step_t: float
:return: the lane which is prrocessed
:rtype: list of dict
"""
interp_lane = []
if len(lane) < 2:
retur... | [
"def",
"spline_interp",
"(",
"lane",
",",
"step_t",
"=",
"1",
")",
":",
"interp_lane",
"=",
"[",
"]",
"if",
"len",
"(",
"lane",
")",
"<",
"2",
":",
"return",
"lane",
"interp_param",
"=",
"calc_params",
"(",
"lane",
")",
"for",
"f",
"in",
"interp_para... | https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/datasets/common/utils/auto_lane_spline_interp.py#L21-L43 | |
vsergeev/u-msgpack-python | e0c4000224d3d8e232fb9e94b5a07ed2c17ca802 | umsgpack.py | python | _pack2 | (obj, fp, **options) | Serialize a Python object into MessagePack bytes.
Args:
obj: a Python object
fp: a .write()-supporting file-like object
Kwargs:
ext_handlers (dict): dictionary of Ext handlers, mapping a custom type
to a callable that packs an instance of the type
... | Serialize a Python object into MessagePack bytes. | [
"Serialize",
"a",
"Python",
"object",
"into",
"MessagePack",
"bytes",
"."
] | def _pack2(obj, fp, **options):
"""
Serialize a Python object into MessagePack bytes.
Args:
obj: a Python object
fp: a .write()-supporting file-like object
Kwargs:
ext_handlers (dict): dictionary of Ext handlers, mapping a custom type
to a callable ... | [
"def",
"_pack2",
"(",
"obj",
",",
"fp",
",",
"*",
"*",
"options",
")",
":",
"global",
"compatibility",
"ext_handlers",
"=",
"options",
".",
"get",
"(",
"\"ext_handlers\"",
")",
"if",
"obj",
"is",
"None",
":",
"_pack_nil",
"(",
"obj",
",",
"fp",
",",
... | https://github.com/vsergeev/u-msgpack-python/blob/e0c4000224d3d8e232fb9e94b5a07ed2c17ca802/umsgpack.py#L457-L540 | ||
nengo/nengo | f5a88ba6b42b39a722299db6e889a5d034fcfeda | nengo/utils/matplotlib.py | python | axis_size | (ax=None) | return bbox.width * fig.dpi, bbox.height * fig.dpi | Get axis width and height in pixels.
Based on a StackOverflow response:
https://stackoverflow.com/questions/19306510/determine-matplotlib-axis-size-in-pixels
Parameters
----------
ax : axis object
The axes to determine the size of. Defaults to current axes.
Returns
-------
wid... | Get axis width and height in pixels. | [
"Get",
"axis",
"width",
"and",
"height",
"in",
"pixels",
"."
] | def axis_size(ax=None):
"""Get axis width and height in pixels.
Based on a StackOverflow response:
https://stackoverflow.com/questions/19306510/determine-matplotlib-axis-size-in-pixels
Parameters
----------
ax : axis object
The axes to determine the size of. Defaults to current axes.
... | [
"def",
"axis_size",
"(",
"ax",
"=",
"None",
")",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"if",
"ax",
"is",
"None",
"else",
"ax",
"fig",
"=",
"ax",
".",
"figure",
"bbox",
"=",
"ax",
".",
"get_window_extent",
"(",
")",
".",
"transformed",
"(",... | https://github.com/nengo/nengo/blob/f5a88ba6b42b39a722299db6e889a5d034fcfeda/nengo/utils/matplotlib.py#L40-L61 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_policy_group.py | python | OpenShiftCLI._list_pods | (self, node=None, selector=None, pod_selector=None) | return self.openshift_cmd(cmd, oadm=True, output=True, output_type='raw') | perform oadm list pods
node: the node in which to list pods
selector: the label selector filter if provided
pod_selector: the pod selector filter if provided | perform oadm list pods | [
"perform",
"oadm",
"list",
"pods"
] | def _list_pods(self, node=None, selector=None, pod_selector=None):
''' perform oadm list pods
node: the node in which to list pods
selector: the label selector filter if provided
pod_selector: the pod selector filter if provided
'''
cmd = ['manage-node']
... | [
"def",
"_list_pods",
"(",
"self",
",",
"node",
"=",
"None",
",",
"selector",
"=",
"None",
",",
"pod_selector",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'manage-node'",
"]",
"if",
"node",
":",
"cmd",
".",
"extend",
"(",
"node",
")",
"else",
":",
"cm... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_policy_group.py#L1029-L1047 | |
jasonstrimpel/volatility-trading | c83af7c1abb55df78a1acba8d148f022e3daa080 | volatility/volest.py | python | VolatilityEstimator.rolling_quantiles | (self, window=30, quantiles=[0.25, 0.75]) | return fig, plt | Plots rolling quantiles of volatility
Parameters
----------
window : int
Rolling window for which to calculate the estimator
quantiles : [lower, upper]
List of lower and upper quantiles for which to plot | Plots rolling quantiles of volatility
Parameters
----------
window : int
Rolling window for which to calculate the estimator
quantiles : [lower, upper]
List of lower and upper quantiles for which to plot | [
"Plots",
"rolling",
"quantiles",
"of",
"volatility",
"Parameters",
"----------",
"window",
":",
"int",
"Rolling",
"window",
"for",
"which",
"to",
"calculate",
"the",
"estimator",
"quantiles",
":",
"[",
"lower",
"upper",
"]",
"List",
"of",
"lower",
"and",
"uppe... | def rolling_quantiles(self, window=30, quantiles=[0.25, 0.75]):
"""Plots rolling quantiles of volatility
Parameters
----------
window : int
Rolling window for which to calculate the estimator
quantiles : [lower, upper]
List of lower and upper quan... | [
"def",
"rolling_quantiles",
"(",
"self",
",",
"window",
"=",
"30",
",",
"quantiles",
"=",
"[",
"0.25",
",",
"0.75",
"]",
")",
":",
"price_data",
"=",
"self",
".",
"_price_data",
"if",
"len",
"(",
"quantiles",
")",
"!=",
"2",
":",
"raise",
"ValueError",... | https://github.com/jasonstrimpel/volatility-trading/blob/c83af7c1abb55df78a1acba8d148f022e3daa080/volatility/volest.py#L250-L336 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/rss/feedsmanager.py | python | get_all_feeds | () | return SubFeed.__subclasses__() | [] | def get_all_feeds():
for app in settings.INSTALLED_APPS:
_try_import(app + '.feeds')
return SubFeed.__subclasses__() | [
"def",
"get_all_feeds",
"(",
")",
":",
"for",
"app",
"in",
"settings",
".",
"INSTALLED_APPS",
":",
"_try_import",
"(",
"app",
"+",
"'.feeds'",
")",
"return",
"SubFeed",
".",
"__subclasses__",
"(",
")"
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/rss/feedsmanager.py#L34-L37 | |||
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/widgets/calculator.py | python | Calculator.calculate | (self, rightOperand, pendingOperator) | return True | [] | def calculate(self, rightOperand, pendingOperator):
if pendingOperator == "+":
self.sumSoFar += rightOperand
elif pendingOperator == "-":
self.sumSoFar -= rightOperand
elif pendingOperator == u"\N{MULTIPLICATION SIGN}":
self.factorSoFar *= rightOperand
... | [
"def",
"calculate",
"(",
"self",
",",
"rightOperand",
",",
"pendingOperator",
")",
":",
"if",
"pendingOperator",
"==",
"\"+\"",
":",
"self",
".",
"sumSoFar",
"+=",
"rightOperand",
"elif",
"pendingOperator",
"==",
"\"-\"",
":",
"self",
".",
"sumSoFar",
"-=",
... | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/widgets/calculator.py#L334-L347 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/alembic/autogenerate/api.py | python | RevisionContext._default_revision | (self) | return op | [] | def _default_revision(self):
op = ops.MigrationScript(
rev_id=self.command_args['rev_id'] or util.rev_id(),
message=self.command_args['message'],
upgrade_ops=ops.UpgradeOps([]),
downgrade_ops=ops.DowngradeOps([]),
head=self.command_args['head'],
... | [
"def",
"_default_revision",
"(",
"self",
")",
":",
"op",
"=",
"ops",
".",
"MigrationScript",
"(",
"rev_id",
"=",
"self",
".",
"command_args",
"[",
"'rev_id'",
"]",
"or",
"util",
".",
"rev_id",
"(",
")",
",",
"message",
"=",
"self",
".",
"command_args",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/alembic/autogenerate/api.py#L464-L476 | |||
Alex-Fabbri/Multi-News | f6476d1f114662eb93db32e9b704b7c4fe047217 | code/OpenNMT-py-baselines/onmt/decoders/cnn_decoder.py | python | CNNDecoderState.update_state | (self, new_input) | Called for every decoder forward pass. | Called for every decoder forward pass. | [
"Called",
"for",
"every",
"decoder",
"forward",
"pass",
"."
] | def update_state(self, new_input):
""" Called for every decoder forward pass. """
self.previous_input = new_input | [
"def",
"update_state",
"(",
"self",
",",
"new_input",
")",
":",
"self",
".",
"previous_input",
"=",
"new_input"
] | https://github.com/Alex-Fabbri/Multi-News/blob/f6476d1f114662eb93db32e9b704b7c4fe047217/code/OpenNMT-py-baselines/onmt/decoders/cnn_decoder.py#L150-L152 | ||
INK-USC/KagNet | b386661ac5841774b9d17cc132e991a7bef3c5ef | pathfinder/pathfinder_analysis.py | python | pathfinding_analysis | (pf_pckle_file, statement_json_file, flag="original") | [] | def pathfinding_analysis(pf_pckle_file, statement_json_file, flag="original"):
statement_json_data = []
print("loading statements from %s" % statement_json_file)
with open(statement_json_file, "r") as fp:
for line in fp.readlines():
statement_data = json.loads(line.strip())
s... | [
"def",
"pathfinding_analysis",
"(",
"pf_pckle_file",
",",
"statement_json_file",
",",
"flag",
"=",
"\"original\"",
")",
":",
"statement_json_data",
"=",
"[",
"]",
"print",
"(",
"\"loading statements from %s\"",
"%",
"statement_json_file",
")",
"with",
"open",
"(",
"... | https://github.com/INK-USC/KagNet/blob/b386661ac5841774b9d17cc132e991a7bef3c5ef/pathfinder/pathfinder_analysis.py#L13-L190 | ||||
mangaki/mangaki | cccbed21a50d804c146b8ece7288bb19d613719a | mangaki/mangaki/utils/vgmdb.py | python | VGMdb.get | (self, id) | return a | Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).
http://vgmdb.info/ | Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).
http://vgmdb.info/ | [
"Allows",
"retrieval",
"of",
"non",
"-",
"file",
"or",
"episode",
"related",
"information",
"for",
"a",
"specific",
"anime",
"by",
"AID",
"(",
"AniDB",
"anime",
"id",
")",
".",
"http",
":",
"//",
"vgmdb",
".",
"info",
"/"
] | def get(self, id):
"""
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).
http://vgmdb.info/
"""
id = int(id) # why?
r = requests.get(BASE_URL + 'album/' + str(id), {'format': 'json'})
soup = json.loads(r.text)
a = Album({
... | [
"def",
"get",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"int",
"(",
"id",
")",
"# why?",
"r",
"=",
"requests",
".",
"get",
"(",
"BASE_URL",
"+",
"'album/'",
"+",
"str",
"(",
"id",
")",
",",
"{",
"'format'",
":",
"'json'",
"}",
")",
"soup",
... | https://github.com/mangaki/mangaki/blob/cccbed21a50d804c146b8ece7288bb19d613719a/mangaki/mangaki/utils/vgmdb.py#L23-L45 | |
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/widgets/stash.py | python | StashView.keep_index_clicked | (self, clicked) | [] | def keep_index_clicked(self, clicked):
if clicked:
self.stash_index.setChecked(False) | [
"def",
"keep_index_clicked",
"(",
"self",
",",
"clicked",
")",
":",
"if",
"clicked",
":",
"self",
".",
"stash_index",
".",
"setChecked",
"(",
"False",
")"
] | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/stash.py#L145-L147 | ||||
gluon/AbletonLive9_RemoteScripts | 0c0db5e2e29bbed88c82bf327f54d4968d36937e | pushbase/note_editor_component.py | python | NoteEditorComponent._trigger_modification | (self, step = None, done = False, immediate = False) | Because the modification of notes is slow, we
accumulate modification events and perform all of them
alltogether in a task. Call this function whenever a given set
of steps (or potentially all steps) are to be modified.
If done=True, we just notify that the given steps have been... | Because the modification of notes is slow, we
accumulate modification events and perform all of them
alltogether in a task. Call this function whenever a given set
of steps (or potentially all steps) are to be modified.
If done=True, we just notify that the given steps have been... | [
"Because",
"the",
"modification",
"of",
"notes",
"is",
"slow",
"we",
"accumulate",
"modification",
"events",
"and",
"perform",
"all",
"of",
"them",
"alltogether",
"in",
"a",
"task",
".",
"Call",
"this",
"function",
"whenever",
"a",
"given",
"set",
"of",
"ste... | def _trigger_modification(self, step = None, done = False, immediate = False):
"""
Because the modification of notes is slow, we
accumulate modification events and perform all of them
alltogether in a task. Call this function whenever a given set
of steps (or potentially all step... | [
"def",
"_trigger_modification",
"(",
"self",
",",
"step",
"=",
"None",
",",
"done",
"=",
"False",
",",
"immediate",
"=",
"False",
")",
":",
"needs_update",
"=",
"False",
"if",
"step",
"is",
"None",
":",
"needs_update",
"=",
"bool",
"(",
"self",
".",
"_... | https://github.com/gluon/AbletonLive9_RemoteScripts/blob/0c0db5e2e29bbed88c82bf327f54d4968d36937e/pushbase/note_editor_component.py#L468-L497 | ||
DxCx/plugin.video.9anime | 34358c2f701e5ddf19d3276926374a16f63f7b6a | resources/lib/ui/js2py/base.py | python | Scope.delete | (self, lval) | return false | [] | def delete(self, lval):
if self.prototype is not None:
if lval in self.own:
return false
return self.prototype.delete(lval)
# we are in global scope here. Must exist and be configurable to delete
if lval not in self.own:
# this lval does not ex... | [
"def",
"delete",
"(",
"self",
",",
"lval",
")",
":",
"if",
"self",
".",
"prototype",
"is",
"not",
"None",
":",
"if",
"lval",
"in",
"self",
".",
"own",
":",
"return",
"false",
"return",
"self",
".",
"prototype",
".",
"delete",
"(",
"lval",
")",
"# w... | https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/base.py#L1081-L1094 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParseExpression.setResultsName | ( self, name, listAllMatches=False ) | return ret | [] | def setResultsName( self, name, listAllMatches=False ):
ret = super(ParseExpression,self).setResultsName(name,listAllMatches)
return ret | [
"def",
"setResultsName",
"(",
"self",
",",
"name",
",",
"listAllMatches",
"=",
"False",
")",
":",
"ret",
"=",
"super",
"(",
"ParseExpression",
",",
"self",
")",
".",
"setResultsName",
"(",
"name",
",",
"listAllMatches",
")",
"return",
"ret"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L3312-L3314 | |||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/state.py | python | BaseHighState._merge_tops_merge | (self, tops) | return top | The default merging strategy. The base env is authoritative, so it is
checked first, followed by the remaining environments. In top files
from environments other than "base", only the section matching the
environment from the top file will be considered, and it too will be
ignored if tha... | The default merging strategy. The base env is authoritative, so it is
checked first, followed by the remaining environments. In top files
from environments other than "base", only the section matching the
environment from the top file will be considered, and it too will be
ignored if tha... | [
"The",
"default",
"merging",
"strategy",
".",
"The",
"base",
"env",
"is",
"authoritative",
"so",
"it",
"is",
"checked",
"first",
"followed",
"by",
"the",
"remaining",
"environments",
".",
"In",
"top",
"files",
"from",
"environments",
"other",
"than",
"base",
... | def _merge_tops_merge(self, tops):
"""
The default merging strategy. The base env is authoritative, so it is
checked first, followed by the remaining environments. In top files
from environments other than "base", only the section matching the
environment from the top file will b... | [
"def",
"_merge_tops_merge",
"(",
"self",
",",
"tops",
")",
":",
"top",
"=",
"DefaultOrderedDict",
"(",
"OrderedDict",
")",
"# Check base env first as it is authoritative",
"base_tops",
"=",
"tops",
".",
"pop",
"(",
"\"base\"",
",",
"DefaultOrderedDict",
"(",
"Ordere... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/state.py#L3709-L3765 | |
pilotmoon/PopClip-Extensions | 29fc472befc09ee350092ac70283bd9fdb456cb6 | source/Trello/requests/packages/urllib3/_collections.py | python | HTTPHeaderDict.add | (self, key, val) | Adds a (name, value) pair, doesn't overwrite the value if it already
exists.
>>> headers = HTTPHeaderDict(foo='bar')
>>> headers.add('Foo', 'baz')
>>> headers['foo']
'bar, baz' | Adds a (name, value) pair, doesn't overwrite the value if it already
exists. | [
"Adds",
"a",
"(",
"name",
"value",
")",
"pair",
"doesn",
"t",
"overwrite",
"the",
"value",
"if",
"it",
"already",
"exists",
"."
] | def add(self, key, val):
"""Adds a (name, value) pair, doesn't overwrite the value if it already
exists.
>>> headers = HTTPHeaderDict(foo='bar')
>>> headers.add('Foo', 'baz')
>>> headers['foo']
'bar, baz'
"""
key_lower = key.lower()
new_vals = key... | [
"def",
"add",
"(",
"self",
",",
"key",
",",
"val",
")",
":",
"key_lower",
"=",
"key",
".",
"lower",
"(",
")",
"new_vals",
"=",
"key",
",",
"val",
"# Keep the common case aka no item present as fast as possible",
"vals",
"=",
"_dict_setdefault",
"(",
"self",
",... | https://github.com/pilotmoon/PopClip-Extensions/blob/29fc472befc09ee350092ac70283bd9fdb456cb6/source/Trello/requests/packages/urllib3/_collections.py#L206-L230 | ||
elcodigok/wphardening | 634daf3a0b8dcc92484a7775a39abdfa9a846173 | lib/removeWordPress.py | python | removeWordPress.deleteStaticFile | (self) | :return: None | :return: None | [
":",
"return",
":",
"None"
] | def deleteStaticFile(self):
"""
:return: None
"""
for pathFile in self.static_file:
if os.path.exists(self.directory + pathFile):
os.remove(self.directory + pathFile)
logging.info("Delete: file " + pathFile)
print colored('\tdel... | [
"def",
"deleteStaticFile",
"(",
"self",
")",
":",
"for",
"pathFile",
"in",
"self",
".",
"static_file",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"directory",
"+",
"pathFile",
")",
":",
"os",
".",
"remove",
"(",
"self",
".",
"dire... | https://github.com/elcodigok/wphardening/blob/634daf3a0b8dcc92484a7775a39abdfa9a846173/lib/removeWordPress.py#L109-L117 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/lib2to3/fixes/fix_urllib.py | python | FixUrllib.transform | (self, node, results) | [] | def transform(self, node, results):
if results.get("module"):
self.transform_import(node, results)
elif results.get("mod_member"):
self.transform_member(node, results)
elif results.get("bare_with_attr"):
self.transform_dot(node, results)
# Renaming and... | [
"def",
"transform",
"(",
"self",
",",
"node",
",",
"results",
")",
":",
"if",
"results",
".",
"get",
"(",
"\"module\"",
")",
":",
"self",
".",
"transform_import",
"(",
"node",
",",
"results",
")",
"elif",
"results",
".",
"get",
"(",
"\"mod_member\"",
"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/lib2to3/fixes/fix_urllib.py#L186-L197 | ||||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/telnetlib.py | python | Telnet.expect | (self, list, timeout=None) | Read until one from a list of a regular expressions matches.
The first argument is a list of regular expressions, either
compiled (re.RegexObject instances) or uncompiled (strings).
The optional second argument is a timeout, in seconds; default
is no timeout.
Return a tuple of ... | Read until one from a list of a regular expressions matches. | [
"Read",
"until",
"one",
"from",
"a",
"list",
"of",
"a",
"regular",
"expressions",
"matches",
"."
] | def expect(self, list, timeout=None):
"""Read until one from a list of a regular expressions matches.
The first argument is a list of regular expressions, either
compiled (re.RegexObject instances) or uncompiled (strings).
The optional second argument is a timeout, in seconds; default
... | [
"def",
"expect",
"(",
"self",
",",
"list",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"self",
".",
"_has_poll",
":",
"return",
"self",
".",
"_expect_with_poll",
"(",
"list",
",",
"timeout",
")",
"else",
":",
"return",
"self",
".",
"_expect_with_select"... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/telnetlib.py#L630-L655 | ||
joxeankoret/diaphora | dcb5a25ac9fe23a285b657e5389cf770de7ac928 | pygments/lexers/special.py | python | RawTokenLexer.get_tokens_unprocessed | (self, text) | [] | def get_tokens_unprocessed(self, text):
length = 0
for match in line_re.finditer(text):
try:
ttypestr, val = match.group().split(b'\t', 1)
except ValueError:
val = match.group().decode('ascii', 'replace')
ttype = Error
e... | [
"def",
"get_tokens_unprocessed",
"(",
"self",
",",
"text",
")",
":",
"length",
"=",
"0",
"for",
"match",
"in",
"line_re",
".",
"finditer",
"(",
"text",
")",
":",
"try",
":",
"ttypestr",
",",
"val",
"=",
"match",
".",
"group",
"(",
")",
".",
"split",
... | https://github.com/joxeankoret/diaphora/blob/dcb5a25ac9fe23a285b657e5389cf770de7ac928/pygments/lexers/special.py#L80-L100 | ||||
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/_lib/decorator.py | python | append | (a, vancestors) | Append ``a`` to the list of the virtual ancestors, unless it is already
included. | Append ``a`` to the list of the virtual ancestors, unless it is already
included. | [
"Append",
"a",
"to",
"the",
"list",
"of",
"the",
"virtual",
"ancestors",
"unless",
"it",
"is",
"already",
"included",
"."
] | def append(a, vancestors):
"""
Append ``a`` to the list of the virtual ancestors, unless it is already
included.
"""
add = True
for j, va in enumerate(vancestors):
if issubclass(va, a):
add = False
break
if issubclass(a, va):
vancestors[j] = a
... | [
"def",
"append",
"(",
"a",
",",
"vancestors",
")",
":",
"add",
"=",
"True",
"for",
"j",
",",
"va",
"in",
"enumerate",
"(",
"vancestors",
")",
":",
"if",
"issubclass",
"(",
"va",
",",
"a",
")",
":",
"add",
"=",
"False",
"break",
"if",
"issubclass",
... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/_lib/decorator.py#L280-L294 | ||
monkeyDemon/AI-Toolbox | 53cf9c78945f2862d789bd0f67384c6a36c1f9d9 | preprocess ToolBox/data_augmentation_tool/tf_data_augmentation_tool/dataset_utils.py | python | bytes_feature | (values) | return tf.train.Feature(bytes_list=tf.train.BytesList(value=[values])) | Returns a TF-Feature of bytes.
Args:
values: A string.
Returns:
A TF-Feature. | Returns a TF-Feature of bytes. | [
"Returns",
"a",
"TF",
"-",
"Feature",
"of",
"bytes",
"."
] | def bytes_feature(values):
"""Returns a TF-Feature of bytes.
Args:
values: A string.
Returns:
A TF-Feature.
"""
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[values])) | [
"def",
"bytes_feature",
"(",
"values",
")",
":",
"return",
"tf",
".",
"train",
".",
"Feature",
"(",
"bytes_list",
"=",
"tf",
".",
"train",
".",
"BytesList",
"(",
"value",
"=",
"[",
"values",
"]",
")",
")"
] | https://github.com/monkeyDemon/AI-Toolbox/blob/53cf9c78945f2862d789bd0f67384c6a36c1f9d9/preprocess ToolBox/data_augmentation_tool/tf_data_augmentation_tool/dataset_utils.py#L43-L52 | |
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | py3.10/multiprocess/resource_sharer.py | python | _ResourceSharer.register | (self, send, close) | Register resource, returning an identifier. | Register resource, returning an identifier. | [
"Register",
"resource",
"returning",
"an",
"identifier",
"."
] | def register(self, send, close):
'''Register resource, returning an identifier.'''
with self._lock:
if self._address is None:
self._start()
self._key += 1
self._cache[self._key] = (send, close)
return (self._address, self._key) | [
"def",
"register",
"(",
"self",
",",
"send",
",",
"close",
")",
":",
"with",
"self",
".",
"_lock",
":",
"if",
"self",
".",
"_address",
"is",
"None",
":",
"self",
".",
"_start",
"(",
")",
"self",
".",
"_key",
"+=",
"1",
"self",
".",
"_cache",
"[",... | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.10/multiprocess/resource_sharer.py#L72-L79 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/nbconvert-4.1.0-py3.3.egg/nbconvert/filters/markdown.py | python | markdown2latex | (source, markup='markdown', extra_args=None) | return pandoc(source, markup, 'latex', extra_args=extra_args) | Convert a markdown string to LaTeX via pandoc.
This function will raise an error if pandoc is not installed.
Any error messages generated by pandoc are printed to stderr.
Parameters
----------
source : string
Input string, assumed to be valid markdown.
markup : string
Markup used b... | Convert a markdown string to LaTeX via pandoc. | [
"Convert",
"a",
"markdown",
"string",
"to",
"LaTeX",
"via",
"pandoc",
"."
] | def markdown2latex(source, markup='markdown', extra_args=None):
"""Convert a markdown string to LaTeX via pandoc.
This function will raise an error if pandoc is not installed.
Any error messages generated by pandoc are printed to stderr.
Parameters
----------
source : string
Input string... | [
"def",
"markdown2latex",
"(",
"source",
",",
"markup",
"=",
"'markdown'",
",",
"extra_args",
"=",
"None",
")",
":",
"return",
"pandoc",
"(",
"source",
",",
"markup",
",",
"'latex'",
",",
"extra_args",
"=",
"extra_args",
")"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/nbconvert-4.1.0-py3.3.egg/nbconvert/filters/markdown.py#L39-L59 | |
JeremyCCHsu/vae-npvc | 94a83b33bf17593aa402cb38408fdfad1339a120 | util/image.py | python | gray2jet | (x) | NHWC (channel last) format | NHWC (channel last) format | [
"NHWC",
"(",
"channel",
"last",
")",
"format"
] | def gray2jet(x):
''' NHWC (channel last) format '''
with tf.name_scope('Gray2Jet'):
r = clip_to_boundary(
line(x, .3515, .66, 0., 1.),
line(x, .8867, 1., 1., .5),
minval=0.,
maxval=1.,
)
g = clip_to_boundary(
line(x, .125, .375,... | [
"def",
"gray2jet",
"(",
"x",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"'Gray2Jet'",
")",
":",
"r",
"=",
"clip_to_boundary",
"(",
"line",
"(",
"x",
",",
".3515",
",",
".66",
",",
"0.",
",",
"1.",
")",
",",
"line",
"(",
"x",
",",
".8867",
... | https://github.com/JeremyCCHsu/vae-npvc/blob/94a83b33bf17593aa402cb38408fdfad1339a120/util/image.py#L45-L66 | ||
jaychsu/algorithm | 87dac5456b74a515dd97507ac68e9b8588066a04 | other/robot_cleaner.py | python | RobotCleanerDFS.clean_room | (self, robot) | :type robot: Robot | :type robot: Robot | [
":",
"type",
"robot",
":",
"Robot"
] | def clean_room(self, robot):
"""
:type robot: Robot
"""
if not isinstance(robot, Robot):
return
"""
robot's direction and coord no needs to same as room
just start as (0, 0),
and face 0 (this 0 just ref of dirs, no needs to treat it as Dirs.DO... | [
"def",
"clean_room",
"(",
"self",
",",
"robot",
")",
":",
"if",
"not",
"isinstance",
"(",
"robot",
",",
"Robot",
")",
":",
"return",
"\"\"\"\n robot's direction and coord no needs to same as room\n just start as (0, 0),\n and face 0 (this 0 just ref of dirs, ... | https://github.com/jaychsu/algorithm/blob/87dac5456b74a515dd97507ac68e9b8588066a04/other/robot_cleaner.py#L306-L321 | ||
textX/Arpeggio | 9ec6c7ee402054616b2f81e76557d39d3d376fcd | examples/robot/robot.py | python | robot | () | return 'begin', ZeroOrMore(command), 'end', EOF | [] | def robot(): return 'begin', ZeroOrMore(command), 'end', EOF | [
"def",
"robot",
"(",
")",
":",
"return",
"'begin'",
",",
"ZeroOrMore",
"(",
"command",
")",
",",
"'end'",
",",
"EOF"
] | https://github.com/textX/Arpeggio/blob/9ec6c7ee402054616b2f81e76557d39d3d376fcd/examples/robot/robot.py#L29-L29 | |||
paulwinex/pw_MultiScriptEditor | e447e99f87cb07e238baf693b7e124e50efdbc51 | multi_script_editor/jedi/evaluate/representation.py | python | Instance._get_func_self_name | (self, func) | Returns the name of the first param in a class method (which is
normally self. | Returns the name of the first param in a class method (which is
normally self. | [
"Returns",
"the",
"name",
"of",
"the",
"first",
"param",
"in",
"a",
"class",
"method",
"(",
"which",
"is",
"normally",
"self",
"."
] | def _get_func_self_name(self, func):
"""
Returns the name of the first param in a class method (which is
normally self.
"""
try:
return str(func.params[0].get_name())
except IndexError:
return None | [
"def",
"_get_func_self_name",
"(",
"self",
",",
"func",
")",
":",
"try",
":",
"return",
"str",
"(",
"func",
".",
"params",
"[",
"0",
"]",
".",
"get_name",
"(",
")",
")",
"except",
"IndexError",
":",
"return",
"None"
] | https://github.com/paulwinex/pw_MultiScriptEditor/blob/e447e99f87cb07e238baf693b7e124e50efdbc51/multi_script_editor/jedi/evaluate/representation.py#L73-L81 | ||
rbonghi/jetson_stats | 628b07d935a2d980eac158c242812a0510e4efb8 | jtop/core/tegra_parse.py | python | SWAP | (text) | SWAP X/Y (cached Z)
X = Amount of SWAP in use in megabytes.
Y = Total amount of SWAP available for applications.
Z = Amount of SWAP cached in megabytes. | SWAP X/Y (cached Z)
X = Amount of SWAP in use in megabytes.
Y = Total amount of SWAP available for applications.
Z = Amount of SWAP cached in megabytes. | [
"SWAP",
"X",
"/",
"Y",
"(",
"cached",
"Z",
")",
"X",
"=",
"Amount",
"of",
"SWAP",
"in",
"use",
"in",
"megabytes",
".",
"Y",
"=",
"Total",
"amount",
"of",
"SWAP",
"available",
"for",
"applications",
".",
"Z",
"=",
"Amount",
"of",
"SWAP",
"cached",
"... | def SWAP(text):
"""
SWAP X/Y (cached Z)
X = Amount of SWAP in use in megabytes.
Y = Total amount of SWAP available for applications.
Z = Amount of SWAP cached in megabytes.
"""
match = SWAP_RE.search(text)
if match:
return {'use': int(match.group(1)),
... | [
"def",
"SWAP",
"(",
"text",
")",
":",
"match",
"=",
"SWAP_RE",
".",
"search",
"(",
"text",
")",
"if",
"match",
":",
"return",
"{",
"'use'",
":",
"int",
"(",
"match",
".",
"group",
"(",
"1",
")",
")",
",",
"'tot'",
":",
"int",
"(",
"match",
".",... | https://github.com/rbonghi/jetson_stats/blob/628b07d935a2d980eac158c242812a0510e4efb8/jtop/core/tegra_parse.py#L40-L56 | ||
inducer/pycuda | 9f3b898ec0846e2a4dff5077d4403ea03b1fccf9 | pycuda/sparse/operator.py | python | DiagonalPreconditioner.shape | (self) | return n, n | [] | def shape(self):
n = self.diagonal.shape[0]
return n, n | [
"def",
"shape",
"(",
"self",
")",
":",
"n",
"=",
"self",
".",
"diagonal",
".",
"shape",
"[",
"0",
"]",
"return",
"n",
",",
"n"
] | https://github.com/inducer/pycuda/blob/9f3b898ec0846e2a4dff5077d4403ea03b1fccf9/pycuda/sparse/operator.py#L37-L39 | |||
bdcht/amoco | dac8e00b862eb6d87cc88dddd1e5316c67c1d798 | amoco/cas/expressions.py | python | exp.signextend | (self, size) | return self.extend(True, size) | sign extend expression to given size | sign extend expression to given size | [
"sign",
"extend",
"expression",
"to",
"given",
"size"
] | def signextend(self, size):
"sign extend expression to given size"
return self.extend(True, size) | [
"def",
"signextend",
"(",
"self",
",",
"size",
")",
":",
"return",
"self",
".",
"extend",
"(",
"True",
",",
"size",
")"
] | https://github.com/bdcht/amoco/blob/dac8e00b862eb6d87cc88dddd1e5316c67c1d798/amoco/cas/expressions.py#L244-L246 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/ipaddress-1.0.19/ipaddress.py | python | _BaseV4._string_from_ip_int | (cls, ip_int) | return '.'.join(_compat_str(struct.unpack(b'!B', b)[0]
if isinstance(b, bytes)
else b)
for b in _compat_to_bytes(ip_int, 4, 'big')) | Turns a 32-bit integer into dotted decimal notation.
Args:
ip_int: An integer, the IP address.
Returns:
The IP address as a string in dotted decimal notation. | Turns a 32-bit integer into dotted decimal notation. | [
"Turns",
"a",
"32",
"-",
"bit",
"integer",
"into",
"dotted",
"decimal",
"notation",
"."
] | def _string_from_ip_int(cls, ip_int):
"""Turns a 32-bit integer into dotted decimal notation.
Args:
ip_int: An integer, the IP address.
Returns:
The IP address as a string in dotted decimal notation.
"""
return '.'.join(_compat_str(struct.unpack(b'!B', ... | [
"def",
"_string_from_ip_int",
"(",
"cls",
",",
"ip_int",
")",
":",
"return",
"'.'",
".",
"join",
"(",
"_compat_str",
"(",
"struct",
".",
"unpack",
"(",
"b'!B'",
",",
"b",
")",
"[",
"0",
"]",
"if",
"isinstance",
"(",
"b",
",",
"bytes",
")",
"else",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/ipaddress-1.0.19/ipaddress.py#L1307-L1320 | |
SirVer/ultisnips | 2c83e40ce66814bf813457bb58ea96184ab9bb81 | pythonx/UltiSnips/snippet/source/snippet_dictionary.py | python | SnippetDictionary.clear_snippets | (self, priority, triggers) | Clear the snippets by mark them as cleared.
If trigger is None, it updates the value of clear priority
instead. | Clear the snippets by mark them as cleared. | [
"Clear",
"the",
"snippets",
"by",
"mark",
"them",
"as",
"cleared",
"."
] | def clear_snippets(self, priority, triggers):
"""Clear the snippets by mark them as cleared.
If trigger is None, it updates the value of clear priority
instead.
"""
if not triggers:
if self._clear_priority is None or priority > self._clear_priority:
... | [
"def",
"clear_snippets",
"(",
"self",
",",
"priority",
",",
"triggers",
")",
":",
"if",
"not",
"triggers",
":",
"if",
"self",
".",
"_clear_priority",
"is",
"None",
"or",
"priority",
">",
"self",
".",
"_clear_priority",
":",
"self",
".",
"_clear_priority",
... | https://github.com/SirVer/ultisnips/blob/2c83e40ce66814bf813457bb58ea96184ab9bb81/pythonx/UltiSnips/snippet/source/snippet_dictionary.py#L44-L57 | ||
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | tools/export_notebooks_to_python.py | python | is_newer | (file1, file2, strict=True) | return t1 >= t2 | Determine if file1 has been modified after file2
Parameters
----------
file1 : str
File path. May not exist, in which case False is returned.
file1 : str
File path. Must exist.
strict : bool
Use strict inequality test (>). If False, then returns True for files
with t... | Determine if file1 has been modified after file2 | [
"Determine",
"if",
"file1",
"has",
"been",
"modified",
"after",
"file2"
] | def is_newer(file1, file2, strict=True):
"""
Determine if file1 has been modified after file2
Parameters
----------
file1 : str
File path. May not exist, in which case False is returned.
file1 : str
File path. Must exist.
strict : bool
Use strict inequality test (>).... | [
"def",
"is_newer",
"(",
"file1",
",",
"file2",
",",
"strict",
"=",
"True",
")",
":",
"try",
":",
"t1",
"=",
"os",
".",
"path",
".",
"getmtime",
"(",
"file1",
")",
"t2",
"=",
"os",
".",
"path",
".",
"getmtime",
"(",
"file2",
")",
"except",
"FileNo... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/tools/export_notebooks_to_python.py#L64-L90 | |
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/symmetry/kpath.py | python | KPathSetyawanCurtarolo.orcf2 | (self, a, b, c) | return {"kpoints": kpoints, "path": path} | ORFC2 Path | ORFC2 Path | [
"ORFC2",
"Path"
] | def orcf2(self, a, b, c):
"""
ORFC2 Path
"""
self.name = "ORCF2"
phi = (1 + c ** 2 / b ** 2 - c ** 2 / a ** 2) / 4
eta = (1 + a ** 2 / b ** 2 - a ** 2 / c ** 2) / 4
delta = (1 + b ** 2 / a ** 2 - b ** 2 / c ** 2) / 4
kpoints = {
"\\Gamma": np.a... | [
"def",
"orcf2",
"(",
"self",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"self",
".",
"name",
"=",
"\"ORCF2\"",
"phi",
"=",
"(",
"1",
"+",
"c",
"**",
"2",
"/",
"b",
"**",
"2",
"-",
"c",
"**",
"2",
"/",
"a",
"**",
"2",
")",
"/",
"4",
"eta",
... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/symmetry/kpath.py#L478-L506 | |
nate-parrott/Flashlight | c3a7c7278a1cccf8918e7543faffc68e863ff5ab | PluginDirectories/1/sublime.bundle/applescript.py | python | asrun | (ascript) | return osa.communicate(ascript)[0] | Run the given AppleScript and return the standard output and error. | Run the given AppleScript and return the standard output and error. | [
"Run",
"the",
"given",
"AppleScript",
"and",
"return",
"the",
"standard",
"output",
"and",
"error",
"."
] | def asrun(ascript):
"Run the given AppleScript and return the standard output and error."
osa = subprocess.Popen(['osascript', '-'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
return osa.communicate(ascript)[0] | [
"def",
"asrun",
"(",
"ascript",
")",
":",
"osa",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"'osascript'",
",",
"'-'",
"]",
",",
"stdin",
"=",
"subprocess",
".",
"PIPE",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"return",
"osa",
".",
"commu... | https://github.com/nate-parrott/Flashlight/blob/c3a7c7278a1cccf8918e7543faffc68e863ff5ab/PluginDirectories/1/sublime.bundle/applescript.py#L5-L11 | |
steeve/xbmctorrent | e6bcb1037668959e1e3cb5ba8cf3e379c6638da9 | resources/site-packages/xbmcswift2/storage.py | python | _Storage.__delitem__ | (self, key) | [] | def __delitem__(self, key):
self._items.__delitem__(key) | [
"def",
"__delitem__",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"_items",
".",
"__delitem__",
"(",
"key",
")"
] | https://github.com/steeve/xbmctorrent/blob/e6bcb1037668959e1e3cb5ba8cf3e379c6638da9/resources/site-packages/xbmcswift2/storage.py#L131-L132 | ||||
stephenhky/PyShortTextCategorization | 4fa46a148a3eeb923885a7d70c789e988554f758 | shorttext/data/data_retrieval.py | python | mergedict | (dicts) | return dict(mdict) | Merge data dictionary.
Merge dictionaries of the data in the training data format.
:param dicts: dicts to merge
:return: merged dict
:type dicts: list
:rtype: dict | Merge data dictionary. | [
"Merge",
"data",
"dictionary",
"."
] | def mergedict(dicts):
""" Merge data dictionary.
Merge dictionaries of the data in the training data format.
:param dicts: dicts to merge
:return: merged dict
:type dicts: list
:rtype: dict
"""
mdict = defaultdict(lambda : [])
for thisdict in dicts:
for label in thisdict:
... | [
"def",
"mergedict",
"(",
"dicts",
")",
":",
"mdict",
"=",
"defaultdict",
"(",
"lambda",
":",
"[",
"]",
")",
"for",
"thisdict",
"in",
"dicts",
":",
"for",
"label",
"in",
"thisdict",
":",
"mdict",
"[",
"label",
"]",
"+=",
"thisdict",
"[",
"label",
"]",... | https://github.com/stephenhky/PyShortTextCategorization/blob/4fa46a148a3eeb923885a7d70c789e988554f758/shorttext/data/data_retrieval.py#L153-L167 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/set/src/core/scapy.py | python | BER_num_enc | (l, size=1) | return "".join([chr(k) for k in x]) | [] | def BER_num_enc(l, size=1):
x=[]
while l or size>0:
x.insert(0, l & 0x7f)
if len(x) > 1:
x[0] |= 0x80
l >>= 7
size -= 1
return "".join([chr(k) for k in x]) | [
"def",
"BER_num_enc",
"(",
"l",
",",
"size",
"=",
"1",
")",
":",
"x",
"=",
"[",
"]",
"while",
"l",
"or",
"size",
">",
"0",
":",
"x",
".",
"insert",
"(",
"0",
",",
"l",
"&",
"0x7f",
")",
"if",
"len",
"(",
"x",
")",
">",
"1",
":",
"x",
"[... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/set/src/core/scapy.py#L1944-L1952 | |||
smicallef/spiderfoot | fd4bf9394c9ab3ecc90adc3115c56349fb23165b | modules/sfp_cinsscore.py | python | sfp_cinsscore.watchedEvents | (self) | return [
"IP_ADDRESS",
"AFFILIATE_IPADDR",
"NETBLOCK_MEMBER",
"NETBLOCK_OWNER",
] | [] | def watchedEvents(self):
return [
"IP_ADDRESS",
"AFFILIATE_IPADDR",
"NETBLOCK_MEMBER",
"NETBLOCK_OWNER",
] | [
"def",
"watchedEvents",
"(",
"self",
")",
":",
"return",
"[",
"\"IP_ADDRESS\"",
",",
"\"AFFILIATE_IPADDR\"",
",",
"\"NETBLOCK_MEMBER\"",
",",
"\"NETBLOCK_OWNER\"",
",",
"]"
] | https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/modules/sfp_cinsscore.py#L64-L70 | |||
aneisch/home-assistant-config | 86e381fde9609cb8871c439c433c12989e4e225d | custom_components/aarlo/pyaarlo/__init__.py | python | PyArlo.base_stations | (self) | return self._bases | List of base stations..
:return: a list of base stations.
:rtype: list(ArloBase) | List of base stations.. | [
"List",
"of",
"base",
"stations",
".."
] | def base_stations(self):
"""List of base stations..
:return: a list of base stations.
:rtype: list(ArloBase)
"""
return self._bases | [
"def",
"base_stations",
"(",
"self",
")",
":",
"return",
"self",
".",
"_bases"
] | https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_components/aarlo/pyaarlo/__init__.py#L522-L528 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/common/lib/python2.7/site-packages/libxml2.py | python | uCSIsTelugu | (code) | return ret | Check whether the character is part of Telugu UCS Block | Check whether the character is part of Telugu UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Telugu",
"UCS",
"Block"
] | def uCSIsTelugu(code):
"""Check whether the character is part of Telugu UCS Block """
ret = libxml2mod.xmlUCSIsTelugu(code)
return ret | [
"def",
"uCSIsTelugu",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsTelugu",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L2880-L2883 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/services/rest/newsapi/newsapi.py | python | NewsAPI.fox_sports | (api_key, max_articles, sort, reverse) | return NewsAPI._get_data(NewsAPI.FOX_SPORTS, api_key, max_articles, sort, reverse) | [] | def fox_sports(api_key, max_articles, sort, reverse):
return NewsAPI._get_data(NewsAPI.FOX_SPORTS, api_key, max_articles, sort, reverse) | [
"def",
"fox_sports",
"(",
"api_key",
",",
"max_articles",
",",
"sort",
",",
"reverse",
")",
":",
"return",
"NewsAPI",
".",
"_get_data",
"(",
"NewsAPI",
".",
"FOX_SPORTS",
",",
"api_key",
",",
"max_articles",
",",
"sort",
",",
"reverse",
")"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/services/rest/newsapi/newsapi.py#L356-L357 | |||
jina-ai/jina | c77a492fcd5adba0fc3de5347bea83dd4e7d8087 | jina/proto/jina_pb2_grpc.py | python | JinaDataRequestRPCServicer.process_data | (self, request, context) | Used for passing DataRequests to the Executors | Used for passing DataRequests to the Executors | [
"Used",
"for",
"passing",
"DataRequests",
"to",
"the",
"Executors"
] | def process_data(self, request, context):
"""Used for passing DataRequests to the Executors"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | [
"def",
"process_data",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"context",
".",
"set_code",
"(",
"grpc",
".",
"StatusCode",
".",
"UNIMPLEMENTED",
")",
"context",
".",
"set_details",
"(",
"'Method not implemented!'",
")",
"raise",
"NotImplementedErr... | https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/proto/jina_pb2_grpc.py#L111-L115 | ||
GNOME/gnome-music | b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e | gnomemusic/application.py | python | Application.lastfm_scrobbler | (self) | return self._lastfm_scrobbler | Get Last.fm scrobbler.
:returns: Last.fm scrobbler
:rtype: LastFmScrobbler | Get Last.fm scrobbler. | [
"Get",
"Last",
".",
"fm",
"scrobbler",
"."
] | def lastfm_scrobbler(self):
"""Get Last.fm scrobbler.
:returns: Last.fm scrobbler
:rtype: LastFmScrobbler
"""
return self._lastfm_scrobbler | [
"def",
"lastfm_scrobbler",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lastfm_scrobbler"
] | https://github.com/GNOME/gnome-music/blob/b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e/gnomemusic/application.py#L153-L159 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.