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
Georce/lepus
5b01bae82b5dc1df00c9e058989e2eb9b89ff333
lepus/pymongo-2.7/ez_setup.py
python
download_file_insecure
(url, target)
Use Python to download the file, even though it cannot authenticate the connection.
Use Python to download the file, even though it cannot authenticate the connection.
[ "Use", "Python", "to", "download", "the", "file", "even", "though", "it", "cannot", "authenticate", "the", "connection", "." ]
def download_file_insecure(url, target): """ Use Python to download the file, even though it cannot authenticate the connection. """ try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen src = dst = None try: src = urlopen(url) ...
[ "def", "download_file_insecure", "(", "url", ",", "target", ")", ":", "try", ":", "from", "urllib", ".", "request", "import", "urlopen", "except", "ImportError", ":", "from", "urllib2", "import", "urlopen", "src", "=", "dst", "=", "None", "try", ":", "src"...
https://github.com/Georce/lepus/blob/5b01bae82b5dc1df00c9e058989e2eb9b89ff333/lepus/pymongo-2.7/ez_setup.py#L231-L252
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/MemoryView.py
python
put_acquire_memoryviewslice
(lhs_cname, lhs_type, lhs_pos, rhs, code, have_gil=False, first_assignment=True)
We can avoid decreffing the lhs if we know it is the first assignment
We can avoid decreffing the lhs if we know it is the first assignment
[ "We", "can", "avoid", "decreffing", "the", "lhs", "if", "we", "know", "it", "is", "the", "first", "assignment" ]
def put_acquire_memoryviewslice(lhs_cname, lhs_type, lhs_pos, rhs, code, have_gil=False, first_assignment=True): "We can avoid decreffing the lhs if we know it is the first assignment" assert rhs.type.is_memoryviewslice pretty_rhs = rhs.result_in_temp() or rhs.is_simple() ...
[ "def", "put_acquire_memoryviewslice", "(", "lhs_cname", ",", "lhs_type", ",", "lhs_pos", ",", "rhs", ",", "code", ",", "have_gil", "=", "False", ",", "first_assignment", "=", "True", ")", ":", "assert", "rhs", ".", "type", ".", "is_memoryviewslice", "pretty_rh...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/MemoryView.py#L86-L104
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/ext/mapreduce/shuffler.py
python
_HashingGCSOutputWriter.__init__
(self, filehandles)
Constructor. Args: filehandles: list of file handles that this writer outputs to.
Constructor.
[ "Constructor", "." ]
def __init__(self, filehandles): """Constructor. Args: filehandles: list of file handles that this writer outputs to. """ self._filehandles = filehandles self._pools = [None] * len(filehandles)
[ "def", "__init__", "(", "self", ",", "filehandles", ")", ":", "self", ".", "_filehandles", "=", "filehandles", "self", ".", "_pools", "=", "[", "None", "]", "*", "len", "(", "filehandles", ")" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/mapreduce/shuffler.py#L435-L442
viblo/pymunk
77647ca037d5ceabd728f20f37d2da8a3bfb73a0
pymunk/space.py
python
Space._remove_body
(self, body: "Body")
Removes a body from the space
Removes a body from the space
[ "Removes", "a", "body", "from", "the", "space" ]
def _remove_body(self, body: "Body") -> None: """Removes a body from the space""" assert body in self._bodies, "body not in space, already removed?" body._space = None # During GC at program exit sometimes the shape might already be removed. Then skip this step. if cp.cpSpaceCont...
[ "def", "_remove_body", "(", "self", ",", "body", ":", "\"Body\"", ")", "->", "None", ":", "assert", "body", "in", "self", ".", "_bodies", ",", "\"body not in space, already removed?\"", "body", ".", "_space", "=", "None", "# During GC at program exit sometimes the s...
https://github.com/viblo/pymunk/blob/77647ca037d5ceabd728f20f37d2da8a3bfb73a0/pymunk/space.py#L476-L483
JelteF/PyLaTeX
1a73261b771ae15afbb3ca5f06d4ba61328f1c62
pylatex/document.py
python
Document.generate_pdf
(self, filepath=None, *, clean=True, clean_tex=True, compiler=None, compiler_args=None, silent=True)
Generate a pdf file from the document. Args ---- filepath: str The name of the file (without .pdf), if it is `None` the ``default_filepath`` attribute will be used. clean: bool Whether non-pdf files created that are created during compilation ...
Generate a pdf file from the document.
[ "Generate", "a", "pdf", "file", "from", "the", "document", "." ]
def generate_pdf(self, filepath=None, *, clean=True, clean_tex=True, compiler=None, compiler_args=None, silent=True): """Generate a pdf file from the document. Args ---- filepath: str The name of the file (without .pdf), if it is `None` the `...
[ "def", "generate_pdf", "(", "self", ",", "filepath", "=", "None", ",", "*", ",", "clean", "=", "True", ",", "clean_tex", "=", "True", ",", "compiler", "=", "None", ",", "compiler_args", "=", "None", ",", "silent", "=", "True", ")", ":", "if", "compil...
https://github.com/JelteF/PyLaTeX/blob/1a73261b771ae15afbb3ca5f06d4ba61328f1c62/pylatex/document.py#L180-L305
praekeltfoundation/vumi
b74b5dac95df778519f54c670a353e4bda496df9
vumi/dispatchers/base.py
python
BaseDispatchRouter.dispatch_inbound_event
(self, msg)
Dispatch an event to a publisher. :param vumi.message.TransportEvent msg: Message to dispatch.
Dispatch an event to a publisher.
[ "Dispatch", "an", "event", "to", "a", "publisher", "." ]
def dispatch_inbound_event(self, msg): """Dispatch an event to a publisher. :param vumi.message.TransportEvent msg: Message to dispatch. """ raise NotImplementedError()
[ "def", "dispatch_inbound_event", "(", "self", ",", "msg", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/praekeltfoundation/vumi/blob/b74b5dac95df778519f54c670a353e4bda496df9/vumi/dispatchers/base.py#L199-L205
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/flatnotebook.py
python
PageContainer.OnMouseMove
(self, event)
Handles the ``wx.EVT_MOTION`` event for :class:`PageContainer`. :param `event`: a :class:`MouseEvent` event to be processed.
Handles the ``wx.EVT_MOTION`` event for :class:`PageContainer`.
[ "Handles", "the", "wx", ".", "EVT_MOTION", "event", "for", ":", "class", ":", "PageContainer", "." ]
def OnMouseMove(self, event): """ Handles the ``wx.EVT_MOTION`` event for :class:`PageContainer`. :param `event`: a :class:`MouseEvent` event to be processed. """ if self._pagesInfoVec and self.IsShown(): xButtonStatus = self._nXButtonStatus xTabButtonS...
[ "def", "OnMouseMove", "(", "self", ",", "event", ")", ":", "if", "self", ".", "_pagesInfoVec", "and", "self", ".", "IsShown", "(", ")", ":", "xButtonStatus", "=", "self", ".", "_nXButtonStatus", "xTabButtonStatus", "=", "self", ".", "_nTabXButtonStatus", "ri...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/flatnotebook.py#L5748-L5883
titusjan/argos
5a9c31a8a9a2ca825bbf821aa1e685740e3682d7
argos/qt/treemodels.py
python
BaseTreeModel.parent
(self, index)
return self.createIndex(parentItem.childNumber(), 0, parentItem)
Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned. A common convention used in models that expose tree data structures is that only items in the first column have children. For that case, when reimplementing this...
Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned.
[ "Returns", "the", "parent", "of", "the", "model", "item", "with", "the", "given", "index", ".", "If", "the", "item", "has", "no", "parent", "an", "invalid", "QModelIndex", "is", "returned", "." ]
def parent(self, index): """ Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned. A common convention used in models that expose tree data structures is that only items in the first column have children. Fo...
[ "def", "parent", "(", "self", ",", "index", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "return", "QtCore", ".", "QModelIndex", "(", ")", "childItem", "=", "self", ".", "getItem", "(", "index", ",", "altItem", "=", "self", ".", "...
https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/qt/treemodels.py#L210-L231
learningequality/ka-lite
571918ea668013dcf022286ea85eff1c5333fb8b
kalite/packages/bundled/django/middleware/common.py
python
_is_internal_request
(domain, referer)
return referer is not None and re.match("^https?://%s/" % re.escape(domain), referer)
Returns true if the referring URL is the same domain as the current request.
Returns true if the referring URL is the same domain as the current request.
[ "Returns", "true", "if", "the", "referring", "URL", "is", "the", "same", "domain", "as", "the", "current", "request", "." ]
def _is_internal_request(domain, referer): """ Returns true if the referring URL is the same domain as the current request. """ # Different subdomains are treated as different domains. return referer is not None and re.match("^https?://%s/" % re.escape(domain), referer)
[ "def", "_is_internal_request", "(", "domain", ",", "referer", ")", ":", "# Different subdomains are treated as different domains.", "return", "referer", "is", "not", "None", "and", "re", ".", "match", "(", "\"^https?://%s/\"", "%", "re", ".", "escape", "(", "domain"...
https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/middleware/common.py#L162-L167
Behappy123/market-maker
aaed8cf8c994771e0a6ff070ce19b15efbfbd1c4
market_maker/bitmex.py
python
BitMEX._curl_bitmex
(self, api, query=None, postdict=None, timeout=3, verb=None, rethrow_errors=False)
return response.json()
Send a request to BitMEX Servers.
Send a request to BitMEX Servers.
[ "Send", "a", "request", "to", "BitMEX", "Servers", "." ]
def _curl_bitmex(self, api, query=None, postdict=None, timeout=3, verb=None, rethrow_errors=False): """Send a request to BitMEX Servers.""" # Handle URL url = self.base_url + api # Default to POST if data is attached, GET otherwise if not verb: verb = 'POST' if postd...
[ "def", "_curl_bitmex", "(", "self", ",", "api", ",", "query", "=", "None", ",", "postdict", "=", "None", ",", "timeout", "=", "3", ",", "verb", "=", "None", ",", "rethrow_errors", "=", "False", ")", ":", "# Handle URL", "url", "=", "self", ".", "base...
https://github.com/Behappy123/market-maker/blob/aaed8cf8c994771e0a6ff070ce19b15efbfbd1c4/market_maker/bitmex.py#L184-L282
shiyanhui/FileHeader
f347cc134021fb0b710694b71c57742476f5fd2b
jinja2/nodes.py
python
Node.iter_fields
(self, exclude=None, only=None)
This method iterates over all fields that are defined and yields ``(key, value)`` tuples. Per default all fields are returned, but it's possible to limit that to some fields by providing the `only` parameter or to exclude some using the `exclude` parameter. Both should be sets or tuple...
This method iterates over all fields that are defined and yields ``(key, value)`` tuples. Per default all fields are returned, but it's possible to limit that to some fields by providing the `only` parameter or to exclude some using the `exclude` parameter. Both should be sets or tuple...
[ "This", "method", "iterates", "over", "all", "fields", "that", "are", "defined", "and", "yields", "(", "key", "value", ")", "tuples", ".", "Per", "default", "all", "fields", "are", "returned", "but", "it", "s", "possible", "to", "limit", "that", "to", "s...
def iter_fields(self, exclude=None, only=None): """This method iterates over all fields that are defined and yields ``(key, value)`` tuples. Per default all fields are returned, but it's possible to limit that to some fields by providing the `only` parameter or to exclude some using the...
[ "def", "iter_fields", "(", "self", ",", "exclude", "=", "None", ",", "only", "=", "None", ")", ":", "for", "name", "in", "self", ".", "fields", ":", "if", "(", "exclude", "is", "only", "is", "None", ")", "or", "(", "exclude", "is", "not", "None", ...
https://github.com/shiyanhui/FileHeader/blob/f347cc134021fb0b710694b71c57742476f5fd2b/jinja2/nodes.py#L148-L162
erdewit/ib_insync
9674fe974c07ca3afaf70673ae296f1d19f028dc
ib_insync/ticker.py
python
TickerUpdateEvent.trades
(self)
return Tickfilter((4, 5, 48, 68, 71), self)
Emit trade ticks.
Emit trade ticks.
[ "Emit", "trade", "ticks", "." ]
def trades(self) -> "Tickfilter": """Emit trade ticks.""" return Tickfilter((4, 5, 48, 68, 71), self)
[ "def", "trades", "(", "self", ")", "->", "\"Tickfilter\"", ":", "return", "Tickfilter", "(", "(", "4", ",", "5", ",", "48", ",", "68", ",", "71", ")", ",", "self", ")" ]
https://github.com/erdewit/ib_insync/blob/9674fe974c07ca3afaf70673ae296f1d19f028dc/ib_insync/ticker.py#L156-L158
berkeleydeeprlcourse/homework_fall2019
e9725d8aba926e2fe1c743f881884111b44e33bb
hw3/cs285/infrastructure/atari_wrappers.py
python
MaxAndSkipEnv.__init__
(self, env, skip=4)
Return only every `skip`-th frame
Return only every `skip`-th frame
[ "Return", "only", "every", "skip", "-", "th", "frame" ]
def __init__(self, env, skip=4): """Return only every `skip`-th frame""" gym.Wrapper.__init__(self, env) # most recent raw observations (for max pooling across time steps) self._obs_buffer = np.zeros((2,)+env.observation_space.shape, dtype=np.uint8) self._skip = skip
[ "def", "__init__", "(", "self", ",", "env", ",", "skip", "=", "4", ")", ":", "gym", ".", "Wrapper", ".", "__init__", "(", "self", ",", "env", ")", "# most recent raw observations (for max pooling across time steps)", "self", ".", "_obs_buffer", "=", "np", ".",...
https://github.com/berkeleydeeprlcourse/homework_fall2019/blob/e9725d8aba926e2fe1c743f881884111b44e33bb/hw3/cs285/infrastructure/atari_wrappers.py#L96-L101
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/dev/bdf_vectorized2/bdf_vectorized.py
python
BDF_.update_card
(self, card_name: str, icard: int, ifield: int, value: Union[int, float, str])
return obj
Updates a Nastran card based on standard Nastran optimization names Parameters ---------- card_name : str the name of the card (e.g. GRID) icard : int the unique 1-based index identifier for the card (e.g. the GRID id) ifield : int...
Updates a Nastran card based on standard Nastran optimization names
[ "Updates", "a", "Nastran", "card", "based", "on", "standard", "Nastran", "optimization", "names" ]
def update_card(self, card_name: str, icard: int, ifield: int, value: Union[int, float, str]) -> None: """ Updates a Nastran card based on standard Nastran optimization names Parameters ---------- card_name : str the name of the card (...
[ "def", "update_card", "(", "self", ",", "card_name", ":", "str", ",", "icard", ":", "int", ",", "ifield", ":", "int", ",", "value", ":", "Union", "[", "int", ",", "float", ",", "str", "]", ")", "->", "None", ":", "#rslot_map = self.get_rslot_map(reset_ty...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized2/bdf_vectorized.py#L1794-L1854
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/pickletools.py
python
OpcodeInfo.__init__
(self, name, code, arg, stack_before, stack_after, proto, doc)
[]
def __init__(self, name, code, arg, stack_before, stack_after, proto, doc): assert isinstance(name, str) self.name = name assert isinstance(code, str) assert len(code) == 1 self.code = code assert arg is None or isinstance(arg, ArgumentDescriptor) ...
[ "def", "__init__", "(", "self", ",", "name", ",", "code", ",", "arg", ",", "stack_before", ",", "stack_after", ",", "proto", ",", "doc", ")", ":", "assert", "isinstance", "(", "name", ",", "str", ")", "self", ".", "name", "=", "name", "assert", "isin...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/pickletools.py#L854-L880
iopsgroup/imoocc
de810eb6d4c1697b7139305925a5b0ba21225f3f
extra_apps/xadmin/filters.py
python
BaseFilter.has_output
(self)
Returns True if some choices would be output for this filter.
Returns True if some choices would be output for this filter.
[ "Returns", "True", "if", "some", "choices", "would", "be", "output", "for", "this", "filter", "." ]
def has_output(self): """ Returns True if some choices would be output for this filter. """ raise NotImplementedError
[ "def", "has_output", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/extra_apps/xadmin/filters.py#L55-L59
ring04h/wyportmap
c4201e2313504e780a7f25238eba2a2d3223e739
sqlalchemy/sql/operators.py
python
Operators.__invert__
(self)
return self.operate(inv)
Implement the ``~`` operator. When used with SQL expressions, results in a NOT operation, equivalent to :func:`~.expression.not_`, that is:: ~a is equivalent to:: from sqlalchemy import not_ not_(a)
Implement the ``~`` operator.
[ "Implement", "the", "~", "operator", "." ]
def __invert__(self): """Implement the ``~`` operator. When used with SQL expressions, results in a NOT operation, equivalent to :func:`~.expression.not_`, that is:: ~a is equivalent to:: from sqlalchemy import not_ not_(a) """ ...
[ "def", "__invert__", "(", "self", ")", ":", "return", "self", ".", "operate", "(", "inv", ")" ]
https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/sqlalchemy/sql/operators.py#L90-L105
mayank93/Twitter-Sentiment-Analysis
f095c6ca6bf69787582b5dabb140fefaf278eb37
front-end/web2py/site-packages/python-ldap-2.4.3/build/lib.linux-x86_64-2.7/ldif.py
python
LDIFWriter._needs_base64_encoding
(self,attr_type,attr_value)
return self._base64_attrs.has_key(attr_type.lower()) or \ not safe_string_re.search(attr_value) is None
returns 1 if attr_value has to be base-64 encoded because of special chars or because attr_type is in self._base64_attrs
returns 1 if attr_value has to be base-64 encoded because of special chars or because attr_type is in self._base64_attrs
[ "returns", "1", "if", "attr_value", "has", "to", "be", "base", "-", "64", "encoded", "because", "of", "special", "chars", "or", "because", "attr_type", "is", "in", "self", ".", "_base64_attrs" ]
def _needs_base64_encoding(self,attr_type,attr_value): """ returns 1 if attr_value has to be base-64 encoded because of special chars or because attr_type is in self._base64_attrs """ return self._base64_attrs.has_key(attr_type.lower()) or \ not safe_string_re.search(attr_value) is None
[ "def", "_needs_base64_encoding", "(", "self", ",", "attr_type", ",", "attr_value", ")", ":", "return", "self", ".", "_base64_attrs", ".", "has_key", "(", "attr_type", ".", "lower", "(", ")", ")", "or", "not", "safe_string_re", ".", "search", "(", "attr_value...
https://github.com/mayank93/Twitter-Sentiment-Analysis/blob/f095c6ca6bf69787582b5dabb140fefaf278eb37/front-end/web2py/site-packages/python-ldap-2.4.3/build/lib.linux-x86_64-2.7/ldif.py#L122-L128
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/tarfile.py
python
TarFile.__enter__
(self)
return self
[]
def __enter__(self): self._check() return self
[ "def", "__enter__", "(", "self", ")", ":", "self", ".", "_check", "(", ")", "return", "self" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tarfile.py#L2526-L2528
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/fuzzbunch/pyreadline/modes/basemode.py
python
BaseMode.possible_completions
(self, e)
List the possible completions of the text before point.
List the possible completions of the text before point.
[ "List", "the", "possible", "completions", "of", "the", "text", "before", "point", "." ]
def possible_completions(self, e): # (M-?) '''List the possible completions of the text before point. ''' completions = self._get_completions() self._display_completions(completions)
[ "def", "possible_completions", "(", "self", ",", "e", ")", ":", "# (M-?)", "completions", "=", "self", ".", "_get_completions", "(", ")", "self", ".", "_display_completions", "(", "completions", ")" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/fuzzbunch/pyreadline/modes/basemode.py#L204-L207
ifwe/digsby
f5fe00244744aa131e07f09348d10563f3d8fa99
digsby/src/gui/uberwidgets/uberbook/tabbar.py
python
TabBar.OnMotion
(self,event)
Positioning updates during drag and drop
Positioning updates during drag and drop
[ "Positioning", "updates", "during", "drag", "and", "drop" ]
def OnMotion(self,event): 'Positioning updates during drag and drop' if event.LeftIsDown() and (self.dragorigin or self.Manager.source): self.DragCalc(event.Position)
[ "def", "OnMotion", "(", "self", ",", "event", ")", ":", "if", "event", ".", "LeftIsDown", "(", ")", "and", "(", "self", ".", "dragorigin", "or", "self", ".", "Manager", ".", "source", ")", ":", "self", ".", "DragCalc", "(", "event", ".", "Position", ...
https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/gui/uberwidgets/uberbook/tabbar.py#L182-L186
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbTianMaoXinLingShou.tmall_nr_order_confirm
( self, param1, buyer_id='0' )
return self._top_request( "tmall.nr.order.confirm", { "param1": param1, "buyer_id": buyer_id } )
确认订单价格 贩卖机计算商品价格,用于透出给消费者; 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=37633 :param param1: 请求参数 :param buyer_id: 可用于透传的买家id,常用于外部技术体系的买家信息透传
确认订单价格 贩卖机计算商品价格,用于透出给消费者; 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=37633
[ "确认订单价格", "贩卖机计算商品价格,用于透出给消费者;", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "37633" ]
def tmall_nr_order_confirm( self, param1, buyer_id='0' ): """ 确认订单价格 贩卖机计算商品价格,用于透出给消费者; 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=37633 :param param1: 请求参数 :param buyer_id: 可用于透传的买家id,常用于外部技术体系的买家信息透传 """ ...
[ "def", "tmall_nr_order_confirm", "(", "self", ",", "param1", ",", "buyer_id", "=", "'0'", ")", ":", "return", "self", ".", "_top_request", "(", "\"tmall.nr.order.confirm\"", ",", "{", "\"param1\"", ":", "param1", ",", "\"buyer_id\"", ":", "buyer_id", "}", ")" ...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L98111-L98130
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/decimal.py
python
Decimal.__rsub__
(self, other, context=None)
return other.__sub__(self, context=context)
Return other - self
Return other - self
[ "Return", "other", "-", "self" ]
def __rsub__(self, other, context=None): """Return other - self""" other = _convert_other(other) if other is NotImplemented: return other return other.__sub__(self, context=context)
[ "def", "__rsub__", "(", "self", ",", "other", ",", "context", "=", "None", ")", ":", "other", "=", "_convert_other", "(", "other", ")", "if", "other", "is", "NotImplemented", ":", "return", "other", "return", "other", ".", "__sub__", "(", "self", ",", ...
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/decimal.py#L1050-L1056
openstack/sahara
c4f4d29847d5bcca83d49ef7e9a3378458462a79
sahara/conductor/api.py
python
LocalApi.job_execution_get
(self, context, job_execution)
return self._manager.job_execution_get(context, _get_id(job_execution))
Return the JobExecution or None if it does not exist.
Return the JobExecution or None if it does not exist.
[ "Return", "the", "JobExecution", "or", "None", "if", "it", "does", "not", "exist", "." ]
def job_execution_get(self, context, job_execution): """Return the JobExecution or None if it does not exist.""" return self._manager.job_execution_get(context, _get_id(job_execution))
[ "def", "job_execution_get", "(", "self", ",", "context", ",", "job_execution", ")", ":", "return", "self", ".", "_manager", ".", "job_execution_get", "(", "context", ",", "_get_id", "(", "job_execution", ")", ")" ]
https://github.com/openstack/sahara/blob/c4f4d29847d5bcca83d49ef7e9a3378458462a79/sahara/conductor/api.py#L325-L328
yt-project/yt
dc7b24f9b266703db4c843e329c6c8644d47b824
doc/helper_scripts/parse_cb_list.py
python
write_docstring
(f, name, cls)
[]
def write_docstring(f, name, cls): if not hasattr(cls, "_type_name") or cls._type_name is None: return for clsi in inspect.getmro(cls): docstring = inspect.getdoc(clsi.__init__) if docstring is not None: break clsname = cls._type_name sig = inspect.formatargspec(*insp...
[ "def", "write_docstring", "(", "f", ",", "name", ",", "cls", ")", ":", "if", "not", "hasattr", "(", "cls", ",", "\"_type_name\"", ")", "or", "cls", ".", "_type_name", "is", "None", ":", "return", "for", "clsi", "in", "inspect", ".", "getmro", "(", "c...
https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/doc/helper_scripts/parse_cb_list.py#L23-L44
Komodo/KomodoEdit
61edab75dce2bdb03943b387b0608ea36f548e8e
src/codeintel/play/core.py
python
Window.ClearBackground
(*args, **kwargs)
return _core.Window_ClearBackground(*args, **kwargs)
ClearBackground() Clears the window by filling it with the current background colour. Does not cause an erase background event to be generated.
ClearBackground()
[ "ClearBackground", "()" ]
def ClearBackground(*args, **kwargs): """ ClearBackground() Clears the window by filling it with the current background colour. Does not cause an erase background event to be generated. """ return _core.Window_ClearBackground(*args, **kwargs)
[ "def", "ClearBackground", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core", ".", "Window_ClearBackground", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/codeintel/play/core.py#L6395-L6402
ztosec/hunter
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
HunterCelery/common/redis_util.py
python
RedisManage.get_redis_pool
(cls)
return RedisManage.__redis_pool
获取redis连接池 :return:
获取redis连接池 :return:
[ "获取redis连接池", ":", "return", ":" ]
def get_redis_pool(cls): """ 获取redis连接池 :return: """ redis_config = get_system_config()["redis"] redis_host = redis_config["host"] redis_port = redis_config["port"] redis_password = redis_config["password"] max_connections = redis_config["max_conn...
[ "def", "get_redis_pool", "(", "cls", ")", ":", "redis_config", "=", "get_system_config", "(", ")", "[", "\"redis\"", "]", "redis_host", "=", "redis_config", "[", "\"host\"", "]", "redis_port", "=", "redis_config", "[", "\"port\"", "]", "redis_password", "=", "...
https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/HunterCelery/common/redis_util.py#L44-L57
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
arcade/sprite_list/sprite_list.py
python
SpriteList.extend
(self, sprites: Union[list, "SpriteList"])
Extends the current list with the given list :param list sprites: list of Sprites to add to the list
Extends the current list with the given list
[ "Extends", "the", "current", "list", "with", "the", "given", "list" ]
def extend(self, sprites: Union[list, "SpriteList"]): """ Extends the current list with the given list :param list sprites: list of Sprites to add to the list """ for sprite in sprites: self.append(sprite)
[ "def", "extend", "(", "self", ",", "sprites", ":", "Union", "[", "list", ",", "\"SpriteList\"", "]", ")", ":", "for", "sprite", "in", "sprites", ":", "self", ".", "append", "(", "sprite", ")" ]
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/sprite_list/sprite_list.py#L546-L553
mozilla-services/socorro
8bff4a90e9e3320eabe7e067adbe0e89f6a39ba7
socorro/signature/cmd_signature.py
python
OutputBase.data
(self, crash_id, old_sig, result, verbose)
Outputs a data point :arg str crash_id: the crash id for the signature generated :arg str old_sig: the old signature retrieved in the processed crash :arg Result result: the signature result :arg boolean verbose: whether or not to be verbose
Outputs a data point
[ "Outputs", "a", "data", "point" ]
def data(self, crash_id, old_sig, result, verbose): """Outputs a data point :arg str crash_id: the crash id for the signature generated :arg str old_sig: the old signature retrieved in the processed crash :arg Result result: the signature result :arg boolean verbose: whether or ...
[ "def", "data", "(", "self", ",", "crash_id", ",", "old_sig", ",", "result", ",", "verbose", ")", ":", "pass" ]
https://github.com/mozilla-services/socorro/blob/8bff4a90e9e3320eabe7e067adbe0e89f6a39ba7/socorro/signature/cmd_signature.py#L58-L67
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/query/spans.py
python
SpanQuery.__eq__
(self, other)
return (other and self.__class__ is other.__class__ and self.q == other.q)
[]
def __eq__(self, other): return (other and self.__class__ is other.__class__ and self.q == other.q)
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "return", "(", "other", "and", "self", ".", "__class__", "is", "other", ".", "__class__", "and", "self", ".", "q", "==", "other", ".", "q", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/query/spans.py#L274-L276
vmware/vsphere-automation-sdk-python
ba7d4e0742f58a641dfed9538ecbbb1db4f3891e
samples/vmc/networks_nsxv/public_ip_crud.py
python
PublicIPsCrud.delete_public_ip
(self)
[]
def delete_public_ip(self): if self.cleanup: self.vmc_client.orgs.sddcs.Publicips.delete( org=self.org_id, sddc=self.sddc_id, id=self.ip_id) print('\n# Example: Public IP "{}" is deleted'.format(self.notes))
[ "def", "delete_public_ip", "(", "self", ")", ":", "if", "self", ".", "cleanup", ":", "self", ".", "vmc_client", ".", "orgs", ".", "sddcs", ".", "Publicips", ".", "delete", "(", "org", "=", "self", ".", "org_id", ",", "sddc", "=", "self", ".", "sddc_i...
https://github.com/vmware/vsphere-automation-sdk-python/blob/ba7d4e0742f58a641dfed9538ecbbb1db4f3891e/samples/vmc/networks_nsxv/public_ip_crud.py#L123-L127
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/qt/docking/layout_handling.py
python
_plug_border_west
(area, widget, frame, guide)
return _split_root_helper(area, Qt.Horizontal, frame, False)
Plug the frame to the west border of the area.
Plug the frame to the west border of the area.
[ "Plug", "the", "frame", "to", "the", "west", "border", "of", "the", "area", "." ]
def _plug_border_west(area, widget, frame, guide): """ Plug the frame to the west border of the area. """ return _split_root_helper(area, Qt.Horizontal, frame, False)
[ "def", "_plug_border_west", "(", "area", ",", "widget", ",", "frame", ",", "guide", ")", ":", "return", "_split_root_helper", "(", "area", ",", "Qt", ".", "Horizontal", ",", "frame", ",", "False", ")" ]
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/qt/docking/layout_handling.py#L387-L391
Guake/guake
6dc23f34cc679a9a697ef4e93799344b56001cef
guake/prefs.py
python
PrefsCallbacks.on_window_horizontal_displacement_value_changed
(self, spin)
Changes the value of window-horizontal-displacement
Changes the value of window-horizontal-displacement
[ "Changes", "the", "value", "of", "window", "-", "horizontal", "-", "displacement" ]
def on_window_horizontal_displacement_value_changed(self, spin): """Changes the value of window-horizontal-displacement""" self.settings.general.set_int("window-horizontal-displacement", int(spin.get_value()))
[ "def", "on_window_horizontal_displacement_value_changed", "(", "self", ",", "spin", ")", ":", "self", ".", "settings", ".", "general", ".", "set_int", "(", "\"window-horizontal-displacement\"", ",", "int", "(", "spin", ".", "get_value", "(", ")", ")", ")" ]
https://github.com/Guake/guake/blob/6dc23f34cc679a9a697ef4e93799344b56001cef/guake/prefs.py#L593-L595
giantbranch/python-hacker-code
addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d
我手敲的代码(中文注释)/chapter11/volatility/plugins/malware/apihooks.py
python
Hook.__init__
(self, hook_type, hook_mode, function_name, function_address = None, hook_address = None, hook_module = None, victim_module = None)
Initalize a hook class instance. @params hook_type: one of the HOOK_TYPE_* constants @params hook_mode: one of the HOOK_MODE_* constants @params function_name: name of the function being hooked @params function_address: address of the hooked function in process or kern...
Initalize a hook class instance.
[ "Initalize", "a", "hook", "class", "instance", "." ]
def __init__(self, hook_type, hook_mode, function_name, function_address = None, hook_address = None, hook_module = None, victim_module = None): """ Initalize a hook class instance. @params hook_type: one of the HOOK_TYPE_* constants @pa...
[ "def", "__init__", "(", "self", ",", "hook_type", ",", "hook_mode", ",", "function_name", ",", "function_address", "=", "None", ",", "hook_address", "=", "None", ",", "hook_module", "=", "None", ",", "victim_module", "=", "None", ")", ":", "self", ".", "ho...
https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/volatility/plugins/malware/apihooks.py#L165-L199
mailpile/Mailpile
b5e4b85fd1e584951d6d13af362ab28821466eea
mailpile/util.py
python
string_to_intlist
(text)
Converts a string into an array of integers
Converts a string into an array of integers
[ "Converts", "a", "string", "into", "an", "array", "of", "integers" ]
def string_to_intlist(text): """Converts a string into an array of integers""" try: return [ord(c) for c in text.encode('utf-8')] except (UnicodeEncodeError, UnicodeDecodeError): return [ord(c) for c in text]
[ "def", "string_to_intlist", "(", "text", ")", ":", "try", ":", "return", "[", "ord", "(", "c", ")", "for", "c", "in", "text", ".", "encode", "(", "'utf-8'", ")", "]", "except", "(", "UnicodeEncodeError", ",", "UnicodeDecodeError", ")", ":", "return", "...
https://github.com/mailpile/Mailpile/blob/b5e4b85fd1e584951d6d13af362ab28821466eea/mailpile/util.py#L457-L462
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/exprs/world.py
python
World._append_node
(self, index, node)
return
not sure if this should be private... API revised 070205, ought to rename it more (and #doc it)
not sure if this should be private... API revised 070205, ought to rename it more (and #doc it)
[ "not", "sure", "if", "this", "should", "be", "private", "...", "API", "revised", "070205", "ought", "to", "rename", "it", "more", "(", "and", "#doc", "it", ")" ]
def _append_node(self, index, node):#070201 new feature ###e SHOULD RENAME [070205] "not sure if this should be private... API revised 070205, ought to rename it more (and #doc it)" ## self._nodeset = dict(self._nodeset) ## ###KLUGE: copy it first, to make sure it gets change-tracked. Ineffici...
[ "def", "_append_node", "(", "self", ",", "index", ",", "node", ")", ":", "#070201 new feature ###e SHOULD RENAME [070205]", "## self._nodeset = dict(self._nodeset)", "## ###KLUGE: copy it first, to make sure it gets change-tracked. Inefficient when long!", "###BUG in the ...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/exprs/world.py#L164-L180
sabri-zaki/EasY_HaCk
2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9
.modules/.sqlmap/lib/request/connect.py
python
Connect.getPage
(**kwargs)
return page, responseHeaders, code
This method connects to the target URL or proxy and returns the target URL page content
This method connects to the target URL or proxy and returns the target URL page content
[ "This", "method", "connects", "to", "the", "target", "URL", "or", "proxy", "and", "returns", "the", "target", "URL", "page", "content" ]
def getPage(**kwargs): """ This method connects to the target URL or proxy and returns the target URL page content """ start = time.time() if isinstance(conf.delay, (int, float)) and conf.delay > 0: time.sleep(conf.delay) if conf.offline: ...
[ "def", "getPage", "(", "*", "*", "kwargs", ")", ":", "start", "=", "time", ".", "time", "(", ")", "if", "isinstance", "(", "conf", ".", "delay", ",", "(", "int", ",", "float", ")", ")", "and", "conf", ".", "delay", ">", "0", ":", "time", ".", ...
https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.sqlmap/lib/request/connect.py#L224-L769
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/django/core/cache/backends/base.py
python
BaseCache.set
(self, key, value, timeout=DEFAULT_TIMEOUT, version=None)
Set a value in the cache. If timeout is given, that timeout will be used for the key; otherwise the default cache timeout will be used.
Set a value in the cache. If timeout is given, that timeout will be used for the key; otherwise the default cache timeout will be used.
[ "Set", "a", "value", "in", "the", "cache", ".", "If", "timeout", "is", "given", "that", "timeout", "will", "be", "used", "for", "the", "key", ";", "otherwise", "the", "default", "cache", "timeout", "will", "be", "used", "." ]
def set(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): """ Set a value in the cache. If timeout is given, that timeout will be used for the key; otherwise the default cache timeout will be used. """ raise NotImplementedError
[ "def", "set", "(", "self", ",", "key", ",", "value", ",", "timeout", "=", "DEFAULT_TIMEOUT", ",", "version", "=", "None", ")", ":", "raise", "NotImplementedError" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/core/cache/backends/base.py#L108-L113
bnpy/bnpy
d5b311e8f58ccd98477f4a0c8a4d4982e3fca424
bnpy/allocmodel/topics/HDPTopicUtil.py
python
calcELBO
(**kwargs)
return Lnon + Llinear
Calculate ELBO objective for provided model state. Returns ------- L : scalar float L is the value of the objective function at provided state.
Calculate ELBO objective for provided model state.
[ "Calculate", "ELBO", "objective", "for", "provided", "model", "state", "." ]
def calcELBO(**kwargs): """ Calculate ELBO objective for provided model state. Returns ------- L : scalar float L is the value of the objective function at provided state. """ Llinear = calcELBO_LinearTerms(**kwargs) Lnon = calcELBO_NonlinearTerms(**kwargs) if isinstance(Lnon, d...
[ "def", "calcELBO", "(", "*", "*", "kwargs", ")", ":", "Llinear", "=", "calcELBO_LinearTerms", "(", "*", "*", "kwargs", ")", "Lnon", "=", "calcELBO_NonlinearTerms", "(", "*", "*", "kwargs", ")", "if", "isinstance", "(", "Lnon", ",", "dict", ")", ":", "L...
https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/allocmodel/topics/HDPTopicUtil.py#L25-L38
Kyubyong/expressive_tacotron
49293bbe6eb6034e2e214483c49fcf709ffbf878
utils.py
python
learning_rate_decay
(init_lr, global_step, warmup_steps=4000.)
return init_lr * warmup_steps ** 0.5 * tf.minimum(step * warmup_steps ** -1.5, step ** -0.5)
Noam scheme from tensor2tensor
Noam scheme from tensor2tensor
[ "Noam", "scheme", "from", "tensor2tensor" ]
def learning_rate_decay(init_lr, global_step, warmup_steps=4000.): '''Noam scheme from tensor2tensor''' step = tf.cast(global_step + 1, dtype=tf.float32) return init_lr * warmup_steps ** 0.5 * tf.minimum(step * warmup_steps ** -1.5, step ** -0.5)
[ "def", "learning_rate_decay", "(", "init_lr", ",", "global_step", ",", "warmup_steps", "=", "4000.", ")", ":", "step", "=", "tf", ".", "cast", "(", "global_step", "+", "1", ",", "dtype", "=", "tf", ".", "float32", ")", "return", "init_lr", "*", "warmup_s...
https://github.com/Kyubyong/expressive_tacotron/blob/49293bbe6eb6034e2e214483c49fcf709ffbf878/utils.py#L126-L129
Qirky/FoxDot
76318f9630bede48ff3994146ed644affa27bfa4
FoxDot/lib/Patterns/Main.py
python
Cycle.__init__
(self, *args)
[]
def __init__(self, *args): Pattern.__init__(self, list(args))
[ "def", "__init__", "(", "self", ",", "*", "args", ")", ":", "Pattern", ".", "__init__", "(", "self", ",", "list", "(", "args", ")", ")" ]
https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/Patterns/Main.py#L1050-L1051
GNS3/gns3-server
aff06572d4173df945ad29ea8feb274f7885d9e4
gns3server/compute/dynamips/nios/nio_udp.py
python
NIOUDP.rhost
(self)
return self._rhost
Returns the remote host :returns: remote address/host
Returns the remote host
[ "Returns", "the", "remote", "host" ]
def rhost(self): """ Returns the remote host :returns: remote address/host """ return self._rhost
[ "def", "rhost", "(", "self", ")", ":", "return", "self", ".", "_rhost" ]
https://github.com/GNS3/gns3-server/blob/aff06572d4173df945ad29ea8feb274f7885d9e4/gns3server/compute/dynamips/nios/nio_udp.py#L118-L125
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wheel/signatures/djbec.py
python
xpt_add
(pt1, pt2)
return (X3, Y3, Z3, T3)
[]
def xpt_add(pt1, pt2): (X1, Y1, Z1, T1) = pt1 (X2, Y2, Z2, T2) = pt2 A = ((Y1 - X1) * (Y2 + X2)) % q B = ((Y1 + X1) * (Y2 - X2)) % q C = (Z1 * 2 * T2) % q D = (T1 * 2 * Z2) % q E = (D + C) % q F = (B - A) % q G = (B + A) % q H = (D - C) % q X3 = (E * F) % q Y3 = (G * H) %...
[ "def", "xpt_add", "(", "pt1", ",", "pt2", ")", ":", "(", "X1", ",", "Y1", ",", "Z1", ",", "T1", ")", "=", "pt1", "(", "X2", ",", "Y2", ",", "Z2", ",", "T2", ")", "=", "pt2", "A", "=", "(", "(", "Y1", "-", "X1", ")", "*", "(", "Y2", "+...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wheel/signatures/djbec.py#L101-L116
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/transforms.py
python
Transform.transform_affine
(self, values)
return self.get_affine().transform(values)
Performs only the affine part of this transformation on the given array of values. ``transform(values)`` is always equivalent to ``transform_affine(transform_non_affine(values))``. In non-affine transformations, this is generally a no-op. In affine transformations, this is equ...
Performs only the affine part of this transformation on the given array of values.
[ "Performs", "only", "the", "affine", "part", "of", "this", "transformation", "on", "the", "given", "array", "of", "values", "." ]
def transform_affine(self, values): """ Performs only the affine part of this transformation on the given array of values. ``transform(values)`` is always equivalent to ``transform_affine(transform_non_affine(values))``. In non-affine transformations, this is generally ...
[ "def", "transform_affine", "(", "self", ",", "values", ")", ":", "return", "self", ".", "get_affine", "(", ")", ".", "transform", "(", "values", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/transforms.py#L1438-L1456
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
Lib/javapath.py
python
normpath
(path)
return slashes + string.joinfields(comps, sep)
Normalize path, eliminating double slashes, etc.
Normalize path, eliminating double slashes, etc.
[ "Normalize", "path", "eliminating", "double", "slashes", "etc", "." ]
def normpath(path): """Normalize path, eliminating double slashes, etc.""" sep = os.sep if sep == '\\': path = path.replace("/", sep) curdir = os.curdir pardir = os.pardir import string # Treat initial slashes specially slashes = '' while path[:1] == sep: slashes = sl...
[ "def", "normpath", "(", "path", ")", ":", "sep", "=", "os", ".", "sep", "if", "sep", "==", "'\\\\'", ":", "path", "=", "path", ".", "replace", "(", "\"/\"", ",", "sep", ")", "curdir", "=", "os", ".", "curdir", "pardir", "=", "os", ".", "pardir", ...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/Lib/javapath.py#L220-L250
google/tf-quant-finance
8fd723689ebf27ff4bb2bd2acb5f6091c5e07309
tf_quant_finance/math/pde/grids.py
python
uniform_grid
(minimums, maximums, sizes, dtype=None, validate_args=False, name=None)
Creates a grid spec for a uniform grid. A uniform grid is characterized by having a constant gap between neighboring points along each axis. Note that the shape of all three parameters must be fully defined and equal to each other. The shape is used to determine the dimension of the grid. Args: minimum...
Creates a grid spec for a uniform grid.
[ "Creates", "a", "grid", "spec", "for", "a", "uniform", "grid", "." ]
def uniform_grid(minimums, maximums, sizes, dtype=None, validate_args=False, name=None): """Creates a grid spec for a uniform grid. A uniform grid is characterized by having a constant gap between neighboring points along each a...
[ "def", "uniform_grid", "(", "minimums", ",", "maximums", ",", "sizes", ",", "dtype", "=", "None", ",", "validate_args", "=", "False", ",", "name", "=", "None", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "name", ",", "'u...
https://github.com/google/tf-quant-finance/blob/8fd723689ebf27ff4bb2bd2acb5f6091c5e07309/tf_quant_finance/math/pde/grids.py#L22-L92
EnableSecurity/wafw00f
3257c48d45ffb2f6504629aa3c5d529f1b886c1b
wafw00f/plugins/sonicwall.py
python
is_waf
(self)
return False
[]
def is_waf(self): schemes = [ self.matchHeader(('Server', 'SonicWALL')), self.matchContent(r"<(title|h\d{1})>Web Site Blocked"), self.matchContent(r'\+?nsa_banner') ] if any(i for i in schemes): return True return False
[ "def", "is_waf", "(", "self", ")", ":", "schemes", "=", "[", "self", ".", "matchHeader", "(", "(", "'Server'", ",", "'SonicWALL'", ")", ")", ",", "self", ".", "matchContent", "(", "r\"<(title|h\\d{1})>Web Site Blocked\"", ")", ",", "self", ".", "matchContent...
https://github.com/EnableSecurity/wafw00f/blob/3257c48d45ffb2f6504629aa3c5d529f1b886c1b/wafw00f/plugins/sonicwall.py#L10-L18
brechtm/rinohtype
d03096f9b1b0ba2d821a25356d84dc6d3028c96c
src/rinoh/backend/pdf/xobject/purepng.py
python
_readable.read
(self, n)
return r
Read `n` chars from buffer
Read `n` chars from buffer
[ "Read", "n", "chars", "from", "buffer" ]
def read(self, n): """Read `n` chars from buffer""" r = self.buf[self.offset:self.offset + n] if isinstance(r, array): r = r.tostring() self.offset += n return r
[ "def", "read", "(", "self", ",", "n", ")", ":", "r", "=", "self", ".", "buf", "[", "self", ".", "offset", ":", "self", ".", "offset", "+", "n", "]", "if", "isinstance", "(", "r", ",", "array", ")", ":", "r", "=", "r", ".", "tostring", "(", ...
https://github.com/brechtm/rinohtype/blob/d03096f9b1b0ba2d821a25356d84dc6d3028c96c/src/rinoh/backend/pdf/xobject/purepng.py#L2071-L2077
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/blockmatrix.py
python
bc_matadd
(expr)
[]
def bc_matadd(expr): args = sift(expr.args, lambda M: isinstance(M, BlockMatrix)) blocks = args[True] if not blocks: return expr nonblocks = args[False] block = blocks[0] for b in blocks[1:]: block = block._blockadd(b) if nonblocks: return MatAdd(*nonblocks) + block ...
[ "def", "bc_matadd", "(", "expr", ")", ":", "args", "=", "sift", "(", "expr", ".", "args", ",", "lambda", "M", ":", "isinstance", "(", "M", ",", "BlockMatrix", ")", ")", "blocks", "=", "args", "[", "True", "]", "if", "not", "blocks", ":", "return", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/blockmatrix.py#L297-L310
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/tornado/iostream.py
python
IOStream.connect
( self: _IOStreamType, address: tuple, server_hostname: str = None )
return future
Connects the socket to a remote address without blocking. May only be called if the socket passed to the constructor was not previously connected. The address parameter is in the same format as for `socket.connect <socket.socket.connect>` for the type of socket passed to the IOStream c...
Connects the socket to a remote address without blocking.
[ "Connects", "the", "socket", "to", "a", "remote", "address", "without", "blocking", "." ]
def connect( self: _IOStreamType, address: tuple, server_hostname: str = None ) -> "Future[_IOStreamType]": """Connects the socket to a remote address without blocking. May only be called if the socket passed to the constructor was not previously connected. The address parameter is...
[ "def", "connect", "(", "self", ":", "_IOStreamType", ",", "address", ":", "tuple", ",", "server_hostname", ":", "str", "=", "None", ")", "->", "\"Future[_IOStreamType]\"", ":", "self", ".", "_connecting", "=", "True", "future", "=", "Future", "(", ")", "# ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/tornado/iostream.py#L1175-L1246
huchunxu/ros_exploring
d09506c4dcb4487be791cceb52ba7c764e614fd8
robot_learning/tensorflow_object_detection/object_detection/core/preprocessor.py
python
random_adjust_brightness
(image, max_delta=0.2)
Randomly adjusts brightness. Makes sure the output image is still between 0 and 1. Args: image: rank 3 float32 tensor contains 1 image -> [height, width, channels] with pixel values varying between [0, 1]. max_delta: how much to change the brightness. A value between [0, 1). Returns: ima...
Randomly adjusts brightness.
[ "Randomly", "adjusts", "brightness", "." ]
def random_adjust_brightness(image, max_delta=0.2): """Randomly adjusts brightness. Makes sure the output image is still between 0 and 1. Args: image: rank 3 float32 tensor contains 1 image -> [height, width, channels] with pixel values varying between [0, 1]. max_delta: how much to change th...
[ "def", "random_adjust_brightness", "(", "image", ",", "max_delta", "=", "0.2", ")", ":", "with", "tf", ".", "name_scope", "(", "'RandomAdjustBrightness'", ",", "values", "=", "[", "image", "]", ")", ":", "image", "=", "tf", ".", "image", ".", "random_brigh...
https://github.com/huchunxu/ros_exploring/blob/d09506c4dcb4487be791cceb52ba7c764e614fd8/robot_learning/tensorflow_object_detection/object_detection/core/preprocessor.py#L431-L448
openstack/ceilometer
9325ae36dc9066073b79fdfbe4757b14536679c7
ceilometer/objectstore/swift.py
python
_Base._neaten_url
(endpoint, tenant_id, reseller_prefix)
return urlparse.urljoin(endpoint.split('/v1')[0].rstrip('/') + '/', 'v1/' + reseller_prefix + tenant_id)
Transform the registered url to standard and valid format.
Transform the registered url to standard and valid format.
[ "Transform", "the", "registered", "url", "to", "standard", "and", "valid", "format", "." ]
def _neaten_url(endpoint, tenant_id, reseller_prefix): """Transform the registered url to standard and valid format.""" return urlparse.urljoin(endpoint.split('/v1')[0].rstrip('/') + '/', 'v1/' + reseller_prefix + tenant_id)
[ "def", "_neaten_url", "(", "endpoint", ",", "tenant_id", ",", "reseller_prefix", ")", ":", "return", "urlparse", ".", "urljoin", "(", "endpoint", ".", "split", "(", "'/v1'", ")", "[", "0", "]", ".", "rstrip", "(", "'/'", ")", "+", "'/'", ",", "'v1/'", ...
https://github.com/openstack/ceilometer/blob/9325ae36dc9066073b79fdfbe4757b14536679c7/ceilometer/objectstore/swift.py#L104-L107
mlflow/mlflow
364aca7daf0fcee3ec407ae0b1b16d9cb3085081
mlflow/experiments.py
python
generate_csv_with_runs
(experiment_id, filename)
Generate CSV with all runs for an experiment
Generate CSV with all runs for an experiment
[ "Generate", "CSV", "with", "all", "runs", "for", "an", "experiment" ]
def generate_csv_with_runs(experiment_id, filename): # type: (str, str) -> None """ Generate CSV with all runs for an experiment """ runs = fluent.search_runs(experiment_ids=experiment_id) if filename: runs.to_csv(filename, index=False) print( "Experiment with ID %s h...
[ "def", "generate_csv_with_runs", "(", "experiment_id", ",", "filename", ")", ":", "# type: (str, str) -> None", "runs", "=", "fluent", ".", "search_runs", "(", "experiment_ids", "=", "experiment_id", ")", "if", "filename", ":", "runs", ".", "to_csv", "(", "filenam...
https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/experiments.py#L129-L142
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
solr/datadog_checks/solr/config_models/instance.py
python
InstanceConfig._final_validation
(cls, values)
return validation.core.finalize_config(getattr(validators, 'finalize_instance', identity)(values))
[]
def _final_validation(cls, values): return validation.core.finalize_config(getattr(validators, 'finalize_instance', identity)(values))
[ "def", "_final_validation", "(", "cls", ",", "values", ")", ":", "return", "validation", ".", "core", ".", "finalize_config", "(", "getattr", "(", "validators", ",", "'finalize_instance'", ",", "identity", ")", "(", "values", ")", ")" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/solr/datadog_checks/solr/config_models/instance.py#L70-L71
choasup/SIN
4851efb7b1c64180026e51ab8abcd95265c0602c
lib/datasets/coco.py
python
coco._load_proposals
(self, method, gt_roidb)
return self.create_roidb_from_box_list(box_list, gt_roidb)
Load pre-computed proposals in the format provided by Jan Hosang: http://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal- computing/research/object-recognition-and-scene-understanding/how- good-are-detection-proposals-really/ For MCG, use boxes from http://www.eecs.berk...
Load pre-computed proposals in the format provided by Jan Hosang: http://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal- computing/research/object-recognition-and-scene-understanding/how- good-are-detection-proposals-really/ For MCG, use boxes from http://www.eecs.berk...
[ "Load", "pre", "-", "computed", "proposals", "in", "the", "format", "provided", "by", "Jan", "Hosang", ":", "http", ":", "//", "www", ".", "mpi", "-", "inf", ".", "mpg", ".", "de", "/", "departments", "/", "computer", "-", "vision", "-", "and", "-", ...
def _load_proposals(self, method, gt_roidb): """ Load pre-computed proposals in the format provided by Jan Hosang: http://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal- computing/research/object-recognition-and-scene-understanding/how- good-are-detection-propo...
[ "def", "_load_proposals", "(", "self", ",", "method", ",", "gt_roidb", ")", ":", "box_list", "=", "[", "]", "top_k", "=", "self", ".", "config", "[", "'top_k'", "]", "valid_methods", "=", "[", "'MCG'", ",", "'selective_search'", ",", "'edge_boxes_AR'", ","...
https://github.com/choasup/SIN/blob/4851efb7b1c64180026e51ab8abcd95265c0602c/lib/datasets/coco.py#L162-L207
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/pygments/lexers/templates.py
python
EvoqueXmlLexer.__init__
(self, **options)
[]
def __init__(self, **options): super(EvoqueXmlLexer, self).__init__(XmlLexer, EvoqueLexer, **options)
[ "def", "__init__", "(", "self", ",", "*", "*", "options", ")", ":", "super", "(", "EvoqueXmlLexer", ",", "self", ")", ".", "__init__", "(", "XmlLexer", ",", "EvoqueLexer", ",", "*", "*", "options", ")" ]
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pygments/lexers/templates.py#L1485-L1487
wbond/oscrypto
d40c62577706682a0f6da5616ad09964f1c9137d
oscrypto/_pkcs1.py
python
_mgf1
(hash_algorithm, seed, mask_length)
return output[0:mask_length]
The PKCS#1 MGF1 mask generation algorithm :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param seed: A byte string to use as the seed for the mask :param mask_length: The desired mask length, as an integ...
The PKCS#1 MGF1 mask generation algorithm
[ "The", "PKCS#1", "MGF1", "mask", "generation", "algorithm" ]
def _mgf1(hash_algorithm, seed, mask_length): """ The PKCS#1 MGF1 mask generation algorithm :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param seed: A byte string to use as the seed for the mask :param...
[ "def", "_mgf1", "(", "hash_algorithm", ",", "seed", ",", "mask_length", ")", ":", "if", "not", "isinstance", "(", "seed", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n seed must be a byte string, not %s\n '''...
https://github.com/wbond/oscrypto/blob/d40c62577706682a0f6da5616ad09964f1c9137d/oscrypto/_pkcs1.py#L314-L384
boostorg/build
aaa95bba19a7acb07badb1929737c67583b14ba0
src/build/property_set.py
python
PropertySet.conditional
(self)
return self.conditional_
Returns conditional properties.
Returns conditional properties.
[ "Returns", "conditional", "properties", "." ]
def conditional (self): """ Returns conditional properties. """ return self.conditional_
[ "def", "conditional", "(", "self", ")", ":", "return", "self", ".", "conditional_" ]
https://github.com/boostorg/build/blob/aaa95bba19a7acb07badb1929737c67583b14ba0/src/build/property_set.py#L297-L300
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/pyasn1/type/univ.py
python
Real.__radd__
(self, value)
return self + value
[]
def __radd__(self, value): return self + value
[ "def", "__radd__", "(", "self", ",", "value", ")", ":", "return", "self", "+", "value" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/pyasn1/type/univ.py#L1419-L1420
GoogleCloudPlatform/professional-services
0c707aa97437f3d154035ef8548109b7882f71da
examples/cloudml-sentiment-analysis/scoring.py
python
run
(project, model, size, input_path, batch_size, random_seed=None)
return results
Runs prediction job on sample of labelled reviews and analyzes results. Args: project: `str`, GCP project id. model: `str`, name of Cloud ML Engine model. size: `int`, number of reviews to process. input_path: `str`, path to input data (reviews). batch_size: `int`, size of predictions batches. ...
Runs prediction job on sample of labelled reviews and analyzes results.
[ "Runs", "prediction", "job", "on", "sample", "of", "labelled", "reviews", "and", "analyzes", "results", "." ]
def run(project, model, size, input_path, batch_size, random_seed=None): """Runs prediction job on sample of labelled reviews and analyzes results. Args: project: `str`, GCP project id. model: `str`, name of Cloud ML Engine model. size: `int`, number of reviews to process. input_path: `str`, path t...
[ "def", "run", "(", "project", ",", "model", ",", "size", ",", "input_path", ",", "batch_size", ",", "random_seed", "=", "None", ")", ":", "if", "random_seed", "is", "not", "None", ":", "np", ".", "random", ".", "seed", "(", "random_seed", ")", "def", ...
https://github.com/GoogleCloudPlatform/professional-services/blob/0c707aa97437f3d154035ef8548109b7882f71da/examples/cloudml-sentiment-analysis/scoring.py#L166-L244
gwastro/pycbc
1e1c85534b9dba8488ce42df693230317ca63dea
pycbc/types/array.py
python
Array.inner
(self, other)
Return the inner product of the array with complex conjugation.
Return the inner product of the array with complex conjugation.
[ "Return", "the", "inner", "product", "of", "the", "array", "with", "complex", "conjugation", "." ]
def inner(self, other): """ Return the inner product of the array with complex conjugation. """ err_msg = "This function is a stub that should be overridden using " err_msg += "the scheme. You shouldn't be seeing this error!" raise ValueError(err_msg)
[ "def", "inner", "(", "self", ",", "other", ")", ":", "err_msg", "=", "\"This function is a stub that should be overridden using \"", "err_msg", "+=", "\"the scheme. You shouldn't be seeing this error!\"", "raise", "ValueError", "(", "err_msg", ")" ]
https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/types/array.py#L669-L674
Project-Platypus/Platypus
a4e56410a772798e905407e99f80d03b86296ad3
platypus/core.py
python
Generator.__init__
(self)
[]
def __init__(self): super(Generator, self).__init__()
[ "def", "__init__", "(", "self", ")", ":", "super", "(", "Generator", ",", "self", ")", ".", "__init__", "(", ")" ]
https://github.com/Project-Platypus/Platypus/blob/a4e56410a772798e905407e99f80d03b86296ad3/platypus/core.py#L214-L215
datacenter/acitoolkit
629b84887dd0f0183b81efc8adb16817f985541a
acitoolkit/aciphysobject.py
python
Linecard.__init__
(self, arg0=None, arg1=None, slot=None, parent=None)
Initialize the basic object. It will create the name of the linecard and set the type before calling the base class __init__ method. If arg1 is an instance of a Node, then pod, and node are derived from the Node and the slot_id is from arg0. If arg1 is not a Node, then arg0 ...
Initialize the basic object. It will create the name of the linecard and set the type before calling the base class __init__ method. If arg1 is an instance of a Node, then pod, and node are derived from the Node and the slot_id is from arg0. If arg1 is not a Node, then arg0 ...
[ "Initialize", "the", "basic", "object", ".", "It", "will", "create", "the", "name", "of", "the", "linecard", "and", "set", "the", "type", "before", "calling", "the", "base", "class", "__init__", "method", ".", "If", "arg1", "is", "an", "instance", "of", ...
def __init__(self, arg0=None, arg1=None, slot=None, parent=None): """Initialize the basic object. It will create the name of the linecard and set the type before calling the base class __init__ method. If arg1 is an instance of a Node, then pod, and node are derived from the Nod...
[ "def", "__init__", "(", "self", ",", "arg0", "=", "None", ",", "arg1", "=", "None", ",", "slot", "=", "None", ",", "parent", "=", "None", ")", ":", "if", "isinstance", "(", "arg1", ",", "self", ".", "_get_parent_class", "(", ")", ")", ":", "slot_id...
https://github.com/datacenter/acitoolkit/blob/629b84887dd0f0183b81efc8adb16817f985541a/acitoolkit/aciphysobject.py#L249-L290
emcconville/wand
03682680c351645f16c3b8ea23bde79fbb270305
wand/image.py
python
BaseImage.compression
(self)
return COMPRESSION_TYPES[compression_index]
(:class:`basestring`) The type of image compression. It's a string from :const:`COMPRESSION_TYPES` list. It also can be set. .. versionadded:: 0.3.6 .. versionchanged:: 0.5.2 Setting :attr:`compression` now sets both `image_info` and `images` in the internal image ...
(:class:`basestring`) The type of image compression. It's a string from :const:`COMPRESSION_TYPES` list. It also can be set.
[ "(", ":", "class", ":", "basestring", ")", "The", "type", "of", "image", "compression", ".", "It", "s", "a", "string", "from", ":", "const", ":", "COMPRESSION_TYPES", "list", ".", "It", "also", "can", "be", "set", "." ]
def compression(self): """(:class:`basestring`) The type of image compression. It's a string from :const:`COMPRESSION_TYPES` list. It also can be set. .. versionadded:: 0.3.6 .. versionchanged:: 0.5.2 Setting :attr:`compression` now sets both `image_info` a...
[ "def", "compression", "(", "self", ")", ":", "compression_index", "=", "library", ".", "MagickGetImageCompression", "(", "self", ".", "wand", ")", "return", "COMPRESSION_TYPES", "[", "compression_index", "]" ]
https://github.com/emcconville/wand/blob/03682680c351645f16c3b8ea23bde79fbb270305/wand/image.py#L1635-L1646
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/inject/lib/core/common.py
python
arrayizeValue
(value)
return value
Makes a list out of value if it is not already a list or tuple itself >>> arrayizeValue(u'1') [u'1']
Makes a list out of value if it is not already a list or tuple itself
[ "Makes", "a", "list", "out", "of", "value", "if", "it", "is", "not", "already", "a", "list", "or", "tuple", "itself" ]
def arrayizeValue(value): """ Makes a list out of value if it is not already a list or tuple itself >>> arrayizeValue(u'1') [u'1'] """ if not isListLike(value): value = [value] return value
[ "def", "arrayizeValue", "(", "value", ")", ":", "if", "not", "isListLike", "(", "value", ")", ":", "value", "=", "[", "value", "]", "return", "value" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/lib/core/common.py#L2798-L2809
aws/aws-parallelcluster
f1fe5679a01c524e7ea904c329bd6d17318c6cd9
cli/src/pcluster/models/imagebuilder.py
python
ImageBuilder.export_logs
( self, bucket: str, bucket_prefix: str = None, keep_s3_objects: bool = False, start_time: datetime = None, end_time: datetime = None, output_file: str = None, )
Export image builder's logs in the given output path, by using given bucket as a temporary folder. :param bucket: S3 bucket to be used to export cluster logs data :param bucket_prefix: Key path under which exported logs data will be stored in s3 bucket, also serves as top-level directory...
Export image builder's logs in the given output path, by using given bucket as a temporary folder.
[ "Export", "image", "builder", "s", "logs", "in", "the", "given", "output", "path", "by", "using", "given", "bucket", "as", "a", "temporary", "folder", "." ]
def export_logs( self, bucket: str, bucket_prefix: str = None, keep_s3_objects: bool = False, start_time: datetime = None, end_time: datetime = None, output_file: str = None, ): """ Export image builder's logs in the given output path, by using...
[ "def", "export_logs", "(", "self", ",", "bucket", ":", "str", ",", "bucket_prefix", ":", "str", "=", "None", ",", "keep_s3_objects", ":", "bool", "=", "False", ",", "start_time", ":", "datetime", "=", "None", ",", "end_time", ":", "datetime", "=", "None"...
https://github.com/aws/aws-parallelcluster/blob/f1fe5679a01c524e7ea904c329bd6d17318c6cd9/cli/src/pcluster/models/imagebuilder.py#L672-L734
scrapy/scrapy
b04cfa48328d5d5749dca6f50fa34e0cfc664c89
scrapy/core/scraper.py
python
Scraper.handle_spider_error
(self, _failure: Failure, request: Request, response: Response, spider: Spider)
[]
def handle_spider_error(self, _failure: Failure, request: Request, response: Response, spider: Spider) -> None: exc = _failure.value if isinstance(exc, CloseSpider): self.crawler.engine.close_spider(spider, exc.reason or 'cancelled') return logkws = self.logformatter.spid...
[ "def", "handle_spider_error", "(", "self", ",", "_failure", ":", "Failure", ",", "request", ":", "Request", ",", "response", ":", "Response", ",", "spider", ":", "Spider", ")", "->", "None", ":", "exc", "=", "_failure", ".", "value", "if", "isinstance", ...
https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/core/scraper.py#L167-L186
scipopt/PySCIPOpt
31527a80d8d0c2b706a26b34d93602aeea5f785f
examples/unfinished/staff_sched_mo.py
python
staff_mo
(I,T,N,J,S,c,b)
return model
staff: staff scheduling Parameters: - I: set of members in the staff - T: number of periods in a cycle - N: number of working periods required for staff's elements in a cycle - J: set of shifts in each period (shift 0 == rest) - S: subset of shifts that must be kept at least ...
staff: staff scheduling Parameters: - I: set of members in the staff - T: number of periods in a cycle - N: number of working periods required for staff's elements in a cycle - J: set of shifts in each period (shift 0 == rest) - S: subset of shifts that must be kept at least ...
[ "staff", ":", "staff", "scheduling", "Parameters", ":", "-", "I", ":", "set", "of", "members", "in", "the", "staff", "-", "T", ":", "number", "of", "periods", "in", "a", "cycle", "-", "N", ":", "number", "of", "working", "periods", "required", "for", ...
def staff_mo(I,T,N,J,S,c,b): """ staff: staff scheduling Parameters: - I: set of members in the staff - T: number of periods in a cycle - N: number of working periods required for staff's elements in a cycle - J: set of shifts in each period (shift 0 == rest) - S: sub...
[ "def", "staff_mo", "(", "I", ",", "T", ",", "N", ",", "J", ",", "S", ",", "c", ",", "b", ")", ":", "Ts", "=", "range", "(", "1", ",", "T", "+", "1", ")", "model", "=", "Model", "(", "\"staff scheduling -- multiobjective version\"", ")", "x", ",",...
https://github.com/scipopt/PySCIPOpt/blob/31527a80d8d0c2b706a26b34d93602aeea5f785f/examples/unfinished/staff_sched_mo.py#L13-L62
natewong1313/bird-bot
0a76dca2157c021c6cd5734928b1ffcf46a2b3b2
sites/bestbuy.py
python
BestBuy.__init__
(self,task_id,status_signal,image_signal,product,profile,proxy,monitor_delay,error_delay)
[]
def __init__(self,task_id,status_signal,image_signal,product,profile,proxy,monitor_delay,error_delay): self.status_signal,self.image_signal,self.product,self.profile,self.monitor_delay,self.error_delay = status_signal,image_signal,product,profile,float(monitor_delay),float(error_delay) self.session = re...
[ "def", "__init__", "(", "self", ",", "task_id", ",", "status_signal", ",", "image_signal", ",", "product", ",", "profile", ",", "proxy", ",", "monitor_delay", ",", "error_delay", ")", ":", "self", ".", "status_signal", ",", "self", ".", "image_signal", ",", ...
https://github.com/natewong1313/bird-bot/blob/0a76dca2157c021c6cd5734928b1ffcf46a2b3b2/sites/bestbuy.py#L12-L38
cagbal/ros_people_object_detection_tensorflow
982ffd4a54b8059638f5cd4aa167299c7fc9e61f
src/action_recognition.py
python
ActionRecognitionNode.__init__
(self)
[]
def __init__(self): super(ActionRecognitionNode, self).__init__() # init the node rospy.init_node('action_recognition_node', anonymous=False) # Get the parameters (image_topic, output_topic, recognition_interval, buffer_size) \ = self.get_parameters() ...
[ "def", "__init__", "(", "self", ")", ":", "super", "(", "ActionRecognitionNode", ",", "self", ")", ".", "__init__", "(", ")", "# init the node", "rospy", ".", "init_node", "(", "'action_recognition_node'", ",", "anonymous", "=", "False", ")", "# Get the paramete...
https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/action_recognition.py#L43-L84
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/protocols/connections/v1_0/models/connection_detail.py
python
ConnectionDetail.did_doc
(self)
return self._did_doc
Accessor for the connection DID Document. Returns: The DIDDoc for this connection
Accessor for the connection DID Document.
[ "Accessor", "for", "the", "connection", "DID", "Document", "." ]
def did_doc(self) -> DIDDoc: """ Accessor for the connection DID Document. Returns: The DIDDoc for this connection """ return self._did_doc
[ "def", "did_doc", "(", "self", ")", "->", "DIDDoc", ":", "return", "self", ".", "_did_doc" ]
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/protocols/connections/v1_0/models/connection_detail.py#L73-L81
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Tools/bgen/bgen/bgenObjectDefinition.py
python
ObjectDefinition.outputSetattr
(self)
[]
def outputSetattr(self): Output() Output("#define %s_setattr NULL", self.prefix)
[ "def", "outputSetattr", "(", "self", ")", ":", "Output", "(", ")", "Output", "(", "\"#define %s_setattr NULL\"", ",", "self", ".", "prefix", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Tools/bgen/bgen/bgenObjectDefinition.py#L173-L175
maas/maas
db2f89970c640758a51247c59bf1ec6f60cf4ab5
src/maasserver/models/tag.py
python
Tag.save
(self, *args, populate=True, **kwargs)
Save this tag. :param populate: Whether or not to call `populate_nodes` if the definition has changed.
Save this tag.
[ "Save", "this", "tag", "." ]
def save(self, *args, populate=True, **kwargs): """Save this tag. :param populate: Whether or not to call `populate_nodes` if the definition has changed. """ super().save(*args, **kwargs) if populate and (self.definition != self._original_definition): sel...
[ "def", "save", "(", "self", ",", "*", "args", ",", "populate", "=", "True", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "save", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "populate", "and", "(", "self", ".", "definitio...
https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/models/tag.py#L141-L150
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/_vendor/urllib3/_collections.py
python
RecentlyUsedContainer.__delitem__
(self, key)
[]
def __delitem__(self, key): with self.lock: value = self._container.pop(key) if self.dispose_func: self.dispose_func(value)
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "with", "self", ".", "lock", ":", "value", "=", "self", ".", "_container", ".", "pop", "(", "key", ")", "if", "self", ".", "dispose_func", ":", "self", ".", "dispose_func", "(", "value", ")" ]
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/_vendor/urllib3/_collections.py#L81-L86
coddingtonbear/jirafs
ad8daffe054a24b58c0fb1cd249dcbb96cd9ed90
jirafs/migrations.py
python
migration_0017
(repo, init=False, **kwargs)
Set initial branch name if not set.
Set initial branch name if not set.
[ "Set", "initial", "branch", "name", "if", "not", "set", "." ]
def migration_0017(repo, init=False, **kwargs): """Set initial branch name if not set.""" repo.run_git_command("config", "init.defaultBranch", "master") set_repo_version(repo, 17)
[ "def", "migration_0017", "(", "repo", ",", "init", "=", "False", ",", "*", "*", "kwargs", ")", ":", "repo", ".", "run_git_command", "(", "\"config\"", ",", "\"init.defaultBranch\"", ",", "\"master\"", ")", "set_repo_version", "(", "repo", ",", "17", ")" ]
https://github.com/coddingtonbear/jirafs/blob/ad8daffe054a24b58c0fb1cd249dcbb96cd9ed90/jirafs/migrations.py#L407-L410
pytransitions/transitions
9663094f4566c016b11563e7a7d6d3802593845c
transitions/extensions/nesting.py
python
HierarchicalMachine.get_global_name
(self, state=None, join=True)
return self.state_cls.separator.join(domains) if join else domains
[]
def get_global_name(self, state=None, join=True): domains = copy.copy(self.prefix_path) if state: state_name = state.name if hasattr(state, 'name') else state if state_name in self.states: domains.append(state_name) else: raise ValueErr...
[ "def", "get_global_name", "(", "self", ",", "state", "=", "None", ",", "join", "=", "True", ")", ":", "domains", "=", "copy", ".", "copy", "(", "self", ".", "prefix_path", ")", "if", "state", ":", "state_name", "=", "state", ".", "name", "if", "hasat...
https://github.com/pytransitions/transitions/blob/9663094f4566c016b11563e7a7d6d3802593845c/transitions/extensions/nesting.py#L618-L626
celery/celery
95015a1d5a60d94d8e1e02da4b9cf16416c747e2
celery/utils/functional.py
python
seq_concat_item
(seq, item)
return seq + (item,) if isinstance(seq, tuple) else seq + [item]
Return copy of sequence seq with item added. Returns: Sequence: if seq is a tuple, the result will be a tuple, otherwise it depends on the implementation of ``__add__``.
Return copy of sequence seq with item added.
[ "Return", "copy", "of", "sequence", "seq", "with", "item", "added", "." ]
def seq_concat_item(seq, item): """Return copy of sequence seq with item added. Returns: Sequence: if seq is a tuple, the result will be a tuple, otherwise it depends on the implementation of ``__add__``. """ return seq + (item,) if isinstance(seq, tuple) else seq + [item]
[ "def", "seq_concat_item", "(", "seq", ",", "item", ")", ":", "return", "seq", "+", "(", "item", ",", ")", "if", "isinstance", "(", "seq", ",", "tuple", ")", "else", "seq", "+", "[", "item", "]" ]
https://github.com/celery/celery/blob/95015a1d5a60d94d8e1e02da4b9cf16416c747e2/celery/utils/functional.py#L367-L374
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/setuptools/setuptools/command/easy_install.py
python
easy_install._fix_install_dir_for_user_site
(self)
Fix the install_dir if "--user" was used.
Fix the install_dir if "--user" was used.
[ "Fix", "the", "install_dir", "if", "--", "user", "was", "used", "." ]
def _fix_install_dir_for_user_site(self): """ Fix the install_dir if "--user" was used. """ if not self.user or not site.ENABLE_USER_SITE: return self.create_home_path() if self.install_userbase is None: msg = "User base directory is not specified...
[ "def", "_fix_install_dir_for_user_site", "(", "self", ")", ":", "if", "not", "self", ".", "user", "or", "not", "site", ".", "ENABLE_USER_SITE", ":", "return", "self", ".", "create_home_path", "(", ")", "if", "self", ".", "install_userbase", "is", "None", ":"...
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/setuptools/command/easy_install.py#L431-L444
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/packaging/version.py
python
LegacyVersion.local
(self)
return None
[]
def local(self): return None
[ "def", "local", "(", "self", ")", ":", "return", "None" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/packaging/version.py#L93-L94
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/psycopg2/extras.py
python
register_composite
(name, conn_or_curs, globally=False, factory=None)
return caster
Register a typecaster to convert a composite type into a tuple. :param name: the name of a PostgreSQL composite type, e.g. created using the |CREATE TYPE|_ command :param conn_or_curs: a connection or cursor used to find the type oid and components; the typecaster is registered in a scope limit...
Register a typecaster to convert a composite type into a tuple.
[ "Register", "a", "typecaster", "to", "convert", "a", "composite", "type", "into", "a", "tuple", "." ]
def register_composite(name, conn_or_curs, globally=False, factory=None): """Register a typecaster to convert a composite type into a tuple. :param name: the name of a PostgreSQL composite type, e.g. created using the |CREATE TYPE|_ command :param conn_or_curs: a connection or cursor used to find t...
[ "def", "register_composite", "(", "name", ",", "conn_or_curs", ",", "globally", "=", "False", ",", "factory", "=", "None", ")", ":", "if", "factory", "is", "None", ":", "factory", "=", "CompositeCaster", "caster", "=", "factory", ".", "_from_db", "(", "nam...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/psycopg2/extras.py#L940-L964
deanishe/alfred-vpn-manager
f5d0dd1433ea69b1517d4866a12b1118097057b9
src/vpn.py
python
VPNApp.filter_connections
(self, name=None, active=True)
return connections
Return connections with matching name and state.
Return connections with matching name and state.
[ "Return", "connections", "with", "matching", "name", "and", "state", "." ]
def filter_connections(self, name=None, active=True): """Return connections with matching name and state.""" connections = self.connections if name: connections = [c for c in connections if c.name == name] if active: connections = [c for c in connections if c.acti...
[ "def", "filter_connections", "(", "self", ",", "name", "=", "None", ",", "active", "=", "True", ")", ":", "connections", "=", "self", ".", "connections", "if", "name", ":", "connections", "=", "[", "c", "for", "c", "in", "connections", "if", "c", ".", ...
https://github.com/deanishe/alfred-vpn-manager/blob/f5d0dd1433ea69b1517d4866a12b1118097057b9/src/vpn.py#L165-L175
reahl/reahl
86aac47c3a9b5b98e9f77dad4939034a02d54d46
reahl-sqlalchemysupport/reahl/sqlalchemysupport/sqlalchemysupport.py
python
pk_name
(table_name)
return 'pk_%s' % table_name
Returns the name that will be used in the database for a primary key, given: :arg table_name: The name of the table to which the primary key belongs.
Returns the name that will be used in the database for a primary key, given:
[ "Returns", "the", "name", "that", "will", "be", "used", "in", "the", "database", "for", "a", "primary", "key", "given", ":" ]
def pk_name(table_name): """Returns the name that will be used in the database for a primary key, given: :arg table_name: The name of the table to which the primary key belongs. """ return 'pk_%s' % table_name
[ "def", "pk_name", "(", "table_name", ")", ":", "return", "'pk_%s'", "%", "table_name" ]
https://github.com/reahl/reahl/blob/86aac47c3a9b5b98e9f77dad4939034a02d54d46/reahl-sqlalchemysupport/reahl/sqlalchemysupport/sqlalchemysupport.py#L86-L91
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
futures2/ctp/ApiStruct.py
python
CombinationLeg.__init__
(self, CombInstrumentID='', LegID=0, LegInstrumentID='', Direction=D_Buy, LegMultiple=0, ImplyLevel=0)
[]
def __init__(self, CombInstrumentID='', LegID=0, LegInstrumentID='', Direction=D_Buy, LegMultiple=0, ImplyLevel=0): self.CombInstrumentID = 'InstrumentID' #组合合约代码, char[31] self.LegID = '' #单腿编号, int self.LegInstrumentID = 'InstrumentID' #单腿合约代码, char[31] self.Direction = '' #买卖方向, char ...
[ "def", "__init__", "(", "self", ",", "CombInstrumentID", "=", "''", ",", "LegID", "=", "0", ",", "LegInstrumentID", "=", "''", ",", "Direction", "=", "D_Buy", ",", "LegMultiple", "=", "0", ",", "ImplyLevel", "=", "0", ")", ":", "self", ".", "CombInstru...
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/futures2/ctp/ApiStruct.py#L4261-L4267
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/distutils/dist.py
python
Distribution.print_commands
(self)
Print out a help message listing all available commands with a description of each. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command c...
Print out a help message listing all available commands with a description of each. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The descriptions come from the command c...
[ "Print", "out", "a", "help", "message", "listing", "all", "available", "commands", "with", "a", "description", "of", "each", ".", "The", "list", "is", "divided", "into", "standard", "commands", "(", "listed", "in", "distutils", ".", "command", ".", "__all__"...
def print_commands(self): """Print out a help message listing all available commands with a description of each. The list is divided into "standard commands" (listed in distutils.command.__all__) and "extra commands" (mentioned in self.cmdclass, but not a standard command). The ...
[ "def", "print_commands", "(", "self", ")", ":", "import", "distutils", ".", "command", "std_commands", "=", "distutils", ".", "command", ".", "__all__", "is_std", "=", "{", "}", "for", "cmd", "in", "std_commands", ":", "is_std", "[", "cmd", "]", "=", "1"...
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/distutils/dist.py#L717-L748
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/pkg_resources/__init__.py
python
Distribution.clone
(self, **kw)
return self.__class__(**kw)
Copy this distribution, substituting in any changed keyword args
Copy this distribution, substituting in any changed keyword args
[ "Copy", "this", "distribution", "substituting", "in", "any", "changed", "keyword", "args" ]
def clone(self, **kw): """Copy this distribution, substituting in any changed keyword args""" names = 'project_name version py_version platform location precedence' for attr in names.split(): kw.setdefault(attr, getattr(self, attr, None)) kw.setdefault('metadata', self._provi...
[ "def", "clone", "(", "self", ",", "*", "*", "kw", ")", ":", "names", "=", "'project_name version py_version platform location precedence'", "for", "attr", "in", "names", ".", "split", "(", ")", ":", "kw", ".", "setdefault", "(", "attr", ",", "getattr", "(", ...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pkg_resources/__init__.py#L2871-L2877
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/pyasn1/type/univ.py
python
ObjectIdentifier.__radd__
(self, other)
return self.clone(other + self._value)
[]
def __radd__(self, other): return self.clone(other + self._value)
[ "def", "__radd__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "clone", "(", "other", "+", "self", ".", "_value", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/pyasn1/type/univ.py#L1139-L1140
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
lib/pkg_resources/_vendor/packaging/specifiers.py
python
BaseSpecifier.__str__
(self)
Returns the str representation of this Specifier like object. This should be representative of the Specifier itself.
Returns the str representation of this Specifier like object. This should be representative of the Specifier itself.
[ "Returns", "the", "str", "representation", "of", "this", "Specifier", "like", "object", ".", "This", "should", "be", "representative", "of", "the", "Specifier", "itself", "." ]
def __str__(self) -> str: """ Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. """
[ "def", "__str__", "(", "self", ")", "->", "str", ":" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/lib/pkg_resources/_vendor/packaging/specifiers.py#L41-L45
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/db/backends/mysql/base.py
python
DatabaseWrapper.is_usable
(self)
[]
def is_usable(self): try: self.connection.ping() except Database.Error: return False else: return True
[ "def", "is_usable", "(", "self", ")", ":", "try", ":", "self", ".", "connection", ".", "ping", "(", ")", "except", "Database", ".", "Error", ":", "return", "False", "else", ":", "return", "True" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/db/backends/mysql/base.py#L357-L363
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/numpy/polynomial/hermite_e.py
python
hermeval2d
(x, y, c)
return c
Evaluate a 2-D HermiteE series at points (x, y). This function returns the values: .. math:: p(x,y) = \\sum_{i,j} c_{i,j} * He_i(x) * He_j(y) The parameters `x` and `y` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same ...
Evaluate a 2-D HermiteE series at points (x, y).
[ "Evaluate", "a", "2", "-", "D", "HermiteE", "series", "at", "points", "(", "x", "y", ")", "." ]
def hermeval2d(x, y, c): """ Evaluate a 2-D HermiteE series at points (x, y). This function returns the values: .. math:: p(x,y) = \\sum_{i,j} c_{i,j} * He_i(x) * He_j(y) The parameters `x` and `y` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a sca...
[ "def", "hermeval2d", "(", "x", ",", "y", ",", "c", ")", ":", "try", ":", "x", ",", "y", "=", "np", ".", "array", "(", "(", "x", ",", "y", ")", ",", "copy", "=", "0", ")", "except", ":", "raise", "ValueError", "(", "'x, y are incompatible'", ")"...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/polynomial/hermite_e.py#L946-L999
llSourcell/AI_Artist
3038c06c2e389b9c919c881c9a169efe2fd7810e
lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
python
_SetuptoolsVersionMixin.__lt__
(self, other)
[]
def __lt__(self, other): if isinstance(other, tuple): return tuple(self) < other else: return super(_SetuptoolsVersionMixin, self).__lt__(other)
[ "def", "__lt__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "tuple", ")", ":", "return", "tuple", "(", "self", ")", "<", "other", "else", ":", "return", "super", "(", "_SetuptoolsVersionMixin", ",", "self", ")", ".", ...
https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L100-L104
gammapy/gammapy
735b25cd5bbed35e2004d633621896dcd5295e8b
gammapy/maps/hpx/geom.py
python
HpxGeom._create_lookup
(self, region)
Create local-to-global pixel lookup table.
Create local-to-global pixel lookup table.
[ "Create", "local", "-", "to", "-", "global", "pixel", "lookup", "table", "." ]
def _create_lookup(self, region): """Create local-to-global pixel lookup table.""" if isinstance(region, str): ipix = [ self.get_index_list(nside, self._nest, region) for nside in self._nside.flat ] self._ipix = [ ravel...
[ "def", "_create_lookup", "(", "self", ",", "region", ")", ":", "if", "isinstance", "(", "region", ",", "str", ")", ":", "ipix", "=", "[", "self", ".", "get_index_list", "(", "nside", ",", "self", ".", "_nest", ",", "region", ")", "for", "nside", "in"...
https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/maps/hpx/geom.py#L94-L137
ericgazoni/openpyxl
c55988e4904d4337ce4c35ab8b7dc305bca9de23
openpyxl/worksheet/worksheet.py
python
Worksheet.title
(self, value)
Set a sheet title, ensuring it is valid. Limited to 31 characters, no special characters.
Set a sheet title, ensuring it is valid. Limited to 31 characters, no special characters.
[ "Set", "a", "sheet", "title", "ensuring", "it", "is", "valid", ".", "Limited", "to", "31", "characters", "no", "special", "characters", "." ]
def title(self, value): """Set a sheet title, ensuring it is valid. Limited to 31 characters, no special characters.""" if self.bad_title_char_re.search(value): msg = 'Invalid character found in sheet title' raise SheetTitleException(msg) value = self.unique_sh...
[ "def", "title", "(", "self", ",", "value", ")", ":", "if", "self", ".", "bad_title_char_re", ".", "search", "(", "value", ")", ":", "msg", "=", "'Invalid character found in sheet title'", "raise", "SheetTitleException", "(", "msg", ")", "value", "=", "self", ...
https://github.com/ericgazoni/openpyxl/blob/c55988e4904d4337ce4c35ab8b7dc305bca9de23/openpyxl/worksheet/worksheet.py#L183-L193
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
lib-python/2.7/zipfile.py
python
ZipFile.extractall
(self, path=None, members=None, pwd=None)
Extract all members from the archive to the current working directory. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by namelist().
Extract all members from the archive to the current working directory. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by namelist().
[ "Extract", "all", "members", "from", "the", "archive", "to", "the", "current", "working", "directory", ".", "path", "specifies", "a", "different", "directory", "to", "extract", "to", ".", "members", "is", "optional", "and", "must", "be", "a", "subset", "of",...
def extractall(self, path=None, members=None, pwd=None): """Extract all members from the archive to the current working directory. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by namelist(). """ ...
[ "def", "extractall", "(", "self", ",", "path", "=", "None", ",", "members", "=", "None", ",", "pwd", "=", "None", ")", ":", "if", "members", "is", "None", ":", "members", "=", "self", ".", "namelist", "(", ")", "for", "zipinfo", "in", "members", ":...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/zipfile.py#L1038-L1048
tdamdouni/Pythonista
3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad
scenes/mydirectory.py
python
dir_contents
(path)
return files, folders
get all dirs and files from path
get all dirs and files from path
[ "get", "all", "dirs", "and", "files", "from", "path" ]
def dir_contents(path): """get all dirs and files from path""" try: contents = listdir(path) except: print('***ERROR with ', path) sys.exit() # print(contents) # tmp = [isfile(path + "\\" + el) for el in contents] # print(tmp) files = [] folders = [] for i, item in enumerate(contents): if isfile(path+sep+...
[ "def", "dir_contents", "(", "path", ")", ":", "try", ":", "contents", "=", "listdir", "(", "path", ")", "except", ":", "print", "(", "'***ERROR with '", ",", "path", ")", "sys", ".", "exit", "(", ")", "#\tprint(contents)", "#\ttmp = [isfile(path + \"\\\\\" + e...
https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/scenes/mydirectory.py#L14-L31
jtpereyda/boofuzz
64badab7257117bcadab35e903d723223dde9203
boofuzz/ifuzz_logger.py
python
IFuzzLogger.log_check
(self, description)
Records a check on the system under test. AKA "instrumentation check." :param description: Received data. :type description: str :return: None :rtype: None
Records a check on the system under test. AKA "instrumentation check."
[ "Records", "a", "check", "on", "the", "system", "under", "test", ".", "AKA", "instrumentation", "check", "." ]
def log_check(self, description): """ Records a check on the system under test. AKA "instrumentation check." :param description: Received data. :type description: str :return: None :rtype: None """ raise NotImplementedError
[ "def", "log_check", "(", "self", ",", "description", ")", ":", "raise", "NotImplementedError" ]
https://github.com/jtpereyda/boofuzz/blob/64badab7257117bcadab35e903d723223dde9203/boofuzz/ifuzz_logger.py#L113-L123
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/mail/interfaces.py
python
IDomain.exists
(user)
Check whether a user exists in this domain. @type user: L{User} @param user: A user. @rtype: no-argument callable which returns L{IMessageSMTP} provider @return: A function which takes no arguments and returns a message receiver for the user. @raise SMTPBadRcpt: Wh...
Check whether a user exists in this domain.
[ "Check", "whether", "a", "user", "exists", "in", "this", "domain", "." ]
def exists(user): """ Check whether a user exists in this domain. @type user: L{User} @param user: A user. @rtype: no-argument callable which returns L{IMessageSMTP} provider @return: A function which takes no arguments and returns a message receiver for the...
[ "def", "exists", "(", "user", ")", ":" ]
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/mail/interfaces.py#L223-L235
getpatchwork/patchwork
60a7b11d12f9e1a6bd08d787d37066c8d89a52ae
patchwork/api/__init__.py
python
_get_attribute
(self, instance)
return relationship.all() if hasattr(relationship, 'all') else relationship
[]
def _get_attribute(self, instance): # Can't have any relationships if not created if hasattr(instance, 'pk') and instance.pk is None: return [] try: relationship = get_attribute(instance, self.source_attrs) except (KeyError, AttributeError) as exc: if self.default is not empty: ...
[ "def", "_get_attribute", "(", "self", ",", "instance", ")", ":", "# Can't have any relationships if not created", "if", "hasattr", "(", "instance", ",", "'pk'", ")", "and", "instance", ".", "pk", "is", "None", ":", "return", "[", "]", "try", ":", "relationship...
https://github.com/getpatchwork/patchwork/blob/60a7b11d12f9e1a6bd08d787d37066c8d89a52ae/patchwork/api/__init__.py#L18-L47
borgbase/vorta
23c47673c009bdef8baebb0b9cdf5e78c07fe373
src/vorta/utils.py
python
get_directory_size
(dir_path, exclude_patterns_re)
return data_size_filtered, files_count_filtered
Get number of files only and total size in bytes from a path. Based off https://stackoverflow.com/a/17936789
Get number of files only and total size in bytes from a path. Based off https://stackoverflow.com/a/17936789
[ "Get", "number", "of", "files", "only", "and", "total", "size", "in", "bytes", "from", "a", "path", ".", "Based", "off", "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "17936789" ]
def get_directory_size(dir_path, exclude_patterns_re): ''' Get number of files only and total size in bytes from a path. Based off https://stackoverflow.com/a/17936789 ''' data_size_filtered = 0 seen = set() seen_filtered = set() for curr_path, _, file_names in os.walk(dir_path): fo...
[ "def", "get_directory_size", "(", "dir_path", ",", "exclude_patterns_re", ")", ":", "data_size_filtered", "=", "0", "seen", "=", "set", "(", ")", "seen_filtered", "=", "set", "(", ")", "for", "curr_path", ",", "_", ",", "file_names", "in", "os", ".", "walk...
https://github.com/borgbase/vorta/blob/23c47673c009bdef8baebb0b9cdf5e78c07fe373/src/vorta/utils.py#L118-L151
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/nltk/corpus/reader/propbank.py
python
PropbankCorpusReader.verbs
(self)
return StreamBackedCorpusView(self.abspath(self._verbsfile), read_line_block, encoding=self.encoding(self._verbsfile))
:return: a corpus view that acts as a list of all verb lemmas in this corpus (from the verbs.txt file).
:return: a corpus view that acts as a list of all verb lemmas in this corpus (from the verbs.txt file).
[ ":", "return", ":", "a", "corpus", "view", "that", "acts", "as", "a", "list", "of", "all", "verb", "lemmas", "in", "this", "corpus", "(", "from", "the", "verbs", ".", "txt", "file", ")", "." ]
def verbs(self): """ :return: a corpus view that acts as a list of all verb lemmas in this corpus (from the verbs.txt file). """ return StreamBackedCorpusView(self.abspath(self._verbsfile), read_line_block, ...
[ "def", "verbs", "(", "self", ")", ":", "return", "StreamBackedCorpusView", "(", "self", ".", "abspath", "(", "self", ".", "_verbsfile", ")", ",", "read_line_block", ",", "encoding", "=", "self", ".", "encoding", "(", "self", ".", "_verbsfile", ")", ")" ]
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/corpus/reader/propbank.py#L132-L139
gitpython-developers/GitPython
fac603789d66c0fd7c26e75debb41b06136c5026
git/config.py
python
GitConfigParser.optionxform
(self, optionstr: str)
return optionstr
Do not transform options in any way when writing
Do not transform options in any way when writing
[ "Do", "not", "transform", "options", "in", "any", "way", "when", "writing" ]
def optionxform(self, optionstr: str) -> str: """Do not transform options in any way when writing""" return optionstr
[ "def", "optionxform", "(", "self", ",", "optionstr", ":", "str", ")", "->", "str", ":", "return", "optionstr" ]
https://github.com/gitpython-developers/GitPython/blob/fac603789d66c0fd7c26e75debb41b06136c5026/git/config.py#L387-L389