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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/idlelib/IOBinding.py | python | IOBinding.set_saved | (self, flag) | [] | def set_saved(self, flag):
self.editwin.set_saved(flag) | [
"def",
"set_saved",
"(",
"self",
",",
"flag",
")",
":",
"self",
".",
"editwin",
".",
"set_saved",
"(",
"flag",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/idlelib/IOBinding.py#L133-L134 | ||||
pikpikcu/Pentest-Tools-Framework | cd6e6107764a809943dc4e073cde8149c1a2cd03 | modules/xsser/build/bdist.linux-armv7l/egg/core/main.py | python | xsser.start_wizard | (self) | Start Wizard Helper | Start Wizard Helper | [
"Start",
"Wizard",
"Helper"
] | def start_wizard(self):
"""
Start Wizard Helper
"""
#step 0: Menu
ans1=True
ans2=True
ans3=True
ans4=True
ans5=True
ans6=True
#step 1: Where
while ans1:
print("""\nA)- Where are your targets?\n
[1]-... | [
"def",
"start_wizard",
"(",
"self",
")",
":",
"#step 0: Menu",
"ans1",
"=",
"True",
"ans2",
"=",
"True",
"ans3",
"=",
"True",
"ans4",
"=",
"True",
"ans5",
"=",
"True",
"ans6",
"=",
"True",
"#step 1: Where",
"while",
"ans1",
":",
"print",
"(",
"\"\"\"\\nA... | https://github.com/pikpikcu/Pentest-Tools-Framework/blob/cd6e6107764a809943dc4e073cde8149c1a2cd03/modules/xsser/build/bdist.linux-armv7l/egg/core/main.py#L1612-L1829 | ||
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/pickle.py | python | Pickler.clear_memo | (self) | Clears the pickler's "memo".
The memo is the data structure that remembers which objects the
pickler has already seen, so that shared or recursive objects are
pickled by reference and not by value. This method is useful when
re-using picklers. | Clears the pickler's "memo". | [
"Clears",
"the",
"pickler",
"s",
"memo",
"."
] | def clear_memo(self):
"""Clears the pickler's "memo".
The memo is the data structure that remembers which objects the
pickler has already seen, so that shared or recursive objects are
pickled by reference and not by value. This method is useful when
re-using picklers.
... | [
"def",
"clear_memo",
"(",
"self",
")",
":",
"self",
".",
"memo",
".",
"clear",
"(",
")"
] | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/pickle.py#L209-L218 | ||
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/tempfile.py | python | _get_candidate_names | () | return _name_sequence | Common setup sequence for all user-callable interfaces. | Common setup sequence for all user-callable interfaces. | [
"Common",
"setup",
"sequence",
"for",
"all",
"user",
"-",
"callable",
"interfaces",
"."
] | def _get_candidate_names():
"""Common setup sequence for all user-callable interfaces."""
global _name_sequence
if _name_sequence is None:
_once_lock.acquire()
try:
if _name_sequence is None:
_name_sequence = _RandomNameSequence()
finally:
_on... | [
"def",
"_get_candidate_names",
"(",
")",
":",
"global",
"_name_sequence",
"if",
"_name_sequence",
"is",
"None",
":",
"_once_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"_name_sequence",
"is",
"None",
":",
"_name_sequence",
"=",
"_RandomNameSequence",
"(",... | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/tempfile.py#L235-L246 | |
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/androwarn/androwarn/search/malicious_behaviours/code_execution.py | python | gather_code_execution | (x) | return result | @param x : a VMAnalysis instance
@rtype : a list strings for the concerned category, for exemple [ 'This application makes phone calls', "This application sends an SMS message 'Premium SMS' to the '12345' phone number" ] | [] | def gather_code_execution(x) :
"""
@param x : a VMAnalysis instance
@rtype : a list strings for the concerned category, for exemple [ 'This application makes phone calls', "This application sends an SMS message 'Premium SMS' to the '12345' phone number" ]
"""
result = []
result.extend( detect_Library_loadin... | [
"def",
"gather_code_execution",
"(",
"x",
")",
":",
"result",
"=",
"[",
"]",
"result",
".",
"extend",
"(",
"detect_Library_loading",
"(",
"x",
")",
")",
"result",
".",
"extend",
"(",
"detect_UNIX_command_execution",
"(",
"x",
")",
")",
"return",
"result"
] | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/androwarn/androwarn/search/malicious_behaviours/code_execution.py#L88-L99 | ||
JimmXinu/FanFicFare | bc149a2deb2636320fe50a3e374af6eef8f61889 | fanficfare/adapters/adapter_pretendercentrecom.py | python | PretenderCenterComAdapter.getSiteURLPattern | (self) | return r"https?://(www\.)?"+re.escape(self.getSiteDomain()+"/missingpieces/viewstory.php?sid=")+r"\d+$" | [] | def getSiteURLPattern(self):
return r"https?://(www\.)?"+re.escape(self.getSiteDomain()+"/missingpieces/viewstory.php?sid=")+r"\d+$" | [
"def",
"getSiteURLPattern",
"(",
"self",
")",
":",
"return",
"r\"https?://(www\\.)?\"",
"+",
"re",
".",
"escape",
"(",
"self",
".",
"getSiteDomain",
"(",
")",
"+",
"\"/missingpieces/viewstory.php?sid=\"",
")",
"+",
"r\"\\d+$\""
] | https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/fanficfare/adapters/adapter_pretendercentrecom.py#L68-L69 | |||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/twiml/voice_response.py | python | Prompt.say | (self, message=None, voice=None, loop=None, language=None, **kwargs) | return self.nest(Say(message=message, voice=voice, loop=loop, language=language, **kwargs)) | Create a <Say> element
:param message: Message to say
:param voice: Voice to use
:param loop: Times to loop message
:param language: Message langauge
:param kwargs: additional attributes
:returns: <Say> element | Create a <Say> element | [
"Create",
"a",
"<Say",
">",
"element"
] | def say(self, message=None, voice=None, loop=None, language=None, **kwargs):
"""
Create a <Say> element
:param message: Message to say
:param voice: Voice to use
:param loop: Times to loop message
:param language: Message langauge
:param kwargs: additional attrib... | [
"def",
"say",
"(",
"self",
",",
"message",
"=",
"None",
",",
"voice",
"=",
"None",
",",
"loop",
"=",
"None",
",",
"language",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"nest",
"(",
"Say",
"(",
"message",
"=",
"message... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/twiml/voice_response.py#L644-L656 | |
SeanLee97/xmnlp | 0ffad8616c248845b18f819c0ac0465a4ec45f5d | xmnlp/radical/radical.py | python | Radical.__init__ | (self) | [] | def __init__(self):
self.dictionary = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"dictionary",
"=",
"{",
"}"
] | https://github.com/SeanLee97/xmnlp/blob/0ffad8616c248845b18f819c0ac0465a4ec45f5d/xmnlp/radical/radical.py#L15-L16 | ||||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/geometry/geometry_utilities/matrix.py | python | Matrix.addXML | (self, depth, output) | Add xml for this object. | Add xml for this object. | [
"Add",
"xml",
"for",
"this",
"object",
"."
] | def addXML(self, depth, output):
'Add xml for this object.'
attributes = self.getAttributes()
if len(attributes) > 0:
xml_simple_writer.addClosedXMLTag(attributes, depth, self.__class__.__name__.lower(), output) | [
"def",
"addXML",
"(",
"self",
",",
"depth",
",",
"output",
")",
":",
"attributes",
"=",
"self",
".",
"getAttributes",
"(",
")",
"if",
"len",
"(",
"attributes",
")",
">",
"0",
":",
"xml_simple_writer",
".",
"addClosedXMLTag",
"(",
"attributes",
",",
"dept... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/geometry_utilities/matrix.py#L457-L461 | ||
tlsfuzzer/tlslite-ng | 8720db53067ba4f7bb7b5a32d682033d8b5446f9 | tlslite/messages.py | python | RecordHeader2.parse | (self, parser) | return self | Deserialise object from Parser. | Deserialise object from Parser. | [
"Deserialise",
"object",
"from",
"Parser",
"."
] | def parse(self, parser):
"""Deserialise object from Parser."""
firstByte = parser.get(1)
secondByte = parser.get(1)
if firstByte & 0x80:
self.length = ((firstByte & 0x7f) << 8) | secondByte
else:
self.length = ((firstByte & 0x3f) << 8) | secondByte
... | [
"def",
"parse",
"(",
"self",
",",
"parser",
")",
":",
"firstByte",
"=",
"parser",
".",
"get",
"(",
"1",
")",
"secondByte",
"=",
"parser",
".",
"get",
"(",
"1",
")",
"if",
"firstByte",
"&",
"0x80",
":",
"self",
".",
"length",
"=",
"(",
"(",
"first... | https://github.com/tlsfuzzer/tlslite-ng/blob/8720db53067ba4f7bb7b5a32d682033d8b5446f9/tlslite/messages.py#L105-L118 | |
weechat/scripts | 99ec0e7eceefabb9efb0f11ec26d45d6e8e84335 | python/otr.py | python | TableFormatter.format | (self) | return '\n'.join([self.format_row(row) for row in self.rows]) | Return the formatted table as a string. | Return the formatted table as a string. | [
"Return",
"the",
"formatted",
"table",
"as",
"a",
"string",
"."
] | def format(self):
"""Return the formatted table as a string."""
return '\n'.join([self.format_row(row) for row in self.rows]) | [
"def",
"format",
"(",
"self",
")",
":",
"return",
"'\\n'",
".",
"join",
"(",
"[",
"self",
".",
"format_row",
"(",
"row",
")",
"for",
"row",
"in",
"self",
".",
"rows",
"]",
")"
] | https://github.com/weechat/scripts/blob/99ec0e7eceefabb9efb0f11ec26d45d6e8e84335/python/otr.py#L1169-L1171 | |
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/util/better_exchook.py | python | Color.__init__ | (self, enable=None) | :param bool|None enable: | :param bool|None enable: | [
":",
"param",
"bool|None",
"enable",
":"
] | def __init__(self, enable=None):
"""
:param bool|None enable:
"""
if enable is None:
enable = self.get_global_color_enabled()
self.enable = enable
self._dark_terminal_background = self.is_dark_terminal_background()
# Set color palettes (will be used so... | [
"def",
"__init__",
"(",
"self",
",",
"enable",
"=",
"None",
")",
":",
"if",
"enable",
"is",
"None",
":",
"enable",
"=",
"self",
".",
"get_global_color_enabled",
"(",
")",
"self",
".",
"enable",
"=",
"enable",
"self",
".",
"_dark_terminal_background",
"=",
... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/util/better_exchook.py#L623-L638 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/sqli/thirdparty/odict/odict.py | python | Items.__len__ | (self) | return len(self._main._sequence) | [] | def __len__(self): return len(self._main._sequence) # easier :-) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_main",
".",
"_sequence",
")",
"# easier :-)"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/thirdparty/odict/odict.py#L1032-L1032 | |||
zvtvz/zvt | 054bf8a3e7a049df7087c324fa87e8effbaf5bdc | src/zvt/contract/context.py | python | Registry.__init__ | (self) | [] | def __init__(self) -> None:
# all registered providers
self.providers = []
# all registered entity types(str)
self.tradable_entity_types = []
# all entity schemas
self.entity_schemas = []
# all registered schemas
self.schemas = []
# tradable en... | [
"def",
"__init__",
"(",
"self",
")",
"->",
"None",
":",
"# all registered providers",
"self",
".",
"providers",
"=",
"[",
"]",
"# all registered entity types(str)",
"self",
".",
"tradable_entity_types",
"=",
"[",
"]",
"# all entity schemas",
"self",
".",
"entity_sch... | https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/src/zvt/contract/context.py#L5-L43 | ||||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/python/reflect.py | python | _importAndCheckStack | (importName) | Import the given name as a module, then walk the stack to determine whether
the failure was the module not existing, or some code in the module (for
example a dependent import) failing. This can be helpful to determine
whether any actual application code was run. For example, to distiguish
administrat... | Import the given name as a module, then walk the stack to determine whether
the failure was the module not existing, or some code in the module (for
example a dependent import) failing. This can be helpful to determine
whether any actual application code was run. For example, to distiguish
administrat... | [
"Import",
"the",
"given",
"name",
"as",
"a",
"module",
"then",
"walk",
"the",
"stack",
"to",
"determine",
"whether",
"the",
"failure",
"was",
"the",
"module",
"not",
"existing",
"or",
"some",
"code",
"in",
"the",
"module",
"(",
"for",
"example",
"a",
"de... | def _importAndCheckStack(importName):
"""
Import the given name as a module, then walk the stack to determine whether
the failure was the module not existing, or some code in the module (for
example a dependent import) failing. This can be helpful to determine
whether any actual application code wa... | [
"def",
"_importAndCheckStack",
"(",
"importName",
")",
":",
"try",
":",
"return",
"__import__",
"(",
"importName",
")",
"except",
"ImportError",
":",
"excType",
",",
"excValue",
",",
"excTraceback",
"=",
"sys",
".",
"exc_info",
"(",
")",
"while",
"excTraceback... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/reflect.py#L230-L257 | ||
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/utilities/data_structures.py | python | Node.children | (self, value) | Setter for the **self.children** property. | Setter for the **self.children** property. | [
"Setter",
"for",
"the",
"**",
"self",
".",
"children",
"**",
"property",
"."
] | def children(self, value):
"""
Setter for the **self.children** property.
"""
if value is not None:
attest(
isinstance(value, Sequence) and not isinstance(value, str),
'"{0}" attribute: "{1}" type is not a "Sequence" instance!'
... | [
"def",
"children",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"attest",
"(",
"isinstance",
"(",
"value",
",",
"Sequence",
")",
"and",
"not",
"isinstance",
"(",
"value",
",",
"str",
")",
",",
"'\"{0}\" attribute: \"{1}\"... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/utilities/data_structures.py#L676-L696 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | examples/treeview/node_background.py | python | layout | (node) | [] | def layout(node):
if node.is_leaf():
N = AttrFace("name", fsize=30)
faces.add_face_to_node(N, node, 0, position="aligned") | [
"def",
"layout",
"(",
"node",
")",
":",
"if",
"node",
".",
"is_leaf",
"(",
")",
":",
"N",
"=",
"AttrFace",
"(",
"\"name\"",
",",
"fsize",
"=",
"30",
")",
"faces",
".",
"add_face_to_node",
"(",
"N",
",",
"node",
",",
"0",
",",
"position",
"=",
"\"... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/examples/treeview/node_background.py#L3-L6 | ||||
jupyterlab/jupyterlab-latex | e6deb0bba7785d5fcc1d88dd907e44e92c1af895 | setupbase.py | python | _iexplode_path | (path) | Iterate over all the parts of a path.
Splits path recursively with os.path.split(). | Iterate over all the parts of a path. | [
"Iterate",
"over",
"all",
"the",
"parts",
"of",
"a",
"path",
"."
] | def _iexplode_path(path):
"""Iterate over all the parts of a path.
Splits path recursively with os.path.split().
"""
(head, tail) = os.path.split(path)
if not head or (not tail and head == path):
if head:
yield head
if tail or not head:
yield tail
ret... | [
"def",
"_iexplode_path",
"(",
"path",
")",
":",
"(",
"head",
",",
"tail",
")",
"=",
"os",
".",
"path",
".",
"split",
"(",
"path",
")",
"if",
"not",
"head",
"or",
"(",
"not",
"tail",
"and",
"head",
"==",
"path",
")",
":",
"if",
"head",
":",
"yie... | https://github.com/jupyterlab/jupyterlab-latex/blob/e6deb0bba7785d5fcc1d88dd907e44e92c1af895/setupbase.py#L616-L630 | ||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/analyses/calling_convention.py | python | CallingConventionAnalysis._reorder_args | (self, args, cc) | return reg_args + args + stack_args | Reorder arguments according to the calling convention identified.
:param set args: A list of arguments that haven't been ordered.
:param SimCC cc: The identified calling convention.
:return: A reordered list of args. | Reorder arguments according to the calling convention identified. | [
"Reorder",
"arguments",
"according",
"to",
"the",
"calling",
"convention",
"identified",
"."
] | def _reorder_args(self, args, cc):
"""
Reorder arguments according to the calling convention identified.
:param set args: A list of arguments that haven't been ordered.
:param SimCC cc: The identified calling convention.
:return: A reordered list of args.
... | [
"def",
"_reorder_args",
"(",
"self",
",",
"args",
",",
"cc",
")",
":",
"reg_args",
"=",
"[",
"]",
"for",
"reg_name",
"in",
"cc",
".",
"ARG_REGS",
":",
"try",
":",
"arg",
"=",
"next",
"(",
"iter",
"(",
"a",
"for",
"a",
"in",
"args",
"if",
"isinsta... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/calling_convention.py#L497-L525 | |
vietnlp/etnlp | c82f1dd451a66cdfb3cd8e02a047ecec31df1636 | src/codes/utils/embedding_io.py | python | load_words_raw | (file_path: str, emb_config: EmbeddingConfigs) | return words | Load the file as-is, without doing any validation or cleanup.
:param file_path:
:param emb_config:
:return: | Load the file as-is, without doing any validation or cleanup.
:param file_path:
:param emb_config:
:return: | [
"Load",
"the",
"file",
"as",
"-",
"is",
"without",
"doing",
"any",
"validation",
"or",
"cleanup",
".",
":",
"param",
"file_path",
":",
":",
"param",
"emb_config",
":",
":",
"return",
":"
] | def load_words_raw(file_path: str, emb_config: EmbeddingConfigs) -> List[Word]:
"""
Load the file as-is, without doing any validation or cleanup.
:param file_path:
:param emb_config:
:return:
"""
def parse_line(line: str, frequency: int) -> Word:
# print("Line=", line)
token... | [
"def",
"load_words_raw",
"(",
"file_path",
":",
"str",
",",
"emb_config",
":",
"EmbeddingConfigs",
")",
"->",
"List",
"[",
"Word",
"]",
":",
"def",
"parse_line",
"(",
"line",
":",
"str",
",",
"frequency",
":",
"int",
")",
"->",
"Word",
":",
"# print(\"Li... | https://github.com/vietnlp/etnlp/blob/c82f1dd451a66cdfb3cd8e02a047ecec31df1636/src/codes/utils/embedding_io.py#L88-L165 | |
flairNLP/flair | b774774752c8338aab3d620f7e5062f66ec7a69d | flair/datasets/biomedical.py | python | bioc_to_internal | (bioc_file: Path) | return InternalBioNerDataset(documents=texts_per_document, entities_per_document=entities_per_document) | Helper function to parse corpora that are given in BIOC format. See
http://bioc.sourceforge.net/
for details. | Helper function to parse corpora that are given in BIOC format. See | [
"Helper",
"function",
"to",
"parse",
"corpora",
"that",
"are",
"given",
"in",
"BIOC",
"format",
".",
"See"
] | def bioc_to_internal(bioc_file: Path):
"""
Helper function to parse corpora that are given in BIOC format. See
http://bioc.sourceforge.net/
for details.
"""
tree = etree.parse(str(bioc_file))
texts_per_document = {}
entities_per_document = {}
documents = tree.xpath(".//document... | [
"def",
"bioc_to_internal",
"(",
"bioc_file",
":",
"Path",
")",
":",
"tree",
"=",
"etree",
".",
"parse",
"(",
"str",
"(",
"bioc_file",
")",
")",
"texts_per_document",
"=",
"{",
"}",
"entities_per_document",
"=",
"{",
"}",
"documents",
"=",
"tree",
".",
"x... | https://github.com/flairNLP/flair/blob/b774774752c8338aab3d620f7e5062f66ec7a69d/flair/datasets/biomedical.py#L186-L271 | |
kovidgoyal/calibre | 2b41671370f2a9eb1109b9ae901ccf915f1bd0c8 | src/calibre/ebooks/pdb/ereader/reader202.py | python | Reader202.dump_images | (self, output_dir) | This is primarily used for debugging and 3rd party tools to
get the images in the file. | This is primarily used for debugging and 3rd party tools to
get the images in the file. | [
"This",
"is",
"primarily",
"used",
"for",
"debugging",
"and",
"3rd",
"party",
"tools",
"to",
"get",
"the",
"images",
"in",
"the",
"file",
"."
] | def dump_images(self, output_dir):
'''
This is primarily used for debugging and 3rd party tools to
get the images in the file.
'''
if not os.path.exists(output_dir):
os.makedirs(output_dir)
with CurrentDir(output_dir):
for i in range(0, self.heade... | [
"def",
"dump_images",
"(",
"self",
",",
"output_dir",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"output_dir",
")",
":",
"os",
".",
"makedirs",
"(",
"output_dir",
")",
"with",
"CurrentDir",
"(",
"output_dir",
")",
":",
"for",
"i",
... | https://github.com/kovidgoyal/calibre/blob/2b41671370f2a9eb1109b9ae901ccf915f1bd0c8/src/calibre/ebooks/pdb/ereader/reader202.py#L154-L166 | ||
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/Shared/sortedcontainers/sortedlist.py | python | SortedListWithKey.insert | (self, idx, val) | Insert the element *val* into the list at *idx*. Raises a ValueError if
the *val* at *idx* would violate the sort order. | Insert the element *val* into the list at *idx*. Raises a ValueError if
the *val* at *idx* would violate the sort order. | [
"Insert",
"the",
"element",
"*",
"val",
"*",
"into",
"the",
"list",
"at",
"*",
"idx",
"*",
".",
"Raises",
"a",
"ValueError",
"if",
"the",
"*",
"val",
"*",
"at",
"*",
"idx",
"*",
"would",
"violate",
"the",
"sort",
"order",
"."
] | def insert(self, idx, val):
"""
Insert the element *val* into the list at *idx*. Raises a ValueError if
the *val* at *idx* would violate the sort order.
"""
_len = self._len
_lists = self._lists
_keys = self._keys
_maxes = self._maxes
if idx < 0:
... | [
"def",
"insert",
"(",
"self",
",",
"idx",
",",
"val",
")",
":",
"_len",
"=",
"self",
".",
"_len",
"_lists",
"=",
"self",
".",
"_lists",
"_keys",
"=",
"self",
".",
"_keys",
"_maxes",
"=",
"self",
".",
"_maxes",
"if",
"idx",
"<",
"0",
":",
"idx",
... | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Shared/sortedcontainers/sortedlist.py#L2215-L2281 | ||
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/visual/custommouse.py | python | CustomMouse.setPos | (self, pos) | Not implemented yet. Place the mouse at a specific position. | Not implemented yet. Place the mouse at a specific position. | [
"Not",
"implemented",
"yet",
".",
"Place",
"the",
"mouse",
"at",
"a",
"specific",
"position",
"."
] | def setPos(self, pos):
"""Not implemented yet. Place the mouse at a specific position.
"""
raise NotImplementedError('setPos is not available for custom mouse') | [
"def",
"setPos",
"(",
"self",
",",
"pos",
")",
":",
"raise",
"NotImplementedError",
"(",
"'setPos is not available for custom mouse'",
")"
] | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/visual/custommouse.py#L150-L153 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_adm_registry.py | python | Registry.prepared_registry | (self, data) | setter method for prepared_registry attribute | setter method for prepared_registry attribute | [
"setter",
"method",
"for",
"prepared_registry",
"attribute"
] | def prepared_registry(self, data):
''' setter method for prepared_registry attribute '''
self.__prepared_registry = data | [
"def",
"prepared_registry",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"__prepared_registry",
"=",
"data"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_adm_registry.py#L2424-L2426 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/linecache.py | python | lazycache | (filename, module_globals) | return False | Seed the cache for filename with module_globals.
The module loader will be asked for the source only when getlines is
called, not immediately.
If there is an entry in the cache already, it is not altered.
:return: True if a lazy load is registered in the cache,
otherwise False. To register su... | Seed the cache for filename with module_globals. | [
"Seed",
"the",
"cache",
"for",
"filename",
"with",
"module_globals",
"."
] | def lazycache(filename, module_globals):
"""Seed the cache for filename with module_globals.
The module loader will be asked for the source only when getlines is
called, not immediately.
If there is an entry in the cache already, it is not altered.
:return: True if a lazy load is registered in th... | [
"def",
"lazycache",
"(",
"filename",
",",
"module_globals",
")",
":",
"if",
"filename",
"in",
"cache",
":",
"if",
"len",
"(",
"cache",
"[",
"filename",
"]",
")",
"==",
"1",
":",
"return",
"True",
"else",
":",
"return",
"False",
"if",
"not",
"filename",... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/linecache.py#L147-L182 | |
donnemartin/gitsome | d7c57abc7cb66e9c910a844f15d4536866da3310 | xonsh/ply/example/optcalc/calc.py | python | p_expression_number | (t) | expression : NUMBER | expression : NUMBER | [
"expression",
":",
"NUMBER"
] | def p_expression_number(t):
'expression : NUMBER'
t[0] = t[1] | [
"def",
"p_expression_number",
"(",
"t",
")",
":",
"t",
"[",
"0",
"]",
"=",
"t",
"[",
"1",
"]"
] | https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/xonsh/ply/example/optcalc/calc.py#L106-L108 | ||
OpenRCE/sulley | bff0dd1864d055eb4bfa8aacbbb6ecf215e4db4b | sulley/pedrpc.py | python | client.__connect | (self) | Connect to the PED-RPC server. | Connect to the PED-RPC server. | [
"Connect",
"to",
"the",
"PED",
"-",
"RPC",
"server",
"."
] | def __connect (self):
'''
Connect to the PED-RPC server.
'''
# if we have a pre-existing server socket, ensure it's closed.
self.__disconnect()
# connect to the server, timeout on failure.
try:
self.__server_sock = socket.socket(socket.AF_INET, socke... | [
"def",
"__connect",
"(",
"self",
")",
":",
"# if we have a pre-existing server socket, ensure it's closed.",
"self",
".",
"__disconnect",
"(",
")",
"# connect to the server, timeout on failure.",
"try",
":",
"self",
".",
"__server_sock",
"=",
"socket",
".",
"socket",
"(",... | https://github.com/OpenRCE/sulley/blob/bff0dd1864d055eb4bfa8aacbbb6ecf215e4db4b/sulley/pedrpc.py#L37-L60 | ||
djblets/djblets | 0496e1ec49e43d43d776768c9fc5b6f8af56ec2c | djblets/avatars/services/base.py | python | AvatarService.is_configurable | (cls) | return cls.config_form_class is not None | Return whether or not the service is configurable.
Returns:
bool:
Whether or not the service is configurable. | Return whether or not the service is configurable. | [
"Return",
"whether",
"or",
"not",
"the",
"service",
"is",
"configurable",
"."
] | def is_configurable(cls):
"""Return whether or not the service is configurable.
Returns:
bool:
Whether or not the service is configurable.
"""
return cls.config_form_class is not None | [
"def",
"is_configurable",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"config_form_class",
"is",
"not",
"None"
] | https://github.com/djblets/djblets/blob/0496e1ec49e43d43d776768c9fc5b6f8af56ec2c/djblets/avatars/services/base.py#L68-L75 | |
ialbert/biostar-central | 2dc7bd30691a50b2da9c2833ba354056bc686afa | biostar/planet/auth.py | python | create_blogpost | (entry, blog) | return | [] | def create_blogpost(entry, blog):
date = entry.get('date_parsed') or entry.get('published_parsed')
date = datetime(date[0], date[1], date[2])
date = timezone.make_aware(date, timezone=timezone.utc)
if not entry.title:
return
# body = html.clean(entry.description)[:5000]
body = entry.des... | [
"def",
"create_blogpost",
"(",
"entry",
",",
"blog",
")",
":",
"date",
"=",
"entry",
".",
"get",
"(",
"'date_parsed'",
")",
"or",
"entry",
".",
"get",
"(",
"'published_parsed'",
")",
"date",
"=",
"datetime",
"(",
"date",
"[",
"0",
"]",
",",
"date",
"... | https://github.com/ialbert/biostar-central/blob/2dc7bd30691a50b2da9c2833ba354056bc686afa/biostar/planet/auth.py#L22-L43 | |||
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/fractions.py | python | Fraction.__trunc__ | (a) | trunc(a) | trunc(a) | [
"trunc",
"(",
"a",
")"
] | def __trunc__(a):
"""trunc(a)"""
if a._numerator < 0:
return -(-a._numerator // a._denominator)
else:
return a._numerator // a._denominator | [
"def",
"__trunc__",
"(",
"a",
")",
":",
"if",
"a",
".",
"_numerator",
"<",
"0",
":",
"return",
"-",
"(",
"-",
"a",
".",
"_numerator",
"//",
"a",
".",
"_denominator",
")",
"else",
":",
"return",
"a",
".",
"_numerator",
"//",
"a",
".",
"_denominator"... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/fractions.py#L501-L506 | ||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | paddlex/cv/models/classifier.py | python | ResNet34.__init__ | (self, num_classes=1000, **params) | [] | def __init__(self, num_classes=1000, **params):
super(ResNet34, self).__init__(
model_name='ResNet34', num_classes=num_classes, **params) | [
"def",
"__init__",
"(",
"self",
",",
"num_classes",
"=",
"1000",
",",
"*",
"*",
"params",
")",
":",
"super",
"(",
"ResNet34",
",",
"self",
")",
".",
"__init__",
"(",
"model_name",
"=",
"'ResNet34'",
",",
"num_classes",
"=",
"num_classes",
",",
"*",
"*"... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/cv/models/classifier.py#L536-L538 | ||||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/ui/gui/helpers.py | python | PropagateBuffer.__init__ | (self, target) | [] | def __init__(self, target):
self.target = target
self.alerted = {}
self.last_notified = None | [
"def",
"__init__",
"(",
"self",
",",
"target",
")",
":",
"self",
".",
"target",
"=",
"target",
"self",
".",
"alerted",
"=",
"{",
"}",
"self",
".",
"last_notified",
"=",
"None"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/helpers.py#L42-L45 | ||||
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/cookielib.py | python | CookieJar.add_cookie_header | (self, request) | Add correct Cookie: header to request (urllib2.Request object).
The Cookie2 header is also added unless policy.hide_cookie2 is true. | Add correct Cookie: header to request (urllib2.Request object). | [
"Add",
"correct",
"Cookie",
":",
"header",
"to",
"request",
"(",
"urllib2",
".",
"Request",
"object",
")",
"."
] | def add_cookie_header(self, request):
"""Add correct Cookie: header to request (urllib2.Request object).
The Cookie2 header is also added unless policy.hide_cookie2 is true.
"""
_debug("add_cookie_header")
self._cookies_lock.acquire()
try:
self._policy._now... | [
"def",
"add_cookie_header",
"(",
"self",
",",
"request",
")",
":",
"_debug",
"(",
"\"add_cookie_header\"",
")",
"self",
".",
"_cookies_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_policy",
".",
"_now",
"=",
"self",
".",
"_now",
"=",
"int",... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/cookielib.py#L1328-L1359 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/argparse.py | python | _ActionsContainer._handle_conflict_error | (self, action, conflicting_actions) | [] | def _handle_conflict_error(self, action, conflicting_actions):
message = ngettext('conflicting option string: %s',
'conflicting option strings: %s',
len(conflicting_actions))
conflict_string = ', '.join([option_string
... | [
"def",
"_handle_conflict_error",
"(",
"self",
",",
"action",
",",
"conflicting_actions",
")",
":",
"message",
"=",
"ngettext",
"(",
"'conflicting option string: %s'",
",",
"'conflicting option strings: %s'",
",",
"len",
"(",
"conflicting_actions",
")",
")",
"conflict_st... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/argparse.py#L1541-L1548 | ||||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/operations/ops_copy.py | python | ops_copy_Mixin._getInitialPasteOffsetForPastableNodes | (self, original_copied_nodes) | return initial_offset_for_chunks, initial_offset_for_other_pastables | @see: self._pasteGroup(), self._pasteChunk()
What it supports:
1. User selects some objects
2. Hits Ctrl + C
3. Hits Ctrl + V
- first ctrl V pastes object at an offset, (doesn't recenter the view)
to the original one
- 2nd paste offsets it further and lik... | @see: self._pasteGroup(), self._pasteChunk()
What it supports:
1. User selects some objects
2. Hits Ctrl + C
3. Hits Ctrl + V
- first ctrl V pastes object at an offset, (doesn't recenter the view)
to the original one
- 2nd paste offsets it further and lik... | [
"@see",
":",
"self",
".",
"_pasteGroup",
"()",
"self",
".",
"_pasteChunk",
"()",
"What",
"it",
"supports",
":",
"1",
".",
"User",
"selects",
"some",
"objects",
"2",
".",
"Hits",
"Ctrl",
"+",
"C",
"3",
".",
"Hits",
"Ctrl",
"+",
"V",
"-",
"first",
"c... | def _getInitialPasteOffsetForPastableNodes(self, original_copied_nodes): # by Ninad
"""
@see: self._pasteGroup(), self._pasteChunk()
What it supports:
1. User selects some objects
2. Hits Ctrl + C
3. Hits Ctrl + V
- first ctrl V pastes object at an offset, (doe... | [
"def",
"_getInitialPasteOffsetForPastableNodes",
"(",
"self",
",",
"original_copied_nodes",
")",
":",
"# by Ninad",
"#@TODO: Review this method. It was added just before v1.1.0 to fix a",
"#copy-paste-pasteagain-pasteagain bug -- Ninad 2008-06-06",
"if",
"same_vals",
"(",
"original_copie... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/operations/ops_copy.py#L770-L795 | |
bslatkin/effectivepython | 4ae6f3141291ea137eb29a245bf889dbc8091713 | example_code/item_14.py | python | Tool.__repr__ | (self) | return f'Tool({self.name!r}, {self.weight})' | [] | def __repr__(self):
return f'Tool({self.name!r}, {self.weight})' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"f'Tool({self.name!r}, {self.weight})'"
] | https://github.com/bslatkin/effectivepython/blob/4ae6f3141291ea137eb29a245bf889dbc8091713/example_code/item_14.py#L61-L62 | |||
RasaHQ/rasa | 54823b68c1297849ba7ae841a4246193cd1223a1 | rasa/utils/tensorflow/environment.py | python | _setup_gpu_environment | () | Sets configuration for TensorFlow GPU environment based on env variable. | Sets configuration for TensorFlow GPU environment based on env variable. | [
"Sets",
"configuration",
"for",
"TensorFlow",
"GPU",
"environment",
"based",
"on",
"env",
"variable",
"."
] | def _setup_gpu_environment() -> None:
"""Sets configuration for TensorFlow GPU environment based on env variable."""
gpu_memory_config = os.getenv(ENV_GPU_CONFIG)
if not gpu_memory_config:
return
# Import from tensorflow only if necessary (environment variable was set)
from tensorflow impo... | [
"def",
"_setup_gpu_environment",
"(",
")",
"->",
"None",
":",
"gpu_memory_config",
"=",
"os",
".",
"getenv",
"(",
"ENV_GPU_CONFIG",
")",
"if",
"not",
"gpu_memory_config",
":",
"return",
"# Import from tensorflow only if necessary (environment variable was set)",
"from",
"... | https://github.com/RasaHQ/rasa/blob/54823b68c1297849ba7ae841a4246193cd1223a1/rasa/utils/tensorflow/environment.py#L21-L43 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/numpy/ma/core.py | python | minimum_fill_value | (obj) | Return the maximum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the minimum of an array with a given dtype.
Parameters
----------
obj : ndarray or dtype
An object that can be queried for it's numeric type.... | Return the maximum value that can be represented by the dtype of an object. | [
"Return",
"the",
"maximum",
"value",
"that",
"can",
"be",
"represented",
"by",
"the",
"dtype",
"of",
"an",
"object",
"."
] | def minimum_fill_value(obj):
"""
Return the maximum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the minimum of an array with a given dtype.
Parameters
----------
obj : ndarray or dtype
An object t... | [
"def",
"minimum_fill_value",
"(",
"obj",
")",
":",
"errmsg",
"=",
"\"Unsuitable type for calculating minimum.\"",
"if",
"hasattr",
"(",
"obj",
",",
"'dtype'",
")",
":",
"return",
"_recursive_extremum_fill_value",
"(",
"obj",
".",
"dtype",
",",
"min_filler",
")",
"... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/ma/core.py#L236-L296 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/docutils/utils/math/math2html.py | python | HeaderParser.complete | (self, ending) | return self | Complete the parser with the given ending. | Complete the parser with the given ending. | [
"Complete",
"the",
"parser",
"with",
"the",
"given",
"ending",
"."
] | def complete(self, ending):
"Complete the parser with the given ending."
self.ending = ending
return self | [
"def",
"complete",
"(",
"self",
",",
"ending",
")",
":",
"self",
".",
"ending",
"=",
"ending",
"return",
"self"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/docutils/utils/math/math2html.py#L4992-L4995 | |
ahmetozlu/vehicle_counting_tensorflow | ce4e86107f36404cdb91c38bf8514983df5e5153 | utils/label_map_util.py | python | convert_label_map_to_categories | (label_map,
max_num_classes,
use_display_name=True) | return categories | Loads label map proto and returns categories list compatible with eval.
This function loads a label map and returns a list of dicts, each of which
has the following keys:
'id': (required) an integer id uniquely identifying this category.
'name': (required) string representing category name
e.g., 'cat... | Loads label map proto and returns categories list compatible with eval. | [
"Loads",
"label",
"map",
"proto",
"and",
"returns",
"categories",
"list",
"compatible",
"with",
"eval",
"."
] | def convert_label_map_to_categories(label_map,
max_num_classes,
use_display_name=True):
"""Loads label map proto and returns categories list compatible with eval.
This function loads a label map and returns a list of dicts, each of which
has... | [
"def",
"convert_label_map_to_categories",
"(",
"label_map",
",",
"max_num_classes",
",",
"use_display_name",
"=",
"True",
")",
":",
"categories",
"=",
"[",
"]",
"list_of_ids_already_added",
"=",
"[",
"]",
"if",
"not",
"label_map",
":",
"label_id_offset",
"=",
"1",... | https://github.com/ahmetozlu/vehicle_counting_tensorflow/blob/ce4e86107f36404cdb91c38bf8514983df5e5153/utils/label_map_util.py#L58-L105 | |
YapengTian/TDAN-VSR-CVPR-2020 | 5ca05727f27570b7aa67d1ad5f3e87494e5a7dbd | solver.py | python | Solver._check_PSNR | (self, dataset, is_test=False) | return avr_psnr, avr_ssim, stats, outputs, names | Get the output of model with the input being 'dataset' then
compute the PSNR between output and label.
if 'is_test' is True, psnr and output of each image is also
return for statistics and generate output image at test phase | Get the output of model with the input being 'dataset' then
compute the PSNR between output and label. | [
"Get",
"the",
"output",
"of",
"model",
"with",
"the",
"input",
"being",
"dataset",
"then",
"compute",
"the",
"PSNR",
"between",
"output",
"and",
"label",
"."
] | def _check_PSNR(self, dataset, is_test=False):
"""
Get the output of model with the input being 'dataset' then
compute the PSNR between output and label.
if 'is_test' is True, psnr and output of each image is also
return for statistics and generate output image at test phase
... | [
"def",
"_check_PSNR",
"(",
"self",
",",
"dataset",
",",
"is_test",
"=",
"False",
")",
":",
"# process one image per iter for test phase",
"if",
"is_test",
":",
"batch_size",
"=",
"1",
"else",
":",
"batch_size",
"=",
"1",
"# self.batch_size",
"dataloader",
"=",
"... | https://github.com/YapengTian/TDAN-VSR-CVPR-2020/blob/5ca05727f27570b7aa67d1ad5f3e87494e5a7dbd/solver.py#L266-L357 | |
petercorke/robotics-toolbox-python | 51aa8bbb3663a7c815f9880d538d61e7c85bc470 | roboticstoolbox/tools/urdf/urdf.py | python | Joint.child | (self) | return self._child | str : The name of the child link. | str : The name of the child link. | [
"str",
":",
"The",
"name",
"of",
"the",
"child",
"link",
"."
] | def child(self):
"""str : The name of the child link."""
return self._child | [
"def",
"child",
"(",
"self",
")",
":",
"return",
"self",
".",
"_child"
] | https://github.com/petercorke/robotics-toolbox-python/blob/51aa8bbb3663a7c815f9880d538d61e7c85bc470/roboticstoolbox/tools/urdf/urdf.py#L1331-L1333 | |
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/engine/processes/calcjobs/calcjob.py | python | validate_stash_options | (stash_options: Any, _: Any) | return None | Validate the ``stash`` options. | Validate the ``stash`` options. | [
"Validate",
"the",
"stash",
"options",
"."
] | def validate_stash_options(stash_options: Any, _: Any) -> Optional[str]:
"""Validate the ``stash`` options."""
from aiida.common.datastructures import StashMode
target_base = stash_options.get('target_base', None)
source_list = stash_options.get('source_list', None)
stash_mode = stash_options.get('... | [
"def",
"validate_stash_options",
"(",
"stash_options",
":",
"Any",
",",
"_",
":",
"Any",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"from",
"aiida",
".",
"common",
".",
"datastructures",
"import",
"StashMode",
"target_base",
"=",
"stash_options",
".",
"get... | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/engine/processes/calcjobs/calcjob.py#L110-L134 | |
robinhood/faust | 01b4c0ad8390221db71751d80001b0fd879291e2 | faust/agents/agent.py | python | Agent.on_shared_partitions_assigned | (self, assigned: Set[TP]) | Call when non-isolated partitions are assigned. | Call when non-isolated partitions are assigned. | [
"Call",
"when",
"non",
"-",
"isolated",
"partitions",
"are",
"assigned",
"."
] | async def on_shared_partitions_assigned(self, assigned: Set[TP]) -> None:
"""Call when non-isolated partitions are assigned."""
... | [
"async",
"def",
"on_shared_partitions_assigned",
"(",
"self",
",",
"assigned",
":",
"Set",
"[",
"TP",
"]",
")",
"->",
"None",
":",
"..."
] | https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/agents/agent.py#L428-L430 | ||
eoyilmaz/stalker | a35c041b79d953d00dc2a09cf8206956ca269bef | stalker/models/version.py | python | Version._template_variables | (self) | return kwargs | variables used in rendering the filename template | variables used in rendering the filename template | [
"variables",
"used",
"in",
"rendering",
"the",
"filename",
"template"
] | def _template_variables(self):
"""variables used in rendering the filename template
"""
from stalker import Shot
sequences = []
scenes = []
if isinstance(self.task, Shot):
sequences = self.task.sequences
scenes = self.task.scenes
# get th... | [
"def",
"_template_variables",
"(",
"self",
")",
":",
"from",
"stalker",
"import",
"Shot",
"sequences",
"=",
"[",
"]",
"scenes",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"self",
".",
"task",
",",
"Shot",
")",
":",
"sequences",
"=",
"self",
".",
"task",
... | https://github.com/eoyilmaz/stalker/blob/a35c041b79d953d00dc2a09cf8206956ca269bef/stalker/models/version.py#L369-L398 | |
buildbot/buildbot | b9c558217c72e4c2463eedc7ec6d56736f7b01a8 | master/setup.py | python | define_plugin_entries | (groups) | return result | helper to all groups for plugins | helper to all groups for plugins | [
"helper",
"to",
"all",
"groups",
"for",
"plugins"
] | def define_plugin_entries(groups):
"""
helper to all groups for plugins
"""
result = dict()
for group, modules in groups:
tempo = []
for module_name, names in modules:
tempo.extend([define_plugin_entry(name, module_name)
for name in names])
... | [
"def",
"define_plugin_entries",
"(",
"groups",
")",
":",
"result",
"=",
"dict",
"(",
")",
"for",
"group",
",",
"modules",
"in",
"groups",
":",
"tempo",
"=",
"[",
"]",
"for",
"module_name",
",",
"names",
"in",
"modules",
":",
"tempo",
".",
"extend",
"("... | https://github.com/buildbot/buildbot/blob/b9c558217c72e4c2463eedc7ec6d56736f7b01a8/master/setup.py#L113-L126 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_adm_policy_group.py | python | RoleBinding.__init__ | (self, content) | RoleBinding constructor | RoleBinding constructor | [
"RoleBinding",
"constructor"
] | def __init__(self, content):
'''RoleBinding constructor'''
super(RoleBinding, self).__init__(content=content)
self._subjects = None
self._role_ref = None
self._group_names = None
self._user_names = None | [
"def",
"__init__",
"(",
"self",
",",
"content",
")",
":",
"super",
"(",
"RoleBinding",
",",
"self",
")",
".",
"__init__",
"(",
"content",
"=",
"content",
")",
"self",
".",
"_subjects",
"=",
"None",
"self",
".",
"_role_ref",
"=",
"None",
"self",
".",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_adm_policy_group.py#L1514-L1520 | ||
liquidctl/liquidctl | 73962574632f94050c2a75f517e929a29797b5e2 | liquidctl/keyval.py | python | RuntimeStorage.__init__ | (self, key_prefixes, backend=None) | [] | def __init__(self, key_prefixes, backend=None):
if not backend:
backend = _FilesystemBackend(key_prefixes)
self._backend = backend | [
"def",
"__init__",
"(",
"self",
",",
"key_prefixes",
",",
"backend",
"=",
"None",
")",
":",
"if",
"not",
"backend",
":",
"backend",
"=",
"_FilesystemBackend",
"(",
"key_prefixes",
")",
"self",
".",
"_backend",
"=",
"backend"
] | https://github.com/liquidctl/liquidctl/blob/73962574632f94050c2a75f517e929a29797b5e2/liquidctl/keyval.py#L179-L182 | ||||
cisco-sas/kitty | cb0760989dcdfe079e43ac574d872d0b18953a32 | kitty/model/low_level/aliases.py | python | Greater | (field, comp_value) | return Compare(field, '>', comp_value) | Condition applies if the value of the field is greater than the comp_value
:rtype: :class:`~kitty.model.low_level.condition.Compare` | Condition applies if the value of the field is greater than the comp_value | [
"Condition",
"applies",
"if",
"the",
"value",
"of",
"the",
"field",
"is",
"greater",
"than",
"the",
"comp_value"
] | def Greater(field, comp_value):
'''
Condition applies if the value of the field is greater than the comp_value
:rtype: :class:`~kitty.model.low_level.condition.Compare`
'''
return Compare(field, '>', comp_value) | [
"def",
"Greater",
"(",
"field",
",",
"comp_value",
")",
":",
"return",
"Compare",
"(",
"field",
",",
"'>'",
",",
"comp_value",
")"
] | https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/aliases.py#L282-L288 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/xlsgrid.py | python | XLSTable.GetRawValue | (self, row, col) | return cell.raw_value | Returns the "raw" value for the cell content.
:param `row`: the row in which this cell lives;
:param `col`: the column in which this cell lives. | Returns the "raw" value for the cell content. | [
"Returns",
"the",
"raw",
"value",
"for",
"the",
"cell",
"content",
"."
] | def GetRawValue(self, row, col):
"""
Returns the "raw" value for the cell content.
:param `row`: the row in which this cell lives;
:param `col`: the column in which this cell lives.
"""
cell = self.cells[(row, col)]
return cell.raw_value | [
"def",
"GetRawValue",
"(",
"self",
",",
"row",
",",
"col",
")",
":",
"cell",
"=",
"self",
".",
"cells",
"[",
"(",
"row",
",",
"col",
")",
"]",
"return",
"cell",
".",
"raw_value"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/xlsgrid.py#L1802-L1811 | |
daoluan/decode-Django | d46a858b45b56de48b0355f50dd9e45402d04cfd | Django-1.5.1/django/utils/translation/trans_real.py | python | blankout | (src, char) | return dot_re.sub(char, src) | Changes every non-whitespace character to the given char.
Used in the templatize function. | Changes every non-whitespace character to the given char.
Used in the templatize function. | [
"Changes",
"every",
"non",
"-",
"whitespace",
"character",
"to",
"the",
"given",
"char",
".",
"Used",
"in",
"the",
"templatize",
"function",
"."
] | def blankout(src, char):
"""
Changes every non-whitespace character to the given char.
Used in the templatize function.
"""
return dot_re.sub(char, src) | [
"def",
"blankout",
"(",
"src",
",",
"char",
")",
":",
"return",
"dot_re",
".",
"sub",
"(",
"char",
",",
"src",
")"
] | https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/utils/translation/trans_real.py#L437-L442 | |
thunlp/ERNIE | 9a4ab4af54bccb70b4eb53cbfe71a2bc16b9e93f | code/run_typing.py | python | DataProcessor.get_labels | (self) | Gets the list of labels for this data set. | Gets the list of labels for this data set. | [
"Gets",
"the",
"list",
"of",
"labels",
"for",
"this",
"data",
"set",
"."
] | def get_labels(self):
"""Gets the list of labels for this data set."""
raise NotImplementedError() | [
"def",
"get_labels",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/thunlp/ERNIE/blob/9a4ab4af54bccb70b4eb53cbfe71a2bc16b9e93f/code/run_typing.py#L91-L93 | ||
morganstanley/treadmill | f18267c665baf6def4374d21170198f63ff1cde4 | lib/python/treadmill/discovery.py | python | Discovery.sync | (self, watch=True) | Find matching endpoints and put them on the queue for processing.
If watch is True, establish a watch on /apps for new changes,
otherwise put termination signal into the queue. | Find matching endpoints and put them on the queue for processing. | [
"Find",
"matching",
"endpoints",
"and",
"put",
"them",
"on",
"the",
"queue",
"for",
"processing",
"."
] | def sync(self, watch=True):
"""Find matching endpoints and put them on the queue for processing.
If watch is True, establish a watch on /apps for new changes,
otherwise put termination signal into the queue.
"""
watch_cb = None
if watch:
watch_cb = self.apps_... | [
"def",
"sync",
"(",
"self",
",",
"watch",
"=",
"True",
")",
":",
"watch_cb",
"=",
"None",
"if",
"watch",
":",
"watch_cb",
"=",
"self",
".",
"apps_watcher",
"match",
"=",
"self",
".",
"get_endpoints_zk",
"(",
"watch_cb",
"=",
"watch_cb",
")",
"# let's rea... | https://github.com/morganstanley/treadmill/blob/f18267c665baf6def4374d21170198f63ff1cde4/lib/python/treadmill/discovery.py#L67-L94 | ||
maciejczyzewski/neural-chessboard | b4a8906059fd61f1962828602cc7253a9881cd7a | utils.py | python | head | (msg) | return "\x1b[5;30;43m " + msg + " \x1b[0m" | [] | def head(msg): return "\x1b[5;30;43m " + msg + " \x1b[0m" | [
"def",
"head",
"(",
"msg",
")",
":",
"return",
"\"\\x1b[5;30;43m \"",
"+",
"msg",
"+",
"\" \\x1b[0m\""
] | https://github.com/maciejczyzewski/neural-chessboard/blob/b4a8906059fd61f1962828602cc7253a9881cd7a/utils.py#L30-L30 | |||
gluon/AbletonLive9_RemoteScripts | 0c0db5e2e29bbed88c82bf327f54d4968d36937e | _Tools/stubout.py | python | StubOutForTesting.Set | (self, parent, child_name, new_child) | Replace child_name's old definition with new_child, in the context
of the given parent. The parent could be a module when the child is a
function at module scope. Or the parent could be a class when a class'
method is being replaced. The named child is set to new_child, while
the prio... | Replace child_name's old definition with new_child, in the context
of the given parent. The parent could be a module when the child is a
function at module scope. Or the parent could be a class when a class'
method is being replaced. The named child is set to new_child, while
the prio... | [
"Replace",
"child_name",
"s",
"old",
"definition",
"with",
"new_child",
"in",
"the",
"context",
"of",
"the",
"given",
"parent",
".",
"The",
"parent",
"could",
"be",
"a",
"module",
"when",
"the",
"child",
"is",
"a",
"function",
"at",
"module",
"scope",
".",... | def Set(self, parent, child_name, new_child):
"""Replace child_name's old definition with new_child, in the context
of the given parent. The parent could be a module when the child is a
function at module scope. Or the parent could be a class when a class'
method is being replaced. Th... | [
"def",
"Set",
"(",
"self",
",",
"parent",
",",
"child_name",
",",
"new_child",
")",
":",
"old_child",
"=",
"getattr",
"(",
"parent",
",",
"child_name",
")",
"old_attribute",
"=",
"parent",
".",
"__dict__",
".",
"get",
"(",
"child_name",
")",
"if",
"old_a... | https://github.com/gluon/AbletonLive9_RemoteScripts/blob/0c0db5e2e29bbed88c82bf327f54d4968d36937e/_Tools/stubout.py#L84-L102 | ||
danforthcenter/plantcv | aecd599d917884770aa0c7dec15bc9d1c53f36c4 | plantcv/plantcv/spectral_index/spectral_index.py | python | ci_rededge | (hsi, distance=20) | Chlorophyll Index Red Edge.
CI_REDEDGE = (R800 / R700) - 1
The theoretical range for CI_REDEDGE is [-1.0, Inf).
Inputs:
hsi = hyperspectral image (PlantCV Spectral_data instance)
distance = how lenient to be if the required wavelengths are not available
Returns:
index_array = ... | Chlorophyll Index Red Edge. | [
"Chlorophyll",
"Index",
"Red",
"Edge",
"."
] | def ci_rededge(hsi, distance=20):
"""Chlorophyll Index Red Edge.
CI_REDEDGE = (R800 / R700) - 1
The theoretical range for CI_REDEDGE is [-1.0, Inf).
Inputs:
hsi = hyperspectral image (PlantCV Spectral_data instance)
distance = how lenient to be if the required wavelengths are not a... | [
"def",
"ci_rededge",
"(",
"hsi",
",",
"distance",
"=",
"20",
")",
":",
"if",
"(",
"float",
"(",
"hsi",
".",
"max_wavelength",
")",
"+",
"distance",
")",
">=",
"800",
"and",
"(",
"float",
"(",
"hsi",
".",
"min_wavelength",
")",
"-",
"distance",
")",
... | https://github.com/danforthcenter/plantcv/blob/aecd599d917884770aa0c7dec15bc9d1c53f36c4/plantcv/plantcv/spectral_index/spectral_index.py#L169-L197 | ||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ttypes.py | python | HeartbeatTxnRangeResponse.__ne__ | (self, other) | return not (self == other) | [] | def __ne__(self, other):
return not (self == other) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"(",
"self",
"==",
"other",
")"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ttypes.py#L8751-L8752 | |||
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/electronic_structure/boltztrap2.py | python | BztTransportProperties.__init__ | (
self,
BztInterpolator,
temp_r=np.arange(100, 1400, 100),
doping=None,
npts_mu=4000,
CRTA=1e-14,
margin=None,
save_bztTranspProps=False,
load_bztTranspProps=False,
fname="bztTranspProps.json.gz",
) | Args:
BztInterpolator: a BztInterpolator previously generated
temp_r: numpy array of temperatures at which to calculate trasport properties
doping: doping levels at which to calculate trasport properties. If provided,
transport properties w.r.t. these doping levels ar... | Args:
BztInterpolator: a BztInterpolator previously generated
temp_r: numpy array of temperatures at which to calculate trasport properties
doping: doping levels at which to calculate trasport properties. If provided,
transport properties w.r.t. these doping levels ar... | [
"Args",
":",
"BztInterpolator",
":",
"a",
"BztInterpolator",
"previously",
"generated",
"temp_r",
":",
"numpy",
"array",
"of",
"temperatures",
"at",
"which",
"to",
"calculate",
"trasport",
"properties",
"doping",
":",
"doping",
"levels",
"at",
"which",
"to",
"ca... | def __init__(
self,
BztInterpolator,
temp_r=np.arange(100, 1400, 100),
doping=None,
npts_mu=4000,
CRTA=1e-14,
margin=None,
save_bztTranspProps=False,
load_bztTranspProps=False,
fname="bztTranspProps.json.gz",
):
"""
Args... | [
"def",
"__init__",
"(",
"self",
",",
"BztInterpolator",
",",
"temp_r",
"=",
"np",
".",
"arange",
"(",
"100",
",",
"1400",
",",
"100",
")",
",",
"doping",
"=",
"None",
",",
"npts_mu",
"=",
"4000",
",",
"CRTA",
"=",
"1e-14",
",",
"margin",
"=",
"None... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/electronic_structure/boltztrap2.py#L664-L794 | ||
veusz/veusz | 5a1e2af5f24df0eb2a2842be51f2997c4999c7fb | veusz/windows/plotwindow.py | python | _ | (text, disambiguation=None, context='PlotWindow') | return qt.QCoreApplication.translate(context, text, disambiguation) | Translate text. | Translate text. | [
"Translate",
"text",
"."
] | def _(text, disambiguation=None, context='PlotWindow'):
"""Translate text."""
return qt.QCoreApplication.translate(context, text, disambiguation) | [
"def",
"_",
"(",
"text",
",",
"disambiguation",
"=",
"None",
",",
"context",
"=",
"'PlotWindow'",
")",
":",
"return",
"qt",
".",
"QCoreApplication",
".",
"translate",
"(",
"context",
",",
"text",
",",
"disambiguation",
")"
] | https://github.com/veusz/veusz/blob/5a1e2af5f24df0eb2a2842be51f2997c4999c7fb/veusz/windows/plotwindow.py#L34-L36 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/frontends/gadget/simulation_handling.py | python | GadgetSimulation.__init__ | (self, parameter_filename, find_outputs=False) | [] | def __init__(self, parameter_filename, find_outputs=False):
self.simulation_type = "particle"
self.dimensionality = 3
SimulationTimeSeries.__init__(
self, parameter_filename, find_outputs=find_outputs
) | [
"def",
"__init__",
"(",
"self",
",",
"parameter_filename",
",",
"find_outputs",
"=",
"False",
")",
":",
"self",
".",
"simulation_type",
"=",
"\"particle\"",
"self",
".",
"dimensionality",
"=",
"3",
"SimulationTimeSeries",
".",
"__init__",
"(",
"self",
",",
"pa... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/frontends/gadget/simulation_handling.py#L52-L57 | ||||
Yelp/clusterman | 54beef89c01a2681aafd1fbb93b6ad5f6252d6cf | examples/clusterman_metrics/clusterman_metrics/boto_client.py | python | ClustermanMetricsBotoClient._extract_timestamp_and_value_from_items | (self, items) | return res | [] | def _extract_timestamp_and_value_from_items(self, items):
try:
res = [(item["timestamp"], item["value"]) for item in items]
except KeyError:
res = [(item["timestamp"], {k: v for k, v in item.items() if k not in RESERVED_KEYS},) for item in items]
return res | [
"def",
"_extract_timestamp_and_value_from_items",
"(",
"self",
",",
"items",
")",
":",
"try",
":",
"res",
"=",
"[",
"(",
"item",
"[",
"\"timestamp\"",
"]",
",",
"item",
"[",
"\"value\"",
"]",
")",
"for",
"item",
"in",
"items",
"]",
"except",
"KeyError",
... | https://github.com/Yelp/clusterman/blob/54beef89c01a2681aafd1fbb93b6ad5f6252d6cf/examples/clusterman_metrics/clusterman_metrics/boto_client.py#L297-L302 | |||
eBay/Sequence-Semantic-Embedding | c2fff8c6f0a6d5931b8d40f5c95bb1c39ff93e92 | tokenizer.py | python | encode | (text) | return ret | Encode a unicode string as a list of tokens.
Args:
text: a unicode string
Returns:
a list of tokens as Unicode strings | Encode a unicode string as a list of tokens. | [
"Encode",
"a",
"unicode",
"string",
"as",
"a",
"list",
"of",
"tokens",
"."
] | def encode(text):
"""Encode a unicode string as a list of tokens.
Args:
text: a unicode string
Returns:
a list of tokens as Unicode strings
"""
if not text:
return []
ret = []
token_start = 0
# Classify each character in the input string
is_alnum = [c in _ALPHANUMERIC_CHAR_SET for c in te... | [
"def",
"encode",
"(",
"text",
")",
":",
"if",
"not",
"text",
":",
"return",
"[",
"]",
"ret",
"=",
"[",
"]",
"token_start",
"=",
"0",
"# Classify each character in the input string",
"is_alnum",
"=",
"[",
"c",
"in",
"_ALPHANUMERIC_CHAR_SET",
"for",
"c",
"in",... | https://github.com/eBay/Sequence-Semantic-Embedding/blob/c2fff8c6f0a6d5931b8d40f5c95bb1c39ff93e92/tokenizer.py#L68-L90 | |
mila-iqia/myia | 56774a39579b4ec4123f44843ad4ca688acc859b | myia/operations/prim_array_map.py | python | ArrayMapGradient.generate_graph | (self, absargs) | return g | Generate the gradient graph. | Generate the gradient graph. | [
"Generate",
"the",
"gradient",
"graph",
"."
] | def generate_graph(self, absargs):
"""Generate the gradient graph."""
g = Graph()
nargs = len(absargs) - 1
params = [g.add_parameter() for _ in range(nargs + 1)]
jf, *jargs = params
f, *args = [g.apply(P.Jinv, p) for p in params]
ret = g.apply(P.array_map, f, *arg... | [
"def",
"generate_graph",
"(",
"self",
",",
"absargs",
")",
":",
"g",
"=",
"Graph",
"(",
")",
"nargs",
"=",
"len",
"(",
"absargs",
")",
"-",
"1",
"params",
"=",
"[",
"g",
".",
"add_parameter",
"(",
")",
"for",
"_",
"in",
"range",
"(",
"nargs",
"+"... | https://github.com/mila-iqia/myia/blob/56774a39579b4ec4123f44843ad4ca688acc859b/myia/operations/prim_array_map.py#L102-L136 | |
harry159821/XiamiForLinuxProject | 93d75d7652548d02ba386c961bc8afb5550a530e | bs4/element.py | python | PageElement.insert_before | (self, predecessor) | Makes the given element the immediate predecessor of this one.
The two elements will have the same parent, and the given element
will be immediately before this one. | Makes the given element the immediate predecessor of this one. | [
"Makes",
"the",
"given",
"element",
"the",
"immediate",
"predecessor",
"of",
"this",
"one",
"."
] | def insert_before(self, predecessor):
"""Makes the given element the immediate predecessor of this one.
The two elements will have the same parent, and the given element
will be immediately before this one.
"""
if self is predecessor:
raise ValueError("Can't insert a... | [
"def",
"insert_before",
"(",
"self",
",",
"predecessor",
")",
":",
"if",
"self",
"is",
"predecessor",
":",
"raise",
"ValueError",
"(",
"\"Can't insert an element before itself.\"",
")",
"parent",
"=",
"self",
".",
"parent",
"if",
"parent",
"is",
"None",
":",
"... | https://github.com/harry159821/XiamiForLinuxProject/blob/93d75d7652548d02ba386c961bc8afb5550a530e/bs4/element.py#L263-L280 | ||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/publish.py | python | _pubReady | (result, d2) | (internal) | (internal) | [
"(",
"internal",
")"
] | def _pubReady(result, d2):
'(internal)'
result.callWhenActivated(d2.callback) | [
"def",
"_pubReady",
"(",
"result",
",",
"d2",
")",
":",
"result",
".",
"callWhenActivated",
"(",
"d2",
".",
"callback",
")"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/publish.py#L140-L142 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/optimize/zeros.py | python | _secant | (xvals, fvals) | return x2 | Perform a secant step, taking a little care | Perform a secant step, taking a little care | [
"Perform",
"a",
"secant",
"step",
"taking",
"a",
"little",
"care"
] | def _secant(xvals, fvals):
"""Perform a secant step, taking a little care"""
# Secant has many "mathematically" equivalent formulations
# x2 = x0 - (x1 - x0)/(f1 - f0) * f0
# = x1 - (x1 - x0)/(f1 - f0) * f1
# = (-x1 * f0 + x0 * f1) / (f1 - f0)
# = (-f0 / f1 * x1 + x0) / (1 - f0 / f1)
... | [
"def",
"_secant",
"(",
"xvals",
",",
"fvals",
")",
":",
"# Secant has many \"mathematically\" equivalent formulations",
"# x2 = x0 - (x1 - x0)/(f1 - f0) * f0",
"# = x1 - (x1 - x0)/(f1 - f0) * f1",
"# = (-x1 * f0 + x0 * f1) / (f1 - f0)",
"# = (-f0 / f1 * x1 + x0) / (1 - f0 / f1)",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/optimize/zeros.py#L905-L921 | |
huawei-noah/Pretrained-Language-Model | d4694a134bdfacbaef8ff1d99735106bd3b3372b | DynaBERT/transformers/data/processors/glue.py | python | QqpProcessor.get_train_examples | (self, data_dir) | return self._create_examples(
self._read_tsv(os.path.join(data_dir, "train.tsv")), "train") | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_train_examples(self, data_dir):
"""See base class."""
return self._create_examples(
self._read_tsv(os.path.join(data_dir, "train.tsv")), "train") | [
"def",
"get_train_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"return",
"self",
".",
"_create_examples",
"(",
"self",
".",
"_read_tsv",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"train.tsv\"",
")",
")",
",",
"\"train\"",
")"
] | https://github.com/huawei-noah/Pretrained-Language-Model/blob/d4694a134bdfacbaef8ff1d99735106bd3b3372b/DynaBERT/transformers/data/processors/glue.py#L585-L588 | |
mysql/mysql-utilities | 08276b2258bf9739f53406b354b21195ff69a261 | mysql/utilities/common/replication.py | python | Slave.get_executed_gtid_set | (self) | return '' | Get any events (gtids) executed
Returns a string with the list of gtids in Executed_Gtid_Set.
Note: an empty string is returned if the server is not acting as a
slave. | Get any events (gtids) executed | [
"Get",
"any",
"events",
"(",
"gtids",
")",
"executed"
] | def get_executed_gtid_set(self):
"""Get any events (gtids) executed
Returns a string with the list of gtids in Executed_Gtid_Set.
Note: an empty string is returned if the server is not acting as a
slave.
"""
res = self.get_status()
if res:
retu... | [
"def",
"get_executed_gtid_set",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"get_status",
"(",
")",
"if",
"res",
":",
"return",
"res",
"[",
"0",
"]",
"[",
"_EXECUTED_GTID_SET",
"]",
"return",
"''"
] | https://github.com/mysql/mysql-utilities/blob/08276b2258bf9739f53406b354b21195ff69a261/mysql/utilities/common/replication.py#L1354-L1366 | |
gwastro/pycbc | 1e1c85534b9dba8488ce42df693230317ca63dea | pycbc/transforms.py | python | read_transforms_from_config | (cp, section="transforms") | return order_transforms(trans) | Returns a list of PyCBC transform instances for a section in the
given configuration file.
If the transforms are nested (i.e., the output of one transform is the
input of another), the returned list will be sorted by the order of the
nests.
Parameters
----------
cp : WorflowConfigParser
... | Returns a list of PyCBC transform instances for a section in the
given configuration file. | [
"Returns",
"a",
"list",
"of",
"PyCBC",
"transform",
"instances",
"for",
"a",
"section",
"in",
"the",
"given",
"configuration",
"file",
"."
] | def read_transforms_from_config(cp, section="transforms"):
"""Returns a list of PyCBC transform instances for a section in the
given configuration file.
If the transforms are nested (i.e., the output of one transform is the
input of another), the returned list will be sorted by the order of the
nes... | [
"def",
"read_transforms_from_config",
"(",
"cp",
",",
"section",
"=",
"\"transforms\"",
")",
":",
"trans",
"=",
"[",
"]",
"for",
"subsection",
"in",
"cp",
".",
"get_subsections",
"(",
"section",
")",
":",
"name",
"=",
"cp",
".",
"get_opt_tag",
"(",
"sectio... | https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/transforms.py#L2478-L2503 | |
pygments/pygments | cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7 | pygments/formatters/html.py | python | HtmlFormatter._wrap_code | (self, inner) | [] | def _wrap_code(self, inner):
yield 0, '<code>'
yield from inner
yield 0, '</code>' | [
"def",
"_wrap_code",
"(",
"self",
",",
"inner",
")",
":",
"yield",
"0",
",",
"'<code>'",
"yield",
"from",
"inner",
"yield",
"0",
",",
"'</code>'"
] | https://github.com/pygments/pygments/blob/cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7/pygments/formatters/html.py#L821-L824 | ||||
playframework/play1 | 0ecac3bc2421ae2dbec27a368bf671eda1c9cba5 | python/Lib/mhlib.py | python | MH.listallfolders | (self) | return self.listallsubfolders('') | Return the names of all folders and subfolders, recursively. | Return the names of all folders and subfolders, recursively. | [
"Return",
"the",
"names",
"of",
"all",
"folders",
"and",
"subfolders",
"recursively",
"."
] | def listallfolders(self):
"""Return the names of all folders and subfolders, recursively."""
return self.listallsubfolders('') | [
"def",
"listallfolders",
"(",
"self",
")",
":",
"return",
"self",
".",
"listallsubfolders",
"(",
"''",
")"
] | https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/mhlib.py#L179-L181 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-build/python-libs/gdata/src/gdata/youtube/service.py | python | YouTubeService.AddPlaylistVideoEntryToPlaylist | (
self, playlist_uri, video_id, custom_video_title=None,
custom_video_description=None) | return self.Post(playlist_video_entry, playlist_uri,
converter=gdata.youtube.YouTubePlaylistVideoEntryFromString) | Add a video entry to a playlist, optionally providing a custom title
and description.
Needs authentication.
Args:
playlist_uri: A string representing the URI of the playlist to which this
video entry is to be added.
video_id: A string representing the ID of the video entry to add.
... | Add a video entry to a playlist, optionally providing a custom title
and description. | [
"Add",
"a",
"video",
"entry",
"to",
"a",
"playlist",
"optionally",
"providing",
"a",
"custom",
"title",
"and",
"description",
"."
] | def AddPlaylistVideoEntryToPlaylist(
self, playlist_uri, video_id, custom_video_title=None,
custom_video_description=None):
"""Add a video entry to a playlist, optionally providing a custom title
and description.
Needs authentication.
Args:
playlist_uri: A string representing the URI... | [
"def",
"AddPlaylistVideoEntryToPlaylist",
"(",
"self",
",",
"playlist_uri",
",",
"video_id",
",",
"custom_video_title",
"=",
"None",
",",
"custom_video_description",
"=",
"None",
")",
":",
"playlist_video_entry",
"=",
"gdata",
".",
"youtube",
".",
"YouTubePlaylistVide... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/gdata/src/gdata/youtube/service.py#L982-L1011 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/McAfee_ESM-v10/Integrations/McAfee_ESM-v10/McAfee_ESM-v10.py | python | NitroESM.get_users | (self) | return self.cmdquery(cmd, query) | get all user's names | get all user's names | [
"get",
"all",
"user",
"s",
"names"
] | def get_users(self):
"""get all user's names"""
cmd = 'userGetUserList'
query = json.dumps({"authPW": {"value": self.passwd}})
return self.cmdquery(cmd, query) | [
"def",
"get_users",
"(",
"self",
")",
":",
"cmd",
"=",
"'userGetUserList'",
"query",
"=",
"json",
".",
"dumps",
"(",
"{",
"\"authPW\"",
":",
"{",
"\"value\"",
":",
"self",
".",
"passwd",
"}",
"}",
")",
"return",
"self",
".",
"cmdquery",
"(",
"cmd",
"... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/McAfee_ESM-v10/Integrations/McAfee_ESM-v10/McAfee_ESM-v10.py#L445-L450 | |
schissmantics/yolo-tf2 | 90e14f1bf8a0a87b32367aa1411e417fa9800167 | yolo_tf2/utils/common.py | python | add_xml_path | (xml_file, path) | Add a path element to the xml file and save.
Args:
xml_file: .xml file path.
path: str, path to add.
Returns:
None | Add a path element to the xml file and save.
Args:
xml_file: .xml file path.
path: str, path to add. | [
"Add",
"a",
"path",
"element",
"to",
"the",
"xml",
"file",
"and",
"save",
".",
"Args",
":",
"xml_file",
":",
".",
"xml",
"file",
"path",
".",
"path",
":",
"str",
"path",
"to",
"add",
"."
] | def add_xml_path(xml_file, path):
"""
Add a path element to the xml file and save.
Args:
xml_file: .xml file path.
path: str, path to add.
Returns:
None
"""
tree = ElementTree.parse(xml_file)
top = tree.getroot()
folder_tag = tree.find('folder')
folder_tag.te... | [
"def",
"add_xml_path",
"(",
"xml_file",
",",
"path",
")",
":",
"tree",
"=",
"ElementTree",
".",
"parse",
"(",
"xml_file",
")",
"top",
"=",
"tree",
".",
"getroot",
"(",
")",
"folder_tag",
"=",
"tree",
".",
"find",
"(",
"'folder'",
")",
"folder_tag",
"."... | https://github.com/schissmantics/yolo-tf2/blob/90e14f1bf8a0a87b32367aa1411e417fa9800167/yolo_tf2/utils/common.py#L245-L269 | ||
eth-sri/debin | 9abb5215b54077da1e9479bfcbc56cd860aac370 | py/elftools/dwarf/lineprogram.py | python | LineProgram.get_entries | (self) | return self._decoded_entries | Get the decoded entries for this line program. Return a list of
LineProgramEntry objects.
Note that this contains more information than absolutely required
for the line table. The line table can be easily extracted from
the list of entries by looking only at entries with ... | Get the decoded entries for this line program. Return a list of
LineProgramEntry objects.
Note that this contains more information than absolutely required
for the line table. The line table can be easily extracted from
the list of entries by looking only at entries with ... | [
"Get",
"the",
"decoded",
"entries",
"for",
"this",
"line",
"program",
".",
"Return",
"a",
"list",
"of",
"LineProgramEntry",
"objects",
".",
"Note",
"that",
"this",
"contains",
"more",
"information",
"than",
"absolutely",
"required",
"for",
"the",
"line",
"tabl... | def get_entries(self):
""" Get the decoded entries for this line program. Return a list of
LineProgramEntry objects.
Note that this contains more information than absolutely required
for the line table. The line table can be easily extracted from
the list of entri... | [
"def",
"get_entries",
"(",
"self",
")",
":",
"if",
"self",
".",
"_decoded_entries",
"is",
"None",
":",
"self",
".",
"_decoded_entries",
"=",
"self",
".",
"_decode_line_program",
"(",
")",
"return",
"self",
".",
"_decoded_entries"
] | https://github.com/eth-sri/debin/blob/9abb5215b54077da1e9479bfcbc56cd860aac370/py/elftools/dwarf/lineprogram.py#L104-L115 | |
klen/aioauth-client | 7672e66053cfd6973261f40741916d2fd52ff97e | aioauth_client/__init__.py | python | User.__init__ | (self, **info) | Initialize self data. | Initialize self data. | [
"Initialize",
"self",
"data",
"."
] | def __init__(self, **info):
"""Initialize self data."""
for attr in self.__slots__:
setattr(self, attr, info.get(attr)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"info",
")",
":",
"for",
"attr",
"in",
"self",
".",
"__slots__",
":",
"setattr",
"(",
"self",
",",
"attr",
",",
"info",
".",
"get",
"(",
"attr",
")",
")"
] | https://github.com/klen/aioauth-client/blob/7672e66053cfd6973261f40741916d2fd52ff97e/aioauth_client/__init__.py#L39-L42 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/pkg_resources/__init__.py | python | MemoizedZipManifests.load | (self, path) | return self[path].manifest | Load a manifest at path or return a suitable manifest already loaded. | Load a manifest at path or return a suitable manifest already loaded. | [
"Load",
"a",
"manifest",
"at",
"path",
"or",
"return",
"a",
"suitable",
"manifest",
"already",
"loaded",
"."
] | def load(self, path):
"""
Load a manifest at path or return a suitable manifest already loaded.
"""
path = os.path.normpath(path)
mtime = os.stat(path).st_mtime
if path not in self or self[path].mtime != mtime:
manifest = self.build(path)
self[pat... | [
"def",
"load",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"path",
")",
"mtime",
"=",
"os",
".",
"stat",
"(",
"path",
")",
".",
"st_mtime",
"if",
"path",
"not",
"in",
"self",
"or",
"self",
"[",
"pat... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pkg_resources/__init__.py#L1669-L1680 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_adm_policy_group.py | python | RoleBinding.update_group_name | (self, inc_group_name) | return True | update a groupname | update a groupname | [
"update",
"a",
"groupname"
] | def update_group_name(self, inc_group_name):
''' update a groupname '''
try:
# pylint: disable=no-member
index = self.group_names.index(inc_group_name)
except ValueError as _:
return self.add_group_names(inc_group_name)
self.group_names[index] = inc_g... | [
"def",
"update_group_name",
"(",
"self",
",",
"inc_group_name",
")",
":",
"try",
":",
"# pylint: disable=no-member",
"index",
"=",
"self",
".",
"group_names",
".",
"index",
"(",
"inc_group_name",
")",
"except",
"ValueError",
"as",
"_",
":",
"return",
"self",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_adm_policy_group.py#L1685-L1695 | |
arsaboo/homeassistant-config | 53c998986fbe84d793a0b174757154ab30e676e4 | custom_components/hacs/repositories/integration.py | python | HacsIntegration.localpath | (self) | return f"{self.hacs.system.config_path}/custom_components/{self.data.domain}" | Return localpath. | Return localpath. | [
"Return",
"localpath",
"."
] | def localpath(self):
"""Return localpath."""
return f"{self.hacs.system.config_path}/custom_components/{self.data.domain}" | [
"def",
"localpath",
"(",
"self",
")",
":",
"return",
"f\"{self.hacs.system.config_path}/custom_components/{self.data.domain}\""
] | https://github.com/arsaboo/homeassistant-config/blob/53c998986fbe84d793a0b174757154ab30e676e4/custom_components/hacs/repositories/integration.py#L30-L32 | |
python-openxml/python-docx | 36cac78de080d412e9e50d56c2784e33655cad59 | docx/oxml/section.py | python | CT_SectPr.add_footerReference | (self, type_, rId) | return footerReference | Return newly added CT_HdrFtrRef element of *type_* with *rId*.
The element tag is `w:footerReference`. | Return newly added CT_HdrFtrRef element of *type_* with *rId*. | [
"Return",
"newly",
"added",
"CT_HdrFtrRef",
"element",
"of",
"*",
"type_",
"*",
"with",
"*",
"rId",
"*",
"."
] | def add_footerReference(self, type_, rId):
"""Return newly added CT_HdrFtrRef element of *type_* with *rId*.
The element tag is `w:footerReference`.
"""
footerReference = self._add_footerReference()
footerReference.type_ = type_
footerReference.rId = rId
return f... | [
"def",
"add_footerReference",
"(",
"self",
",",
"type_",
",",
"rId",
")",
":",
"footerReference",
"=",
"self",
".",
"_add_footerReference",
"(",
")",
"footerReference",
".",
"type_",
"=",
"type_",
"footerReference",
".",
"rId",
"=",
"rId",
"return",
"footerRef... | https://github.com/python-openxml/python-docx/blob/36cac78de080d412e9e50d56c2784e33655cad59/docx/oxml/section.py#L75-L83 | |
plastex/plastex | af1628719b50cf25fbe80f16a3e100d566e9bc32 | plasTeX/__init__.py | python | Macro.config | (self) | return self.ownerDocument.config | Shortcut to the document config | Shortcut to the document config | [
"Shortcut",
"to",
"the",
"document",
"config"
] | def config(self):
""" Shortcut to the document config """
return self.ownerDocument.config | [
"def",
"config",
"(",
"self",
")",
":",
"return",
"self",
".",
"ownerDocument",
".",
"config"
] | https://github.com/plastex/plastex/blob/af1628719b50cf25fbe80f16a3e100d566e9bc32/plasTeX/__init__.py#L194-L196 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/dynamic_search_ads_search_term_view_service/transports/grpc.py | python | DynamicSearchAdsSearchTermViewServiceGrpcTransport.create_channel | (
cls,
host: str = "googleads.googleapis.com",
credentials: credentials.Credentials = None,
scopes: Optional[Sequence[str]] = None,
**kwargs,
) | return grpc_helpers.create_channel(
host,
credentials=credentials,
scopes=scopes or cls.AUTH_SCOPES,
**kwargs,
) | Create and return a gRPC channel object.
Args:
address (Optionsl[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service.... | Create and return a gRPC channel object.
Args:
address (Optionsl[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service.... | [
"Create",
"and",
"return",
"a",
"gRPC",
"channel",
"object",
".",
"Args",
":",
"address",
"(",
"Optionsl",
"[",
"str",
"]",
")",
":",
"The",
"host",
"for",
"the",
"channel",
"to",
"use",
".",
"credentials",
"(",
"Optional",
"[",
"~",
".",
"Credentials"... | def create_channel(
cls,
host: str = "googleads.googleapis.com",
credentials: credentials.Credentials = None,
scopes: Optional[Sequence[str]] = None,
**kwargs,
) -> grpc.Channel:
"""Create and return a gRPC channel object.
Args:
address (Optionsl[s... | [
"def",
"create_channel",
"(",
"cls",
",",
"host",
":",
"str",
"=",
"\"googleads.googleapis.com\"",
",",
"credentials",
":",
"credentials",
".",
"Credentials",
"=",
"None",
",",
"scopes",
":",
"Optional",
"[",
"Sequence",
"[",
"str",
"]",
"]",
"=",
"None",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/dynamic_search_ads_search_term_view_service/transports/grpc.py#L185-L213 | |
googlefonts/gftools | 8ad55dd4d7e38729524329c79f236476f1576e67 | bin/gftools-build-vf.py | python | printR | (prt) | Print in red | Print in red | [
"Print",
"in",
"red"
] | def printR(prt):
"""
Print in red
"""
print("\033[91m {}\033[00m".format(prt)) | [
"def",
"printR",
"(",
"prt",
")",
":",
"print",
"(",
"\"\\033[91m {}\\033[00m\"",
".",
"format",
"(",
"prt",
")",
")"
] | https://github.com/googlefonts/gftools/blob/8ad55dd4d7e38729524329c79f236476f1576e67/bin/gftools-build-vf.py#L94-L98 | ||
FraBle/python-duckling | e6a34192e35fd4fc287b4bc93c938fcd5c2d9024 | duckling/wrapper.py | python | DucklingWrapper.parse_leven_product | (self, input_str) | return self._parse(input_str, dim=Dim.LEVENPRODUCT) | Parses input with Duckling for occurences of products.
Args:
input_str: An input string, e.g. '5 cups of sugar'.
Returns:
A preprocessed list of results (dicts) from Duckling output. For
example:
[
{
"dim": "leven-produc... | Parses input with Duckling for occurences of products. | [
"Parses",
"input",
"with",
"Duckling",
"for",
"occurences",
"of",
"products",
"."
] | def parse_leven_product(self, input_str):
"""Parses input with Duckling for occurences of products.
Args:
input_str: An input string, e.g. '5 cups of sugar'.
Returns:
A preprocessed list of results (dicts) from Duckling output. For
example:
[
... | [
"def",
"parse_leven_product",
"(",
"self",
",",
"input_str",
")",
":",
"return",
"self",
".",
"_parse",
"(",
"input_str",
",",
"dim",
"=",
"Dim",
".",
"LEVENPRODUCT",
")"
] | https://github.com/FraBle/python-duckling/blob/e6a34192e35fd4fc287b4bc93c938fcd5c2d9024/duckling/wrapper.py#L609-L632 | |
LumaPictures/pymel | fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72 | pymel/core/datatypes.py | python | EulerRotation.__iadd__ | (self, other) | u.__iadd__(v) <==> u += v
In place addition of u and v, see __add__ | u.__iadd__(v) <==> u += v
In place addition of u and v, see __add__ | [
"u",
".",
"__iadd__",
"(",
"v",
")",
"<",
"==",
">",
"u",
"+",
"=",
"v",
"In",
"place",
"addition",
"of",
"u",
"and",
"v",
"see",
"__add__"
] | def __iadd__(self, other):
""" u.__iadd__(v) <==> u += v
In place addition of u and v, see __add__ """
try:
return self.__class__(self.__add__(other))
except:
return NotImplemented | [
"def",
"__iadd__",
"(",
"self",
",",
"other",
")",
":",
"try",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"__add__",
"(",
"other",
")",
")",
"except",
":",
"return",
"NotImplemented"
] | https://github.com/LumaPictures/pymel/blob/fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72/pymel/core/datatypes.py#L2990-L2996 | ||
beancount/beancount | cb3526a1af95b3b5be70347470c381b5a86055fe | beancount/utils/misc_utils.py | python | idify | (string) | return string | Replace characters objectionable for a filename with underscores.
Args:
string: Any string.
Returns:
The input string, with offending characters replaced. | Replace characters objectionable for a filename with underscores. | [
"Replace",
"characters",
"objectionable",
"for",
"a",
"filename",
"with",
"underscores",
"."
] | def idify(string):
"""Replace characters objectionable for a filename with underscores.
Args:
string: Any string.
Returns:
The input string, with offending characters replaced.
"""
for sfrom, sto in [(r'[ \(\)]+', '_'),
(r'_*\._*', '.')]:
string = re.sub(s... | [
"def",
"idify",
"(",
"string",
")",
":",
"for",
"sfrom",
",",
"sto",
"in",
"[",
"(",
"r'[ \\(\\)]+'",
",",
"'_'",
")",
",",
"(",
"r'_*\\._*'",
",",
"'.'",
")",
"]",
":",
"string",
"=",
"re",
".",
"sub",
"(",
"sfrom",
",",
"sto",
",",
"string",
... | https://github.com/beancount/beancount/blob/cb3526a1af95b3b5be70347470c381b5a86055fe/beancount/utils/misc_utils.py#L285-L297 | |
openstack/neutron | fb229fb527ac8b95526412f7762d90826ac41428 | neutron/cmd/status.py | python | setup_conf | (conf=cfg.CONF) | return conf | Setup the cfg for the status check utility.
Use separate setup_conf for the utility because there are many options
from the main config that do not apply during checks. | Setup the cfg for the status check utility. | [
"Setup",
"the",
"cfg",
"for",
"the",
"status",
"check",
"utility",
"."
] | def setup_conf(conf=cfg.CONF):
"""Setup the cfg for the status check utility.
Use separate setup_conf for the utility because there are many options
from the main config that do not apply during checks.
"""
neutron_conf_base.register_core_common_config_opts(conf)
neutron_conf_service.register_... | [
"def",
"setup_conf",
"(",
"conf",
"=",
"cfg",
".",
"CONF",
")",
":",
"neutron_conf_base",
".",
"register_core_common_config_opts",
"(",
"conf",
")",
"neutron_conf_service",
".",
"register_service_opts",
"(",
"neutron_conf_service",
".",
"SERVICE_OPTS",
",",
"cfg",
"... | https://github.com/openstack/neutron/blob/fb229fb527ac8b95526412f7762d90826ac41428/neutron/cmd/status.py#L47-L58 | |
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/plugins/cursesGui2.py | python | LeoCursesGui.createCursesMinibuffer | (self, c, form) | Create the curses minibuffer widget in the given curses Form. | Create the curses minibuffer widget in the given curses Form. | [
"Create",
"the",
"curses",
"minibuffer",
"widget",
"in",
"the",
"given",
"curses",
"Form",
"."
] | def createCursesMinibuffer(self, c, form):
"""Create the curses minibuffer widget in the given curses Form."""
trace = False
class MiniBufferBox(npyscreen.BoxTitle):
"""An npyscreen class representing Leo's minibuffer, with binding."""
# pylint: disable=used-before-assig... | [
"def",
"createCursesMinibuffer",
"(",
"self",
",",
"c",
",",
"form",
")",
":",
"trace",
"=",
"False",
"class",
"MiniBufferBox",
"(",
"npyscreen",
".",
"BoxTitle",
")",
":",
"\"\"\"An npyscreen class representing Leo's minibuffer, with binding.\"\"\"",
"# pylint: disable=u... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/cursesGui2.py#L1384-L1413 | ||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/vistir/compat.py | python | _invalid_utf8_indexes | (bytes) | return skips | [] | def _invalid_utf8_indexes(bytes):
skips = []
i = 0
len_bytes = len(bytes)
while i < len_bytes:
c1 = bytes[i]
if c1 < 0x80:
# U+0000 - U+007F - 7 bits
i += 1
continue
try:
c2 = bytes[i + 1]
if (c1 & 0xE0 == 0xC0) and (c2 ... | [
"def",
"_invalid_utf8_indexes",
"(",
"bytes",
")",
":",
"skips",
"=",
"[",
"]",
"i",
"=",
"0",
"len_bytes",
"=",
"len",
"(",
"bytes",
")",
"while",
"i",
"<",
"len_bytes",
":",
"c1",
"=",
"bytes",
"[",
"i",
"]",
"if",
"c1",
"<",
"0x80",
":",
"# U+... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/vistir/compat.py#L313-L362 | |||
MingtaoFu/gliding_vertex | c4470140265140e118725b80a81efe68e44e10af | maskrcnn_benchmark/modeling/matcher.py | python | Matcher.__init__ | (self, high_threshold, low_threshold, allow_low_quality_matches=False) | Args:
high_threshold (float): quality values greater than or equal to
this value are candidate matches.
low_threshold (float): a lower quality threshold used to stratify
matches into three levels:
1) matches >= high_threshold
2) BET... | Args:
high_threshold (float): quality values greater than or equal to
this value are candidate matches.
low_threshold (float): a lower quality threshold used to stratify
matches into three levels:
1) matches >= high_threshold
2) BET... | [
"Args",
":",
"high_threshold",
"(",
"float",
")",
":",
"quality",
"values",
"greater",
"than",
"or",
"equal",
"to",
"this",
"value",
"are",
"candidate",
"matches",
".",
"low_threshold",
"(",
"float",
")",
":",
"a",
"lower",
"quality",
"threshold",
"used",
... | def __init__(self, high_threshold, low_threshold, allow_low_quality_matches=False):
"""
Args:
high_threshold (float): quality values greater than or equal to
this value are candidate matches.
low_threshold (float): a lower quality threshold used to stratify
... | [
"def",
"__init__",
"(",
"self",
",",
"high_threshold",
",",
"low_threshold",
",",
"allow_low_quality_matches",
"=",
"False",
")",
":",
"assert",
"low_threshold",
"<=",
"high_threshold",
"self",
".",
"high_threshold",
"=",
"high_threshold",
"self",
".",
"low_threshol... | https://github.com/MingtaoFu/gliding_vertex/blob/c4470140265140e118725b80a81efe68e44e10af/maskrcnn_benchmark/modeling/matcher.py#L23-L40 | ||
thinkle/gourmet | 8af29c8ded24528030e5ae2ea3461f61c1e5a575 | gourmet/plugins/import_export/pdf_plugin/page_drawer.py | python | PageDrawer.on_realize | (self, widget: 'PdfPageDrawer') | [] | def on_realize(self, widget: 'PdfPageDrawer'):
# TODO: refactor this function out
# self.gc = widget.window.new_gc()
#self.gc.set_line_attributes(3, Gdk.LINE_ON_OFF_DASH,
# Gdk.CAP_ROUND, Gdk.JOIN_ROUND)
pass | [
"def",
"on_realize",
"(",
"self",
",",
"widget",
":",
"'PdfPageDrawer'",
")",
":",
"# TODO: refactor this function out",
"# self.gc = widget.window.new_gc()",
"#self.gc.set_line_attributes(3, Gdk.LINE_ON_OFF_DASH,",
"# Gdk.CAP_ROUND, Gdk.JOIN_ROUND)",
"pass"
] | https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/plugins/import_export/pdf_plugin/page_drawer.py#L40-L45 | ||||
ShreyAmbesh/Traffic-Rule-Violation-Detection-System | ae0c327ce014ce6a427da920b5798a0d4bbf001e | meta_architectures/ssd_meta_arch.py | python | SSDMetaArch.preprocess | (self, inputs) | Feature-extractor specific preprocessing.
SSD meta architecture uses a default clip_window of [0, 0, 1, 1] during
post-processing. On calling `preprocess` method, clip_window gets updated
based on `true_image_shapes` returned by `image_resizer_fn`.
Args:
inputs: a [batch, height_in, width_in, ch... | Feature-extractor specific preprocessing. | [
"Feature",
"-",
"extractor",
"specific",
"preprocessing",
"."
] | def preprocess(self, inputs):
"""Feature-extractor specific preprocessing.
SSD meta architecture uses a default clip_window of [0, 0, 1, 1] during
post-processing. On calling `preprocess` method, clip_window gets updated
based on `true_image_shapes` returned by `image_resizer_fn`.
Args:
inpu... | [
"def",
"preprocess",
"(",
"self",
",",
"inputs",
")",
":",
"if",
"inputs",
".",
"dtype",
"is",
"not",
"tf",
".",
"float32",
":",
"raise",
"ValueError",
"(",
"'`preprocess` expects a tf.float32 tensor'",
")",
"with",
"tf",
".",
"name_scope",
"(",
"'Preprocessor... | https://github.com/ShreyAmbesh/Traffic-Rule-Violation-Detection-System/blob/ae0c327ce014ce6a427da920b5798a0d4bbf001e/meta_architectures/ssd_meta_arch.py#L223-L258 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/soupsieve/css_parser.py | python | CSSParser.parse_pseudo_open | (self, sel, name, has_selector, iselector, index) | return has_selector | Parse pseudo with opening bracket. | Parse pseudo with opening bracket. | [
"Parse",
"pseudo",
"with",
"opening",
"bracket",
"."
] | def parse_pseudo_open(self, sel, name, has_selector, iselector, index):
"""Parse pseudo with opening bracket."""
flags = FLG_PSEUDO | FLG_OPEN
if name == ':not':
flags |= FLG_NOT
if name == ':has':
flags |= FLG_RELATIVE
sel.selectors.append(self.parse_se... | [
"def",
"parse_pseudo_open",
"(",
"self",
",",
"sel",
",",
"name",
",",
"has_selector",
",",
"iselector",
",",
"index",
")",
":",
"flags",
"=",
"FLG_PSEUDO",
"|",
"FLG_OPEN",
"if",
"name",
"==",
"':not'",
":",
"flags",
"|=",
"FLG_NOT",
"if",
"name",
"==",... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/soupsieve/css_parser.py#L704-L715 | |
pyglet/pyglet | 2833c1df902ca81aeeffa786c12e7e87d402434b | pyglet/media/player.py | python | Player.on_driver_reset | (self) | The audio driver has been reset, by default this will kill the current audio player and create a new one,
and requeue the buffers. Any buffers that may have been queued in a player will be resubmitted. It will
continue from from the last buffers submitted, not played and may cause sync issues if using ... | The audio driver has been reset, by default this will kill the current audio player and create a new one,
and requeue the buffers. Any buffers that may have been queued in a player will be resubmitted. It will
continue from from the last buffers submitted, not played and may cause sync issues if using ... | [
"The",
"audio",
"driver",
"has",
"been",
"reset",
"by",
"default",
"this",
"will",
"kill",
"the",
"current",
"audio",
"player",
"and",
"create",
"a",
"new",
"one",
"and",
"requeue",
"the",
"buffers",
".",
"Any",
"buffers",
"that",
"may",
"have",
"been",
... | def on_driver_reset(self):
"""The audio driver has been reset, by default this will kill the current audio player and create a new one,
and requeue the buffers. Any buffers that may have been queued in a player will be resubmitted. It will
continue from from the last buffers submitted, not play... | [
"def",
"on_driver_reset",
"(",
"self",
")",
":",
"if",
"self",
".",
"_audio_player",
":",
"self",
".",
"_audio_player",
".",
"on_driver_reset",
"(",
")",
"# Voice has been changed, will need to reset all options on the voice.",
"for",
"attr",
"in",
"(",
"'volume'",
",... | https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/media/player.py#L629-L647 | ||
zulip/zulip | 19f891968de50d43920af63526c823bdd233cdee | zerver/lib/push_notifications.py | python | get_message_payload | (
user_profile: UserProfile,
message: Message,
mentioned_user_group_id: Optional[int] = None,
mentioned_user_group_name: Optional[str] = None,
) | return data | Common fields for `message` payloads, for all platforms. | Common fields for `message` payloads, for all platforms. | [
"Common",
"fields",
"for",
"message",
"payloads",
"for",
"all",
"platforms",
"."
] | def get_message_payload(
user_profile: UserProfile,
message: Message,
mentioned_user_group_id: Optional[int] = None,
mentioned_user_group_name: Optional[str] = None,
) -> Dict[str, Any]:
"""Common fields for `message` payloads, for all platforms."""
data = get_base_payload(user_profile)
# `... | [
"def",
"get_message_payload",
"(",
"user_profile",
":",
"UserProfile",
",",
"message",
":",
"Message",
",",
"mentioned_user_group_id",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"mentioned_user_group_name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",... | https://github.com/zulip/zulip/blob/19f891968de50d43920af63526c823bdd233cdee/zerver/lib/push_notifications.py#L697-L724 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_service.py | python | Service.add_portal_ip | (self, pip) | add cluster ip | add cluster ip | [
"add",
"cluster",
"ip"
] | def add_portal_ip(self, pip):
'''add cluster ip'''
self.put(Service.portal_ip, pip) | [
"def",
"add_portal_ip",
"(",
"self",
",",
"pip",
")",
":",
"self",
".",
"put",
"(",
"Service",
".",
"portal_ip",
",",
"pip",
")"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_service.py#L1662-L1664 | ||
openatx/uiautomator2 | a6ebc2446a8babb4ce14dc62cfdb5590ea95c709 | uiautomator2/__init__.py | python | _AppMixIn._pidof_app | (self, package_name) | Return pid of package name | Return pid of package name | [
"Return",
"pid",
"of",
"package",
"name"
] | def _pidof_app(self, package_name):
"""
Return pid of package name
"""
text = self.http.get('/pidof/' + package_name).text
if text.isdigit():
return int(text) | [
"def",
"_pidof_app",
"(",
"self",
",",
"package_name",
")",
":",
"text",
"=",
"self",
".",
"http",
".",
"get",
"(",
"'/pidof/'",
"+",
"package_name",
")",
".",
"text",
"if",
"text",
".",
"isdigit",
"(",
")",
":",
"return",
"int",
"(",
"text",
")"
] | https://github.com/openatx/uiautomator2/blob/a6ebc2446a8babb4ce14dc62cfdb5590ea95c709/uiautomator2/__init__.py#L1314-L1320 | ||
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/redis/client.py | python | StrictRedis.pfmerge | (self, dest, *sources) | return self.execute_command('PFMERGE', dest, *sources) | Merge N different HyperLogLogs into a single one. | Merge N different HyperLogLogs into a single one. | [
"Merge",
"N",
"different",
"HyperLogLogs",
"into",
"a",
"single",
"one",
"."
] | def pfmerge(self, dest, *sources):
"Merge N different HyperLogLogs into a single one."
return self.execute_command('PFMERGE', dest, *sources) | [
"def",
"pfmerge",
"(",
"self",
",",
"dest",
",",
"*",
"sources",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"'PFMERGE'",
",",
"dest",
",",
"*",
"sources",
")"
] | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/redis/client.py#L1842-L1844 | |
codelv/enaml-native | 04c3a015bcd649f374c5ecd98fcddba5e4fbdbdc | src/enamlnative/core/bridge.py | python | tag_object_with_id | (obj) | Generate and assign a id for the object | Generate and assign a id for the object | [
"Generate",
"and",
"assign",
"a",
"id",
"for",
"the",
"object"
] | def tag_object_with_id(obj):
""" Generate and assign a id for the object"""
obj.__id__ = generate_id()
CACHE[obj.__id__] = obj | [
"def",
"tag_object_with_id",
"(",
"obj",
")",
":",
"obj",
".",
"__id__",
"=",
"generate_id",
"(",
")",
"CACHE",
"[",
"obj",
".",
"__id__",
"]",
"=",
"obj"
] | https://github.com/codelv/enaml-native/blob/04c3a015bcd649f374c5ecd98fcddba5e4fbdbdc/src/enamlnative/core/bridge.py#L57-L60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.