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
statsmodels/statsmodels
debbe7ea6ba28fe5bdb78f09f8cac694bef98722
statsmodels/tsa/exponential_smoothing/ets.py
python
ETSModel._loglike_internal
( self, params, yhat, xhat, is_fixed=None, fixed_values=None, use_beta_star=False, use_gamma_star=False, )
return logL
Log-likelihood function to be called from fit to avoid reallocation of memory. Parameters ---------- params : np.ndarray of np.float Model parameters: (alpha, beta, gamma, phi, l[-1], b[-1], s[-1], ..., s[-m]). If there are no fixed values this must b...
Log-likelihood function to be called from fit to avoid reallocation of memory.
[ "Log", "-", "likelihood", "function", "to", "be", "called", "from", "fit", "to", "avoid", "reallocation", "of", "memory", "." ]
def _loglike_internal( self, params, yhat, xhat, is_fixed=None, fixed_values=None, use_beta_star=False, use_gamma_star=False, ): """ Log-likelihood function to be called from fit to avoid reallocation of memory. Paramet...
[ "def", "_loglike_internal", "(", "self", ",", "params", ",", "yhat", ",", "xhat", ",", "is_fixed", "=", "None", ",", "fixed_values", "=", "None", ",", "use_beta_star", "=", "False", ",", "use_gamma_star", "=", "False", ",", ")", ":", "if", "np", ".", "...
https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/tsa/exponential_smoothing/ets.py#L1102-L1170
KhronosGroup/NNEF-Tools
c913758ca687dab8cb7b49e8f1556819a2d0ca25
nnef_tools/io/tf/lite/flatbuffers/QuantizationParameters.py
python
QuantizationParametersAddScale
(builder, scale)
[]
def QuantizationParametersAddScale(builder, scale): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0)
[ "def", "QuantizationParametersAddScale", "(", "builder", ",", "scale", ")", ":", "builder", ".", "PrependUOffsetTRelativeSlot", "(", "2", ",", "flatbuffers", ".", "number_types", ".", "UOffsetTFlags", ".", "py_type", "(", "scale", ")", ",", "0", ")" ]
https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/io/tf/lite/flatbuffers/QuantizationParameters.py#L164-L164
gruns/furl
63b0bbeb40a8113862a61501cb12f9aad1f321e9
furl/furl.py
python
Fragment.asdict
(self)
return { 'encoded': str(self), 'separator': self.separator, 'path': self.path.asdict(), 'query': self.query.asdict(), }
[]
def asdict(self): return { 'encoded': str(self), 'separator': self.separator, 'path': self.path.asdict(), 'query': self.query.asdict(), }
[ "def", "asdict", "(", "self", ")", ":", "return", "{", "'encoded'", ":", "str", "(", "self", ")", ",", "'separator'", ":", "self", ".", "separator", ",", "'path'", ":", "self", ".", "path", ".", "asdict", "(", ")", ",", "'query'", ":", "self", ".",...
https://github.com/gruns/furl/blob/63b0bbeb40a8113862a61501cb12f9aad1f321e9/furl/furl.py#L1261-L1267
emesene/emesene
4548a4098310e21b16437bb36223a7f632a4f7bc
emesene/gui/gtkui/MainWindow.py
python
MainWindow.unsubscribe_signals
(self, close=None)
callback called when the disconnect option is selected
callback called when the disconnect option is selected
[ "callback", "called", "when", "the", "disconnect", "option", "is", "selected" ]
def unsubscribe_signals(self, close=None): '''callback called when the disconnect option is selected''' gui.MainWindowBase.unsubscribe_signals(self) self.menu.remove_subscriptions() self.contact_list.contact_selected.unsubscribe( self._on_contact_selected) self.conta...
[ "def", "unsubscribe_signals", "(", "self", ",", "close", "=", "None", ")", ":", "gui", ".", "MainWindowBase", ".", "unsubscribe_signals", "(", "self", ")", "self", ".", "menu", ".", "remove_subscriptions", "(", ")", "self", ".", "contact_list", ".", "contact...
https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/gui/gtkui/MainWindow.py#L275-L290
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/distutils/misc_util.py
python
msvc_runtime_library
()
return lib
Return name of MSVC runtime library if Python was built with MSVC >= 7
Return name of MSVC runtime library if Python was built with MSVC >= 7
[ "Return", "name", "of", "MSVC", "runtime", "library", "if", "Python", "was", "built", "with", "MSVC", ">", "=", "7" ]
def msvc_runtime_library(): "Return name of MSVC runtime library if Python was built with MSVC >= 7" msc_pos = sys.version.find('MSC v.') if msc_pos != -1: msc_ver = sys.version[msc_pos+6:msc_pos+10] lib = {'1300': 'msvcr70', # MSVC 7.0 '1310': 'msvcr71', # MSVC 7.1 ...
[ "def", "msvc_runtime_library", "(", ")", ":", "msc_pos", "=", "sys", ".", "version", ".", "find", "(", "'MSC v.'", ")", "if", "msc_pos", "!=", "-", "1", ":", "msc_ver", "=", "sys", ".", "version", "[", "msc_pos", "+", "6", ":", "msc_pos", "+", "10", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/distutils/misc_util.py#L355-L368
pyvisa/pyvisa
ae8c8b1180851ee4d120bc3527923c944b9623d6
pyvisa/errors.py
python
LibraryError.from_wrong_arch
(cls, filename: str)
return cls("Error while accessing %s: %s" % (filename, s))
Build the exception when the library has a mismatched architecture.
Build the exception when the library has a mismatched architecture.
[ "Build", "the", "exception", "when", "the", "library", "has", "a", "mismatched", "architecture", "." ]
def from_wrong_arch(cls, filename: str) -> "LibraryError": """Build the exception when the library has a mismatched architecture.""" s = "" details = util.get_system_details(backends=False) visalib = util.LibraryPath( filename, "user" if filename == util.read_user_library_pat...
[ "def", "from_wrong_arch", "(", "cls", ",", "filename", ":", "str", ")", "->", "\"LibraryError\"", ":", "s", "=", "\"\"", "details", "=", "util", ".", "get_system_details", "(", "backends", "=", "False", ")", "visalib", "=", "util", ".", "LibraryPath", "(",...
https://github.com/pyvisa/pyvisa/blob/ae8c8b1180851ee4d120bc3527923c944b9623d6/pyvisa/errors.py#L726-L739
ucaiado/rl_trading
f4168c69f44fe5a11a06461387d4591426a43735
market_gym/scripts/book_cleaner.py
python
Order.__str__
(self)
return self.name
Return the name of the Order
Return the name of the Order
[ "Return", "the", "name", "of", "the", "Order" ]
def __str__(self): ''' Return the name of the Order ''' return self.name
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "name" ]
https://github.com/ucaiado/rl_trading/blob/f4168c69f44fe5a11a06461387d4591426a43735/market_gym/scripts/book_cleaner.py#L79-L83
thouska/spotpy
92c3aad416ccd6becbeb345c58cae36b3a63d892
spotpy/parameter.py
python
Base.__repr__
(self)
return "{tname}('{p.name}', {p.rndargs})".format(tname=type(self).__name__, p=self)
Returns a textual representation of the parameter
Returns a textual representation of the parameter
[ "Returns", "a", "textual", "representation", "of", "the", "parameter" ]
def __repr__(self): """ Returns a textual representation of the parameter """ return "{tname}('{p.name}', {p.rndargs})".format(tname=type(self).__name__, p=self)
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"{tname}('{p.name}', {p.rndargs})\"", ".", "format", "(", "tname", "=", "type", "(", "self", ")", ".", "__name__", ",", "p", "=", "self", ")" ]
https://github.com/thouska/spotpy/blob/92c3aad416ccd6becbeb345c58cae36b3a63d892/spotpy/parameter.py#L230-L234
ehForwarderBot/efb-telegram-master
4ba2d019c68170e0f7ce08c5beaaa1ef36b1654d
efb_telegram_master/chat_binding.py
python
ChatBindingManager.chat_head_req_generate
(self, chat_id: TelegramChatID, message_id: TelegramMessageID = None, offset: int = 0, pattern: str = "", chats: List[EFBChannelChatIDStr] = None)
Generate the list for chat head, and update it to a message. Args: chat_id: Chat ID message_id: ID of message to be updated, None to send a new message. offset: Offset for pagination. pattern: Regex String used as a filter. chats: Specified list of ch...
Generate the list for chat head, and update it to a message.
[ "Generate", "the", "list", "for", "chat", "head", "and", "update", "it", "to", "a", "message", "." ]
def chat_head_req_generate(self, chat_id: TelegramChatID, message_id: TelegramMessageID = None, offset: int = 0, pattern: str = "", chats: List[EFBChannelChatIDStr] = None): """ Generate the list for chat head, ...
[ "def", "chat_head_req_generate", "(", "self", ",", "chat_id", ":", "TelegramChatID", ",", "message_id", ":", "TelegramMessageID", "=", "None", ",", "offset", ":", "int", "=", "0", ",", "pattern", ":", "str", "=", "\"\"", ",", "chats", ":", "List", "[", "...
https://github.com/ehForwarderBot/efb-telegram-master/blob/4ba2d019c68170e0f7ce08c5beaaa1ef36b1654d/efb_telegram_master/chat_binding.py#L648-L716
WPO-Foundation/wptagent
94470f007294213f900dcd9a207678b5b9fce5d3
internal/android_browser.py
python
AndroidBrowser.wait_for_processing
(self, task)
Wait for any background processing threads to finish
Wait for any background processing threads to finish
[ "Wait", "for", "any", "background", "processing", "threads", "to", "finish" ]
def wait_for_processing(self, task): """Wait for any background processing threads to finish""" if self.video_processing is not None: self.video_processing.communicate() self.video_processing = None if not self.job['keepvideo']: try: ...
[ "def", "wait_for_processing", "(", "self", ",", "task", ")", ":", "if", "self", ".", "video_processing", "is", "not", "None", ":", "self", ".", "video_processing", ".", "communicate", "(", ")", "self", ".", "video_processing", "=", "None", "if", "not", "se...
https://github.com/WPO-Foundation/wptagent/blob/94470f007294213f900dcd9a207678b5b9fce5d3/internal/android_browser.py#L333-L359
mandiant/flare-fakenet-ng
596bb139b59eb15323510ed41e33661a40c8d80c
fakenet/diverters/windows.py
python
Diverter.redirIcmpIpUnconditionally
(self, crit, pkt)
return pkt
Redirect ICMP to loopback or external IP if necessary. On Windows, we can't conveniently use an iptables REDIRECT rule to get ICMP packets sent back home for free, so here is some code.
Redirect ICMP to loopback or external IP if necessary.
[ "Redirect", "ICMP", "to", "loopback", "or", "external", "IP", "if", "necessary", "." ]
def redirIcmpIpUnconditionally(self, crit, pkt): """Redirect ICMP to loopback or external IP if necessary. On Windows, we can't conveniently use an iptables REDIRECT rule to get ICMP packets sent back home for free, so here is some code. """ if (pkt.is_icmp and p...
[ "def", "redirIcmpIpUnconditionally", "(", "self", ",", "crit", ",", "pkt", ")", ":", "if", "(", "pkt", ".", "is_icmp", "and", "pkt", ".", "dst_ip", "not", "in", "[", "self", ".", "loopback_ip", ",", "self", ".", "external_ip", "]", ")", ":", "self", ...
https://github.com/mandiant/flare-fakenet-ng/blob/596bb139b59eb15323510ed41e33661a40c8d80c/fakenet/diverters/windows.py#L293-L307
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pip/_vendor/distlib/_backport/shutil.py
python
unpack_archive
(filename, extract_dir=None, format=None)
Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", or "gztar". Or any other registered format. If n...
Unpack an archive.
[ "Unpack", "an", "archive", "." ]
def unpack_archive(filename, extract_dir=None, format=None): """Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one o...
[ "def", "unpack_archive", "(", "filename", ",", "extract_dir", "=", "None", ",", "format", "=", "None", ")", ":", "if", "extract_dir", "is", "None", ":", "extract_dir", "=", "os", ".", "getcwd", "(", ")", "if", "format", "is", "not", "None", ":", "try",...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/_vendor/distlib/_backport/shutil.py#L727-L761
coin-or/python-mip
ce72b669d77960a8839641d58c4fdc844cbb3836
mip/entities.py
python
Var.model
(self)
return self.__model
Model which this variable refers to. :rtype: mip.Model
Model which this variable refers to.
[ "Model", "which", "this", "variable", "refers", "to", "." ]
def model(self) -> "mip.Model": """Model which this variable refers to. :rtype: mip.Model """ return self.__model
[ "def", "model", "(", "self", ")", "->", "\"mip.Model\"", ":", "return", "self", ".", "__model" ]
https://github.com/coin-or/python-mip/blob/ce72b669d77960a8839641d58c4fdc844cbb3836/mip/entities.py#L819-L824
geofront-auth/geofront
1db8d3c1a7ae1d59caa3a5bb2a36a6e466b226f6
geofront/server.py
python
get_remote_set
()
Get the configured remote set. :return: the configured remote set :rtype: :class:`~.remote.RemoteSet` :raise RuntimeError: if ``'REMOTE_SET'`` is not configured, or it's not a mapping object
Get the configured remote set.
[ "Get", "the", "configured", "remote", "set", "." ]
def get_remote_set() -> RemoteSet: """Get the configured remote set. :return: the configured remote set :rtype: :class:`~.remote.RemoteSet` :raise RuntimeError: if ``'REMOTE_SET'`` is not configured, or it's not a mapping object """ try: set_ = app.config['REMO...
[ "def", "get_remote_set", "(", ")", "->", "RemoteSet", ":", "try", ":", "set_", "=", "app", ".", "config", "[", "'REMOTE_SET'", "]", "except", "KeyError", ":", "raise", "RuntimeError", "(", "'REMOTE_SET configuration is not present'", ")", "if", "isinstance", "("...
https://github.com/geofront-auth/geofront/blob/1db8d3c1a7ae1d59caa3a5bb2a36a6e466b226f6/geofront/server.py#L871-L889
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/codecs.py
python
IncrementalDecoder.decode
(self, input, final=False)
Decodes input and returns the resulting object.
Decodes input and returns the resulting object.
[ "Decodes", "input", "and", "returns", "the", "resulting", "object", "." ]
def decode(self, input, final=False): """ Decodes input and returns the resulting object. """ raise NotImplementedError
[ "def", "decode", "(", "self", ",", "input", ",", "final", "=", "False", ")", ":", "raise", "NotImplementedError" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/codecs.py#L245-L249
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/verify/v2/service/entity/__init__.py
python
EntityInstance.new_factors
(self)
return self._proxy.new_factors
Access the new_factors :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList
Access the new_factors
[ "Access", "the", "new_factors" ]
def new_factors(self): """ Access the new_factors :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList """ return self._proxy.new_factors
[ "def", "new_factors", "(", "self", ")", ":", "return", "self", ".", "_proxy", ".", "new_factors" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/verify/v2/service/entity/__init__.py#L454-L461
ztosec/hunter
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
SqlmapCelery/sqlmap/lib/utils/hash.py
python
sha384_generic_passwd
(password, uppercase=False)
return retVal.upper() if uppercase else retVal.lower()
>>> sha384_generic_passwd(password='testpass', uppercase=False) '6823546e56adf46849343be991d4b1be9b432e42ed1b4bb90635a0e4b930e49b9ca007bc3e04bf0a4e0df6f1f82769bf'
>>> sha384_generic_passwd(password='testpass', uppercase=False) '6823546e56adf46849343be991d4b1be9b432e42ed1b4bb90635a0e4b930e49b9ca007bc3e04bf0a4e0df6f1f82769bf'
[ ">>>", "sha384_generic_passwd", "(", "password", "=", "testpass", "uppercase", "=", "False", ")", "6823546e56adf46849343be991d4b1be9b432e42ed1b4bb90635a0e4b930e49b9ca007bc3e04bf0a4e0df6f1f82769bf" ]
def sha384_generic_passwd(password, uppercase=False): """ >>> sha384_generic_passwd(password='testpass', uppercase=False) '6823546e56adf46849343be991d4b1be9b432e42ed1b4bb90635a0e4b930e49b9ca007bc3e04bf0a4e0df6f1f82769bf' """ retVal = sha384(password).hexdigest() return retVal.upper() if upperc...
[ "def", "sha384_generic_passwd", "(", "password", ",", "uppercase", "=", "False", ")", ":", "retVal", "=", "sha384", "(", "password", ")", ".", "hexdigest", "(", ")", "return", "retVal", ".", "upper", "(", ")", "if", "uppercase", "else", "retVal", ".", "l...
https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/SqlmapCelery/sqlmap/lib/utils/hash.py#L267-L275
lazylibrarian/LazyLibrarian
ae3c14e9db9328ce81765e094ab2a14ed7155624
lib/pythontwitter/__init__.py
python
User.SetLocation
(self, location)
Set the geographic location of this user. Args: location: The geographic location of this user
Set the geographic location of this user.
[ "Set", "the", "geographic", "location", "of", "this", "user", "." ]
def SetLocation(self, location): '''Set the geographic location of this user. Args: location: The geographic location of this user ''' self._location = location
[ "def", "SetLocation", "(", "self", ",", "location", ")", ":", "self", ".", "_location", "=", "location" ]
https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/lib/pythontwitter/__init__.py#L964-L970
geopython/pycsw
43a5c92fa819a3a3fdc8a8e3ef075d784dff73fc
pycsw/core/repository.py
python
Repository.query_domain
(self, domain, typenames, domainquerytype='list', count=False)
return self._get_repo_filter(query).all()
Query by property domain values
Query by property domain values
[ "Query", "by", "property", "domain", "values" ]
def query_domain(self, domain, typenames, domainquerytype='list', count=False): ''' Query by property domain values ''' domain_value = getattr(self.dataset, domain) if domainquerytype == 'range': LOGGER.info('Generating property name range values') query = self....
[ "def", "query_domain", "(", "self", ",", "domain", ",", "typenames", ",", "domainquerytype", "=", "'list'", ",", "count", "=", "False", ")", ":", "domain_value", "=", "getattr", "(", "self", ".", "dataset", ",", "domain", ")", "if", "domainquerytype", "=="...
https://github.com/geopython/pycsw/blob/43a5c92fa819a3a3fdc8a8e3ef075d784dff73fc/pycsw/core/repository.py#L244-L261
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/markdown/extensions/footnotes.py
python
makeExtension
(configs=[])
return FootnoteExtension(configs=configs)
Return an instance of the FootnoteExtension
Return an instance of the FootnoteExtension
[ "Return", "an", "instance", "of", "the", "FootnoteExtension" ]
def makeExtension(configs=[]): """ Return an instance of the FootnoteExtension """ return FootnoteExtension(configs=configs)
[ "def", "makeExtension", "(", "configs", "=", "[", "]", ")", ":", "return", "FootnoteExtension", "(", "configs", "=", "configs", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/markdown/extensions/footnotes.py#L302-L304
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/urllib/parse.py
python
urlsplit
(url, scheme='', allow_fragments=True)
return _coerce_result(v)
Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fragment> Return a 5-tuple: (scheme, netloc, path, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.
Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fragment> Return a 5-tuple: (scheme, netloc, path, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.
[ "Parse", "a", "URL", "into", "5", "components", ":", "<scheme", ">", ":", "//", "<netloc", ">", "/", "<path", ">", "?<query", ">", "#<fragment", ">", "Return", "a", "5", "-", "tuple", ":", "(", "scheme", "netloc", "path", "query", "fragment", ")", "....
def urlsplit(url, scheme='', allow_fragments=True): """Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fragment> Return a 5-tuple: (scheme, netloc, path, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expa...
[ "def", "urlsplit", "(", "url", ",", "scheme", "=", "''", ",", "allow_fragments", "=", "True", ")", ":", "url", ",", "scheme", ",", "_coerce_result", "=", "_coerce_args", "(", "url", ",", "scheme", ")", "allow_fragments", "=", "bool", "(", "allow_fragments"...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/urllib/parse.py#L334-L390
Blueqat/Blueqat
b676f30489b71767419fd20503403d290d4950b5
blueqat/gate.py
python
Mat1Gate.create
(cls, targets: Targets, params: tuple, options: Optional[dict] = None)
return cls(targets, params[0])
[]
def create(cls, targets: Targets, params: tuple, options: Optional[dict] = None) -> 'Mat1Gate': if options: raise ValueError(f"{cls.__name__} doesn't take options") return cls(targets, params[0])
[ "def", "create", "(", "cls", ",", "targets", ":", "Targets", ",", "params", ":", "tuple", ",", "options", ":", "Optional", "[", "dict", "]", "=", "None", ")", "->", "'Mat1Gate'", ":", "if", "options", ":", "raise", "ValueError", "(", "f\"{cls.__name__} d...
https://github.com/Blueqat/Blueqat/blob/b676f30489b71767419fd20503403d290d4950b5/blueqat/gate.py#L200-L206
freqtrade/freqtrade
13651fd3be8d5ce8dcd7c94b920bda4e00b75aca
freqtrade/plugins/pairlist/VolumePairList.py
python
VolumePairList.gen_pairlist
(self, tickers: Dict)
return pairlist
Generate the pairlist :param tickers: Tickers (from exchange.get_tickers()). May be cached. :return: List of pairs
Generate the pairlist :param tickers: Tickers (from exchange.get_tickers()). May be cached. :return: List of pairs
[ "Generate", "the", "pairlist", ":", "param", "tickers", ":", "Tickers", "(", "from", "exchange", ".", "get_tickers", "()", ")", ".", "May", "be", "cached", ".", ":", "return", ":", "List", "of", "pairs" ]
def gen_pairlist(self, tickers: Dict) -> List[str]: """ Generate the pairlist :param tickers: Tickers (from exchange.get_tickers()). May be cached. :return: List of pairs """ # Generate dynamic whitelist # Must always run if this pairlist is not the first in the l...
[ "def", "gen_pairlist", "(", "self", ",", "tickers", ":", "Dict", ")", "->", "List", "[", "str", "]", ":", "# Generate dynamic whitelist", "# Must always run if this pairlist is not the first in the list.", "pairlist", "=", "self", ".", "_pair_cache", ".", "get", "(", ...
https://github.com/freqtrade/freqtrade/blob/13651fd3be8d5ce8dcd7c94b920bda4e00b75aca/freqtrade/plugins/pairlist/VolumePairList.py#L107-L138
nadineproject/nadine
c41c8ef7ffe18f1853029c97eecc329039b4af6c
nadine/utils/payment_api.py
python
USAEPAY_SOAP_API.runTransactions4
(self, customer_number, amount, description, invoice=None, comment=None, auth_only=False)
return response
[]
def runTransactions4(self, customer_number, amount, description, invoice=None, comment=None, auth_only=False): params = self.client.factory.create('CustomerTransactionRequest') if auth_only: command = "AuthOnly" else: command = "Sale" params.CustReceipt = True ...
[ "def", "runTransactions4", "(", "self", ",", "customer_number", ",", "amount", ",", "description", ",", "invoice", "=", "None", ",", "comment", "=", "None", ",", "auth_only", "=", "False", ")", ":", "params", "=", "self", ".", "client", ".", "factory", "...
https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/nadine/utils/payment_api.py#L342-L363
skylander86/lambda-text-extractor
6da52d077a2fc571e38bfe29c33ae68f6443cd5a
lib-linux_x64/odf/odf2moinmoin.py
python
ODF2MoinMoin.toString
(self)
return self.compressCodeBlocks('\n'.join(buffer))
Converts the document to a string. FIXME: Result from second call differs from first call
Converts the document to a string. FIXME: Result from second call differs from first call
[ "Converts", "the", "document", "to", "a", "string", ".", "FIXME", ":", "Result", "from", "second", "call", "differs", "from", "first", "call" ]
def toString(self): """ Converts the document to a string. FIXME: Result from second call differs from first call """ body = self.content.getElementsByTagName("office:body")[0] text = body.childNodes[0] buffer = [] paragraphs = [el for el in text.childNodes ...
[ "def", "toString", "(", "self", ")", ":", "body", "=", "self", ".", "content", ".", "getElementsByTagName", "(", "\"office:body\"", ")", "[", "0", "]", "text", "=", "body", ".", "childNodes", "[", "0", "]", "buffer", "=", "[", "]", "paragraphs", "=", ...
https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/odf/odf2moinmoin.py#L452-L485
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/_vendor/colorama/winterm.py
python
WinTerm.erase_line
(self, mode=0, on_stderr=False)
[]
def erase_line(self, mode=0, on_stderr=False): # 0 should clear from the cursor to the end of the line. # 1 should clear from the cursor to the beginning of the line. # 2 should clear the entire line. handle = win32.STDOUT if on_stderr: handle = win32.STDERR c...
[ "def", "erase_line", "(", "self", ",", "mode", "=", "0", ",", "on_stderr", "=", "False", ")", ":", "# 0 should clear from the cursor to the end of the line.", "# 1 should clear from the cursor to the beginning of the line.", "# 2 should clear the entire line.", "handle", "=", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/colorama/winterm.py#L139-L159
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/tkinter/__init__.py
python
Misc._options
(self, cnf, kw = None)
return res
Internal function.
Internal function.
[ "Internal", "function", "." ]
def _options(self, cnf, kw = None): """Internal function.""" if kw: cnf = _cnfmerge((cnf, kw)) else: cnf = _cnfmerge(cnf) res = () for k, v in cnf.items(): if v is not None: if k[-1] == '_': k = k[:-1] if callabl...
[ "def", "_options", "(", "self", ",", "cnf", ",", "kw", "=", "None", ")", ":", "if", "kw", ":", "cnf", "=", "_cnfmerge", "(", "(", "cnf", ",", "kw", ")", ")", "else", ":", "cnf", "=", "_cnfmerge", "(", "cnf", ")", "res", "=", "(", ")", "for", ...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/tkinter/__init__.py#L1157-L1181
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/storage/databases/main/signatures.py
python
SignatureWorkerStore.add_event_hashes
( self, event_ids: Iterable[str] )
return list(encoded_hashes.items())
Args: event_ids: The event IDs Returns: A list of tuples of event ID and a mapping of algorithm to base-64 encoded hash.
[]
async def add_event_hashes( self, event_ids: Iterable[str] ) -> List[Tuple[str, Dict[str, str]]]: """ Args: event_ids: The event IDs Returns: A list of tuples of event ID and a mapping of algorithm to base-64 encoded hash. """ hashes = await ...
[ "async", "def", "add_event_hashes", "(", "self", ",", "event_ids", ":", "Iterable", "[", "str", "]", ")", "->", "List", "[", "Tuple", "[", "str", ",", "Dict", "[", "str", ",", "str", "]", "]", "]", ":", "hashes", "=", "await", "self", ".", "get_eve...
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/storage/databases/main/signatures.py#L54-L71
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/psutil/_psosx.py
python
Process.cpu_times
(self)
return _common.pcputimes( rawtuple[pidtaskinfo_map['cpuutime']], rawtuple[pidtaskinfo_map['cpustime']], # children user / system times are not retrievable (set to 0) 0.0, 0.0)
[]
def cpu_times(self): rawtuple = self._get_pidtaskinfo() return _common.pcputimes( rawtuple[pidtaskinfo_map['cpuutime']], rawtuple[pidtaskinfo_map['cpustime']], # children user / system times are not retrievable (set to 0) 0.0, 0.0)
[ "def", "cpu_times", "(", "self", ")", ":", "rawtuple", "=", "self", ".", "_get_pidtaskinfo", "(", ")", "return", "_common", ".", "pcputimes", "(", "rawtuple", "[", "pidtaskinfo_map", "[", "'cpuutime'", "]", "]", ",", "rawtuple", "[", "pidtaskinfo_map", "[", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/psutil/_psosx.py#L477-L483
datawire/forge
d501be4571dcef5691804c7db7008ee877933c8d
versioneer.py
python
git_pieces_from_vcs
(tag_prefix, root, verbose, run_command=run_command)
return pieces
Get version from 'git describe' in the root of the source tree. This only gets called if the git-archive 'subst' keywords were *not* expanded, and _version.py hasn't already been rewritten with a short version string, meaning we're inside a checked out source tree.
Get version from 'git describe' in the root of the source tree.
[ "Get", "version", "from", "git", "describe", "in", "the", "root", "of", "the", "source", "tree", "." ]
def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): """Get version from 'git describe' in the root of the source tree. This only gets called if the git-archive 'subst' keywords were *not* expanded, and _version.py hasn't already been rewritten with a short version string, meani...
[ "def", "git_pieces_from_vcs", "(", "tag_prefix", ",", "root", ",", "verbose", ",", "run_command", "=", "run_command", ")", ":", "GITS", "=", "[", "\"git\"", "]", "if", "sys", ".", "platform", "==", "\"win32\"", ":", "GITS", "=", "[", "\"git.cmd\"", ",", ...
https://github.com/datawire/forge/blob/d501be4571dcef5691804c7db7008ee877933c8d/versioneer.py#L1029-L1117
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_internal/req/req_install.py
python
InstallRequirement.from_path
(self)
return s
Format a nice indicator to show where this "comes from"
Format a nice indicator to show where this "comes from"
[ "Format", "a", "nice", "indicator", "to", "show", "where", "this", "comes", "from" ]
def from_path(self): """Format a nice indicator to show where this "comes from" """ if self.req is None: return None s = str(self.req) if self.comes_from: if isinstance(self.comes_from, six.string_types): comes_from = self.comes_from ...
[ "def", "from_path", "(", "self", ")", ":", "if", "self", ".", "req", "is", "None", ":", "return", "None", "s", "=", "str", "(", "self", ".", "req", ")", "if", "self", ".", "comes_from", ":", "if", "isinstance", "(", "self", ".", "comes_from", ",", ...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_internal/req/req_install.py#L383-L396
nerdvegas/rez
d392c65bf63b4bca8106f938cec49144ba54e770
src/rez/vendor/pika/connection.py
python
Connection.close
(self, reply_code=200, reply_text='Normal shutdown')
Disconnect from RabbitMQ. If there are any open channels, it will attempt to close them prior to fully disconnecting. Channels which have active consumers will attempt to send a Basic.Cancel to RabbitMQ to cleanly stop the delivery of messages prior to closing the channel. :param int re...
Disconnect from RabbitMQ. If there are any open channels, it will attempt to close them prior to fully disconnecting. Channels which have active consumers will attempt to send a Basic.Cancel to RabbitMQ to cleanly stop the delivery of messages prior to closing the channel.
[ "Disconnect", "from", "RabbitMQ", ".", "If", "there", "are", "any", "open", "channels", "it", "will", "attempt", "to", "close", "them", "prior", "to", "fully", "disconnecting", ".", "Channels", "which", "have", "active", "consumers", "will", "attempt", "to", ...
def close(self, reply_code=200, reply_text='Normal shutdown'): """Disconnect from RabbitMQ. If there are any open channels, it will attempt to close them prior to fully disconnecting. Channels which have active consumers will attempt to send a Basic.Cancel to RabbitMQ to cleanly stop the...
[ "def", "close", "(", "self", ",", "reply_code", "=", "200", ",", "reply_text", "=", "'Normal shutdown'", ")", ":", "if", "self", ".", "is_closing", "or", "self", ".", "is_closed", ":", "msg", "=", "(", "'Illegal close({}, {!r}) request on {} because it '", "'was...
https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/vendor/pika/connection.py#L1266-L1325
LMFDB/lmfdb
6cf48a4c18a96e6298da6ae43f587f96845bcb43
lmfdb/knowledge/knowl.py
python
KnowlBackend.broken_links_knowls
(self)
return [(kid, results[kid]) for kid in sorted(results)]
A list of knowl ids that have broken links. OUTPUT: A list of pairs ``kid``, ``links``, where ``links`` is a list of broken links on the knowl with id ``kid``.
A list of knowl ids that have broken links.
[ "A", "list", "of", "knowl", "ids", "that", "have", "broken", "links", "." ]
def broken_links_knowls(self): """ A list of knowl ids that have broken links. OUTPUT: A list of pairs ``kid``, ``links``, where ``links`` is a list of broken links on the knowl with id ``kid``. """ selecter = SQL("SELECT id, link FROM (SELECT DISTINCT ON (id) id, UNNES...
[ "def", "broken_links_knowls", "(", "self", ")", ":", "selecter", "=", "SQL", "(", "\"SELECT id, link FROM (SELECT DISTINCT ON (id) id, UNNEST(links) AS link FROM kwl_knowls WHERE status >= 0 ORDER BY id, timestamp DESC) knowls WHERE (SELECT COUNT(*) FROM kwl_knowls kw WHERE kw.id = link) = 0\"",...
https://github.com/LMFDB/lmfdb/blob/6cf48a4c18a96e6298da6ae43f587f96845bcb43/lmfdb/knowledge/knowl.py#L641-L653
rlisagor/freshen
5578f7368e8d53b4cf51c589fb192090d3524968
freshen/compat.py
python
relpath
(path, start=curdir)
return join(*rel_list)
Return a relative version of a path
Return a relative version of a path
[ "Return", "a", "relative", "version", "of", "a", "path" ]
def relpath(path, start=curdir): """Return a relative version of a path""" if not path: raise ValueError("no path specified") start_list = abspath(start).split(sep) path_list = abspath(path).split(sep) # Work out how much of the filepath is shared by start and path. i = len(commonpref...
[ "def", "relpath", "(", "path", ",", "start", "=", "curdir", ")", ":", "if", "not", "path", ":", "raise", "ValueError", "(", "\"no path specified\"", ")", "start_list", "=", "abspath", "(", "start", ")", ".", "split", "(", "sep", ")", "path_list", "=", ...
https://github.com/rlisagor/freshen/blob/5578f7368e8d53b4cf51c589fb192090d3524968/freshen/compat.py#L7-L22
nicrusso7/rex-gym
26663048bd3c3da307714da4458b1a2a9dc81824
rex_gym/envs/rex_gym_env.py
python
RexGymEnv.set_time_step
(self, control_step, simulation_step=0.001)
Sets the time step of the environment. Args: control_step: The time period (in seconds) between two adjacent control actions are applied. simulation_step: The simulation time step in PyBullet. By default, the simulation step is 0.001s, which is a good trade-off betwe...
Sets the time step of the environment.
[ "Sets", "the", "time", "step", "of", "the", "environment", "." ]
def set_time_step(self, control_step, simulation_step=0.001): """Sets the time step of the environment. Args: control_step: The time period (in seconds) between two adjacent control actions are applied. simulation_step: The simulation time step in PyBullet. By default, t...
[ "def", "set_time_step", "(", "self", ",", "control_step", ",", "simulation_step", "=", "0.001", ")", ":", "if", "control_step", "<", "simulation_step", ":", "raise", "ValueError", "(", "\"Control step should be larger than or equal to simulation step.\"", ")", "self", "...
https://github.com/nicrusso7/rex-gym/blob/26663048bd3c3da307714da4458b1a2a9dc81824/rex_gym/envs/rex_gym_env.py#L623-L644
jaimeMF/youtube-dl-api-server
a7456b502047e038439cefafba880aab91497665
youtube_dl_server/app.py
python
get_videos
(url, extra_params)
return res
Get a list with a dict for every video founded
Get a list with a dict for every video founded
[ "Get", "a", "list", "with", "a", "dict", "for", "every", "video", "founded" ]
def get_videos(url, extra_params): ''' Get a list with a dict for every video founded ''' ydl_params = { 'format': 'best', 'cachedir': False, 'logger': current_app.logger.getChild('youtube-dl'), } ydl_params.update(extra_params) ydl = SimpleYDL(ydl_params) res = y...
[ "def", "get_videos", "(", "url", ",", "extra_params", ")", ":", "ydl_params", "=", "{", "'format'", ":", "'best'", ",", "'cachedir'", ":", "False", ",", "'logger'", ":", "current_app", ".", "logger", ".", "getChild", "(", "'youtube-dl'", ")", ",", "}", "...
https://github.com/jaimeMF/youtube-dl-api-server/blob/a7456b502047e038439cefafba880aab91497665/youtube_dl_server/app.py#L24-L36
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/translations/forms.py
python
MigrateTransifexProjectForm.__init__
(self, domain, *args, **kwargs)
[]
def __init__(self, domain, *args, **kwargs): super(MigrateTransifexProjectForm, self).__init__(*args, **kwargs) self.domain = domain self._set_choices() self.helper = HQFormHelper() self.helper.layout = crispy.Layout( crispy.Fieldset( "Migrate Project"...
[ "def", "__init__", "(", "self", ",", "domain", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "MigrateTransifexProjectForm", ",", "self", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "domain",...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/translations/forms.py#L382-L405
accel-brain/accel-brain-code
86f489dc9be001a3bae6d053f48d6b57c0bedb95
Reinforcement-Learning/pyqlearning/annealing_model.py
python
AnnealingModel.set_var_log_arr
(self, value)
setter
setter
[ "setter" ]
def set_var_log_arr(self, value): ''' setter ''' if isinstance(value, np.ndarray): self.__var_log_arr = value else: raise TypeError()
[ "def", "set_var_log_arr", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "np", ".", "ndarray", ")", ":", "self", ".", "__var_log_arr", "=", "value", "else", ":", "raise", "TypeError", "(", ")" ]
https://github.com/accel-brain/accel-brain-code/blob/86f489dc9be001a3bae6d053f48d6b57c0bedb95/Reinforcement-Learning/pyqlearning/annealing_model.py#L124-L129
bachya/smart-home
536b989e0d7057c7a8a65b2ac9bbffd4b826cce7
hass/settings/custom_components/hacs/repositories/integration.py
python
HacsIntegrationRepository.update_repository
(self, ignore_issues=False, force=False)
Update.
Update.
[ "Update", "." ]
async def update_repository(self, ignore_issues=False, force=False): """Update.""" if not await self.common_update(ignore_issues, force): return if self.data.content_in_root: self.content.path.remote = "" if self.content.path.remote == "custom_components": ...
[ "async", "def", "update_repository", "(", "self", ",", "ignore_issues", "=", "False", ",", "force", "=", "False", ")", ":", "if", "not", "await", "self", ".", "common_update", "(", "ignore_issues", ",", "force", ")", ":", "return", "if", "self", ".", "da...
https://github.com/bachya/smart-home/blob/536b989e0d7057c7a8a65b2ac9bbffd4b826cce7/hass/settings/custom_components/hacs/repositories/integration.py#L72-L90
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/wifitap/scapy.py
python
TracerouteResult.make_graph
(self,ASN,padding)
[]
def make_graph(self,ASN,padding): self.graphASN = ASN self.graphpadding = padding ips = {} rt = {} ports = {} ports_done = {} for s,r in self.res: ips[r.src] = None if s.haslayer(TCP) or s.haslayer(UDP): trace_id = (s.src,s....
[ "def", "make_graph", "(", "self", ",", "ASN", ",", "padding", ")", ":", "self", ".", "graphASN", "=", "ASN", "self", ".", "graphpadding", "=", "padding", "ips", "=", "{", "}", "rt", "=", "{", "}", "ports", "=", "{", "}", "ports_done", "=", "{", "...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/wifitap/scapy.py#L3393-L3595
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/notpip/_vendor/urllib3/util/retry.py
python
_RetryMeta.DEFAULT_METHOD_WHITELIST
(cls, value)
[]
def DEFAULT_METHOD_WHITELIST(cls, value): warnings.warn( "Using 'Retry.DEFAULT_METHOD_WHITELIST' is deprecated and " "will be removed in v2.0. Use 'Retry.DEFAULT_ALLOWED_METHODS' instead", DeprecationWarning, ) cls.DEFAULT_ALLOWED_METHODS = value
[ "def", "DEFAULT_METHOD_WHITELIST", "(", "cls", ",", "value", ")", ":", "warnings", ".", "warn", "(", "\"Using 'Retry.DEFAULT_METHOD_WHITELIST' is deprecated and \"", "\"will be removed in v2.0. Use 'Retry.DEFAULT_ALLOWED_METHODS' instead\"", ",", "DeprecationWarning", ",", ")", "...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/urllib3/util/retry.py#L46-L52
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/numbers.py
python
Complex.__truediv__
(self, other)
self / other with __future__ division. Should promote to float when necessary.
self / other with __future__ division.
[ "self", "/", "other", "with", "__future__", "division", "." ]
def __truediv__(self, other): """self / other with __future__ division. Should promote to float when necessary. """ raise NotImplementedError
[ "def", "__truediv__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/numbers.py#L124-L129
Blizzard/s2protocol
4bfe857bb832eee12cc6307dd699e3b74bd7e1b2
s2protocol/versions/protocol77661.py
python
decode_replay_game_events
(contents)
Decodes and yields each game event from the contents byte string.
Decodes and yields each game event from the contents byte string.
[ "Decodes", "and", "yields", "each", "game", "event", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_game_events(contents): """Decodes and yields each game event from the contents byte string.""" decoder = BitPackedDecoder(contents, typeinfos) for event in _decode_event_stream(decoder, game_eventid_typeid, game_ev...
[ "def", "decode_replay_game_events", "(", "contents", ")", ":", "decoder", "=", "BitPackedDecoder", "(", "contents", ",", "typeinfos", ")", "for", "event", "in", "_decode_event_stream", "(", "decoder", ",", "game_eventid_typeid", ",", "game_event_types", ",", "decode...
https://github.com/Blizzard/s2protocol/blob/4bfe857bb832eee12cc6307dd699e3b74bd7e1b2/s2protocol/versions/protocol77661.py#L442-L449
lingtengqiu/Deeperlab-pytorch
5c500780a6655ff343d147477402aa20e0ed7a7c
utils/pyt_utils.py
python
extant_file
(x)
return x
'Type' for argparse - checks that file exists but does not open.
'Type' for argparse - checks that file exists but does not open.
[ "Type", "for", "argparse", "-", "checks", "that", "file", "exists", "but", "does", "not", "open", "." ]
def extant_file(x): """ 'Type' for argparse - checks that file exists but does not open. """ if not os.path.exists(x): # Argparse uses the ArgumentTypeError to give a rejection message like: # error: argument input: x does not exist raise argparse.ArgumentTypeError("{0} does not ...
[ "def", "extant_file", "(", "x", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "x", ")", ":", "# Argparse uses the ArgumentTypeError to give a rejection message like:", "# error: argument input: x does not exist", "raise", "argparse", ".", "ArgumentTypeErro...
https://github.com/lingtengqiu/Deeperlab-pytorch/blob/5c500780a6655ff343d147477402aa20e0ed7a7c/utils/pyt_utils.py#L93-L101
tdpetrou/pandas_cub
9f933c2a1a11a7f8eebab29b62c320cedb9d631a
pandas_cub/__init__.py
python
DataFrame.var
(self)
return self._agg(np.var)
[]
def var(self): return self._agg(np.var)
[ "def", "var", "(", "self", ")", ":", "return", "self", ".", "_agg", "(", "np", ".", "var", ")" ]
https://github.com/tdpetrou/pandas_cub/blob/9f933c2a1a11a7f8eebab29b62c320cedb9d631a/pandas_cub/__init__.py#L217-L218
easezyc/deep-transfer-learning
9af0921f4f21bc2ccea61be53cf8e8a49873d613
UDA/pytorch1.0/DSAN/lmmd.py
python
LMMD_loss.guassian_kernel
(self, source, target, kernel_mul=2.0, kernel_num=5, fix_sigma=None)
return sum(kernel_val)
[]
def guassian_kernel(self, source, target, kernel_mul=2.0, kernel_num=5, fix_sigma=None): n_samples = int(source.size()[0]) + int(target.size()[0]) total = torch.cat([source, target], dim=0) total0 = total.unsqueeze(0).expand( int(total.size(0)), int(total.size(0)), int(total.size(1))...
[ "def", "guassian_kernel", "(", "self", ",", "source", ",", "target", ",", "kernel_mul", "=", "2.0", ",", "kernel_num", "=", "5", ",", "fix_sigma", "=", "None", ")", ":", "n_samples", "=", "int", "(", "source", ".", "size", "(", ")", "[", "0", "]", ...
https://github.com/easezyc/deep-transfer-learning/blob/9af0921f4f21bc2ccea61be53cf8e8a49873d613/UDA/pytorch1.0/DSAN/lmmd.py#L14-L31
Pymol-Scripts/Pymol-script-repo
bcd7bb7812dc6db1595953dfa4471fa15fb68c77
modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/WSDLTools.py
python
Operation.getWSDL
(self)
return self.parent().parent().parent().parent()
Return the WSDL object that contains this Operation.
Return the WSDL object that contains this Operation.
[ "Return", "the", "WSDL", "object", "that", "contains", "this", "Operation", "." ]
def getWSDL(self): """Return the WSDL object that contains this Operation.""" return self.parent().parent().parent().parent()
[ "def", "getWSDL", "(", "self", ")", ":", "return", "self", ".", "parent", "(", ")", ".", "parent", "(", ")", ".", "parent", "(", ")", ".", "parent", "(", ")" ]
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/WSDLTools.py#L650-L652
accel-brain/accel-brain-code
86f489dc9be001a3bae6d053f48d6b57c0bedb95
Generative-Adversarial-Networks/pygan/gan_image_generator.py
python
GANImageGenerator.__init__
( self, dir_list, width=28, height=28, channel=1, initializer=None, batch_size=40, learning_rate=1e-03, ctx=mx.gpu(), discriminative_model=None, generative_model=None, generator_loss_weight=1.0, discriminator_loss_we...
Init. If you are not satisfied with this simple default setting, delegate `discriminative_model` and `generative_model` designed by yourself. Args: dir_list: `list` of `str` of path to image files. width: `int` of image width. height: ...
Init.
[ "Init", "." ]
def __init__( self, dir_list, width=28, height=28, channel=1, initializer=None, batch_size=40, learning_rate=1e-03, ctx=mx.gpu(), discriminative_model=None, generative_model=None, generator_loss_weight=1.0, discrimin...
[ "def", "__init__", "(", "self", ",", "dir_list", ",", "width", "=", "28", ",", "height", "=", "28", ",", "channel", "=", "1", ",", "initializer", "=", "None", ",", "batch_size", "=", "40", ",", "learning_rate", "=", "1e-03", ",", "ctx", "=", "mx", ...
https://github.com/accel-brain/accel-brain-code/blob/86f489dc9be001a3bae6d053f48d6b57c0bedb95/Generative-Adversarial-Networks/pygan/gan_image_generator.py#L66-L290
JulianEberius/SublimeRope
c6ac5179ce8c1e7af0c2c1134589f945252c362d
rope/refactor/change_signature.py
python
ArgumentReorderer.__init__
(self, new_order, autodef=None)
Construct an `ArgumentReorderer` Note that the `new_order` is a list containing the new position of parameters; not the position each parameter is going to be moved to. (changed in ``0.5m4``) For example changing ``f(a, b, c)`` to ``f(c, a, b)`` requires passing ``[2, 0, 1]`` a...
Construct an `ArgumentReorderer`
[ "Construct", "an", "ArgumentReorderer" ]
def __init__(self, new_order, autodef=None): """Construct an `ArgumentReorderer` Note that the `new_order` is a list containing the new position of parameters; not the position each parameter is going to be moved to. (changed in ``0.5m4``) For example changing ``f(a, b, c)`` to...
[ "def", "__init__", "(", "self", ",", "new_order", ",", "autodef", "=", "None", ")", ":", "self", ".", "new_order", "=", "new_order", "self", ".", "autodef", "=", "autodef" ]
https://github.com/JulianEberius/SublimeRope/blob/c6ac5179ce8c1e7af0c2c1134589f945252c362d/rope/refactor/change_signature.py#L249-L268
PaddlePaddle/PaddleHub
107ee7e1a49d15e9c94da3956475d88a53fc165f
paddlehub/compat/task/batch.py
python
pad_batch_data
(insts: List, pad_idx: int = 0, max_seq_len: int = 128, return_pos: bool = False, return_input_mask: bool = False, return_max_len: bool = False, return_num_token: bool = False, return_seq...
return return_list if len(return_list) > 1 else return_list[0]
Pad the instances to the max sequence length in batch, and generate the corresponding position data and input mask.
Pad the instances to the max sequence length in batch, and generate the corresponding position data and input mask.
[ "Pad", "the", "instances", "to", "the", "max", "sequence", "length", "in", "batch", "and", "generate", "the", "corresponding", "position", "data", "and", "input", "mask", "." ]
def pad_batch_data(insts: List, pad_idx: int = 0, max_seq_len: int = 128, return_pos: bool = False, return_input_mask: bool = False, return_max_len: bool = False, return_num_token: bool = False, ...
[ "def", "pad_batch_data", "(", "insts", ":", "List", ",", "pad_idx", ":", "int", "=", "0", ",", "max_seq_len", ":", "int", "=", "128", ",", "return_pos", ":", "bool", "=", "False", ",", "return_input_mask", ":", "bool", "=", "False", ",", "return_max_len"...
https://github.com/PaddlePaddle/PaddleHub/blob/107ee7e1a49d15e9c94da3956475d88a53fc165f/paddlehub/compat/task/batch.py#L22-L68
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/decimal.py
python
Decimal.same_quantum
(self, other)
return self._exp == other._exp
Return True if self and other have the same exponent; otherwise return False. If either operand is a special value, the following rules are used: * return True if both operands are infinities * return True if both operands are NaNs * otherwise, return False.
Return True if self and other have the same exponent; otherwise return False. If either operand is a special value, the following rules are used: * return True if both operands are infinities * return True if both operands are NaNs * otherwise, return False.
[ "Return", "True", "if", "self", "and", "other", "have", "the", "same", "exponent", ";", "otherwise", "return", "False", ".", "If", "either", "operand", "is", "a", "special", "value", "the", "following", "rules", "are", "used", ":", "*", "return", "True", ...
def same_quantum(self, other): """Return True if self and other have the same exponent; otherwise return False. If either operand is a special value, the following rules are used: * return True if both operands are infinities * return True if both operands are NaNs...
[ "def", "same_quantum", "(", "self", ",", "other", ")", ":", "other", "=", "_convert_other", "(", "other", ",", "raiseit", "=", "True", ")", "if", "self", ".", "_is_special", "or", "other", ".", "_is_special", ":", "return", "self", ".", "is_nan", "(", ...
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/decimal.py#L1977-L1989
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py
python
encode_fs_path
(path)
return smart_str(path, HDFS_ENCODING, errors='strict')
encode_fs_path(path) -> byte string in utf8
encode_fs_path(path) -> byte string in utf8
[ "encode_fs_path", "(", "path", ")", "-", ">", "byte", "string", "in", "utf8" ]
def encode_fs_path(path): """encode_fs_path(path) -> byte string in utf8""" return smart_str(path, HDFS_ENCODING, errors='strict')
[ "def", "encode_fs_path", "(", "path", ")", ":", "return", "smart_str", "(", "path", ",", "HDFS_ENCODING", ",", "errors", "=", "'strict'", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py#L76-L78
hottbox/hottbox
26580018ec6d38a1b08266c04ce4408c9e276130
hottbox/core/structures.py
python
TensorTKD.reconstruct
(self, keep_meta=0)
return tensor
Converts the Tucker representation of a tensor into a full tensor Parameters ---------- keep_meta : int Keep meta information about modes of the given `tensor`. 0 - the output will have default values for the meta data 1 - keep only mode names 2 -...
Converts the Tucker representation of a tensor into a full tensor
[ "Converts", "the", "Tucker", "representation", "of", "a", "tensor", "into", "a", "full", "tensor" ]
def reconstruct(self, keep_meta=0): """ Converts the Tucker representation of a tensor into a full tensor Parameters ---------- keep_meta : int Keep meta information about modes of the given `tensor`. 0 - the output will have default values for the meta data ...
[ "def", "reconstruct", "(", "self", ",", "keep_meta", "=", "0", ")", ":", "tensor", "=", "self", ".", "core", "for", "mode", ",", "fmat", "in", "enumerate", "(", "self", ".", "fmat", ")", ":", "tensor", ".", "mode_n_product", "(", "fmat", ",", "mode",...
https://github.com/hottbox/hottbox/blob/26580018ec6d38a1b08266c04ce4408c9e276130/hottbox/core/structures.py#L1704-L1731
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/db/sqlalchemy/api.py
python
fixed_ip_get_by_address_detailed
(context, address, session=None)
return result
:returns: a tuple of (models.FixedIp, models.Network, models.Instance)
:returns: a tuple of (models.FixedIp, models.Network, models.Instance)
[ ":", "returns", ":", "a", "tuple", "of", "(", "models", ".", "FixedIp", "models", ".", "Network", "models", ".", "Instance", ")" ]
def fixed_ip_get_by_address_detailed(context, address, session=None): """ :returns: a tuple of (models.FixedIp, models.Network, models.Instance) """ if not session: session = get_session() result = model_query(context, models.FixedIp, models.Network, models.Instance...
[ "def", "fixed_ip_get_by_address_detailed", "(", "context", ",", "address", ",", "session", "=", "None", ")", ":", "if", "not", "session", ":", "session", "=", "get_session", "(", ")", "result", "=", "model_query", "(", "context", ",", "models", ".", "FixedIp...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/db/sqlalchemy/api.py#L1178-L1199
owid/covid-19-data
936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92
scripts/scripts/utils/db_imports.py
python
print_err
(*args, **kwargs)
return print(*args, file=sys.stderr, **kwargs)
[]
def print_err(*args, **kwargs): return print(*args, file=sys.stderr, **kwargs)
[ "def", "print_err", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "print", "(", "*", "args", ",", "file", "=", "sys", ".", "stderr", ",", "*", "*", "kwargs", ")" ]
https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/scripts/utils/db_imports.py#L36-L37
OpenEIT/OpenEIT
0448694e8092361ae5ccb45fba81dee543a6244b
OpenEIT/backend/bluetooth/old/build/dlib/Adafruit_BluefruitLE/bluez_dbus/adapter.py
python
BluezAdapter.__init__
(self, dbus_obj)
Create an instance of the bluetooth adapter from the provided bluez DBus object.
Create an instance of the bluetooth adapter from the provided bluez DBus object.
[ "Create", "an", "instance", "of", "the", "bluetooth", "adapter", "from", "the", "provided", "bluez", "DBus", "object", "." ]
def __init__(self, dbus_obj): """Create an instance of the bluetooth adapter from the provided bluez DBus object. """ self._adapter = dbus.Interface(dbus_obj, _INTERFACE) self._props = dbus.Interface(dbus_obj, 'org.freedesktop.DBus.Properties') self._scan_started = thread...
[ "def", "__init__", "(", "self", ",", "dbus_obj", ")", ":", "self", ".", "_adapter", "=", "dbus", ".", "Interface", "(", "dbus_obj", ",", "_INTERFACE", ")", "self", ".", "_props", "=", "dbus", ".", "Interface", "(", "dbus_obj", ",", "'org.freedesktop.DBus.P...
https://github.com/OpenEIT/OpenEIT/blob/0448694e8092361ae5ccb45fba81dee543a6244b/OpenEIT/backend/bluetooth/old/build/dlib/Adafruit_BluefruitLE/bluez_dbus/adapter.py#L38-L46
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/vagrant.py
python
_build_machine_uri
(machine, cwd)
return _build_sdb_uri(key)
returns string used to fetch id names from the sdb store. the cwd and machine name are concatenated with '?' which should never collide with a Salt node id -- which is important since we will be storing both in the same table.
returns string used to fetch id names from the sdb store.
[ "returns", "string", "used", "to", "fetch", "id", "names", "from", "the", "sdb", "store", "." ]
def _build_machine_uri(machine, cwd): """ returns string used to fetch id names from the sdb store. the cwd and machine name are concatenated with '?' which should never collide with a Salt node id -- which is important since we will be storing both in the same table. """ key = "{}?{}".form...
[ "def", "_build_machine_uri", "(", "machine", ",", "cwd", ")", ":", "key", "=", "\"{}?{}\"", ".", "format", "(", "machine", ",", "os", ".", "path", ".", "abspath", "(", "cwd", ")", ")", "return", "_build_sdb_uri", "(", "key", ")" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/vagrant.py#L68-L77
ShreyAmbesh/Traffic-Rule-Violation-Detection-System
ae0c327ce014ce6a427da920b5798a0d4bbf001e
metrics/coco_tools.py
python
COCOEvalWrapper.GetCategoryIdList
(self)
return self.params.catIds
Returns list of valid category ids.
Returns list of valid category ids.
[ "Returns", "list", "of", "valid", "category", "ids", "." ]
def GetCategoryIdList(self): """Returns list of valid category ids.""" return self.params.catIds
[ "def", "GetCategoryIdList", "(", "self", ")", ":", "return", "self", ".", "params", ".", "catIds" ]
https://github.com/ShreyAmbesh/Traffic-Rule-Violation-Detection-System/blob/ae0c327ce014ce6a427da920b5798a0d4bbf001e/metrics/coco_tools.py#L188-L190
jina-ai/jina
c77a492fcd5adba0fc3de5347bea83dd4e7d8087
jina/logging/profile.py
python
TimeContext.__exit__
(self, typ, value, traceback)
[]
def __exit__(self, typ, value, traceback): self.duration = self.now() self.readable_duration = get_readable_time(seconds=self.duration) self._exit_msg()
[ "def", "__exit__", "(", "self", ",", "typ", ",", "value", ",", "traceback", ")", ":", "self", ".", "duration", "=", "self", ".", "now", "(", ")", "self", ".", "readable_duration", "=", "get_readable_time", "(", "seconds", "=", "self", ".", "duration", ...
https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/logging/profile.py#L166-L171
huawei-noah/vega
d9f13deede7f2b584e4b1d32ffdb833856129989
vega/common/task_ops.py
python
TaskOps.step_name
(self, value)
Setter: set step_name with value. :param value: step name :type value: str
Setter: set step_name with value.
[ "Setter", ":", "set", "step_name", "with", "value", "." ]
def step_name(self, value): """Setter: set step_name with value. :param value: step name :type value: str """ self._step_name = value
[ "def", "step_name", "(", "self", ",", "value", ")", ":", "self", ".", "_step_name", "=", "value" ]
https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/common/task_ops.py#L254-L260
Fantomas42/django-blog-zinnia
881101a9d1d455b2fc581d6f4ae0947cdd8126c6
zinnia/signals.py
python
count_trackbacks_handler
(sender, **kwargs)
Update Entry.trackback_count when a trackback was posted.
Update Entry.trackback_count when a trackback was posted.
[ "Update", "Entry", ".", "trackback_count", "when", "a", "trackback", "was", "posted", "." ]
def count_trackbacks_handler(sender, **kwargs): """ Update Entry.trackback_count when a trackback was posted. """ entry = kwargs['entry'] entry.trackback_count = F('trackback_count') + 1 entry.save(update_fields=['trackback_count'])
[ "def", "count_trackbacks_handler", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "entry", "=", "kwargs", "[", "'entry'", "]", "entry", ".", "trackback_count", "=", "F", "(", "'trackback_count'", ")", "+", "1", "entry", ".", "save", "(", "update_fields"...
https://github.com/Fantomas42/django-blog-zinnia/blob/881101a9d1d455b2fc581d6f4ae0947cdd8126c6/zinnia/signals.py#L126-L132
tern-tools/tern
723f43dcaae2f2f0a08a63e5e8de3938031a386e
tern/analyze/default/dockerfile/parse.py
python
get_from_indices
(dfobj)
return from_lines
Given a dockerfile object, return the indices of FROM lines in the dfobj structure.
Given a dockerfile object, return the indices of FROM lines in the dfobj structure.
[ "Given", "a", "dockerfile", "object", "return", "the", "indices", "of", "FROM", "lines", "in", "the", "dfobj", "structure", "." ]
def get_from_indices(dfobj): """Given a dockerfile object, return the indices of FROM lines in the dfobj structure.""" from_lines = [] for idx, st in enumerate(dfobj.structure): if st['instruction'] == 'FROM': from_lines.append(idx) from_lines.append(len(dfobj.structure)) ret...
[ "def", "get_from_indices", "(", "dfobj", ")", ":", "from_lines", "=", "[", "]", "for", "idx", ",", "st", "in", "enumerate", "(", "dfobj", ".", "structure", ")", ":", "if", "st", "[", "'instruction'", "]", "==", "'FROM'", ":", "from_lines", ".", "append...
https://github.com/tern-tools/tern/blob/723f43dcaae2f2f0a08a63e5e8de3938031a386e/tern/analyze/default/dockerfile/parse.py#L301-L309
anymail/django-anymail
dc0a46a815d062d52660b9237627b22f89093bce
anymail/backends/base.py
python
AnymailBaseBackend.open
(self)
return False
Open and persist a connection to the ESP's API, and whether a new connection was created. Callers must ensure they later call close, if (and only if) open returns True.
Open and persist a connection to the ESP's API, and whether a new connection was created.
[ "Open", "and", "persist", "a", "connection", "to", "the", "ESP", "s", "API", "and", "whether", "a", "new", "connection", "was", "created", "." ]
def open(self): """ Open and persist a connection to the ESP's API, and whether a new connection was created. Callers must ensure they later call close, if (and only if) open returns True. """ # Subclasses should use an instance property to maintain a cached ...
[ "def", "open", "(", "self", ")", ":", "# Subclasses should use an instance property to maintain a cached", "# connection, and return True iff they initialize that instance", "# property in _this_ open call. (If the cached connection already", "# exists, just do nothing and return False.)", "#", ...
https://github.com/anymail/django-anymail/blob/dc0a46a815d062d52660b9237627b22f89093bce/anymail/backends/base.py#L43-L61
emre/storm
c752defc1b718cfffbf0e0e15532fa1d7840bf6d
storm/__main__.py
python
list
(config=None)
Lists all hosts from ssh config.
Lists all hosts from ssh config.
[ "Lists", "all", "hosts", "from", "ssh", "config", "." ]
def list(config=None): """ Lists all hosts from ssh config. """ storm_ = get_storm_instance(config) try: result = colored('Listing entries:', 'white', attrs=["bold", ]) + "\n\n" result_stack = "" for host in storm_.list_entries(True): if host.get("type") == 'ent...
[ "def", "list", "(", "config", "=", "None", ")", ":", "storm_", "=", "get_storm_instance", "(", "config", ")", "try", ":", "result", "=", "colored", "(", "'Listing entries:'", ",", "'white'", ",", "attrs", "=", "[", "\"bold\"", ",", "]", ")", "+", "\"\\...
https://github.com/emre/storm/blob/c752defc1b718cfffbf0e0e15532fa1d7840bf6d/storm/__main__.py#L190-L258
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/requests/utils.py
python
get_encoding_from_headers
(headers)
Returns encodings from given HTTP Header Dict. :param headers: dictionary to extract encoding from. :rtype: str
Returns encodings from given HTTP Header Dict.
[ "Returns", "encodings", "from", "given", "HTTP", "Header", "Dict", "." ]
def get_encoding_from_headers(headers): """Returns encodings from given HTTP Header Dict. :param headers: dictionary to extract encoding from. :rtype: str """ content_type = headers.get('content-type') if not content_type: return None content_type, params = _parse_content_type_he...
[ "def", "get_encoding_from_headers", "(", "headers", ")", ":", "content_type", "=", "headers", ".", "get", "(", "'content-type'", ")", "if", "not", "content_type", ":", "return", "None", "content_type", ",", "params", "=", "_parse_content_type_header", "(", "conten...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/requests/utils.py#L507-L529
songyingxin/python-algorithm
1c3cc9f73687f5bf291d95d4c6558d982ad98985
niuke/2_8_maximum_gap.py
python
Solution.which_bucket
(self, num, arr_len, arr_min, arr_max)
return int((num - arr_min) * arr_len / (arr_max - arr_min))
判断 num 属于第几个桶
判断 num 属于第几个桶
[ "判断", "num", "属于第几个桶" ]
def which_bucket(self, num, arr_len, arr_min, arr_max): """ 判断 num 属于第几个桶 """ return int((num - arr_min) * arr_len / (arr_max - arr_min))
[ "def", "which_bucket", "(", "self", ",", "num", ",", "arr_len", ",", "arr_min", ",", "arr_max", ")", ":", "return", "int", "(", "(", "num", "-", "arr_min", ")", "*", "arr_len", "/", "(", "arr_max", "-", "arr_min", ")", ")" ]
https://github.com/songyingxin/python-algorithm/blob/1c3cc9f73687f5bf291d95d4c6558d982ad98985/niuke/2_8_maximum_gap.py#L38-L40
tensorflow/ranking
94cccec8b4e71d2cc4489c61e2623522738c2924
tensorflow_ranking/extension/pipeline.py
python
RankingPipeline._required_hparam_keys
(self)
return required_hparam_keys
Returns a list of keys for the required hparams for RankingPipeline.
Returns a list of keys for the required hparams for RankingPipeline.
[ "Returns", "a", "list", "of", "keys", "for", "the", "required", "hparams", "for", "RankingPipeline", "." ]
def _required_hparam_keys(self): """Returns a list of keys for the required hparams for RankingPipeline.""" required_hparam_keys = [ "train_input_pattern", "eval_input_pattern", "train_batch_size", "eval_batch_size", "checkpoint_secs", "num_checkpoints", "num_train_steps", "num_eval_step...
[ "def", "_required_hparam_keys", "(", "self", ")", ":", "required_hparam_keys", "=", "[", "\"train_input_pattern\"", ",", "\"eval_input_pattern\"", ",", "\"train_batch_size\"", ",", "\"eval_batch_size\"", ",", "\"checkpoint_secs\"", ",", "\"num_checkpoints\"", ",", "\"num_tr...
https://github.com/tensorflow/ranking/blob/94cccec8b4e71d2cc4489c61e2623522738c2924/tensorflow_ranking/extension/pipeline.py#L180-L188
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/encodings/iso8859_6.py
python
Codec.encode
(self,input,errors='strict')
return codecs.charmap_encode(input,errors,encoding_table)
[]
def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table)
[ "def", "encode", "(", "self", ",", "input", ",", "errors", "=", "'strict'", ")", ":", "return", "codecs", ".", "charmap_encode", "(", "input", ",", "errors", ",", "encoding_table", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/encodings/iso8859_6.py#L11-L12
Guanghan/lighttrack
a980585acb4189da12f5d3dec68b5c3cd1b69de9
lib/lib_kernel/lib_nms/setup.py
python
locate_cuda
()
return cudaconfig
Locate the CUDA environment on the system Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64' and values giving the absolute path to each directory. Starts by looking for the CUDAHOME env variable. If not found, everything is based on finding 'nvcc' in the PATH.
Locate the CUDA environment on the system
[ "Locate", "the", "CUDA", "environment", "on", "the", "system" ]
def locate_cuda(): """Locate the CUDA environment on the system Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64' and values giving the absolute path to each directory. Starts by looking for the CUDAHOME env variable. If not found, everything is based on finding 'nvcc' in the PATH. ...
[ "def", "locate_cuda", "(", ")", ":", "# first check if the CUDAHOME env variable is in use", "if", "'CUDAHOME'", "in", "os", ".", "environ", ":", "home", "=", "os", ".", "environ", "[", "'CUDAHOME'", "]", "nvcc", "=", "pjoin", "(", "home", ",", "'bin'", ",", ...
https://github.com/Guanghan/lighttrack/blob/a980585acb4189da12f5d3dec68b5c3cd1b69de9/lib/lib_kernel/lib_nms/setup.py#L27-L57
Ridter/acefile
31f90219fb560364b6f5d27f512fccfae81d04f4
acefile.py
python
Pic.classinit_pic_dif_bit_width
(cls)
return cls
Decorator that adds the PIC dif_bit_width static table to *cls*.
Decorator that adds the PIC dif_bit_width static table to *cls*.
[ "Decorator", "that", "adds", "the", "PIC", "dif_bit_width", "static", "table", "to", "*", "cls", "*", "." ]
def classinit_pic_dif_bit_width(cls): """ Decorator that adds the PIC dif_bit_width static table to *cls*. """ cls._dif_bit_width = [] for i in range(0, 128): cls._dif_bit_width.append((2 * i).bit_length()) for i in range(-128, 0): cls._dif_bit_wid...
[ "def", "classinit_pic_dif_bit_width", "(", "cls", ")", ":", "cls", ".", "_dif_bit_width", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "128", ")", ":", "cls", ".", "_dif_bit_width", ".", "append", "(", "(", "2", "*", "i", ")", ".", "bit...
https://github.com/Ridter/acefile/blob/31f90219fb560364b6f5d27f512fccfae81d04f4/acefile.py#L1839-L1848
zaxlct/imooc-django
daf1ced745d3d21989e8191b658c293a511b37fd
apps/users/views.py
python
UserInfoView.get
(self, request)
return render(request, 'usercenter-info.html')
[]
def get(self, request): return render(request, 'usercenter-info.html')
[ "def", "get", "(", "self", ",", "request", ")", ":", "return", "render", "(", "request", ",", "'usercenter-info.html'", ")" ]
https://github.com/zaxlct/imooc-django/blob/daf1ced745d3d21989e8191b658c293a511b37fd/apps/users/views.py#L181-L182
WenmuZhou/DBNet.pytorch
678b2ae55e018c6c16d5ac182558517a154a91ed
utils/cal_recall/script.py
python
evaluate_method
(gtFilePath, submFilePath, evaluationParams)
return resDict
Method evaluate_method: evaluate method and returns the results Results. Dictionary with the following values: - method (required) Global method metrics. Ex: { 'Precision':0.8,'Recall':0.9 } - samples (optional) Per sample metrics. Ex: {'sample1' : { 'Precision':0.8,'Recall':0.9 } , 'sample2' :...
Method evaluate_method: evaluate method and returns the results Results. Dictionary with the following values: - method (required) Global method metrics. Ex: { 'Precision':0.8,'Recall':0.9 } - samples (optional) Per sample metrics. Ex: {'sample1' : { 'Precision':0.8,'Recall':0.9 } , 'sample2' :...
[ "Method", "evaluate_method", ":", "evaluate", "method", "and", "returns", "the", "results", "Results", ".", "Dictionary", "with", "the", "following", "values", ":", "-", "method", "(", "required", ")", "Global", "method", "metrics", ".", "Ex", ":", "{", "Pre...
def evaluate_method(gtFilePath, submFilePath, evaluationParams): """ Method evaluate_method: evaluate method and returns the results Results. Dictionary with the following values: - method (required) Global method metrics. Ex: { 'Precision':0.8,'Recall':0.9 } - samples (optional) Per sa...
[ "def", "evaluate_method", "(", "gtFilePath", ",", "submFilePath", ",", "evaluationParams", ")", ":", "def", "polygon_from_points", "(", "points", ")", ":", "\"\"\"\n Returns a Polygon object to use with the Polygon2 class from a list of 8 points: x1,y1,x2,y2,x3,y3,x4,y4\n ...
https://github.com/WenmuZhou/DBNet.pytorch/blob/678b2ae55e018c6c16d5ac182558517a154a91ed/utils/cal_recall/script.py#L48-L317
ni/nidaqmx-python
62fc6b48cbbb330fe1bcc9aedadc86610a1269b6
nidaqmx/_task_modules/export_signals.py
python
ExportSignals.samp_clk_delay_offset
(self)
return val.value
float: Specifies in seconds the amount of time to offset the exported Sample clock. Refer to timing diagrams for generation applications in the device documentation for more information about this value.
float: Specifies in seconds the amount of time to offset the exported Sample clock. Refer to timing diagrams for generation applications in the device documentation for more information about this value.
[ "float", ":", "Specifies", "in", "seconds", "the", "amount", "of", "time", "to", "offset", "the", "exported", "Sample", "clock", ".", "Refer", "to", "timing", "diagrams", "for", "generation", "applications", "in", "the", "device", "documentation", "for", "more...
def samp_clk_delay_offset(self): """ float: Specifies in seconds the amount of time to offset the exported Sample clock. Refer to timing diagrams for generation applications in the device documentation for more information about this value. """ val = ...
[ "def", "samp_clk_delay_offset", "(", "self", ")", ":", "val", "=", "ctypes", ".", "c_double", "(", ")", "cfunc", "=", "lib_importer", ".", "windll", ".", "DAQmxGetExportedSampClkDelayOffset", "if", "cfunc", ".", "argtypes", "is", "None", ":", "with", "cfunc", ...
https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/export_signals.py#L2196-L2217
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/StringIO.py
python
StringIO.seek
(self, pos, mode = 0)
Set the file's current position. The mode argument is optional and defaults to 0 (absolute file positioning); other values are 1 (seek relative to the current position) and 2 (seek relative to the file's end). There is no return value.
Set the file's current position.
[ "Set", "the", "file", "s", "current", "position", "." ]
def seek(self, pos, mode = 0): """Set the file's current position. The mode argument is optional and defaults to 0 (absolute file positioning); other values are 1 (seek relative to the current position) and 2 (seek relative to the file's end). There is no return value. ...
[ "def", "seek", "(", "self", ",", "pos", ",", "mode", "=", "0", ")", ":", "_complain_ifclosed", "(", "self", ".", "closed", ")", "if", "self", ".", "buflist", ":", "self", ".", "buf", "+=", "''", ".", "join", "(", "self", ".", "buflist", ")", "sel...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/StringIO.py#L95-L112
coderSkyChen/Action_Recognition_Zoo
92ec5ec3efeee852aec5c057798298cd3a8e58ae
model_zoo/models/neural_gpu/neural_gpu.py
python
make_dense
(targets, noclass)
return tf.reshape(dense, [-1, noclass])
Move a batch of targets to a dense 1-hot representation.
Move a batch of targets to a dense 1-hot representation.
[ "Move", "a", "batch", "of", "targets", "to", "a", "dense", "1", "-", "hot", "representation", "." ]
def make_dense(targets, noclass): """Move a batch of targets to a dense 1-hot representation.""" with tf.device("/cpu:0"): shape = tf.shape(targets) batch_size = shape[0] indices = targets + noclass * tf.range(0, batch_size) length = tf.expand_dims(batch_size * noclass, 0) dense = tf.sparse_to_d...
[ "def", "make_dense", "(", "targets", ",", "noclass", ")", ":", "with", "tf", ".", "device", "(", "\"/cpu:0\"", ")", ":", "shape", "=", "tf", ".", "shape", "(", "targets", ")", "batch_size", "=", "shape", "[", "0", "]", "indices", "=", "targets", "+",...
https://github.com/coderSkyChen/Action_Recognition_Zoo/blob/92ec5ec3efeee852aec5c057798298cd3a8e58ae/model_zoo/models/neural_gpu/neural_gpu.py#L119-L127
tschellenbach/Django-facebook
fecbb5dd4931cc03a8425bde84e5e7b1ba22786d
docs/docs_env/Lib/posixpath.py
python
isfile
(path)
return stat.S_ISREG(st.st_mode)
Test whether a path is a regular file
Test whether a path is a regular file
[ "Test", "whether", "a", "path", "is", "a", "regular", "file" ]
def isfile(path): """Test whether a path is a regular file""" try: st = os.stat(path) except os.error: return False return stat.S_ISREG(st.st_mode)
[ "def", "isfile", "(", "path", ")", ":", "try", ":", "st", "=", "os", ".", "stat", "(", "path", ")", "except", "os", ".", "error", ":", "return", "False", "return", "stat", ".", "S_ISREG", "(", "st", ".", "st_mode", ")" ]
https://github.com/tschellenbach/Django-facebook/blob/fecbb5dd4931cc03a8425bde84e5e7b1ba22786d/docs/docs_env/Lib/posixpath.py#L205-L211
barneygale/quarry
eac47471fc55598de6b4723a728a37d035002237
quarry/types/buffer/v1_13_2.py
python
Buffer1_13_2.unpack_slot
(self)
return slot
Unpacks a slot.
Unpacks a slot.
[ "Unpacks", "a", "slot", "." ]
def unpack_slot(self): """ Unpacks a slot. """ slot = {} item_id = self.unpack_optional(self.unpack_varint) if item_id is None: slot['item'] = None else: slot['item'] = self.registry.decode('minecraft:item', item_id) slot['coun...
[ "def", "unpack_slot", "(", "self", ")", ":", "slot", "=", "{", "}", "item_id", "=", "self", ".", "unpack_optional", "(", "self", ".", "unpack_varint", ")", "if", "item_id", "is", "None", ":", "slot", "[", "'item'", "]", "=", "None", "else", ":", "slo...
https://github.com/barneygale/quarry/blob/eac47471fc55598de6b4723a728a37d035002237/quarry/types/buffer/v1_13_2.py#L20-L33
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/core/index.py
python
Index.get_level_values
(self, level)
return self
Return vector of label values for requested level, equal to the length of the index Parameters ---------- level : int Returns ------- values : ndarray
Return vector of label values for requested level, equal to the length of the index
[ "Return", "vector", "of", "label", "values", "for", "requested", "level", "equal", "to", "the", "length", "of", "the", "index" ]
def get_level_values(self, level): """ Return vector of label values for requested level, equal to the length of the index Parameters ---------- level : int Returns ------- values : ndarray """ # checks that level number is actual...
[ "def", "get_level_values", "(", "self", ",", "level", ")", ":", "# checks that level number is actually just 1", "self", ".", "_validate_index_level", "(", "level", ")", "return", "self" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/core/index.py#L1754-L1769
salabim/salabim
e0de846b042daf2dc71aaf43d8adc6486b57f376
salabim_exp.py
python
test107
()
[]
def test107(): env = sim.Environment() mylist = [1, 2, 3, 400] m = sim.Monitor("Test", type="int8", fill=mylist) m.print_histogram() print(m._t) print(m._x)
[ "def", "test107", "(", ")", ":", "env", "=", "sim", ".", "Environment", "(", ")", "mylist", "=", "[", "1", ",", "2", ",", "3", ",", "400", "]", "m", "=", "sim", ".", "Monitor", "(", "\"Test\"", ",", "type", "=", "\"int8\"", ",", "fill", "=", ...
https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim_exp.py#L1056-L1062
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/collections.py
python
OrderedDict.iterkeys
(self)
return iter(self)
od.iterkeys() -> an iterator over the keys in od
od.iterkeys() -> an iterator over the keys in od
[ "od", ".", "iterkeys", "()", "-", ">", "an", "iterator", "over", "the", "keys", "in", "od" ]
def iterkeys(self): 'od.iterkeys() -> an iterator over the keys in od' return iter(self)
[ "def", "iterkeys", "(", "self", ")", ":", "return", "iter", "(", "self", ")" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/collections.py#L115-L117
GalSim-developers/GalSim
a05d4ec3b8d8574f99d3b0606ad882cbba53f345
galsim/catalog.py
python
OutputCatalog.makeData
(self)
return data
Returns a numpy array of the data as it should be written to an output file.
Returns a numpy array of the data as it should be written to an output file.
[ "Returns", "a", "numpy", "array", "of", "the", "data", "as", "it", "should", "be", "written", "to", "an", "output", "file", "." ]
def makeData(self): """Returns a numpy array of the data as it should be written to an output file. """ from .angle import Angle from .position import PositionD, PositionI from .shear import Shear cols = zip(*self.rows) dtypes = [] new_cols = [] ...
[ "def", "makeData", "(", "self", ")", ":", "from", ".", "angle", "import", "Angle", "from", ".", "position", "import", "PositionD", ",", "PositionI", "from", ".", "shear", "import", "Shear", "cols", "=", "zip", "(", "*", "self", ".", "rows", ")", "dtype...
https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/galsim/catalog.py#L470-L519
numenta/numenta-apps
02903b0062c89c2c259b533eea2df6e8bb44eaf3
taurus_metric_collectors/taurus_metric_collectors/metric_utils.py
python
createAllModels
(host, apiKey, onlyMetricNames=None)
return allModels
Create models corresponding to all metrics in the metrics configuration. NOTE: Has no effect on metrics that have already been promoted to models. :param str host: API server's hostname or IP address :param str apiKey: API server's API Key :param onlyMetricNames: None to create models for all configured metri...
Create models corresponding to all metrics in the metrics configuration.
[ "Create", "models", "corresponding", "to", "all", "metrics", "in", "the", "metrics", "configuration", "." ]
def createAllModels(host, apiKey, onlyMetricNames=None): """ Create models corresponding to all metrics in the metrics configuration. NOTE: Has no effect on metrics that have already been promoted to models. :param str host: API server's hostname or IP address :param str apiKey: API server's API Key :param ...
[ "def", "createAllModels", "(", "host", ",", "apiKey", ",", "onlyMetricNames", "=", "None", ")", ":", "metricsConfig", "=", "getMetricsConfiguration", "(", ")", "configuredMetricNames", "=", "set", "(", "getMetricNamesFromConfig", "(", "metricsConfig", ")", ")", "i...
https://github.com/numenta/numenta-apps/blob/02903b0062c89c2c259b533eea2df6e8bb44eaf3/taurus_metric_collectors/taurus_metric_collectors/metric_utils.py#L275-L356
translate/pootle
742c08fce1a0dc16e6ab8d2494eb867c8879205d
pootle/apps/pootle_translationproject/utils.py
python
TPTool.update_children
(self, source_dir, target_dir)
Update a target Directory and its children from a given source Directory
Update a target Directory and its children from a given source Directory
[ "Update", "a", "target", "Directory", "and", "its", "children", "from", "a", "given", "source", "Directory" ]
def update_children(self, source_dir, target_dir): """Update a target Directory and its children from a given source Directory """ stores = [] dirs = [] source_stores = source_dir.child_stores.select_related( "filetype__extension", "filetype__templ...
[ "def", "update_children", "(", "self", ",", "source_dir", ",", "target_dir", ")", ":", "stores", "=", "[", "]", "dirs", "=", "[", "]", "source_stores", "=", "source_dir", ".", "child_stores", ".", "select_related", "(", "\"filetype__extension\"", ",", "\"filet...
https://github.com/translate/pootle/blob/742c08fce1a0dc16e6ab8d2494eb867c8879205d/pootle/apps/pootle_translationproject/utils.py#L222-L253
plone/guillotina
57ad54988f797a93630e424fd4b6a75fa26410af
guillotina/component/interfaces.py
python
IComponentArchitecture.get_adapters
(objects, provided, context=None)
Look for all matching adapters to a provided interface for objects Return a list of adapters that match. If an adapter is named, only the most specific adapter of a given name is returned. If context is None, an application-defined policy is used to choose an appropriate service manage...
Look for all matching adapters to a provided interface for objects
[ "Look", "for", "all", "matching", "adapters", "to", "a", "provided", "interface", "for", "objects" ]
def get_adapters(objects, provided, context=None): """Look for all matching adapters to a provided interface for objects Return a list of adapters that match. If an adapter is named, only the most specific adapter of a given name is returned. If context is None, an application-defined ...
[ "def", "get_adapters", "(", "objects", ",", "provided", ",", "context", "=", "None", ")", ":" ]
https://github.com/plone/guillotina/blob/57ad54988f797a93630e424fd4b6a75fa26410af/guillotina/component/interfaces.py#L166-L178
Huangying-Zhan/DF-VO
6a2ec43fc6209d9058ae1709d779c5ada68a31f3
tools/generate_flow_prediction.py
python
initialize_deep_flow_model
(h, w, weight)
return flow_net
Initialize optical flow network Args: h (int): image height w (int): image width Returns: flow_net (nn.Module): optical flow network
Initialize optical flow network
[ "Initialize", "optical", "flow", "network" ]
def initialize_deep_flow_model(h, w, weight): """Initialize optical flow network Args: h (int): image height w (int): image width Returns: flow_net (nn.Module): optical flow network """ flow_net = LiteFlow(h, w) flow_net.initialize_network_model( weight_...
[ "def", "initialize_deep_flow_model", "(", "h", ",", "w", ",", "weight", ")", ":", "flow_net", "=", "LiteFlow", "(", "h", ",", "w", ")", "flow_net", ".", "initialize_network_model", "(", "weight_path", "=", "weight", ")", "return", "flow_net" ]
https://github.com/Huangying-Zhan/DF-VO/blob/6a2ec43fc6209d9058ae1709d779c5ada68a31f3/tools/generate_flow_prediction.py#L47-L61
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/urllib3/util/url.py
python
parse_url
(url)
return Url( scheme=ensure_type(scheme), auth=ensure_type(auth), host=ensure_type(host), port=port, path=ensure_type(path), query=ensure_type(query), fragment=ensure_type(fragment), )
Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is performed to parse incomplete urls. Fields not provided will be None. This parser is RFC 3986 compliant. The parser logic and helper functions are based heavily on work done in the ``rfc3986`` module. :param str url: URL to pars...
Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is performed to parse incomplete urls. Fields not provided will be None. This parser is RFC 3986 compliant.
[ "Given", "a", "url", "return", "a", "parsed", ":", "class", ":", ".", "Url", "namedtuple", ".", "Best", "-", "effort", "is", "performed", "to", "parse", "incomplete", "urls", ".", "Fields", "not", "provided", "will", "be", "None", ".", "This", "parser", ...
def parse_url(url): """ Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is performed to parse incomplete urls. Fields not provided will be None. This parser is RFC 3986 compliant. The parser logic and helper functions are based heavily on work done in the ``rfc3986`` module. ...
[ "def", "parse_url", "(", "url", ")", ":", "if", "not", "url", ":", "# Empty", "return", "Url", "(", ")", "source_url", "=", "url", "if", "not", "SCHEME_RE", ".", "search", "(", "url", ")", ":", "url", "=", "\"//\"", "+", "url", "try", ":", "scheme"...
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/urllib3/util/url.py#L330-L424
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/released/work/work_client.py
python
WorkClient.update_team_settings
(self, team_settings_patch, team_context)
return self._deserialize('TeamSetting', response)
UpdateTeamSettings. Update a team's settings :param :class:`<TeamSettingsPatch> <azure.devops.v5_1.work.models.TeamSettingsPatch>` team_settings_patch: TeamSettings changes :param :class:`<TeamContext> <azure.devops.v5_1.work.models.TeamContext>` team_context: The team context for the operation ...
UpdateTeamSettings. Update a team's settings :param :class:`<TeamSettingsPatch> <azure.devops.v5_1.work.models.TeamSettingsPatch>` team_settings_patch: TeamSettings changes :param :class:`<TeamContext> <azure.devops.v5_1.work.models.TeamContext>` team_context: The team context for the operation ...
[ "UpdateTeamSettings", ".", "Update", "a", "team", "s", "settings", ":", "param", ":", "class", ":", "<TeamSettingsPatch", ">", "<azure", ".", "devops", ".", "v5_1", ".", "work", ".", "models", ".", "TeamSettingsPatch", ">", "team_settings_patch", ":", "TeamSet...
def update_team_settings(self, team_settings_patch, team_context): """UpdateTeamSettings. Update a team's settings :param :class:`<TeamSettingsPatch> <azure.devops.v5_1.work.models.TeamSettingsPatch>` team_settings_patch: TeamSettings changes :param :class:`<TeamContext> <azure.devops.v5...
[ "def", "update_team_settings", "(", "self", ",", "team_settings_patch", ",", "team_context", ")", ":", "project", "=", "None", "team", "=", "None", "if", "team_context", "is", "not", "None", ":", "if", "team_context", ".", "project_id", ":", "project", "=", ...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/released/work/work_client.py#L1098-L1128
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/wled/coordinator.py
python
WLEDDataUpdateCoordinator._async_update_data
(self)
return device
Fetch data from WLED.
Fetch data from WLED.
[ "Fetch", "data", "from", "WLED", "." ]
async def _async_update_data(self) -> WLEDDevice: """Fetch data from WLED.""" try: device = await self.wled.update(full_update=not self.last_update_success) except WLEDError as error: raise UpdateFailed(f"Invalid response from API: {error}") from error # If the d...
[ "async", "def", "_async_update_data", "(", "self", ")", "->", "WLEDDevice", ":", "try", ":", "device", "=", "await", "self", ".", "wled", ".", "update", "(", "full_update", "=", "not", "self", ".", "last_update_success", ")", "except", "WLEDError", "as", "...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/wled/coordinator.py#L106-L121
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/pdb.py
python
Pdb.do_commands
(self, arg)
commands [bpnumber] (com) ... (com) end (Pdb) Specify a list of commands for breakpoint number bpnumber. The commands themselves are entered on the following lines. Type a line containing just 'end' to terminate the commands. The commands are executed when the br...
commands [bpnumber] (com) ... (com) end (Pdb)
[ "commands", "[", "bpnumber", "]", "(", "com", ")", "...", "(", "com", ")", "end", "(", "Pdb", ")" ]
def do_commands(self, arg): """commands [bpnumber] (com) ... (com) end (Pdb) Specify a list of commands for breakpoint number bpnumber. The commands themselves are entered on the following lines. Type a line containing just 'end' to terminate the commands. ...
[ "def", "do_commands", "(", "self", ",", "arg", ")", ":", "if", "not", "arg", ":", "bnum", "=", "len", "(", "bdb", ".", "Breakpoint", ".", "bpbynumber", ")", "-", "1", "else", ":", "try", ":", "bnum", "=", "int", "(", "arg", ")", "except", ":", ...
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/pdb.py#L511-L586
dropbox/pyannotate
a7a46f394f0ba91a1b5fbf657e2393af542969ae
pyannotate_runtime/collect_types.py
python
TentativeType.merge
(self, other)
Merge two TentativeType instances
Merge two TentativeType instances
[ "Merge", "two", "TentativeType", "instances" ]
def merge(self, other): # type: (TentativeType) -> None """ Merge two TentativeType instances """ for hashables in other.types_hashable: self.add(hashables) for non_hashbles in other.types: self.add(non_hashbles)
[ "def", "merge", "(", "self", ",", "other", ")", ":", "# type: (TentativeType) -> None", "for", "hashables", "in", "other", ".", "types_hashable", ":", "self", ".", "add", "(", "hashables", ")", "for", "non_hashbles", "in", "other", ".", "types", ":", "self",...
https://github.com/dropbox/pyannotate/blob/a7a46f394f0ba91a1b5fbf657e2393af542969ae/pyannotate_runtime/collect_types.py#L369-L377
cylc/cylc-flow
5ec221143476c7c616c156b74158edfbcd83794a
cylc/flow/task_pool.py
python
TaskPool.can_spawn
(self, name: str, point: 'PointBase')
return True
Return True if name.point is within various workflow limits.
Return True if name.point is within various workflow limits.
[ "Return", "True", "if", "name", ".", "point", "is", "within", "various", "workflow", "limits", "." ]
def can_spawn(self, name: str, point: 'PointBase') -> bool: """Return True if name.point is within various workflow limits.""" if name not in self.config.get_task_name_list(): LOG.debug('No task definition %s', name) return False # Don't spawn outside of graph limits. ...
[ "def", "can_spawn", "(", "self", ",", "name", ":", "str", ",", "point", ":", "'PointBase'", ")", "->", "bool", ":", "if", "name", "not", "in", "self", ".", "config", ".", "get_task_name_list", "(", ")", ":", "LOG", ".", "debug", "(", "'No task definiti...
https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/task_pool.py#L1273-L1292
INK-USC/KagNet
b386661ac5841774b9d17cc132e991a7bef3c5ef
baselines/pytorch-pretrained-BERT/pytorch_pretrained_bert/modeling_transfo_xl.py
python
TransfoXLPreTrainedModel.init_weight
(self, weight)
[]
def init_weight(self, weight): if self.config.init == 'uniform': nn.init.uniform_(weight, -self.config.init_range, self.config.init_range) elif self.config.init == 'normal': nn.init.normal_(weight, 0.0, self.config.init_std)
[ "def", "init_weight", "(", "self", ",", "weight", ")", ":", "if", "self", ".", "config", ".", "init", "==", "'uniform'", ":", "nn", ".", "init", ".", "uniform_", "(", "weight", ",", "-", "self", ".", "config", ".", "init_range", ",", "self", ".", "...
https://github.com/INK-USC/KagNet/blob/b386661ac5841774b9d17cc132e991a7bef3c5ef/baselines/pytorch-pretrained-BERT/pytorch_pretrained_bert/modeling_transfo_xl.py#L831-L835
santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning
97ff2ae3ba9f2d478e174444c4e0f5349f28c319
texar_repo/examples/bert/utils/data_utils.py
python
SSTProcessor.get_labels
(self)
return ["0", "1"]
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_labels(self): """See base class.""" return ["0", "1"]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "\"0\"", ",", "\"1\"", "]" ]
https://github.com/santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning/blob/97ff2ae3ba9f2d478e174444c4e0f5349f28c319/texar_repo/examples/bert/utils/data_utils.py#L106-L108
alan-turing-institute/CleverCSV
a7c7c812f2dc220b8f45f3409daac6e933bc44a2
clevercsv/utils.py
python
sha1sum
(filename)
return hasher.hexdigest()
Compute the SHA1 checksum of a given file Parameters ---------- filename : str Path to a file Returns ------- checksum : str The SHA1 checksum of the file contents.
Compute the SHA1 checksum of a given file
[ "Compute", "the", "SHA1", "checksum", "of", "a", "given", "file" ]
def sha1sum(filename): """Compute the SHA1 checksum of a given file Parameters ---------- filename : str Path to a file Returns ------- checksum : str The SHA1 checksum of the file contents. """ blocksize = 1 << 16 hasher = hashlib.sha1() with open(filename,...
[ "def", "sha1sum", "(", "filename", ")", ":", "blocksize", "=", "1", "<<", "16", "hasher", "=", "hashlib", ".", "sha1", "(", ")", "with", "open", "(", "filename", ",", "\"rb\"", ")", "as", "fp", ":", "buf", "=", "fp", ".", "read", "(", "blocksize", ...
https://github.com/alan-turing-institute/CleverCSV/blob/a7c7c812f2dc220b8f45f3409daac6e933bc44a2/clevercsv/utils.py#L21-L41
khalim19/gimp-plugin-export-layers
b37255f2957ad322f4d332689052351cdea6e563
export_layers/pygimplib/_lib/python_standard_modules/logging/__init__.py
python
captureWarnings
(capture)
If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations.
If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations.
[ "If", "capture", "is", "true", "redirect", "all", "warnings", "to", "the", "logging", "package", ".", "If", "capture", "is", "False", "ensure", "that", "warnings", "are", "not", "redirected", "to", "logging", "but", "to", "their", "original", "destinations", ...
def captureWarnings(capture): """ If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations. """ global _warnings_showwarning if capture: if _warnings_showwarning is Non...
[ "def", "captureWarnings", "(", "capture", ")", ":", "global", "_warnings_showwarning", "if", "capture", ":", "if", "_warnings_showwarning", "is", "None", ":", "_warnings_showwarning", "=", "warnings", ".", "showwarning", "warnings", ".", "showwarning", "=", "_showwa...
https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/python_standard_modules/logging/__init__.py#L1730-L1744
linkchecker/linkchecker
d1078ed8480e5cfc4264d0dbf026b45b45aede4d
linkcheck/log.py
python
warn
(logname, msg, *args, **kwargs)
Log a warning. return: None
Log a warning.
[ "Log", "a", "warning", "." ]
def warn(logname, msg, *args, **kwargs): """Log a warning. return: None """ log = logging.getLogger(logname) if log.isEnabledFor(logging.WARN): _log(log.warning, msg, args, **kwargs)
[ "def", "warn", "(", "logname", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "logname", ")", "if", "log", ".", "isEnabledFor", "(", "logging", ".", "WARN", ")", ":", "_log", "(", "l...
https://github.com/linkchecker/linkchecker/blob/d1078ed8480e5cfc4264d0dbf026b45b45aede4d/linkcheck/log.py#L95-L102
fabioz/PyDev.Debugger
0f8c02a010fe5690405da1dd30ed72326191ce63
_pydevd_bundle/pydevd_daemon_thread.py
python
PyDBDaemonThread.__init__
(self, py_db, target_and_args=None)
:param target_and_args: tuple(func, args, kwargs) if this should be a function and args to run. -- Note: use through run_as_pydevd_daemon_thread().
:param target_and_args: tuple(func, args, kwargs) if this should be a function and args to run. -- Note: use through run_as_pydevd_daemon_thread().
[ ":", "param", "target_and_args", ":", "tuple", "(", "func", "args", "kwargs", ")", "if", "this", "should", "be", "a", "function", "and", "args", "to", "run", ".", "--", "Note", ":", "use", "through", "run_as_pydevd_daemon_thread", "()", "." ]
def __init__(self, py_db, target_and_args=None): ''' :param target_and_args: tuple(func, args, kwargs) if this should be a function and args to run. -- Note: use through run_as_pydevd_daemon_thread(). ''' threading.Thread.__init__(self) notify_about_gevent...
[ "def", "__init__", "(", "self", ",", "py_db", ",", "target_and_args", "=", "None", ")", ":", "threading", ".", "Thread", ".", "__init__", "(", "self", ")", "notify_about_gevent_if_needed", "(", ")", "self", ".", "_py_db", "=", "weakref", ".", "ref", "(", ...
https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/_pydevd_bundle/pydevd_daemon_thread.py#L19-L30
insanum/sncli
c34729c6c286b924eb9ab72a2a5ec4f950465e57
simplenote_cli/simplenote.py
python
Simplenote.authenticate
(self, user: str, password: str)
return api
Method to get simplenote auth token Arguments: - user (string): simplenote email address - password (string): simplenote password Returns: Simplenote API instance
Method to get simplenote auth token
[ "Method", "to", "get", "simplenote", "auth", "token" ]
def authenticate(self, user: str, password: str) -> Api: """ Method to get simplenote auth token Arguments: - user (string): simplenote email address - password (string): simplenote password Returns: Simplenote API instance """ token = ...
[ "def", "authenticate", "(", "self", ",", "user", ":", "str", ",", "password", ":", "str", ")", "->", "Api", ":", "token", "=", "self", ".", "auth", ".", "authorize", "(", "user", ",", "password", ")", "api", "=", "Api", "(", "SIMPLENOTE_APP_ID", ",",...
https://github.com/insanum/sncli/blob/c34729c6c286b924eb9ab72a2a5ec4f950465e57/simplenote_cli/simplenote.py#L77-L92
gkrizek/bash-lambda-layer
703b0ade8174022d44779d823172ab7ac33a5505
bin/docutils/statemachine.py
python
StateMachine.at_eof
(self)
return self.line_offset >= len(self.input_lines) - 1
Return 1 if the input is at or past end-of-file.
Return 1 if the input is at or past end-of-file.
[ "Return", "1", "if", "the", "input", "is", "at", "or", "past", "end", "-", "of", "-", "file", "." ]
def at_eof(self): """Return 1 if the input is at or past end-of-file.""" return self.line_offset >= len(self.input_lines) - 1
[ "def", "at_eof", "(", "self", ")", ":", "return", "self", ".", "line_offset", ">=", "len", "(", "self", ".", "input_lines", ")", "-", "1" ]
https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/statemachine.py#L322-L324
odlgroup/odl
0b088df8dc4621c68b9414c3deff9127f4c4f11d
odl/util/ufuncs.py
python
ProductSpaceUfuncs.sum
(self)
return np.sum(results)
Return the sum of ``self``. See Also -------- numpy.sum prod
Return the sum of ``self``.
[ "Return", "the", "sum", "of", "self", "." ]
def sum(self): """Return the sum of ``self``. See Also -------- numpy.sum prod """ results = [x.ufuncs.sum() for x in self.elem] return np.sum(results)
[ "def", "sum", "(", "self", ")", ":", "results", "=", "[", "x", ".", "ufuncs", ".", "sum", "(", ")", "for", "x", "in", "self", ".", "elem", "]", "return", "np", ".", "sum", "(", "results", ")" ]
https://github.com/odlgroup/odl/blob/0b088df8dc4621c68b9414c3deff9127f4c4f11d/odl/util/ufuncs.py#L255-L264