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
KristianOellegaard/django-hvad
b4fb1ff3674bd8309530ed5dcb95e9c3afd53a10
hvad/manager.py
python
FieldTranslator.__call__
(self, key)
return ret
[]
def __call__(self, key): try: ret = self._cache[key] except KeyError: ret = self._build(key) self._cache[key] = ret return ret
[ "def", "__call__", "(", "self", ",", "key", ")", ":", "try", ":", "ret", "=", "self", ".", "_cache", "[", "key", "]", "except", "KeyError", ":", "ret", "=", "self", ".", "_build", "(", "key", ")", "self", ".", "_cache", "[", "key", "]", "=", "r...
https://github.com/KristianOellegaard/django-hvad/blob/b4fb1ff3674bd8309530ed5dcb95e9c3afd53a10/hvad/manager.py#L41-L47
inventree/InvenTree
4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b
InvenTree/company/models.py
python
ManufacturerPart.create
(cls, part, manufacturer, mpn, description, link=None)
return manufacturer_part
Check if ManufacturerPart instance does not already exist then create it
Check if ManufacturerPart instance does not already exist then create it
[ "Check", "if", "ManufacturerPart", "instance", "does", "not", "already", "exist", "then", "create", "it" ]
def create(cls, part, manufacturer, mpn, description, link=None): """ Check if ManufacturerPart instance does not already exist then create it """ manufacturer_part = None try: manufacturer_part = ManufacturerPart.objects.get(part=part, manufacturer=manufacturer...
[ "def", "create", "(", "cls", ",", "part", ",", "manufacturer", ",", "mpn", ",", "description", ",", "link", "=", "None", ")", ":", "manufacturer_part", "=", "None", "try", ":", "manufacturer_part", "=", "ManufacturerPart", ".", "objects", ".", "get", "(", ...
https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/company/models.py#L359-L375
autotest/autotest
4614ae5f550cc888267b9a419e4b90deb54f8fae
server/base_utils.py
python
default_mappings
(machines)
return (mappings, failures)
Returns a simple mapping in which all machines are assigned to the same key. Provides the default behavior for form_ntuples_from_machines.
Returns a simple mapping in which all machines are assigned to the same key. Provides the default behavior for form_ntuples_from_machines.
[ "Returns", "a", "simple", "mapping", "in", "which", "all", "machines", "are", "assigned", "to", "the", "same", "key", ".", "Provides", "the", "default", "behavior", "for", "form_ntuples_from_machines", "." ]
def default_mappings(machines): """ Returns a simple mapping in which all machines are assigned to the same key. Provides the default behavior for form_ntuples_from_machines. """ mappings = {} failures = [] mach = machines[0] mappings['ident'] = [mach] if len(machines) > 1: ...
[ "def", "default_mappings", "(", "machines", ")", ":", "mappings", "=", "{", "}", "failures", "=", "[", "]", "mach", "=", "machines", "[", "0", "]", "mappings", "[", "'ident'", "]", "=", "[", "mach", "]", "if", "len", "(", "machines", ")", ">", "1",...
https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/server/base_utils.py#L212-L227
wrye-bash/wrye-bash
d495c47cfdb44475befa523438a40c4419cb386f
Mopy/bash/basher/gui_patchers.py
python
_TweakPatcherPanel.GetConfigPanel
(self, parent, config_layout, gTipText)
return gConfigPanel
Show config.
Show config.
[ "Show", "config", "." ]
def GetConfigPanel(self, parent, config_layout, gTipText): """Show config.""" if self.gConfigPanel: return self.gConfigPanel gConfigPanel = super(_TweakPatcherPanel, self).GetConfigPanel( parent, config_layout, gTipText) self.gTweakList = CheckListBox(self.gConfigPanel) ...
[ "def", "GetConfigPanel", "(", "self", ",", "parent", ",", "config_layout", ",", "gTipText", ")", ":", "if", "self", ".", "gConfigPanel", ":", "return", "self", ".", "gConfigPanel", "gConfigPanel", "=", "super", "(", "_TweakPatcherPanel", ",", "self", ")", "....
https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/basher/gui_patchers.py#L522-L540
weldr/lorax
d692ce366287ae468c52bc8becde2fef113661a3
src/pylorax/ltmpl.py
python
LoraxTemplateRunner.mkdir
(self, *dirs)
mkdir DIR [DIR ...] Create the named DIR(s). Will create leading directories as needed. Example: mkdir /images
mkdir DIR [DIR ...] Create the named DIR(s). Will create leading directories as needed.
[ "mkdir", "DIR", "[", "DIR", "...", "]", "Create", "the", "named", "DIR", "(", "s", ")", ".", "Will", "create", "leading", "directories", "as", "needed", "." ]
def mkdir(self, *dirs): ''' mkdir DIR [DIR ...] Create the named DIR(s). Will create leading directories as needed. Example: mkdir /images ''' for d in dirs: d = self._out(d) if not isdir(d): os.makedirs(d)
[ "def", "mkdir", "(", "self", ",", "*", "dirs", ")", ":", "for", "d", "in", "dirs", ":", "d", "=", "self", ".", "_out", "(", "d", ")", "if", "not", "isdir", "(", "d", ")", ":", "os", ".", "makedirs", "(", "d", ")" ]
https://github.com/weldr/lorax/blob/d692ce366287ae468c52bc8becde2fef113661a3/src/pylorax/ltmpl.py#L479-L490
deluge-torrent/deluge
2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc
deluge/ui/client.py
python
Client.get_auth_user
(self)
return self._daemon_proxy.username
Returns the current authenticated username. :returns: the authenticated username :rtype: str
Returns the current authenticated username.
[ "Returns", "the", "current", "authenticated", "username", "." ]
def get_auth_user(self): """ Returns the current authenticated username. :returns: the authenticated username :rtype: str """ return self._daemon_proxy.username
[ "def", "get_auth_user", "(", "self", ")", ":", "return", "self", ".", "_daemon_proxy", ".", "username" ]
https://github.com/deluge-torrent/deluge/blob/2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc/deluge/ui/client.py#L807-L814
taseikyo/PyQt5-Apps
8c715edd3710f413932d982f8e2e24ea9ec6e9bd
google-translate/main.py
python
MyWindow.translated
(self)
[]
def translated(self): global GTransData if GTransData: self.transText.setPlainText(GTransData) else: self.transText.setPlainText("error!") GTransData = ""
[ "def", "translated", "(", "self", ")", ":", "global", "GTransData", "if", "GTransData", ":", "self", ".", "transText", ".", "setPlainText", "(", "GTransData", ")", "else", ":", "self", ".", "transText", ".", "setPlainText", "(", "\"error!\"", ")", "GTransDat...
https://github.com/taseikyo/PyQt5-Apps/blob/8c715edd3710f413932d982f8e2e24ea9ec6e9bd/google-translate/main.py#L175-L181
scrapinghub/spidermon
f2b21e45e70796f583bbb97f39b823c31d242b17
spidermon/contrib/stats/counters.py
python
DictPercentCounter.__len__
(self)
return len(self._dict)
[]
def __len__(self): return len(self._dict)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_dict", ")" ]
https://github.com/scrapinghub/spidermon/blob/f2b21e45e70796f583bbb97f39b823c31d242b17/spidermon/contrib/stats/counters.py#L67-L68
OlafenwaMoses/ImageAI
fe2d6bab3ddb1027c54abe7eb961364928869a30
imageai/Detection/keras_retinanet/utils/anchors.py
python
make_shapes_callback
(model)
return get_shapes
Make a function for getting the shape of the pyramid levels.
Make a function for getting the shape of the pyramid levels.
[ "Make", "a", "function", "for", "getting", "the", "shape", "of", "the", "pyramid", "levels", "." ]
def make_shapes_callback(model): """ Make a function for getting the shape of the pyramid levels. """ def get_shapes(image_shape, pyramid_levels): shape = layer_shapes(image_shape, model) image_shapes = [shape["P{}".format(level)][1:3] for level in pyramid_levels] return image_shapes...
[ "def", "make_shapes_callback", "(", "model", ")", ":", "def", "get_shapes", "(", "image_shape", ",", "pyramid_levels", ")", ":", "shape", "=", "layer_shapes", "(", "image_shape", ",", "model", ")", "image_shapes", "=", "[", "shape", "[", "\"P{}\"", ".", "for...
https://github.com/OlafenwaMoses/ImageAI/blob/fe2d6bab3ddb1027c54abe7eb961364928869a30/imageai/Detection/keras_retinanet/utils/anchors.py#L147-L155
a312863063/seeprettyface-ganerator-dongman
f21440d04dcd94a1e8abb25905c25566ed0fe06f
dnnlib/tflib/tfutil.py
python
absolute_name_scope
(scope: str)
return tf.name_scope(scope + "/")
Forcefully enter the specified name scope, ignoring any surrounding scopes.
Forcefully enter the specified name scope, ignoring any surrounding scopes.
[ "Forcefully", "enter", "the", "specified", "name", "scope", "ignoring", "any", "surrounding", "scopes", "." ]
def absolute_name_scope(scope: str) -> tf.name_scope: """Forcefully enter the specified name scope, ignoring any surrounding scopes.""" return tf.name_scope(scope + "/")
[ "def", "absolute_name_scope", "(", "scope", ":", "str", ")", "->", "tf", ".", "name_scope", ":", "return", "tf", ".", "name_scope", "(", "scope", "+", "\"/\"", ")" ]
https://github.com/a312863063/seeprettyface-ganerator-dongman/blob/f21440d04dcd94a1e8abb25905c25566ed0fe06f/dnnlib/tflib/tfutil.py#L69-L71
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
example/ctp/futures/ApiStruct.py
python
Dissemination.__init__
(self, SequenceSeries=0, SequenceNo=0)
[]
def __init__(self, SequenceSeries=0, SequenceNo=0): self.SequenceSeries = '' #序列系列号, short self.SequenceNo = ''
[ "def", "__init__", "(", "self", ",", "SequenceSeries", "=", "0", ",", "SequenceNo", "=", "0", ")", ":", "self", ".", "SequenceSeries", "=", "''", "#序列系列号, short", "self", ".", "SequenceNo", "=", "''" ]
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/futures/ApiStruct.py#L1901-L1903
adamcaudill/EquationGroupLeak
52fa871c89008566c27159bd48f2a8641260c984
windows/fuzzbunch/pluginmanager.py
python
PluginManager.do_validate
(self, *ignore)
Validate the current parameter settings
Validate the current parameter settings
[ "Validate", "the", "current", "parameter", "settings" ]
def do_validate(self, *ignore): """Validate the current parameter settings""" plugin = self.get_active_plugin() self.io.print_msg("Checking %s parameters" % plugin.getName()) self.io.newline() if plugin.validate(self.session.get_dirs(), globalvars=self.fb.fbglobalvars) and self....
[ "def", "do_validate", "(", "self", ",", "*", "ignore", ")", ":", "plugin", "=", "self", ".", "get_active_plugin", "(", ")", "self", ".", "io", ".", "print_msg", "(", "\"Checking %s parameters\"", "%", "plugin", ".", "getName", "(", ")", ")", "self", ".",...
https://github.com/adamcaudill/EquationGroupLeak/blob/52fa871c89008566c27159bd48f2a8641260c984/windows/fuzzbunch/pluginmanager.py#L243-L252
jd-aig/nlp_baai
e2b3c6fe9cb3ddb478c338be8e5628cb1ff7f6fc
jddc2020_baseline/mhred/tensorflow2/utils_tf/bow.py
python
to_bow
(sentence, vocab_size)
return x
Convert a sentence into a bag of words representation Args - sentence: a list of token ids - vocab_size: V Returns - bow: a integer vector of size V
Convert a sentence into a bag of words representation Args - sentence: a list of token ids - vocab_size: V Returns - bow: a integer vector of size V
[ "Convert", "a", "sentence", "into", "a", "bag", "of", "words", "representation", "Args", "-", "sentence", ":", "a", "list", "of", "token", "ids", "-", "vocab_size", ":", "V", "Returns", "-", "bow", ":", "a", "integer", "vector", "of", "size", "V" ]
def to_bow(sentence, vocab_size): ''' Convert a sentence into a bag of words representation Args - sentence: a list of token ids - vocab_size: V Returns - bow: a integer vector of size V ''' bow = Counter(sentence) # Remove EOS tokens bow[PAD_ID] = 0 bow[EOS_ID] ...
[ "def", "to_bow", "(", "sentence", ",", "vocab_size", ")", ":", "bow", "=", "Counter", "(", "sentence", ")", "# Remove EOS tokens", "bow", "[", "PAD_ID", "]", "=", "0", "bow", "[", "EOS_ID", "]", "=", "0", "x", "=", "np", ".", "zeros", "(", "vocab_siz...
https://github.com/jd-aig/nlp_baai/blob/e2b3c6fe9cb3ddb478c338be8e5628cb1ff7f6fc/jddc2020_baseline/mhred/tensorflow2/utils_tf/bow.py#L8-L24
saltstack/salt-contrib
062355938ad1cced273056e9c23dc344c6a2c858
modules/circus.py
python
stats
(watcher=None, pid=None)
return processes_dict
Return statistics of processes. CLI Example:: salt '*' circus.stats mywatcher
Return statistics of processes.
[ "Return", "statistics", "of", "processes", "." ]
def stats(watcher=None, pid=None): """ Return statistics of processes. CLI Example:: salt '*' circus.stats mywatcher """ salt.utils.warn_until( 'Oxygen', 'circus module is deprecated and is going to be replaced ' 'with circusctl module.' ) if watcher and pid...
[ "def", "stats", "(", "watcher", "=", "None", ",", "pid", "=", "None", ")", ":", "salt", ".", "utils", ".", "warn_until", "(", "'Oxygen'", ",", "'circus module is deprecated and is going to be replaced '", "'with circusctl module.'", ")", "if", "watcher", "and", "p...
https://github.com/saltstack/salt-contrib/blob/062355938ad1cced273056e9c23dc344c6a2c858/modules/circus.py#L83-L120
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pandas/core/dtypes/common.py
python
_get_dtype_from_object
(dtype)
return _get_dtype_from_object(np.dtype(dtype))
Get a numpy dtype.type-style object for a dtype object. This methods also includes handling of the datetime64[ns] and datetime64[ns, TZ] objects. If no dtype can be found, we return ``object``. Parameters ---------- dtype : dtype, type The dtype object whose numpy dtype.type-style ...
Get a numpy dtype.type-style object for a dtype object.
[ "Get", "a", "numpy", "dtype", ".", "type", "-", "style", "object", "for", "a", "dtype", "object", "." ]
def _get_dtype_from_object(dtype): """ Get a numpy dtype.type-style object for a dtype object. This methods also includes handling of the datetime64[ns] and datetime64[ns, TZ] objects. If no dtype can be found, we return ``object``. Parameters ---------- dtype : dtype, type Th...
[ "def", "_get_dtype_from_object", "(", "dtype", ")", ":", "if", "isinstance", "(", "dtype", ",", "type", ")", "and", "issubclass", "(", "dtype", ",", "np", ".", "generic", ")", ":", "# Type object from a dtype", "return", "dtype", "elif", "is_categorical", "(",...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/dtypes/common.py#L1763-L1817
marcusva/py-sdl2
d549fc58de7aa204a119dc8dedef81b3cc888fb9
sdl2/sdlimage.py
python
IMG_isSVG
(src)
return _funcs["IMG_isSVG"](src)
Tests whether a file object contains an SVG image. .. note:: This function is only available in SDL_image 2.0.2 or later. Args: src (:obj:`SDL_RWops`): The file object to check. Returns: int: 1 if SVGs are supported and file is a valid SVG, otherwise 0.
Tests whether a file object contains an SVG image.
[ "Tests", "whether", "a", "file", "object", "contains", "an", "SVG", "image", "." ]
def IMG_isSVG(src): """Tests whether a file object contains an SVG image. .. note:: This function is only available in SDL_image 2.0.2 or later. Args: src (:obj:`SDL_RWops`): The file object to check. Returns: int: 1 if SVGs are supported and file is a valid SVG, otherwise 0. """...
[ "def", "IMG_isSVG", "(", "src", ")", ":", "return", "_funcs", "[", "\"IMG_isSVG\"", "]", "(", "src", ")" ]
https://github.com/marcusva/py-sdl2/blob/d549fc58de7aa204a119dc8dedef81b3cc888fb9/sdl2/sdlimage.py#L488-L500
kbandla/ImmunityDebugger
2abc03fb15c8f3ed0914e1175c4d8933977c73e3
1.73/Libs/libregisters.py
python
GFlags.Print
(self)
return ret
Print all the current setted GFlags @rtype: LIST OF TUPLES @return: A list of a tuple with two elements: Shortcut Name and flag information
Print all the current setted GFlags
[ "Print", "all", "the", "current", "setted", "GFlags" ]
def Print(self): """ Print all the current setted GFlags @rtype: LIST OF TUPLES @return: A list of a tuple with two elements: Shortcut Name and flag information """ current = self._query() ret = [] for a in GFlagsRef.keys(): r = GFla...
[ "def", "Print", "(", "self", ")", ":", "current", "=", "self", ".", "_query", "(", ")", "ret", "=", "[", "]", "for", "a", "in", "GFlagsRef", ".", "keys", "(", ")", ":", "r", "=", "GFlagsRef", "[", "a", "]", "if", "r", "[", "1", "]", "&", "c...
https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.73/Libs/libregisters.py#L177-L190
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/core/code_generator.py
python
CodeGenerator.insert_python_block
(self, pydata, trim=True)
Insert the compiled code for a Python Module ast or string.
Insert the compiled code for a Python Module ast or string.
[ "Insert", "the", "compiled", "code", "for", "a", "Python", "Module", "ast", "or", "string", "." ]
def insert_python_block(self, pydata, trim=True): """ Insert the compiled code for a Python Module ast or string. """ if PY310: _inspector = _ReturnNoneIdentifier() _inspector.visit(pydata) code = compile(pydata, self.filename, mode='exec') bc_code = bc.B...
[ "def", "insert_python_block", "(", "self", ",", "pydata", ",", "trim", "=", "True", ")", ":", "if", "PY310", ":", "_inspector", "=", "_ReturnNoneIdentifier", "(", ")", "_inspector", ".", "visit", "(", "pydata", ")", "code", "=", "compile", "(", "pydata", ...
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/core/code_generator.py#L458-L497
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/inject/thirdparty/oset/_abc.py
python
MutableSet.clear
(self)
This is slow (creates N new iterators!) but effective.
This is slow (creates N new iterators!) but effective.
[ "This", "is", "slow", "(", "creates", "N", "new", "iterators!", ")", "but", "effective", "." ]
def clear(self): """This is slow (creates N new iterators!) but effective.""" try: while True: self.pop() except KeyError: pass
[ "def", "clear", "(", "self", ")", ":", "try", ":", "while", "True", ":", "self", ".", "pop", "(", ")", "except", "KeyError", ":", "pass" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/thirdparty/oset/_abc.py#L373-L379
python-telegram-bot/python-telegram-bot
ade1529986f5b6d394a65372d6a27045a70725b2
telegram/ext/commandhandler.py
python
PrefixHandler.prefix
(self)
return self._prefix
The prefixes that will precede :attr:`command`. Returns: List[:obj:`str`]
The prefixes that will precede :attr:`command`.
[ "The", "prefixes", "that", "will", "precede", ":", "attr", ":", "command", "." ]
def prefix(self) -> List[str]: """ The prefixes that will precede :attr:`command`. Returns: List[:obj:`str`] """ return self._prefix
[ "def", "prefix", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "self", ".", "_prefix" ]
https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/ext/commandhandler.py#L395-L402
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/contourcarpet/_colorbar.py
python
ColorBar.ticks
(self)
return self["ticks"]
Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the following enumeration values: ...
Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the following enumeration values: ...
[ "Determines", "whether", "ticks", "are", "drawn", "or", "not", ".", "If", "this", "axis", "ticks", "are", "not", "drawn", ".", "If", "outside", "(", "inside", ")", "this", "axis", "are", "drawn", "outside", "(", "inside", ")", "the", "axis", "lines", "...
def ticks(self): """ Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the follo...
[ "def", "ticks", "(", "self", ")", ":", "return", "self", "[", "\"ticks\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/contourcarpet/_colorbar.py#L996-L1010
openbmc/openbmc
5f4109adae05f4d6925bfe960007d52f98c61086
poky/bitbake/lib/pyinotify.py
python
WatchManager.watch_transient_file
(self, filename, mask, proc_class)
return self.add_watch(dirname, mask, proc_fun=proc_class(ChainIfTrue(func=cmp_name)), rec=False, auto_add=False, do_glob=False, exclude_filter=lambda path: False)
Watch a transient file, which will be created and deleted frequently over time (e.g. pid file). @attention: Currently under the call to this function it is not possible to correctly watch the events triggered into the same base directory than the directory where is located this watched ...
Watch a transient file, which will be created and deleted frequently over time (e.g. pid file).
[ "Watch", "a", "transient", "file", "which", "will", "be", "created", "and", "deleted", "frequently", "over", "time", "(", "e", ".", "g", ".", "pid", "file", ")", "." ]
def watch_transient_file(self, filename, mask, proc_class): """ Watch a transient file, which will be created and deleted frequently over time (e.g. pid file). @attention: Currently under the call to this function it is not possible to correctly watch the events triggered into t...
[ "def", "watch_transient_file", "(", "self", ",", "filename", ",", "mask", ",", "proc_class", ")", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "filename", ")", "if", "dirname", "==", "''", ":", "return", "{", "}", "# Maintains coherence wit...
https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/bitbake/lib/pyinotify.py#L2125-L2164
mcedit/mcedit2
4bb98da521447b6cf43d923cea9f00acf2f427e9
src/mcedit2/util/showprogress.py
python
showProgress
(text, *tasks, **kwargs)
Show a progress dialog for the given task(s). Each task should be an iterable, yielding progress info as (current, max) or (current, max, statusString) tuples. Return the last value yielded by the task. :param text: :type text: :param iter: :type iter: :param cancel: :type cancel: :...
Show a progress dialog for the given task(s). Each task should be an iterable, yielding progress info as (current, max) or (current, max, statusString) tuples. Return the last value yielded by the task.
[ "Show", "a", "progress", "dialog", "for", "the", "given", "task", "(", "s", ")", ".", "Each", "task", "should", "be", "an", "iterable", "yielding", "progress", "info", "as", "(", "current", "max", ")", "or", "(", "current", "max", "statusString", ")", ...
def showProgress(text, *tasks, **kwargs): """ Show a progress dialog for the given task(s). Each task should be an iterable, yielding progress info as (current, max) or (current, max, statusString) tuples. Return the last value yielded by the task. :param text: :type text: :param iter: ...
[ "def", "showProgress", "(", "text", ",", "*", "tasks", ",", "*", "*", "kwargs", ")", ":", "global", "_progressBarActive", "if", "_progressBarActive", ":", "for", "task", "in", "tasks", ":", "exhaust", "(", "task", ")", "return", "progress", "=", "None", ...
https://github.com/mcedit/mcedit2/blob/4bb98da521447b6cf43d923cea9f00acf2f427e9/src/mcedit2/util/showprogress.py#L38-L112
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tdid/v20210519/models.py
python
CreateSelectiveCredentialRequest.__init__
(self)
r""" :param FunctionArg: 参数集合 :type FunctionArg: :class:`tencentcloud.tdid.v20210519.models.VerifyFunctionArg` :param PolicyId: 批露策略id :type PolicyId: int
r""" :param FunctionArg: 参数集合 :type FunctionArg: :class:`tencentcloud.tdid.v20210519.models.VerifyFunctionArg` :param PolicyId: 批露策略id :type PolicyId: int
[ "r", ":", "param", "FunctionArg", ":", "参数集合", ":", "type", "FunctionArg", ":", ":", "class", ":", "tencentcloud", ".", "tdid", ".", "v20210519", ".", "models", ".", "VerifyFunctionArg", ":", "param", "PolicyId", ":", "批露策略id", ":", "type", "PolicyId", ":"...
def __init__(self): r""" :param FunctionArg: 参数集合 :type FunctionArg: :class:`tencentcloud.tdid.v20210519.models.VerifyFunctionArg` :param PolicyId: 批露策略id :type PolicyId: int """ self.FunctionArg = None self.PolicyId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "FunctionArg", "=", "None", "self", ".", "PolicyId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tdid/v20210519/models.py#L83-L91
FederatedAI/FATE
32540492623568ecd1afcb367360133616e02fa3
python/federatedml/util/data_io.py
python
SparseFeatureReader.fit
(self, input_data)
return data_instance
[]
def fit(self, input_data): get_max_fid = functools.partial(self.get_max_feature_index, delimitor=self.delimitor) max_feature = input_data.mapValues(get_max_fid).reduce(lambda max_fid1, max_fid2: max(max_fid1, max_fid2)) if max_feature == -1: raise ValueError("no feature value in inp...
[ "def", "fit", "(", "self", ",", "input_data", ")", ":", "get_max_fid", "=", "functools", ".", "partial", "(", "self", ".", "get_max_feature_index", ",", "delimitor", "=", "self", ".", "delimitor", ")", "max_feature", "=", "input_data", ".", "mapValues", "(",...
https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/util/data_io.py#L437-L447
kujason/avod
b2d32f6ddd5007c12afe37760fbcff993816da39
avod/core/evaluator_utils.py
python
save_predictions_in_kitti_format
(model, checkpoint_name, data_split, score_threshold, global_step)
Converts a set of network predictions into text files required for KITTI evaluation.
Converts a set of network predictions into text files required for KITTI evaluation.
[ "Converts", "a", "set", "of", "network", "predictions", "into", "text", "files", "required", "for", "KITTI", "evaluation", "." ]
def save_predictions_in_kitti_format(model, checkpoint_name, data_split, score_threshold, global_step): """ Converts a set of network predictions into text files requir...
[ "def", "save_predictions_in_kitti_format", "(", "model", ",", "checkpoint_name", ",", "data_split", ",", "score_threshold", ",", "global_step", ")", ":", "dataset", "=", "model", ".", "dataset", "# Round this because protobuf encodes default values as full decimal", "score_th...
https://github.com/kujason/avod/blob/b2d32f6ddd5007c12afe37760fbcff993816da39/avod/core/evaluator_utils.py#L18-L180
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/repl/interface_magic.py
python
InterfaceMagic.line_magic_factory
(self)
return line_magic
Factory for line magic OUTPUT: A function suitable to be used as line magic. EXAMPLES:: sage: from sage.repl.interface_magic import InterfaceMagic sage: line_magic = InterfaceMagic.find('gap').line_magic_factory() sage: output = line_magic('1+1') ...
Factory for line magic
[ "Factory", "for", "line", "magic" ]
def line_magic_factory(self): """ Factory for line magic OUTPUT: A function suitable to be used as line magic. EXAMPLES:: sage: from sage.repl.interface_magic import InterfaceMagic sage: line_magic = InterfaceMagic.find('gap').line_magic_factory() ...
[ "def", "line_magic_factory", "(", "self", ")", ":", "terminal", "=", "get_display_manager", "(", ")", ".", "is_in_terminal", "(", ")", "def", "line_magic", "(", "line", ")", ":", "if", "line", ":", "return", "self", ".", "_interface", "(", "line", ")", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/repl/interface_magic.py#L189-L231
XanaduAI/strawberryfields
298601e409528f22c6717c2d816ab68ae8bda1fa
strawberryfields/backends/fockbackend/ops.py
python
kerr
(kappa, trunc)
return ret
r""" The Kerr interaction :math:`K(\kappa)`.
r""" The Kerr interaction :math:`K(\kappa)`.
[ "r", "The", "Kerr", "interaction", ":", "math", ":", "K", "(", "\\", "kappa", ")", "." ]
def kerr(kappa, trunc): r""" The Kerr interaction :math:`K(\kappa)`. """ n = np.arange(trunc) ret = np.diag(np.exp(1j * kappa * n ** 2)) return ret
[ "def", "kerr", "(", "kappa", ",", "trunc", ")", ":", "n", "=", "np", ".", "arange", "(", "trunc", ")", "ret", "=", "np", ".", "diag", "(", "np", ".", "exp", "(", "1j", "*", "kappa", "*", "n", "**", "2", ")", ")", "return", "ret" ]
https://github.com/XanaduAI/strawberryfields/blob/298601e409528f22c6717c2d816ab68ae8bda1fa/strawberryfields/backends/fockbackend/ops.py#L275-L281
lfz/Guided-Denoise
8881ab768d16eaf87342da4ff7dc8271e183e205
Attackset/Iter8_ensv3_resv2_inresv2_random/nets/inception_v4.py
python
block_reduction_a
(inputs, scope=None, reuse=None)
Builds Reduction-A block for Inception v4 network.
Builds Reduction-A block for Inception v4 network.
[ "Builds", "Reduction", "-", "A", "block", "for", "Inception", "v4", "network", "." ]
def block_reduction_a(inputs, scope=None, reuse=None): """Builds Reduction-A block for Inception v4 network.""" # By default use stride=1 and SAME padding with slim.arg_scope([slim.conv2d, slim.avg_pool2d, slim.max_pool2d], stride=1, padding='SAME'): with tf.variable_scope(scope, 'BlockR...
[ "def", "block_reduction_a", "(", "inputs", ",", "scope", "=", "None", ",", "reuse", "=", "None", ")", ":", "# By default use stride=1 and SAME padding", "with", "slim", ".", "arg_scope", "(", "[", "slim", ".", "conv2d", ",", "slim", ".", "avg_pool2d", ",", "...
https://github.com/lfz/Guided-Denoise/blob/8881ab768d16eaf87342da4ff7dc8271e183e205/Attackset/Iter8_ensv3_resv2_inresv2_random/nets/inception_v4.py#L55-L72
wrye-bash/wrye-bash
d495c47cfdb44475befa523438a40c4419cb386f
Mopy/bash/bolt.py
python
Log.writeFooter
(self)
Write mess. Abstract/null version.
Write mess. Abstract/null version.
[ "Write", "mess", ".", "Abstract", "/", "null", "version", "." ]
def writeFooter(self): """Write mess. Abstract/null version.""" pass
[ "def", "writeFooter", "(", "self", ")", ":", "pass" ]
https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/bolt.py#L1838-L1840
ClusterLabs/pcs
1f225199e02c8d20456bb386f4c913c3ff21ac78
pcs/cluster.py
python
authkey_corosync
(lib, argv, modifiers)
Options: * --force - skip check for authkey length * --request-timeout - timeout for HTTP requests * --skip-offline - skip unreachable nodes
Options: * --force - skip check for authkey length * --request-timeout - timeout for HTTP requests * --skip-offline - skip unreachable nodes
[ "Options", ":", "*", "--", "force", "-", "skip", "check", "for", "authkey", "length", "*", "--", "request", "-", "timeout", "-", "timeout", "for", "HTTP", "requests", "*", "--", "skip", "-", "offline", "-", "skip", "unreachable", "nodes" ]
def authkey_corosync(lib, argv, modifiers): """ Options: * --force - skip check for authkey length * --request-timeout - timeout for HTTP requests * --skip-offline - skip unreachable nodes """ modifiers.ensure_only_supported( "--force", "--skip-offline", "--request-timeout" ...
[ "def", "authkey_corosync", "(", "lib", ",", "argv", ",", "modifiers", ")", ":", "modifiers", ".", "ensure_only_supported", "(", "\"--force\"", ",", "\"--skip-offline\"", ",", "\"--request-timeout\"", ")", "if", "len", "(", "argv", ")", ">", "1", ":", "raise", ...
https://github.com/ClusterLabs/pcs/blob/1f225199e02c8d20456bb386f4c913c3ff21ac78/pcs/cluster.py#L170-L201
openstack/ironic
b392dc19bcd29cef5a69ec00d2f18a7a19a679e5
ironic/conductor/steps.py
python
_get_deployment_templates
(task)
return deploy_template.DeployTemplate.list_by_names(task.context, instance_traits)
Get deployment templates for task.node. Return deployment templates where the name of the deployment template matches one of the node's instance traits (the subset of the node's traits requested by the user via a flavor or image). :param task: A TaskManager object :returns: a list of DeployTemplat...
Get deployment templates for task.node.
[ "Get", "deployment", "templates", "for", "task", ".", "node", "." ]
def _get_deployment_templates(task): """Get deployment templates for task.node. Return deployment templates where the name of the deployment template matches one of the node's instance traits (the subset of the node's traits requested by the user via a flavor or image). :param task: A TaskManager ...
[ "def", "_get_deployment_templates", "(", "task", ")", ":", "node", "=", "task", ".", "node", "if", "not", "node", ".", "instance_info", ".", "get", "(", "'traits'", ")", ":", "return", "[", "]", "instance_traits", "=", "node", ".", "instance_info", "[", ...
https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/conductor/steps.py#L299-L314
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
pypy/module/_socket/interp_func.py
python
inet_pton
(space, family, ip)
return space.newbytes(buf)
inet_pton(family, ip) -> packed IP address string Convert an IP address from string format to a packed string suitable for use with low-level network functions.
inet_pton(family, ip) -> packed IP address string
[ "inet_pton", "(", "family", "ip", ")", "-", ">", "packed", "IP", "address", "string" ]
def inet_pton(space, family, ip): """inet_pton(family, ip) -> packed IP address string Convert an IP address from string format to a packed string suitable for use with low-level network functions. """ try: buf = rsocket.inet_pton(family, ip) except SocketError as e: raise conve...
[ "def", "inet_pton", "(", "space", ",", "family", ",", "ip", ")", ":", "try", ":", "buf", "=", "rsocket", ".", "inet_pton", "(", "family", ",", "ip", ")", "except", "SocketError", "as", "e", ":", "raise", "converted_error", "(", "space", ",", "e", ")"...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/module/_socket/interp_func.py#L246-L256
RasaHQ/rasa-sdk
231c200d24574bb5908074df6c59f2acaa152606
rasa_sdk/knowledge_base/actions.py
python
ActionQueryKnowledgeBase.run
( self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: "DomainDict", )
return []
Executes this action. If the user ask a question about an attribute, the knowledge base is queried for that attribute. Otherwise, if no attribute was detected in the request or the user is talking about a new object type, multiple objects of the requested type are returned from the knowl...
Executes this action. If the user ask a question about an attribute, the knowledge base is queried for that attribute. Otherwise, if no attribute was detected in the request or the user is talking about a new object type, multiple objects of the requested type are returned from the knowl...
[ "Executes", "this", "action", ".", "If", "the", "user", "ask", "a", "question", "about", "an", "attribute", "the", "knowledge", "base", "is", "queried", "for", "that", "attribute", ".", "Otherwise", "if", "no", "attribute", "was", "detected", "in", "the", ...
async def run( self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: "DomainDict", ) -> List[Dict[Text, Any]]: """ Executes this action. If the user ask a question about an attribute, the knowledge base is queried for that attribute. Otherwise, if ...
[ "async", "def", "run", "(", "self", ",", "dispatcher", ":", "CollectingDispatcher", ",", "tracker", ":", "Tracker", ",", "domain", ":", "\"DomainDict\"", ",", ")", "->", "List", "[", "Dict", "[", "Text", ",", "Any", "]", "]", ":", "object_type", "=", "...
https://github.com/RasaHQ/rasa-sdk/blob/231c200d24574bb5908074df6c59f2acaa152606/rasa_sdk/knowledge_base/actions.py#L103-L144
aws/aws-parallelcluster
f1fe5679a01c524e7ea904c329bd6d17318c6cd9
cli/src/pcluster/api/models/dryrun_operation_exception_response_content.py
python
DryrunOperationExceptionResponseContent.validation_messages
(self)
return self._validation_messages
Gets the validation_messages of this DryrunOperationExceptionResponseContent. List of messages collected during cluster config validation whose level is lower than the 'validationFailureLevel' set by the user. # noqa: E501 :return: The validation_messages of this DryrunOperationExceptionResponseConte...
Gets the validation_messages of this DryrunOperationExceptionResponseContent.
[ "Gets", "the", "validation_messages", "of", "this", "DryrunOperationExceptionResponseContent", "." ]
def validation_messages(self): """Gets the validation_messages of this DryrunOperationExceptionResponseContent. List of messages collected during cluster config validation whose level is lower than the 'validationFailureLevel' set by the user. # noqa: E501 :return: The validation_messages of ...
[ "def", "validation_messages", "(", "self", ")", ":", "return", "self", ".", "_validation_messages" ]
https://github.com/aws/aws-parallelcluster/blob/f1fe5679a01c524e7ea904c329bd6d17318c6cd9/cli/src/pcluster/api/models/dryrun_operation_exception_response_content.py#L65-L73
rferrazz/pyqt4topyqt5
c0630e1a3e1e2884d8c56127812c35854dbdf301
pyqt4topyqt5/__init__.py
python
PyQt4ToPyQt5.fix_signal
(self, lines)
clean decorator arguments
clean decorator arguments
[ "clean", "decorator", "arguments" ]
def fix_signal(self, lines): """ clean decorator arguments """ for idx, line in enumerate(lines): if '@pyqtSignal' in line: line = self.clean_signal_args(line) line = line.replace("'str'", "str").replace('"str"', 'str') lines[idx] =...
[ "def", "fix_signal", "(", "self", ",", "lines", ")", ":", "for", "idx", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "if", "'@pyqtSignal'", "in", "line", ":", "line", "=", "self", ".", "clean_signal_args", "(", "line", ")", "line", "=", "l...
https://github.com/rferrazz/pyqt4topyqt5/blob/c0630e1a3e1e2884d8c56127812c35854dbdf301/pyqt4topyqt5/__init__.py#L756-L764
xMistt/fortnitepy-bot
407a4fa9cf37e61533054389dea355335bcdb2a7
partybot/party.py
python
PartyCommands.echo
(self, ctx: fortnitepy.ext.commands.Context, *, content: str)
[]
async def echo(self, ctx: fortnitepy.ext.commands.Context, *, content: str) -> None: await self.bot.party.send(content) await ctx.send('Sent message to party chat.')
[ "async", "def", "echo", "(", "self", ",", "ctx", ":", "fortnitepy", ".", "ext", ".", "commands", ".", "Context", ",", "*", ",", "content", ":", "str", ")", "->", "None", ":", "await", "self", ".", "bot", ".", "party", ".", "send", "(", "content", ...
https://github.com/xMistt/fortnitepy-bot/blob/407a4fa9cf37e61533054389dea355335bcdb2a7/partybot/party.py#L141-L143
plasticityai/magnitude
7ac0baeaf181263b661c3ae00643d21e3fd90216
pymagnitude/third_party/_pysqlite/__init__.py
python
MagnitudeUtils.to_categorical
(y, num_classes=None)
return categorical
Converts a class vector (integers) to binary class matrix.
Converts a class vector (integers) to binary class matrix.
[ "Converts", "a", "class", "vector", "(", "integers", ")", "to", "binary", "class", "matrix", "." ]
def to_categorical(y, num_classes=None): """Converts a class vector (integers) to binary class matrix. """ y = np.array(y, dtype='int') input_shape = y.shape if input_shape and input_shape[-1] == 1 and len(input_shape) > 1: input_shape = tuple(input_shape[:-1]) ...
[ "def", "to_categorical", "(", "y", ",", "num_classes", "=", "None", ")", ":", "y", "=", "np", ".", "array", "(", "y", ",", "dtype", "=", "'int'", ")", "input_shape", "=", "y", ".", "shape", "if", "input_shape", "and", "input_shape", "[", "-", "1", ...
https://github.com/plasticityai/magnitude/blob/7ac0baeaf181263b661c3ae00643d21e3fd90216/pymagnitude/third_party/_pysqlite/__init__.py#L1594-L1609
SweetyTian/efficientdet
f7c1051ba46a01b3c4aac97b15e238714e0e4055
backbones/geffnet/mobilenetv3.py
python
_gen_mobilenet_v3_rw
(variant, channel_multiplier=1.0, pretrained=False, **kwargs)
return model
Creates a MobileNet-V3 model (RW variant). Paper: https://arxiv.org/abs/1905.02244 This was my first attempt at reproducing the MobileNet-V3 from paper alone. It came close to the eventual Tensorflow reference impl but has a few differences: 1. This model has no bias on the head convolution 2. Thi...
Creates a MobileNet-V3 model (RW variant).
[ "Creates", "a", "MobileNet", "-", "V3", "model", "(", "RW", "variant", ")", "." ]
def _gen_mobilenet_v3_rw(variant, channel_multiplier=1.0, pretrained=False, **kwargs): """Creates a MobileNet-V3 model (RW variant). Paper: https://arxiv.org/abs/1905.02244 This was my first attempt at reproducing the MobileNet-V3 from paper alone. It came close to the eventual Tensorflow reference im...
[ "def", "_gen_mobilenet_v3_rw", "(", "variant", ",", "channel_multiplier", "=", "1.0", ",", "pretrained", "=", "False", ",", "*", "*", "kwargs", ")", ":", "arch_def", "=", "[", "# stage 0, 112x112 in", "[", "'ds_r1_k3_s1_e1_c16_nre_noskip'", "]", ",", "# relu", "...
https://github.com/SweetyTian/efficientdet/blob/f7c1051ba46a01b3c4aac97b15e238714e0e4055/backbones/geffnet/mobilenetv3.py#L118-L163
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/userreports/reports/factory.py
python
ReportOrderByFactory.from_spec
(cls, spec)
return OrderBySpec.wrap(spec)
[]
def from_spec(cls, spec): return OrderBySpec.wrap(spec)
[ "def", "from_spec", "(", "cls", ",", "spec", ")", ":", "return", "OrderBySpec", ".", "wrap", "(", "spec", ")" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/userreports/reports/factory.py#L151-L152
spacetx/starfish
0e879d995d5c49b6f5a842e201e3be04c91afc7e
starfish/core/intensity_table/intensity_table.py
python
IntensityTable.get_log
(self)
Deserialize and return a list of pipeline components that have been applied throughout a starfish session to create this :py:class:IntensityTable:.
Deserialize and return a list of pipeline components that have been applied throughout a starfish session to create this :py:class:IntensityTable:.
[ "Deserialize", "and", "return", "a", "list", "of", "pipeline", "components", "that", "have", "been", "applied", "throughout", "a", "starfish", "session", "to", "create", "this", ":", "py", ":", "class", ":", "IntensityTable", ":", "." ]
def get_log(self): """ Deserialize and return a list of pipeline components that have been applied throughout a starfish session to create this :py:class:IntensityTable:. """ if STARFISH_EXTRAS_KEY in self.attrs and LOG in self.attrs[STARFISH_EXTRAS_KEY]: return load...
[ "def", "get_log", "(", "self", ")", ":", "if", "STARFISH_EXTRAS_KEY", "in", "self", ".", "attrs", "and", "LOG", "in", "self", ".", "attrs", "[", "STARFISH_EXTRAS_KEY", "]", ":", "return", "loads", "(", "self", ".", "attrs", "[", "STARFISH_EXTRAS_KEY", "]",...
https://github.com/spacetx/starfish/blob/0e879d995d5c49b6f5a842e201e3be04c91afc7e/starfish/core/intensity_table/intensity_table.py#L200-L209
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/xmpp/client.py
python
Client.connect
(self,server=None,proxy=None,secure=None,use_srv=True)
return self.connected
Connect to jabber server. If you want to specify different ip/port to connect to you can pass it as tuple as first parameter. If there is HTTP proxy between you and server specify it's address and credentials (if needed) in the second argument. If you want ssl/tls support to be disc...
Connect to jabber server. If you want to specify different ip/port to connect to you can pass it as tuple as first parameter. If there is HTTP proxy between you and server specify it's address and credentials (if needed) in the second argument. If you want ssl/tls support to be disc...
[ "Connect", "to", "jabber", "server", ".", "If", "you", "want", "to", "specify", "different", "ip", "/", "port", "to", "connect", "to", "you", "can", "pass", "it", "as", "tuple", "as", "first", "parameter", ".", "If", "there", "is", "HTTP", "proxy", "be...
def connect(self,server=None,proxy=None,secure=None,use_srv=True): """ Connect to jabber server. If you want to specify different ip/port to connect to you can pass it as tuple as first parameter. If there is HTTP proxy between you and server specify it's address and credentials (if nee...
[ "def", "connect", "(", "self", ",", "server", "=", "None", ",", "proxy", "=", "None", ",", "secure", "=", "None", ",", "use_srv", "=", "True", ")", ":", "if", "not", "CommonClient", ".", "connect", "(", "self", ",", "server", ",", "proxy", ",", "se...
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/xmpp/client.py#L191-L208
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/utils/dbserialize.py
python
pack_session
(item)
return None
Handle the safe serializion of Sessions objects (these contain hidden references to database objects (accounts, puppets) so they can't be safely serialized). Args: item (Session)): This item must have all properties of a session before entering this call. Returns: packed (t...
Handle the safe serializion of Sessions objects (these contain hidden references to database objects (accounts, puppets) so they can't be safely serialized).
[ "Handle", "the", "safe", "serializion", "of", "Sessions", "objects", "(", "these", "contain", "hidden", "references", "to", "database", "objects", "(", "accounts", "puppets", ")", "so", "they", "can", "t", "be", "safely", "serialized", ")", "." ]
def pack_session(item): """ Handle the safe serializion of Sessions objects (these contain hidden references to database objects (accounts, puppets) so they can't be safely serialized). Args: item (Session)): This item must have all properties of a session before entering this c...
[ "def", "pack_session", "(", "item", ")", ":", "_init_globals", "(", ")", "session", "=", "_SESSION_HANDLER", ".", "get", "(", "item", ".", "sessid", ")", "if", "session", "and", "session", ".", "conn_time", "==", "item", ".", "conn_time", ":", "# we requir...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/utils/dbserialize.py#L497-L524
cool-RR/python_toolbox
cb9ef64b48f1d03275484d707dc5079b6701ad0c
python_toolbox/temp_value_setting/temp_value_setter.py
python
TempValueSetter.__init__
(self, variable, value, assert_no_fiddling=True)
Construct the `TempValueSetter`. `variable` may be either an `(object, attribute_string)`, a `(dict, key)` pair, or a `(getter, setter)` pair. `value` is the temporary value to set to the variable.
Construct the `TempValueSetter`.
[ "Construct", "the", "TempValueSetter", "." ]
def __init__(self, variable, value, assert_no_fiddling=True): ''' Construct the `TempValueSetter`. `variable` may be either an `(object, attribute_string)`, a `(dict, key)` pair, or a `(getter, setter)` pair. `value` is the temporary value to set to the variable. ''' ...
[ "def", "__init__", "(", "self", ",", "variable", ",", "value", ",", "assert_no_fiddling", "=", "True", ")", ":", "self", ".", "assert_no_fiddling", "=", "assert_no_fiddling", "#######################################################################", "# We let the user input e...
https://github.com/cool-RR/python_toolbox/blob/cb9ef64b48f1d03275484d707dc5079b6701ad0c/python_toolbox/temp_value_setting/temp_value_setter.py#L29-L99
radlab/sparrow
afb8efadeb88524f1394d1abe4ea66c6fd2ac744
deploy/third_party/boto-2.1.1/boto/s3/bucket.py
python
Bucket.set_key_class
(self, key_class)
Set the Key class associated with this bucket. By default, this would be the boto.s3.key.Key class but if you want to subclass that for some reason this allows you to associate your new class with a bucket so that when you call bucket.new_key() or when you get a listing of keys in the b...
Set the Key class associated with this bucket. By default, this would be the boto.s3.key.Key class but if you want to subclass that for some reason this allows you to associate your new class with a bucket so that when you call bucket.new_key() or when you get a listing of keys in the b...
[ "Set", "the", "Key", "class", "associated", "with", "this", "bucket", ".", "By", "default", "this", "would", "be", "the", "boto", ".", "s3", ".", "key", ".", "Key", "class", "but", "if", "you", "want", "to", "subclass", "that", "for", "some", "reason",...
def set_key_class(self, key_class): """ Set the Key class associated with this bucket. By default, this would be the boto.s3.key.Key class but if you want to subclass that for some reason this allows you to associate your new class with a bucket so that when you call bucket.new_...
[ "def", "set_key_class", "(", "self", ",", "key_class", ")", ":", "self", ".", "key_class", "=", "key_class" ]
https://github.com/radlab/sparrow/blob/afb8efadeb88524f1394d1abe4ea66c6fd2ac744/deploy/third_party/boto-2.1.1/boto/s3/bucket.py#L121-L133
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
var/spack/repos/builtin/packages/libsigsegv/package.py
python
Libsigsegv._run_build_tests
(self)
Run selected build tests.
Run selected build tests.
[ "Run", "selected", "build", "tests", "." ]
def _run_build_tests(self): """Run selected build tests.""" passed = 'Test passed' checks = { 'sigsegv1': [passed], 'sigsegv2': [passed], 'sigsegv3': ['caught', passed], 'stackoverflow1': ['recursion', 'Stack overflow', passed], 'stacko...
[ "def", "_run_build_tests", "(", "self", ")", ":", "passed", "=", "'Test passed'", "checks", "=", "{", "'sigsegv1'", ":", "[", "passed", "]", ",", "'sigsegv2'", ":", "[", "passed", "]", ",", "'sigsegv3'", ":", "[", "'caught'", ",", "passed", "]", ",", "...
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/var/spack/repos/builtin/packages/libsigsegv/package.py#L55-L69
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/grep/wsdl_greper.py
python
wsdl_greper.analyze_disco
(self, request, response)
[]
def analyze_disco(self, request, response): for disco_string in self._disco_strings: if disco_string in response: desc = ('The URL: "%s" is a DISCO file that contains' ' references to WSDL URLs.') desc %= response.get_url() i = ...
[ "def", "analyze_disco", "(", "self", ",", "request", ",", "response", ")", ":", "for", "disco_string", "in", "self", ".", "_disco_strings", ":", "if", "disco_string", "in", "response", ":", "desc", "=", "(", "'The URL: \"%s\" is a DISCO file that contains'", "' re...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/grep/wsdl_greper.py#L78-L90
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/services/rest/newsapi/newsapi.py
python
NewsAPI.associated_press
(api_key, max_articles, sort, reverse)
return NewsAPI._get_data(NewsAPI.ASSOCIATED_PRESS, api_key, max_articles, sort, reverse)
[]
def associated_press(api_key, max_articles, sort, reverse): return NewsAPI._get_data(NewsAPI.ASSOCIATED_PRESS, api_key, max_articles, sort, reverse)
[ "def", "associated_press", "(", "api_key", ",", "max_articles", ",", "sort", ",", "reverse", ")", ":", "return", "NewsAPI", ".", "_get_data", "(", "NewsAPI", ".", "ASSOCIATED_PRESS", ",", "api_key", ",", "max_articles", ",", "sort", ",", "reverse", ")" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/services/rest/newsapi/newsapi.py#L284-L285
allegroai/clearml
5953dc6eefadcdfcc2bdbb6a0da32be58823a5af
clearml/automation/optimization.py
python
HyperParameterOptimizer.is_active
(self)
return self._stop_event is None or self._thread is not None
Is the optimization procedure active (still running) The values are: - ``True`` - The optimization procedure is active (still running). - ``False`` - The optimization procedure is not active (not still running). .. note:: If the daemon thread has not yet started, ``is_acti...
Is the optimization procedure active (still running)
[ "Is", "the", "optimization", "procedure", "active", "(", "still", "running", ")" ]
def is_active(self): # type: () -> bool """ Is the optimization procedure active (still running) The values are: - ``True`` - The optimization procedure is active (still running). - ``False`` - The optimization procedure is not active (not still running). .. no...
[ "def", "is_active", "(", "self", ")", ":", "# type: () -> bool", "return", "self", ".", "_stop_event", "is", "None", "or", "self", ".", "_thread", "is", "not", "None" ]
https://github.com/allegroai/clearml/blob/5953dc6eefadcdfcc2bdbb6a0da32be58823a5af/clearml/automation/optimization.py#L1368-L1383
anitagraser/movingpandas
b171436f8e868f40e7a6dc611167f4de7dd66b10
movingpandas/trajectory.py
python
Trajectory.add_distance
(self, overwrite=False)
Add distance column and values to the trajectory's DataFrame. Distance is calculated as CRS units, except if the CRS is geographic (e.g. EPSG:4326 WGS84) then distance is calculated in meters. Parameters ---------- overwrite : bool Whether to overwrite existing dist...
Add distance column and values to the trajectory's DataFrame.
[ "Add", "distance", "column", "and", "values", "to", "the", "trajectory", "s", "DataFrame", "." ]
def add_distance(self, overwrite=False): """ Add distance column and values to the trajectory's DataFrame. Distance is calculated as CRS units, except if the CRS is geographic (e.g. EPSG:4326 WGS84) then distance is calculated in meters. Parameters ---------- ov...
[ "def", "add_distance", "(", "self", ",", "overwrite", "=", "False", ")", ":", "if", "DISTANCE_COL_NAME", "in", "self", ".", "df", ".", "columns", "and", "not", "overwrite", ":", "raise", "RuntimeError", "(", "\"Trajectory already has distance values! \"", "\"Use o...
https://github.com/anitagraser/movingpandas/blob/b171436f8e868f40e7a6dc611167f4de7dd66b10/movingpandas/trajectory.py#L762-L779
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/platform.py
python
_mac_ver_gestalt
()
return release,versioninfo,machine
Thanks to Mark R. Levinson for mailing documentation links and code examples for this function. Documentation for the gestalt() API is available online at: http://www.rgaros.nl/gestalt/
Thanks to Mark R. Levinson for mailing documentation links and code examples for this function. Documentation for the gestalt() API is available online at:
[ "Thanks", "to", "Mark", "R", ".", "Levinson", "for", "mailing", "documentation", "links", "and", "code", "examples", "for", "this", "function", ".", "Documentation", "for", "the", "gestalt", "()", "API", "is", "available", "online", "at", ":" ]
def _mac_ver_gestalt(): """ Thanks to Mark R. Levinson for mailing documentation links and code examples for this function. Documentation for the gestalt() API is available online at: http://www.rgaros.nl/gestalt/ """ # Check whether the version info module is available ...
[ "def", "_mac_ver_gestalt", "(", ")", ":", "# Check whether the version info module is available", "try", ":", "import", "gestalt", "import", "MacOS", "except", "ImportError", ":", "return", "None", "# Get the infos", "sysv", ",", "sysa", "=", "_mac_ver_lookup", "(", "...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/platform.py#L734-L773
makinacorpus/django-screamshot
bfa15b6acd7325ba959977001ab6445ce8090686
screamshot/models.py
python
OverwriteStorage.get_available_name
(self, name)
return name
Returns a filename that's free on the target storage system, and available for new content to be written to. -> https://djangosnippets.org/snippets/976/
Returns a filename that's free on the target storage system, and available for new content to be written to. -> https://djangosnippets.org/snippets/976/
[ "Returns", "a", "filename", "that", "s", "free", "on", "the", "target", "storage", "system", "and", "available", "for", "new", "content", "to", "be", "written", "to", ".", "-", ">", "https", ":", "//", "djangosnippets", ".", "org", "/", "snippets", "/", ...
def get_available_name(self, name): """ Returns a filename that's free on the target storage system, and available for new content to be written to. -> https://djangosnippets.org/snippets/976/ """ # If the filename already exists, # remove it as if it was a true f...
[ "def", "get_available_name", "(", "self", ",", "name", ")", ":", "# If the filename already exists,", "# remove it as if it was a true file system", "if", "self", ".", "exists", "(", "name", ")", ":", "self", ".", "delete", "(", "name", ")", "return", "name" ]
https://github.com/makinacorpus/django-screamshot/blob/bfa15b6acd7325ba959977001ab6445ce8090686/screamshot/models.py#L30-L40
olist/correios
5494d7457665fa9a8dffbffa976cdbd2885c54e4
correios/renderers/pdf.py
python
PDF.__init__
(self, page_size)
[]
def __init__(self, page_size): self._file = BytesIO() self.canvas = Canvas(self._file, pagesize=page_size) self._saved = False
[ "def", "__init__", "(", "self", ",", "page_size", ")", ":", "self", ".", "_file", "=", "BytesIO", "(", ")", "self", ".", "canvas", "=", "Canvas", "(", "self", ".", "_file", ",", "pagesize", "=", "page_size", ")", "self", ".", "_saved", "=", "False" ]
https://github.com/olist/correios/blob/5494d7457665fa9a8dffbffa976cdbd2885c54e4/correios/renderers/pdf.py#L38-L41
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/plat-sunos5/IN.py
python
FTFLW_HASH
(h)
return (((unsigned)(h))%ftflw_hash_sz)
[]
def FTFLW_HASH(h): return (((unsigned)(h))%ftflw_hash_sz)
[ "def", "FTFLW_HASH", "(", "h", ")", ":", "return", "(", "(", "(", "unsigned", ")", "(", "h", ")", ")", "%", "ftflw_hash_sz", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-sunos5/IN.py#L1102-L1102
jason9693/MusicTransformer-tensorflow2.0
f7c06c0cb2e9cdddcbf6db779cb39cd650282778
utils.py
python
weights2boards
(weights, dir, step)
[]
def weights2boards(weights, dir, step): # weights stored weight[layer][w1,w2] for weight in weights: w1, w2 = weight tf.summary.histogram() pass
[ "def", "weights2boards", "(", "weights", ",", "dir", ",", "step", ")", ":", "# weights stored weight[layer][w1,w2]", "for", "weight", "in", "weights", ":", "w1", ",", "w2", "=", "weight", "tf", ".", "summary", ".", "histogram", "(", ")", "pass" ]
https://github.com/jason9693/MusicTransformer-tensorflow2.0/blob/f7c06c0cb2e9cdddcbf6db779cb39cd650282778/utils.py#L149-L153
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/ServiceNow/Integrations/ServiceNowv2/ServiceNowv2.py
python
query_groups_command
(client: Client, args: dict)
return human_readable, entry_context, result, False
Query groups. Args: client: Client object with request. args: Usually demisto.args() Returns: Demisto Outputs.
Query groups.
[ "Query", "groups", "." ]
def query_groups_command(client: Client, args: dict) -> Tuple[Any, Dict[Any, Any], Dict[Any, Any], bool]: """Query groups. Args: client: Client object with request. args: Usually demisto.args() Returns: Demisto Outputs. """ table_name = 'sys_user_group' group_id = args....
[ "def", "query_groups_command", "(", "client", ":", "Client", ",", "args", ":", "dict", ")", "->", "Tuple", "[", "Any", ",", "Dict", "[", "Any", ",", "Any", "]", ",", "Dict", "[", "Any", ",", "Any", "]", ",", "bool", "]", ":", "table_name", "=", "...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/ServiceNow/Integrations/ServiceNowv2/ServiceNowv2.py#L1639-L1689
openstack/cinder
23494a6d6c51451688191e1847a458f1d3cdcaa5
cinder/api/v2/limits.py
python
WsgiLimiterProxy.__init__
(self, limiter_address)
Initialize the new `WsgiLimiterProxy`. @param limiter_address: IP/port combination of where to request limit
Initialize the new `WsgiLimiterProxy`.
[ "Initialize", "the", "new", "WsgiLimiterProxy", "." ]
def __init__(self, limiter_address): """Initialize the new `WsgiLimiterProxy`. @param limiter_address: IP/port combination of where to request limit """ self.limiter_address = limiter_address
[ "def", "__init__", "(", "self", ",", "limiter_address", ")", ":", "self", ".", "limiter_address", "=", "limiter_address" ]
https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/api/v2/limits.py#L399-L404
Textualize/rich
d39626143036188cb2c9e1619e836540f5b627f8
rich/console.py
python
detect_legacy_windows
()
return WINDOWS and not get_windows_console_features().vt
Detect legacy Windows.
Detect legacy Windows.
[ "Detect", "legacy", "Windows", "." ]
def detect_legacy_windows() -> bool: """Detect legacy Windows.""" return WINDOWS and not get_windows_console_features().vt
[ "def", "detect_legacy_windows", "(", ")", "->", "bool", ":", "return", "WINDOWS", "and", "not", "get_windows_console_features", "(", ")", ".", "vt" ]
https://github.com/Textualize/rich/blob/d39626143036188cb2c9e1619e836540f5b627f8/rich/console.py#L569-L571
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/chunk/regexp.py
python
StripRule.__repr__
(self)
return "<StripRule: " + repr(self._pattern) + ">"
Return a string representation of this rule. It has the form:: <StripRule: '<IN|VB.*>'> Note that this representation does not include the description string; that string can be accessed separately with the ``descr()`` method. :rtype: str
Return a string representation of this rule. It has the form::
[ "Return", "a", "string", "representation", "of", "this", "rule", ".", "It", "has", "the", "form", "::" ]
def __repr__(self): """ Return a string representation of this rule. It has the form:: <StripRule: '<IN|VB.*>'> Note that this representation does not include the description string; that string can be accessed separately with the ``descr()`` method. :rtyp...
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"<StripRule: \"", "+", "repr", "(", "self", ".", "_pattern", ")", "+", "\">\"" ]
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/chunk/regexp.py#L471-L483
wbond/packagecontrol.io
9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20
app/lib/package_control/deps/oscrypto/_openssl/asymmetric.py
python
dsa_sign
(private_key, data, hash_algorithm)
return _sign(private_key, data, hash_algorithm)
Generates a DSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "md5", "sha1", "sha224", "sha256", "sha384" or "sha512" :raises: ValueErr...
Generates a DSA signature
[ "Generates", "a", "DSA", "signature" ]
def dsa_sign(private_key, data, hash_algorithm): """ Generates a DSA signature :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "md5", "sha1", "sha224", ...
[ "def", "dsa_sign", "(", "private_key", ",", "data", ",", "hash_algorithm", ")", ":", "if", "private_key", ".", "algorithm", "!=", "'dsa'", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n The key specified is not a DSA private key, but %s\n ...
https://github.com/wbond/packagecontrol.io/blob/9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20/app/lib/package_control/deps/oscrypto/_openssl/asymmetric.py#L1533-L1563
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/cinder/cinder/api/v2/types.py
python
VolumeTypesController.index
(self, req)
return self._view_builder.index(req, vol_types)
Returns the list of volume types.
Returns the list of volume types.
[ "Returns", "the", "list", "of", "volume", "types", "." ]
def index(self, req): """Returns the list of volume types.""" context = req.environ['cinder.context'] vol_types = volume_types.get_all_types(context).values() return self._view_builder.index(req, vol_types)
[ "def", "index", "(", "self", ",", "req", ")", ":", "context", "=", "req", ".", "environ", "[", "'cinder.context'", "]", "vol_types", "=", "volume_types", ".", "get_all_types", "(", "context", ")", ".", "values", "(", ")", "return", "self", ".", "_view_bu...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/api/v2/types.py#L58-L62
cupy/cupy
a47ad3105f0fe817a4957de87d98ddccb8c7491f
cupy/_manipulation/rearrange.py
python
rot90
(a, k=1, axes=(0, 1))
Rotate an array by 90 degrees in the plane specified by axes. Note that ``axes`` argument has been introduced since NumPy v1.12. The contents of this document is the same as the original one. Args: a (~cupy.ndarray): Array of two or more dimensions. k (int): Number of times the array is ro...
Rotate an array by 90 degrees in the plane specified by axes.
[ "Rotate", "an", "array", "by", "90", "degrees", "in", "the", "plane", "specified", "by", "axes", "." ]
def rot90(a, k=1, axes=(0, 1)): """Rotate an array by 90 degrees in the plane specified by axes. Note that ``axes`` argument has been introduced since NumPy v1.12. The contents of this document is the same as the original one. Args: a (~cupy.ndarray): Array of two or more dimensions. k...
[ "def", "rot90", "(", "a", ",", "k", "=", "1", ",", "axes", "=", "(", "0", ",", "1", ")", ")", ":", "a_ndim", "=", "a", ".", "ndim", "if", "a_ndim", "<", "2", ":", "raise", "ValueError", "(", "'Input must be >= 2-d'", ")", "axes", "=", "tuple", ...
https://github.com/cupy/cupy/blob/a47ad3105f0fe817a4957de87d98ddccb8c7491f/cupy/_manipulation/rearrange.py#L148-L191
zatosource/zato
2a9d273f06f9d776fbfeb53e73855af6e40fa208
code/zato-server/src/zato/server/service/__init__.py
python
Service.after_cron_style_job
(self, _zato_no_op_marker=zato_no_op_marker)
Invoked if the service has been defined as a cron-style job's invocation target.
Invoked if the service has been defined as a cron-style job's invocation target.
[ "Invoked", "if", "the", "service", "has", "been", "defined", "as", "a", "cron", "-", "style", "job", "s", "invocation", "target", "." ]
def after_cron_style_job(self, _zato_no_op_marker=zato_no_op_marker): """ Invoked if the service has been defined as a cron-style job's invocation target. """
[ "def", "after_cron_style_job", "(", "self", ",", "_zato_no_op_marker", "=", "zato_no_op_marker", ")", ":" ]
https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/zato-server/src/zato/server/service/__init__.py#L1213-L1216
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/boto/opsworks/layer1.py
python
OpsWorksConnection.attach_elastic_load_balancer
(self, elastic_load_balancer_name, layer_id)
return self.make_request(action='AttachElasticLoadBalancer', body=json.dumps(params))
Attaches an Elastic Load Balancing load balancer to a specified layer. For more information, see `Elastic Load Balancing`_. You must create the Elastic Load Balancing instance separately, by using the Elastic Load Balancing console, API, or CLI. For more information, see ` Elas...
Attaches an Elastic Load Balancing load balancer to a specified layer. For more information, see `Elastic Load Balancing`_.
[ "Attaches", "an", "Elastic", "Load", "Balancing", "load", "balancer", "to", "a", "specified", "layer", ".", "For", "more", "information", "see", "Elastic", "Load", "Balancing", "_", "." ]
def attach_elastic_load_balancer(self, elastic_load_balancer_name, layer_id): """ Attaches an Elastic Load Balancing load balancer to a specified layer. For more information, see `Elastic Load Balancing`_. You must create the Elastic Load Ba...
[ "def", "attach_elastic_load_balancer", "(", "self", ",", "elastic_load_balancer_name", ",", "layer_id", ")", ":", "params", "=", "{", "'ElasticLoadBalancerName'", ":", "elastic_load_balancer_name", ",", "'LayerId'", ":", "layer_id", ",", "}", "return", "self", ".", ...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/opsworks/layer1.py#L188-L222
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/email/_parseaddr.py
python
AddrlistClass.getdelimited
(self, beginchar, endchars, allowcomments=True)
return EMPTYSTRING.join(slist)
Parse a header fragment delimited by special characters. `beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. `endchars' is a sequence of allowable end-delimiting characters. Parsin...
Parse a header fragment delimited by special characters.
[ "Parse", "a", "header", "fragment", "delimited", "by", "special", "characters", "." ]
def getdelimited(self, beginchar, endchars, allowcomments=True): """Parse a header fragment delimited by special characters. `beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. `en...
[ "def", "getdelimited", "(", "self", ",", "beginchar", ",", "endchars", ",", "allowcomments", "=", "True", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "!=", "beginchar", ":", "return", "''", "slist", "=", "[", "''", "]", "quote...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/email/_parseaddr.py#L412-L447
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/click/core.py
python
Parameter.process_value
(self, ctx: Context, value: t.Any)
return value
[]
def process_value(self, ctx: Context, value: t.Any) -> t.Any: value = self.type_cast_value(ctx, value) if self.required and self.value_is_missing(value): raise MissingParameter(ctx=ctx, param=self) if self.callback is not None: value = self.callback(ctx, self, value) ...
[ "def", "process_value", "(", "self", ",", "ctx", ":", "Context", ",", "value", ":", "t", ".", "Any", ")", "->", "t", ".", "Any", ":", "value", "=", "self", ".", "type_cast_value", "(", "ctx", ",", "value", ")", "if", "self", ".", "required", "and",...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/click/core.py#L2302-L2311
ahkab/ahkab
1e8939194b689909b8184ce7eba478b485ff9e3a
ahkab/switch.py
python
vswitch_model._set_status
(self, is_on)
Set the switch status, which meeans setting the effective switching voltage self.V (w hyst taken into account)
Set the switch status, which meeans setting the effective switching voltage self.V (w hyst taken into account)
[ "Set", "the", "switch", "status", "which", "meeans", "setting", "the", "effective", "switching", "voltage", "self", ".", "V", "(", "w", "hyst", "taken", "into", "account", ")" ]
def _set_status(self, is_on): """Set the switch status, which meeans setting the effective switching voltage self.V (w hyst taken into account) """ self.V = self.VT + self.VH * 2 * (not is_on) - self.VH
[ "def", "_set_status", "(", "self", ",", "is_on", ")", ":", "self", ".", "V", "=", "self", ".", "VT", "+", "self", ".", "VH", "*", "2", "*", "(", "not", "is_on", ")", "-", "self", ".", "VH" ]
https://github.com/ahkab/ahkab/blob/1e8939194b689909b8184ce7eba478b485ff9e3a/ahkab/switch.py#L336-L340
timkpaine/pyEX
254acd2b0cf7cb7183100106f4ecc11d1860c46a
pyEX/premium/wallstreethorizon/__init__.py
python
capitalMarketsDayWallStreetHorizon
(symbol="", **kwargs)
return _base( id="PREMIUM_WALLSTREETHORIZON_CAPITAL_MARKETS_DAY", symbol=symbol, **kwargs )
This is a meeting where company executives provide information about the company’s performance and its future prospects. https://iexcloud.io/docs/api/#capital-markets-day Args: symbol (str): symbol to use
This is a meeting where company executives provide information about the company’s performance and its future prospects. https://iexcloud.io/docs/api/#capital-markets-day
[ "This", "is", "a", "meeting", "where", "company", "executives", "provide", "information", "about", "the", "company’s", "performance", "and", "its", "future", "prospects", ".", "https", ":", "//", "iexcloud", ".", "io", "/", "docs", "/", "api", "/", "#capital...
def capitalMarketsDayWallStreetHorizon(symbol="", **kwargs): """This is a meeting where company executives provide information about the company’s performance and its future prospects. https://iexcloud.io/docs/api/#capital-markets-day Args: symbol (str): symbol to use """ return _base( ...
[ "def", "capitalMarketsDayWallStreetHorizon", "(", "symbol", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "return", "_base", "(", "id", "=", "\"PREMIUM_WALLSTREETHORIZON_CAPITAL_MARKETS_DAY\"", ",", "symbol", "=", "symbol", ",", "*", "*", "kwargs", ")" ]
https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/premium/wallstreethorizon/__init__.py#L133-L142
aploium/zmirror
f3db3048f83d1ea1bf06a94df312dd30d54b96d3
zmirror/zmirror.py
python
generate_error_page
(errormsg='Unknown Error', error_code=500, is_traceback=False, content_only=False)
:type content_only: bool :type errormsg: Union(str, bytes) :type error_code: int :type is_traceback: bool :rtype: Union[Response, str]
[]
def generate_error_page(errormsg='Unknown Error', error_code=500, is_traceback=False, content_only=False): """ :type content_only: bool :type errormsg: Union(str, bytes) :type error_code: int :type is_traceback: bool :rtype: Union[Response, str] """ if is_traceback: traceback.pr...
[ "def", "generate_error_page", "(", "errormsg", "=", "'Unknown Error'", ",", "error_code", "=", "500", ",", "is_traceback", "=", "False", ",", "content_only", "=", "False", ")", ":", "if", "is_traceback", ":", "traceback", ".", "print_exc", "(", ")", "errprint"...
https://github.com/aploium/zmirror/blob/f3db3048f83d1ea1bf06a94df312dd30d54b96d3/zmirror/zmirror.py#L826-L900
domlysz/BlenderGIS
0c00bc361d05599467174b8721d4cfeb4c3db608
core/lib/imageio/core/util.py
python
has_module
(module_name)
Check to see if a python module is available.
Check to see if a python module is available.
[ "Check", "to", "see", "if", "a", "python", "module", "is", "available", "." ]
def has_module(module_name): """Check to see if a python module is available. """ if sys.version_info > (3, ): import importlib return importlib.find_loader(module_name) is not None else: # pragma: no cover import imp try: imp.find_module(module_name) ...
[ "def", "has_module", "(", "module_name", ")", ":", "if", "sys", ".", "version_info", ">", "(", "3", ",", ")", ":", "import", "importlib", "return", "importlib", ".", "find_loader", "(", "module_name", ")", "is", "not", "None", "else", ":", "# pragma: no co...
https://github.com/domlysz/BlenderGIS/blob/0c00bc361d05599467174b8721d4cfeb4c3db608/core/lib/imageio/core/util.py#L534-L546
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/wsgiref/util.py
python
shift_path_info
(environ)
return name
Shift a name from PATH_INFO to SCRIPT_NAME, returning it If there are no remaining path segments in PATH_INFO, return None. Note: 'environ' is modified in-place; use a copy if you need to keep the original PATH_INFO or SCRIPT_NAME. Note: when PATH_INFO is just a '/', this returns '' and appends a trai...
Shift a name from PATH_INFO to SCRIPT_NAME, returning it
[ "Shift", "a", "name", "from", "PATH_INFO", "to", "SCRIPT_NAME", "returning", "it" ]
def shift_path_info(environ): """Shift a name from PATH_INFO to SCRIPT_NAME, returning it If there are no remaining path segments in PATH_INFO, return None. Note: 'environ' is modified in-place; use a copy if you need to keep the original PATH_INFO or SCRIPT_NAME. Note: when PATH_INFO is just a '/...
[ "def", "shift_path_info", "(", "environ", ")", ":", "path_info", "=", "environ", ".", "get", "(", "'PATH_INFO'", ",", "''", ")", "if", "not", "path_info", ":", "return", "None", "path_parts", "=", "path_info", ".", "split", "(", "'/'", ")", "path_parts", ...
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/wsgiref/util.py#L76-L115
google/macops
8442745359c0c941cd4e4e7d243e43bd16b40dec
gmacpyutil/gmacpyutil/profiles.py
python
Profile.__str__
(self)
return self.Get(PAYLOADKEYS_DISPLAYNAME)
[]
def __str__(self): return self.Get(PAYLOADKEYS_DISPLAYNAME)
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "Get", "(", "PAYLOADKEYS_DISPLAYNAME", ")" ]
https://github.com/google/macops/blob/8442745359c0c941cd4e4e7d243e43bd16b40dec/gmacpyutil/gmacpyutil/profiles.py#L103-L104
cleverhans-lab/cleverhans
e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d
cleverhans_v3.1.0/cleverhans/attack_bundling.py
python
bundle_attacks_with_goal
( sess, model, x, y, adv_x, attack_configs, run_counts, goal, report, report_path, attack_batch_size=BATCH_SIZE, eval_batch_size=BATCH_SIZE, )
Runs attack bundling, working on one specific AttackGoal. This function is mostly intended to be called by `bundle_attacks`. Reference: https://openreview.net/forum?id=H1g0piA9tQ :param sess: tf.session.Session :param model: cleverhans.model.Model :param x: numpy array containing clean example inp...
Runs attack bundling, working on one specific AttackGoal. This function is mostly intended to be called by `bundle_attacks`.
[ "Runs", "attack", "bundling", "working", "on", "one", "specific", "AttackGoal", ".", "This", "function", "is", "mostly", "intended", "to", "be", "called", "by", "bundle_attacks", "." ]
def bundle_attacks_with_goal( sess, model, x, y, adv_x, attack_configs, run_counts, goal, report, report_path, attack_batch_size=BATCH_SIZE, eval_batch_size=BATCH_SIZE, ): """ Runs attack bundling, working on one specific AttackGoal. This function is mostly in...
[ "def", "bundle_attacks_with_goal", "(", "sess", ",", "model", ",", "x", ",", "y", ",", "adv_x", ",", "attack_configs", ",", "run_counts", ",", "goal", ",", "report", ",", "report_path", ",", "attack_batch_size", "=", "BATCH_SIZE", ",", "eval_batch_size", "=", ...
https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans_v3.1.0/cleverhans/attack_bundling.py#L461-L521
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/widgets/action.py
python
ActionButtons.__init__
(self, context, parent=None)
[]
def __init__(self, context, parent=None): QFlowLayoutWidget.__init__(self, parent) layout = self.layout() self.context = context self.stage_button = tooltip_button(N_('Stage'), layout) self.unstage_button = tooltip_button(N_('Unstage'), layout) self.refresh_button = toolt...
[ "def", "__init__", "(", "self", ",", "context", ",", "parent", "=", "None", ")", ":", "QFlowLayoutWidget", ".", "__init__", "(", "self", ",", "parent", ")", "layout", "=", "self", ".", "layout", "(", ")", "self", ".", "context", "=", "context", "self",...
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/action.py#L56-L78
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/storage/stores/nosql/mongo/engine.py
python
MongoStorageEngine.linked_account_store
(self)
return MongoLinkedAccountStore(self)
[]
def linked_account_store(self): return MongoLinkedAccountStore(self)
[ "def", "linked_account_store", "(", "self", ")", ":", "return", "MongoLinkedAccountStore", "(", "self", ")" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/storage/stores/nosql/mongo/engine.py#L151-L152
learning511/cs224n-learning-camp
c01e2c55797b76910f5dbdd2efcb4f025a2cd753
assigments/assignment3/data_util.py
python
featurize
(embeddings, word)
return np.hstack((wv, fv))
Featurize a word given embeddings.
Featurize a word given embeddings.
[ "Featurize", "a", "word", "given", "embeddings", "." ]
def featurize(embeddings, word): """ Featurize a word given embeddings. """ case = casing(word) word = normalize(word) case_mapping = {c: one_hot(FDIM, i) for i, c in enumerate(CASES)} wv = embeddings.get(word, embeddings[UNK]) fv = case_mapping[case] return np.hstack((wv, fv))
[ "def", "featurize", "(", "embeddings", ",", "word", ")", ":", "case", "=", "casing", "(", "word", ")", "word", "=", "normalize", "(", "word", ")", "case_mapping", "=", "{", "c", ":", "one_hot", "(", "FDIM", ",", "i", ")", "for", "i", ",", "c", "i...
https://github.com/learning511/cs224n-learning-camp/blob/c01e2c55797b76910f5dbdd2efcb4f025a2cd753/assigments/assignment3/data_util.py#L45-L54
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/email/_policybase.py
python
Policy.fold_binary
(self, name, value)
Given the header name and the value from the model, return binary data containing linesep characters that implement the folding of the header according to the policy controls. The value passed in by the email package may contain surrogateescaped binary data.
Given the header name and the value from the model, return binary data containing linesep characters that implement the folding of the header according to the policy controls. The value passed in by the email package may contain surrogateescaped binary data.
[ "Given", "the", "header", "name", "and", "the", "value", "from", "the", "model", "return", "binary", "data", "containing", "linesep", "characters", "that", "implement", "the", "folding", "of", "the", "header", "according", "to", "the", "policy", "controls", "....
def fold_binary(self, name, value): """Given the header name and the value from the model, return binary data containing linesep characters that implement the folding of the header according to the policy controls. The value passed in by the email package may contain surrogateescaped bi...
[ "def", "fold_binary", "(", "self", ",", "name", ",", "value", ")", ":", "raise", "NotImplementedError" ]
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/email/_policybase.py#L257-L264
armooo/cloudprint
88b89726a4ddef841b39af6c1ca6dd23cba30422
cloudprint/cloudprint.py
python
CloudPrintAuth.refresh
(self)
[]
def refresh(self): token = requests.post( 'https://accounts.google.com/o/oauth2/token', data={ 'client_id': CLIENT_ID, 'client_secret': CLIENT_KEY, 'grant_type': 'refresh_token', 'refresh_token': self.refresh_token, ...
[ "def", "refresh", "(", "self", ")", ":", "token", "=", "requests", ".", "post", "(", "'https://accounts.google.com/o/oauth2/token'", ",", "data", "=", "{", "'client_id'", ":", "CLIENT_ID", ",", "'client_secret'", ":", "CLIENT_KEY", ",", "'grant_type'", ":", "'re...
https://github.com/armooo/cloudprint/blob/88b89726a4ddef841b39af6c1ca6dd23cba30422/cloudprint/cloudprint.py#L161-L175
roclark/sportsipy
c19f545d3376d62ded6304b137dc69238ac620a9
sportsipy/nhl/boxscore.py
python
Boxscores._get_boxscore_uri
(self, url)
return uri
Find the boxscore URI. Given the boxscore tag for a game, parse the embedded URI for the boxscore. Parameters ---------- url : PyQuery object A PyQuery object containing the game's boxscore tag which has the boxscore URI embedded within it. Retu...
Find the boxscore URI.
[ "Find", "the", "boxscore", "URI", "." ]
def _get_boxscore_uri(self, url): """ Find the boxscore URI. Given the boxscore tag for a game, parse the embedded URI for the boxscore. Parameters ---------- url : PyQuery object A PyQuery object containing the game's boxscore tag which has the ...
[ "def", "_get_boxscore_uri", "(", "self", ",", "url", ")", ":", "uri", "=", "re", ".", "sub", "(", "r'.*/boxscores/'", ",", "''", ",", "str", "(", "url", ")", ")", "uri", "=", "re", ".", "sub", "(", "r'\\.html.*'", ",", "''", ",", "uri", ")", ".",...
https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nhl/boxscore.py#L1217-L1238
blurstudio/cross3d
277968d1227de740fc87ef61005c75034420eadf
cross3d/softimage/softimagesceneobject.py
python
SoftimageSceneObject._setNativeParent
(self, nativeParent)
return True
\remarks implements the AbstractSceneObject._setNativeParent method to set the native parent for this object \sa parent, setParent, _nativeParent \param <PySoftimage.xsi.Object> nativeObject || None \return <bool> success
\remarks implements the AbstractSceneObject._setNativeParent method to set the native parent for this object \sa parent, setParent, _nativeParent \param <PySoftimage.xsi.Object> nativeObject || None \return <bool> success
[ "\\", "remarks", "implements", "the", "AbstractSceneObject", ".", "_setNativeParent", "method", "to", "set", "the", "native", "parent", "for", "this", "object", "\\", "sa", "parent", "setParent", "_nativeParent", "\\", "param", "<PySoftimage", ".", "xsi", ".", "...
def _setNativeParent(self, nativeParent): """ \remarks implements the AbstractSceneObject._setNativeParent method to set the native parent for this object \sa parent, setParent, _nativeParent \param <PySoftimage.xsi.Object> nativeObject || None \return <bool> success """ if nativeParent is None: ...
[ "def", "_setNativeParent", "(", "self", ",", "nativeParent", ")", ":", "if", "nativeParent", "is", "None", ":", "nativeParent", "=", "xsi", ".", "ActiveSceneRoot", "# Making sure the object is not already a child of the parent, otherwise Softimage throws an error", "if", "not...
https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/softimage/softimagesceneobject.py#L69-L82
isce-framework/isce2
0e5114a8bede3caf1d533d98e44dfe4b983e3f48
components/isceobj/RtcProc/runLooks.py
python
takeLooks
(inimg, alks, rlks)
return outfile
Take looks.
Take looks.
[ "Take", "looks", "." ]
def takeLooks(inimg, alks, rlks): ''' Take looks. ''' from mroipac.looks.Looks import Looks img = isceobj.createImage() img.load(inimg + '.xml') img.setAccessMode('READ') spl = os.path.splitext(inimg) ext = '.{0}alks_{1}rlks'.format(alks, rlks) outfile = spl[0] + ext + spl[1] ...
[ "def", "takeLooks", "(", "inimg", ",", "alks", ",", "rlks", ")", ":", "from", "mroipac", ".", "looks", ".", "Looks", "import", "Looks", "img", "=", "isceobj", ".", "createImage", "(", ")", "img", ".", "load", "(", "inimg", "+", "'.xml'", ")", "img", ...
https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/isceobj/RtcProc/runLooks.py#L17-L40
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/contrib/formtools/wizard/views.py
python
NamedUrlWizardView.get_initkwargs
(cls, *args, **kwargs)
return initkwargs
We require a url_name to reverse URLs later. Additionally users can pass a done_step_name to change the URL name of the "done" view.
We require a url_name to reverse URLs later. Additionally users can pass a done_step_name to change the URL name of the "done" view.
[ "We", "require", "a", "url_name", "to", "reverse", "URLs", "later", ".", "Additionally", "users", "can", "pass", "a", "done_step_name", "to", "change", "the", "URL", "name", "of", "the", "done", "view", "." ]
def get_initkwargs(cls, *args, **kwargs): """ We require a url_name to reverse URLs later. Additionally users can pass a done_step_name to change the URL name of the "done" view. """ assert 'url_name' in kwargs, 'URL name is needed to resolve correct wizard URLs' extra_kw...
[ "def", "get_initkwargs", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "assert", "'url_name'", "in", "kwargs", ",", "'URL name is needed to resolve correct wizard URLs'", "extra_kwargs", "=", "{", "'done_step_name'", ":", "kwargs", ".", "pop", ...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/formtools/wizard/views.py#L579-L594
sassoftware/saspy
47adeb5b9e298e6b9ec017f850245e318f2faa57
saspy/sasiocom.py
python
SASSessionCOM._asubmit
(self, code: str, results: str='html')
Submit any SAS code. Does not return a result. :param code [str]: SAS statements to execute.
Submit any SAS code. Does not return a result. :param code [str]: SAS statements to execute.
[ "Submit", "any", "SAS", "code", ".", "Does", "not", "return", "a", "result", ".", ":", "param", "code", "[", "str", "]", ":", "SAS", "statements", "to", "execute", "." ]
def _asubmit(self, code: str, results: str='html'): """ Submit any SAS code. Does not return a result. :param code [str]: SAS statements to execute. """ # Support html ods if results.lower() == 'html': ods_open = """ ods listing close; ...
[ "def", "_asubmit", "(", "self", ",", "code", ":", "str", ",", "results", ":", "str", "=", "'html'", ")", ":", "# Support html ods", "if", "results", ".", "lower", "(", ")", "==", "'html'", ":", "ods_open", "=", "\"\"\"\n ods listing close;\n ...
https://github.com/sassoftware/saspy/blob/47adeb5b9e298e6b9ec017f850245e318f2faa57/saspy/sasiocom.py#L435-L461
ApostropheEditor/Apostrophe
cc30858c15f3408296d73202497d3cdef5a46064
apostrophe/headerbars.py
python
PreviewHeaderbar.__init__
(self)
[]
def __init__(self): self.hb = Gtk.HeaderBar().new() self.hb.props.show_close_button = True self.hb_revealer = Gtk.Revealer(name="titlebar-revealer-pv") self.hb_revealer.add(self.hb) self.hb_revealer.props.transition_duration = 750 self.hb_revealer.set_transition_type( ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "hb", "=", "Gtk", ".", "HeaderBar", "(", ")", ".", "new", "(", ")", "self", ".", "hb", ".", "props", ".", "show_close_button", "=", "True", "self", ".", "hb_revealer", "=", "Gtk", ".", "Reveale...
https://github.com/ApostropheEditor/Apostrophe/blob/cc30858c15f3408296d73202497d3cdef5a46064/apostrophe/headerbars.py#L257-L274
sfu-db/dataprep
6dfb9c659e8bf73f07978ae195d0372495c6f118
dataprep/clean/clean_cr_cpf.py
python
validate_cr_cpf
( df: Union[str, pd.Series, dd.Series, pd.DataFrame, dd.DataFrame], column: str = "", )
return cpf.is_valid(df)
Validate if a data cell is CPF in a DataFrame column. For each cell, return True or False. Parameters ---------- df A pandas or Dask DataFrame containing the data to be validated. col The name of the column to be validated.
Validate if a data cell is CPF in a DataFrame column. For each cell, return True or False.
[ "Validate", "if", "a", "data", "cell", "is", "CPF", "in", "a", "DataFrame", "column", ".", "For", "each", "cell", "return", "True", "or", "False", "." ]
def validate_cr_cpf( df: Union[str, pd.Series, dd.Series, pd.DataFrame, dd.DataFrame], column: str = "", ) -> Union[bool, pd.Series, pd.DataFrame]: """ Validate if a data cell is CPF in a DataFrame column. For each cell, return True or False. Parameters ---------- df A pandas or...
[ "def", "validate_cr_cpf", "(", "df", ":", "Union", "[", "str", ",", "pd", ".", "Series", ",", "dd", ".", "Series", ",", "pd", ".", "DataFrame", ",", "dd", ".", "DataFrame", "]", ",", "column", ":", "str", "=", "\"\"", ",", ")", "->", "Union", "["...
https://github.com/sfu-db/dataprep/blob/6dfb9c659e8bf73f07978ae195d0372495c6f118/dataprep/clean/clean_cr_cpf.py#L108-L129
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/artist.py
python
Artist.set_visible
(self, b)
Set the artist's visibility. Parameters ---------- b : bool
Set the artist's visibility.
[ "Set", "the", "artist", "s", "visibility", "." ]
def set_visible(self, b): """ Set the artist's visibility. Parameters ---------- b : bool """ self._visible = b self.pchanged() self.stale = True
[ "def", "set_visible", "(", "self", ",", "b", ")", ":", "self", ".", "_visible", "=", "b", "self", ".", "pchanged", "(", ")", "self", ".", "stale", "=", "True" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/artist.py#L848-L858
hackingmaterials/atomate
bdca913591d22a6f71d4914c69f3ee191e2d96db
atomate/vasp/workflows/presets/core.py
python
wf_nudged_elastic_band
(structures, parent, c=None)
return wf
Nudged elastic band (NEB) workflow from the given structures and config dict. 'is_optimized' default False 'neb_round' default 1 Notes: Length of Structure list and "is_optimized" are used to determine the workflow: 1 structure # The parent structure & two endpoint indexes provided; nee...
Nudged elastic band (NEB) workflow from the given structures and config dict.
[ "Nudged", "elastic", "band", "(", "NEB", ")", "workflow", "from", "the", "given", "structures", "and", "config", "dict", "." ]
def wf_nudged_elastic_band(structures, parent, c=None): """ Nudged elastic band (NEB) workflow from the given structures and config dict. 'is_optimized' default False 'neb_round' default 1 Notes: Length of Structure list and "is_optimized" are used to determine the workflow: 1 stru...
[ "def", "wf_nudged_elastic_band", "(", "structures", ",", "parent", ",", "c", "=", "None", ")", ":", "if", "not", "(", "isinstance", "(", "structures", ",", "list", ")", "and", "len", "(", "structures", ")", ">", "0", ")", ":", "raise", "ValueError", "(...
https://github.com/hackingmaterials/atomate/blob/bdca913591d22a6f71d4914c69f3ee191e2d96db/atomate/vasp/workflows/presets/core.py#L719-L828
JelteF/PyLaTeX
1a73261b771ae15afbb3ca5f06d4ba61328f1c62
pylatex/headfoot.py
python
simple_page_number
()
return NoEscape(r'Page \thepage\ of \pageref{LastPage}')
Get a string containing commands to display the page number. Returns ------- str The latex string that displays the page number
Get a string containing commands to display the page number.
[ "Get", "a", "string", "containing", "commands", "to", "display", "the", "page", "number", "." ]
def simple_page_number(): """Get a string containing commands to display the page number. Returns ------- str The latex string that displays the page number """ return NoEscape(r'Page \thepage\ of \pageref{LastPage}')
[ "def", "simple_page_number", "(", ")", ":", "return", "NoEscape", "(", "r'Page \\thepage\\ of \\pageref{LastPage}'", ")" ]
https://github.com/JelteF/PyLaTeX/blob/1a73261b771ae15afbb3ca5f06d4ba61328f1c62/pylatex/headfoot.py#L70-L79
adamcaudill/EquationGroupLeak
52fa871c89008566c27159bd48f2a8641260c984
windows/fuzzbunch/pyreadline/modes/notemacs.py
python
NotEmacsMode.paste_mulitline_code
(self,e)
Paste windows clipboard
Paste windows clipboard
[ "Paste", "windows", "clipboard" ]
def paste_mulitline_code(self,e): '''Paste windows clipboard''' reg=re.compile("\r?\n") if self.enable_win32_clipboard: txt=clipboard.get_clipboard_text_and_convert(False) t=reg.split(txt) t=[row for row in t if row.strip()!=""] #remove empty lines...
[ "def", "paste_mulitline_code", "(", "self", ",", "e", ")", ":", "reg", "=", "re", ".", "compile", "(", "\"\\r?\\n\"", ")", "if", "self", ".", "enable_win32_clipboard", ":", "txt", "=", "clipboard", ".", "get_clipboard_text_and_convert", "(", "False", ")", "t...
https://github.com/adamcaudill/EquationGroupLeak/blob/52fa871c89008566c27159bd48f2a8641260c984/windows/fuzzbunch/pyreadline/modes/notemacs.py#L399-L413
keras-team/keras
5caa668b6a415675064a730f5eb46ecc08e40f65
keras/backend.py
python
int_shape
(x)
Returns the shape of tensor or variable as a tuple of int or None entries. Args: x: Tensor or variable. Returns: A tuple of integers (or None entries). Examples: >>> input = tf.keras.backend.placeholder(shape=(2, 4, 5)) >>> tf.keras.backend.int_shape(input) (2, 4, 5) >>> val = np.array([[1...
Returns the shape of tensor or variable as a tuple of int or None entries.
[ "Returns", "the", "shape", "of", "tensor", "or", "variable", "as", "a", "tuple", "of", "int", "or", "None", "entries", "." ]
def int_shape(x): """Returns the shape of tensor or variable as a tuple of int or None entries. Args: x: Tensor or variable. Returns: A tuple of integers (or None entries). Examples: >>> input = tf.keras.backend.placeholder(shape=(2, 4, 5)) >>> tf.keras.backend.int_shape(input) (2, 4, 5) ...
[ "def", "int_shape", "(", "x", ")", ":", "try", ":", "shape", "=", "x", ".", "shape", "if", "not", "isinstance", "(", "shape", ",", "tuple", ")", ":", "shape", "=", "tuple", "(", "shape", ".", "as_list", "(", ")", ")", "return", "shape", "except", ...
https://github.com/keras-team/keras/blob/5caa668b6a415675064a730f5eb46ecc08e40f65/keras/backend.py#L1449-L1475
koaning/scikit-lego
028597fd0ba9ac387b9faa6f06050a7ee05e6cba
sklego/meta/subjective_classifier.py
python
SubjectiveClassifier.predict
(self, X)
return self.classes_[self.predict_proba(X).argmax(axis=1)]
Returns predicted class, based on the provided data. :param X: array-like, shape=(n_columns, n_samples,) training data. :return: array, shape=(n_samples, n_classes) the predicted data
Returns predicted class, based on the provided data.
[ "Returns", "predicted", "class", "based", "on", "the", "provided", "data", "." ]
def predict(self, X): """ Returns predicted class, based on the provided data. :param X: array-like, shape=(n_columns, n_samples,) training data. :return: array, shape=(n_samples, n_classes) the predicted data """ check_is_fitted(self, ["posterior_matrix_"]) X = ...
[ "def", "predict", "(", "self", ",", "X", ")", ":", "check_is_fitted", "(", "self", ",", "[", "\"posterior_matrix_\"", "]", ")", "X", "=", "check_array", "(", "X", ",", "estimator", "=", "self", ",", "dtype", "=", "FLOAT_DTYPES", ")", "return", "self", ...
https://github.com/koaning/scikit-lego/blob/028597fd0ba9ac387b9faa6f06050a7ee05e6cba/sklego/meta/subjective_classifier.py#L148-L157
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/markupsafe/__init__.py
python
Markup.partition
(self, sep: str)
return cls(l), cls(s), cls(r)
[]
def partition(self, sep: str) -> t.Tuple["Markup", "Markup", "Markup"]: l, s, r = super().partition(self.escape(sep)) cls = self.__class__ return cls(l), cls(s), cls(r)
[ "def", "partition", "(", "self", ",", "sep", ":", "str", ")", "->", "t", ".", "Tuple", "[", "\"Markup\"", ",", "\"Markup\"", ",", "\"Markup\"", "]", ":", "l", ",", "s", ",", "r", "=", "super", "(", ")", ".", "partition", "(", "self", ".", "escape...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/markupsafe/__init__.py#L193-L196
openstack/tempest
fe0ac89a5a1c43fa908a76759cd99eea3b1f9853
tempest/lib/services/identity/v3/project_tags_client.py
python
ProjectTagsClient.check_project_tag_existence
(self, project_id, tag)
return rest_client.ResponseBody(resp, body)
Check if a project contains a tag.
Check if a project contains a tag.
[ "Check", "if", "a", "project", "contains", "a", "tag", "." ]
def check_project_tag_existence(self, project_id, tag): """Check if a project contains a tag.""" url = 'projects/%s/tags/%s' % (project_id, tag) resp, body = self.get(url) self.expected_success(204, resp.status) return rest_client.ResponseBody(resp, body)
[ "def", "check_project_tag_existence", "(", "self", ",", "project_id", ",", "tag", ")", ":", "url", "=", "'projects/%s/tags/%s'", "%", "(", "project_id", ",", "tag", ")", "resp", ",", "body", "=", "self", ".", "get", "(", "url", ")", "self", ".", "expecte...
https://github.com/openstack/tempest/blob/fe0ac89a5a1c43fa908a76759cd99eea3b1f9853/tempest/lib/services/identity/v3/project_tags_client.py#L62-L67
poppy-project/pypot
c5d384fe23eef9f6ec98467f6f76626cdf20afb9
pypot/server/httpserver.py
python
RunningPrimitivesListHandler.get
(self)
[]
def get(self): self.set_status(200) self.write_json({ "running_primitives": self.restful_robot.get_running_primitives_list() })
[ "def", "get", "(", "self", ")", ":", "self", ".", "set_status", "(", "200", ")", "self", ".", "write_json", "(", "{", "\"running_primitives\"", ":", "self", ".", "restful_robot", ".", "get_running_primitives_list", "(", ")", "}", ")" ]
https://github.com/poppy-project/pypot/blob/c5d384fe23eef9f6ec98467f6f76626cdf20afb9/pypot/server/httpserver.py#L738-L742
ztosec/hunter
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
SqlmapCelery/sqlmap/thirdparty/socks/socks.py
python
socksocket.get_proxy_sockname
(self)
return self.proxy_sockname
Returns the bound IP address and port number at the proxy.
Returns the bound IP address and port number at the proxy.
[ "Returns", "the", "bound", "IP", "address", "and", "port", "number", "at", "the", "proxy", "." ]
def get_proxy_sockname(self): """ Returns the bound IP address and port number at the proxy. """ return self.proxy_sockname
[ "def", "get_proxy_sockname", "(", "self", ")", ":", "return", "self", ".", "proxy_sockname" ]
https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/SqlmapCelery/sqlmap/thirdparty/socks/socks.py#L394-L398
nucypher/pyUmbral
b2abccafa6dc007fd4d3de60c83bc8f1a857e885
umbral/openssl.py
python
Curve._get_ec_order_by_group
(ec_group)
return ec_order
Returns the order of a given curve via its OpenSSL EC_GROUP.
Returns the order of a given curve via its OpenSSL EC_GROUP.
[ "Returns", "the", "order", "of", "a", "given", "curve", "via", "its", "OpenSSL", "EC_GROUP", "." ]
def _get_ec_order_by_group(ec_group): """ Returns the order of a given curve via its OpenSSL EC_GROUP. """ ec_order = _bn_new() with tmp_bn_ctx() as bn_ctx: res = BACKEND_LIB.EC_GROUP_get_order(ec_group, ec_order, bn_ctx) backend.openssl_assert(res == 1) ...
[ "def", "_get_ec_order_by_group", "(", "ec_group", ")", ":", "ec_order", "=", "_bn_new", "(", ")", "with", "tmp_bn_ctx", "(", ")", "as", "bn_ctx", ":", "res", "=", "BACKEND_LIB", ".", "EC_GROUP_get_order", "(", "ec_group", ",", "ec_order", ",", "bn_ctx", ")",...
https://github.com/nucypher/pyUmbral/blob/b2abccafa6dc007fd4d3de60c83bc8f1a857e885/umbral/openssl.py#L42-L50
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/cli/command.py
python
sync
( ctx, state, bare=False, user=False, unused=False, **kwargs )
Installs all packages specified in Pipfile.lock.
Installs all packages specified in Pipfile.lock.
[ "Installs", "all", "packages", "specified", "in", "Pipfile", ".", "lock", "." ]
def sync( ctx, state, bare=False, user=False, unused=False, **kwargs ): """Installs all packages specified in Pipfile.lock.""" from ..core import do_sync retcode = do_sync( state.project, dev=state.installstate.dev, three=state.three, python=state.pyt...
[ "def", "sync", "(", "ctx", ",", "state", ",", "bare", "=", "False", ",", "user", "=", "False", ",", "unused", "=", "False", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "core", "import", "do_sync", "retcode", "=", "do_sync", "(", "state", ...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/cli/command.py#L634-L660
dmbee/seglearn
746d6c4eb89a338e6366c5be59fb25d1af63477f
seglearn/transform.py
python
InterpLongToWide.fit
(self, X, y=None)
return self
Fit the transform. Does nothing, for compatibility with sklearn API. Parameters ---------- X : array-like, shape [n_series, ...] Time series data and (optionally) contextual data y : None There is no need of a target in a transformer, yet the pipeline API require...
Fit the transform. Does nothing, for compatibility with sklearn API.
[ "Fit", "the", "transform", ".", "Does", "nothing", "for", "compatibility", "with", "sklearn", "API", "." ]
def fit(self, X, y=None): """ Fit the transform. Does nothing, for compatibility with sklearn API. Parameters ---------- X : array-like, shape [n_series, ...] Time series data and (optionally) contextual data y : None There is no need of a target ...
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "self", ".", "_check_data", "(", "X", ")", "if", "not", "X", "[", "0", "]", ".", "ndim", ">=", "2", ":", "raise", "ValueError", "(", "\"X input must be 2 dim array or greater\"", "...
https://github.com/dmbee/seglearn/blob/746d6c4eb89a338e6366c5be59fb25d1af63477f/seglearn/transform.py#L827-L847
gitpython-developers/GitPython
fac603789d66c0fd7c26e75debb41b06136c5026
git/refs/reference.py
python
Reference.remote_head
(self)
return '/'.join(tokens[3:])
:return: Name of the remote head itself, i.e. master. :note: The returned name is usually not qualified enough to uniquely identify a branch
:return: Name of the remote head itself, i.e. master. :note: The returned name is usually not qualified enough to uniquely identify a branch
[ ":", "return", ":", "Name", "of", "the", "remote", "head", "itself", "i", ".", "e", ".", "master", ".", ":", "note", ":", "The", "returned", "name", "is", "usually", "not", "qualified", "enough", "to", "uniquely", "identify", "a", "branch" ]
def remote_head(self) -> str: """:return: Name of the remote head itself, i.e. master. :note: The returned name is usually not qualified enough to uniquely identify a branch""" tokens = self.path.split('/') return '/'.join(tokens[3:])
[ "def", "remote_head", "(", "self", ")", "->", "str", ":", "tokens", "=", "self", ".", "path", ".", "split", "(", "'/'", ")", "return", "'/'", ".", "join", "(", "tokens", "[", "3", ":", "]", ")" ]
https://github.com/gitpython-developers/GitPython/blob/fac603789d66c0fd7c26e75debb41b06136c5026/git/refs/reference.py#L134-L139
alvarobartt/investpy
59bd52be96deb755341832ec0a09e85134fc1ea7
investpy/currency_crosses.py
python
get_currency_cross_recent_data
( currency_cross, as_json=False, order="ascending", interval="Daily" )
This function retrieves recent historical data from the introduced `currency_cross` as indexed in Investing.com via Web Scraping. The resulting data can it either be stored in a :obj:`pandas.DataFrame` or in a :obj:`json` file, with `ascending` or `descending` order. Args: currency_cross (:obj:`str...
This function retrieves recent historical data from the introduced `currency_cross` as indexed in Investing.com via Web Scraping. The resulting data can it either be stored in a :obj:`pandas.DataFrame` or in a :obj:`json` file, with `ascending` or `descending` order.
[ "This", "function", "retrieves", "recent", "historical", "data", "from", "the", "introduced", "currency_cross", "as", "indexed", "in", "Investing", ".", "com", "via", "Web", "Scraping", ".", "The", "resulting", "data", "can", "it", "either", "be", "stored", "i...
def get_currency_cross_recent_data( currency_cross, as_json=False, order="ascending", interval="Daily" ): """ This function retrieves recent historical data from the introduced `currency_cross` as indexed in Investing.com via Web Scraping. The resulting data can it either be stored in a :obj:`pandas.Dat...
[ "def", "get_currency_cross_recent_data", "(", "currency_cross", ",", "as_json", "=", "False", ",", "order", "=", "\"ascending\"", ",", "interval", "=", "\"Daily\"", ")", ":", "if", "not", "currency_cross", ":", "raise", "ValueError", "(", "\"ERR#0052: currency_cross...
https://github.com/alvarobartt/investpy/blob/59bd52be96deb755341832ec0a09e85134fc1ea7/investpy/currency_crosses.py#L187-L427