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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
websauna/websauna | a57de54fb8a3fae859f24f373f0292e1e4b3c344 | websauna/system/__init__.py | python | Initializer.configure_user_models | (self) | Plug in user models.
This initialization step connects chosen user model to SQLAlchemy model Base. Also set up :py:class:`websauna.system.user.usermixin.SiteCreator` logic - what happens when the first user logs in. | Plug in user models. | [
"Plug",
"in",
"user",
"models",
"."
] | def configure_user_models(self):
"""Plug in user models.
This initialization step connects chosen user model to SQLAlchemy model Base. Also set up :py:class:`websauna.system.user.usermixin.SiteCreator` logic - what happens when the first user logs in.
"""
from websauna.system.model.meta... | [
"def",
"configure_user_models",
"(",
"self",
")",
":",
"from",
"websauna",
".",
"system",
".",
"model",
".",
"meta",
"import",
"Base",
"from",
"websauna",
".",
"system",
".",
"model",
".",
"utils",
"import",
"attach_model_to_base",
"from",
"websauna",
".",
"... | https://github.com/websauna/websauna/blob/a57de54fb8a3fae859f24f373f0292e1e4b3c344/websauna/system/__init__.py#L536-L567 | ||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_tf_objects.py | python | TFLayoutLMModel.from_pretrained | (cls, *args, **kwargs) | [] | def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["tf"]) | [
"def",
"from_pretrained",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"cls",
",",
"[",
"\"tf\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_tf_objects.py#L73-L74 | ||||
RaRe-Technologies/gensim | 8b8203d8df354673732dff635283494a33d0d422 | gensim/similarities/docsim.py | python | WmdSimilarity.__len__ | (self) | return len(self.corpus) | Get size of corpus. | Get size of corpus. | [
"Get",
"size",
"of",
"corpus",
"."
] | def __len__(self):
"""Get size of corpus."""
return len(self.corpus) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"corpus",
")"
] | https://github.com/RaRe-Technologies/gensim/blob/8b8203d8df354673732dff635283494a33d0d422/gensim/similarities/docsim.py#L1050-L1052 | |
Antergos/Cnchi | 13ac2209da9432d453e0097cf48a107640b563a9 | src/pages/zfs_manager.py | python | load_existing_pools | () | return existing_pools | Fills existing_pools dict with pool's name,
identifier and status | Fills existing_pools dict with pool's name,
identifier and status | [
"Fills",
"existing_pools",
"dict",
"with",
"pool",
"s",
"name",
"identifier",
"and",
"status"
] | def load_existing_pools():
""" Fills existing_pools dict with pool's name,
identifier and status """
existing_pools = {}
output = call(["zpool", "import"])
if output:
name = identifier = state = None
lines = output.split("\n")
for line in lines:
if "pool:" in... | [
"def",
"load_existing_pools",
"(",
")",
":",
"existing_pools",
"=",
"{",
"}",
"output",
"=",
"call",
"(",
"[",
"\"zpool\"",
",",
"\"import\"",
"]",
")",
"if",
"output",
":",
"name",
"=",
"identifier",
"=",
"state",
"=",
"None",
"lines",
"=",
"output",
... | https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/pages/zfs_manager.py#L212-L231 | |
inkandswitch/livebook | 93c8d467734787366ad084fc3566bf5cbe249c51 | public/pypyjs/modules/numpy/polynomial/hermite.py | python | hermgrid2d | (x, y, c) | return c | Evaluate a 2-D Hermite series on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \sum_{i,j} c_{i,j} * H_i(a) * H_j(b)
where the points `(a, b)` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulting points form a grid with
`x` in ... | Evaluate a 2-D Hermite series on the Cartesian product of x and y. | [
"Evaluate",
"a",
"2",
"-",
"D",
"Hermite",
"series",
"on",
"the",
"Cartesian",
"product",
"of",
"x",
"and",
"y",
"."
] | def hermgrid2d(x, y, c):
"""
Evaluate a 2-D Hermite series on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \sum_{i,j} c_{i,j} * H_i(a) * H_j(b)
where the points `(a, b)` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resultin... | [
"def",
"hermgrid2d",
"(",
"x",
",",
"y",
",",
"c",
")",
":",
"c",
"=",
"hermval",
"(",
"x",
",",
"c",
")",
"c",
"=",
"hermval",
"(",
"y",
",",
"c",
")",
"return",
"c"
] | https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/numpy/polynomial/hermite.py#L1004-L1056 | |
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | plugin.video.const.kinozal.tv/default.py | python | get_years | (params) | [] | def get_years(params):
http = GET(siteurl + '/top.php')
beautifulSoup = BeautifulSoup(http)
years = beautifulSoup.find('select',attrs={"class":"w100 styled"})
years = years.findAll('option')
for n in years:
li = xbmcgui.ListItem(n.string.encode('utf-8'),addon_icon,addon_icon)
uri = construct_request({
'fun... | [
"def",
"get_years",
"(",
"params",
")",
":",
"http",
"=",
"GET",
"(",
"siteurl",
"+",
"'/top.php'",
")",
"beautifulSoup",
"=",
"BeautifulSoup",
"(",
"http",
")",
"years",
"=",
"beautifulSoup",
".",
"find",
"(",
"'select'",
",",
"attrs",
"=",
"{",
"\"clas... | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.const.kinozal.tv/default.py#L1017-L1030 | ||||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_obj.py | python | Yedit._write | (filename, contents) | Actually write the file contents to disk. This helps with mocking. | Actually write the file contents to disk. This helps with mocking. | [
"Actually",
"write",
"the",
"file",
"contents",
"to",
"disk",
".",
"This",
"helps",
"with",
"mocking",
"."
] | def _write(filename, contents):
''' Actually write the file contents to disk. This helps with mocking. '''
tmp_filename = filename + '.yedit'
with open(tmp_filename, 'w') as yfd:
fcntl.flock(yfd, fcntl.LOCK_EX | fcntl.LOCK_NB)
yfd.write(contents)
fcntl.flock... | [
"def",
"_write",
"(",
"filename",
",",
"contents",
")",
":",
"tmp_filename",
"=",
"filename",
"+",
"'.yedit'",
"with",
"open",
"(",
"tmp_filename",
",",
"'w'",
")",
"as",
"yfd",
":",
"fcntl",
".",
"flock",
"(",
"yfd",
",",
"fcntl",
".",
"LOCK_EX",
"|",... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_obj.py#L361-L371 | ||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/mailcap.py | python | listmailcapfiles | () | return mailcaps | Return a list of all mailcap files found on the system. | Return a list of all mailcap files found on the system. | [
"Return",
"a",
"list",
"of",
"all",
"mailcap",
"files",
"found",
"on",
"the",
"system",
"."
] | def listmailcapfiles():
"""Return a list of all mailcap files found on the system."""
# XXX Actually, this is Unix-specific
if 'MAILCAPS' in os.environ:
str = os.environ['MAILCAPS']
mailcaps = str.split(':')
else:
if 'HOME' in os.environ:
home = os.environ['HOME']
... | [
"def",
"listmailcapfiles",
"(",
")",
":",
"# XXX Actually, this is Unix-specific",
"if",
"'MAILCAPS'",
"in",
"os",
".",
"environ",
":",
"str",
"=",
"os",
".",
"environ",
"[",
"'MAILCAPS'",
"]",
"mailcaps",
"=",
"str",
".",
"split",
"(",
"':'",
")",
"else",
... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/mailcap.py#L34-L48 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/elasticsearch.py | python | info | (hosts=None, profile=None) | .. versionadded:: 2017.7.0
Return Elasticsearch information.
CLI Example:
.. code-block:: bash
salt myminion elasticsearch.info
salt myminion elasticsearch.info profile=elasticsearch-extra | .. versionadded:: 2017.7.0 | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | def info(hosts=None, profile=None):
"""
.. versionadded:: 2017.7.0
Return Elasticsearch information.
CLI Example:
.. code-block:: bash
salt myminion elasticsearch.info
salt myminion elasticsearch.info profile=elasticsearch-extra
"""
es = _get_instance(hosts, profile)
... | [
"def",
"info",
"(",
"hosts",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"es",
"=",
"_get_instance",
"(",
"hosts",
",",
"profile",
")",
"try",
":",
"return",
"es",
".",
"info",
"(",
")",
"except",
"elasticsearch",
".",
"TransportError",
"as",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/elasticsearch.py#L187-L208 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cherrypy/_cptools.py | python | Tool._setup | (self) | Hook this tool into cherrypy.request.
The standard CherryPy request object will automatically call this
method when the tool is "turned on" in config. | Hook this tool into cherrypy.request. | [
"Hook",
"this",
"tool",
"into",
"cherrypy",
".",
"request",
"."
] | def _setup(self):
"""Hook this tool into cherrypy.request.
The standard CherryPy request object will automatically call this
method when the tool is "turned on" in config.
"""
conf = self._merged_args()
p = conf.pop('priority', None)
if p is None:
p =... | [
"def",
"_setup",
"(",
"self",
")",
":",
"conf",
"=",
"self",
".",
"_merged_args",
"(",
")",
"p",
"=",
"conf",
".",
"pop",
"(",
"'priority'",
",",
"None",
")",
"if",
"p",
"is",
"None",
":",
"p",
"=",
"getattr",
"(",
"self",
".",
"callable",
",",
... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cherrypy/_cptools.py#L135-L146 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.py | python | HTTPHeaderDict.from_httplib | (cls, message) | return cls(headers) | Read headers from a Python 2 httplib message object. | Read headers from a Python 2 httplib message object. | [
"Read",
"headers",
"from",
"a",
"Python",
"2",
"httplib",
"message",
"object",
"."
] | def from_httplib(cls, message): # Python 2
"""Read headers from a Python 2 httplib message object."""
# python2.7 does not expose a proper API for exporting multiheaders
# efficiently. This function re-reads raw lines from the message
# object and extracts the multiheaders properly.
... | [
"def",
"from_httplib",
"(",
"cls",
",",
"message",
")",
":",
"# Python 2",
"# python2.7 does not expose a proper API for exporting multiheaders",
"# efficiently. This function re-reads raw lines from the message",
"# object and extracts the multiheaders properly.",
"obs_fold_continued_leader... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/urllib3/_collections.py#L307-L332 | |
vmware/pyvcloud | d72c615fa41b8ea5ab049a929e18d8ba6460fc59 | pyvcloud/vcd/gateway.py | python | Gateway.change_shared_key_ipsec_vpn | (self, shared_key) | Changes shared key.
:param str shared_key: shared key. | Changes shared key. | [
"Changes",
"shared",
"key",
"."
] | def change_shared_key_ipsec_vpn(self, shared_key):
"""Changes shared key.
:param str shared_key: shared key.
"""
ipsec_vpn = self.get_ipsec_vpn()
ip_sec_global = ipsec_vpn.xpath('global', namespaces=NSMAP)
ip_sec_global[0].psk = shared_key
self.client.put_resour... | [
"def",
"change_shared_key_ipsec_vpn",
"(",
"self",
",",
"shared_key",
")",
":",
"ipsec_vpn",
"=",
"self",
".",
"get_ipsec_vpn",
"(",
")",
"ip_sec_global",
"=",
"ipsec_vpn",
".",
"xpath",
"(",
"'global'",
",",
"namespaces",
"=",
"NSMAP",
")",
"ip_sec_global",
"... | https://github.com/vmware/pyvcloud/blob/d72c615fa41b8ea5ab049a929e18d8ba6460fc59/pyvcloud/vcd/gateway.py#L1281-L1292 | ||
e2nIEE/pandapower | 12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb | pandapower/pf/dSbus_dV_numba.py | python | dSbus_dV | (Ybus, V, I=None) | Calls functions to calculate dS/dV depending on whether Ybus is sparse or not | Calls functions to calculate dS/dV depending on whether Ybus is sparse or not | [
"Calls",
"functions",
"to",
"calculate",
"dS",
"/",
"dV",
"depending",
"on",
"whether",
"Ybus",
"is",
"sparse",
"or",
"not"
] | def dSbus_dV(Ybus, V, I=None):
"""
Calls functions to calculate dS/dV depending on whether Ybus is sparse or not
"""
if issparse(Ybus):
# I is substracted from Y*V,
# therefore it must be negative for numba version of dSbus_dV if it is not zeros anyways
I = zeros(len(V), dtype=c... | [
"def",
"dSbus_dV",
"(",
"Ybus",
",",
"V",
",",
"I",
"=",
"None",
")",
":",
"if",
"issparse",
"(",
"Ybus",
")",
":",
"# I is substracted from Y*V,",
"# therefore it must be negative for numba version of dSbus_dV if it is not zeros anyways",
"I",
"=",
"zeros",
"(",
"len... | https://github.com/e2nIEE/pandapower/blob/12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb/pandapower/pf/dSbus_dV_numba.py#L67-L82 | ||
modin-project/modin | 0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee | modin/core/dataframe/pandas/partitioning/partition_manager.py | python | PandasDataframePartitionManager.from_arrow | (cls, at, return_dims=False) | return cls.from_pandas(at.to_pandas(), return_dims=return_dims) | Return the partitions from Apache Arrow (PyArrow).
Parameters
----------
at : pyarrow.table
Arrow Table.
return_dims : bool, default: False
If it's True, return as (np.ndarray, row_lengths, col_widths),
else np.ndarray.
Returns
------... | Return the partitions from Apache Arrow (PyArrow). | [
"Return",
"the",
"partitions",
"from",
"Apache",
"Arrow",
"(",
"PyArrow",
")",
"."
] | def from_arrow(cls, at, return_dims=False):
"""
Return the partitions from Apache Arrow (PyArrow).
Parameters
----------
at : pyarrow.table
Arrow Table.
return_dims : bool, default: False
If it's True, return as (np.ndarray, row_lengths, col_width... | [
"def",
"from_arrow",
"(",
"cls",
",",
"at",
",",
"return_dims",
"=",
"False",
")",
":",
"return",
"cls",
".",
"from_pandas",
"(",
"at",
".",
"to_pandas",
"(",
")",
",",
"return_dims",
"=",
"return_dims",
")"
] | https://github.com/modin-project/modin/blob/0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee/modin/core/dataframe/pandas/partitioning/partition_manager.py#L772-L789 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/utils/ui.py | python | InterruptibleMixin.__init__ | (self, *args, **kwargs) | Save the original SIGINT handler for later. | Save the original SIGINT handler for later. | [
"Save",
"the",
"original",
"SIGINT",
"handler",
"for",
"later",
"."
] | def __init__(self, *args, **kwargs):
"""
Save the original SIGINT handler for later.
"""
super(InterruptibleMixin, self).__init__(*args, **kwargs)
self.original_handler = signal(SIGINT, self.handle_sigint)
# If signal() returns None, the previous handler was not install... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"InterruptibleMixin",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"original_handler",
"=",
"signal"... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/utils/ui.py#L84-L98 | ||
dropbox/nsot | 941b11f84f5c0d210f638654a6ed34a5610af22a | nsot/api/filters.py | python | NetworkFilter.filter_root_only | (self, queryset, name, value) | return queryset | Converts ``root_only`` to null parent filter. | Converts ``root_only`` to null parent filter. | [
"Converts",
"root_only",
"to",
"null",
"parent",
"filter",
"."
] | def filter_root_only(self, queryset, name, value):
"""Converts ``root_only`` to null parent filter."""
if qpbool(value):
return queryset.filter(parent=None)
return queryset | [
"def",
"filter_root_only",
"(",
"self",
",",
"queryset",
",",
"name",
",",
"value",
")",
":",
"if",
"qpbool",
"(",
"value",
")",
":",
"return",
"queryset",
".",
"filter",
"(",
"parent",
"=",
"None",
")",
"return",
"queryset"
] | https://github.com/dropbox/nsot/blob/941b11f84f5c0d210f638654a6ed34a5610af22a/nsot/api/filters.py#L118-L122 | |
mysql/mysql-connector-python | c5460bcbb0dff8e4e48bf4af7a971c89bf486d85 | lib/mysql/connector/connection.py | python | MySQLConnection.info_query | (self, query) | return cursor.fetchone() | Send a query which only returns 1 row | Send a query which only returns 1 row | [
"Send",
"a",
"query",
"which",
"only",
"returns",
"1",
"row"
] | def info_query(self, query):
"""Send a query which only returns 1 row"""
cursor = self.cursor(buffered=True)
cursor.execute(query)
return cursor.fetchone() | [
"def",
"info_query",
"(",
"self",
",",
"query",
")",
":",
"cursor",
"=",
"self",
".",
"cursor",
"(",
"buffered",
"=",
"True",
")",
"cursor",
".",
"execute",
"(",
"query",
")",
"return",
"cursor",
".",
"fetchone",
"(",
")"
] | https://github.com/mysql/mysql-connector-python/blob/c5460bcbb0dff8e4e48bf4af7a971c89bf486d85/lib/mysql/connector/connection.py#L1270-L1274 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/email/_header_value_parser.py | python | Mailbox.domain | (self) | return self[0].domain | [] | def domain(self):
return self[0].domain | [
"def",
"domain",
"(",
"self",
")",
":",
"return",
"self",
"[",
"0",
"]",
".",
"domain"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/email/_header_value_parser.py#L469-L470 | |||
tdamdouni/Pythonista | 3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad | markdown/markdown2pdf/reportlab/graphics/charts/lineplots.py | python | LinePlot.calcPositions | (self) | Works out where they go.
Sets an attribute _positions which is a list of
lists of (x, y) matching the data. | Works out where they go. | [
"Works",
"out",
"where",
"they",
"go",
"."
] | def calcPositions(self):
"""Works out where they go.
Sets an attribute _positions which is a list of
lists of (x, y) matching the data.
"""
self._seriesCount = len(self.data)
self._rowLength = max(list(map(len,self.data)))
self._positions = []
for rowNo... | [
"def",
"calcPositions",
"(",
"self",
")",
":",
"self",
".",
"_seriesCount",
"=",
"len",
"(",
"self",
".",
"data",
")",
"self",
".",
"_rowLength",
"=",
"max",
"(",
"list",
"(",
"map",
"(",
"len",
",",
"self",
".",
"data",
")",
")",
")",
"self",
".... | https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/markdown/markdown2pdf/reportlab/graphics/charts/lineplots.py#L179-L200 | ||
blaze/odo | 9fce6690b3666160681833540de6c55e922de5eb | odo/utils.py | python | write | (triple, writer) | return i, filename | Write a file using the input from `gentemp` using `writer` and return
its index and filename.
Parameters
----------
triple : tuple of int, str, str
The first element is the index in the set of chunks of a file, the
second element is the path to write to, the third element is the data
... | Write a file using the input from `gentemp` using `writer` and return
its index and filename. | [
"Write",
"a",
"file",
"using",
"the",
"input",
"from",
"gentemp",
"using",
"writer",
"and",
"return",
"its",
"index",
"and",
"filename",
"."
] | def write(triple, writer):
"""Write a file using the input from `gentemp` using `writer` and return
its index and filename.
Parameters
----------
triple : tuple of int, str, str
The first element is the index in the set of chunks of a file, the
second element is the path to write to... | [
"def",
"write",
"(",
"triple",
",",
"writer",
")",
":",
"i",
",",
"filename",
",",
"data",
"=",
"triple",
"with",
"writer",
"(",
"filename",
",",
"mode",
"=",
"'wb'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"data",
")",
"return",
"i",
",",
... | https://github.com/blaze/odo/blob/9fce6690b3666160681833540de6c55e922de5eb/odo/utils.py#L305-L331 | |
thaines/helit | 04bd36ee0fb6b762c63d746e2cd8813641dceda9 | video/seq_make.py | python | num_to_seq | (fn, loader) | return Seq(seq) | Given a filename of the form 'directory/start#end' finds all files that match the given form, where # is an arbitrary number. The files are sorted into numerical order, and each is loaded using the provided loader (ReadCV for instance - constructor should take a single filename.), a Seq object is then created. This in ... | Given a filename of the form 'directory/start#end' finds all files that match the given form, where # is an arbitrary number. The files are sorted into numerical order, and each is loaded using the provided loader (ReadCV for instance - constructor should take a single filename.), a Seq object is then created. This in ... | [
"Given",
"a",
"filename",
"of",
"the",
"form",
"directory",
"/",
"start#end",
"finds",
"all",
"files",
"that",
"match",
"the",
"given",
"form",
"where",
"#",
"is",
"an",
"arbitrary",
"number",
".",
"The",
"files",
"are",
"sorted",
"into",
"numerical",
"ord... | def num_to_seq(fn, loader):
"""Given a filename of the form 'directory/start#end' finds all files that match the given form, where # is an arbitrary number. The files are sorted into numerical order, and each is loaded using the provided loader (ReadCV for instance - constructor should take a single filename.), a Seq... | [
"def",
"num_to_seq",
"(",
"fn",
",",
"loader",
")",
":",
"# Break the given filename form into its basic parts...",
"path",
",",
"fn",
"=",
"os",
".",
"path",
".",
"split",
"(",
"fn",
")",
"start",
",",
"end",
"=",
"map",
"(",
"lambda",
"s",
":",
"s",
".... | https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/video/seq_make.py#L25-L50 | |
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/calculators/export/risk.py | python | export_aggrisk | (ekey, dstore) | return [dest] | :param ekey: export key, i.e. a pair (datastore key, fmt)
:param dstore: datastore object | :param ekey: export key, i.e. a pair (datastore key, fmt)
:param dstore: datastore object | [
":",
"param",
"ekey",
":",
"export",
"key",
"i",
".",
"e",
".",
"a",
"pair",
"(",
"datastore",
"key",
"fmt",
")",
":",
"param",
"dstore",
":",
"datastore",
"object"
] | def export_aggrisk(ekey, dstore):
"""
:param ekey: export key, i.e. a pair (datastore key, fmt)
:param dstore: datastore object
"""
oq = dstore['oqparam']
tagnames = oq.aggregate_by
writer = writers.CsvWriter(fmt=writers.FIVEDIGITS)
tagcol = dstore['assetcol/tagcol']
aggtags = list(t... | [
"def",
"export_aggrisk",
"(",
"ekey",
",",
"dstore",
")",
":",
"oq",
"=",
"dstore",
"[",
"'oqparam'",
"]",
"tagnames",
"=",
"oq",
".",
"aggregate_by",
"writer",
"=",
"writers",
".",
"CsvWriter",
"(",
"fmt",
"=",
"writers",
".",
"FIVEDIGITS",
")",
"tagcol... | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/calculators/export/risk.py#L75-L122 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/nlp/sentiment/scores.py | python | SentimentScores.positivity | (self, score, client_context=None) | [] | def positivity(self, score, client_context=None):
del client_context
# Score between -1.0 and 1.0
if score < -0.9:
return "EXTREMELY NEGATIVE"
elif score > -0.9 and score <= -0.7:
return "VERY NEGATIVE"
elif score > -0.7 and score <= -0.5:
r... | [
"def",
"positivity",
"(",
"self",
",",
"score",
",",
"client_context",
"=",
"None",
")",
":",
"del",
"client_context",
"# Score between -1.0 and 1.0",
"if",
"score",
"<",
"-",
"0.9",
":",
"return",
"\"EXTREMELY NEGATIVE\"",
"elif",
"score",
">",
"-",
"0.9",
"a... | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/nlp/sentiment/scores.py#L21-L59 | ||||
holland-backup/holland | 77dcfe9f23d4254e4c351cdc18f29a8d34945812 | holland/core/backup/base.py | python | load_plugin | (name, config, path, dry_run) | Method to load plugins | Method to load plugins | [
"Method",
"to",
"load",
"plugins"
] | def load_plugin(name, config, path, dry_run):
"""
Method to load plugins
"""
try:
plugin_cls = load_backup_plugin(config["holland:backup"]["plugin"])
except KeyError:
raise BackupError("No plugin defined for backupset '%s'." % name)
except PluginLoadError as exc:
raise Ba... | [
"def",
"load_plugin",
"(",
"name",
",",
"config",
",",
"path",
",",
"dry_run",
")",
":",
"try",
":",
"plugin_cls",
"=",
"load_backup_plugin",
"(",
"config",
"[",
"\"holland:backup\"",
"]",
"[",
"\"plugin\"",
"]",
")",
"except",
"KeyError",
":",
"raise",
"B... | https://github.com/holland-backup/holland/blob/77dcfe9f23d4254e4c351cdc18f29a8d34945812/holland/core/backup/base.py#L61-L81 | ||
explosion/spaCy | a784b12eff48df9281b184cb7005e66bbd2e3aca | spacy/util.py | python | find_matching_language | (lang: str) | Given an IETF language code, find a supported spaCy language that is a
close match for it (according to Unicode CLDR language-matching rules).
This allows for language aliases, ISO 639-2 codes, more detailed language
tags, and close matches.
Returns the language code if a matching language is available... | Given an IETF language code, find a supported spaCy language that is a
close match for it (according to Unicode CLDR language-matching rules).
This allows for language aliases, ISO 639-2 codes, more detailed language
tags, and close matches. | [
"Given",
"an",
"IETF",
"language",
"code",
"find",
"a",
"supported",
"spaCy",
"language",
"that",
"is",
"a",
"close",
"match",
"for",
"it",
"(",
"according",
"to",
"Unicode",
"CLDR",
"language",
"-",
"matching",
"rules",
")",
".",
"This",
"allows",
"for",
... | def find_matching_language(lang: str) -> Optional[str]:
"""
Given an IETF language code, find a supported spaCy language that is a
close match for it (according to Unicode CLDR language-matching rules).
This allows for language aliases, ISO 639-2 codes, more detailed language
tags, and close matches... | [
"def",
"find_matching_language",
"(",
"lang",
":",
"str",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"import",
"spacy",
".",
"lang",
"# noqa: F401",
"if",
"lang",
"==",
"\"xx\"",
":",
"return",
"\"xx\"",
"# Find out which language modules we have",
"possible_lan... | https://github.com/explosion/spaCy/blob/a784b12eff48df9281b184cb7005e66bbd2e3aca/spacy/util.py#L263-L315 | ||
man-group/arctic | 004983367acd4b5fcc5d034cb275389fe09dc9d0 | arctic/serialization/numpy_records.py | python | PandasSerializer.fast_check_serializable | (self, df) | return arr, {f: dtype[f] for f in dtype.names} | Convert efficiently the frame's object-columns/object-index/multi-index/multi-column to
records, by creating a recarray only for the object fields instead for the whole dataframe.
If we have no object dtypes, we can safely convert only the first row to recarray to test if serializable.
Previousl... | Convert efficiently the frame's object-columns/object-index/multi-index/multi-column to
records, by creating a recarray only for the object fields instead for the whole dataframe.
If we have no object dtypes, we can safely convert only the first row to recarray to test if serializable.
Previousl... | [
"Convert",
"efficiently",
"the",
"frame",
"s",
"object",
"-",
"columns",
"/",
"object",
"-",
"index",
"/",
"multi",
"-",
"index",
"/",
"multi",
"-",
"column",
"to",
"records",
"by",
"creating",
"a",
"recarray",
"only",
"for",
"the",
"object",
"fields",
"... | def fast_check_serializable(self, df):
"""
Convert efficiently the frame's object-columns/object-index/multi-index/multi-column to
records, by creating a recarray only for the object fields instead for the whole dataframe.
If we have no object dtypes, we can safely convert only the first... | [
"def",
"fast_check_serializable",
"(",
"self",
",",
"df",
")",
":",
"i_dtype",
",",
"f_dtypes",
"=",
"df",
".",
"index",
".",
"dtype",
",",
"df",
".",
"dtypes",
"index_has_object",
"=",
"df",
".",
"index",
".",
"dtype",
"is",
"NP_OBJECT_DTYPE",
"fields_wit... | https://github.com/man-group/arctic/blob/004983367acd4b5fcc5d034cb275389fe09dc9d0/arctic/serialization/numpy_records.py#L161-L189 | |
great-expectations/great_expectations | 45224cb890aeae725af25905923d0dbbab2d969d | great_expectations/execution_engine/pandas_execution_engine.py | python | PandasExecutionEngine._split_on_divided_integer | (
df, column_name: str, divisor: int, batch_identifiers: dict
) | return df[matching_rows] | Divide the values in the named column by `divisor`, and split on that | Divide the values in the named column by `divisor`, and split on that | [
"Divide",
"the",
"values",
"in",
"the",
"named",
"column",
"by",
"divisor",
"and",
"split",
"on",
"that"
] | def _split_on_divided_integer(
df, column_name: str, divisor: int, batch_identifiers: dict
):
"""Divide the values in the named column by `divisor`, and split on that"""
matching_divisor = batch_identifiers[column_name]
matching_rows = df[column_name].map(
lambda x: int(... | [
"def",
"_split_on_divided_integer",
"(",
"df",
",",
"column_name",
":",
"str",
",",
"divisor",
":",
"int",
",",
"batch_identifiers",
":",
"dict",
")",
":",
"matching_divisor",
"=",
"batch_identifiers",
"[",
"column_name",
"]",
"matching_rows",
"=",
"df",
"[",
... | https://github.com/great-expectations/great_expectations/blob/45224cb890aeae725af25905923d0dbbab2d969d/great_expectations/execution_engine/pandas_execution_engine.py#L682-L692 | |
tensorflow/tensorboard | 61d11d99ef034c30ba20b6a7840c8eededb9031c | tensorboard/plugins/hparams/_keras.py | python | Callback.__init__ | (self, writer, hparams, trial_id=None) | Create a callback for logging hyperparameters to TensorBoard.
As with the standard `tf.keras.callbacks.TensorBoard` class, each
callback object is valid for only one call to `model.fit`.
Args:
writer: The `SummaryWriter` object to which hparams should be
written, or a log... | Create a callback for logging hyperparameters to TensorBoard. | [
"Create",
"a",
"callback",
"for",
"logging",
"hyperparameters",
"to",
"TensorBoard",
"."
] | def __init__(self, writer, hparams, trial_id=None):
"""Create a callback for logging hyperparameters to TensorBoard.
As with the standard `tf.keras.callbacks.TensorBoard` class, each
callback object is valid for only one call to `model.fit`.
Args:
writer: The `SummaryWriter` ... | [
"def",
"__init__",
"(",
"self",
",",
"writer",
",",
"hparams",
",",
"trial_id",
"=",
"None",
")",
":",
"# Defer creating the actual summary until we write it, so that the",
"# timestamp is correct. But create a \"dry-run\" first to fail fast in",
"# case the `hparams` are invalid.",
... | https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/plugins/hparams/_keras.py#L34-L70 | ||
cbrgm/telegram-robot-rss | 58fe98de427121fdc152c8df0721f1891174e6c9 | venv/lib/python2.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/url.py | python | parse_url | (url) | return Url(scheme, auth, host, port, path, query, fragment) | Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is
performed to parse incomplete urls. Fields not provided will be None.
Partly backwards-compatible with :mod:`urlparse`.
Example::
>>> parse_url('http://google.com/mail/')
Url(scheme='http', host='google.com', port=None,... | Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is
performed to parse incomplete urls. Fields not provided will be None. | [
"Given",
"a",
"url",
"return",
"a",
"parsed",
":",
"class",
":",
".",
"Url",
"namedtuple",
".",
"Best",
"-",
"effort",
"is",
"performed",
"to",
"parse",
"incomplete",
"urls",
".",
"Fields",
"not",
"provided",
"will",
"be",
"None",
"."
] | def parse_url(url):
"""
Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is
performed to parse incomplete urls. Fields not provided will be None.
Partly backwards-compatible with :mod:`urlparse`.
Example::
>>> parse_url('http://google.com/mail/')
Url(scheme='http... | [
"def",
"parse_url",
"(",
"url",
")",
":",
"# While this code has overlap with stdlib's urlparse, it is much",
"# simplified for our needs and less annoying.",
"# Additionally, this implementations does silly things to be optimal",
"# on CPython.",
"if",
"not",
"url",
":",
"# Empty",
"r... | https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/url.py#L128-L218 | |
plasticityai/magnitude | 7ac0baeaf181263b661c3ae00643d21e3fd90216 | pymagnitude/third_party/allennlp/nn/util.py | python | weighted_sum | (matrix , attention ) | return intermediate.sum(dim=-2) | u"""
Takes a matrix of vectors and a set of weights over the rows in the matrix (which we call an
"attention" vector), and returns a weighted sum of the rows in the matrix. This is the typical
computation performed after an attention mechanism.
Note that while we call this a "matrix" of vectors and an... | u"""
Takes a matrix of vectors and a set of weights over the rows in the matrix (which we call an
"attention" vector), and returns a weighted sum of the rows in the matrix. This is the typical
computation performed after an attention mechanism. | [
"u",
"Takes",
"a",
"matrix",
"of",
"vectors",
"and",
"a",
"set",
"of",
"weights",
"over",
"the",
"rows",
"in",
"the",
"matrix",
"(",
"which",
"we",
"call",
"an",
"attention",
"vector",
")",
"and",
"returns",
"a",
"weighted",
"sum",
"of",
"the",
"rows",... | def weighted_sum(matrix , attention ) :
u"""
Takes a matrix of vectors and a set of weights over the rows in the matrix (which we call an
"attention" vector), and returns a weighted sum of the rows in the matrix. This is the typical
computation performed after a... | [
"def",
"weighted_sum",
"(",
"matrix",
",",
"attention",
")",
":",
"# We'll special-case a few settings here, where there are efficient (but poorly-named)",
"# operations in pytorch that already do the computation we need.",
"if",
"attention",
".",
"dim",
"(",
")",
"==",
"2",
"and... | https://github.com/plasticityai/magnitude/blob/7ac0baeaf181263b661c3ae00643d21e3fd90216/pymagnitude/third_party/allennlp/nn/util.py#L470-L506 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/protobuf/homo_model_convert/component_converter.py | python | ComponentConverterBase.get_target_modules | () | return [] | Returns the component model type that this converter supports. | Returns the component model type that this converter supports. | [
"Returns",
"the",
"component",
"model",
"type",
"that",
"this",
"converter",
"supports",
"."
] | def get_target_modules():
"""Returns the component model type that this converter supports.
"""
return [] | [
"def",
"get_target_modules",
"(",
")",
":",
"return",
"[",
"]"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/protobuf/homo_model_convert/component_converter.py#L26-L29 | |
p2pool/p2pool | 53c438bbada06b9d4a9a465bc13f7694a7a322b7 | SOAPpy/Types.py | python | simplify | (object, level=0) | Convert the SOAPpy objects and their contents to simple python types.
This function recursively converts the passed 'container' object,
and all public subobjects. (Private subobjects have names that
start with '_'.)
Conversions:
- faultType --> raise python exception
- arrayType --> ... | Convert the SOAPpy objects and their contents to simple python types. | [
"Convert",
"the",
"SOAPpy",
"objects",
"and",
"their",
"contents",
"to",
"simple",
"python",
"types",
"."
] | def simplify(object, level=0):
"""
Convert the SOAPpy objects and their contents to simple python types.
This function recursively converts the passed 'container' object,
and all public subobjects. (Private subobjects have names that
start with '_'.)
Conversions:
- faultType --> rai... | [
"def",
"simplify",
"(",
"object",
",",
"level",
"=",
"0",
")",
":",
"if",
"level",
">",
"10",
":",
"return",
"object",
"if",
"isinstance",
"(",
"object",
",",
"faultType",
")",
":",
"if",
"object",
".",
"faultstring",
"==",
"\"Required Header Misunderstood... | https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/SOAPpy/Types.py#L1649-L1700 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_url | (self, url, params) | Prepares the given HTTP URL. | Prepares the given HTTP URL. | [
"Prepares",
"the",
"given",
"HTTP",
"URL",
"."
] | def prepare_url(self, url, params):
"""Prepares the given HTTP URL."""
#: Accept objects that have string representations.
#: We're unable to blindly call unicode/str functions
#: as this will include the bytestring indicator (b'')
#: on python 3.x.
#: https://github.com/... | [
"def",
"prepare_url",
"(",
"self",
",",
"url",
",",
"params",
")",
":",
"#: Accept objects that have string representations.",
"#: We're unable to blindly call unicode/str functions",
"#: as this will include the bytestring indicator (b'')",
"#: on python 3.x.",
"#: https://github.com/re... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/requests/models.py#L351-L435 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_openshift_3.2/library/oc_service.py | python | Utils.check_def_equal | (user_def, result_def, skip_keys=None, debug=False) | return True | Given a user defined definition, compare it with the results given back by our query. | Given a user defined definition, compare it with the results given back by our query. | [
"Given",
"a",
"user",
"defined",
"definition",
"compare",
"it",
"with",
"the",
"results",
"given",
"back",
"by",
"our",
"query",
"."
] | def check_def_equal(user_def, result_def, skip_keys=None, debug=False):
''' Given a user defined definition, compare it with the results given back by our query. '''
# Currently these values are autogenerated and we do not need to check them
skip = ['metadata', 'status']
if skip_keys:
... | [
"def",
"check_def_equal",
"(",
"user_def",
",",
"result_def",
",",
"skip_keys",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"# Currently these values are autogenerated and we do not need to check them",
"skip",
"=",
"[",
"'metadata'",
",",
"'status'",
"]",
"if"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oc_service.py#L361-L453 | |
XiaoMi/kaldi-onnx | e820292ad6dcf1c55a7f3affa98d335805aa995e | converter/node.py | python | PerEltScaleNode.inference_dim | (self, dims_by_name, nodes_by_name) | [] | def inference_dim(self, dims_by_name, nodes_by_name):
if 'output_dim' in self.attrs:
output_dim = self.attrs['output_dim']
else:
kaldi_check(len(self.inputs) >= 2,
"PerEltScale(%s) should have at least 2 inputs." %
self.name)
... | [
"def",
"inference_dim",
"(",
"self",
",",
"dims_by_name",
",",
"nodes_by_name",
")",
":",
"if",
"'output_dim'",
"in",
"self",
".",
"attrs",
":",
"output_dim",
"=",
"self",
".",
"attrs",
"[",
"'output_dim'",
"]",
"else",
":",
"kaldi_check",
"(",
"len",
"(",... | https://github.com/XiaoMi/kaldi-onnx/blob/e820292ad6dcf1c55a7f3affa98d335805aa995e/converter/node.py#L1010-L1024 | ||||
xiadingZ/video-caption.pytorch | 0597647c9f1f756202ba7ff9898ad0a26847480f | coco-caption/pycocoevalcap/cider/cider.py | python | Cider.__init__ | (self, test=None, refs=None, n=4, sigma=6.0) | [] | def __init__(self, test=None, refs=None, n=4, sigma=6.0):
# set cider to sum over 1 to 4-grams
self._n = n
# set the standard deviation parameter for gaussian penalty
self._sigma = sigma | [
"def",
"__init__",
"(",
"self",
",",
"test",
"=",
"None",
",",
"refs",
"=",
"None",
",",
"n",
"=",
"4",
",",
"sigma",
"=",
"6.0",
")",
":",
"# set cider to sum over 1 to 4-grams",
"self",
".",
"_n",
"=",
"n",
"# set the standard deviation parameter for gaussia... | https://github.com/xiadingZ/video-caption.pytorch/blob/0597647c9f1f756202ba7ff9898ad0a26847480f/coco-caption/pycocoevalcap/cider/cider.py#L18-L22 | ||||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/eventlet-0.24.1/eventlet/debug.py | python | unspew | () | Remove the trace hook installed by spew. | Remove the trace hook installed by spew. | [
"Remove",
"the",
"trace",
"hook",
"installed",
"by",
"spew",
"."
] | def unspew():
"""Remove the trace hook installed by spew.
"""
sys.settrace(None) | [
"def",
"unspew",
"(",
")",
":",
"sys",
".",
"settrace",
"(",
"None",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/eventlet-0.24.1/eventlet/debug.py#L66-L69 | ||
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/visualization/timeline/core.py | python | DrawerCanvas._check_bit_visible | (self, bit: types.Bits) | return False | A helper function to check if the bit is visible.
Args:
bit: Bit object to test.
Returns:
Return `True` if the bit is visible. | A helper function to check if the bit is visible. | [
"A",
"helper",
"function",
"to",
"check",
"if",
"the",
"bit",
"is",
"visible",
"."
] | def _check_bit_visible(self, bit: types.Bits) -> bool:
"""A helper function to check if the bit is visible.
Args:
bit: Bit object to test.
Returns:
Return `True` if the bit is visible.
"""
_gates = [str(types.BoxType.SCHED_GATE.value), str(types.SymbolTy... | [
"def",
"_check_bit_visible",
"(",
"self",
",",
"bit",
":",
"types",
".",
"Bits",
")",
"->",
"bool",
":",
"_gates",
"=",
"[",
"str",
"(",
"types",
".",
"BoxType",
".",
"SCHED_GATE",
".",
"value",
")",
",",
"str",
"(",
"types",
".",
"SymbolType",
".",
... | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/visualization/timeline/core.py#L315-L335 | |
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/core/machine.py | python | MachineController.create_data_manager | (self, config_name: str) | return DataManager(self, config_name) | Return a new DataManager for a certain config.
Args:
----
config_name: Name of the config | Return a new DataManager for a certain config. | [
"Return",
"a",
"new",
"DataManager",
"for",
"a",
"certain",
"config",
"."
] | def create_data_manager(self, config_name: str) -> DataManager: # pragma: no cover
"""Return a new DataManager for a certain config.
Args:
----
config_name: Name of the config
"""
return DataManager(self, config_name) | [
"def",
"create_data_manager",
"(",
"self",
",",
"config_name",
":",
"str",
")",
"->",
"DataManager",
":",
"# pragma: no cover",
"return",
"DataManager",
"(",
"self",
",",
"config_name",
")"
] | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/core/machine.py#L408-L415 | |
dragonfly/dragonfly | a579b5eadf452e23b07d4caf27b402703b0012b7 | dragonfly/exd/domains.py | python | DiscreteEuclideanDomain._get_disc_domain_type | (self) | return "DiscEuc" | Prefix for __str__. Can be overridden by a child class. | Prefix for __str__. Can be overridden by a child class. | [
"Prefix",
"for",
"__str__",
".",
"Can",
"be",
"overridden",
"by",
"a",
"child",
"class",
"."
] | def _get_disc_domain_type(self):
""" Prefix for __str__. Can be overridden by a child class. """
return "DiscEuc" | [
"def",
"_get_disc_domain_type",
"(",
"self",
")",
":",
"return",
"\"DiscEuc\""
] | https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/exd/domains.py#L230-L232 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_toleration.py | python | V1Toleration.operator | (self, operator) | Sets the operator of this V1Toleration.
Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.
:param operator: The operator of this V1Tol... | Sets the operator of this V1Toleration.
Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category. | [
"Sets",
"the",
"operator",
"of",
"this",
"V1Toleration",
".",
"Operator",
"represents",
"a",
"key",
"s",
"relationship",
"to",
"the",
"value",
".",
"Valid",
"operators",
"are",
"Exists",
"and",
"Equal",
".",
"Defaults",
"to",
"Equal",
".",
"Exists",
"is",
... | def operator(self, operator):
"""
Sets the operator of this V1Toleration.
Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.
... | [
"def",
"operator",
"(",
"self",
",",
"operator",
")",
":",
"self",
".",
"_operator",
"=",
"operator"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_toleration.py#L113-L122 | ||
dgilland/pushjack | a42cb438510aee574a3c91caef947f563e844d20 | src/pushjack/gcm.py | python | GCMMessage._parse_message | (self) | Parse and filter :attr:`message` to set :attr:`data` and
:attr:`notification`. | Parse and filter :attr:`message` to set :attr:`data` and
:attr:`notification`. | [
"Parse",
"and",
"filter",
":",
"attr",
":",
"message",
"to",
"set",
":",
"attr",
":",
"data",
"and",
":",
"attr",
":",
"notification",
"."
] | def _parse_message(self):
"""Parse and filter :attr:`message` to set :attr:`data` and
:attr:`notification`.
"""
if not isinstance(self.message, dict):
self.data["message"] = self.message
else:
if "notification" in self.message:
self.notific... | [
"def",
"_parse_message",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"message",
",",
"dict",
")",
":",
"self",
".",
"data",
"[",
"\"message\"",
"]",
"=",
"self",
".",
"message",
"else",
":",
"if",
"\"notification\"",
"in",
"self... | https://github.com/dgilland/pushjack/blob/a42cb438510aee574a3c91caef947f563e844d20/src/pushjack/gcm.py#L207-L223 | ||
boston-dynamics/spot-sdk | 5ffa12e6943a47323c7279d86e30346868755f52 | python/examples/graph_nav_command_line/graph_nav_util.py | python | update_waypoints_and_edges | (graph, localization_id, do_print=True) | return name_to_id, edges | Update and print waypoint ids and edge ids. | Update and print waypoint ids and edge ids. | [
"Update",
"and",
"print",
"waypoint",
"ids",
"and",
"edge",
"ids",
"."
] | def update_waypoints_and_edges(graph, localization_id, do_print=True):
"""Update and print waypoint ids and edge ids."""
name_to_id = dict()
edges = dict()
short_code_to_count = {}
waypoint_to_timestamp = []
for waypoint in graph.waypoints:
# Determine the timestamp that this waypoint w... | [
"def",
"update_waypoints_and_edges",
"(",
"graph",
",",
"localization_id",
",",
"do_print",
"=",
"True",
")",
":",
"name_to_id",
"=",
"dict",
"(",
")",
"edges",
"=",
"dict",
"(",
")",
"short_code_to_count",
"=",
"{",
"}",
"waypoint_to_timestamp",
"=",
"[",
"... | https://github.com/boston-dynamics/spot-sdk/blob/5ffa12e6943a47323c7279d86e30346868755f52/python/examples/graph_nav_command_line/graph_nav_util.py#L58-L115 | |
coleifer/sqlite-web | ee63de31aa77510f1d9ef7bd412eafe3c54539c2 | sqlite_web/sqlite_web.py | python | install_auth_handler | (password) | [] | def install_auth_handler(password):
app.config['PASSWORD'] = password
@app.before_request
def check_password():
if not session.get('authorized') and request.path != '/login/' and \
not request.path.startswith(('/static/', '/favicon')):
flash('You must log-in to view the datab... | [
"def",
"install_auth_handler",
"(",
"password",
")",
":",
"app",
".",
"config",
"[",
"'PASSWORD'",
"]",
"=",
"password",
"@",
"app",
".",
"before_request",
"def",
"check_password",
"(",
")",
":",
"if",
"not",
"session",
".",
"get",
"(",
"'authorized'",
")"... | https://github.com/coleifer/sqlite-web/blob/ee63de31aa77510f1d9ef7bd412eafe3c54539c2/sqlite_web/sqlite_web.py#L804-L813 | ||||
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/frontends/art/io.py | python | _read_art_level_info | (
f, level_oct_offsets, level, coarse_grid=128, ncell0=None, root_level=None
) | return unitary_center, fl, iocts, nLevel, root_level | [] | def _read_art_level_info(
f, level_oct_offsets, level, coarse_grid=128, ncell0=None, root_level=None
):
pos = f.tell()
f.seek(level_oct_offsets[level])
# Get the info for this level, skip the rest
junk, nLevel, iOct = read_vector(f, "i", ">")
# fortran indices start at 1
# Skip all the oct... | [
"def",
"_read_art_level_info",
"(",
"f",
",",
"level_oct_offsets",
",",
"level",
",",
"coarse_grid",
"=",
"128",
",",
"ncell0",
"=",
"None",
",",
"root_level",
"=",
"None",
")",
":",
"pos",
"=",
"f",
".",
"tell",
"(",
")",
"f",
".",
"seek",
"(",
"lev... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/frontends/art/io.py#L298-L404 | |||
neulab/xnmt | d93f8f3710f986f36eb54e9ff3976a6b683da2a4 | xnmt/persistence.py | python | Serializable.__init__ | (self) | Initialize class, including allocation of DyNet parameters if needed.
The __init__() must always be annotated with @serializable_init. It's arguments are exactly those that can be
specified in a YAML config file. If the argument values are Serializable, they are initialized before being passed
to this clas... | Initialize class, including allocation of DyNet parameters if needed. | [
"Initialize",
"class",
"including",
"allocation",
"of",
"DyNet",
"parameters",
"if",
"needed",
"."
] | def __init__(self) -> None:
"""
Initialize class, including allocation of DyNet parameters if needed.
The __init__() must always be annotated with @serializable_init. It's arguments are exactly those that can be
specified in a YAML config file. If the argument values are Serializable, they are initiali... | [
"def",
"__init__",
"(",
"self",
")",
"->",
"None",
":",
"# attributes that are in the YAML file (never change this manually, use Serializable.save_processed_arg() instead)",
"self",
".",
"serialize_params",
"=",
"{",
"}"
] | https://github.com/neulab/xnmt/blob/d93f8f3710f986f36eb54e9ff3976a6b683da2a4/xnmt/persistence.py#L115-L126 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/phyloxml/_phyloxml.py | python | Events.get_duplications | (self) | return self.duplications | [] | def get_duplications(self): return self.duplications | [
"def",
"get_duplications",
"(",
"self",
")",
":",
"return",
"self",
".",
"duplications"
] | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/phyloxml/_phyloxml.py#L2060-L2060 | |||
bobbui/json-logging-python | efbe367527203a88e0fec9f81ccb2f1e9252b1bf | json_logging/framework/fastapi/implementation.py | python | FastAPIRequestInfoExtractor.get_remote_port | (self, request: starlette.requests.Request) | return request.client.port | [] | def get_remote_port(self, request: starlette.requests.Request):
return request.client.port | [
"def",
"get_remote_port",
"(",
"self",
",",
"request",
":",
"starlette",
".",
"requests",
".",
"Request",
")",
":",
"return",
"request",
".",
"client",
".",
"port"
] | https://github.com/bobbui/json-logging-python/blob/efbe367527203a88e0fec9f81ccb2f1e9252b1bf/json_logging/framework/fastapi/implementation.py#L116-L117 | |||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | opy/compiler2/ast.py | python | ListCompFor.getChildNodes | (self) | return tuple(nodelist) | [] | def getChildNodes(self):
nodelist = []
nodelist.append(self.assign)
nodelist.append(self.list)
nodelist.extend(flatten_nodes(self.ifs))
return tuple(nodelist) | [
"def",
"getChildNodes",
"(",
"self",
")",
":",
"nodelist",
"=",
"[",
"]",
"nodelist",
".",
"append",
"(",
"self",
".",
"assign",
")",
"nodelist",
".",
"append",
"(",
"self",
".",
"list",
")",
"nodelist",
".",
"extend",
"(",
"flatten_nodes",
"(",
"self"... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/opy/compiler2/ast.py#L867-L872 | |||
nipy/nipy | d16d268938dcd5c15748ca051532c21f57cf8a22 | nipy/modalities/fmri/design_matrix.py | python | DesignMatrix.write_csv | (self, path) | write self.matrix as a csv file with appropriate column names
Parameters
----------
path: string, path of the resulting csv file
Notes
-----
The frametimes are not written | write self.matrix as a csv file with appropriate column names | [
"write",
"self",
".",
"matrix",
"as",
"a",
"csv",
"file",
"with",
"appropriate",
"column",
"names"
] | def write_csv(self, path):
""" write self.matrix as a csv file with appropriate column names
Parameters
----------
path: string, path of the resulting csv file
Notes
-----
The frametimes are not written
"""
import csv
with open4csv(path, ... | [
"def",
"write_csv",
"(",
"self",
",",
"path",
")",
":",
"import",
"csv",
"with",
"open4csv",
"(",
"path",
",",
"\"w\"",
")",
"as",
"fid",
":",
"writer",
"=",
"csv",
".",
"writer",
"(",
"fid",
")",
"writer",
".",
"writerow",
"(",
"self",
".",
"names... | https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/modalities/fmri/design_matrix.py#L273-L288 | ||
Yelp/data_pipeline | e143a4031b0940e17b22cdf36db0b677b46e3975 | data_pipeline/schematizer_clientlib/schematizer.py | python | SchematizerClient.get_data_target_by_name | (self, data_target_name) | return self._get_data_target_by_name(data_target_name).to_result() | Get the data target of specified name.
Args:
data_target_name (str): The name of requested data target.
Returns:
(data_pipeline.schematizer_clientlib.models.data_target.DataTarget):
The requested data target. | Get the data target of specified name. | [
"Get",
"the",
"data",
"target",
"of",
"specified",
"name",
"."
] | def get_data_target_by_name(self, data_target_name):
"""Get the data target of specified name.
Args:
data_target_name (str): The name of requested data target.
Returns:
(data_pipeline.schematizer_clientlib.models.data_target.DataTarget):
The requested da... | [
"def",
"get_data_target_by_name",
"(",
"self",
",",
"data_target_name",
")",
":",
"return",
"self",
".",
"_get_data_target_by_name",
"(",
"data_target_name",
")",
".",
"to_result",
"(",
")"
] | https://github.com/Yelp/data_pipeline/blob/e143a4031b0940e17b22cdf36db0b677b46e3975/data_pipeline/schematizer_clientlib/schematizer.py#L935-L945 | |
graphite-project/whisper | 3ce395e2561daae852bbe292ee973bd559d21040 | whisper.py | python | enableDebug | () | Enable writing IO statistics to stdout | Enable writing IO statistics to stdout | [
"Enable",
"writing",
"IO",
"statistics",
"to",
"stdout"
] | def enableDebug():
""" Enable writing IO statistics to stdout """
global open, _open, debug, startBlock, endBlock
_open = open
class open(object):
def __init__(self, *args, **kwargs):
self.f = _open(*args, **kwargs)
self.writeCount = 0
self.readCount = 0
def __enter__(self):
re... | [
"def",
"enableDebug",
"(",
")",
":",
"global",
"open",
",",
"_open",
",",
"debug",
",",
"startBlock",
",",
"endBlock",
"_open",
"=",
"open",
"class",
"open",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
... | https://github.com/graphite-project/whisper/blob/3ce395e2561daae852bbe292ee973bd559d21040/whisper.py#L234-L273 | ||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/db/backends/base/introspection.py | python | BaseDatabaseIntrospection.__init__ | (self, connection) | [] | def __init__(self, connection):
self.connection = connection | [
"def",
"__init__",
"(",
"self",
",",
"connection",
")",
":",
"self",
".",
"connection",
"=",
"connection"
] | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/backends/base/introspection.py#L16-L17 | ||||
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/pwiki/WikiDocument.py | python | WikiDocument.renameWikiWord | (self, word, toWord) | Rename `word` to `toWord`.
Renames only one word and does not update the wiki text. Use
renameWikiWords to rename more than one word and/or update
references to `word` with `toWord` (modify text).
This function will update the page's title.
Note: `word` page should alr... | Rename `word` to `toWord`. | [
"Rename",
"word",
"to",
"toWord",
"."
] | def renameWikiWord(self, word, toWord):
"""Rename `word` to `toWord`.
Renames only one word and does not update the wiki text. Use
renameWikiWords to rename more than one word and/or update
references to `word` with `toWord` (modify text).
This function will update the ... | [
"def",
"renameWikiWord",
"(",
"self",
",",
"word",
",",
"toWord",
")",
":",
"# print u\"WikiDataManager.renameWikiWord: %r -> %r\" % (word, toWord)",
"langHelper",
"=",
"GetApp",
"(",
")",
".",
"createWikiLanguageHelper",
"(",
"self",
".",
"getWikiDefaultWikiLanguag... | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/pwiki/WikiDocument.py#L1750-L1852 | ||
pilotmoon/PopClip-Extensions | 29fc472befc09ee350092ac70283bd9fdb456cb6 | source/Trello/auth.py | python | get_session | (stored_access_token) | return get_oauth_service().get_session(json.loads(stored_access_token)) | called in main extension script to actually get a usable session | called in main extension script to actually get a usable session | [
"called",
"in",
"main",
"extension",
"script",
"to",
"actually",
"get",
"a",
"usable",
"session"
] | def get_session(stored_access_token):
""" called in main extension script to actually get a usable session """
return get_oauth_service().get_session(json.loads(stored_access_token)) | [
"def",
"get_session",
"(",
"stored_access_token",
")",
":",
"return",
"get_oauth_service",
"(",
")",
".",
"get_session",
"(",
"json",
".",
"loads",
"(",
"stored_access_token",
")",
")"
] | https://github.com/pilotmoon/PopClip-Extensions/blob/29fc472befc09ee350092ac70283bd9fdb456cb6/source/Trello/auth.py#L14-L16 | |
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/dependencies/ui.py | python | GLDependencySystem.__init__ | (self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]) | [] | def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> None:
super().__init__(name, environment, kwargs)
if self.env.machines[self.for_machine].is_darwin():
self.is_found = True
# FIXME: Use AppleFrameworks dependency
self.link_args ... | [
"def",
"__init__",
"(",
"self",
",",
"name",
":",
"str",
",",
"environment",
":",
"'Environment'",
",",
"kwargs",
":",
"T",
".",
"Dict",
"[",
"str",
",",
"T",
".",
"Any",
"]",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"name... | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/dependencies/ui.py#L37-L51 | ||||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/PIL/ImageOps.py | python | deform | (image, deformer, resample=Image.BILINEAR) | return image.transform(image.size, Image.MESH, deformer.getmesh(image), resample) | Deform the image.
:param image: The image to deform.
:param deformer: A deformer object. Any object that implements a
**getmesh** method can be used.
:param resample: An optional resampling filter. Same values possible as
in the PIL.Image.transform function.
:return: An imag... | Deform the image. | [
"Deform",
"the",
"image",
"."
] | def deform(image, deformer, resample=Image.BILINEAR):
"""
Deform the image.
:param image: The image to deform.
:param deformer: A deformer object. Any object that implements a
**getmesh** method can be used.
:param resample: An optional resampling filter. Same values possible a... | [
"def",
"deform",
"(",
"image",
",",
"deformer",
",",
"resample",
"=",
"Image",
".",
"BILINEAR",
")",
":",
"return",
"image",
".",
"transform",
"(",
"image",
".",
"size",
",",
"Image",
".",
"MESH",
",",
"deformer",
".",
"getmesh",
"(",
"image",
")",
"... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/PIL/ImageOps.py#L305-L316 | |
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/datastore/datastore_v4_pb.py | python | _DatastoreV4Service_ClientBaseStub.ContinueQuery | (self, request, rpc=None, callback=None, response=None) | return self._MakeCall(rpc,
self._full_name_ContinueQuery,
'ContinueQuery',
request,
response,
callback,
self._protorpc_ContinueQuery,
pack... | Make a ContinueQuery RPC call.
Args:
request: a ContinueQueryRequest instance.
rpc: Optional RPC instance to use for the call.
callback: Optional final callback. Will be called as
callback(rpc, result) when the rpc completes. If None, the
call is synchronous.
response: O... | Make a ContinueQuery RPC call. | [
"Make",
"a",
"ContinueQuery",
"RPC",
"call",
"."
] | def ContinueQuery(self, request, rpc=None, callback=None, response=None):
"""Make a ContinueQuery RPC call.
Args:
request: a ContinueQueryRequest instance.
rpc: Optional RPC instance to use for the call.
callback: Optional final callback. Will be called as
callback(rpc, result) when... | [
"def",
"ContinueQuery",
"(",
"self",
",",
"request",
",",
"rpc",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"response",
"=",
"None",
")",
":",
"if",
"response",
"is",
"None",
":",
"response",
"=",
"ContinueQueryResponse",
"return",
"self",
".",
"_Ma... | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/datastore/datastore_v4_pb.py#L7233-L7257 | |
pytroll/pyorbital | 1bf73c834befb6d7f060c636dae85bb91230a556 | versioneer.py | python | get_version | () | return get_versions()["version"] | Get the short version string for this project. | Get the short version string for this project. | [
"Get",
"the",
"short",
"version",
"string",
"for",
"this",
"project",
"."
] | def get_version():
"""Get the short version string for this project."""
return get_versions()["version"] | [
"def",
"get_version",
"(",
")",
":",
"return",
"get_versions",
"(",
")",
"[",
"\"version\"",
"]"
] | https://github.com/pytroll/pyorbital/blob/1bf73c834befb6d7f060c636dae85bb91230a556/versioneer.py#L1478-L1480 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/contrib/admin/options.py | python | ModelAdmin.get_changelist_formset | (self, request, **kwargs) | return modelformset_factory(self.model,
self.get_changelist_form(request), extra=0,
fields=self.list_editable, **defaults) | Returns a FormSet class for use on the changelist page if list_editable
is used. | Returns a FormSet class for use on the changelist page if list_editable
is used. | [
"Returns",
"a",
"FormSet",
"class",
"for",
"use",
"on",
"the",
"changelist",
"page",
"if",
"list_editable",
"is",
"used",
"."
] | def get_changelist_formset(self, request, **kwargs):
"""
Returns a FormSet class for use on the changelist page if list_editable
is used.
"""
defaults = {
"formfield_callback": partial(self.formfield_for_dbfield, request=request),
}
defaults.update(kwa... | [
"def",
"get_changelist_formset",
"(",
"self",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"defaults",
"=",
"{",
"\"formfield_callback\"",
":",
"partial",
"(",
"self",
".",
"formfield_for_dbfield",
",",
"request",
"=",
"request",
")",
",",
"}",
"defaul... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/admin/options.py#L492-L503 | |
Floobits/floobits-emacs | 93b3317fb6c842efe165e54c8a32bf51d436837d | floo/common/lib/diff_match_patch.py | python | diff_match_patch.diff_charsToLines | (self, diffs, lineArray) | Rehydrate the text in a diff from a string of line hashes to real lines
of text.
Args:
diffs: Array of diff tuples.
lineArray: Array of unique strings. | Rehydrate the text in a diff from a string of line hashes to real lines
of text. | [
"Rehydrate",
"the",
"text",
"in",
"a",
"diff",
"from",
"a",
"string",
"of",
"line",
"hashes",
"to",
"real",
"lines",
"of",
"text",
"."
] | def diff_charsToLines(self, diffs, lineArray):
"""Rehydrate the text in a diff from a string of line hashes to real lines
of text.
Args:
diffs: Array of diff tuples.
lineArray: Array of unique strings.
"""
for x in range(len(diffs)):
text = []... | [
"def",
"diff_charsToLines",
"(",
"self",
",",
"diffs",
",",
"lineArray",
")",
":",
"for",
"x",
"in",
"range",
"(",
"len",
"(",
"diffs",
")",
")",
":",
"text",
"=",
"[",
"]",
"for",
"char",
"in",
"diffs",
"[",
"x",
"]",
"[",
"1",
"]",
":",
"text... | https://github.com/Floobits/floobits-emacs/blob/93b3317fb6c842efe165e54c8a32bf51d436837d/floo/common/lib/diff_match_patch.py#L453-L465 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | scripts/xsslint/xsslint/django_linter.py | python | TransExpression.process_translation_string | (self, trans_expr) | return trans_var_name_used, trans_expr_msg | Process translation string into string and variable name used
Arguments:
trans_expr: Translation expression inside {% %}
Returns:
None | Process translation string into string and variable name used | [
"Process",
"translation",
"string",
"into",
"string",
"and",
"variable",
"name",
"used"
] | def process_translation_string(self, trans_expr):
"""
Process translation string into string and variable name used
Arguments:
trans_expr: Translation expression inside {% %}
Returns:
None
"""
quote = re.search(r"""\s*['"].*['"]\s*""", trans_expr... | [
"def",
"process_translation_string",
"(",
"self",
",",
"trans_expr",
")",
":",
"quote",
"=",
"re",
".",
"search",
"(",
"r\"\"\"\\s*['\"].*['\"]\\s*\"\"\"",
",",
"trans_expr",
",",
"re",
".",
"I",
")",
"if",
"not",
"quote",
":",
"_add_violations",
"(",
"self",
... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/scripts/xsslint/xsslint/django_linter.py#L55-L85 | |
deanishe/alfred-pwgen | 7966df5c5e05f2fca5b9406fb2a6116f7030608a | src/workflow/workflow3.py | python | Workflow3._default_datadir | (self) | return os.path.join(os.path.expanduser(
'~/Library/Application Support/Alfred/Workflow Data/'),
self.bundleid) | Alfred 4's default data directory. | Alfred 4's default data directory. | [
"Alfred",
"4",
"s",
"default",
"data",
"directory",
"."
] | def _default_datadir(self):
"""Alfred 4's default data directory."""
return os.path.join(os.path.expanduser(
'~/Library/Application Support/Alfred/Workflow Data/'),
self.bundleid) | [
"def",
"_default_datadir",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~/Library/Application Support/Alfred/Workflow Data/'",
")",
",",
"self",
".",
"bundleid",
")"
] | https://github.com/deanishe/alfred-pwgen/blob/7966df5c5e05f2fca5b9406fb2a6116f7030608a/src/workflow/workflow3.py#L487-L491 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/plat-mac/findertools.py | python | _getfinder | () | return _finder_talker | returns basic (recyclable) Finder AE interface object | returns basic (recyclable) Finder AE interface object | [
"returns",
"basic",
"(",
"recyclable",
")",
"Finder",
"AE",
"interface",
"object"
] | def _getfinder():
"""returns basic (recyclable) Finder AE interface object"""
global _finder_talker
if not _finder_talker:
_finder_talker = Finder.Finder()
_finder_talker.send_flags = ( _finder_talker.send_flags |
AppleEvents.kAECanInteract | AppleEvents.kAECanSwitchLayer)
return _fi... | [
"def",
"_getfinder",
"(",
")",
":",
"global",
"_finder_talker",
"if",
"not",
"_finder_talker",
":",
"_finder_talker",
"=",
"Finder",
".",
"Finder",
"(",
")",
"_finder_talker",
".",
"send_flags",
"=",
"(",
"_finder_talker",
".",
"send_flags",
"|",
"AppleEvents",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/plat-mac/findertools.py#L36-L43 | |
CyanideCN/PyCINRAD | f4bcc1f05e1355987b04f192caec4927ecb8e247 | cinrad/visualize/ppi.py | python | PPI.plot_range_rings | (
self,
_range: Union[int, float, list],
color: str = "white",
linewidth: Number_T = 0.5,
**kwargs
) | r"""Plot range rings on PPI plot. | r"""Plot range rings on PPI plot. | [
"r",
"Plot",
"range",
"rings",
"on",
"PPI",
"plot",
"."
] | def plot_range_rings(
self,
_range: Union[int, float, list],
color: str = "white",
linewidth: Number_T = 0.5,
**kwargs
):
r"""Plot range rings on PPI plot."""
slon, slat = self.data.site_longitude, self.data.site_latitude
if isinstance(_range, (int, fl... | [
"def",
"plot_range_rings",
"(",
"self",
",",
"_range",
":",
"Union",
"[",
"int",
",",
"float",
",",
"list",
"]",
",",
"color",
":",
"str",
"=",
"\"white\"",
",",
"linewidth",
":",
"Number_T",
"=",
"0.5",
",",
"*",
"*",
"kwargs",
")",
":",
"slon",
"... | https://github.com/CyanideCN/PyCINRAD/blob/f4bcc1f05e1355987b04f192caec4927ecb8e247/cinrad/visualize/ppi.py#L292-L314 | ||
google-research/tf-slim | e00575ad39d19112a4b1342930825258316cf233 | tf_slim/ops/variables.py | python | assign_from_checkpoint | (model_path, var_list, ignore_missing_vars=False) | return assign_op, feed_dict | Creates an operation to assign specific variables from a checkpoint.
Args:
model_path: The full path to the model checkpoint. To get latest checkpoint
use `model_path = tf.train.latest_checkpoint(checkpoint_dir)`
var_list: A list of (possibly partitioned) `Variable` objects or a
dictionary mappin... | Creates an operation to assign specific variables from a checkpoint. | [
"Creates",
"an",
"operation",
"to",
"assign",
"specific",
"variables",
"from",
"a",
"checkpoint",
"."
] | def assign_from_checkpoint(model_path, var_list, ignore_missing_vars=False):
"""Creates an operation to assign specific variables from a checkpoint.
Args:
model_path: The full path to the model checkpoint. To get latest checkpoint
use `model_path = tf.train.latest_checkpoint(checkpoint_dir)`
var_list... | [
"def",
"assign_from_checkpoint",
"(",
"model_path",
",",
"var_list",
",",
"ignore_missing_vars",
"=",
"False",
")",
":",
"# Normalize var_list into a dictionary mapping names in the",
"# checkpoint to the list of variables to initialize from that",
"# checkpoint variable. Sliced (includi... | https://github.com/google-research/tf-slim/blob/e00575ad39d19112a4b1342930825258316cf233/tf_slim/ops/variables.py#L593-L674 | |
tensorflow/mesh | 57ed4018e6a173952501b074daabad32b6449f3d | mesh_tensorflow/transformer/attention.py | python | AttentionParams.compute_output | (self, o, output_shape=None) | return mtf.layers.us_einsum(
[o, self.wo], output_shape=output_shape, reduced_dims=reduced_dims) | Compute output of multihead attention.
Args:
o: a Tensor with dimensions
query_heads_dims + {value_dim} + other_dims
output_shape: an optional Shape
Returns:
a Tensor with shape:
{output_dim} + other_dims | Compute output of multihead attention. | [
"Compute",
"output",
"of",
"multihead",
"attention",
"."
] | def compute_output(self, o, output_shape=None):
"""Compute output of multihead attention.
Args:
o: a Tensor with dimensions
query_heads_dims + {value_dim} + other_dims
output_shape: an optional Shape
Returns:
a Tensor with shape:
{output_dim} + other_dims
"""
if ... | [
"def",
"compute_output",
"(",
"self",
",",
"o",
",",
"output_shape",
"=",
"None",
")",
":",
"if",
"self",
".",
"combine_dims",
":",
"o",
"=",
"mtf",
".",
"transpose",
"(",
"o",
",",
"o",
".",
"shape",
"-",
"self",
".",
"o_dims",
"+",
"self",
".",
... | https://github.com/tensorflow/mesh/blob/57ed4018e6a173952501b074daabad32b6449f3d/mesh_tensorflow/transformer/attention.py#L575-L597 | |
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/ext/ndb/model.py | python | Property._is_initialized | (self, entity) | return (not self._required or
((self._has_value(entity) or self._default is not None) and
self._get_value(entity) is not None)) | Internal helper to ask if the entity has a value for this Property.
This returns False if a value is stored but it is None. | Internal helper to ask if the entity has a value for this Property. | [
"Internal",
"helper",
"to",
"ask",
"if",
"the",
"entity",
"has",
"a",
"value",
"for",
"this",
"Property",
"."
] | def _is_initialized(self, entity):
"""Internal helper to ask if the entity has a value for this Property.
This returns False if a value is stored but it is None.
"""
return (not self._required or
((self._has_value(entity) or self._default is not None) and
self._get_value(entity... | [
"def",
"_is_initialized",
"(",
"self",
",",
"entity",
")",
":",
"return",
"(",
"not",
"self",
".",
"_required",
"or",
"(",
"(",
"self",
".",
"_has_value",
"(",
"entity",
")",
"or",
"self",
".",
"_default",
"is",
"not",
"None",
")",
"and",
"self",
"."... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/ext/ndb/model.py#L1383-L1390 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/smtpd.py | python | SMTPChannel.smtp_RSET | (self, arg) | [] | def smtp_RSET(self, arg):
if arg:
self.push('501 Syntax: RSET')
return
# Resets the sender, recipients, and data, but not the greeting
self.__mailfrom = None
self.__rcpttos = []
self.__data = ''
self.__state = self.COMMAND
self.push('250 Ok... | [
"def",
"smtp_RSET",
"(",
"self",
",",
"arg",
")",
":",
"if",
"arg",
":",
"self",
".",
"push",
"(",
"'501 Syntax: RSET'",
")",
"return",
"# Resets the sender, recipients, and data, but not the greeting",
"self",
".",
"__mailfrom",
"=",
"None",
"self",
".",
"__rcptt... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/smtpd.py#L253-L262 | ||||
toxinu/pyhn | c36090e33ae730daa16c276e5f54c49baef2d8fe | pyhn/hnapi.py | python | HackerNewsAPI.get_source | (self, url) | Returns the HTML source code for a URL. | Returns the HTML source code for a URL. | [
"Returns",
"the",
"HTML",
"source",
"code",
"for",
"a",
"URL",
"."
] | def get_source(self, url):
"""
Returns the HTML source code for a URL.
"""
try:
r = requests.get(url, headers=HEADERS)
if r:
return r.text
except Exception:
raise HNException(
"Error getting source from " + url +... | [
"def",
"get_source",
"(",
"self",
",",
"url",
")",
":",
"try",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"headers",
"=",
"HEADERS",
")",
"if",
"r",
":",
"return",
"r",
".",
"text",
"except",
"Exception",
":",
"raise",
"HNException",
"... | https://github.com/toxinu/pyhn/blob/c36090e33ae730daa16c276e5f54c49baef2d8fe/pyhn/hnapi.py#L77-L89 | ||
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/_pydecimal.py | python | Context.copy_negate | (self, a) | return a.copy_negate() | Returns a copy of the operand with the sign inverted.
>>> ExtendedContext.copy_negate(Decimal('101.5'))
Decimal('-101.5')
>>> ExtendedContext.copy_negate(Decimal('-101.5'))
Decimal('101.5')
>>> ExtendedContext.copy_negate(1)
Decimal('-1') | Returns a copy of the operand with the sign inverted. | [
"Returns",
"a",
"copy",
"of",
"the",
"operand",
"with",
"the",
"sign",
"inverted",
"."
] | def copy_negate(self, a):
"""Returns a copy of the operand with the sign inverted.
>>> ExtendedContext.copy_negate(Decimal('101.5'))
Decimal('-101.5')
>>> ExtendedContext.copy_negate(Decimal('-101.5'))
Decimal('101.5')
>>> ExtendedContext.copy_negate(1)
Decimal('... | [
"def",
"copy_negate",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"copy_negate",
"(",
")"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/_pydecimal.py#L4317-L4328 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/sql/compiler.py | python | DDLCompiler.define_constraint_remote_table | (self, constraint, table, preparer) | return preparer.format_table(table) | Format the remote table clause of a CREATE CONSTRAINT clause. | Format the remote table clause of a CREATE CONSTRAINT clause. | [
"Format",
"the",
"remote",
"table",
"clause",
"of",
"a",
"CREATE",
"CONSTRAINT",
"clause",
"."
] | def define_constraint_remote_table(self, constraint, table, preparer):
"""Format the remote table clause of a CREATE CONSTRAINT clause."""
return preparer.format_table(table) | [
"def",
"define_constraint_remote_table",
"(",
"self",
",",
"constraint",
",",
"table",
",",
"preparer",
")",
":",
"return",
"preparer",
".",
"format_table",
"(",
"table",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/SQLAlchemy-1.3.17/lib/sqlalchemy/sql/compiler.py#L3231-L3234 | |
openstack/taskflow | 38b9011094dbcfdd00e6446393816201e8256d38 | taskflow/utils/threading_utils.py | python | ThreadBundle.__len__ | (self) | return len(self._threads) | Returns how many threads (to-be) are in this bundle. | Returns how many threads (to-be) are in this bundle. | [
"Returns",
"how",
"many",
"threads",
"(",
"to",
"-",
"be",
")",
"are",
"in",
"this",
"bundle",
"."
] | def __len__(self):
"""Returns how many threads (to-be) are in this bundle."""
return len(self._threads) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_threads",
")"
] | https://github.com/openstack/taskflow/blob/38b9011094dbcfdd00e6446393816201e8256d38/taskflow/utils/threading_utils.py#L163-L165 | |
mapnik/Cascadenik | 82f66859340a31dfcb24af127274f262d4f3ad85 | cascadenik/style.py | python | SelectorElement.countClasses | (self) | return len([n for n in self.names if n.startswith('.')]) | [] | def countClasses(self):
return len([n for n in self.names if n.startswith('.')]) | [
"def",
"countClasses",
"(",
"self",
")",
":",
"return",
"len",
"(",
"[",
"n",
"for",
"n",
"in",
"self",
".",
"names",
"if",
"n",
".",
"startswith",
"(",
"'.'",
")",
"]",
")"
] | https://github.com/mapnik/Cascadenik/blob/82f66859340a31dfcb24af127274f262d4f3ad85/cascadenik/style.py#L560-L561 | |||
thomasvs/morituri | 135b2f7bf27721177e3aeb1d26403f1b29116599 | morituri/common/program.py | python | Program.getRipResult | (self, cddbdiscid) | return self.result | Retrieve the persistable RipResult either from our cache (from a
previous, possibly aborted rip), or return a new one.
@rtype: L{result.RipResult} | Retrieve the persistable RipResult either from our cache (from a
previous, possibly aborted rip), or return a new one. | [
"Retrieve",
"the",
"persistable",
"RipResult",
"either",
"from",
"our",
"cache",
"(",
"from",
"a",
"previous",
"possibly",
"aborted",
"rip",
")",
"or",
"return",
"a",
"new",
"one",
"."
] | def getRipResult(self, cddbdiscid):
"""
Retrieve the persistable RipResult either from our cache (from a
previous, possibly aborted rip), or return a new one.
@rtype: L{result.RipResult}
"""
assert self.result is None
self._presult = self._cache.getRipResult(cdd... | [
"def",
"getRipResult",
"(",
"self",
",",
"cddbdiscid",
")",
":",
"assert",
"self",
".",
"result",
"is",
"None",
"self",
".",
"_presult",
"=",
"self",
".",
"_cache",
".",
"getRipResult",
"(",
"cddbdiscid",
")",
"self",
".",
"result",
"=",
"self",
".",
"... | https://github.com/thomasvs/morituri/blob/135b2f7bf27721177e3aeb1d26403f1b29116599/morituri/common/program.py#L187-L199 | |
debian-calibre/calibre | 020fc81d3936a64b2ac51459ecb796666ab6a051 | src/calibre/library/catalogs/epub_mobi_builder.py | python | CatalogBuilder.generate_html_genre_header | (self, title) | return soup | Generate HTML header with initial body content
Start with a generic HTML header, add <p> and <div>
Args:
title (str): document title
Return:
soup (BeautifulSoup): HTML with initial <p> and <div> tags | Generate HTML header with initial body content | [
"Generate",
"HTML",
"header",
"with",
"initial",
"body",
"content"
] | def generate_html_genre_header(self, title):
""" Generate HTML header with initial body content
Start with a generic HTML header, add <p> and <div>
Args:
title (str): document title
Return:
soup (BeautifulSoup): HTML with initial <p> and <div> tags
"""
... | [
"def",
"generate_html_genre_header",
"(",
"self",
",",
"title",
")",
":",
"soup",
"=",
"self",
".",
"generate_html_empty_header",
"(",
"title",
")",
"bodyTag",
"=",
"soup",
".",
"find",
"(",
"'body'",
")",
"pTag",
"=",
"soup",
".",
"new_tag",
"(",
"'p'",
... | https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/library/catalogs/epub_mobi_builder.py#L2904-L2924 | |
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/smtlib/printers.py | python | SmtPrinter.walk_bv_sdiv | (self, formula) | return self.walk_nary(formula, "bvsdiv") | [] | def walk_bv_sdiv(self, formula): return self.walk_nary(formula, "bvsdiv") | [
"def",
"walk_bv_sdiv",
"(",
"self",
",",
"formula",
")",
":",
"return",
"self",
".",
"walk_nary",
"(",
"formula",
",",
"\"bvsdiv\"",
")"
] | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/smtlib/printers.py#L83-L83 | |||
HewlettPackard/dlcookbook-dlbs | 863ac1d7e72ad2fcafc78d8a13f67d35bc00c235 | python/tf_cnn_benchmarks/variable_mgr.py | python | VariableMgr.savable_variables | (self) | return tf.global_variables() | Returns a list/dict of savable variables to pass to tf.train.Saver. | Returns a list/dict of savable variables to pass to tf.train.Saver. | [
"Returns",
"a",
"list",
"/",
"dict",
"of",
"savable",
"variables",
"to",
"pass",
"to",
"tf",
".",
"train",
".",
"Saver",
"."
] | def savable_variables(self):
"""Returns a list/dict of savable variables to pass to tf.train.Saver."""
return tf.global_variables() | [
"def",
"savable_variables",
"(",
"self",
")",
":",
"return",
"tf",
".",
"global_variables",
"(",
")"
] | https://github.com/HewlettPackard/dlcookbook-dlbs/blob/863ac1d7e72ad2fcafc78d8a13f67d35bc00c235/python/tf_cnn_benchmarks/variable_mgr.py#L113-L115 | |
archesproject/arches | bdb6b3fec9eaa1289957471d5e86b4a5e7c8fa97 | arches/app/utils/permission_backend.py | python | user_is_resource_editor | (user) | return user.groups.filter(name="Resource Editor").exists() | Single test for whether a user is in the Resource Editor group | Single test for whether a user is in the Resource Editor group | [
"Single",
"test",
"for",
"whether",
"a",
"user",
"is",
"in",
"the",
"Resource",
"Editor",
"group"
] | def user_is_resource_editor(user):
"""
Single test for whether a user is in the Resource Editor group
"""
return user.groups.filter(name="Resource Editor").exists() | [
"def",
"user_is_resource_editor",
"(",
"user",
")",
":",
"return",
"user",
".",
"groups",
".",
"filter",
"(",
"name",
"=",
"\"Resource Editor\"",
")",
".",
"exists",
"(",
")"
] | https://github.com/archesproject/arches/blob/bdb6b3fec9eaa1289957471d5e86b4a5e7c8fa97/arches/app/utils/permission_backend.py#L413-L418 | |
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/providers/azure/azure_kubernetes_service.py | python | AksCluster._Delete | (self) | Deletes the AKS cluster. | Deletes the AKS cluster. | [
"Deletes",
"the",
"AKS",
"cluster",
"."
] | def _Delete(self):
"""Deletes the AKS cluster."""
# This will be deleted along with the resource group
super()._Delete()
self._deleted = True | [
"def",
"_Delete",
"(",
"self",
")",
":",
"# This will be deleted along with the resource group",
"super",
"(",
")",
".",
"_Delete",
"(",
")",
"self",
".",
"_deleted",
"=",
"True"
] | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/azure/azure_kubernetes_service.py#L209-L213 | ||
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v5_1/git/git_client_base.py | python | GitClientBase.get_ref_favorite | (self, project, favorite_id) | return self._deserialize('GitRefFavorite', response) | GetRefFavorite.
[Preview API] Gets the refs favorite for a favorite Id.
:param str project: Project ID or project name
:param int favorite_id: The Id of the requested ref favorite.
:rtype: :class:`<GitRefFavorite> <azure.devops.v5_1.git.models.GitRefFavorite>` | GetRefFavorite.
[Preview API] Gets the refs favorite for a favorite Id.
:param str project: Project ID or project name
:param int favorite_id: The Id of the requested ref favorite.
:rtype: :class:`<GitRefFavorite> <azure.devops.v5_1.git.models.GitRefFavorite>` | [
"GetRefFavorite",
".",
"[",
"Preview",
"API",
"]",
"Gets",
"the",
"refs",
"favorite",
"for",
"a",
"favorite",
"Id",
".",
":",
"param",
"str",
"project",
":",
"Project",
"ID",
"or",
"project",
"name",
":",
"param",
"int",
"favorite_id",
":",
"The",
"Id",
... | def get_ref_favorite(self, project, favorite_id):
"""GetRefFavorite.
[Preview API] Gets the refs favorite for a favorite Id.
:param str project: Project ID or project name
:param int favorite_id: The Id of the requested ref favorite.
:rtype: :class:`<GitRefFavorite> <azure.devops... | [
"def",
"get_ref_favorite",
"(",
"self",
",",
"project",
",",
"favorite_id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_serialize",
".",
"url",
"(",
"'proj... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v5_1/git/git_client_base.py#L2896-L2912 | |
Netflix-Skunkworks/stethoscope | 33a35236ca3857ab2a50b622ca51f445a55170fb | stethoscope/api/endpoints/devices.py | python | register_merged_device_endpoints | (app, config, auth, device_plugins, apply_practices,
transforms, log_hooks=[]) | Registers endpoints which provide merged devices without the ownership attribution stage. | Registers endpoints which provide merged devices without the ownership attribution stage. | [
"Registers",
"endpoints",
"which",
"provide",
"merged",
"devices",
"without",
"the",
"ownership",
"attribution",
"stage",
"."
] | def register_merged_device_endpoints(app, config, auth, device_plugins, apply_practices,
transforms, log_hooks=[]):
"""Registers endpoints which provide merged devices without the ownership attribution stage."""
def setup_endpoint_kwargs(endpoint_type, args, kwargs):
userinfo = kwargs.pop('userinfo')
... | [
"def",
"register_merged_device_endpoints",
"(",
"app",
",",
"config",
",",
"auth",
",",
"device_plugins",
",",
"apply_practices",
",",
"transforms",
",",
"log_hooks",
"=",
"[",
"]",
")",
":",
"def",
"setup_endpoint_kwargs",
"(",
"endpoint_type",
",",
"args",
","... | https://github.com/Netflix-Skunkworks/stethoscope/blob/33a35236ca3857ab2a50b622ca51f445a55170fb/stethoscope/api/endpoints/devices.py#L155-L213 | ||
Blueqat/Blueqat | b676f30489b71767419fd20503403d290d4950b5 | blueqat/gate.py | python | RZGate.dagger | (self) | return RZGate(self.targets, -self.theta) | [] | def dagger(self):
return RZGate(self.targets, -self.theta) | [
"def",
"dagger",
"(",
"self",
")",
":",
"return",
"RZGate",
"(",
"self",
".",
"targets",
",",
"-",
"self",
".",
"theta",
")"
] | https://github.com/Blueqat/Blueqat/blob/b676f30489b71767419fd20503403d290d4950b5/blueqat/gate.py#L331-L332 | |||
xonsh/xonsh | b76d6f994f22a4078f602f8b386f4ec280c8461f | xonsh/xoreutils/yes.py | python | yes | (args, stdin, stdout, stderr) | return 0 | A yes command. | A yes command. | [
"A",
"yes",
"command",
"."
] | def yes(args, stdin, stdout, stderr):
"""A yes command."""
if "--help" in args:
print(YES_HELP, file=stdout)
return 0
to_print = ["y"] if len(args) == 0 else [str(i) for i in args]
while True:
print(*to_print, file=stdout)
return 0 | [
"def",
"yes",
"(",
"args",
",",
"stdin",
",",
"stdout",
",",
"stderr",
")",
":",
"if",
"\"--help\"",
"in",
"args",
":",
"print",
"(",
"YES_HELP",
",",
"file",
"=",
"stdout",
")",
"return",
"0",
"to_print",
"=",
"[",
"\"y\"",
"]",
"if",
"len",
"(",
... | https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/xoreutils/yes.py#L4-L15 | |
getsentry/sentry | 83b1f25aac3e08075e0e2495bc29efaf35aca18a | src/sentry/plugins/base/v1.py | python | IPlugin.get_resource_links | (self) | return self.resource_links | Returns a list of tuples pointing to various resources for this plugin.
>>> def get_resource_links(self):
>>> return [
>>> ('Documentation', 'https://docs.sentry.io'),
>>> ('Report Issue', 'https://github.com/getsentry/sentry/issues'),
>>> ('View Sour... | Returns a list of tuples pointing to various resources for this plugin. | [
"Returns",
"a",
"list",
"of",
"tuples",
"pointing",
"to",
"various",
"resources",
"for",
"this",
"plugin",
"."
] | def get_resource_links(self):
"""
Returns a list of tuples pointing to various resources for this plugin.
>>> def get_resource_links(self):
>>> return [
>>> ('Documentation', 'https://docs.sentry.io'),
>>> ('Report Issue', 'https://github.com/getsentr... | [
"def",
"get_resource_links",
"(",
"self",
")",
":",
"return",
"self",
".",
"resource_links"
] | https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/plugins/base/v1.py#L290-L301 | |
fossasia/x-mario-center | fe67afe28d995dcf4e2498e305825a4859566172 | build/lib.linux-i686-2.7/softwarecenter/ui/gtk3/widgets/thumbnail.py | python | ScreenshotGallery.set_screenshot_available | (self, available) | Configures the ScreenshotView depending on whether there
is a screenshot available. | Configures the ScreenshotView depending on whether there
is a screenshot available. | [
"Configures",
"the",
"ScreenshotView",
"depending",
"on",
"whether",
"there",
"is",
"a",
"screenshot",
"available",
"."
] | def set_screenshot_available(self, available):
""" Configures the ScreenshotView depending on whether there
is a screenshot available.
"""
if not available:
self.display_unavailable()
elif available and self.unavailable.get_property("visible"):
self.di... | [
"def",
"set_screenshot_available",
"(",
"self",
",",
"available",
")",
":",
"if",
"not",
"available",
":",
"self",
".",
"display_unavailable",
"(",
")",
"elif",
"available",
"and",
"self",
".",
"unavailable",
".",
"get_property",
"(",
"\"visible\"",
")",
":",
... | https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/build/lib.linux-i686-2.7/softwarecenter/ui/gtk3/widgets/thumbnail.py#L344-L352 | ||
HenriWahl/Nagstamon | 16549c6860b51a93141d84881c6ad28c35d8581e | Nagstamon/QUI/__init__.py | python | StatusWindow.raise_window_on_all_desktops | (self) | experimental workaround for floating-statusbar-only-on-one-virtual-desktop-after-a-while bug
see https://github.com/HenriWahl/Nagstamon/issues/217 | experimental workaround for floating-statusbar-only-on-one-virtual-desktop-after-a-while bug
see https://github.com/HenriWahl/Nagstamon/issues/217 | [
"experimental",
"workaround",
"for",
"floating",
"-",
"statusbar",
"-",
"only",
"-",
"on",
"-",
"one",
"-",
"virtual",
"-",
"desktop",
"-",
"after",
"-",
"a",
"-",
"while",
"bug",
"see",
"https",
":",
"//",
"github",
".",
"com",
"/",
"HenriWahl",
"/",
... | def raise_window_on_all_desktops(self):
"""
experimental workaround for floating-statusbar-only-on-one-virtual-desktop-after-a-while bug
see https://github.com/HenriWahl/Nagstamon/issues/217
"""
if conf.windowed:
return
# X11/Linux needs some special t... | [
"def",
"raise_window_on_all_desktops",
"(",
"self",
")",
":",
"if",
"conf",
".",
"windowed",
":",
"return",
"# X11/Linux needs some special treatment to get the statusbar floating on all virtual desktops",
"if",
"not",
"OS",
"in",
"OS_NON_LINUX",
":",
"# get all windows...",
... | https://github.com/HenriWahl/Nagstamon/blob/16549c6860b51a93141d84881c6ad28c35d8581e/Nagstamon/QUI/__init__.py#L2120-L2154 | ||
NoGameNoLife00/mybolg | afe17ea5bfe405e33766e5682c43a4262232ee12 | libs/sqlalchemy/sql/dml.py | python | Insert.__init__ | (self,
table,
values=None,
inline=False,
bind=None,
prefixes=None,
returning=None,
return_defaults=False,
**dialect_kw) | Construct an :class:`.Insert` object.
Similar functionality is available via the
:meth:`~.TableClause.insert` method on
:class:`~.schema.Table`.
:param table: :class:`.TableClause` which is the subject of the
insert.
:param values: collection of values to be inserted;... | Construct an :class:`.Insert` object. | [
"Construct",
"an",
":",
"class",
":",
".",
"Insert",
"object",
"."
] | def __init__(self,
table,
values=None,
inline=False,
bind=None,
prefixes=None,
returning=None,
return_defaults=False,
**dialect_kw):
"""Construct an :class:`.Insert` object.
... | [
"def",
"__init__",
"(",
"self",
",",
"table",
",",
"values",
"=",
"None",
",",
"inline",
"=",
"False",
",",
"bind",
"=",
"None",
",",
"prefixes",
"=",
"None",
",",
"returning",
"=",
"None",
",",
"return_defaults",
"=",
"False",
",",
"*",
"*",
"dialec... | https://github.com/NoGameNoLife00/mybolg/blob/afe17ea5bfe405e33766e5682c43a4262232ee12/libs/sqlalchemy/sql/dml.py#L413-L469 | ||
euphrat1ca/fuzzdb-collect | f32552a4d5d84350552c68801aed281ca1f48e66 | ScriptShare/bannerscan.py | python | bannerscan.run | (self) | [] | def run(self):
result[self.ip] = dict()
for port in PORTS:
url_pre = "https://" if port == 443 else "http://"
site = url_pre + self.ip + ":" + str(port)
try:
print ("[*] %s\r" % (site[0:60].ljust(60, " "))),
resp = requests.head(site,
... | [
"def",
"run",
"(",
"self",
")",
":",
"result",
"[",
"self",
".",
"ip",
"]",
"=",
"dict",
"(",
")",
"for",
"port",
"in",
"PORTS",
":",
"url_pre",
"=",
"\"https://\"",
"if",
"port",
"==",
"443",
"else",
"\"http://\"",
"site",
"=",
"url_pre",
"+",
"se... | https://github.com/euphrat1ca/fuzzdb-collect/blob/f32552a4d5d84350552c68801aed281ca1f48e66/ScriptShare/bannerscan.py#L104-L141 | ||||
steeve/xbmctorrent | e6bcb1037668959e1e3cb5ba8cf3e379c6638da9 | resources/site-packages/six.py | python | iterlists | (d, **kw) | return iter(getattr(d, _iterlists)(**kw)) | Return an iterator over the (key, [values]) pairs of a dictionary. | Return an iterator over the (key, [values]) pairs of a dictionary. | [
"Return",
"an",
"iterator",
"over",
"the",
"(",
"key",
"[",
"values",
"]",
")",
"pairs",
"of",
"a",
"dictionary",
"."
] | def iterlists(d, **kw):
"""Return an iterator over the (key, [values]) pairs of a dictionary."""
return iter(getattr(d, _iterlists)(**kw)) | [
"def",
"iterlists",
"(",
"d",
",",
"*",
"*",
"kw",
")",
":",
"return",
"iter",
"(",
"getattr",
"(",
"d",
",",
"_iterlists",
")",
"(",
"*",
"*",
"kw",
")",
")"
] | https://github.com/steeve/xbmctorrent/blob/e6bcb1037668959e1e3cb5ba8cf3e379c6638da9/resources/site-packages/six.py#L441-L443 | |
bleachbit/bleachbit | 88fc4452936d02b56a76f07ce2142306bb47262b | bleachbit/GuiBasic.py | python | open_url | (url, parent_window=None, prompt=True) | Open an HTTP URL. Try to run as non-root. | Open an HTTP URL. Try to run as non-root. | [
"Open",
"an",
"HTTP",
"URL",
".",
"Try",
"to",
"run",
"as",
"non",
"-",
"root",
"."
] | def open_url(url, parent_window=None, prompt=True):
"""Open an HTTP URL. Try to run as non-root."""
# drop privileges so the web browser is running as a normal process
if os.name == 'posix' and os.getuid() == 0:
msg = _(
"Because you are running as root, please manually open this link i... | [
"def",
"open_url",
"(",
"url",
",",
"parent_window",
"=",
"None",
",",
"prompt",
"=",
"True",
")",
":",
"# drop privileges so the web browser is running as a normal process",
"if",
"os",
".",
"name",
"==",
"'posix'",
"and",
"os",
".",
"getuid",
"(",
")",
"==",
... | https://github.com/bleachbit/bleachbit/blob/88fc4452936d02b56a76f07ce2142306bb47262b/bleachbit/GuiBasic.py#L175-L207 | ||
mcfletch/pyopengl | 02d11dad9ff18e50db10e975c4756e17bf198464 | OpenGL/GLX/MESA/set_3dfx_mode.py | python | glInitSet3DfxModeMESA | () | return extensions.hasGLExtension( _EXTENSION_NAME ) | Return boolean indicating whether this extension is available | Return boolean indicating whether this extension is available | [
"Return",
"boolean",
"indicating",
"whether",
"this",
"extension",
"is",
"available"
] | def glInitSet3DfxModeMESA():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME ) | [
"def",
"glInitSet3DfxModeMESA",
"(",
")",
":",
"from",
"OpenGL",
"import",
"extensions",
"return",
"extensions",
".",
"hasGLExtension",
"(",
"_EXTENSION_NAME",
")"
] | https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GLX/MESA/set_3dfx_mode.py#L17-L20 | |
zachwill/flask-engine | 7c8ad4bfe36382a8c9286d873ec7b785715832a4 | libs/jinja2/parser.py | python | Parser.parse_statement | (self) | Parse a single statement. | Parse a single statement. | [
"Parse",
"a",
"single",
"statement",
"."
] | def parse_statement(self):
"""Parse a single statement."""
token = self.stream.current
if token.type != 'name':
self.fail('tag name expected', token.lineno)
self._tag_stack.append(token.value)
pop_tag = True
try:
if token.value in _statement_keywor... | [
"def",
"parse_statement",
"(",
"self",
")",
":",
"token",
"=",
"self",
".",
"stream",
".",
"current",
"if",
"token",
".",
"type",
"!=",
"'name'",
":",
"self",
".",
"fail",
"(",
"'tag name expected'",
",",
"token",
".",
"lineno",
")",
"self",
".",
"_tag... | https://github.com/zachwill/flask-engine/blob/7c8ad4bfe36382a8c9286d873ec7b785715832a4/libs/jinja2/parser.py#L113-L139 | ||
haiwen/seafile-docker | 2d2461d4c8cab3458ec9832611c419d47506c300 | cluster/image/pro_seafile/scripts/utils/__init__.py | python | underlined | (msg) | return '\x1b[4m{}\x1b[0m'.format(msg) | [] | def underlined(msg):
return '\x1b[4m{}\x1b[0m'.format(msg) | [
"def",
"underlined",
"(",
"msg",
")",
":",
"return",
"'\\x1b[4m{}\\x1b[0m'",
".",
"format",
"(",
"msg",
")"
] | https://github.com/haiwen/seafile-docker/blob/2d2461d4c8cab3458ec9832611c419d47506c300/cluster/image/pro_seafile/scripts/utils/__init__.py#L34-L35 | |||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/mutagen/id3/_specs.py | python | Spec.validate | (self, frame, value) | Returns:
the validated value
Raises:
ValueError
TypeError | Returns:
the validated value
Raises:
ValueError
TypeError | [
"Returns",
":",
"the",
"validated",
"value",
"Raises",
":",
"ValueError",
"TypeError"
] | def validate(self, frame, value):
"""
Returns:
the validated value
Raises:
ValueError
TypeError
"""
raise NotImplementedError | [
"def",
"validate",
"(",
"self",
",",
"frame",
",",
"value",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/mutagen/id3/_specs.py#L147-L156 | ||
clips/pattern | d25511f9ca7ed9356b801d8663b8b5168464e68f | pattern/db/__init__.py | python | time | (days=0, seconds=0, minutes=0, hours=0, **kwargs) | return Time(days=days, seconds=seconds, minutes=minutes, hours=hours, **kwargs) | Returns a Time that can be added to a Date object.
Other parameters: microseconds, milliseconds, weeks, months, years. | Returns a Time that can be added to a Date object.
Other parameters: microseconds, milliseconds, weeks, months, years. | [
"Returns",
"a",
"Time",
"that",
"can",
"be",
"added",
"to",
"a",
"Date",
"object",
".",
"Other",
"parameters",
":",
"microseconds",
"milliseconds",
"weeks",
"months",
"years",
"."
] | def time(days=0, seconds=0, minutes=0, hours=0, **kwargs):
""" Returns a Time that can be added to a Date object.
Other parameters: microseconds, milliseconds, weeks, months, years.
"""
return Time(days=days, seconds=seconds, minutes=minutes, hours=hours, **kwargs) | [
"def",
"time",
"(",
"days",
"=",
"0",
",",
"seconds",
"=",
"0",
",",
"minutes",
"=",
"0",
",",
"hours",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"Time",
"(",
"days",
"=",
"days",
",",
"seconds",
"=",
"seconds",
",",
"minutes",
"="... | https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/db/__init__.py#L305-L309 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/email/message.py | python | _formatparam | (param, value=None, quote=True) | Convenience function to format and return a key=value pair.
This will quote the value if needed or if quote is true. If value is a
three tuple (charset, language, value), it will be encoded according
to RFC2231 rules. | Convenience function to format and return a key=value pair. | [
"Convenience",
"function",
"to",
"format",
"and",
"return",
"a",
"key",
"=",
"value",
"pair",
"."
] | def _formatparam(param, value=None, quote=True):
"""Convenience function to format and return a key=value pair.
This will quote the value if needed or if quote is true. If value is a
three tuple (charset, language, value), it will be encoded according
to RFC2231 rules.
"""
if value is not None... | [
"def",
"_formatparam",
"(",
"param",
",",
"value",
"=",
"None",
",",
"quote",
"=",
"True",
")",
":",
"if",
"value",
"is",
"not",
"None",
"and",
"len",
"(",
"value",
")",
">",
"0",
":",
"# A tuple is used for RFC 2231 encoded parameter values where items",
"# a... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/email/message.py#L38-L60 | ||
grow/grow | 97fc21730b6a674d5d33948d94968e79447ce433 | grow/pods/pods.py | python | Pod.preprocess | (self, preprocessor_names=None, run_all=False, tags=None,
build=True, ratelimit=None) | [] | def preprocess(self, preprocessor_names=None, run_all=False, tags=None,
build=True, ratelimit=None):
if not preprocessor_names:
self.catalogs.compile() # Preprocess translations.
# Extension support for preprocessors.
preprocessors = self.yaml.get('preprocessors'... | [
"def",
"preprocess",
"(",
"self",
",",
"preprocessor_names",
"=",
"None",
",",
"run_all",
"=",
"False",
",",
"tags",
"=",
"None",
",",
"build",
"=",
"True",
",",
"ratelimit",
"=",
"None",
")",
":",
"if",
"not",
"preprocessor_names",
":",
"self",
".",
"... | https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/pods/pods.py#L848-L871 | ||||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/t5/modeling_flax_t5.py | python | FlaxT5DenseReluDense.__call__ | (self, hidden_states, deterministic=True) | return hidden_states | [] | def __call__(self, hidden_states, deterministic=True):
hidden_states = self.wi(hidden_states)
hidden_states = jax.nn.relu(hidden_states)
hidden_states = self.dropout(hidden_states, deterministic=deterministic)
hidden_states = self.wo(hidden_states)
return hidden_states | [
"def",
"__call__",
"(",
"self",
",",
"hidden_states",
",",
"deterministic",
"=",
"True",
")",
":",
"hidden_states",
"=",
"self",
".",
"wi",
"(",
"hidden_states",
")",
"hidden_states",
"=",
"jax",
".",
"nn",
".",
"relu",
"(",
"hidden_states",
")",
"hidden_s... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/t5/modeling_flax_t5.py#L112-L117 | |||
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/Mask RCNN/CharlesShang_FastMaskRCNN/libs/datasets/pycocotools/coco.py | python | COCO.getCatIds | (self, catNms=[], supNms=[], catIds=[]) | return ids | filtering parameters. default skips that filter.
:param catNms (str array) : get cats for given cat names
:param supNms (str array) : get cats for given supercategory names
:param catIds (int array) : get cats for given cat ids
:return: ids (int array) : integer array of cat ids | filtering parameters. default skips that filter.
:param catNms (str array) : get cats for given cat names
:param supNms (str array) : get cats for given supercategory names
:param catIds (int array) : get cats for given cat ids
:return: ids (int array) : integer array of cat ids | [
"filtering",
"parameters",
".",
"default",
"skips",
"that",
"filter",
".",
":",
"param",
"catNms",
"(",
"str",
"array",
")",
":",
"get",
"cats",
"for",
"given",
"cat",
"names",
":",
"param",
"supNms",
"(",
"str",
"array",
")",
":",
"get",
"cats",
"for"... | def getCatIds(self, catNms=[], supNms=[], catIds=[]):
"""
filtering parameters. default skips that filter.
:param catNms (str array) : get cats for given cat names
:param supNms (str array) : get cats for given supercategory names
:param catIds (int array) : get cats for given... | [
"def",
"getCatIds",
"(",
"self",
",",
"catNms",
"=",
"[",
"]",
",",
"supNms",
"=",
"[",
"]",
",",
"catIds",
"=",
"[",
"]",
")",
":",
"catNms",
"=",
"catNms",
"if",
"type",
"(",
"catNms",
")",
"==",
"list",
"else",
"[",
"catNms",
"]",
"supNms",
... | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/Mask RCNN/CharlesShang_FastMaskRCNN/libs/datasets/pycocotools/coco.py#L152-L172 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.