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
postgres/pgadmin4
374c5e952fa594d749fadf1f88076c1cba8c5f64
web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
python
SchemaView.msql
(self, gid, sid, did, scid=None)
This function will generate modified sql for schema object based on the input from the user. This route is used by the SQL tab in the edit/create dialog. Args: gid: Server Group ID sid: Server ID did: Database ID scid: Schema ID (When working with ex...
This function will generate modified sql for schema object based on the input from the user. This route is used by the SQL tab in the edit/create dialog.
[ "This", "function", "will", "generate", "modified", "sql", "for", "schema", "object", "based", "on", "the", "input", "from", "the", "user", ".", "This", "route", "is", "used", "by", "the", "SQL", "tab", "in", "the", "edit", "/", "create", "dialog", "." ]
def msql(self, gid, sid, did, scid=None): """ This function will generate modified sql for schema object based on the input from the user. This route is used by the SQL tab in the edit/create dialog. Args: gid: Server Group ID sid: Server ID did...
[ "def", "msql", "(", "self", ",", "gid", ",", "sid", ",", "did", ",", "scid", "=", "None", ")", ":", "data", "=", "dict", "(", ")", "for", "k", ",", "v", "in", "request", ".", "args", ".", "items", "(", ")", ":", "try", ":", "# comments should b...
https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py#L745-L777
shiyanhui/FileHeader
f347cc134021fb0b710694b71c57742476f5fd2b
jinja2/filters.py
python
do_indent
(s, width=4, indentfirst=False)
return rv
Return a copy of the passed string, each line indented by 4 spaces. The first line is not indented. If you want to change the number of spaces or indent the first line too you can pass additional parameters to the filter: .. sourcecode:: jinja {{ mytext|indent(2, true) }} indent by...
Return a copy of the passed string, each line indented by 4 spaces. The first line is not indented. If you want to change the number of spaces or indent the first line too you can pass additional parameters to the filter:
[ "Return", "a", "copy", "of", "the", "passed", "string", "each", "line", "indented", "by", "4", "spaces", ".", "The", "first", "line", "is", "not", "indented", ".", "If", "you", "want", "to", "change", "the", "number", "of", "spaces", "or", "indent", "t...
def do_indent(s, width=4, indentfirst=False): """Return a copy of the passed string, each line indented by 4 spaces. The first line is not indented. If you want to change the number of spaces or indent the first line too you can pass additional parameters to the filter: .. sourcecode:: jinja ...
[ "def", "do_indent", "(", "s", ",", "width", "=", "4", ",", "indentfirst", "=", "False", ")", ":", "indention", "=", "u' '", "*", "width", "rv", "=", "(", "u'\\n'", "+", "indention", ")", ".", "join", "(", "s", ".", "splitlines", "(", ")", ")", "i...
https://github.com/shiyanhui/FileHeader/blob/f347cc134021fb0b710694b71c57742476f5fd2b/jinja2/filters.py#L430-L445
qibinlou/SinaWeibo-Emotion-Classification
f336fc104abd68b0ec4180fe2ed80fafe49cb790
nltk/sem/evaluate.py
python
arity
(rel)
return len(list(rel)[0])
Check the arity of a relation. :type rel: set of tuples :rtype: int of tuple of str
Check the arity of a relation. :type rel: set of tuples :rtype: int of tuple of str
[ "Check", "the", "arity", "of", "a", "relation", ".", ":", "type", "rel", ":", "set", "of", "tuples", ":", "rtype", ":", "int", "of", "tuple", "of", "str" ]
def arity(rel): """ Check the arity of a relation. :type rel: set of tuples :rtype: int of tuple of str """ if len(rel) == 0: return 0 return len(list(rel)[0])
[ "def", "arity", "(", "rel", ")", ":", "if", "len", "(", "rel", ")", "==", "0", ":", "return", "0", "return", "len", "(", "list", "(", "rel", ")", "[", "0", "]", ")" ]
https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/nltk/sem/evaluate.py#L85-L93
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/font_manager.py
python
FontManager.score_size
(self, size1, size2)
return abs(sizeval1 - sizeval2) / 72.0
Returns a match score between *size1* and *size2*. If *size2* (the size specified in the font file) is 'scalable', this function always returns 0.0, since any font size can be generated. Otherwise, the result is the absolute distance between *size1* and *size2*, normalized so that the ...
Returns a match score between *size1* and *size2*.
[ "Returns", "a", "match", "score", "between", "*", "size1", "*", "and", "*", "size2", "*", "." ]
def score_size(self, size1, size2): """ Returns a match score between *size1* and *size2*. If *size2* (the size specified in the font file) is 'scalable', this function always returns 0.0, since any font size can be generated. Otherwise, the result is the absolute distance betw...
[ "def", "score_size", "(", "self", ",", "size1", ",", "size2", ")", ":", "if", "size2", "==", "'scalable'", ":", "return", "0.0", "# Size value should have already been", "try", ":", "sizeval1", "=", "float", "(", "size1", ")", "except", "ValueError", ":", "s...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/font_manager.py#L1139-L1161
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/sqli/thirdparty/bottle/bottle.py
python
tob
(s, enc='utf8')
return s.encode(enc) if isinstance(s, unicode) else bytes(s)
[]
def tob(s, enc='utf8'): return s.encode(enc) if isinstance(s, unicode) else bytes(s)
[ "def", "tob", "(", "s", ",", "enc", "=", "'utf8'", ")", ":", "return", "s", ".", "encode", "(", "enc", ")", "if", "isinstance", "(", "s", ",", "unicode", ")", "else", "bytes", "(", "s", ")" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/thirdparty/bottle/bottle.py#L112-L113
nodesign/weio
1d67d705a5c36a2e825ad13feab910b0aca9a2e8
openWrt/files/usr/lib/python2.7/site-packages/tornado/ioloop.py
python
IOLoop.configurable_base
(cls)
return IOLoop
[]
def configurable_base(cls): return IOLoop
[ "def", "configurable_base", "(", "cls", ")", ":", "return", "IOLoop" ]
https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/tornado/ioloop.py#L198-L199
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
tensorflow_dl_models/research/slim/datasets/download_and_convert_flowers.py
python
_convert_dataset
(split_name, filenames, class_names_to_ids, dataset_dir)
Converts the given filenames to a TFRecord dataset. Args: split_name: The name of the dataset, either 'train' or 'validation'. filenames: A list of absolute paths to png or jpg images. class_names_to_ids: A dictionary from class names (strings) to ids (integers). dataset_dir: The directory wher...
Converts the given filenames to a TFRecord dataset.
[ "Converts", "the", "given", "filenames", "to", "a", "TFRecord", "dataset", "." ]
def _convert_dataset(split_name, filenames, class_names_to_ids, dataset_dir): """Converts the given filenames to a TFRecord dataset. Args: split_name: The name of the dataset, either 'train' or 'validation'. filenames: A list of absolute paths to png or jpg images. class_names_to_ids: A dictionary from...
[ "def", "_convert_dataset", "(", "split_name", ",", "filenames", ",", "class_names_to_ids", ",", "dataset_dir", ")", ":", "assert", "split_name", "in", "[", "'train'", ",", "'validation'", "]", "num_per_shard", "=", "int", "(", "math", ".", "ceil", "(", "len", ...
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/slim/datasets/download_and_convert_flowers.py#L107-L150
unknown-horizons/unknown-horizons
7397fb333006d26c3d9fe796c7bd9cb8c3b43a49
horizons/gui/ingamegui.py
python
IngameGui._on_new_disaster
(self, message)
Called when a building is 'infected' with a disaster.
Called when a building is 'infected' with a disaster.
[ "Called", "when", "a", "building", "is", "infected", "with", "a", "disaster", "." ]
def _on_new_disaster(self, message): """Called when a building is 'infected' with a disaster.""" if message.building.owner.is_local_player and len(message.disaster._affected_buildings) == 1: pos = message.building.position.center self.message_widget.add(point=pos, string_id=message.disaster_class.NOTIFICATION...
[ "def", "_on_new_disaster", "(", "self", ",", "message", ")", ":", "if", "message", ".", "building", ".", "owner", ".", "is_local_player", "and", "len", "(", "message", ".", "disaster", ".", "_affected_buildings", ")", "==", "1", ":", "pos", "=", "message",...
https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/gui/ingamegui.py#L630-L634
rgerum/pylustrator
b01825bc3de75ac127291647729fa7b0e6f8b821
pylustrator/drag_helper.py
python
GrabbableRectangleSelection.update_grabber
(self)
update the position of the grabber elements
update the position of the grabber elements
[ "update", "the", "position", "of", "the", "grabber", "elements" ]
def update_grabber(self): """ update the position of the grabber elements """ if self.do_target_scale(): for grabber in self.grabbers: grabber.updatePos() else: self.hide_grabber()
[ "def", "update_grabber", "(", "self", ")", ":", "if", "self", ".", "do_target_scale", "(", ")", ":", "for", "grabber", "in", "self", ".", "grabbers", ":", "grabber", ".", "updatePos", "(", ")", "else", ":", "self", ".", "hide_grabber", "(", ")" ]
https://github.com/rgerum/pylustrator/blob/b01825bc3de75ac127291647729fa7b0e6f8b821/pylustrator/drag_helper.py#L289-L295
ustayready/CredKing
68b612e4cdf01d2b65b14ab2869bb8a5531056ee
plugins/gmail/lxml/html/__init__.py
python
HtmlMixin.head
(self)
return self.xpath('//head|//x:head', namespaces={'x':XHTML_NAMESPACE})[0]
Returns the <head> element. Can be called from a child element to get the document's head.
Returns the <head> element. Can be called from a child element to get the document's head.
[ "Returns", "the", "<head", ">", "element", ".", "Can", "be", "called", "from", "a", "child", "element", "to", "get", "the", "document", "s", "head", "." ]
def head(self): """ Returns the <head> element. Can be called from a child element to get the document's head. """ return self.xpath('//head|//x:head', namespaces={'x':XHTML_NAMESPACE})[0]
[ "def", "head", "(", "self", ")", ":", "return", "self", ".", "xpath", "(", "'//head|//x:head'", ",", "namespaces", "=", "{", "'x'", ":", "XHTML_NAMESPACE", "}", ")", "[", "0", "]" ]
https://github.com/ustayready/CredKing/blob/68b612e4cdf01d2b65b14ab2869bb8a5531056ee/plugins/gmail/lxml/html/__init__.py#L293-L298
transferwise/pipelinewise
6934b3851512dbdd4280790bf253a0a13ab65684
pipelinewise/fastsync/commons/tap_mongodb.py
python
get_connection_string
(config: Dict)
return connection_string
Generates a MongoClientConnectionString based on configuration Args: config: DB config Returns: A MongoClient connection string
Generates a MongoClientConnectionString based on configuration Args: config: DB config
[ "Generates", "a", "MongoClientConnectionString", "based", "on", "configuration", "Args", ":", "config", ":", "DB", "config" ]
def get_connection_string(config: Dict): """ Generates a MongoClientConnectionString based on configuration Args: config: DB config Returns: A MongoClient connection string """ srv = config.get('srv') == 'true' # Default SSL verify mode to true, give option to disable verify_mo...
[ "def", "get_connection_string", "(", "config", ":", "Dict", ")", ":", "srv", "=", "config", ".", "get", "(", "'srv'", ")", "==", "'true'", "# Default SSL verify mode to true, give option to disable", "verify_mode", "=", "config", ".", "get", "(", "'verify_mode'", ...
https://github.com/transferwise/pipelinewise/blob/6934b3851512dbdd4280790bf253a0a13ab65684/pipelinewise/fastsync/commons/tap_mongodb.py#L156-L197
google/trax
d6cae2067dedd0490b78d831033607357e975015
trax/layers/research/efficient_attention.py
python
LSHSelfAttention.backward
(self, inputs, output, grad, weights, state, new_state, rng=None, **kwargs)
return inputs_grad, weights_grad
Custom backward pass, for efficiency (see forward_and_or_backward).
Custom backward pass, for efficiency (see forward_and_or_backward).
[ "Custom", "backward", "pass", "for", "efficiency", "(", "see", "forward_and_or_backward", ")", "." ]
def backward(self, inputs, output, grad, weights, state, new_state, rng=None, **kwargs): """Custom backward pass, for efficiency (see forward_and_or_backward).""" assert not self._use_reference_code del output, state, kwargs _, _, inputs_grad, weights_grad = self.forward_and_or_backward( ...
[ "def", "backward", "(", "self", ",", "inputs", ",", "output", ",", "grad", ",", "weights", ",", "state", ",", "new_state", ",", "rng", "=", "None", ",", "*", "*", "kwargs", ")", ":", "assert", "not", "self", ".", "_use_reference_code", "del", "output",...
https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/layers/research/efficient_attention.py#L2252-L2260
aws-ia/taskcat
67d19abdc1ad2070296925c297b614bbe7caaa76
taskcat/_cli_modules/lint.py
python
Lint.__init__
( self, input_file: str = ".taskcat.yml", project_root: str = "./", strict: bool = False, )
:param input_file: path to project config or CloudFormation template :param project_root: base path for project :param strict: fail on lint warnings as well as errors
:param input_file: path to project config or CloudFormation template :param project_root: base path for project :param strict: fail on lint warnings as well as errors
[ ":", "param", "input_file", ":", "path", "to", "project", "config", "or", "CloudFormation", "template", ":", "param", "project_root", ":", "base", "path", "for", "project", ":", "param", "strict", ":", "fail", "on", "lint", "warnings", "as", "well", "as", ...
def __init__( self, input_file: str = ".taskcat.yml", project_root: str = "./", strict: bool = False, ): """ :param input_file: path to project config or CloudFormation template :param project_root: base path for project :param strict: fail on lint war...
[ "def", "__init__", "(", "self", ",", "input_file", ":", "str", "=", "\".taskcat.yml\"", ",", "project_root", ":", "str", "=", "\"./\"", ",", "strict", ":", "bool", "=", "False", ",", ")", ":", "project_root_path", ":", "Path", "=", "Path", "(", "project_...
https://github.com/aws-ia/taskcat/blob/67d19abdc1ad2070296925c297b614bbe7caaa76/taskcat/_cli_modules/lint.py#L14-L37
Calysto/metakernel
9815c0e8b3f9c427105b5d094e9041a303302469
metakernel/_metakernel.py
python
MetaKernel.reload_magics
(self)
Reload all of the line and cell magics.
Reload all of the line and cell magics.
[ "Reload", "all", "of", "the", "line", "and", "cell", "magics", "." ]
def reload_magics(self): """Reload all of the line and cell magics.""" self.line_magics = {} self.cell_magics = {} # get base magic files and those relative to the current class # directory magic_files = [] # Make a metakernel/magics if it doesn't exist: ...
[ "def", "reload_magics", "(", "self", ")", ":", "self", ".", "line_magics", "=", "{", "}", "self", ".", "cell_magics", "=", "{", "}", "# get base magic files and those relative to the current class", "# directory", "magic_files", "=", "[", "]", "# Make a metakernel/mag...
https://github.com/Calysto/metakernel/blob/9815c0e8b3f9c427105b5d094e9041a303302469/metakernel/_metakernel.py#L737-L768
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/dyck_word.py
python
DyckWords_size.__iter__
(self)
r""" Return an iterator for Dyck words with ``k1`` opening and ``k2`` closing parentheses. EXAMPLES:: sage: list(DyckWords(0)) [[]] sage: list(DyckWords(1)) [[1, 0]] sage: list(DyckWords(2)) [[1, 0, 1, 0], [1, 1, 0, 0]] ...
r""" Return an iterator for Dyck words with ``k1`` opening and ``k2`` closing parentheses.
[ "r", "Return", "an", "iterator", "for", "Dyck", "words", "with", "k1", "opening", "and", "k2", "closing", "parentheses", "." ]
def __iter__(self): r""" Return an iterator for Dyck words with ``k1`` opening and ``k2`` closing parentheses. EXAMPLES:: sage: list(DyckWords(0)) [[]] sage: list(DyckWords(1)) [[1, 0]] sage: list(DyckWords(2)) [[1...
[ "def", "__iter__", "(", "self", ")", ":", "if", "self", ".", "k1", "==", "0", ":", "yield", "self", ".", "element_class", "(", "self", ",", "[", "]", ")", "elif", "self", ".", "k2", "==", "0", ":", "yield", "self", ".", "element_class", "(", "sel...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/dyck_word.py#L3677-L3705
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/set_partition_ordered.py
python
OrderedSetPartition.base_set_cardinality
(self)
return sum(len(x) for x in self)
Return the cardinality of the base set of ``self``, which is the sum of the sizes of the parts of ``self``. This is also known as the *size* (sometimes the *weight*) of an ordered set partition. EXAMPLES:: sage: OrderedSetPartition([[1], [2,3], [4]]).base_set_cardinality()...
Return the cardinality of the base set of ``self``, which is the sum of the sizes of the parts of ``self``.
[ "Return", "the", "cardinality", "of", "the", "base", "set", "of", "self", "which", "is", "the", "sum", "of", "the", "sizes", "of", "the", "parts", "of", "self", "." ]
def base_set_cardinality(self): """ Return the cardinality of the base set of ``self``, which is the sum of the sizes of the parts of ``self``. This is also known as the *size* (sometimes the *weight*) of an ordered set partition. EXAMPLES:: sage: OrderedSe...
[ "def", "base_set_cardinality", "(", "self", ")", ":", "return", "sum", "(", "len", "(", "x", ")", "for", "x", "in", "self", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/set_partition_ordered.py#L263-L278
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_utils/filter_plugins/openshift_hosted_filters.py
python
FilterModule.filters
(self)
return {'get_router_replicas': self.get_router_replicas}
returns a mapping of filters to methods
returns a mapping of filters to methods
[ "returns", "a", "mapping", "of", "filters", "to", "methods" ]
def filters(self): ''' returns a mapping of filters to methods ''' return {'get_router_replicas': self.get_router_replicas}
[ "def", "filters", "(", "self", ")", ":", "return", "{", "'get_router_replicas'", ":", "self", ".", "get_router_replicas", "}" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_utils/filter_plugins/openshift_hosted_filters.py#L40-L42
techwithtim/Sudoku-GUI-Solver
d02ece82f114f120d4632815d8276a0787775cd2
solver.py
python
print_board
(bo)
[]
def print_board(bo): for i in range(len(bo)): if i % 3 == 0 and i != 0: print("- - - - - - - - - - - - - ") for j in range(len(bo[0])): if j % 3 == 0 and j != 0: print(" | ", end="") if j == 8: print(bo[i][j]) else: ...
[ "def", "print_board", "(", "bo", ")", ":", "for", "i", "in", "range", "(", "len", "(", "bo", ")", ")", ":", "if", "i", "%", "3", "==", "0", "and", "i", "!=", "0", ":", "print", "(", "\"- - - - - - - - - - - - - \"", ")", "for", "j", "in", "range"...
https://github.com/techwithtim/Sudoku-GUI-Solver/blob/d02ece82f114f120d4632815d8276a0787775cd2/solver.py#L45-L57
Kozea/pygal
8267b03535ff55789a30bf66b798302adad88623
pygal/colors.py
python
saturate
(color, percent)
return adjust(color, 1, percent)
Saturate a color by increasing its saturation by percent
Saturate a color by increasing its saturation by percent
[ "Saturate", "a", "color", "by", "increasing", "its", "saturation", "by", "percent" ]
def saturate(color, percent): """Saturate a color by increasing its saturation by percent""" return adjust(color, 1, percent)
[ "def", "saturate", "(", "color", ",", "percent", ")", ":", "return", "adjust", "(", "color", ",", "1", ",", "percent", ")" ]
https://github.com/Kozea/pygal/blob/8267b03535ff55789a30bf66b798302adad88623/pygal/colors.py#L191-L193
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/pymaging-bench.py
python
draw_lines
(img)
return img
[]
def draw_lines(img): topleft_bottomright = Line(0, 0, 999, 999) bottomright_topleft = Line(999, 999, 0, 0) bottomleft_topright = Line(0, 999, 999, 0) topright_bottomleft = Line(999, 0, 0, 999) img.draw(topleft_bottomright, White) img.draw(bottomright_topleft, White) img.draw(bottomleft_topr...
[ "def", "draw_lines", "(", "img", ")", ":", "topleft_bottomright", "=", "Line", "(", "0", ",", "0", ",", "999", ",", "999", ")", "bottomright_topleft", "=", "Line", "(", "999", ",", "999", ",", "0", ",", "0", ")", "bottomleft_topright", "=", "Line", "...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/pymaging-bench.py#L19-L50
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/flaskbb/user/forms.py
python
ChangeEmailForm.__init__
(self, user, *args, **kwargs)
[]
def __init__(self, user, *args, **kwargs): self.user = user kwargs['obj'] = self.user super(ChangeEmailForm, self).__init__(*args, **kwargs)
[ "def", "__init__", "(", "self", ",", "user", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "user", "=", "user", "kwargs", "[", "'obj'", "]", "=", "self", ".", "user", "super", "(", "ChangeEmailForm", ",", "self", ")", ".", "__...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/flaskbb/user/forms.py#L53-L56
Ultimaker/Cura
a1622c77ea7259ecb956acd6de07b7d34b7ac52b
cura/Settings/MachineManager.py
python
MachineManager.variantBuildplateUsable
(self)
return result
The selected buildplate is usable if it is usable for all materials OR it is compatible for one but not compatible for the other material but the buildplate is still usable
The selected buildplate is usable if it is usable for all materials OR it is compatible for one but not compatible
[ "The", "selected", "buildplate", "is", "usable", "if", "it", "is", "usable", "for", "all", "materials", "OR", "it", "is", "compatible", "for", "one", "but", "not", "compatible" ]
def variantBuildplateUsable(self) -> bool: """The selected buildplate is usable if it is usable for all materials OR it is compatible for one but not compatible for the other material but the buildplate is still usable """ if not self._global_container_stack: return True ...
[ "def", "variantBuildplateUsable", "(", "self", ")", "->", "bool", ":", "if", "not", "self", ".", "_global_container_stack", ":", "return", "True", "# Here the next formula is being calculated:", "# result = (not (material_left_compatible and material_right_compatible)) and", "# ...
https://github.com/Ultimaker/Cura/blob/a1622c77ea7259ecb956acd6de07b7d34b7ac52b/cura/Settings/MachineManager.py#L786-L809
BRML/climin
2215b1abb5906a98ba95b868072b5f4f66b11679
climin/mathadapt.py
python
where
(x, *args)
Delegate to gnumpy.where or numpy.where depending on the type of `x`.
Delegate to gnumpy.where or numpy.where depending on the type of `x`.
[ "Delegate", "to", "gnumpy", ".", "where", "or", "numpy", ".", "where", "depending", "on", "the", "type", "of", "x", "." ]
def where(x, *args): """Delegate to gnumpy.where or numpy.where depending on the type of `x`.""" if not isinstance(x, np.ndarray): return gp.where(x, *args) else: return np.where(x, *args)
[ "def", "where", "(", "x", ",", "*", "args", ")", ":", "if", "not", "isinstance", "(", "x", ",", "np", ".", "ndarray", ")", ":", "return", "gp", ".", "where", "(", "x", ",", "*", "args", ")", "else", ":", "return", "np", ".", "where", "(", "x"...
https://github.com/BRML/climin/blob/2215b1abb5906a98ba95b868072b5f4f66b11679/climin/mathadapt.py#L58-L63
OfflineIMAP/offlineimap
e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2
offlineimap/CustomConfig.py
python
ConfigHelperMixin.getconfint
(self, option, default = CustomConfigDefault)
return self._confighelper_runner(option, default, self.getconfig().getdefaultint, self.getconfig().getint)
Retrieves integer value from the configuration. Arguments: - option: option name whose value is to be retrieved; - default: default return value if no such option exists.
Retrieves integer value from the configuration.
[ "Retrieves", "integer", "value", "from", "the", "configuration", "." ]
def getconfint(self, option, default = CustomConfigDefault): """ Retrieves integer value from the configuration. Arguments: - option: option name whose value is to be retrieved; - default: default return value if no such option exists. """ return s...
[ "def", "getconfint", "(", "self", ",", "option", ",", "default", "=", "CustomConfigDefault", ")", ":", "return", "self", ".", "_confighelper_runner", "(", "option", ",", "default", ",", "self", ".", "getconfig", "(", ")", ".", "getdefaultint", ",", "self", ...
https://github.com/OfflineIMAP/offlineimap/blob/e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2/offlineimap/CustomConfig.py#L270-L283
EnableSecurity/wafw00f
3257c48d45ffb2f6504629aa3c5d529f1b886c1b
wafw00f/plugins/siteground.py
python
is_waf
(self)
return False
[]
def is_waf(self): schemes = [ self.matchContent(r"Our system thinks you might be a robot!"), self.matchContent(r'access is restricted due to a security rule') ] if any(i for i in schemes): return True return False
[ "def", "is_waf", "(", "self", ")", ":", "schemes", "=", "[", "self", ".", "matchContent", "(", "r\"Our system thinks you might be a robot!\"", ")", ",", "self", ".", "matchContent", "(", "r'access is restricted due to a security rule'", ")", "]", "if", "any", "(", ...
https://github.com/EnableSecurity/wafw00f/blob/3257c48d45ffb2f6504629aa3c5d529f1b886c1b/wafw00f/plugins/siteground.py#L10-L17
OpnTec/open-event-server
a48f7e4c6002db6fb4dc06bac6508536a0dc585e
app/api/helpers/jwt.py
python
jwt_authenticate
(email, password)
helper function to authenticate user if credentials are correct :param email: :param password: :return:
helper function to authenticate user if credentials are correct :param email: :param password: :return:
[ "helper", "function", "to", "authenticate", "user", "if", "credentials", "are", "correct", ":", "param", "email", ":", ":", "param", "password", ":", ":", "return", ":" ]
def jwt_authenticate(email, password): """ helper function to authenticate user if credentials are correct :param email: :param password: :return: """ user = User.query.filter_by(email=email).first() if user is None: return None auth_ok = check_password_hash( password...
[ "def", "jwt_authenticate", "(", "email", ",", "password", ")", ":", "user", "=", "User", ".", "query", ".", "filter_by", "(", "email", "=", "email", ")", ".", "first", "(", ")", "if", "user", "is", "None", ":", "return", "None", "auth_ok", "=", "chec...
https://github.com/OpnTec/open-event-server/blob/a48f7e4c6002db6fb4dc06bac6508536a0dc585e/app/api/helpers/jwt.py#L7-L25
mrkipling/maraschino
c6be9286937783ae01df2d6d8cebfc8b2734a7d7
lib/pastebin/pastebin.py
python
PastebinAPI.trending
(self, api_dev_key)
return response
Returns the top trending paste details. Usage Example:: >>> from pastebin import PastebinAPI >>> x = PastebinAPI() >>> details = x.trending('453a994e0e2f1efae07f8759e59e075b') >>> print details <paste> <paste_key>jjMRFDH6</paste_k...
Returns the top trending paste details.
[ "Returns", "the", "top", "trending", "paste", "details", "." ]
def trending(self, api_dev_key): """Returns the top trending paste details. Usage Example:: >>> from pastebin import PastebinAPI >>> x = PastebinAPI() >>> details = x.trending('453a994e0e2f1efae07f8759e59e075b') >>> print details <pas...
[ "def", "trending", "(", "self", ",", "api_dev_key", ")", ":", "# Valid api developer key", "argv", "=", "{", "'api_dev_key'", ":", "str", "(", "api_dev_key", ")", "}", "# Valid API option - 'trends' is returns trending pastes", "argv", "[", "'api_option'", "]", "=", ...
https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/pastebin/pastebin.py#L401-L451
shiyanhui/FileHeader
f347cc134021fb0b710694b71c57742476f5fd2b
jinja2/filters.py
python
do_attr
(environment, obj, name)
return environment.undefined(obj=obj, name=name)
Get an attribute of an object. ``foo|attr("bar")`` works like ``foo["bar"]`` just that always an attribute is returned and items are not looked up. See :ref:`Notes on subscriptions <notes-on-subscriptions>` for more details.
Get an attribute of an object. ``foo|attr("bar")`` works like ``foo["bar"]`` just that always an attribute is returned and items are not looked up.
[ "Get", "an", "attribute", "of", "an", "object", ".", "foo|attr", "(", "bar", ")", "works", "like", "foo", "[", "bar", "]", "just", "that", "always", "an", "attribute", "is", "returned", "and", "items", "are", "not", "looked", "up", "." ]
def do_attr(environment, obj, name): """Get an attribute of an object. ``foo|attr("bar")`` works like ``foo["bar"]`` just that always an attribute is returned and items are not looked up. See :ref:`Notes on subscriptions <notes-on-subscriptions>` for more details. """ try: name = str(n...
[ "def", "do_attr", "(", "environment", ",", "obj", ",", "name", ")", ":", "try", ":", "name", "=", "str", "(", "name", ")", "except", "UnicodeError", ":", "pass", "else", ":", "try", ":", "value", "=", "getattr", "(", "obj", ",", "name", ")", "excep...
https://github.com/shiyanhui/FileHeader/blob/f347cc134021fb0b710694b71c57742476f5fd2b/jinja2/filters.py#L773-L794
allenai/allennlp
a3d71254fcc0f3615910e9c3d48874515edf53e0
allennlp/commands/predict.py
python
_PredictManager._get_json_data
(self)
[]
def _get_json_data(self) -> Iterator[JsonDict]: if self._input_file == "-": for line in sys.stdin: if not line.isspace(): yield self._predictor.load_line(line) else: input_file = cached_path(self._input_file) with open(input_file, "...
[ "def", "_get_json_data", "(", "self", ")", "->", "Iterator", "[", "JsonDict", "]", ":", "if", "self", ".", "_input_file", "==", "\"-\"", ":", "for", "line", "in", "sys", ".", "stdin", ":", "if", "not", "line", ".", "isspace", "(", ")", ":", "yield", ...
https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/commands/predict.py#L206-L216
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/Django-1.11.29/django/contrib/gis/gdal/field.py
python
Field.type
(self)
return capi.get_field_type(self.ptr)
Returns the OGR type of this Field.
Returns the OGR type of this Field.
[ "Returns", "the", "OGR", "type", "of", "this", "Field", "." ]
def type(self): "Returns the OGR type of this Field." return capi.get_field_type(self.ptr)
[ "def", "type", "(", "self", ")", ":", "return", "capi", ".", "get_field_type", "(", "self", ".", "ptr", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/contrib/gis/gdal/field.py#L88-L90
Tencent/tencent-ml-images
182631879cdb3d44d594d13d3f29a98bf7acdf81
models/resnet.py
python
ResNet._batch_norm
(self, name, x, is_training=True)
Batch normalization. Considering the performance, we use batch_normalization in contrib/layers/python/layers/layers.py instead of tf.nn.batch_normalization and set fused=True Args: x: input tensor is_training: Whether to return the output in training mode or in inference mode, use the argme...
Batch normalization. Considering the performance, we use batch_normalization in contrib/layers/python/layers/layers.py instead of tf.nn.batch_normalization and set fused=True Args: x: input tensor is_training: Whether to return the output in training mode or in inference mode, use the argme...
[ "Batch", "normalization", ".", "Considering", "the", "performance", "we", "use", "batch_normalization", "in", "contrib", "/", "layers", "/", "python", "/", "layers", "/", "layers", ".", "py", "instead", "of", "tf", ".", "nn", ".", "batch_normalization", "and",...
def _batch_norm(self, name, x, is_training=True): """Batch normalization. Considering the performance, we use batch_normalization in contrib/layers/python/layers/layers.py instead of tf.nn.batch_normalization and set fused=True Args: x: input tensor is_training: Whether to return the ou...
[ "def", "_batch_norm", "(", "self", ",", "name", ",", "x", ",", "is_training", "=", "True", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ")", ":", "return", "tf", ".", "layers", ".", "batch_normalization", "(", "inputs", "=", "x", ",", ...
https://github.com/Tencent/tencent-ml-images/blob/182631879cdb3d44d594d13d3f29a98bf7acdf81/models/resnet.py#L113-L132
eirannejad/pyRevit
49c0b7eb54eb343458ce1365425e6552d0c47d44
site-packages/sqlalchemy/util/queue.py
python
Queue.put
(self, item, block=True, timeout=None)
Put an item into the queue. If optional args `block` is True and `timeout` is None (the default), block if necessary until a free slot is available. If `timeout` is a positive number, it blocks at most `timeout` seconds and raises the ``Full`` exception if no free slot was avail...
Put an item into the queue.
[ "Put", "an", "item", "into", "the", "queue", "." ]
def put(self, item, block=True, timeout=None): """Put an item into the queue. If optional args `block` is True and `timeout` is None (the default), block if necessary until a free slot is available. If `timeout` is a positive number, it blocks at most `timeout` seconds and raise...
[ "def", "put", "(", "self", ",", "item", ",", "block", "=", "True", ",", "timeout", "=", "None", ")", ":", "self", ".", "not_full", ".", "acquire", "(", ")", "try", ":", "if", "not", "block", ":", "if", "self", ".", "_full", "(", ")", ":", "rais...
https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/sqlalchemy/util/queue.py#L87-L120
MongoEngine/django-mongoengine
e8a75e8e5860545ecfbadaf1b1285495022bd7cb
django_mongoengine/forms/widgets.py
python
Dictionary.__init__
(self, schema=None, no_schema=1, max_depth=None, flags=None, sub_attrs=None, attrs=None, verbose_dict=None, verbose_field=None)
:param schema: A dictionary representing the future schema of the Dictionary widget. It is responsible for the creation of subwidgets. :param no_schema: An integer that can take 3 values : 0,1,2. 0 means that no schema was passed. ...
:param schema: A dictionary representing the future schema of the Dictionary widget. It is responsible for the creation of subwidgets. :param no_schema: An integer that can take 3 values : 0,1,2. 0 means that no schema was passed. ...
[ ":", "param", "schema", ":", "A", "dictionary", "representing", "the", "future", "schema", "of", "the", "Dictionary", "widget", ".", "It", "is", "responsible", "for", "the", "creation", "of", "subwidgets", ".", ":", "param", "no_schema", ":", "An", "integer"...
def __init__(self, schema=None, no_schema=1, max_depth=None, flags=None, sub_attrs=None, attrs=None, verbose_dict=None, verbose_field=None): """ :param schema: A dictionary representing the future schema of the Dictionary widget. It is responsible...
[ "def", "__init__", "(", "self", ",", "schema", "=", "None", ",", "no_schema", "=", "1", ",", "max_depth", "=", "None", ",", "flags", "=", "None", ",", "sub_attrs", "=", "None", ",", "attrs", "=", "None", ",", "verbose_dict", "=", "None", ",", "verbos...
https://github.com/MongoEngine/django-mongoengine/blob/e8a75e8e5860545ecfbadaf1b1285495022bd7cb/django_mongoengine/forms/widgets.py#L19-L76
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/xmlrpc/client.py
python
ServerProxy.__close
(self)
[]
def __close(self): self.__transport.close()
[ "def", "__close", "(", "self", ")", ":", "self", ".", "__transport", ".", "close", "(", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/xmlrpc/client.py#L1390-L1391
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/mailbox.py
python
_singlefileMailbox.lock
(self)
Lock the mailbox.
Lock the mailbox.
[ "Lock", "the", "mailbox", "." ]
def lock(self): """Lock the mailbox.""" if not self._locked: _lock_file(self._file) self._locked = True
[ "def", "lock", "(", "self", ")", ":", "if", "not", "self", ".", "_locked", ":", "_lock_file", "(", "self", ".", "_file", ")", "self", ".", "_locked", "=", "True" ]
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/mailbox.py#L560-L564
ddbourgin/numpy-ml
b0359af5285fbf9699d64fd5ec059493228af03e
numpy_ml/neural_nets/layers/layers.py
python
LayerNorm1D.__init__
(self, epsilon=1e-5, optimizer=None)
A layer normalization layer for 1D inputs. Notes ----- In contrast to :class:`BatchNorm1D`, the LayerNorm layer calculates the mean and variance across *features* rather than examples in the batch ensuring that the mean and variance estimates are independent of batch siz...
A layer normalization layer for 1D inputs.
[ "A", "layer", "normalization", "layer", "for", "1D", "inputs", "." ]
def __init__(self, epsilon=1e-5, optimizer=None): """ A layer normalization layer for 1D inputs. Notes ----- In contrast to :class:`BatchNorm1D`, the LayerNorm layer calculates the mean and variance across *features* rather than examples in the batch ensuring tha...
[ "def", "__init__", "(", "self", ",", "epsilon", "=", "1e-5", ",", "optimizer", "=", "None", ")", ":", "# noqa: E501", "super", "(", ")", ".", "__init__", "(", "optimizer", ")", "self", ".", "n_in", "=", "None", "self", ".", "n_out", "=", "None", "sel...
https://github.com/ddbourgin/numpy-ml/blob/b0359af5285fbf9699d64fd5ec059493228af03e/numpy_ml/neural_nets/layers/layers.py#L1635-L1685
laspy/laspy
c9d9b9c0e8d84288134c02bf4ecec3964f5afa29
laspy/header.py
python
LasHeader.y_offset
(self)
return self.offsets[1]
[]
def y_offset(self) -> float: return self.offsets[1]
[ "def", "y_offset", "(", "self", ")", "->", "float", ":", "return", "self", ".", "offsets", "[", "1", "]" ]
https://github.com/laspy/laspy/blob/c9d9b9c0e8d84288134c02bf4ecec3964f5afa29/laspy/header.py#L314-L315
AwesomeTTS/awesometts-anki-addon
c7c2c94479b610b9767ec44cdbb825002bc0c2b7
awesometts/router.py
python
Router.get_options
(self, svc_id)
return service['options']
Returns a list of options that should be displayed for the service, with defaults highlighted.
Returns a list of options that should be displayed for the service, with defaults highlighted.
[ "Returns", "a", "list", "of", "options", "that", "should", "be", "displayed", "for", "the", "service", "with", "defaults", "highlighted", "." ]
def get_options(self, svc_id): """ Returns a list of options that should be displayed for the service, with defaults highlighted. """ svc_id, service = self._fetch_options_and_extras(svc_id) return service['options']
[ "def", "get_options", "(", "self", ",", "svc_id", ")", ":", "svc_id", ",", "service", "=", "self", ".", "_fetch_options_and_extras", "(", "svc_id", ")", "return", "service", "[", "'options'", "]" ]
https://github.com/AwesomeTTS/awesometts-anki-addon/blob/c7c2c94479b610b9767ec44cdbb825002bc0c2b7/awesometts/router.py#L212-L219
kivy/python-for-android
4ecaa5fe01aa25e3bc8cadc52ae481645754f955
pythonforandroid/recipe.py
python
CythonRecipe.build_arch
(self, arch)
Build any cython components, then install the Python module by calling setup.py install with the target Python dir.
Build any cython components, then install the Python module by calling setup.py install with the target Python dir.
[ "Build", "any", "cython", "components", "then", "install", "the", "Python", "module", "by", "calling", "setup", ".", "py", "install", "with", "the", "target", "Python", "dir", "." ]
def build_arch(self, arch): '''Build any cython components, then install the Python module by calling setup.py install with the target Python dir. ''' Recipe.build_arch(self, arch) self.build_cython_components(arch) self.install_python_package(arch)
[ "def", "build_arch", "(", "self", ",", "arch", ")", ":", "Recipe", ".", "build_arch", "(", "self", ",", "arch", ")", "self", ".", "build_cython_components", "(", "arch", ")", "self", ".", "install_python_package", "(", "arch", ")" ]
https://github.com/kivy/python-for-android/blob/4ecaa5fe01aa25e3bc8cadc52ae481645754f955/pythonforandroid/recipe.py#L1054-L1060
firedrakeproject/firedrake
06ab4975c14c0d4dcb79be55821f8b9e41554125
firedrake/slate/slate.py
python
Tensor._output_string
(self, prec=None)
return ["S", "V", "M"][self.rank] + "_%d" % self.id
Creates a string representation of the tensor.
Creates a string representation of the tensor.
[ "Creates", "a", "string", "representation", "of", "the", "tensor", "." ]
def _output_string(self, prec=None): """Creates a string representation of the tensor.""" return ["S", "V", "M"][self.rank] + "_%d" % self.id
[ "def", "_output_string", "(", "self", ",", "prec", "=", "None", ")", ":", "return", "[", "\"S\"", ",", "\"V\"", ",", "\"M\"", "]", "[", "self", ".", "rank", "]", "+", "\"_%d\"", "%", "self", ".", "id" ]
https://github.com/firedrakeproject/firedrake/blob/06ab4975c14c0d4dcb79be55821f8b9e41554125/firedrake/slate/slate.py#L870-L872
albertogeniola/MerossIot
35abe51dbc97f1aadcba7ec52b58b88711a6a0ef
meross_iot/controller/mixins/roller_shutter.py
python
RollerShutterTimerMixin.get_position
(self, channel: int = 0, *args, **kwargs)
return self._roller_shutter_position_by_channel.get(channel)
The current roller shutter position. Returns 100 if the given roller shutter is open, 0 if it is close, -1 if it is stop. :param channel: channel of which status is needed :return: 100 if the given roller shutter is opened, 0 if it is closed, -1 if it is stopped.
The current roller shutter position. Returns 100 if the given roller shutter is open, 0 if it is close, -1 if it is stop.
[ "The", "current", "roller", "shutter", "position", ".", "Returns", "100", "if", "the", "given", "roller", "shutter", "is", "open", "0", "if", "it", "is", "close", "-", "1", "if", "it", "is", "stop", "." ]
def get_position(self, channel: int = 0, *args, **kwargs) -> Optional[int]: """ The current roller shutter position. Returns 100 if the given roller shutter is open, 0 if it is close, -1 if it is stop. :param channel: channel of which status is needed :return: 100 if the given roller s...
[ "def", "get_position", "(", "self", ",", "channel", ":", "int", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "Optional", "[", "int", "]", ":", "self", ".", "check_full_update_done", "(", ")", "return", "self", ".", "_roller_shutter_p...
https://github.com/albertogeniola/MerossIot/blob/35abe51dbc97f1aadcba7ec52b58b88711a6a0ef/meross_iot/controller/mixins/roller_shutter.py#L133-L142
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
coredns/datadog_checks/coredns/config_models/defaults.py
python
instance_tls_cert
(field, value)
return get_default_field_value(field, value)
[]
def instance_tls_cert(field, value): return get_default_field_value(field, value)
[ "def", "instance_tls_cert", "(", "field", ",", "value", ")", ":", "return", "get_default_field_value", "(", "field", ",", "value", ")" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/coredns/datadog_checks/coredns/config_models/defaults.py#L309-L310
PaddlePaddle/models
511e2e282960ed4c7440c3f1d1e62017acb90e11
tutorials/mobilenetv3_prod/Step6/paddlevision/datasets/vision.py
python
StandardTransform._format_transform_repr
(self, transform: Callable, head: str)
return (["{}{}".format(head, lines[0])] + ["{}{}".format(" " * len(head), line) for line in lines[1:]])
[]
def _format_transform_repr(self, transform: Callable, head: str) -> List[str]: lines = transform.__repr__().splitlines() return (["{}{}".format(head, lines[0])] + ["{}{}".format(" " * len(head), line) for line in lines[1:]])
[ "def", "_format_transform_repr", "(", "self", ",", "transform", ":", "Callable", ",", "head", ":", "str", ")", "->", "List", "[", "str", "]", ":", "lines", "=", "transform", ".", "__repr__", "(", ")", ".", "splitlines", "(", ")", "return", "(", "[", ...
https://github.com/PaddlePaddle/models/blob/511e2e282960ed4c7440c3f1d1e62017acb90e11/tutorials/mobilenetv3_prod/Step6/paddlevision/datasets/vision.py#L99-L103
tensorflow/benchmarks
16af178ad312e8c1213efb27a5f227044228bfdf
scripts/tf_cnn_benchmarks/preprocessing.py
python
Cifar10ImagePreprocessor.preprocess
(self, raw_image)
return tf.cast(normalized, self.dtype)
Preprocessing raw image.
Preprocessing raw image.
[ "Preprocessing", "raw", "image", "." ]
def preprocess(self, raw_image): """Preprocessing raw image.""" if self.summary_verbosity >= 3: tf.summary.image('raw.image', tf.expand_dims(raw_image, 0)) if self.train and self.distortions: image = self._distort_image(raw_image) else: image = self._eval_image(raw_image) normalize...
[ "def", "preprocess", "(", "self", ",", "raw_image", ")", ":", "if", "self", ".", "summary_verbosity", ">=", "3", ":", "tf", ".", "summary", ".", "image", "(", "'raw.image'", ",", "tf", ".", "expand_dims", "(", "raw_image", ",", "0", ")", ")", "if", "...
https://github.com/tensorflow/benchmarks/blob/16af178ad312e8c1213efb27a5f227044228bfdf/scripts/tf_cnn_benchmarks/preprocessing.py#L854-L863
nosmokingbandit/watcher
dadacd21a5790ee609058a98a17fcc8954d24439
lib/sqlalchemy/sql/type_api.py
python
TypeEngine.result_processor
(self, dialect, coltype)
return None
Return a conversion function for processing result row values. Returns a callable which will receive a result row column value as the sole positional argument and will return a value to return to the user. If processing is not necessary, the method should return ``None``. :par...
Return a conversion function for processing result row values.
[ "Return", "a", "conversion", "function", "for", "processing", "result", "row", "values", "." ]
def result_processor(self, dialect, coltype): """Return a conversion function for processing result row values. Returns a callable which will receive a result row column value as the sole positional argument and will return a value to return to the user. If processing is not ne...
[ "def", "result_processor", "(", "self", ",", "dialect", ",", "coltype", ")", ":", "return", "None" ]
https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/sql/type_api.py#L261-L275
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/setuptools/sandbox.py
python
run_setup
(setup_script, args)
Run a distutils setup script, sandboxed in its directory
Run a distutils setup script, sandboxed in its directory
[ "Run", "a", "distutils", "setup", "script", "sandboxed", "in", "its", "directory" ]
def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" old_dir = os.getcwd() save_argv = sys.argv[:] save_path = sys.path[:] setup_dir = os.path.abspath(os.path.dirname(setup_script)) temp_dir = os.path.join(setup_dir,'temp') if not os.path.isdir(te...
[ "def", "run_setup", "(", "setup_script", ",", "args", ")", ":", "old_dir", "=", "os", ".", "getcwd", "(", ")", "save_argv", "=", "sys", ".", "argv", "[", ":", "]", "save_path", "=", "sys", ".", "path", "[", ":", "]", "setup_dir", "=", "os", ".", ...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/setuptools/sandbox.py#L42-L79
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
NLP/EMNLP2019-MAL/src/train.py
python
prepare_batch_input
(insts, data_input_names, src_pad_idx, trg_pad_idx, n_head, d_model)
return data_input_dict, np.asarray([num_token], dtype="float32")
Put all padded data needed by training into a dict.
Put all padded data needed by training into a dict.
[ "Put", "all", "padded", "data", "needed", "by", "training", "into", "a", "dict", "." ]
def prepare_batch_input(insts, data_input_names, src_pad_idx, trg_pad_idx, n_head, d_model): """ Put all padded data needed by training into a dict. """ src_word, src_pos, src_slf_attn_bias, src_max_len = pad_batch_data( [inst[0] for inst in insts], src_pad_idx, n_head, i...
[ "def", "prepare_batch_input", "(", "insts", ",", "data_input_names", ",", "src_pad_idx", ",", "trg_pad_idx", ",", "n_head", ",", "d_model", ")", ":", "src_word", ",", "src_pos", ",", "src_slf_attn_bias", ",", "src_max_len", "=", "pad_batch_data", "(", "[", "inst...
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/NLP/EMNLP2019-MAL/src/train.py#L238-L301
wistbean/fxxkpython
88e16d79d8dd37236ba6ecd0d0ff11d63143968c
vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/html5lib/treeadapters/sax.py
python
to_sax
(walker, handler)
Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use
Call SAX-like content handler based on treewalker walker
[ "Call", "SAX", "-", "like", "content", "handler", "based", "on", "treewalker", "walker" ]
def to_sax(walker, handler): """Call SAX-like content handler based on treewalker walker :arg walker: the treewalker to use to walk the tree to convert it :arg handler: SAX handler to use """ handler.startDocument() for prefix, namespace in prefix_mapping.items(): handler.startPrefixM...
[ "def", "to_sax", "(", "walker", ",", "handler", ")", ":", "handler", ".", "startDocument", "(", ")", "for", "prefix", ",", "namespace", "in", "prefix_mapping", ".", "items", "(", ")", ":", "handler", ".", "startPrefixMapping", "(", "prefix", ",", "namespac...
https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/html5lib/treeadapters/sax.py#L13-L50
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/github/View.py
python
View.timestamp
(self)
return self._timestamp.value
:type: datetime.datetime
:type: datetime.datetime
[ ":", "type", ":", "datetime", ".", "datetime" ]
def timestamp(self): """ :type: datetime.datetime """ return self._timestamp.value
[ "def", "timestamp", "(", "self", ")", ":", "return", "self", ".", "_timestamp", ".", "value" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/github/View.py#L50-L54
Qiskit/qiskit-terra
b66030e3b9192efdd3eb95cf25c6545fe0a13da4
qiskit/algorithms/optimizers/gsls.py
python
GSLS.ls_optimize
( self, n: int, obj_fun: Callable, initial_point: np.ndarray, var_lb: np.ndarray, var_ub: np.ndarray, )
return x, x_value, n_evals, grad_norm
Run the line search optimization. Args: n: Dimension of the problem. obj_fun: Objective function. initial_point: Initial point. var_lb: Vector of lower bounds on the decision variables. Vector elements can be -np.inf if the corresponding varia...
Run the line search optimization.
[ "Run", "the", "line", "search", "optimization", "." ]
def ls_optimize( self, n: int, obj_fun: Callable, initial_point: np.ndarray, var_lb: np.ndarray, var_ub: np.ndarray, ) -> Tuple[np.ndarray, float, int, float]: """Run the line search optimization. Args: n: Dimension of the problem. ...
[ "def", "ls_optimize", "(", "self", ",", "n", ":", "int", ",", "obj_fun", ":", "Callable", ",", "initial_point", ":", "np", ".", "ndarray", ",", "var_lb", ":", "np", ".", "ndarray", ",", "var_ub", ":", "np", ".", "ndarray", ",", ")", "->", "Tuple", ...
https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/algorithms/optimizers/gsls.py#L153-L268
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/functions/orthogonal_polys.py
python
Func_assoc_legendre_P._derivative_
(self, n, m, x, *args, **kwds)
Return the derivative of ``gen_legendre_P(n,m,x)``. EXAMPLES:: sage: (m,n) = var('m,n') sage: derivative(gen_legendre_P(n,m,x), x) -((n + 1)*x*gen_legendre_P(n, m, x) + (m - n - 1)*gen_legendre_P(n + 1, m, x))/(x^2 - 1) sage: gen_legendre_P(3,2,x,hold=True).diff...
Return the derivative of ``gen_legendre_P(n,m,x)``.
[ "Return", "the", "derivative", "of", "gen_legendre_P", "(", "n", "m", "x", ")", "." ]
def _derivative_(self, n, m, x, *args, **kwds): """ Return the derivative of ``gen_legendre_P(n,m,x)``. EXAMPLES:: sage: (m,n) = var('m,n') sage: derivative(gen_legendre_P(n,m,x), x) -((n + 1)*x*gen_legendre_P(n, m, x) + (m - n - 1)*gen_legendre_P(n + 1, m, ...
[ "def", "_derivative_", "(", "self", ",", "n", ",", "m", ",", "x", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "diff_param", "=", "kwds", "[", "'diff_param'", "]", "if", "diff_param", "==", "0", ":", "raise", "NotImplementedError", "(", "\"Deri...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/functions/orthogonal_polys.py#L1715-L1737
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/contrib/clothing.py
python
Clothing.at_get
(self, getter)
Makes absolutely sure clothes aren't already set as 'worn' when they're picked up, in case they've somehow had their location changed without getting removed.
Makes absolutely sure clothes aren't already set as 'worn' when they're picked up, in case they've somehow had their location changed without getting removed.
[ "Makes", "absolutely", "sure", "clothes", "aren", "t", "already", "set", "as", "worn", "when", "they", "re", "picked", "up", "in", "case", "they", "ve", "somehow", "had", "their", "location", "changed", "without", "getting", "removed", "." ]
def at_get(self, getter): """ Makes absolutely sure clothes aren't already set as 'worn' when they're picked up, in case they've somehow had their location changed without getting removed. """ self.db.worn = False
[ "def", "at_get", "(", "self", ",", "getter", ")", ":", "self", ".", "db", ".", "worn", "=", "False" ]
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/contrib/clothing.py#L302-L308
hellohaptik/chatbot_ner
742104790170ae5b73c583c94db6786549337dc4
ner_v2/detectors/temporal/date/date_detection.py
python
DateAdvancedDetector._detect_return_date
(self)
return date_dict_list
Finds return type dates in the given text by matching few keywords like 'coming back', 'return date', 'leaving on', 'returning on', 'returning at', 'arriving', 'arrive' . It detects dates in the part of text right to these keywords. Args: Returns: The list of dictionary con...
Finds return type dates in the given text by matching few keywords like 'coming back', 'return date', 'leaving on', 'returning on', 'returning at', 'arriving', 'arrive' . It detects dates in the part of text right to these keywords.
[ "Finds", "return", "type", "dates", "in", "the", "given", "text", "by", "matching", "few", "keywords", "like", "coming", "back", "return", "date", "leaving", "on", "returning", "on", "returning", "at", "arriving", "arrive", ".", "It", "detects", "dates", "in...
def _detect_return_date(self): """ Finds return type dates in the given text by matching few keywords like 'coming back', 'return date', 'leaving on', 'returning on', 'returning at', 'arriving', 'arrive' . It detects dates in the part of text right to these keywords. Args: ...
[ "def", "_detect_return_date", "(", "self", ")", ":", "date_dict_list", "=", "[", "]", "regex_pattern_1", "=", "re", ".", "compile", "(", "r'\\b'", "r'(?:check(?:\\s|\\-)?out date (?:is|\\:)?|'", "r'coming back|return date\\s?(?:\\:|\\-)?|returning on|returning at|'", "r'arrivin...
https://github.com/hellohaptik/chatbot_ner/blob/742104790170ae5b73c583c94db6786549337dc4/ner_v2/detectors/temporal/date/date_detection.py#L323-L355
ahmetcemturan/SFACT
7576e29ba72b33e5058049b77b7b558875542747
fabmetheus_utilities/archive.py
python
getAbsoluteFrozenFolderPath
(filePath, folderName='')
return getAbsoluteFolderPath(filePath, folderName)
Get the absolute frozen folder path.
Get the absolute frozen folder path.
[ "Get", "the", "absolute", "frozen", "folder", "path", "." ]
def getAbsoluteFrozenFolderPath(filePath, folderName=''): 'Get the absolute frozen folder path.' if hasattr(sys, 'frozen'): if '.py' in filePath: filePath = ''.join(filePath.rpartition('\\')[: 2]) filePath = os.path.join(filePath, 'skeinforge_application') return getAbsoluteFolderPath(filePath, folderName)
[ "def", "getAbsoluteFrozenFolderPath", "(", "filePath", ",", "folderName", "=", "''", ")", ":", "if", "hasattr", "(", "sys", ",", "'frozen'", ")", ":", "if", "'.py'", "in", "filePath", ":", "filePath", "=", "''", ".", "join", "(", "filePath", ".", "rparti...
https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/fabmetheus_utilities/archive.py#L39-L45
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/native_exec/simple_x64.py
python
create_displacement
(base=None, index=None, scale=None, disp=0, prefix=None)
return mem_access(base, index, scale, disp, prefix)
[]
def create_displacement(base=None, index=None, scale=None, disp=0, prefix=None): if index is not None and scale is None: scale = 1 if scale and index is None: raise ValueError("Cannot create displacement with scale and no index") if scale and index.upper() == "RSP": raise ValueError(...
[ "def", "create_displacement", "(", "base", "=", "None", ",", "index", "=", "None", ",", "scale", "=", "None", ",", "disp", "=", "0", ",", "prefix", "=", "None", ")", ":", "if", "index", "is", "not", "None", "and", "scale", "is", "None", ":", "scale...
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/native_exec/simple_x64.py#L197-L204
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/root_system/type_marked.py
python
CartanType_affine.special_node
(self)
return self._type.special_node()
r""" Return the special node of the Cartan type. .. SEEALSO:: :meth:`~sage.combinat.root_system.CartanType_affine.special_node` It is the special node of the non-marked Cartan type.. EXAMPLES:: sage: CartanType(['B', 3, 1]).marked_nodes([1,3]).special_node() 0
r""" Return the special node of the Cartan type.
[ "r", "Return", "the", "special", "node", "of", "the", "Cartan", "type", "." ]
def special_node(self): r""" Return the special node of the Cartan type. .. SEEALSO:: :meth:`~sage.combinat.root_system.CartanType_affine.special_node` It is the special node of the non-marked Cartan type.. EXAMPLES:: sage: CartanType(['B', 3, 1]).marked_nodes([1,...
[ "def", "special_node", "(", "self", ")", ":", "return", "self", ".", "_type", ".", "special_node", "(", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/root_system/type_marked.py#L712-L725
zhang-can/ECO-pytorch
355c3866b35cdaa5d451263c1f3291c150e22eeb
tf_model_zoo/models/neural_gpu/data_utils.py
python
to_id
(s)
return int(s) + 1
Covert text to ids.
Covert text to ids.
[ "Covert", "text", "to", "ids", "." ]
def to_id(s): """Covert text to ids.""" if s == "+": return 11 if s == "*": return 12 return int(s) + 1
[ "def", "to_id", "(", "s", ")", ":", "if", "s", "==", "\"+\"", ":", "return", "11", "if", "s", "==", "\"*\"", ":", "return", "12", "return", "int", "(", "s", ")", "+", "1" ]
https://github.com/zhang-can/ECO-pytorch/blob/355c3866b35cdaa5d451263c1f3291c150e22eeb/tf_model_zoo/models/neural_gpu/data_utils.py#L214-L218
runawayhorse001/LearningApacheSpark
67f3879dce17553195f094f5728b94a01badcf24
pyspark/rdd.py
python
RDD.values
(self)
return self.map(lambda x: x[1])
Return an RDD with the values of each tuple. >>> m = sc.parallelize([(1, 2), (3, 4)]).values() >>> m.collect() [2, 4]
Return an RDD with the values of each tuple.
[ "Return", "an", "RDD", "with", "the", "values", "of", "each", "tuple", "." ]
def values(self): """ Return an RDD with the values of each tuple. >>> m = sc.parallelize([(1, 2), (3, 4)]).values() >>> m.collect() [2, 4] """ return self.map(lambda x: x[1])
[ "def", "values", "(", "self", ")", ":", "return", "self", ".", "map", "(", "lambda", "x", ":", "x", "[", "1", "]", ")" ]
https://github.com/runawayhorse001/LearningApacheSpark/blob/67f3879dce17553195f094f5728b94a01badcf24/pyspark/rdd.py#L1599-L1607
mrlesmithjr/Ansible
d44f0dc0d942bdf3bf7334b307e6048f0ee16e36
roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/wheel/metadata.py
python
pkginfo_unicode
(pkg_info, field)
return text
Hack to coax Unicode out of an email Message() - Python 3.3+
Hack to coax Unicode out of an email Message() - Python 3.3+
[ "Hack", "to", "coax", "Unicode", "out", "of", "an", "email", "Message", "()", "-", "Python", "3", ".", "3", "+" ]
def pkginfo_unicode(pkg_info, field): """Hack to coax Unicode out of an email Message() - Python 3.3+""" text = pkg_info[field] field = field.lower() if not isinstance(text, str): if not hasattr(pkg_info, 'raw_items'): # Python 3.2 return str(text) for item in pkg_info.raw_i...
[ "def", "pkginfo_unicode", "(", "pkg_info", ",", "field", ")", ":", "text", "=", "pkg_info", "[", "field", "]", "field", "=", "field", ".", "lower", "(", ")", "if", "not", "isinstance", "(", "text", ",", "str", ")", ":", "if", "not", "hasattr", "(", ...
https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/wheel/metadata.py#L290-L303
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/searching.py
python
Results.upgrade_and_extend
(self, results)
Combines the effects of extend() and upgrade(): hits that are also in 'results' are raised. Then any hits from the other results object that are not in this results object are appended to the end. :param results: another results object.
Combines the effects of extend() and upgrade(): hits that are also in 'results' are raised. Then any hits from the other results object that are not in this results object are appended to the end.
[ "Combines", "the", "effects", "of", "extend", "()", "and", "upgrade", "()", ":", "hits", "that", "are", "also", "in", "results", "are", "raised", ".", "Then", "any", "hits", "from", "the", "other", "results", "object", "that", "are", "not", "in", "this",...
def upgrade_and_extend(self, results): """Combines the effects of extend() and upgrade(): hits that are also in 'results' are raised. Then any hits from the other results object that are not in this results object are appended to the end. :param results: another results object. ...
[ "def", "upgrade_and_extend", "(", "self", ",", "results", ")", ":", "if", "not", "len", "(", "results", ")", ":", "return", "docs", "=", "self", ".", "docs", "(", ")", "otherdocs", "=", "results", ".", "docs", "(", ")", "arein", "=", "[", "item", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/searching.py#L1326-L1345
carbonblack/cbapi-python
24d677ffd99aee911c2c76ecb5528e4e9320c7cc
src/cbapi/live_response_api.py
python
LiveResponseJobScheduler._cleanup_idle_workers
(self, max=None)
[]
def _cleanup_idle_workers(self, max=None): if not max: max = self._max_workers for sensor in list(self._idle_workers)[:max]: log.debug("asking worker for sensor id {0} to exit".format(sensor)) self._job_workers[sensor].job_queue.put(None)
[ "def", "_cleanup_idle_workers", "(", "self", ",", "max", "=", "None", ")", ":", "if", "not", "max", ":", "max", "=", "self", ".", "_max_workers", "for", "sensor", "in", "list", "(", "self", ".", "_idle_workers", ")", "[", ":", "max", "]", ":", "log",...
https://github.com/carbonblack/cbapi-python/blob/24d677ffd99aee911c2c76ecb5528e4e9320c7cc/src/cbapi/live_response_api.py#L942-L948
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/suds/xsd/doctor.py
python
Import.__init__
(self, ns, location=None)
@param ns: An import namespace. @type ns: str @param location: An optional I{schemaLocation}. @type location: str
[]
def __init__(self, ns, location=None): """ @param ns: An import namespace. @type ns: str @param location: An optional I{schemaLocation}. @type location: str """ self.ns = ns self.location = location self.filter = TnsFilter()
[ "def", "__init__", "(", "self", ",", "ns", ",", "location", "=", "None", ")", ":", "self", ".", "ns", "=", "ns", "self", ".", "location", "=", "location", "self", ".", "filter", "=", "TnsFilter", "(", ")" ]
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/suds/xsd/doctor.py#L123-L132
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
lib/spack/spack/build_systems/waf.py
python
WafPackage.build_test
(self)
Run unit tests after build. By default, does nothing. Override this if you want to add package-specific tests.
Run unit tests after build.
[ "Run", "unit", "tests", "after", "build", "." ]
def build_test(self): """Run unit tests after build. By default, does nothing. Override this if you want to add package-specific tests. """ pass
[ "def", "build_test", "(", "self", ")", ":", "pass" ]
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/build_systems/waf.py#L109-L115
FPGAwars/apio
6a3451549f94223a99878b9b67c8e52b9dfcb200
apio/util.py
python
get_bin_dir_table
(base_dir)
return bin_dir
Return a table with the package name and the folder were the executable files are stored * Input: Table with the package base_dir
Return a table with the package name and the folder were the executable files are stored * Input: Table with the package base_dir
[ "Return", "a", "table", "with", "the", "package", "name", "and", "the", "folder", "were", "the", "executable", "files", "are", "stored", "*", "Input", ":", "Table", "with", "the", "package", "base_dir" ]
def get_bin_dir_table(base_dir): """Return a table with the package name and the folder were the executable files are stored * Input: Table with the package base_dir """ bin_dir = { OSS_CAD_SUITE: str(Path(base_dir.get(OSS_CAD_SUITE)) / BIN), SCONS: str(Path(base_dir.get(SCONS)) / "...
[ "def", "get_bin_dir_table", "(", "base_dir", ")", ":", "bin_dir", "=", "{", "OSS_CAD_SUITE", ":", "str", "(", "Path", "(", "base_dir", ".", "get", "(", "OSS_CAD_SUITE", ")", ")", "/", "BIN", ")", ",", "SCONS", ":", "str", "(", "Path", "(", "base_dir", ...
https://github.com/FPGAwars/apio/blob/6a3451549f94223a99878b9b67c8e52b9dfcb200/apio/util.py#L485-L507
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python3-alpha/python-libs/gdata/finance/service.py
python
FinanceService.DeletePosition
(self, position_entry=None, portfolio_id=None, ticker_id=None, transaction_feed=None)
return True
A position is deleted by deleting all its transactions. Args: position_entry: PositionEntry (optional; see Notes) portfolio_id: string (optional; see Notes) This may be obtained from a PortfolioEntry's portfolio_id attribute. ticker_id: string (optional; see Notes) This may be obtained ...
A position is deleted by deleting all its transactions.
[ "A", "position", "is", "deleted", "by", "deleting", "all", "its", "transactions", "." ]
def DeletePosition(self, position_entry=None, portfolio_id=None, ticker_id=None, transaction_feed=None): """A position is deleted by deleting all its transactions. Args: position_entry: PositionEntry (optional; see Notes) portfolio_id: string (optional; see Notes) This may be obtained ...
[ "def", "DeletePosition", "(", "self", ",", "position_entry", "=", "None", ",", "portfolio_id", "=", "None", ",", "ticker_id", "=", "None", ",", "transaction_feed", "=", "None", ")", ":", "if", "transaction_feed", ":", "feed", "=", "transaction_feed", "else", ...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/gdata/finance/service.py#L172-L200
QCoDeS/Qcodes
3cda2cef44812e2aa4672781f2423bf5f816f9f9
qcodes/instrument_drivers/tektronix/Keithley_2450.py
python
Sense2450.auto_zero_once
(self)
This command causes the instrument to refresh the reference and zero measurements once.
This command causes the instrument to refresh the reference and zero measurements once.
[ "This", "command", "causes", "the", "instrument", "to", "refresh", "the", "reference", "and", "zero", "measurements", "once", "." ]
def auto_zero_once(self) -> None: """ This command causes the instrument to refresh the reference and zero measurements once. """ self.write(":SENSe:AZERo:ONCE")
[ "def", "auto_zero_once", "(", "self", ")", "->", "None", ":", "self", ".", "write", "(", "\":SENSe:AZERo:ONCE\"", ")" ]
https://github.com/QCoDeS/Qcodes/blob/3cda2cef44812e2aa4672781f2423bf5f816f9f9/qcodes/instrument_drivers/tektronix/Keithley_2450.py#L336-L341
w3h/isf
6faf0a3df185465ec17369c90ccc16e2a03a1870
lib/thirdparty/bitstring.py
python
Bits.split
(self, delimiter, start=None, end=None, count=None, bytealigned=None)
return
Return bitstring generator by splittling using a delimiter. The first item returned is the initial bitstring before the delimiter, which may be an empty bitstring. delimiter -- The bitstring used as the divider. start -- The bit position to start the split. Defaults to 0. end -...
Return bitstring generator by splittling using a delimiter.
[ "Return", "bitstring", "generator", "by", "splittling", "using", "a", "delimiter", "." ]
def split(self, delimiter, start=None, end=None, count=None, bytealigned=None): """Return bitstring generator by splittling using a delimiter. The first item returned is the initial bitstring before the delimiter, which may be an empty bitstring. delimiter -- The bitstrin...
[ "def", "split", "(", "self", ",", "delimiter", ",", "start", "=", "None", ",", "end", "=", "None", ",", "count", "=", "None", ",", "bytealigned", "=", "None", ")", ":", "delimiter", "=", "Bits", "(", "delimiter", ")", "if", "not", "delimiter", ".", ...
https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/bitstring.py#L2567-L2622
SeuTao/TGS-Salt-Identification-Challenge-2018-_4th_place_solution
aae45f7040464e0dd2f85825b99ca90821f2caeb
loss/lovasz_losses.py
python
flatten_binary_scores
(scores, labels, ignore=None)
return vscores, vlabels
Flattens predictions in the batch (binary case) Remove labels equal to 'ignore'
Flattens predictions in the batch (binary case) Remove labels equal to 'ignore'
[ "Flattens", "predictions", "in", "the", "batch", "(", "binary", "case", ")", "Remove", "labels", "equal", "to", "ignore" ]
def flatten_binary_scores(scores, labels, ignore=None): """ Flattens predictions in the batch (binary case) Remove labels equal to 'ignore' """ scores = scores.view(-1) labels = labels.view(-1) if ignore is None: return scores, labels valid = (labels != ignore) vscores = scor...
[ "def", "flatten_binary_scores", "(", "scores", ",", "labels", ",", "ignore", "=", "None", ")", ":", "scores", "=", "scores", ".", "view", "(", "-", "1", ")", "labels", "=", "labels", ".", "view", "(", "-", "1", ")", "if", "ignore", "is", "None", ":...
https://github.com/SeuTao/TGS-Salt-Identification-Challenge-2018-_4th_place_solution/blob/aae45f7040464e0dd2f85825b99ca90821f2caeb/loss/lovasz_losses.py#L117-L129
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/axes/_base.py
python
_AxesBase.has_data
(self)
return ( len(self.collections) + len(self.images) + len(self.lines) + len(self.patches)) > 0
Return *True* if any artists have been added to axes. This should not be used to determine whether the *dataLim* need to be updated, and may not actually be useful for anything.
Return *True* if any artists have been added to axes.
[ "Return", "*", "True", "*", "if", "any", "artists", "have", "been", "added", "to", "axes", "." ]
def has_data(self): """ Return *True* if any artists have been added to axes. This should not be used to determine whether the *dataLim* need to be updated, and may not actually be useful for anything. """ return ( len(self.collections) + ...
[ "def", "has_data", "(", "self", ")", ":", "return", "(", "len", "(", "self", ".", "collections", ")", "+", "len", "(", "self", ".", "images", ")", "+", "len", "(", "self", ".", "lines", ")", "+", "len", "(", "self", ".", "patches", ")", ")", ">...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/axes/_base.py#L1786-L1798
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/lib-tk/ttk.py
python
Treeview.identify_element
(self, x, y)
return self.identify("element", x, y)
Returns the element at position x, y. * Availability: Tk 8.6
Returns the element at position x, y.
[ "Returns", "the", "element", "at", "position", "x", "y", "." ]
def identify_element(self, x, y): """Returns the element at position x, y. * Availability: Tk 8.6""" return self.identify("element", x, y)
[ "def", "identify_element", "(", "self", ",", "x", ",", "y", ")", ":", "return", "self", ".", "identify", "(", "\"element\"", ",", "x", ",", "y", ")" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/ttk.py#L1308-L1312
nipy/nibabel
4703f4d8e32be4cec30e829c2d93ebe54759bb62
nibabel/ecat.py
python
EcatImage.to_file_map
(self, file_map=None)
Write ECAT7 image to `file_map` or contained ``self.file_map`` The format consist of: - A main header (512L) with dictionary entries in the form [numAvail, nextDir, previousDir, numUsed] - For every frame (3D volume in 4D data) - A subheader (size = frame_offset) ...
Write ECAT7 image to `file_map` or contained ``self.file_map``
[ "Write", "ECAT7", "image", "to", "file_map", "or", "contained", "self", ".", "file_map" ]
def to_file_map(self, file_map=None): """ Write ECAT7 image to `file_map` or contained ``self.file_map`` The format consist of: - A main header (512L) with dictionary entries in the form [numAvail, nextDir, previousDir, numUsed] - For every frame (3D volume in 4D data) ...
[ "def", "to_file_map", "(", "self", ",", "file_map", "=", "None", ")", ":", "if", "file_map", "is", "None", ":", "file_map", "=", "self", ".", "file_map", "# It appears to be necessary to load the data before saving even if the", "# data itself is not used.", "self", "."...
https://github.com/nipy/nibabel/blob/4703f4d8e32be4cec30e829c2d93ebe54759bb62/nibabel/ecat.py#L941-L1023
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/datetime.py
python
date.isoweekday
(self)
return self.toordinal() % 7 or 7
Return day of the week, where Monday == 1 ... Sunday == 7.
Return day of the week, where Monday == 1 ... Sunday == 7.
[ "Return", "day", "of", "the", "week", "where", "Monday", "==", "1", "...", "Sunday", "==", "7", "." ]
def isoweekday(self): "Return day of the week, where Monday == 1 ... Sunday == 7." # 1-Jan-0001 is a Monday return self.toordinal() % 7 or 7
[ "def", "isoweekday", "(", "self", ")", ":", "# 1-Jan-0001 is a Monday", "return", "self", ".", "toordinal", "(", ")", "%", "7", "or", "7" ]
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/datetime.py#L900-L903
asdf-format/asdf
c1f6cf915409da5372c47ac725dc922b4bd52f7d
asdf/extension/_converter.py
python
Converter.tags
(self)
Get the YAML tags that this converter is capable of handling. URI patterns are permitted, see `asdf.util.uri_match` for details. Returns ------- iterable of str Tag URIs or URI patterns.
Get the YAML tags that this converter is capable of handling. URI patterns are permitted, see `asdf.util.uri_match` for details.
[ "Get", "the", "YAML", "tags", "that", "this", "converter", "is", "capable", "of", "handling", ".", "URI", "patterns", "are", "permitted", "see", "asdf", ".", "util", ".", "uri_match", "for", "details", "." ]
def tags(self): """ Get the YAML tags that this converter is capable of handling. URI patterns are permitted, see `asdf.util.uri_match` for details. Returns ------- iterable of str Tag URIs or URI patterns. """ pass
[ "def", "tags", "(", "self", ")", ":", "pass" ]
https://github.com/asdf-format/asdf/blob/c1f6cf915409da5372c47ac725dc922b4bd52f7d/asdf/extension/_converter.py#L29-L40
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/io/formats/format.py
python
FloatArrayFormatter._value_formatter
( self, float_format: FloatFormatType | None = None, threshold: float | int | None = None, )
return formatter
Returns a function to be applied on each value to format it
Returns a function to be applied on each value to format it
[ "Returns", "a", "function", "to", "be", "applied", "on", "each", "value", "to", "format", "it" ]
def _value_formatter( self, float_format: FloatFormatType | None = None, threshold: float | int | None = None, ) -> Callable: """Returns a function to be applied on each value to format it""" # the float_format parameter supersedes self.float_format if float_format is...
[ "def", "_value_formatter", "(", "self", ",", "float_format", ":", "FloatFormatType", "|", "None", "=", "None", ",", "threshold", ":", "float", "|", "int", "|", "None", "=", "None", ",", ")", "->", "Callable", ":", "# the float_format parameter supersedes self.fl...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/io/formats/format.py#L1438-L1492
carlospolop/legion
df23a348663dcf29d20114ce475988e114e0f135
lib/interact.py
python
LegionPrompt.do_run
(self, _)
Execute the confiured protocol attack
Execute the confiured protocol attack
[ "Execute", "the", "confiured", "protocol", "attack" ]
def do_run(self, _): '''Execute the confiured protocol attack''' self.priv_values["protohelp"] = False self.update_executed() warrior = self.initW() if warrior != -1: # If -1, then something went wrong creating the warrior self.ws.append(warrior) thread ...
[ "def", "do_run", "(", "self", ",", "_", ")", ":", "self", ".", "priv_values", "[", "\"protohelp\"", "]", "=", "False", "self", ".", "update_executed", "(", ")", "warrior", "=", "self", ".", "initW", "(", ")", "if", "warrior", "!=", "-", "1", ":", "...
https://github.com/carlospolop/legion/blob/df23a348663dcf29d20114ce475988e114e0f135/lib/interact.py#L160-L171
zetaops/ulakbus
bcc05abf17bbd6dbeec93809e4ad30885e94e83e
ulakbus/services/common/banka.py
python
authenticate
(func)
return auth
Banka yetkilendirme kontrolü için decorator fonksiyon. Banka servislerine istek geldiğinde öncelikle bu fonksiyon tetiklenir ve Banka kullanıcı bilgileri kontrol edilir. Bilgiler sistemdeki bilgilerle uyuşuyorsa işleme devam edilir. Aksi taktirde AuthException hatası verilir. Args: func (...
Banka yetkilendirme kontrolü için decorator fonksiyon.
[ "Banka", "yetkilendirme", "kontrolü", "için", "decorator", "fonksiyon", "." ]
def authenticate(func): """ Banka yetkilendirme kontrolü için decorator fonksiyon. Banka servislerine istek geldiğinde öncelikle bu fonksiyon tetiklenir ve Banka kullanıcı bilgileri kontrol edilir. Bilgiler sistemdeki bilgilerle uyuşuyorsa işleme devam edilir. Aksi taktirde AuthException hatas...
[ "def", "authenticate", "(", "func", ")", ":", "def", "auth", "(", "self", ")", ":", "try", ":", "self", ".", "banka", "=", "Banka", ".", "objects", ".", "get", "(", "kod", "=", "str", "(", "self", ".", "request", ".", "input", ".", "banka_kodu", ...
https://github.com/zetaops/ulakbus/blob/bcc05abf17bbd6dbeec93809e4ad30885e94e83e/ulakbus/services/common/banka.py#L29-L55
Latitude-Archives/AIDungeon
591f318091f46306d01a5307505534a32bd18024
generator/gpt2/src/model.py
python
shape_list
(x)
return [dynamic[i] if s is None else s for i, s in enumerate(static)]
Deal with dynamic shape in tensorflow cleanly.
Deal with dynamic shape in tensorflow cleanly.
[ "Deal", "with", "dynamic", "shape", "in", "tensorflow", "cleanly", "." ]
def shape_list(x): """Deal with dynamic shape in tensorflow cleanly.""" static = x.shape.as_list() dynamic = tf.shape(x) return [dynamic[i] if s is None else s for i, s in enumerate(static)]
[ "def", "shape_list", "(", "x", ")", ":", "static", "=", "x", ".", "shape", ".", "as_list", "(", ")", "dynamic", "=", "tf", ".", "shape", "(", "x", ")", "return", "[", "dynamic", "[", "i", "]", "if", "s", "is", "None", "else", "s", "for", "i", ...
https://github.com/Latitude-Archives/AIDungeon/blob/591f318091f46306d01a5307505534a32bd18024/generator/gpt2/src/model.py#L11-L15
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/pupylib/utils/rpyc_utils.py
python
redirected_stdio
(module, stdout=None, stderr=None)
r""" Redirects the other party's ``stdin``, ``stdout`` and ``stderr`` to those of the local party, so remote IO will occur locally. Example usage:: with redirected_stdio(conn): conn.modules.sys.stdout.write("hello\n") # will be printed locally
r""" Redirects the other party's ``stdin``, ``stdout`` and ``stderr`` to those of the local party, so remote IO will occur locally.
[ "r", "Redirects", "the", "other", "party", "s", "stdin", "stdout", "and", "stderr", "to", "those", "of", "the", "local", "party", "so", "remote", "IO", "will", "occur", "locally", "." ]
def redirected_stdio(module, stdout=None, stderr=None): r""" Redirects the other party's ``stdin``, ``stdout`` and ``stderr`` to those of the local party, so remote IO will occur locally. Example usage:: with redirected_stdio(conn): conn.modules.sys.stdout.write("hello\n") # will...
[ "def", "redirected_stdio", "(", "module", ",", "stdout", "=", "None", ",", "stderr", "=", "None", ")", ":", "ns", "=", "module", ".", "client", ".", "conn", ".", "namespace", "stdin", "=", "sys", ".", "stdin", "if", "stdout", "is", "None", ":", "stdo...
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/pupylib/utils/rpyc_utils.py#L91-L127
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/logging/__init__.py
python
BufferingFormatter.__init__
(self, linefmt=None)
Optionally specify a formatter which will be used to format each individual record.
Optionally specify a formatter which will be used to format each individual record.
[ "Optionally", "specify", "a", "formatter", "which", "will", "be", "used", "to", "format", "each", "individual", "record", "." ]
def __init__(self, linefmt=None): """ Optionally specify a formatter which will be used to format each individual record. """ if linefmt: self.linefmt = linefmt else: self.linefmt = _defaultFormatter
[ "def", "__init__", "(", "self", ",", "linefmt", "=", "None", ")", ":", "if", "linefmt", ":", "self", ".", "linefmt", "=", "linefmt", "else", ":", "self", ".", "linefmt", "=", "_defaultFormatter" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/logging/__init__.py#L507-L515
researchmm/tasn
5dba8ccc096cedc63913730eeea14a9647911129
tasn-mxnet/python/mxnet/operator.py
python
PythonOp.infer_shape
(self, in_shape)
return in_shape, [in_shape[0]]
Interface for ``infer_shape``. Can override when creating new operators. Parameters ---------- in_shape : list List of argument shapes in the same order as declared in list_arguments. Returns ------- in_shape : list List of argument s...
Interface for ``infer_shape``. Can override when creating new operators.
[ "Interface", "for", "infer_shape", ".", "Can", "override", "when", "creating", "new", "operators", "." ]
def infer_shape(self, in_shape): """Interface for ``infer_shape``. Can override when creating new operators. Parameters ---------- in_shape : list List of argument shapes in the same order as declared in list_arguments. Returns ------- in...
[ "def", "infer_shape", "(", "self", ",", "in_shape", ")", ":", "return", "in_shape", ",", "[", "in_shape", "[", "0", "]", "]" ]
https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/python/mxnet/operator.py#L99-L116
libtcod/python-tcod
e12c4172baa9efdfd74aff6ee9bab8454a835248
tcod/sdl.py
python
Window.size
(self)
return xy[0], xy[1]
Return the pixel (width, height) of the window. This attribute can be set to change the size of the window but the given size must be greater than (1, 1) or else an exception will be raised.
Return the pixel (width, height) of the window.
[ "Return", "the", "pixel", "(", "width", "height", ")", "of", "the", "window", "." ]
def size(self) -> Tuple[int, int]: """Return the pixel (width, height) of the window. This attribute can be set to change the size of the window but the given size must be greater than (1, 1) or else an exception will be raised. """ xy = ffi.new("int[2]") lib.SDL...
[ "def", "size", "(", "self", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "xy", "=", "ffi", ".", "new", "(", "\"int[2]\"", ")", "lib", ".", "SDL_GetWindowSize", "(", "self", ".", "p", ",", "xy", ",", "xy", "+", "1", ")", "return", "xy",...
https://github.com/libtcod/python-tcod/blob/e12c4172baa9efdfd74aff6ee9bab8454a835248/tcod/sdl.py#L99-L108
Python-Markdown/markdown
af38c42706f8dff93694d4a7572003dbd8b0ddc0
markdown/extensions/smarty.py
python
SubstituteTextPattern.__init__
(self, pattern, replace, md)
Replaces matches with some text.
Replaces matches with some text.
[ "Replaces", "matches", "with", "some", "text", "." ]
def __init__(self, pattern, replace, md): """ Replaces matches with some text. """ HtmlInlineProcessor.__init__(self, pattern) self.replace = replace self.md = md
[ "def", "__init__", "(", "self", ",", "pattern", ",", "replace", ",", "md", ")", ":", "HtmlInlineProcessor", ".", "__init__", "(", "self", ",", "pattern", ")", "self", ".", "replace", "=", "replace", "self", ".", "md", "=", "md" ]
https://github.com/Python-Markdown/markdown/blob/af38c42706f8dff93694d4a7572003dbd8b0ddc0/markdown/extensions/smarty.py#L152-L156
meduza-corp/interstellar
40a801ccd7856491726f5a126621d9318cabe2e1
gsutil/third_party/python-gflags/gflags.py
python
FlagValues.ShortestUniquePrefixes
(self, fl)
return shortest_matches
Returns: dictionary; maps flag names to their shortest unique prefix.
Returns: dictionary; maps flag names to their shortest unique prefix.
[ "Returns", ":", "dictionary", ";", "maps", "flag", "names", "to", "their", "shortest", "unique", "prefix", "." ]
def ShortestUniquePrefixes(self, fl): """Returns: dictionary; maps flag names to their shortest unique prefix.""" # Sort the list of flag names sorted_flags = [] for name, flag in fl.items(): sorted_flags.append(name) if flag.boolean: sorted_flags.append('no%s' % name) sorted_fla...
[ "def", "ShortestUniquePrefixes", "(", "self", ",", "fl", ")", ":", "# Sort the list of flag names", "sorted_flags", "=", "[", "]", "for", "name", ",", "flag", "in", "fl", ".", "items", "(", ")", ":", "sorted_flags", ".", "append", "(", "name", ")", "if", ...
https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/python-gflags/gflags.py#L1487-L1521
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/inject/plugins/generic/filesystem.py
python
Filesystem.writeFile
(self, localFile, remoteFile, fileType=None, forceCheck=False)
return written
[]
def writeFile(self, localFile, remoteFile, fileType=None, forceCheck=False): written = False checkFile(localFile) self.checkDbmsOs() if localFile.endswith('_'): localFile = decloakToTemp(localFile) if conf.direct or isStackingAvailable(): if isStacking...
[ "def", "writeFile", "(", "self", ",", "localFile", ",", "remoteFile", ",", "fileType", "=", "None", ",", "forceCheck", "=", "False", ")", ":", "written", "=", "False", "checkFile", "(", "localFile", ")", "self", ".", "checkDbmsOs", "(", ")", "if", "local...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/plugins/generic/filesystem.py#L267-L299
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/asynchat.py
python
async_chat.writable
(self)
return self.producer_fifo or (not self.connected)
predicate for inclusion in the writable for select()
predicate for inclusion in the writable for select()
[ "predicate", "for", "inclusion", "in", "the", "writable", "for", "select", "()" ]
def writable (self): "predicate for inclusion in the writable for select()" return self.producer_fifo or (not self.connected)
[ "def", "writable", "(", "self", ")", ":", "return", "self", ".", "producer_fifo", "or", "(", "not", "self", ".", "connected", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/asynchat.py#L207-L209
CoinAlpha/hummingbot
36f6149c1644c07cd36795b915f38b8f49b798e7
hummingbot/connector/exchange/wazirx/wazirx_exchange.py
python
WazirxExchange.tracking_states
(self)
return { key: value.to_json() for key, value in self._in_flight_orders.items() if not value.is_done }
:return active in-flight orders in json format, is used to save in sqlite db.
:return active in-flight orders in json format, is used to save in sqlite db.
[ ":", "return", "active", "in", "-", "flight", "orders", "in", "json", "format", "is", "used", "to", "save", "in", "sqlite", "db", "." ]
def tracking_states(self) -> Dict[str, any]: """ :return active in-flight orders in json format, is used to save in sqlite db. """ return { key: value.to_json() for key, value in self._in_flight_orders.items() if not value.is_done }
[ "def", "tracking_states", "(", "self", ")", "->", "Dict", "[", "str", ",", "any", "]", ":", "return", "{", "key", ":", "value", ".", "to_json", "(", ")", "for", "key", ",", "value", "in", "self", ".", "_in_flight_orders", ".", "items", "(", ")", "i...
https://github.com/CoinAlpha/hummingbot/blob/36f6149c1644c07cd36795b915f38b8f49b798e7/hummingbot/connector/exchange/wazirx/wazirx_exchange.py#L139-L147
TheSouthFrog/stylealign
910632d2fccc9db61b00c265ae18a88913113c1d
pytorch_code/util/visualizer.py
python
Visualizer.reset
(self)
[]
def reset(self): self.saved = False
[ "def", "reset", "(", "self", ")", ":", "self", ".", "saved", "=", "False" ]
https://github.com/TheSouthFrog/stylealign/blob/910632d2fccc9db61b00c265ae18a88913113c1d/pytorch_code/util/visualizer.py#L54-L55
pyenchant/pyenchant
fc2a4a3fca6a55d510d01455b814aa27cdfc961e
enchant/checker/__init__.py
python
SpellChecker.leading_context
(self, chars: int)
return self._array_to_string(context)
Get `chars` characters of leading context. This method returns up to `chars` characters of leading context - the text that occurs in the string immediately before the current erroneous word.
Get `chars` characters of leading context.
[ "Get", "chars", "characters", "of", "leading", "context", "." ]
def leading_context(self, chars: int) -> str: """Get `chars` characters of leading context. This method returns up to `chars` characters of leading context - the text that occurs in the string immediately before the current erroneous word. """ start = max(self.wordpos - ...
[ "def", "leading_context", "(", "self", ",", "chars", ":", "int", ")", "->", "str", ":", "start", "=", "max", "(", "self", ".", "wordpos", "-", "chars", ",", "0", ")", "context", "=", "self", ".", "_text", "[", "start", ":", "self", ".", "wordpos", ...
https://github.com/pyenchant/pyenchant/blob/fc2a4a3fca6a55d510d01455b814aa27cdfc961e/enchant/checker/__init__.py#L377-L386
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/numpy/lib/arraysetops.py
python
unique
(ar, return_index=False, return_inverse=False, return_counts=False)
return ret
Find the unique elements of an array. Returns the sorted unique elements of an array. There are two optional outputs in addition to the unique elements: the indices of the input array that give the unique values, and the indices of the unique array that reconstruct the input array. Parameters ...
Find the unique elements of an array.
[ "Find", "the", "unique", "elements", "of", "an", "array", "." ]
def unique(ar, return_index=False, return_inverse=False, return_counts=False): """ Find the unique elements of an array. Returns the sorted unique elements of an array. There are two optional outputs in addition to the unique elements: the indices of the input array that give the unique values, and...
[ "def", "unique", "(", "ar", ",", "return_index", "=", "False", ",", "return_inverse", "=", "False", ",", "return_counts", "=", "False", ")", ":", "ar", "=", "np", ".", "asanyarray", "(", "ar", ")", ".", "flatten", "(", ")", "optional_indices", "=", "re...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/lib/arraysetops.py#L96-L212
aws-quickstart/quickstart-redhat-openshift
2b87dd38b72e7e4c439a606c5a9ea458d72da612
functions/source/DeleteBucketContents/requests/models.py
python
Response.ok
(self)
return True
Returns True if :attr:`status_code` is less than 400, False if not. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code is between 200 and 400, this will return True. This is **not** a c...
Returns True if :attr:`status_code` is less than 400, False if not.
[ "Returns", "True", "if", ":", "attr", ":", "status_code", "is", "less", "than", "400", "False", "if", "not", "." ]
def ok(self): """Returns True if :attr:`status_code` is less than 400, False if not. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code is between 200 and 400, this will return True. Th...
[ "def", "ok", "(", "self", ")", ":", "try", ":", "self", ".", "raise_for_status", "(", ")", "except", "HTTPError", ":", "return", "False", "return", "True" ]
https://github.com/aws-quickstart/quickstart-redhat-openshift/blob/2b87dd38b72e7e4c439a606c5a9ea458d72da612/functions/source/DeleteBucketContents/requests/models.py#L693-L705
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_vendor/ipaddress.py
python
_BaseNetwork._get_networks_key
(self)
return (self._version, self.network_address, self.netmask)
Network-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort().
Network-only key function.
[ "Network", "-", "only", "key", "function", "." ]
def _get_networks_key(self): """Network-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort(). """ return (self._version, self.network_address, self.netmask)
[ "def", "_get_networks_key", "(", "self", ")", ":", "return", "(", "self", ".", "_version", ",", "self", ".", "network_address", ",", "self", ".", "netmask", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/ipaddress.py#L986-L994
mgear-dev/mgear
06ddc26c5adb5eab07ca470c7fafa77404c8a1de
scripts/mgear/maya/shifter/__init__.py
python
Rig.findControlRelative
(self, guideName)
return self.components[comp_name].getControlRelation(relative_name)
Return the control objects in the rig matching the guide object. Args: guideName (str): Name of the guide object. Returns: transform: The relative control object
Return the control objects in the rig matching the guide object.
[ "Return", "the", "control", "objects", "in", "the", "rig", "matching", "the", "guide", "object", "." ]
def findControlRelative(self, guideName): """Return the control objects in the rig matching the guide object. Args: guideName (str): Name of the guide object. Returns: transform: The relative control object """ if guideName is None: return s...
[ "def", "findControlRelative", "(", "self", ",", "guideName", ")", ":", "if", "guideName", "is", "None", ":", "return", "self", ".", "global_ctl", "# localName = self.getLocalName(guideName)", "comp_name", "=", "self", ".", "getComponentName", "(", "guideName", ")", ...
https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/shifter/__init__.py#L568-L588
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/tools/devappserver2/api_server.py
python
create_api_server
(request_info, storage_path, options, app_id, app_root, request_context=None)
return APIServer('localhost', options.api_port, app_id, request_context)
Creates an API server. Args: request_info: An apiproxy_stub.RequestInfo instance used by the stubs to lookup information about the request associated with an API call. storage_path: A string directory for storing API stub data. options: An instance of argparse.Namespace containing command line flag...
Creates an API server.
[ "Creates", "an", "API", "server", "." ]
def create_api_server(request_info, storage_path, options, app_id, app_root, request_context=None): """Creates an API server. Args: request_info: An apiproxy_stub.RequestInfo instance used by the stubs to lookup information about the request associated with an API call. storage_...
[ "def", "create_api_server", "(", "request_info", ",", "storage_path", ",", "options", ",", "app_id", ",", "app_root", ",", "request_context", "=", "None", ")", ":", "datastore_path", "=", "options", ".", "datastore_path", "or", "os", ".", "path", ".", "join", ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/tools/devappserver2/api_server.py#L234-L333
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/cffi/backend_ctypes.py
python
CTypesData._create_ctype_obj
(cls, init)
[]
def _create_ctype_obj(cls, init): if init is None: return cls._arg_to_ctypes() else: return cls._arg_to_ctypes(init)
[ "def", "_create_ctype_obj", "(", "cls", ",", "init", ")", ":", "if", "init", "is", "None", ":", "return", "cls", ".", "_arg_to_ctypes", "(", ")", "else", ":", "return", "cls", ".", "_arg_to_ctypes", "(", "init", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/cffi/backend_ctypes.py#L47-L51
chubin/cheat.sh
46d1a5f73c6b88da15d809154245dbf234e9479e
lib/fmt/comments.py
python
_language_name
(name)
return VIM_NAME.get(name, name)
[]
def _language_name(name): return VIM_NAME.get(name, name)
[ "def", "_language_name", "(", "name", ")", ":", "return", "VIM_NAME", ".", "get", "(", "name", ",", "name", ")" ]
https://github.com/chubin/cheat.sh/blob/46d1a5f73c6b88da15d809154245dbf234e9479e/lib/fmt/comments.py#L41-L42
CouchPotato/CouchPotatoV1
135b3331d1b88ef645e29b76f2d4cc4a732c9232
library/hachoir_parser/parser_list.py
python
ParserList.print_
(self, title=None, out=None, verbose=False, format="one-line")
Display a list of parser with its title * out: output file * title : title of the list to display * format: "rest", "trac", "file-ext", "mime" or "one_line" (default)
Display a list of parser with its title * out: output file * title : title of the list to display * format: "rest", "trac", "file-ext", "mime" or "one_line" (default)
[ "Display", "a", "list", "of", "parser", "with", "its", "title", "*", "out", ":", "output", "file", "*", "title", ":", "title", "of", "the", "list", "to", "display", "*", "format", ":", "rest", "trac", "file", "-", "ext", "mime", "or", "one_line", "("...
def print_(self, title=None, out=None, verbose=False, format="one-line"): """Display a list of parser with its title * out: output file * title : title of the list to display * format: "rest", "trac", "file-ext", "mime" or "one_line" (default) """ if out is None: ...
[ "def", "print_", "(", "self", ",", "title", "=", "None", ",", "out", "=", "None", ",", "verbose", "=", "False", ",", "format", "=", "\"one-line\"", ")", ":", "if", "out", "is", "None", ":", "out", "=", "sys", ".", "stdout", "if", "format", "in", ...
https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/hachoir_parser/parser_list.py#L88-L174
jazzband/sorl-thumbnail
4fcb55df2cbebb0464c9de6c00e3d089273d687a
sorl/thumbnail/engines/base.py
python
EngineBase.blur
(self, image, geometry, options)
return image
Wrapper for ``_blur``
Wrapper for ``_blur``
[ "Wrapper", "for", "_blur" ]
def blur(self, image, geometry, options): """ Wrapper for ``_blur`` """ if options.get('blur'): return self._blur(image, int(options.get('blur'))) return image
[ "def", "blur", "(", "self", ",", "image", ",", "geometry", ",", "options", ")", ":", "if", "options", ".", "get", "(", "'blur'", ")", ":", "return", "self", ".", "_blur", "(", "image", ",", "int", "(", "options", ".", "get", "(", "'blur'", ")", "...
https://github.com/jazzband/sorl-thumbnail/blob/4fcb55df2cbebb0464c9de6c00e3d089273d687a/sorl/thumbnail/engines/base.py#L118-L124
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py
python
Standard_Suite_Events.duplicate
(self, _object, _attributes={}, **_arguments)
duplicate: Duplicate one or more objects Required argument: the object(s) to duplicate Keyword argument to: the new location for the object(s) Keyword argument with_properties: the initial values for properties of the new object that are to be different from the original Keyword argument...
duplicate: Duplicate one or more objects Required argument: the object(s) to duplicate Keyword argument to: the new location for the object(s) Keyword argument with_properties: the initial values for properties of the new object that are to be different from the original Keyword argument...
[ "duplicate", ":", "Duplicate", "one", "or", "more", "objects", "Required", "argument", ":", "the", "object", "(", "s", ")", "to", "duplicate", "Keyword", "argument", "to", ":", "the", "new", "location", "for", "the", "object", "(", "s", ")", "Keyword", "...
def duplicate(self, _object, _attributes={}, **_arguments): """duplicate: Duplicate one or more objects Required argument: the object(s) to duplicate Keyword argument to: the new location for the object(s) Keyword argument with_properties: the initial values for properties of the new obj...
[ "def", "duplicate", "(", "self", ",", "_object", ",", "_attributes", "=", "{", "}", ",", "*", "*", "_arguments", ")", ":", "_code", "=", "'core'", "_subcode", "=", "'clon'", "aetools", ".", "keysubst", "(", "_arguments", ",", "self", ".", "_argmap_duplic...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py#L147-L168
blogbar/blogbar
4d3703af1a9bdc6d0db97907bcea65432ace49aa
application/controllers/site.py
python
wiki
()
return render_template('site/wiki.html')
帮助
帮助
[ "帮助" ]
def wiki(): """帮助""" return render_template('site/wiki.html')
[ "def", "wiki", "(", ")", ":", "return", "render_template", "(", "'site/wiki.html'", ")" ]
https://github.com/blogbar/blogbar/blob/4d3703af1a9bdc6d0db97907bcea65432ace49aa/application/controllers/site.py#L66-L68
espnet/espnet
ea411f3f627b8f101c211e107d0ff7053344ac80
espnet/nets/asr_interface.py
python
ASRInterface.forward
(self, xs, ilens, ys)
Compute loss for training. :param xs: For pytorch, batch of padded source sequences torch.Tensor (B, Tmax, idim) For chainer, list of source sequences chainer.Variable :param ilens: batch of lengths of source sequences (B) For pytorch, torch.Tensor For ch...
Compute loss for training.
[ "Compute", "loss", "for", "training", "." ]
def forward(self, xs, ilens, ys): """Compute loss for training. :param xs: For pytorch, batch of padded source sequences torch.Tensor (B, Tmax, idim) For chainer, list of source sequences chainer.Variable :param ilens: batch of lengths of source sequences (B) ...
[ "def", "forward", "(", "self", ",", "xs", ",", "ilens", ",", "ys", ")", ":", "raise", "NotImplementedError", "(", "\"forward method is not implemented\"", ")" ]
https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/espnet/nets/asr_interface.py#L38-L53