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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DxCx/plugin.video.9anime | 34358c2f701e5ddf19d3276926374a16f63f7b6a | resources/lib/ui/js2py/legecy_translators/flow.py | python | do_try | (source, start) | return result + 'finally:\n%s' % indent(block), start | [] | def do_try(source, start):
start += 3 # pass try
block, start = do_block(source, start)
result = 'try:\n%s' %indent(block)
catch = except_keyword(source, start, 'catch')
if catch:
bra, catch = pass_bracket(source, catch, '()')
bra = bra[1:-1]
identifier, bra_end = parse_ident... | [
"def",
"do_try",
"(",
"source",
",",
"start",
")",
":",
"start",
"+=",
"3",
"# pass try",
"block",
",",
"start",
"=",
"do_block",
"(",
"source",
",",
"start",
")",
"result",
"=",
"'try:\\n%s'",
"%",
"indent",
"(",
"block",
")",
"catch",
"=",
"except_ke... | https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/legecy_translators/flow.py#L306-L332 | |||
Dozed12/df-style-worldgen | 937455d54f4b02df9c4b10ae6418f4c932fd97bf | dist/libtcodpy.py | python | image_hflip | (image) | [] | def image_hflip(image) :
_lib.TCOD_image_hflip(image) | [
"def",
"image_hflip",
"(",
"image",
")",
":",
"_lib",
".",
"TCOD_image_hflip",
"(",
"image",
")"
] | https://github.com/Dozed12/df-style-worldgen/blob/937455d54f4b02df9c4b10ae6418f4c932fd97bf/dist/libtcodpy.py#L1098-L1099 | ||||
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/filepost.py | python | choose_boundary | () | return uuid4().hex | Our embarassingly-simple replacement for mimetools.choose_boundary. | Our embarassingly-simple replacement for mimetools.choose_boundary. | [
"Our",
"embarassingly",
"-",
"simple",
"replacement",
"for",
"mimetools",
".",
"choose_boundary",
"."
] | def choose_boundary():
"""
Our embarassingly-simple replacement for mimetools.choose_boundary.
"""
return uuid4().hex | [
"def",
"choose_boundary",
"(",
")",
":",
"return",
"uuid4",
"(",
")",
".",
"hex"
] | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/filepost.py#L14-L18 | |
openSUSE/osc | 5c2e1b039a16334880e7ebe4a33baafe0f2d5e20 | osc/core.py | python | replace_pkg_meta | (pkgmeta, new_name, new_prj, keep_maintainers = False,
dst_userid = None, keep_develproject = False) | return ET.tostring(root, encoding=ET_ENCODING) | update pkgmeta with new new_name and new_prj and set calling user as the
only maintainer (unless keep_maintainers is set). Additionally remove the
develproject entry (<devel />) unless keep_develproject is true. | update pkgmeta with new new_name and new_prj and set calling user as the
only maintainer (unless keep_maintainers is set). Additionally remove the
develproject entry (<devel />) unless keep_develproject is true. | [
"update",
"pkgmeta",
"with",
"new",
"new_name",
"and",
"new_prj",
"and",
"set",
"calling",
"user",
"as",
"the",
"only",
"maintainer",
"(",
"unless",
"keep_maintainers",
"is",
"set",
")",
".",
"Additionally",
"remove",
"the",
"develproject",
"entry",
"(",
"<dev... | def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False,
dst_userid = None, keep_develproject = False):
"""
update pkgmeta with new new_name and new_prj and set calling user as the
only maintainer (unless keep_maintainers is set). Additionally remove the
develproje... | [
"def",
"replace_pkg_meta",
"(",
"pkgmeta",
",",
"new_name",
",",
"new_prj",
",",
"keep_maintainers",
"=",
"False",
",",
"dst_userid",
"=",
"None",
",",
"keep_develproject",
"=",
"False",
")",
":",
"root",
"=",
"ET",
".",
"fromstring",
"(",
"b''",
".",
"joi... | https://github.com/openSUSE/osc/blob/5c2e1b039a16334880e7ebe4a33baafe0f2d5e20/osc/core.py#L5145-L5166 | |
espnet/espnet | ea411f3f627b8f101c211e107d0ff7053344ac80 | espnet2/layers/sinc_conv.py | python | LogCompression.__init__ | (self) | Initialize. | Initialize. | [
"Initialize",
"."
] | def __init__(self):
"""Initialize."""
super().__init__() | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")"
] | https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/espnet2/layers/sinc_conv.py#L18-L20 | ||
mkeeter/kokopelli | c99b7909e138c42c7d5c99927f5031f021bffd77 | koko/fab/path.py | python | Path.save_svg | (self, filename) | [] | def save_svg(self, filename):
self.write_svg_header(filename, self.dx, self.dy)
self.write_svg_contour(filename, self.xmin, self.ymin)
self.write_svg_footer(filename) | [
"def",
"save_svg",
"(",
"self",
",",
"filename",
")",
":",
"self",
".",
"write_svg_header",
"(",
"filename",
",",
"self",
".",
"dx",
",",
"self",
".",
"dy",
")",
"self",
".",
"write_svg_contour",
"(",
"filename",
",",
"self",
".",
"xmin",
",",
"self",
... | https://github.com/mkeeter/kokopelli/blob/c99b7909e138c42c7d5c99927f5031f021bffd77/koko/fab/path.py#L127-L130 | ||||
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/solvers/portfolio.py | python | Portfolio._add_assertion | (self, formula, named=None) | return formula | [] | def _add_assertion(self, formula, named=None):
return formula | [
"def",
"_add_assertion",
"(",
"self",
",",
"formula",
",",
"named",
"=",
"None",
")",
":",
"return",
"formula"
] | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/solvers/portfolio.py#L113-L114 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/ext/ndb/metadata.py | python | Namespace.namespace_name | (self) | return self.key_to_namespace(self.key) | Return the namespace name specified by this entity's key. | Return the namespace name specified by this entity's key. | [
"Return",
"the",
"namespace",
"name",
"specified",
"by",
"this",
"entity",
"s",
"key",
"."
] | def namespace_name(self):
"""Return the namespace name specified by this entity's key."""
return self.key_to_namespace(self.key) | [
"def",
"namespace_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"key_to_namespace",
"(",
"self",
".",
"key",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/ndb/metadata.py#L56-L58 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/inject/thirdparty/beautifulsoup/beautifulsoup.py | python | PageElement.insert | (self, position, newChild) | [] | def insert(self, position, newChild):
if isinstance(newChild, basestring) \
and not isinstance(newChild, NavigableString):
newChild = NavigableString(newChild)
position = min(position, len(self.contents))
if hasattr(newChild, 'parent') and newChild.parent is not None:
... | [
"def",
"insert",
"(",
"self",
",",
"position",
",",
"newChild",
")",
":",
"if",
"isinstance",
"(",
"newChild",
",",
"basestring",
")",
"and",
"not",
"isinstance",
"(",
"newChild",
",",
"NavigableString",
")",
":",
"newChild",
"=",
"NavigableString",
"(",
"... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/thirdparty/beautifulsoup/beautifulsoup.py#L189-L246 | ||||
cytoscape/py2cytoscape | f3e7c82a7b67f890b46d4dd3db4a03203468faaf | py2cytoscape/cyrest/ui.py | python | ui.getPanelStatus | (self, panelName, verbose=None) | return response | Returns the status of the CytoPanel specified by the `panelName` parameter.
:param panelName: Name of the CytoPanel
:param verbose: print more
:returns: 200: successful operation | Returns the status of the CytoPanel specified by the `panelName` parameter. | [
"Returns",
"the",
"status",
"of",
"the",
"CytoPanel",
"specified",
"by",
"the",
"panelName",
"parameter",
"."
] | def getPanelStatus(self, panelName, verbose=None):
"""
Returns the status of the CytoPanel specified by the `panelName` parameter.
:param panelName: Name of the CytoPanel
:param verbose: print more
:returns: 200: successful operation
"""
response=api(url=self._... | [
"def",
"getPanelStatus",
"(",
"self",
",",
"panelName",
",",
"verbose",
"=",
"None",
")",
":",
"response",
"=",
"api",
"(",
"url",
"=",
"self",
".",
"___url",
"+",
"'ui/panels/'",
"+",
"str",
"(",
"panelName",
")",
"+",
"''",
",",
"method",
"=",
"\"G... | https://github.com/cytoscape/py2cytoscape/blob/f3e7c82a7b67f890b46d4dd3db4a03203468faaf/py2cytoscape/cyrest/ui.py#L55-L66 | |
Sterncat/opticspy | 2777da49ad796cfee14070372a72e4d0ea88e85b | opticspy/ray_tracing/draw.py | python | draw_surface | (r,x0,d1,d2) | return verts,codes,[verts[0],verts[-1]] | d1: diameter that rays go through
d2: max diameter for a lens, doublet, let edge be flat | d1: diameter that rays go through
d2: max diameter for a lens, doublet, let edge be flat | [
"d1",
":",
"diameter",
"that",
"rays",
"go",
"through",
"d2",
":",
"max",
"diameter",
"for",
"a",
"lens",
"doublet",
"let",
"edge",
"be",
"flat"
] | def draw_surface(r,x0,d1,d2):
'''
d1: diameter that rays go through
d2: max diameter for a lens, doublet, let edge be flat
'''
verts_1 = []
verts_2 = []
codes = []
for y in np.linspace(0,d1/2,10):
if r > 0:
x = -np.sqrt(r**2-y**2) + r
else:
x = np.... | [
"def",
"draw_surface",
"(",
"r",
",",
"x0",
",",
"d1",
",",
"d2",
")",
":",
"verts_1",
"=",
"[",
"]",
"verts_2",
"=",
"[",
"]",
"codes",
"=",
"[",
"]",
"for",
"y",
"in",
"np",
".",
"linspace",
"(",
"0",
",",
"d1",
"/",
"2",
",",
"10",
")",
... | https://github.com/Sterncat/opticspy/blob/2777da49ad796cfee14070372a72e4d0ea88e85b/opticspy/ray_tracing/draw.py#L9-L31 | |
mudpi/mudpi-core | fb206b1136f529c7197f1e6b29629ed05630d377 | mudpi/config.py | python | Config.save_to_file | (self, file=None, format=None, config=None) | return True | Save current configs to a file
File: Full path to file
Format: 'json' or 'yaml'
Config: Dict of data to write to file (Default: self) | Save current configs to a file
File: Full path to file
Format: 'json' or 'yaml'
Config: Dict of data to write to file (Default: self) | [
"Save",
"current",
"configs",
"to",
"a",
"file",
"File",
":",
"Full",
"path",
"to",
"file",
"Format",
":",
"json",
"or",
"yaml",
"Config",
":",
"Dict",
"of",
"data",
"to",
"write",
"to",
"file",
"(",
"Default",
":",
"self",
")"
] | def save_to_file(self, file=None, format=None, config=None):
""" Save current configs to a file
File: Full path to file
Format: 'json' or 'yaml'
Config: Dict of data to write to file (Default: self)
"""
if file is not None:
file = self.validate_fi... | [
"def",
"save_to_file",
"(",
"self",
",",
"file",
"=",
"None",
",",
"format",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"if",
"file",
"is",
"not",
"None",
":",
"file",
"=",
"self",
".",
"validate_file",
"(",
"file",
",",
"exists",
"=",
"Fal... | https://github.com/mudpi/mudpi-core/blob/fb206b1136f529c7197f1e6b29629ed05630d377/mudpi/config.py#L151-L174 | |
owid/covid-19-data | 936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92 | scripts/src/cowidev/vax/incremental/jordan.py | python | Jordan.export | (self) | [] | def export(self):
data = self.read().pipe(self.pipeline)
increment(
location=data["location"],
total_vaccinations=data["total_vaccinations"],
people_vaccinated=data["people_vaccinated"],
people_fully_vaccinated=data["people_fully_vaccinated"],
... | [
"def",
"export",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"read",
"(",
")",
".",
"pipe",
"(",
"self",
".",
"pipeline",
")",
"increment",
"(",
"location",
"=",
"data",
"[",
"\"location\"",
"]",
",",
"total_vaccinations",
"=",
"data",
"[",
"\"t... | https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/incremental/jordan.py#L86-L96 | ||||
bert-nmt/bert-nmt | fcb616d28091ac23c9c16f30e6870fe90b8576d6 | fairseq/modules/adaptive_softmax.py | python | AdaptiveSoftmax.__init__ | (self, vocab_size, input_dim, cutoff, dropout, factor=4., adaptive_inputs=None, tie_proj=False) | [] | def __init__(self, vocab_size, input_dim, cutoff, dropout, factor=4., adaptive_inputs=None, tie_proj=False):
super().__init__()
if vocab_size > cutoff[-1]:
cutoff = cutoff + [vocab_size]
else:
assert vocab_size == cutoff[
-1], 'cannot specify cutoff large... | [
"def",
"__init__",
"(",
"self",
",",
"vocab_size",
",",
"input_dim",
",",
"cutoff",
",",
"dropout",
",",
"factor",
"=",
"4.",
",",
"adaptive_inputs",
"=",
"None",
",",
"tie_proj",
"=",
"False",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
... | https://github.com/bert-nmt/bert-nmt/blob/fcb616d28091ac23c9c16f30e6870fe90b8576d6/fairseq/modules/adaptive_softmax.py#L59-L91 | ||||
Tuxemon/Tuxemon | ee80708090525391c1dfc43849a6348aca636b22 | tuxemon/states/combat/combat_menus.py | python | CombatTargetMenuState.refresh_layout | (self) | Before refreshing the layout, determine the optimal target. | Before refreshing the layout, determine the optimal target. | [
"Before",
"refreshing",
"the",
"layout",
"determine",
"the",
"optimal",
"target",
"."
] | def refresh_layout(self) -> None:
"""Before refreshing the layout, determine the optimal target."""
def determine_target() -> None:
for tag in self.action.target:
for target in self.targeting_map[tag]:
menu_item = self.search_items(target)
... | [
"def",
"refresh_layout",
"(",
"self",
")",
"->",
"None",
":",
"def",
"determine_target",
"(",
")",
"->",
"None",
":",
"for",
"tag",
"in",
"self",
".",
"action",
".",
"target",
":",
"for",
"target",
"in",
"self",
".",
"targeting_map",
"[",
"tag",
"]",
... | https://github.com/Tuxemon/Tuxemon/blob/ee80708090525391c1dfc43849a6348aca636b22/tuxemon/states/combat/combat_menus.py#L306-L323 | ||
PaddlePaddle/PARL | 5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96 | benchmark/torch/dqn/agent.py | python | AtariAgent.sample | (self, obs) | return act | Sample an action when given an observation, base on the current epsilon value,
either a greedy action or a random action will be returned.
Args:
obs (np.float32): shape of (3, 84, 84) or (1, 3, 84, 84), current observation
Returns:
act (int): action | Sample an action when given an observation, base on the current epsilon value,
either a greedy action or a random action will be returned. | [
"Sample",
"an",
"action",
"when",
"given",
"an",
"observation",
"base",
"on",
"the",
"current",
"epsilon",
"value",
"either",
"a",
"greedy",
"action",
"or",
"a",
"random",
"action",
"will",
"be",
"returned",
"."
] | def sample(self, obs):
"""Sample an action when given an observation, base on the current epsilon value,
either a greedy action or a random action will be returned.
Args:
obs (np.float32): shape of (3, 84, 84) or (1, 3, 84, 84), current observation
Returns:
act... | [
"def",
"sample",
"(",
"self",
",",
"obs",
")",
":",
"explore",
"=",
"np",
".",
"random",
".",
"choice",
"(",
"[",
"True",
",",
"False",
"]",
",",
"p",
"=",
"[",
"self",
".",
"curr_ep",
",",
"1",
"-",
"self",
".",
"curr_ep",
"]",
")",
"if",
"e... | https://github.com/PaddlePaddle/PARL/blob/5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96/benchmark/torch/dqn/agent.py#L47-L65 | |
deepfakes/faceswap | 09c7d8aca3c608d1afad941ea78e9fd9b64d9219 | scripts/train.py | python | Train._load_model | (self) | return model | Load the model requested for training.
Returns
-------
:file:`plugins.train.model` plugin
The requested model plugin | Load the model requested for training. | [
"Load",
"the",
"model",
"requested",
"for",
"training",
"."
] | def _load_model(self):
""" Load the model requested for training.
Returns
-------
:file:`plugins.train.model` plugin
The requested model plugin
"""
logger.debug("Loading Model")
model_dir = get_folder(self._args.model_dir)
model = PluginLoader... | [
"def",
"_load_model",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Loading Model\"",
")",
"model_dir",
"=",
"get_folder",
"(",
"self",
".",
"_args",
".",
"model_dir",
")",
"model",
"=",
"PluginLoader",
".",
"get_model",
"(",
"self",
".",
"_args",... | https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/scripts/train.py#L254-L270 | |
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/pip/pip/_vendor/distlib/locators.py | python | Locator._get_scheme | (self) | return self._scheme | [] | def _get_scheme(self):
return self._scheme | [
"def",
"_get_scheme",
"(",
"self",
")",
":",
"return",
"self",
".",
"_scheme"
] | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/distlib/locators.py#L145-L146 | |||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/posixpath.py | python | ismount | (path) | return False | Test whether a path is a mount point | Test whether a path is a mount point | [
"Test",
"whether",
"a",
"path",
"is",
"a",
"mount",
"point"
] | def ismount(path):
"""Test whether a path is a mount point"""
if islink(path):
# A symlink can never be a mount point
return False
try:
s1 = os.lstat(path)
s2 = os.lstat(join(path, '..'))
except os.error:
return False # It doesn't exist -- so not a mount point :-)... | [
"def",
"ismount",
"(",
"path",
")",
":",
"if",
"islink",
"(",
"path",
")",
":",
"# A symlink can never be a mount point",
"return",
"False",
"try",
":",
"s1",
"=",
"os",
".",
"lstat",
"(",
"path",
")",
"s2",
"=",
"os",
".",
"lstat",
"(",
"join",
"(",
... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/posixpath.py#L180-L198 | |
timkpaine/pyEX | 254acd2b0cf7cb7183100106f4ecc11d1860c46a | pyEX/stocks/iex.py | python | iexTopsAsync | (symbols=None, token="", version="stable", format="json") | return await _getAsync("tops", token=token, version=version, format=format) | [] | async def iexTopsAsync(symbols=None, token="", version="stable", format="json"):
symbols = _strToList(symbols)
if symbols:
return await _getAsync(
"tops?symbols=" + _quoteSymbols(",".join(symbols)),
token=token,
version=version,
format=format,
)
... | [
"async",
"def",
"iexTopsAsync",
"(",
"symbols",
"=",
"None",
",",
"token",
"=",
"\"\"",
",",
"version",
"=",
"\"stable\"",
",",
"format",
"=",
"\"json\"",
")",
":",
"symbols",
"=",
"_strToList",
"(",
"symbols",
")",
"if",
"symbols",
":",
"return",
"await... | https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/stocks/iex.py#L91-L100 | |||
CompVis/adaptive-style-transfer | 51b4c90dbd998d9efd1dc821ad7a8df69bef61da | evaluation/feature_extractor/preprocessing/vgg_preprocessing.py | python | _central_crop | (image_list, crop_height, crop_width) | return outputs | Performs central crops of the given image list.
Args:
image_list: a list of image tensors of the same dimension but possibly
varying channel.
crop_height: the height of the image following the crop.
crop_width: the width of the image following the crop.
Returns:
the list of cropped images. | Performs central crops of the given image list. | [
"Performs",
"central",
"crops",
"of",
"the",
"given",
"image",
"list",
"."
] | def _central_crop(image_list, crop_height, crop_width):
"""Performs central crops of the given image list.
Args:
image_list: a list of image tensors of the same dimension but possibly
varying channel.
crop_height: the height of the image following the crop.
crop_width: the width of the image foll... | [
"def",
"_central_crop",
"(",
"image_list",
",",
"crop_height",
",",
"crop_width",
")",
":",
"outputs",
"=",
"[",
"]",
"for",
"image",
"in",
"image_list",
":",
"image_height",
"=",
"tf",
".",
"shape",
"(",
"image",
")",
"[",
"0",
"]",
"image_width",
"=",
... | https://github.com/CompVis/adaptive-style-transfer/blob/51b4c90dbd998d9efd1dc821ad7a8df69bef61da/evaluation/feature_extractor/preprocessing/vgg_preprocessing.py#L178-L200 | |
brendano/tweetmotif | 1b0b1e3a941745cd5a26eba01f554688b7c4b27e | everything_else/djfrontend/django-1.0.2/utils/dateformat.py | python | DateFormat.I | (self) | 1' if Daylight Savings Time, '0' otherwise. | 1' if Daylight Savings Time, '0' otherwise. | [
"1",
"if",
"Daylight",
"Savings",
"Time",
"0",
"otherwise",
"."
] | def I(self):
"'1' if Daylight Savings Time, '0' otherwise."
if self.timezone.dst(self.data):
return u'1'
else:
return u'0' | [
"def",
"I",
"(",
"self",
")",
":",
"if",
"self",
".",
"timezone",
".",
"dst",
"(",
"self",
".",
"data",
")",
":",
"return",
"u'1'",
"else",
":",
"return",
"u'0'"
] | https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/utils/dateformat.py#L132-L137 | ||
reviewboard/rbtools | b4838a640b458641ffd233093ae65971d0b4d529 | rbtools/clients/tfs.py | python | TFHelperWrapper.get_local_path | (self) | return None | Return the local path to the working tree.
Returns:
unicode:
The filesystem path of the repository on the client system. | Return the local path to the working tree. | [
"Return",
"the",
"local",
"path",
"to",
"the",
"working",
"tree",
"."
] | def get_local_path(self):
"""Return the local path to the working tree.
Returns:
unicode:
The filesystem path of the repository on the client system.
"""
rc, path, errors = self._run_helper(['get-collection'],
ignore_er... | [
"def",
"get_local_path",
"(",
"self",
")",
":",
"rc",
",",
"path",
",",
"errors",
"=",
"self",
".",
"_run_helper",
"(",
"[",
"'get-collection'",
"]",
",",
"ignore_errors",
"=",
"True",
")",
"if",
"rc",
"==",
"0",
":",
"return",
"path",
".",
"strip",
... | https://github.com/reviewboard/rbtools/blob/b4838a640b458641ffd233093ae65971d0b4d529/rbtools/clients/tfs.py#L804-L817 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/syntaxnet/dragnn/python/network_units.py | python | activation_lookup_other | (component, state, channel_id, source_tensor,
source_layer_size) | Looks up activations from tensors.
If the linked feature's embedding_dim is set to -1, the feature vectors are
not passed through (i.e. multiplied by) an embedding matrix.
Args:
component: Component object in which to look up the fixed features.
state: MasterState object for the live ComputeSession.
... | Looks up activations from tensors. | [
"Looks",
"up",
"activations",
"from",
"tensors",
"."
] | def activation_lookup_other(component, state, channel_id, source_tensor,
source_layer_size):
"""Looks up activations from tensors.
If the linked feature's embedding_dim is set to -1, the feature vectors are
not passed through (i.e. multiplied by) an embedding matrix.
Args:
comp... | [
"def",
"activation_lookup_other",
"(",
"component",
",",
"state",
",",
"channel_id",
",",
"source_tensor",
",",
"source_layer_size",
")",
":",
"feature_spec",
"=",
"component",
".",
"spec",
".",
"linked_feature",
"[",
"channel_id",
"]",
"with",
"tf",
".",
"name_... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/syntaxnet/dragnn/python/network_units.py#L476-L522 | ||
sphinx-doc/sphinx | e79681c76843c1339863b365747079b2d662d0c1 | sphinx/environment/collectors/toctree.py | python | TocTreeCollector.assign_figure_numbers | (self, env: BuildEnvironment) | return rewrite_needed | Assign a figure number to each figure under a numbered toctree. | Assign a figure number to each figure under a numbered toctree. | [
"Assign",
"a",
"figure",
"number",
"to",
"each",
"figure",
"under",
"a",
"numbered",
"toctree",
"."
] | def assign_figure_numbers(self, env: BuildEnvironment) -> List[str]:
"""Assign a figure number to each figure under a numbered toctree."""
rewrite_needed = []
assigned: Set[str] = set()
old_fignumbers = env.toc_fignumbers
env.toc_fignumbers = {}
fignum_counter: Dict[str... | [
"def",
"assign_figure_numbers",
"(",
"self",
",",
"env",
":",
"BuildEnvironment",
")",
"->",
"List",
"[",
"str",
"]",
":",
"rewrite_needed",
"=",
"[",
"]",
"assigned",
":",
"Set",
"[",
"str",
"]",
"=",
"set",
"(",
")",
"old_fignumbers",
"=",
"env",
"."... | https://github.com/sphinx-doc/sphinx/blob/e79681c76843c1339863b365747079b2d662d0c1/sphinx/environment/collectors/toctree.py#L208-L289 | |
prechelt/typecheck-decorator | f2c5a7a22805e39eed910ce48ca8c0c3cf16c1ab | typecheck/typing_predicates.py | python | GenericMetaChecker._is_possible_subclass | (self, subtype, supertype) | return False | Like issubclass(subtype, supertype) except that TypeVars
are not taken into account. | Like issubclass(subtype, supertype) except that TypeVars
are not taken into account. | [
"Like",
"issubclass",
"(",
"subtype",
"supertype",
")",
"except",
"that",
"TypeVars",
"are",
"not",
"taken",
"into",
"account",
"."
] | def _is_possible_subclass(self, subtype, supertype):
"""
Like issubclass(subtype, supertype) except that TypeVars
are not taken into account.
"""
subparams = getattr(subtype, "__parameters__", None)
if subparams is None:
return issubclass(subtype, supertype) ... | [
"def",
"_is_possible_subclass",
"(",
"self",
",",
"subtype",
",",
"supertype",
")",
":",
"subparams",
"=",
"getattr",
"(",
"subtype",
",",
"\"__parameters__\"",
",",
"None",
")",
"if",
"subparams",
"is",
"None",
":",
"return",
"issubclass",
"(",
"subtype",
"... | https://github.com/prechelt/typecheck-decorator/blob/f2c5a7a22805e39eed910ce48ca8c0c3cf16c1ab/typecheck/typing_predicates.py#L43-L59 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pip/baseparser.py | python | PrettyHelpFormatter.format_option_strings | (self, option) | return self._format_option_strings(option, ' <%s>', ', ') | [] | def format_option_strings(self, option):
return self._format_option_strings(option, ' <%s>', ', ') | [
"def",
"format_option_strings",
"(",
"self",
",",
"option",
")",
":",
"return",
"self",
".",
"_format_option_strings",
"(",
"option",
",",
"' <%s>'",
",",
"', '",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/baseparser.py#L33-L34 | |||
ChineseGLUE/ChineseGLUE | 1591b85cf5427c2ff60f718d359ecb71d2b44879 | baselines/models/xlnet/run_classifier_thucnews.py | python | THUCNewsProcessor._create_examples | (self, lines, set_type) | return examples | Creates examples for the training and dev sets. | Creates examples for the training and dev sets. | [
"Creates",
"examples",
"for",
"the",
"training",
"and",
"dev",
"sets",
"."
] | def _create_examples(self, lines, set_type):
"""Creates examples for the training and dev sets."""
examples = []
for (i, line) in enumerate(lines):
if i == 0 or len(line) < 3:
continue
guid = "%s-%s" % (set_type, i)
text_a = line[3]
... | [
"def",
"_create_examples",
"(",
"self",
",",
"lines",
",",
"set_type",
")",
":",
"examples",
"=",
"[",
"]",
"for",
"(",
"i",
",",
"line",
")",
"in",
"enumerate",
"(",
"lines",
")",
":",
"if",
"i",
"==",
"0",
"or",
"len",
"(",
"line",
")",
"<",
... | https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/xlnet/run_classifier_thucnews.py#L467-L479 | |
google/pasta | 921baea7d088cd25f69c8d583e13bbc610fe4908 | pasta/augment/rename.py | python | _rename_reads | (sc, t, old_name, new_name) | return has_changed | Updates all locations in the module where the given name is read.
Arguments:
sc: (scope.Scope) Scope to work in. This should be the scope of `t`.
t: (ast.AST) The AST to perform updates in.
old_name: (string) Dotted name to update.
new_name: (string) Dotted name to replace it with.
Returns:
Tr... | Updates all locations in the module where the given name is read. | [
"Updates",
"all",
"locations",
"in",
"the",
"module",
"where",
"the",
"given",
"name",
"is",
"read",
"."
] | def _rename_reads(sc, t, old_name, new_name):
"""Updates all locations in the module where the given name is read.
Arguments:
sc: (scope.Scope) Scope to work in. This should be the scope of `t`.
t: (ast.AST) The AST to perform updates in.
old_name: (string) Dotted name to update.
new_name: (string)... | [
"def",
"_rename_reads",
"(",
"sc",
",",
"t",
",",
"old_name",
",",
"new_name",
")",
":",
"name_parts",
"=",
"old_name",
".",
"split",
"(",
"'.'",
")",
"try",
":",
"name",
"=",
"sc",
".",
"names",
"[",
"name_parts",
"[",
"0",
"]",
"]",
"for",
"part"... | https://github.com/google/pasta/blob/921baea7d088cd25f69c8d583e13bbc610fe4908/pasta/augment/rename.py#L127-L156 | |
bjmayor/hacker | e3ce2ad74839c2733b27dac6c0f495e0743e1866 | venv/lib/python3.5/site-packages/pip/compat/dictconfig.py | python | DictConfigurator.configure_logger | (self, name, config, incremental=False) | Configure a non-root logger from a dictionary. | Configure a non-root logger from a dictionary. | [
"Configure",
"a",
"non",
"-",
"root",
"logger",
"from",
"a",
"dictionary",
"."
] | def configure_logger(self, name, config, incremental=False):
"""Configure a non-root logger from a dictionary."""
logger = logging.getLogger(name)
self.common_logger_config(logger, config, incremental)
propagate = config.get('propagate', None)
if propagate is not None:
... | [
"def",
"configure_logger",
"(",
"self",
",",
"name",
",",
"config",
",",
"incremental",
"=",
"False",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
")",
"self",
".",
"common_logger_config",
"(",
"logger",
",",
"config",
",",
"increment... | https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pip/compat/dictconfig.py#L547-L553 | ||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py | python | Spinbox.scan_dragto | (self, x) | return self.scan('dragto', x) | Compute the difference between the given x argument
and the x argument to the last scan mark command
It then adjusts the view left or right by 10 times the
difference in x-coordinates. This command is typically
associated with mouse motion events in the widget, to
produc... | Compute the difference between the given x argument
and the x argument to the last scan mark command
It then adjusts the view left or right by 10 times the
difference in x-coordinates. This command is typically
associated with mouse motion events in the widget, to
produc... | [
"Compute",
"the",
"difference",
"between",
"the",
"given",
"x",
"argument",
"and",
"the",
"x",
"argument",
"to",
"the",
"last",
"scan",
"mark",
"command",
"It",
"then",
"adjusts",
"the",
"view",
"left",
"or",
"right",
"by",
"10",
"times",
"the",
"differenc... | def scan_dragto(self, x):
"""Compute the difference between the given x argument
and the x argument to the last scan mark command
It then adjusts the view left or right by 10 times the
difference in x-coordinates. This command is typically
associated with mouse motion ev... | [
"def",
"scan_dragto",
"(",
"self",
",",
"x",
")",
":",
"return",
"self",
".",
"scan",
"(",
"'dragto'",
",",
"x",
")"
] | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py#L3867-L3877 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/urllib3/util/url.py | python | get_host | (url) | return p.scheme or 'http', p.hostname, p.port | Deprecated. Use :func:`parse_url` instead. | Deprecated. Use :func:`parse_url` instead. | [
"Deprecated",
".",
"Use",
":",
"func",
":",
"parse_url",
"instead",
"."
] | def get_host(url):
"""
Deprecated. Use :func:`parse_url` instead.
"""
p = parse_url(url)
return p.scheme or 'http', p.hostname, p.port | [
"def",
"get_host",
"(",
"url",
")",
":",
"p",
"=",
"parse_url",
"(",
"url",
")",
"return",
"p",
".",
"scheme",
"or",
"'http'",
",",
"p",
".",
"hostname",
",",
"p",
".",
"port"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/urllib3/util/url.py#L225-L230 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | examples/billing/get_invoices.py | python | main | (client, customer_id, billing_setup_id) | The main method that creates all necessary entities for the example.
Args:
client: an initialized GoogleAdsClient instance.
customer_id: a client customer ID.
billing_setup_id: a billing setup ID. | The main method that creates all necessary entities for the example. | [
"The",
"main",
"method",
"that",
"creates",
"all",
"necessary",
"entities",
"for",
"the",
"example",
"."
] | def main(client, customer_id, billing_setup_id):
"""The main method that creates all necessary entities for the example.
Args:
client: an initialized GoogleAdsClient instance.
customer_id: a client customer ID.
billing_setup_id: a billing setup ID.
"""
# The last day of last mo... | [
"def",
"main",
"(",
"client",
",",
"customer_id",
",",
"billing_setup_id",
")",
":",
"# The last day of last month.",
"last_month",
"=",
"date",
".",
"today",
"(",
")",
".",
"replace",
"(",
"day",
"=",
"1",
")",
"-",
"timedelta",
"(",
"days",
"=",
"1",
"... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/examples/billing/get_invoices.py#L26-L99 | ||
mewo2/oisin | 0e391d6dbbf931c2257a7625682a26b25733b25c | oisin/wfc.py | python | Collapser.conset | (self, node, nb) | return states | Get a set of valid states for node, given the current states of nb | Get a set of valid states for node, given the current states of nb | [
"Get",
"a",
"set",
"of",
"valid",
"states",
"for",
"node",
"given",
"the",
"current",
"states",
"of",
"nb"
] | def conset(self, node, nb):
"""Get a set of valid states for node, given the current states of nb"""
states = set()
for s in self.valid[nb]:
cons = self.consistent(node, nb, s)
states = states | cons
if states == anything:
break
return ... | [
"def",
"conset",
"(",
"self",
",",
"node",
",",
"nb",
")",
":",
"states",
"=",
"set",
"(",
")",
"for",
"s",
"in",
"self",
".",
"valid",
"[",
"nb",
"]",
":",
"cons",
"=",
"self",
".",
"consistent",
"(",
"node",
",",
"nb",
",",
"s",
")",
"state... | https://github.com/mewo2/oisin/blob/0e391d6dbbf931c2257a7625682a26b25733b25c/oisin/wfc.py#L103-L111 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/api/batch_v1_api.py | python | BatchV1Api.get_api_resources | (self, **kwargs) | return self.get_api_resources_with_http_info(**kwargs) | get_api_resources # noqa: E501
get available resources # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_api_resources(async_req=True)
>>> result = thread.get()
:... | get_api_resources # noqa: E501 | [
"get_api_resources",
"#",
"noqa",
":",
"E501"
] | def get_api_resources(self, **kwargs): # noqa: E501
"""get_api_resources # noqa: E501
get available resources # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_api_resour... | [
"def",
"get_api_resources",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"get_api_resources_with_http_info",
"(",
"*",
"*",
"kwargs",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/api/batch_v1_api.py#L979-L1001 | |
openstack/ironic | b392dc19bcd29cef5a69ec00d2f18a7a19a679e5 | ironic/conductor/manager.py | python | ConductorManager.get_supported_indicators | (self, context, node_id, component=None) | Get node hardware components and their indicators.
:param context: request context.
:param node_id: node id or uuid.
:param component: If not `None`, return indicator information
for just this component, otherwise return indicators for
all existing components.
:r... | Get node hardware components and their indicators. | [
"Get",
"node",
"hardware",
"components",
"and",
"their",
"indicators",
"."
] | def get_supported_indicators(self, context, node_id, component=None):
"""Get node hardware components and their indicators.
:param context: request context.
:param node_id: node id or uuid.
:param component: If not `None`, return indicator information
for just this component... | [
"def",
"get_supported_indicators",
"(",
"self",
",",
"context",
",",
"node_id",
",",
"component",
"=",
"None",
")",
":",
"LOG",
".",
"debug",
"(",
"'RPC get_supported_indicators called for node %s'",
",",
"node_id",
")",
"lock_purpose",
"=",
"'getting supported indica... | https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/conductor/manager.py#L2851-L2907 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/curses/ascii.py | python | isgraph | (c) | return 33 <= _ctoi(c) <= 126 | [] | def isgraph(c): return 33 <= _ctoi(c) <= 126 | [
"def",
"isgraph",
"(",
"c",
")",
":",
"return",
"33",
"<=",
"_ctoi",
"(",
"c",
")",
"<=",
"126"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/curses/ascii.py#L60-L60 | |||
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/nhl/schedule.py | python | Schedule.__repr__ | (self) | return self.__str__() | Return the string representation of the class. | Return the string representation of the class. | [
"Return",
"the",
"string",
"representation",
"of",
"the",
"class",
"."
] | def __repr__(self):
"""
Return the string representation of the class.
"""
return self.__str__() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"__str__",
"(",
")"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nhl/schedule.py#L566-L570 | |
bbc/brave | 88d4454412ee5acfa5ecf2ac5bc8cf75766c7be5 | brave/connections/connection_to_mixer.py | python | ConnectionToMixer._handle_video_mix_props | (self) | Set properties about the video mix | Set properties about the video mix | [
"Set",
"properties",
"about",
"the",
"video",
"mix"
] | def _handle_video_mix_props(self):
'''
Set properties about the video mix
'''
if 'video' not in self._mix_request_pad:
return
if hasattr(self, 'xpos'):
self._mix_request_pad['video'].set_property('xpos', self.xpos)
if hasattr(self, 'ypos'):
... | [
"def",
"_handle_video_mix_props",
"(",
"self",
")",
":",
"if",
"'video'",
"not",
"in",
"self",
".",
"_mix_request_pad",
":",
"return",
"if",
"hasattr",
"(",
"self",
",",
"'xpos'",
")",
":",
"self",
".",
"_mix_request_pad",
"[",
"'video'",
"]",
".",
"set_pr... | https://github.com/bbc/brave/blob/88d4454412ee5acfa5ecf2ac5bc8cf75766c7be5/brave/connections/connection_to_mixer.py#L104-L124 | ||
psf/black | 33e3bb1e4e326713f85749705179da2e31520670 | src/black/nodes.py | python | is_atom_with_invisible_parens | (node: LN) | return (
isinstance(first, Leaf)
and first.type == token.LPAR
and first.value == ""
and isinstance(last, Leaf)
and last.type == token.RPAR
and last.value == ""
) | Given a `LN`, determines whether it's an atom `node` with invisible
parens. Useful in dedupe-ing and normalizing parens. | Given a `LN`, determines whether it's an atom `node` with invisible
parens. Useful in dedupe-ing and normalizing parens. | [
"Given",
"a",
"LN",
"determines",
"whether",
"it",
"s",
"an",
"atom",
"node",
"with",
"invisible",
"parens",
".",
"Useful",
"in",
"dedupe",
"-",
"ing",
"and",
"normalizing",
"parens",
"."
] | def is_atom_with_invisible_parens(node: LN) -> bool:
"""Given a `LN`, determines whether it's an atom `node` with invisible
parens. Useful in dedupe-ing and normalizing parens.
"""
if isinstance(node, Leaf) or node.type != syms.atom:
return False
first, last = node.children[0], node.childre... | [
"def",
"is_atom_with_invisible_parens",
"(",
"node",
":",
"LN",
")",
"->",
"bool",
":",
"if",
"isinstance",
"(",
"node",
",",
"Leaf",
")",
"or",
"node",
".",
"type",
"!=",
"syms",
".",
"atom",
":",
"return",
"False",
"first",
",",
"last",
"=",
"node",
... | https://github.com/psf/black/blob/33e3bb1e4e326713f85749705179da2e31520670/src/black/nodes.py#L757-L772 | |
anymail/django-anymail | dc0a46a815d062d52660b9237627b22f89093bce | anymail/backends/sendinblue.py | python | SendinBluePayload.set_merge_data | (self, merge_data) | SendinBlue doesn't support special attributes for each recipient | SendinBlue doesn't support special attributes for each recipient | [
"SendinBlue",
"doesn",
"t",
"support",
"special",
"attributes",
"for",
"each",
"recipient"
] | def set_merge_data(self, merge_data):
"""SendinBlue doesn't support special attributes for each recipient"""
self.unsupported_feature("merge_data") | [
"def",
"set_merge_data",
"(",
"self",
",",
"merge_data",
")",
":",
"self",
".",
"unsupported_feature",
"(",
"\"merge_data\"",
")"
] | https://github.com/anymail/django-anymail/blob/dc0a46a815d062d52660b9237627b22f89093bce/anymail/backends/sendinblue.py#L150-L152 | ||
williballenthin/python-idb | 1db372ba2efd65e30e3ef1e6c6577d3db48f049f | idb/fileformat.py | python | Page.get_entries | (self) | generate the entries from this page in order.
each entry is guaranteed to have the following fields:
- key
- value
Yields:
Union[BranchEntry, LeafEntry]: the b-tree entries from this page. | generate the entries from this page in order.
each entry is guaranteed to have the following fields:
- key
- value | [
"generate",
"the",
"entries",
"from",
"this",
"page",
"in",
"order",
".",
"each",
"entry",
"is",
"guaranteed",
"to",
"have",
"the",
"following",
"fields",
":",
"-",
"key",
"-",
"value"
] | def get_entries(self):
"""
generate the entries from this page in order.
each entry is guaranteed to have the following fields:
- key
- value
Yields:
Union[BranchEntry, LeafEntry]: the b-tree entries from this page.
"""
self._load_entries()
... | [
"def",
"get_entries",
"(",
"self",
")",
":",
"self",
".",
"_load_entries",
"(",
")",
"for",
"entry",
"in",
"self",
".",
"_entries",
":",
"yield",
"entry"
] | https://github.com/williballenthin/python-idb/blob/1db372ba2efd65e30e3ef1e6c6577d3db48f049f/idb/fileformat.py#L313-L325 | ||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | txdav/caldav/datastore/scheduling/ischedule/utils.py | python | FakeBindAuthority.parseLines | (self, lines) | Work around a bug in the base implementation that causes parsing of TXT RRs with
spaces in the RDATA to be broken into multiple fragments and for quotes around the
data to not be removed. | Work around a bug in the base implementation that causes parsing of TXT RRs with
spaces in the RDATA to be broken into multiple fragments and for quotes around the
data to not be removed. | [
"Work",
"around",
"a",
"bug",
"in",
"the",
"base",
"implementation",
"that",
"causes",
"parsing",
"of",
"TXT",
"RRs",
"with",
"spaces",
"in",
"the",
"RDATA",
"to",
"be",
"broken",
"into",
"multiple",
"fragments",
"and",
"for",
"quotes",
"around",
"the",
"d... | def parseLines(self, lines):
"""
Work around a bug in the base implementation that causes parsing of TXT RRs with
spaces in the RDATA to be broken into multiple fragments and for quotes around the
data to not be removed.
"""
for line in lines:
if line[3] == "T... | [
"def",
"parseLines",
"(",
"self",
",",
"lines",
")",
":",
"for",
"line",
"in",
"lines",
":",
"if",
"line",
"[",
"3",
"]",
"==",
"\"TXT\"",
":",
"line",
"[",
"4",
"]",
"=",
"\" \"",
".",
"join",
"(",
"line",
"[",
"4",
":",
"]",
")",
"[",
"1",
... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/caldav/datastore/scheduling/ischedule/utils.py#L174-L185 | ||
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | TensorFlow/Translation/GNMT/beam_search_decoder.py | python | BeamSearchDecoder._maybe_merge_batch_beams | (self, t, s) | Splits the tensor from a batch by beams into a batch of beams.
More exactly, `t` is a tensor of dimension `[batch_size * beam_width] + s`,
then we reshape it to `[batch_size, beam_width] + s`.
Args:
t: `Tensor` of dimension `[batch_size * beam_width] + s`.
s: `Tensor`, Python int, or `TensorSh... | Splits the tensor from a batch by beams into a batch of beams. | [
"Splits",
"the",
"tensor",
"from",
"a",
"batch",
"by",
"beams",
"into",
"a",
"batch",
"of",
"beams",
"."
] | def _maybe_merge_batch_beams(self, t, s):
"""Splits the tensor from a batch by beams into a batch of beams.
More exactly, `t` is a tensor of dimension `[batch_size * beam_width] + s`,
then we reshape it to `[batch_size, beam_width] + s`.
Args:
t: `Tensor` of dimension `[batch_size * beam_width] ... | [
"def",
"_maybe_merge_batch_beams",
"(",
"self",
",",
"t",
",",
"s",
")",
":",
"if",
"isinstance",
"(",
"t",
",",
"tf",
".",
"TensorArray",
")",
":",
"return",
"t",
"_check_maybe",
"(",
"t",
")",
"if",
"t",
".",
"shape",
".",
"ndims",
">=",
"2",
":"... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/Translation/GNMT/beam_search_decoder.py#L559-L581 | ||
tlsfuzzer/tlslite-ng | 8720db53067ba4f7bb7b5a32d682033d8b5446f9 | tlslite/tlsconnection.py | python | TLSConnection.keyingMaterialExporter | (self, label, length=20) | Return keying material as described in RFC 5705
:type label: bytearray
:param label: label to be provided for the exporter
:type length: int
:param length: number of bytes of the keying material to export | Return keying material as described in RFC 5705 | [
"Return",
"keying",
"material",
"as",
"described",
"in",
"RFC",
"5705"
] | def keyingMaterialExporter(self, label, length=20):
"""Return keying material as described in RFC 5705
:type label: bytearray
:param label: label to be provided for the exporter
:type length: int
:param length: number of bytes of the keying material to export
"""
... | [
"def",
"keyingMaterialExporter",
"(",
"self",
",",
"label",
",",
"length",
"=",
"20",
")",
":",
"if",
"label",
"in",
"(",
"b'server finished'",
",",
"b'client finished'",
",",
"b'master secret'",
",",
"b'key expansion'",
")",
":",
"raise",
"ValueError",
"(",
"... | https://github.com/tlsfuzzer/tlslite-ng/blob/8720db53067ba4f7bb7b5a32d682033d8b5446f9/tlslite/tlsconnection.py#L90-L126 | ||
hyperspy/hyperspy | 1ffb3fab33e607045a37f30c1463350b72617e10 | hyperspy/signal.py | python | BaseSignal.nanmin | (self, axis=None, out=None, rechunk=True) | return self._apply_function_on_data_and_remove_axis(
np.nanmin, axis, out=out, rechunk=rechunk) | %s | %s | [
"%s"
] | def nanmin(self, axis=None, out=None, rechunk=True):
"""%s"""
if axis is None:
axis = self.axes_manager.navigation_axes
return self._apply_function_on_data_and_remove_axis(
np.nanmin, axis, out=out, rechunk=rechunk) | [
"def",
"nanmin",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
",",
"rechunk",
"=",
"True",
")",
":",
"if",
"axis",
"is",
"None",
":",
"axis",
"=",
"self",
".",
"axes_manager",
".",
"navigation_axes",
"return",
"self",
".",
"_apply_... | https://github.com/hyperspy/hyperspy/blob/1ffb3fab33e607045a37f30c1463350b72617e10/hyperspy/signal.py#L4000-L4005 | |
ecdavis/pants | 88129d24020e95b71e8d0260a111dc0b457b0676 | pants/_channel.py | python | _Channel._stop_waiting_for_write_event | (self) | Stop waiting for a write event on the channel, update the engine
if necessary. | Stop waiting for a write event on the channel, update the engine
if necessary. | [
"Stop",
"waiting",
"for",
"a",
"write",
"event",
"on",
"the",
"channel",
"update",
"the",
"engine",
"if",
"necessary",
"."
] | def _stop_waiting_for_write_event(self):
"""
Stop waiting for a write event on the channel, update the engine
if necessary.
"""
if self._events == self._events | Engine.WRITE:
self._events = self._events & (self._events ^ Engine.WRITE)
self.engine.modify_c... | [
"def",
"_stop_waiting_for_write_event",
"(",
"self",
")",
":",
"if",
"self",
".",
"_events",
"==",
"self",
".",
"_events",
"|",
"Engine",
".",
"WRITE",
":",
"self",
".",
"_events",
"=",
"self",
".",
"_events",
"&",
"(",
"self",
".",
"_events",
"^",
"En... | https://github.com/ecdavis/pants/blob/88129d24020e95b71e8d0260a111dc0b457b0676/pants/_channel.py#L600-L607 | ||
plastex/plastex | af1628719b50cf25fbe80f16a3e100d566e9bc32 | plasTeX/__init__.py | python | Macro.tocEntry | (self) | return self.title | Retrieve table of contents entry | Retrieve table of contents entry | [
"Retrieve",
"table",
"of",
"contents",
"entry"
] | def tocEntry(self):
""" Retrieve table of contents entry """
try:
return getattr(self, '@tocEntry')
except AttributeError:
try:
if 'toc' in list(self.attributes.keys()):
toc = self.attributes['toc']
if toc is None:
... | [
"def",
"tocEntry",
"(",
"self",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"self",
",",
"'@tocEntry'",
")",
"except",
"AttributeError",
":",
"try",
":",
"if",
"'toc'",
"in",
"list",
"(",
"self",
".",
"attributes",
".",
"keys",
"(",
")",
")",
":"... | https://github.com/plastex/plastex/blob/af1628719b50cf25fbe80f16a3e100d566e9bc32/plasTeX/__init__.py#L254-L268 | |
lmfit/lmfit-py | 47219daa401639831136d39aa472ccee9a712320 | lmfit/models.py | python | ExponentialModel.guess | (self, data, x, **kwargs) | return update_param_vals(pars, self.prefix, **kwargs) | Estimate initial model parameter values from data. | Estimate initial model parameter values from data. | [
"Estimate",
"initial",
"model",
"parameter",
"values",
"from",
"data",
"."
] | def guess(self, data, x, **kwargs):
"""Estimate initial model parameter values from data."""
try:
sval, oval = np.polyfit(x, np.log(abs(data)+1.e-15), 1)
except TypeError:
sval, oval = 1., np.log(abs(max(data)+1.e-9))
pars = self.make_params(amplitude=np.exp(oval)... | [
"def",
"guess",
"(",
"self",
",",
"data",
",",
"x",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"sval",
",",
"oval",
"=",
"np",
".",
"polyfit",
"(",
"x",
",",
"np",
".",
"log",
"(",
"abs",
"(",
"data",
")",
"+",
"1.e-15",
")",
",",
"1",
... | https://github.com/lmfit/lmfit-py/blob/47219daa401639831136d39aa472ccee9a712320/lmfit/models.py#L1275-L1282 | |
SebKuzminsky/pycam | 55e3129f518e470040e79bb00515b4bfcf36c172 | pycam/Utils/__init__.py | python | URIHandler.get_path | (self) | return url2pathname(encoded_path) | [] | def get_path(self):
encoded_path = self._uri.path
if get_platform() == OSPlatform.WINDOWS:
# prepend "netloc" (the drive letter - e.g. "c:")
encoded_path = self._uri.netloc + encoded_path
# decode all special characters like "%20" and replace "/" with "\\" (Windows)
... | [
"def",
"get_path",
"(",
"self",
")",
":",
"encoded_path",
"=",
"self",
".",
"_uri",
".",
"path",
"if",
"get_platform",
"(",
")",
"==",
"OSPlatform",
".",
"WINDOWS",
":",
"# prepend \"netloc\" (the drive letter - e.g. \"c:\")",
"encoded_path",
"=",
"self",
".",
"... | https://github.com/SebKuzminsky/pycam/blob/55e3129f518e470040e79bb00515b4bfcf36c172/pycam/Utils/__init__.py#L159-L165 | |||
bayespy/bayespy | 0e6e6130c888a4295cc9421d61d4ad27b2960ebb | bayespy/plot.py | python | bernoulli_hinton | (Z, square=True) | return _hinton(z, vmax=1.0, square=square) | Plot a Bernoulli distributed random variable as a Hinton diagram | Plot a Bernoulli distributed random variable as a Hinton diagram | [
"Plot",
"a",
"Bernoulli",
"distributed",
"random",
"variable",
"as",
"a",
"Hinton",
"diagram"
] | def bernoulli_hinton(Z, square=True):
"""
Plot a Bernoulli distributed random variable as a Hinton diagram
"""
# Make sure that the node is Bernoulli
Z = Z._ensure_moments(Z, BernoulliMoments)
# Get <Z>
z = Z._message_to_child()[0]
# Explicit broadcasting
z = z * np.ones(Z.plates)... | [
"def",
"bernoulli_hinton",
"(",
"Z",
",",
"square",
"=",
"True",
")",
":",
"# Make sure that the node is Bernoulli",
"Z",
"=",
"Z",
".",
"_ensure_moments",
"(",
"Z",
",",
"BernoulliMoments",
")",
"# Get <Z>",
"z",
"=",
"Z",
".",
"_message_to_child",
"(",
")",
... | https://github.com/bayespy/bayespy/blob/0e6e6130c888a4295cc9421d61d4ad27b2960ebb/bayespy/plot.py#L842-L857 | |
bgreenlee/sublime-github | d89cac5c30584e163babcf2db3b8a084b3ed7b86 | lib/requests/utils.py | python | unquote_header_value | (value, is_filename=False) | return value | r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote. | r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting. | [
"r",
"Unquotes",
"a",
"header",
"value",
".",
"(",
"Reversal",
"of",
":",
"func",
":",
"quote_header_value",
")",
".",
"This",
"does",
"not",
"use",
"the",
"real",
"unquoting",
"but",
"what",
"browsers",
"are",
"actually",
"using",
"for",
"quoting",
"."
] | def unquote_header_value(value, is_filename=False):
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
"""
if value and value[0] == value[-1] ==... | [
"def",
"unquote_header_value",
"(",
"value",
",",
"is_filename",
"=",
"False",
")",
":",
"if",
"value",
"and",
"value",
"[",
"0",
"]",
"==",
"value",
"[",
"-",
"1",
"]",
"==",
"'\"'",
":",
"# this is not the real unquoting, but fixing this so that the",
"# RFC i... | https://github.com/bgreenlee/sublime-github/blob/d89cac5c30584e163babcf2db3b8a084b3ed7b86/lib/requests/utils.py#L210-L231 | |
aio-libs/aiobotocore | 0b71254446ef7ba6d93016d5a8b5b02c665a7b0b | aiobotocore/response.py | python | StreamingBody.iter_chunks | (self, chunk_size=_DEFAULT_CHUNK_SIZE) | Return an iterator to yield chunks of chunk_size bytes from the raw
stream. | Return an iterator to yield chunks of chunk_size bytes from the raw
stream. | [
"Return",
"an",
"iterator",
"to",
"yield",
"chunks",
"of",
"chunk_size",
"bytes",
"from",
"the",
"raw",
"stream",
"."
] | async def iter_chunks(self, chunk_size=_DEFAULT_CHUNK_SIZE):
"""Return an iterator to yield chunks of chunk_size bytes from the raw
stream.
"""
while True:
current_chunk = await self.read(chunk_size)
if current_chunk == b"":
break
yield... | [
"async",
"def",
"iter_chunks",
"(",
"self",
",",
"chunk_size",
"=",
"_DEFAULT_CHUNK_SIZE",
")",
":",
"while",
"True",
":",
"current_chunk",
"=",
"await",
"self",
".",
"read",
"(",
"chunk_size",
")",
"if",
"current_chunk",
"==",
"b\"\"",
":",
"break",
"yield"... | https://github.com/aio-libs/aiobotocore/blob/0b71254446ef7ba6d93016d5a8b5b02c665a7b0b/aiobotocore/response.py#L98-L106 | ||
wbond/asn1crypto | 9ae350f212532dfee7f185f6b3eda24753249cf3 | asn1crypto/x509.py | python | EmailAddress.contents | (self, value) | :param value:
A byte string of the DER-encoded contents of the sequence | :param value:
A byte string of the DER-encoded contents of the sequence | [
":",
"param",
"value",
":",
"A",
"byte",
"string",
"of",
"the",
"DER",
"-",
"encoded",
"contents",
"of",
"the",
"sequence"
] | def contents(self, value):
"""
:param value:
A byte string of the DER-encoded contents of the sequence
"""
self._normalized = False
self._contents = value | [
"def",
"contents",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_normalized",
"=",
"False",
"self",
".",
"_contents",
"=",
"value"
] | https://github.com/wbond/asn1crypto/blob/9ae350f212532dfee7f185f6b3eda24753249cf3/asn1crypto/x509.py#L201-L208 | ||
ohmyadd/wetland | 76d296ec66dc438606e2455a848619d446f4a4b7 | paramiko/transport.py | python | SecurityOptions.kex | (self) | return self._transport._preferred_kex | Key exchange algorithms | Key exchange algorithms | [
"Key",
"exchange",
"algorithms"
] | def kex(self):
"""Key exchange algorithms"""
return self._transport._preferred_kex | [
"def",
"kex",
"(",
"self",
")",
":",
"return",
"self",
".",
"_transport",
".",
"_preferred_kex"
] | https://github.com/ohmyadd/wetland/blob/76d296ec66dc438606e2455a848619d446f4a4b7/paramiko/transport.py#L2636-L2638 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | api_client/python/grr_api_client/vfs.py | python | FileBase.GetBlobWithOffset | (
self,
offset: int,
timestamp: Optional[int] = None,
) | return self._context.SendStreamingRequest("GetFileBlob", args) | [] | def GetBlobWithOffset(
self,
offset: int,
timestamp: Optional[int] = None,
) -> utils.BinaryChunkIterator:
args = vfs_pb2.ApiGetFileBlobArgs(
client_id=self.client_id, file_path=self.path, offset=offset)
if timestamp is not None:
args.timestamp = timestamp
return self._cont... | [
"def",
"GetBlobWithOffset",
"(",
"self",
",",
"offset",
":",
"int",
",",
"timestamp",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
")",
"->",
"utils",
".",
"BinaryChunkIterator",
":",
"args",
"=",
"vfs_pb2",
".",
"ApiGetFileBlobArgs",
"(",
"client_i... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/api_client/python/grr_api_client/vfs.py#L167-L176 | |||
debian-calibre/calibre | 020fc81d3936a64b2ac51459ecb796666ab6a051 | src/calibre/devices/kindle/apnx.py | python | APNXBuilder.write_apnx | (self, mobi_file_path, apnx_path, method=None, page_count=0) | If you want a fixed number of pages (such as from a custom column) then
pass in a value to page_count, otherwise a count will be estimated
using either the fast or accurate algorithm. | If you want a fixed number of pages (such as from a custom column) then
pass in a value to page_count, otherwise a count will be estimated
using either the fast or accurate algorithm. | [
"If",
"you",
"want",
"a",
"fixed",
"number",
"of",
"pages",
"(",
"such",
"as",
"from",
"a",
"custom",
"column",
")",
"then",
"pass",
"in",
"a",
"value",
"to",
"page_count",
"otherwise",
"a",
"count",
"will",
"be",
"estimated",
"using",
"either",
"the",
... | def write_apnx(self, mobi_file_path, apnx_path, method=None, page_count=0):
'''
If you want a fixed number of pages (such as from a custom column) then
pass in a value to page_count, otherwise a count will be estimated
using either the fast or accurate algorithm.
'''
impo... | [
"def",
"write_apnx",
"(",
"self",
",",
"mobi_file_path",
",",
"apnx_path",
",",
"method",
"=",
"None",
",",
"page_count",
"=",
"0",
")",
":",
"import",
"uuid",
"apnx_meta",
"=",
"{",
"'guid'",
":",
"str",
"(",
"uuid",
".",
"uuid4",
"(",
")",
")",
"."... | https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/devices/kindle/apnx.py#L29-L93 | ||
kerlomz/captcha_trainer | 72b0cd02c66a9b44073820098155b3278c8bde61 | optimizer/AdaBound.py | python | AdaBoundOptimizer._prepare | (self) | [] | def _prepare(self):
self._lr_t = ops.convert_to_tensor(self._lr)
self._base_lr_t = ops.convert_to_tensor(self._lr)
self._beta1_t = ops.convert_to_tensor(self._beta1)
self._beta2_t = ops.convert_to_tensor(self._beta2)
self._epsilon_t = ops.convert_to_tensor(self._epsilon)
... | [
"def",
"_prepare",
"(",
"self",
")",
":",
"self",
".",
"_lr_t",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"self",
".",
"_lr",
")",
"self",
".",
"_base_lr_t",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"self",
".",
"_lr",
")",
"self",
".",
"_beta1_t",
... | https://github.com/kerlomz/captcha_trainer/blob/72b0cd02c66a9b44073820098155b3278c8bde61/optimizer/AdaBound.py#L80-L86 | ||||
marl/jams | edea1c4e4d5751cb10ca4379802fd898dc025d01 | jams/nsconvert.py | python | scaper_to_tag | (annotation) | return annotation | Convert scaper annotations to tag_open | Convert scaper annotations to tag_open | [
"Convert",
"scaper",
"annotations",
"to",
"tag_open"
] | def scaper_to_tag(annotation):
'''Convert scaper annotations to tag_open'''
annotation.namespace = 'tag_open'
data = annotation.pop_data()
for obs in data:
annotation.append(time=obs.time, duration=obs.duration,
confidence=obs.confidence, value=obs.value['label'])
... | [
"def",
"scaper_to_tag",
"(",
"annotation",
")",
":",
"annotation",
".",
"namespace",
"=",
"'tag_open'",
"data",
"=",
"annotation",
".",
"pop_data",
"(",
")",
"for",
"obs",
"in",
"data",
":",
"annotation",
".",
"append",
"(",
"time",
"=",
"obs",
".",
"tim... | https://github.com/marl/jams/blob/edea1c4e4d5751cb10ca4379802fd898dc025d01/jams/nsconvert.py#L242-L252 | |
CellProfiler/CellProfiler | a90e17e4d258c6f3900238be0f828e0b4bd1b293 | cellprofiler/modules/trackobjects.py | python | TrackObjects.save_kalman_measurements | (self, workspace) | Save the first-pass state_vec, state_cov and state_noise | Save the first-pass state_vec, state_cov and state_noise | [
"Save",
"the",
"first",
"-",
"pass",
"state_vec",
"state_cov",
"and",
"state_noise"
] | def save_kalman_measurements(self, workspace):
"""Save the first-pass state_vec, state_cov and state_noise"""
m = workspace.measurements
object_name = self.object_name.value
for (model, elements), kalman_state in zip(
self.get_kalman_models(), self.get_kalman_states(workspac... | [
"def",
"save_kalman_measurements",
"(",
"self",
",",
"workspace",
")",
":",
"m",
"=",
"workspace",
".",
"measurements",
"object_name",
"=",
"self",
".",
"object_name",
".",
"value",
"for",
"(",
"model",
",",
"elements",
")",
",",
"kalman_state",
"in",
"zip",... | https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/modules/trackobjects.py#L1709-L1761 | ||
zeth/inputs | a46681dbf77d6ab07834f550e5855c1f50701f99 | inputs.py | python | AppKitMouseBaseListener._get_event_type | (event) | return event.type() | Get the appkit event type of the event. | Get the appkit event type of the event. | [
"Get",
"the",
"appkit",
"event",
"type",
"of",
"the",
"event",
"."
] | def _get_event_type(event):
"""Get the appkit event type of the event."""
return event.type() | [
"def",
"_get_event_type",
"(",
"event",
")",
":",
"return",
"event",
".",
"type",
"(",
")"
] | https://github.com/zeth/inputs/blob/a46681dbf77d6ab07834f550e5855c1f50701f99/inputs.py#L2076-L2078 | |
yuanming-hu/fc4 | fc86df1ce82308b7dda28d71d705c25d6edd8251 | datasets.py | python | GehlerDataSet.regenerate_meta_data | (self) | [] | def regenerate_meta_data(self):
meta_data = []
print "Loading and shuffle fn_and_illum[]"
ground_truth = scipy.io.loadmat(self.get_directory() + 'ground_truth.mat')[
'real_rgb']
ground_truth /= np.linalg.norm(ground_truth, axis=1)[..., np.newaxis]
filenames = sorted(os.listdir(self.get_direc... | [
"def",
"regenerate_meta_data",
"(",
"self",
")",
":",
"meta_data",
"=",
"[",
"]",
"print",
"\"Loading and shuffle fn_and_illum[]\"",
"ground_truth",
"=",
"scipy",
".",
"io",
".",
"loadmat",
"(",
"self",
".",
"get_directory",
"(",
")",
"+",
"'ground_truth.mat'",
... | https://github.com/yuanming-hu/fc4/blob/fc86df1ce82308b7dda28d71d705c25d6edd8251/datasets.py#L121-L163 | ||||
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/models/selection.py | python | SelectionModel.selection | (self) | return State(self.staged, self.unmerged, self.modified, self.untracked) | [] | def selection(self):
return State(self.staged, self.unmerged, self.modified, self.untracked) | [
"def",
"selection",
"(",
"self",
")",
":",
"return",
"State",
"(",
"self",
".",
"staged",
",",
"self",
".",
"unmerged",
",",
"self",
".",
"modified",
",",
"self",
".",
"untracked",
")"
] | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/models/selection.py#L89-L90 | |||
google/closure-linter | c09c885b4e4fec386ff81cebeb8c66c2b0643d49 | closure_linter/tokenutil.py | python | DeleteTokens | (token, token_count) | Deletes the given number of tokens starting with the given token.
Args:
token: The token to start deleting at.
token_count: The total number of tokens to delete. | Deletes the given number of tokens starting with the given token. | [
"Deletes",
"the",
"given",
"number",
"of",
"tokens",
"starting",
"with",
"the",
"given",
"token",
"."
] | def DeleteTokens(token, token_count):
"""Deletes the given number of tokens starting with the given token.
Args:
token: The token to start deleting at.
token_count: The total number of tokens to delete.
"""
for i in xrange(1, token_count):
DeleteToken(token.next)
DeleteToken(token) | [
"def",
"DeleteTokens",
"(",
"token",
",",
"token_count",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
"token_count",
")",
":",
"DeleteToken",
"(",
"token",
".",
"next",
")",
"DeleteToken",
"(",
"token",
")"
] | https://github.com/google/closure-linter/blob/c09c885b4e4fec386ff81cebeb8c66c2b0643d49/closure_linter/tokenutil.py#L237-L246 | ||
ConsenSys/mythril | d00152f8e4d925c7749d63b533152a937e1dd516 | mythril/laser/ethereum/state/environment.py | python | Environment.as_dict | (self) | return dict(
active_account=self.active_account,
sender=self.sender,
calldata=self.calldata,
gasprice=self.gasprice,
callvalue=self.callvalue,
origin=self.origin,
) | :return: | [] | def as_dict(self) -> Dict:
"""
:return:
"""
return dict(
active_account=self.active_account,
sender=self.sender,
calldata=self.calldata,
gasprice=self.gasprice,
callvalue=self.callvalue,
origin=self.origin,
... | [
"def",
"as_dict",
"(",
"self",
")",
"->",
"Dict",
":",
"return",
"dict",
"(",
"active_account",
"=",
"self",
".",
"active_account",
",",
"sender",
"=",
"self",
".",
"sender",
",",
"calldata",
"=",
"self",
".",
"calldata",
",",
"gasprice",
"=",
"self",
... | https://github.com/ConsenSys/mythril/blob/d00152f8e4d925c7749d63b533152a937e1dd516/mythril/laser/ethereum/state/environment.py#L69-L81 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/idlelib/CallTips.py | python | get_argspec | (ob) | return argspec | Return a string describing the signature of a callable object, or ''.
For Python-coded functions and methods, the first line is introspected.
Delete 'self' parameter for classes (.__init__) and bound methods.
The next lines are the first lines of the doc string up to the first
empty line or _MAX_LINES.... | Return a string describing the signature of a callable object, or ''. | [
"Return",
"a",
"string",
"describing",
"the",
"signature",
"of",
"a",
"callable",
"object",
"or",
"."
] | def get_argspec(ob):
'''Return a string describing the signature of a callable object, or ''.
For Python-coded functions and methods, the first line is introspected.
Delete 'self' parameter for classes (.__init__) and bound methods.
The next lines are the first lines of the doc string up to the first
... | [
"def",
"get_argspec",
"(",
"ob",
")",
":",
"argspec",
"=",
"\"\"",
"try",
":",
"ob_call",
"=",
"ob",
".",
"__call__",
"except",
"BaseException",
":",
"return",
"argspec",
"if",
"isinstance",
"(",
"ob",
",",
"type",
")",
":",
"fob",
"=",
"ob",
".",
"_... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/idlelib/CallTips.py#L127-L171 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/watttime/config_flow.py | python | ConfigFlow.async_step_reauth | (self, config: ConfigType) | return await self.async_step_reauth_confirm() | Handle configuration by re-auth. | Handle configuration by re-auth. | [
"Handle",
"configuration",
"by",
"re",
"-",
"auth",
"."
] | async def async_step_reauth(self, config: ConfigType) -> FlowResult:
"""Handle configuration by re-auth."""
self._data = {**config}
return await self.async_step_reauth_confirm() | [
"async",
"def",
"async_step_reauth",
"(",
"self",
",",
"config",
":",
"ConfigType",
")",
"->",
"FlowResult",
":",
"self",
".",
"_data",
"=",
"{",
"*",
"*",
"config",
"}",
"return",
"await",
"self",
".",
"async_step_reauth_confirm",
"(",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/watttime/config_flow.py#L193-L196 | |
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/nodes/viewer/viewer_3d.py | python | Viewer3DNode.drawSpline | (self, spline) | [] | def drawSpline(self, spline):
vectors = spline.points
if spline.isEvaluable() and isinstance(spline, BezierSpline):
vectors = spline.getDistributedPoints(self.pointAmount, 0, 1, 'RESOLUTION')
lineType = 'LINE_LOOP' if spline.cyclic else 'LINE_STRIP'
shader = gpu.shader.from_... | [
"def",
"drawSpline",
"(",
"self",
",",
"spline",
")",
":",
"vectors",
"=",
"spline",
".",
"points",
"if",
"spline",
".",
"isEvaluable",
"(",
")",
"and",
"isinstance",
"(",
"spline",
",",
"BezierSpline",
")",
":",
"vectors",
"=",
"spline",
".",
"getDistri... | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/nodes/viewer/viewer_3d.py#L119-L132 | ||||
google-research/tapas | a3e069b50c71f50b12a6e5bb3dad10fb51f6fe68 | tapas/utils/file_utils.py | python | make_directories | (path) | Create directory recursively. Don't do anything if directory exits. | Create directory recursively. Don't do anything if directory exits. | [
"Create",
"directory",
"recursively",
".",
"Don",
"t",
"do",
"anything",
"if",
"directory",
"exits",
"."
] | def make_directories(path):
"""Create directory recursively. Don't do anything if directory exits."""
tf.io.gfile.makedirs(path) | [
"def",
"make_directories",
"(",
"path",
")",
":",
"tf",
".",
"io",
".",
"gfile",
".",
"makedirs",
"(",
"path",
")"
] | https://github.com/google-research/tapas/blob/a3e069b50c71f50b12a6e5bb3dad10fb51f6fe68/tapas/utils/file_utils.py#L22-L24 | ||
kivy/kivy | fbf561f73ddba9941b1b7e771f86264c6e6eef36 | kivy/base.py | python | EventLoopBase.remove_postproc_module | (self, mod) | Remove a postproc module. | Remove a postproc module. | [
"Remove",
"a",
"postproc",
"module",
"."
] | def remove_postproc_module(self, mod):
'''Remove a postproc module.'''
if mod in self.postproc_modules:
self.postproc_modules.remove(mod) | [
"def",
"remove_postproc_module",
"(",
"self",
",",
"mod",
")",
":",
"if",
"mod",
"in",
"self",
".",
"postproc_modules",
":",
"self",
".",
"postproc_modules",
".",
"remove",
"(",
"mod",
")"
] | https://github.com/kivy/kivy/blob/fbf561f73ddba9941b1b7e771f86264c6e6eef36/kivy/base.py#L233-L236 | ||
MycroftAI/mycroft-core | 3d963cee402e232174850f36918313e87313fb13 | mycroft/tts/tts.py | python | TTSValidator.validate_lang | (self) | Ensure the TTS supports current language. | Ensure the TTS supports current language. | [
"Ensure",
"the",
"TTS",
"supports",
"current",
"language",
"."
] | def validate_lang(self):
"""Ensure the TTS supports current language.""" | [
"def",
"validate_lang",
"(",
"self",
")",
":"
] | https://github.com/MycroftAI/mycroft-core/blob/3d963cee402e232174850f36918313e87313fb13/mycroft/tts/tts.py#L521-L522 | ||
aqlaboratory/rgn | 0133213eea9aa95900d1f16c0c6b9febbeb394cb | model/model.py | python | _recurrence | (mode, config, inputs, num_stepss) | return outputs, states | Recurrent layer for transforming inputs (primary sequences) into an internal representation. | Recurrent layer for transforming inputs (primary sequences) into an internal representation. | [
"Recurrent",
"layer",
"for",
"transforming",
"inputs",
"(",
"primary",
"sequences",
")",
"into",
"an",
"internal",
"representation",
"."
] | def _recurrence(mode, config, inputs, num_stepss):
""" Recurrent layer for transforming inputs (primary sequences) into an internal representation. """
is_training = (mode == 'training')
reverse = lambda seqs: tf.reverse_sequence(seqs, num_stepss, seq_axis=0, batch_axis=1) # convenience function for se... | [
"def",
"_recurrence",
"(",
"mode",
",",
"config",
",",
"inputs",
",",
"num_stepss",
")",
":",
"is_training",
"=",
"(",
"mode",
"==",
"'training'",
")",
"reverse",
"=",
"lambda",
"seqs",
":",
"tf",
".",
"reverse_sequence",
"(",
"seqs",
",",
"num_stepss",
... | https://github.com/aqlaboratory/rgn/blob/0133213eea9aa95900d1f16c0c6b9febbeb394cb/model/model.py#L739-L818 | |
CGCookie/retopoflow | 3d8b3a47d1d661f99ab0aeb21d31370bf15de35e | retopoflow/rf/rf_ui.py | python | RetopoFlow_UI.minimize_options_window | (self, target) | [] | def minimize_options_window(self, target):
if target.id != 'optionsdialog': return
options['show options window'] = False
self.ui_options.is_visible = False
self.ui_options_min.is_visible = True
self.ui_options_min.left = self.ui_options.left
self.ui_options_min.top ... | [
"def",
"minimize_options_window",
"(",
"self",
",",
"target",
")",
":",
"if",
"target",
".",
"id",
"!=",
"'optionsdialog'",
":",
"return",
"options",
"[",
"'show options window'",
"]",
"=",
"False",
"self",
".",
"ui_options",
".",
"is_visible",
"=",
"False",
... | https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/retopoflow/rf/rf_ui.py#L197-L204 | ||||
intohole/moodstyle | 1d06fc565c0df4bf07196854f3efb94bbefd1bfb | moodstyle/common/BaseStrut.py | python | LogNormalization.__init__ | (self , base = 10 ) | function
init
params
base log基数,最好为最大值
return
None
raise
None | function
init
params
base log基数,最好为最大值
return
None
raise
None | [
"function",
"init",
"params",
"base",
"log基数,最好为最大值",
"return",
"None",
"raise",
"None"
] | def __init__(self , base = 10 ):
'''
function
init
params
base log基数,最好为最大值
return
None
raise
None
'''
self.base = base | [
"def",
"__init__",
"(",
"self",
",",
"base",
"=",
"10",
")",
":",
"self",
".",
"base",
"=",
"base"
] | https://github.com/intohole/moodstyle/blob/1d06fc565c0df4bf07196854f3efb94bbefd1bfb/moodstyle/common/BaseStrut.py#L179-L190 | ||
iopsgroup/imoocc | de810eb6d4c1697b7139305925a5b0ba21225f3f | scanhosts/modules/paramiko_old/proxy.py | python | ProxyCommand.__init__ | (self, command_line) | Create a new CommandProxy instance. The instance created by this
class can be passed as an argument to the L{Transport} class.
@param command_line: the command that should be executed and
used as the proxy.
@type command_line: str | Create a new CommandProxy instance. The instance created by this
class can be passed as an argument to the L{Transport} class. | [
"Create",
"a",
"new",
"CommandProxy",
"instance",
".",
"The",
"instance",
"created",
"by",
"this",
"class",
"can",
"be",
"passed",
"as",
"an",
"argument",
"to",
"the",
"L",
"{",
"Transport",
"}",
"class",
"."
] | def __init__(self, command_line):
"""
Create a new CommandProxy instance. The instance created by this
class can be passed as an argument to the L{Transport} class.
@param command_line: the command that should be executed and
used as the proxy.
@type command_line: st... | [
"def",
"__init__",
"(",
"self",
",",
"command_line",
")",
":",
"self",
".",
"cmd",
"=",
"shlsplit",
"(",
"command_line",
")",
"self",
".",
"process",
"=",
"Popen",
"(",
"self",
".",
"cmd",
",",
"stdin",
"=",
"PIPE",
",",
"stdout",
"=",
"PIPE",
",",
... | https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/scanhosts/modules/paramiko_old/proxy.py#L40-L50 | ||
jfilter/clean-text | 66921d3abd40cbee0c3163aa0d986f77cb32f623 | cleantext/clean.py | python | remove_punct | (text) | return text.translate(constants.PUNCT_TRANSLATE_UNICODE) | Replace punctuations from ``text`` with whitespaces.
Args:
text (str): raw text
Returns:
str | Replace punctuations from ``text`` with whitespaces.
Args:
text (str): raw text
Returns:
str | [
"Replace",
"punctuations",
"from",
"text",
"with",
"whitespaces",
".",
"Args",
":",
"text",
"(",
"str",
")",
":",
"raw",
"text",
"Returns",
":",
"str"
] | def remove_punct(text):
"""
Replace punctuations from ``text`` with whitespaces.
Args:
text (str): raw text
Returns:
str
"""
return text.translate(constants.PUNCT_TRANSLATE_UNICODE) | [
"def",
"remove_punct",
"(",
"text",
")",
":",
"return",
"text",
".",
"translate",
"(",
"constants",
".",
"PUNCT_TRANSLATE_UNICODE",
")"
] | https://github.com/jfilter/clean-text/blob/66921d3abd40cbee0c3163aa0d986f77cb32f623/cleantext/clean.py#L181-L189 | |
tanrax/terminal-AdvancedNewFile | 34a87dbc41b0f802b383485069ee31f4cc94d196 | advance_touch.py | python | advance_touch | (paths, cd) | Make folders and files | Make folders and files | [
"Make",
"folders",
"and",
"files"
] | def advance_touch(paths, cd):
""" Make folders and files """
for path in paths:
# Make folders
new_dirs = '/'.join(path.split('/')[0:-1])
if not os.path.exists(new_dirs) and new_dirs != '':
os.makedirs(new_dirs)
# Change directory
if cd:
cd_path = ... | [
"def",
"advance_touch",
"(",
"paths",
",",
"cd",
")",
":",
"for",
"path",
"in",
"paths",
":",
"# Make folders",
"new_dirs",
"=",
"'/'",
".",
"join",
"(",
"path",
".",
"split",
"(",
"'/'",
")",
"[",
"0",
":",
"-",
"1",
"]",
")",
"if",
"not",
"os",... | https://github.com/tanrax/terminal-AdvancedNewFile/blob/34a87dbc41b0f802b383485069ee31f4cc94d196/advance_touch.py#L11-L28 | ||
DocNow/twarc | adec782f0a99987e0e909812823bb9bd01af4e5e | twarc/client.py | python | Twarc.premium_search | (
self,
q,
product,
environment,
from_date=None,
to_date=None,
max_results=None,
sandbox=False,
limit=0,
) | Search using the Premium Search API. You will need to pass in a query
a product (30day or fullarchive) and environment to use. Optionally
you can pass in a from_date and to_date to limit the search using
datetime objects. If you would like to set max_results you can, or
you can accept th... | Search using the Premium Search API. You will need to pass in a query
a product (30day or fullarchive) and environment to use. Optionally
you can pass in a from_date and to_date to limit the search using
datetime objects. If you would like to set max_results you can, or
you can accept th... | [
"Search",
"using",
"the",
"Premium",
"Search",
"API",
".",
"You",
"will",
"need",
"to",
"pass",
"in",
"a",
"query",
"a",
"product",
"(",
"30day",
"or",
"fullarchive",
")",
"and",
"environment",
"to",
"use",
".",
"Optionally",
"you",
"can",
"pass",
"in",
... | def premium_search(
self,
q,
product,
environment,
from_date=None,
to_date=None,
max_results=None,
sandbox=False,
limit=0,
):
"""
Search using the Premium Search API. You will need to pass in a query
a product (30day or ... | [
"def",
"premium_search",
"(",
"self",
",",
"q",
",",
"product",
",",
"environment",
",",
"from_date",
"=",
"None",
",",
"to_date",
"=",
"None",
",",
"max_results",
"=",
"None",
",",
"sandbox",
"=",
"False",
",",
"limit",
"=",
"0",
",",
")",
":",
"if"... | https://github.com/DocNow/twarc/blob/adec782f0a99987e0e909812823bb9bd01af4e5e/twarc/client.py#L172-L254 | ||
pytorch/ignite | e452884afa36b63447b9029c4773f6f59cf41340 | ignite/handlers/checkpoint.py | python | Checkpoint.setup_filename_pattern | (
with_prefix: bool = True, with_score: bool = True, with_score_name: bool = True, with_global_step: bool = True
) | return filename_pattern | Helper method to get the default filename pattern for a checkpoint.
Args:
with_prefix: If True, the ``filename_prefix`` is added to the filename pattern:
``{filename_prefix}_{name}...``. Default, True.
with_score: If True, ``score`` is added to the filename pattern: ``..... | Helper method to get the default filename pattern for a checkpoint. | [
"Helper",
"method",
"to",
"get",
"the",
"default",
"filename",
"pattern",
"for",
"a",
"checkpoint",
"."
] | def setup_filename_pattern(
with_prefix: bool = True, with_score: bool = True, with_score_name: bool = True, with_global_step: bool = True
) -> str:
"""Helper method to get the default filename pattern for a checkpoint.
Args:
with_prefix: If True, the ``filename_prefix`` is adde... | [
"def",
"setup_filename_pattern",
"(",
"with_prefix",
":",
"bool",
"=",
"True",
",",
"with_score",
":",
"bool",
"=",
"True",
",",
"with_score_name",
":",
"bool",
"=",
"True",
",",
"with_global_step",
":",
"bool",
"=",
"True",
")",
"->",
"str",
":",
"filenam... | https://github.com/pytorch/ignite/blob/e452884afa36b63447b9029c4773f6f59cf41340/ignite/handlers/checkpoint.py#L453-L501 | |
cdhigh/KindleEar | 7c4ecf9625239f12a829210d1760b863ef5a23aa | books/kftoutiao.py | python | KFTouTiao.url4forwarder | (self, url) | return SHARE_FUCK_GFW_SRV % urllib.quote(url) | 生成经过转发器的URL | 生成经过转发器的URL | [
"生成经过转发器的URL"
] | def url4forwarder(self, url):
' 生成经过转发器的URL '
return SHARE_FUCK_GFW_SRV % urllib.quote(url) | [
"def",
"url4forwarder",
"(",
"self",
",",
"url",
")",
":",
"return",
"SHARE_FUCK_GFW_SRV",
"%",
"urllib",
".",
"quote",
"(",
"url",
")"
] | https://github.com/cdhigh/KindleEar/blob/7c4ecf9625239f12a829210d1760b863ef5a23aa/books/kftoutiao.py#L39-L41 | |
yuanjunchai/IKC | 2a846cf1194cd9bace08973d55ecd8fd3179fe48 | codes/models/base_model.py | python | BaseModel.get_network_description | (self, network) | return s, n | Get the string and total parameters of the network | Get the string and total parameters of the network | [
"Get",
"the",
"string",
"and",
"total",
"parameters",
"of",
"the",
"network"
] | def get_network_description(self, network):
'''Get the string and total parameters of the network'''
if isinstance(network, nn.DataParallel) or isinstance(network, DistributedDataParallel):
network = network.module
s = str(network)
n = sum(map(lambda x: x.numel(), network.par... | [
"def",
"get_network_description",
"(",
"self",
",",
"network",
")",
":",
"if",
"isinstance",
"(",
"network",
",",
"nn",
".",
"DataParallel",
")",
"or",
"isinstance",
"(",
"network",
",",
"DistributedDataParallel",
")",
":",
"network",
"=",
"network",
".",
"m... | https://github.com/yuanjunchai/IKC/blob/2a846cf1194cd9bace08973d55ecd8fd3179fe48/codes/models/base_model.py#L69-L75 | |
artefactual/archivematica | 4f4605453d5a8796f6a739fa9664921bdb3418f2 | src/archivematicaCommon/lib/databaseFunctions.py | python | auto_close_db | (f) | return wrapper | Decorator to ensure the db connection is closed when the function returns. | Decorator to ensure the db connection is closed when the function returns. | [
"Decorator",
"to",
"ensure",
"the",
"db",
"connection",
"is",
"closed",
"when",
"the",
"function",
"returns",
"."
] | def auto_close_db(f):
"""Decorator to ensure the db connection is closed when the function returns."""
@wraps(f)
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
finally:
close_old_connections()
return wrapper | [
"def",
"auto_close_db",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"finally",
":",
"close_ol... | https://github.com/artefactual/archivematica/blob/4f4605453d5a8796f6a739fa9664921bdb3418f2/src/archivematicaCommon/lib/databaseFunctions.py#L44-L54 | |
acoular/acoular | 4d790517adb38dc012b1f06966262b94f3625358 | acoular/fileimport.py | python | td_import.get_data | (self, td) | Main work is done here: imports the data from `*.td` file into
TimeSamples object `td` and saves also a `*.h5` file so this import
need not be performed only once. | Main work is done here: imports the data from `*.td` file into
TimeSamples object `td` and saves also a `*.h5` file so this import
need not be performed only once. | [
"Main",
"work",
"is",
"done",
"here",
":",
"imports",
"the",
"data",
"from",
"*",
".",
"td",
"file",
"into",
"TimeSamples",
"object",
"td",
"and",
"saves",
"also",
"a",
"*",
".",
"h5",
"file",
"so",
"this",
"import",
"need",
"not",
"be",
"performed",
... | def get_data (self, td):
"""
Main work is done here: imports the data from `*.td` file into
TimeSamples object `td` and saves also a `*.h5` file so this import
need not be performed only once.
"""
if not path.isfile(self.from_file):
# no file there
... | [
"def",
"get_data",
"(",
"self",
",",
"td",
")",
":",
"if",
"not",
"path",
".",
"isfile",
"(",
"self",
".",
"from_file",
")",
":",
"# no file there",
"time_data_import",
".",
"get_data",
"(",
"self",
",",
"td",
")",
"return",
"f",
"=",
"open",
"(",
"s... | https://github.com/acoular/acoular/blob/4d790517adb38dc012b1f06966262b94f3625358/acoular/fileimport.py#L120-L153 | ||
opendatateam/udata | a295cab3c0e8f086fea1853655011f361ac81b77 | udata/commands/init.py | python | init | (ctx) | Initialize your udata instance (search index, user, sample data...) | Initialize your udata instance (search index, user, sample data...) | [
"Initialize",
"your",
"udata",
"instance",
"(",
"search",
"index",
"user",
"sample",
"data",
"...",
")"
] | def init(ctx):
'''Initialize your udata instance (search index, user, sample data...)'''
log.info('Apply DB migrations if needed')
ctx.invoke(migrate, record=True)
ctx.invoke(index)
if IS_TTY:
text = _('Do you want to create a superadmin user?')
if click.confirm(text, default=True... | [
"def",
"init",
"(",
"ctx",
")",
":",
"log",
".",
"info",
"(",
"'Apply DB migrations if needed'",
")",
"ctx",
".",
"invoke",
"(",
"migrate",
",",
"record",
"=",
"True",
")",
"ctx",
".",
"invoke",
"(",
"index",
")",
"if",
"IS_TTY",
":",
"text",
"=",
"_... | https://github.com/opendatateam/udata/blob/a295cab3c0e8f086fea1853655011f361ac81b77/udata/commands/init.py#L20-L46 | ||
feeluown/FeelUOwn | ec104689add09c351e6ca4133a5d0632294b3784 | mpv_old.py | python | MPV.screenshot | (self, includes='subtitles', mode='single') | Mapped mpv screenshot command, see man mpv(1). | Mapped mpv screenshot command, see man mpv(1). | [
"Mapped",
"mpv",
"screenshot",
"command",
"see",
"man",
"mpv",
"(",
"1",
")",
"."
] | def screenshot(self, includes='subtitles', mode='single'):
"""Mapped mpv screenshot command, see man mpv(1)."""
self.command('screenshot', includes, mode) | [
"def",
"screenshot",
"(",
"self",
",",
"includes",
"=",
"'subtitles'",
",",
"mode",
"=",
"'single'",
")",
":",
"self",
".",
"command",
"(",
"'screenshot'",
",",
"includes",
",",
"mode",
")"
] | https://github.com/feeluown/FeelUOwn/blob/ec104689add09c351e6ca4133a5d0632294b3784/mpv_old.py#L696-L698 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/api/rbac_authorization_v1alpha1_api.py | python | RbacAuthorizationV1alpha1Api.patch_namespaced_role_binding_with_http_info | (self, name, namespace, body, **kwargs) | return self.api_client.call_api(
'/apis/rbac.authorization.k8s.io/v1alpha1/namespaces/{namespace}/rolebindings/{name}', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,... | patch_namespaced_role_binding # noqa: E501
partially update the specified RoleBinding # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_namespaced_role_binding_with_http_info(na... | patch_namespaced_role_binding # noqa: E501 | [
"patch_namespaced_role_binding",
"#",
"noqa",
":",
"E501"
] | def patch_namespaced_role_binding_with_http_info(self, name, namespace, body, **kwargs): # noqa: E501
"""patch_namespaced_role_binding # noqa: E501
partially update the specified RoleBinding # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous... | [
"def",
"patch_namespaced_role_binding_with_http_info",
"(",
"self",
",",
"name",
",",
"namespace",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"local_var_params",
"=",
"locals",
"(",
")",
"all_params",
"=",
"[",
"'name'",
",",
"'namespace'",
... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/api/rbac_authorization_v1alpha1_api.py#L3399-L3522 | |
mgear-dev/mgear | 06ddc26c5adb5eab07ca470c7fafa77404c8a1de | scripts/mgear/maya/shifter/component/hydraulic_01/guide.py | python | Guide.addParameters | (self) | Add the configurations settings | Add the configurations settings | [
"Add",
"the",
"configurations",
"settings"
] | def addParameters(self):
"""Add the configurations settings"""
self.pRefArray = self.addParam("ikrefarray", "string", "")
self.pUseIndex = self.addParam("useIndex", "bool", False)
self.pParentJointIndex = self.addParam(
"parentJointIndex", "long", -1, None, None)
se... | [
"def",
"addParameters",
"(",
"self",
")",
":",
"self",
".",
"pRefArray",
"=",
"self",
".",
"addParam",
"(",
"\"ikrefarray\"",
",",
"\"string\"",
",",
"\"\"",
")",
"self",
".",
"pUseIndex",
"=",
"self",
".",
"addParam",
"(",
"\"useIndex\"",
",",
"\"bool\"",... | https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/shifter/component/hydraulic_01/guide.py#L56-L64 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/mhlib.py | python | Folder.getfullname | (self) | return os.path.join(self.mh.path, self.name) | Return the full pathname of the folder. | Return the full pathname of the folder. | [
"Return",
"the",
"full",
"pathname",
"of",
"the",
"folder",
"."
] | def getfullname(self):
"""Return the full pathname of the folder."""
return os.path.join(self.mh.path, self.name) | [
"def",
"getfullname",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"mh",
".",
"path",
",",
"self",
".",
"name",
")"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/mhlib.py#L260-L262 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twill/twill/other_packages/_mechanize_dist/_clientcookie.py | python | CookieJar.__init__ | (self, policy=None) | See CookieJar.__doc__ for argument documentation. | See CookieJar.__doc__ for argument documentation. | [
"See",
"CookieJar",
".",
"__doc__",
"for",
"argument",
"documentation",
"."
] | def __init__(self, policy=None):
"""
See CookieJar.__doc__ for argument documentation.
"""
if policy is None:
policy = DefaultCookiePolicy()
self._policy = policy
self._cookies = {}
# for __getitem__ iteration in pre-2.2 Pythons
self._prev_g... | [
"def",
"__init__",
"(",
"self",
",",
"policy",
"=",
"None",
")",
":",
"if",
"policy",
"is",
"None",
":",
"policy",
"=",
"DefaultCookiePolicy",
"(",
")",
"self",
".",
"_policy",
"=",
"policy",
"self",
".",
"_cookies",
"=",
"{",
"}",
"# for __getitem__ ite... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twill/twill/other_packages/_mechanize_dist/_clientcookie.py#L1007-L1019 | ||
pfalcon/pycopy-lib | 56ebf2110f3caa63a3785d439ce49b11e13c75c0 | datetime/datetime.py | python | date.month | (self) | return self._month | month (1-12) | month (1-12) | [
"month",
"(",
"1",
"-",
"12",
")"
] | def month(self):
"""month (1-12)"""
return self._month | [
"def",
"month",
"(",
"self",
")",
":",
"return",
"self",
".",
"_month"
] | https://github.com/pfalcon/pycopy-lib/blob/56ebf2110f3caa63a3785d439ce49b11e13c75c0/datetime/datetime.py#L752-L754 | |
oaubert/python-vlc | 908ffdbd0844dc1849728c456e147788798c99da | generated/dev/vlc.py | python | libvlc_media_list_media | (p_ml) | return f(p_ml) | Get media instance from this media list instance. This action will increase
the refcount on the media instance.
The L{libvlc_media_list_lock} should NOT be held upon entering this function.
@param p_ml: a media list instance.
@return: media instance. | Get media instance from this media list instance. This action will increase
the refcount on the media instance.
The L{libvlc_media_list_lock} should NOT be held upon entering this function. | [
"Get",
"media",
"instance",
"from",
"this",
"media",
"list",
"instance",
".",
"This",
"action",
"will",
"increase",
"the",
"refcount",
"on",
"the",
"media",
"instance",
".",
"The",
"L",
"{",
"libvlc_media_list_lock",
"}",
"should",
"NOT",
"be",
"held",
"upon... | def libvlc_media_list_media(p_ml):
'''Get media instance from this media list instance. This action will increase
the refcount on the media instance.
The L{libvlc_media_list_lock} should NOT be held upon entering this function.
@param p_ml: a media list instance.
@return: media instance.
'''
... | [
"def",
"libvlc_media_list_media",
"(",
"p_ml",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_media_list_media'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_media_list_media'",
",",
"(",
"(",
"1",
",",
")",
",",
")",
",",
"class_result... | https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/dev/vlc.py#L5874-L5884 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/io/excel.py | python | _pop_header_name | (row, index_col) | (header, new_data) for header rows in MultiIndex parsing | (header, new_data) for header rows in MultiIndex parsing | [
"(",
"header",
"new_data",
")",
"for",
"header",
"rows",
"in",
"MultiIndex",
"parsing"
] | def _pop_header_name(row, index_col):
""" (header, new_data) for header rows in MultiIndex parsing"""
none_fill = lambda x: None if x == '' else x
if index_col is None:
# no index col specified, trim data for inference path
return none_fill(row[0]), row[1:]
else:
# pop out heade... | [
"def",
"_pop_header_name",
"(",
"row",
",",
"index_col",
")",
":",
"none_fill",
"=",
"lambda",
"x",
":",
"None",
"if",
"x",
"==",
"''",
"else",
"x",
"if",
"index_col",
"is",
"None",
":",
"# no index col specified, trim data for inference path",
"return",
"none_f... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/io/excel.py#L600-L610 | ||
Eugeny/ajenti | ec75299866b26dcb0ceedd8229a152aa596da7d9 | ajenti/plugins/openvpn/manager.py | python | manager._pgenresp | (response) | return dict(map(lambda x: x.split("="), response.split(","))) | Parses generically formatted response (param1=value1,param2=value2,param3=value3)
@type response: str
@param response: Response string
@return: Dictionary | Parses generically formatted response (param1=value1,param2=value2,param3=value3) | [
"Parses",
"generically",
"formatted",
"response",
"(",
"param1",
"=",
"value1",
"param2",
"=",
"value2",
"param3",
"=",
"value3",
")"
] | def _pgenresp(response):
"""
Parses generically formatted response (param1=value1,param2=value2,param3=value3)
@type response: str
@param response: Response string
@return: Dictionary
"""
return dict(map(lambda x: x.split("="), response.split(","))) | [
"def",
"_pgenresp",
"(",
"response",
")",
":",
"return",
"dict",
"(",
"map",
"(",
"lambda",
"x",
":",
"x",
".",
"split",
"(",
"\"=\"",
")",
",",
"response",
".",
"split",
"(",
"\",\"",
")",
")",
")"
] | https://github.com/Eugeny/ajenti/blob/ec75299866b26dcb0ceedd8229a152aa596da7d9/ajenti/plugins/openvpn/manager.py#L240-L247 | |
kozec/sc-controller | ce92c773b8b26f6404882e9209aff212c4053170 | scc/osd/menu.py | python | Menu.show_submenu | (self, trash, trash2, trash3, menuitem) | Called when user chooses menu item pointing to submenu | Called when user chooses menu item pointing to submenu | [
"Called",
"when",
"user",
"chooses",
"menu",
"item",
"pointing",
"to",
"submenu"
] | def show_submenu(self, trash, trash2, trash3, menuitem):
""" Called when user chooses menu item pointing to submenu """
filename = find_menu(menuitem.filename)
if filename:
self._submenu = self.__class__()
sub_pos = list(self.position)
for i in (0, 1):
sub_pos[i] = (sub_pos[i] - self.SUBMENU_OFFSET
... | [
"def",
"show_submenu",
"(",
"self",
",",
"trash",
",",
"trash2",
",",
"trash3",
",",
"menuitem",
")",
":",
"filename",
"=",
"find_menu",
"(",
"menuitem",
".",
"filename",
")",
"if",
"filename",
":",
"self",
".",
"_submenu",
"=",
"self",
".",
"__class__",... | https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scc/osd/menu.py#L471-L495 | ||
Staffjoy/suite | 14ed49b21cf8296d2e0696a7f50f91f8e4b65072 | app/email.py | python | _send_email | (self, to, subject, html_body) | if current_app.config.get("ENV") != "prod":
allowed_domains = ["@staffjoy.com", "@7bridg.es"]
ok = False
for d in allowed_domains:
if to[-len(d):].lower() == d:
ok = True
if not ok:
current_app.logger.info(
"Intercepted email to %s... | if current_app.config.get("ENV") != "prod":
allowed_domains = ["@staffjoy.com", "@7bridg.es"]
ok = False
for d in allowed_domains:
if to[-len(d):].lower() == d:
ok = True | [
"if",
"current_app",
".",
"config",
".",
"get",
"(",
"ENV",
")",
"!",
"=",
"prod",
":",
"allowed_domains",
"=",
"[",
"@staffjoy",
".",
"com",
"@7bridg",
".",
"es",
"]",
"ok",
"=",
"False",
"for",
"d",
"in",
"allowed_domains",
":",
"if",
"to",
"[",
... | def _send_email(self, to, subject, html_body):
# We intentionally commented out this code - we used it to prevent emails in development from going to non-Staffjoy emails.
"""
if current_app.config.get("ENV") != "prod":
allowed_domains = ["@staffjoy.com", "@7bridg.es"]
ok = False
for... | [
"def",
"_send_email",
"(",
"self",
",",
"to",
",",
"subject",
",",
"html_body",
")",
":",
"# We intentionally commented out this code - we used it to prevent emails in development from going to non-Staffjoy emails.",
"if",
"to",
"in",
"current_app",
".",
"config",
".",
"get",... | https://github.com/Staffjoy/suite/blob/14ed49b21cf8296d2e0696a7f50f91f8e4b65072/app/email.py#L14-L92 | ||
bdauvergne/python-oath | eb5aa28c3d0b2c0b67fa936be24c6b72b85dd9f4 | oath/_hotp.py | python | int2beint64 | (i) | return struct.pack('>Q', int(i)) | [] | def int2beint64(i):
return struct.pack('>Q', int(i)) | [
"def",
"int2beint64",
"(",
"i",
")",
":",
"return",
"struct",
".",
"pack",
"(",
"'>Q'",
",",
"int",
"(",
"i",
")",
")"
] | https://github.com/bdauvergne/python-oath/blob/eb5aa28c3d0b2c0b67fa936be24c6b72b85dd9f4/oath/_hotp.py#L38-L39 | |||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/blockmatrix.py | python | BlockMatrix.equals | (self, other) | return super(BlockMatrix, self).equals(other) | [] | def equals(self, other):
if self == other:
return True
if (isinstance(other, BlockMatrix) and self.blocks == other.blocks):
return True
return super(BlockMatrix, self).equals(other) | [
"def",
"equals",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
"==",
"other",
":",
"return",
"True",
"if",
"(",
"isinstance",
"(",
"other",
",",
"BlockMatrix",
")",
"and",
"self",
".",
"blocks",
"==",
"other",
".",
"blocks",
")",
":",
"return",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/blockmatrix.py#L181-L186 | |||
dpp/simply_lift | cf49f7dcce81c7f1557314dd0f0bb08aaedc73da | elyxer.py | python | BibAuthor.__unicode__ | (self) | return result + self.surname | Return a printable representation. | Return a printable representation. | [
"Return",
"a",
"printable",
"representation",
"."
] | def __unicode__(self):
"Return a printable representation."
result = ''
for firstname in self.firstnames:
result += firstname + ' '
return result + self.surname | [
"def",
"__unicode__",
"(",
"self",
")",
":",
"result",
"=",
"''",
"for",
"firstname",
"in",
"self",
".",
"firstnames",
":",
"result",
"+=",
"firstname",
"+",
"' '",
"return",
"result",
"+",
"self",
".",
"surname"
] | https://github.com/dpp/simply_lift/blob/cf49f7dcce81c7f1557314dd0f0bb08aaedc73da/elyxer.py#L7770-L7775 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/cinder/cinder/utils.py | python | sanitize_hostname | (hostname) | return hostname | Return a hostname which conforms to RFC-952 and RFC-1123 specs. | Return a hostname which conforms to RFC-952 and RFC-1123 specs. | [
"Return",
"a",
"hostname",
"which",
"conforms",
"to",
"RFC",
"-",
"952",
"and",
"RFC",
"-",
"1123",
"specs",
"."
] | def sanitize_hostname(hostname):
"""Return a hostname which conforms to RFC-952 and RFC-1123 specs."""
if isinstance(hostname, unicode):
hostname = hostname.encode('latin-1', 'ignore')
hostname = re.sub('[ _]', '-', hostname)
hostname = re.sub('[^\w.-]+', '', hostname)
hostname = hostname.l... | [
"def",
"sanitize_hostname",
"(",
"hostname",
")",
":",
"if",
"isinstance",
"(",
"hostname",
",",
"unicode",
")",
":",
"hostname",
"=",
"hostname",
".",
"encode",
"(",
"'latin-1'",
",",
"'ignore'",
")",
"hostname",
"=",
"re",
".",
"sub",
"(",
"'[ _]'",
",... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/utils.py#L956-L966 | |
pikpikcu/Pentest-Tools-Framework | cd6e6107764a809943dc4e073cde8149c1a2cd03 | modules/xsser/build/bdist.linux-armv7l/egg/core/threadpool.py | python | WorkerThread.dismiss | (self) | Sets a flag to tell the thread to exit when done with current job. | Sets a flag to tell the thread to exit when done with current job. | [
"Sets",
"a",
"flag",
"to",
"tell",
"the",
"thread",
"to",
"exit",
"when",
"done",
"with",
"current",
"job",
"."
] | def dismiss(self):
"""Sets a flag to tell the thread to exit when done with current job."""
self._dismissed.set() | [
"def",
"dismiss",
"(",
"self",
")",
":",
"self",
".",
"_dismissed",
".",
"set",
"(",
")"
] | https://github.com/pikpikcu/Pentest-Tools-Framework/blob/cd6e6107764a809943dc4e073cde8149c1a2cd03/modules/xsser/build/bdist.linux-armv7l/egg/core/threadpool.py#L187-L189 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.