id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
51,700
CameronLonsdale/lantern
lantern/modules/shift.py
decrypt
def decrypt(key, ciphertext, shift_function=shift_case_english): """Decrypt Shift enciphered ``ciphertext`` using ``key``. Examples: >>> ''.join(decrypt(3, "KHOOR")) HELLO >> decrypt(15, [0xcf, 0x9e, 0xaf, 0xe0], shift_bytes) [0xde, 0xad, 0xbe, 0xef] Args: key (int...
python
def decrypt(key, ciphertext, shift_function=shift_case_english): """Decrypt Shift enciphered ``ciphertext`` using ``key``. Examples: >>> ''.join(decrypt(3, "KHOOR")) HELLO >> decrypt(15, [0xcf, 0x9e, 0xaf, 0xe0], shift_bytes) [0xde, 0xad, 0xbe, 0xef] Args: key (int...
[ "def", "decrypt", "(", "key", ",", "ciphertext", ",", "shift_function", "=", "shift_case_english", ")", ":", "return", "[", "shift_function", "(", "key", ",", "symbol", ")", "for", "symbol", "in", "ciphertext", "]" ]
Decrypt Shift enciphered ``ciphertext`` using ``key``. Examples: >>> ''.join(decrypt(3, "KHOOR")) HELLO >> decrypt(15, [0xcf, 0x9e, 0xaf, 0xe0], shift_bytes) [0xde, 0xad, 0xbe, 0xef] Args: key (int): The shift to use ciphertext (iterable): The symbols to decryp...
[ "Decrypt", "Shift", "enciphered", "ciphertext", "using", "key", "." ]
235e163e96bf0719d49c54204ee576b2ca93abb6
https://github.com/CameronLonsdale/lantern/blob/235e163e96bf0719d49c54204ee576b2ca93abb6/lantern/modules/shift.py#L83-L101
51,701
bububa/pyTOP
pyTOP/packages/requests/utils.py
header_expand
def header_expand(headers): """Returns an HTTP Header value string from a dictionary. Example expansion:: {'text/x-dvi': {'q': '.8', 'mxb': '100000', 'mxt': '5.0'}, 'text/x-c': {}} # Accept: text/x-dvi; q=.8; mxb=100000; mxt=5.0, text/x-c (('text/x-dvi', {'q': '.8', 'mxb': '100000', '...
python
def header_expand(headers): """Returns an HTTP Header value string from a dictionary. Example expansion:: {'text/x-dvi': {'q': '.8', 'mxb': '100000', 'mxt': '5.0'}, 'text/x-c': {}} # Accept: text/x-dvi; q=.8; mxb=100000; mxt=5.0, text/x-c (('text/x-dvi', {'q': '.8', 'mxb': '100000', '...
[ "def", "header_expand", "(", "headers", ")", ":", "collector", "=", "[", "]", "if", "isinstance", "(", "headers", ",", "dict", ")", ":", "headers", "=", "headers", ".", "items", "(", ")", "elif", "isinstance", "(", "headers", ",", "basestring", ")", ":...
Returns an HTTP Header value string from a dictionary. Example expansion:: {'text/x-dvi': {'q': '.8', 'mxb': '100000', 'mxt': '5.0'}, 'text/x-c': {}} # Accept: text/x-dvi; q=.8; mxb=100000; mxt=5.0, text/x-c (('text/x-dvi', {'q': '.8', 'mxb': '100000', 'mxt': '5.0'}), ('text/x-c', {})) ...
[ "Returns", "an", "HTTP", "Header", "value", "string", "from", "a", "dictionary", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/utils.py#L119-L162
51,702
bububa/pyTOP
pyTOP/packages/requests/utils.py
randombytes
def randombytes(n): """Return n random bytes.""" # Use /dev/urandom if it is available. Fall back to random module # if not. It might be worthwhile to extend this function to use # other platform-specific mechanisms for getting random bytes. if os.path.exists("/dev/urandom"): f = open("/de...
python
def randombytes(n): """Return n random bytes.""" # Use /dev/urandom if it is available. Fall back to random module # if not. It might be worthwhile to extend this function to use # other platform-specific mechanisms for getting random bytes. if os.path.exists("/dev/urandom"): f = open("/de...
[ "def", "randombytes", "(", "n", ")", ":", "# Use /dev/urandom if it is available. Fall back to random module", "# if not. It might be worthwhile to extend this function to use", "# other platform-specific mechanisms for getting random bytes.", "if", "os", ".", "path", ".", "exists", ...
Return n random bytes.
[ "Return", "n", "random", "bytes", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/utils.py#L166-L178
51,703
bububa/pyTOP
pyTOP/packages/requests/utils.py
unicode_from_html
def unicode_from_html(content): """Attempts to decode an HTML string into unicode. If unsuccessful, the original content is returned. """ encodings = get_encodings_from_content(content) for encoding in encodings: try: return unicode(content, encoding) except (UnicodeEr...
python
def unicode_from_html(content): """Attempts to decode an HTML string into unicode. If unsuccessful, the original content is returned. """ encodings = get_encodings_from_content(content) for encoding in encodings: try: return unicode(content, encoding) except (UnicodeEr...
[ "def", "unicode_from_html", "(", "content", ")", ":", "encodings", "=", "get_encodings_from_content", "(", "content", ")", "for", "encoding", "in", "encodings", ":", "try", ":", "return", "unicode", "(", "content", ",", "encoding", ")", "except", "(", "Unicode...
Attempts to decode an HTML string into unicode. If unsuccessful, the original content is returned.
[ "Attempts", "to", "decode", "an", "HTML", "string", "into", "unicode", ".", "If", "unsuccessful", "the", "original", "content", "is", "returned", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/utils.py#L279-L293
51,704
bububa/pyTOP
pyTOP/packages/requests/utils.py
stream_decode_response_unicode
def stream_decode_response_unicode(iterator, r): """Stream decodes a iterator.""" encoding = get_encoding_from_headers(r.headers) if encoding is None: for item in iterator: yield item return decoder = codecs.getincrementaldecoder(encoding)(errors='replace') for chunk in ...
python
def stream_decode_response_unicode(iterator, r): """Stream decodes a iterator.""" encoding = get_encoding_from_headers(r.headers) if encoding is None: for item in iterator: yield item return decoder = codecs.getincrementaldecoder(encoding)(errors='replace') for chunk in ...
[ "def", "stream_decode_response_unicode", "(", "iterator", ",", "r", ")", ":", "encoding", "=", "get_encoding_from_headers", "(", "r", ".", "headers", ")", "if", "encoding", "is", "None", ":", "for", "item", "in", "iterator", ":", "yield", "item", "return", "...
Stream decodes a iterator.
[ "Stream", "decodes", "a", "iterator", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/utils.py#L296-L311
51,705
bububa/pyTOP
pyTOP/packages/requests/utils.py
stream_decode_gzip
def stream_decode_gzip(iterator): """Stream decodes a gzip-encoded iterator""" try: dec = zlib.decompressobj(16 + zlib.MAX_WBITS) for chunk in iterator: rv = dec.decompress(chunk) if rv: yield rv buf = dec.decompress('') rv = buf + dec.flus...
python
def stream_decode_gzip(iterator): """Stream decodes a gzip-encoded iterator""" try: dec = zlib.decompressobj(16 + zlib.MAX_WBITS) for chunk in iterator: rv = dec.decompress(chunk) if rv: yield rv buf = dec.decompress('') rv = buf + dec.flus...
[ "def", "stream_decode_gzip", "(", "iterator", ")", ":", "try", ":", "dec", "=", "zlib", ".", "decompressobj", "(", "16", "+", "zlib", ".", "MAX_WBITS", ")", "for", "chunk", "in", "iterator", ":", "rv", "=", "dec", ".", "decompress", "(", "chunk", ")", ...
Stream decodes a gzip-encoded iterator
[ "Stream", "decodes", "a", "gzip", "-", "encoded", "iterator" ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/utils.py#L356-L369
51,706
chukysoria/pyspotify-connect
spotifyconnect/config.py
Config.load_application_key_file
def load_application_key_file(self, filename=b'spotify_appkey.key'): """Load your libspotify application key file. If called without arguments, it tries to read ``spotify_appkey.key`` from the current working directory. This is an alternative to setting :attr:`application_key` yourself...
python
def load_application_key_file(self, filename=b'spotify_appkey.key'): """Load your libspotify application key file. If called without arguments, it tries to read ``spotify_appkey.key`` from the current working directory. This is an alternative to setting :attr:`application_key` yourself...
[ "def", "load_application_key_file", "(", "self", ",", "filename", "=", "b'spotify_appkey.key'", ")", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "fh", ":", "self", ".", "app_key", "=", "fh", ".", "read", "(", ")" ]
Load your libspotify application key file. If called without arguments, it tries to read ``spotify_appkey.key`` from the current working directory. This is an alternative to setting :attr:`application_key` yourself. The file must be a binary key file, not the C code key file that can b...
[ "Load", "your", "libspotify", "application", "key", "file", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/config.py#L103-L114
51,707
idmillington/layout
layout/elements/text.py
Paragraph._do_layout
def _do_layout(self, data): """ Lays the text out into separate lines and calculates their total height. """ c = data['output'] word_space = c.text_width( ' ', font_name=self.font_name, font_size=self.font_size) # Arrange the t...
python
def _do_layout(self, data): """ Lays the text out into separate lines and calculates their total height. """ c = data['output'] word_space = c.text_width( ' ', font_name=self.font_name, font_size=self.font_size) # Arrange the t...
[ "def", "_do_layout", "(", "self", ",", "data", ")", ":", "c", "=", "data", "[", "'output'", "]", "word_space", "=", "c", ".", "text_width", "(", "' '", ",", "font_name", "=", "self", ".", "font_name", ",", "font_size", "=", "self", ".", "font_size", ...
Lays the text out into separate lines and calculates their total height.
[ "Lays", "the", "text", "out", "into", "separate", "lines", "and", "calculates", "their", "total", "height", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/elements/text.py#L45-L76
51,708
bububa/pyTOP
pyTOP/packages/requests/models.py
Response.iter_content
def iter_content(self, chunk_size=10 * 1024, decode_unicode=None): """Iterates over the response data. This avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each ...
python
def iter_content(self, chunk_size=10 * 1024, decode_unicode=None): """Iterates over the response data. This avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each ...
[ "def", "iter_content", "(", "self", ",", "chunk_size", "=", "10", "*", "1024", ",", "decode_unicode", "=", "None", ")", ":", "if", "self", ".", "_content_consumed", ":", "raise", "RuntimeError", "(", "'The content for this response was already consumed'", ")", "de...
Iterates over the response data. This avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can take place.
[ "Iterates", "over", "the", "response", "data", ".", "This", "avoids", "reading", "the", "content", "at", "once", "into", "memory", "for", "large", "responses", ".", "The", "chunk", "size", "is", "the", "number", "of", "bytes", "it", "should", "read", "into...
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/models.py#L535-L565
51,709
zyga/python-glibc
pyglibc/selectors.py
_get_fd
def _get_fd(fileobj): """ Get a descriptor out of a file object. :param fileobj: An integer (existing descriptor) or any object having the `fileno()` method. :raises ValueError: if the descriptor cannot be obtained or if the descriptor is invalid :returns: file descr...
python
def _get_fd(fileobj): """ Get a descriptor out of a file object. :param fileobj: An integer (existing descriptor) or any object having the `fileno()` method. :raises ValueError: if the descriptor cannot be obtained or if the descriptor is invalid :returns: file descr...
[ "def", "_get_fd", "(", "fileobj", ")", ":", "if", "isinstance", "(", "fileobj", ",", "int", ")", ":", "fd", "=", "fileobj", "else", ":", "try", ":", "fd", "=", "fileobj", ".", "fileno", "(", ")", "except", "AttributeError", ":", "fd", "=", "None", ...
Get a descriptor out of a file object. :param fileobj: An integer (existing descriptor) or any object having the `fileno()` method. :raises ValueError: if the descriptor cannot be obtained or if the descriptor is invalid :returns: file descriptor number
[ "Get", "a", "descriptor", "out", "of", "a", "file", "object", "." ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/selectors.py#L241-L262
51,710
zyga/python-glibc
pyglibc/selectors.py
EpollSelector.unregister
def unregister(self, fileobj): """ Remove interest in IO events from the specified fileobj :param fileobj: Any existing file-like object that has a fileno() method and was previously registered with :meth:`register()` :raises ValueError: if `fileobj` ...
python
def unregister(self, fileobj): """ Remove interest in IO events from the specified fileobj :param fileobj: Any existing file-like object that has a fileno() method and was previously registered with :meth:`register()` :raises ValueError: if `fileobj` ...
[ "def", "unregister", "(", "self", ",", "fileobj", ")", ":", "fd", "=", "_get_fd", "(", "fileobj", ")", "key", "=", "self", ".", "_fd_map", "[", "fd", "]", "try", ":", "self", ".", "_epoll", ".", "unregister", "(", "fd", ")", "except", "OSError", ":...
Remove interest in IO events from the specified fileobj :param fileobj: Any existing file-like object that has a fileno() method and was previously registered with :meth:`register()` :raises ValueError: if `fileobj` is invalid or not supported :raises KeyErro...
[ "Remove", "interest", "in", "IO", "events", "from", "the", "specified", "fileobj" ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/selectors.py#L354-L375
51,711
zyga/python-glibc
pyglibc/selectors.py
EpollSelector.modify
def modify(self, fileobj, events, data=None): """ Modify interest in specified IO events on the specified file object :param fileobj: Any existing file-like object that has a fileno() method :param events: A bitmask composed of EVENT_READ and EVENT_WRITE ...
python
def modify(self, fileobj, events, data=None): """ Modify interest in specified IO events on the specified file object :param fileobj: Any existing file-like object that has a fileno() method :param events: A bitmask composed of EVENT_READ and EVENT_WRITE ...
[ "def", "modify", "(", "self", ",", "fileobj", ",", "events", ",", "data", "=", "None", ")", ":", "fd", "=", "_get_fd", "(", "fileobj", ")", "epoll_events", "=", "_EpollSelectorEvents", "(", "events", ")", ".", "get_epoll_events", "(", ")", "if", "fd", ...
Modify interest in specified IO events on the specified file object :param fileobj: Any existing file-like object that has a fileno() method :param events: A bitmask composed of EVENT_READ and EVENT_WRITE :param data: (optional) Arbitrary data :raises...
[ "Modify", "interest", "in", "specified", "IO", "events", "on", "the", "specified", "file", "object" ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/selectors.py#L377-L401
51,712
zyga/python-glibc
pyglibc/selectors.py
EpollSelector.select
def select(self, timeout=None): """ Wait until one or more of the registered file objects becomes ready or until the timeout expires. :param timeout: maximum wait time, in seconds (see below for special meaning) :returns: A list of pairs (key, events) fo...
python
def select(self, timeout=None): """ Wait until one or more of the registered file objects becomes ready or until the timeout expires. :param timeout: maximum wait time, in seconds (see below for special meaning) :returns: A list of pairs (key, events) fo...
[ "def", "select", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "None", ":", "epoll_timeout", "=", "-", "1", "elif", "timeout", "<=", "0", ":", "epoll_timeout", "=", "0", "else", ":", "epoll_timeout", "=", "timeout", "max_ev...
Wait until one or more of the registered file objects becomes ready or until the timeout expires. :param timeout: maximum wait time, in seconds (see below for special meaning) :returns: A list of pairs (key, events) for each ready file object. Note that the ...
[ "Wait", "until", "one", "or", "more", "of", "the", "registered", "file", "objects", "becomes", "ready", "or", "until", "the", "timeout", "expires", "." ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/selectors.py#L403-L435
51,713
chukysoria/pyspotify-connect
spotifyconnect/connection.py
Connection.login
def login(self, username, password=None, blob=None, zeroconf=None): """Authenticate to Spotify's servers. You can login with one of three combinations: - ``username`` and ``password`` - ``username`` and ``blob`` - ``username`` and ``zeroconf`` To get the ``blob`` strin...
python
def login(self, username, password=None, blob=None, zeroconf=None): """Authenticate to Spotify's servers. You can login with one of three combinations: - ``username`` and ``password`` - ``username`` and ``blob`` - ``username`` and ``zeroconf`` To get the ``blob`` strin...
[ "def", "login", "(", "self", ",", "username", ",", "password", "=", "None", ",", "blob", "=", "None", ",", "zeroconf", "=", "None", ")", ":", "username", "=", "utils", ".", "to_char", "(", "username", ")", "if", "password", "is", "not", "None", ":", ...
Authenticate to Spotify's servers. You can login with one of three combinations: - ``username`` and ``password`` - ``username`` and ``blob`` - ``username`` and ``zeroconf`` To get the ``blob`` string, you must once log in with ``username`` and ``password``. You'll then...
[ "Authenticate", "to", "Spotify", "s", "servers", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/connection.py#L99-L130
51,714
chukysoria/pyspotify-connect
spotifyconnect/sink.py
Sink.on
def on(self): """Turn on the alsa_sink sink. This is done automatically when the sink is instantiated, so you'll only need to call this method if you ever call :meth:`off` and want to turn the sink back on. """ assert spotifyconnect._session_instance.player.num_listeners...
python
def on(self): """Turn on the alsa_sink sink. This is done automatically when the sink is instantiated, so you'll only need to call this method if you ever call :meth:`off` and want to turn the sink back on. """ assert spotifyconnect._session_instance.player.num_listeners...
[ "def", "on", "(", "self", ")", ":", "assert", "spotifyconnect", ".", "_session_instance", ".", "player", ".", "num_listeners", "(", "spotifyconnect", ".", "PlayerEvent", ".", "MUSIC_DELIVERY", ")", "==", "0", "spotifyconnect", ".", "_session_instance", ".", "pla...
Turn on the alsa_sink sink. This is done automatically when the sink is instantiated, so you'll only need to call this method if you ever call :meth:`off` and want to turn the sink back on.
[ "Turn", "on", "the", "alsa_sink", "sink", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/sink.py#L12-L22
51,715
chukysoria/pyspotify-connect
spotifyconnect/sink.py
Sink.off
def off(self): """Turn off the alsa_sink sink. This disconnects the sink from the relevant session events. """ spotifyconnect._session_instance.player.off( spotifyconnect.PlayerEvent.MUSIC_DELIVERY, self._on_music_delivery) assert spotifyconnect._session_instance.pla...
python
def off(self): """Turn off the alsa_sink sink. This disconnects the sink from the relevant session events. """ spotifyconnect._session_instance.player.off( spotifyconnect.PlayerEvent.MUSIC_DELIVERY, self._on_music_delivery) assert spotifyconnect._session_instance.pla...
[ "def", "off", "(", "self", ")", ":", "spotifyconnect", ".", "_session_instance", ".", "player", ".", "off", "(", "spotifyconnect", ".", "PlayerEvent", ".", "MUSIC_DELIVERY", ",", "self", ".", "_on_music_delivery", ")", "assert", "spotifyconnect", ".", "_session_...
Turn off the alsa_sink sink. This disconnects the sink from the relevant session events.
[ "Turn", "off", "the", "alsa_sink", "sink", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/sink.py#L24-L33
51,716
bububa/pyTOP
pyTOP/packages/requests/async.py
patched
def patched(f): """Patches a given API function to not send.""" def wrapped(*args, **kwargs): kwargs['return_response'] = False kwargs['prefetch'] = True return f(*args, **kwargs) return wrapped
python
def patched(f): """Patches a given API function to not send.""" def wrapped(*args, **kwargs): kwargs['return_response'] = False kwargs['prefetch'] = True return f(*args, **kwargs) return wrapped
[ "def", "patched", "(", "f", ")", ":", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'return_response'", "]", "=", "False", "kwargs", "[", "'prefetch'", "]", "=", "True", "return", "f", "(", "*", "args", ",",...
Patches a given API function to not send.
[ "Patches", "a", "given", "API", "function", "to", "not", "send", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/async.py#L31-L41
51,717
bububa/pyTOP
pyTOP/packages/requests/async.py
send
def send(r, pools=None): """Sends a given Request object.""" if pools: r._pools = pools r.send() return r.response
python
def send(r, pools=None): """Sends a given Request object.""" if pools: r._pools = pools r.send() return r.response
[ "def", "send", "(", "r", ",", "pools", "=", "None", ")", ":", "if", "pools", ":", "r", ".", "_pools", "=", "pools", "r", ".", "send", "(", ")", "return", "r", ".", "response" ]
Sends a given Request object.
[ "Sends", "a", "given", "Request", "object", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/async.py#L44-L52
51,718
nickmasster/xsmtplib
xsmtplib/xsmtplib.py
SMTP._print_debug
def _print_debug(self, *args): """Method output debug message into stderr :param args: Message(s) to output :rtype args: string """ if self.debuglevel > 1: print(datetime.datetime.now().time(), *args, file=sys.stderr) else: print(*args, file=sys.s...
python
def _print_debug(self, *args): """Method output debug message into stderr :param args: Message(s) to output :rtype args: string """ if self.debuglevel > 1: print(datetime.datetime.now().time(), *args, file=sys.stderr) else: print(*args, file=sys.s...
[ "def", "_print_debug", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "debuglevel", ">", "1", ":", "print", "(", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "time", "(", ")", ",", "*", "args", ",", "file", "=", "sys", "...
Method output debug message into stderr :param args: Message(s) to output :rtype args: string
[ "Method", "output", "debug", "message", "into", "stderr" ]
0207f5c72f2fec03f3ebdb3acb3a56401805f32f
https://github.com/nickmasster/xsmtplib/blob/0207f5c72f2fec03f3ebdb3acb3a56401805f32f/xsmtplib/xsmtplib.py#L93-L102
51,719
nickmasster/xsmtplib
xsmtplib/xsmtplib.py
SMTP._parse_host
def _parse_host(cls, host='localhost', port=0): """ Parse provided hostname and extract port number :param host: Server hostname :type host: string :param port: Server port :return: Tuple of (host, port) :rtype: tuple """ if not port and (host.find(':') =...
python
def _parse_host(cls, host='localhost', port=0): """ Parse provided hostname and extract port number :param host: Server hostname :type host: string :param port: Server port :return: Tuple of (host, port) :rtype: tuple """ if not port and (host.find(':') =...
[ "def", "_parse_host", "(", "cls", ",", "host", "=", "'localhost'", ",", "port", "=", "0", ")", ":", "if", "not", "port", "and", "(", "host", ".", "find", "(", "':'", ")", "==", "host", ".", "rfind", "(", "':'", ")", ")", ":", "i", "=", "host", ...
Parse provided hostname and extract port number :param host: Server hostname :type host: string :param port: Server port :return: Tuple of (host, port) :rtype: tuple
[ "Parse", "provided", "hostname", "and", "extract", "port", "number" ]
0207f5c72f2fec03f3ebdb3acb3a56401805f32f
https://github.com/nickmasster/xsmtplib/blob/0207f5c72f2fec03f3ebdb3acb3a56401805f32f/xsmtplib/xsmtplib.py#L105-L122
51,720
nickmasster/xsmtplib
xsmtplib/xsmtplib.py
SMTP.connect_proxy
def connect_proxy(self, proxy_host='localhost', proxy_port=0, proxy_type=socks.HTTP, host='localhost', port=0): """Connect to a host on a given port via proxy server If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix w...
python
def connect_proxy(self, proxy_host='localhost', proxy_port=0, proxy_type=socks.HTTP, host='localhost', port=0): """Connect to a host on a given port via proxy server If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix w...
[ "def", "connect_proxy", "(", "self", ",", "proxy_host", "=", "'localhost'", ",", "proxy_port", "=", "0", ",", "proxy_type", "=", "socks", ".", "HTTP", ",", "host", "=", "'localhost'", ",", "port", "=", "0", ")", ":", "if", "proxy_type", "not", "in", "s...
Connect to a host on a given port via proxy server If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use. Note: This method is automatically invoked by __init__...
[ "Connect", "to", "a", "host", "on", "a", "given", "port", "via", "proxy", "server" ]
0207f5c72f2fec03f3ebdb3acb3a56401805f32f
https://github.com/nickmasster/xsmtplib/blob/0207f5c72f2fec03f3ebdb3acb3a56401805f32f/xsmtplib/xsmtplib.py#L132-L183
51,721
zyga/python-glibc
pyglibc/_subreaper.py
_subreaper.enabled
def enabled(self): """ read or write the child sub-reaper flag of the current process This property behaves in the following manner: * If a read is attempted and a prior read or write has determined that this feature is unavailable (status is equal to ``SR_UNSUPPORTED``) ...
python
def enabled(self): """ read or write the child sub-reaper flag of the current process This property behaves in the following manner: * If a read is attempted and a prior read or write has determined that this feature is unavailable (status is equal to ``SR_UNSUPPORTED``) ...
[ "def", "enabled", "(", "self", ")", ":", "if", "self", ".", "_status", "==", "self", ".", "SR_UNSUPPORTED", ":", "return", "False", "status", "=", "c_int", "(", ")", "try", ":", "prctl", "(", "PR_GET_CHILD_SUBREAPER", ",", "addressof", "(", "status", ")"...
read or write the child sub-reaper flag of the current process This property behaves in the following manner: * If a read is attempted and a prior read or write has determined that this feature is unavailable (status is equal to ``SR_UNSUPPORTED``) then no further attempts are made...
[ "read", "or", "write", "the", "child", "sub", "-", "reaper", "flag", "of", "the", "current", "process" ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/_subreaper.py#L103-L143
51,722
bububa/pyTOP
pyTOP/api.py
TOP._sign
def _sign(self,params): ''' Generate API sign code ''' for k, v in params.iteritems(): if type(v) == int: v = str(v) elif type(v) == float: v = '%.2f'%v elif type(v) in (list, set): v = ','.join([str(i) for i in v]) elif ty...
python
def _sign(self,params): ''' Generate API sign code ''' for k, v in params.iteritems(): if type(v) == int: v = str(v) elif type(v) == float: v = '%.2f'%v elif type(v) in (list, set): v = ','.join([str(i) for i in v]) elif ty...
[ "def", "_sign", "(", "self", ",", "params", ")", ":", "for", "k", ",", "v", "in", "params", ".", "iteritems", "(", ")", ":", "if", "type", "(", "v", ")", "==", "int", ":", "v", "=", "str", "(", "v", ")", "elif", "type", "(", "v", ")", "==",...
Generate API sign code
[ "Generate", "API", "sign", "code" ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/api.py#L106-L122
51,723
bububa/pyTOP
pyTOP/api.py
TOP.create
def create(self, data, fields=[], models={}): ''' Create model attributes ''' if not fields: fields = self.fields if not models and hasattr(self, 'models'): models = self.models for field in fields: setattr(self,field,None) if not data: return None ...
python
def create(self, data, fields=[], models={}): ''' Create model attributes ''' if not fields: fields = self.fields if not models and hasattr(self, 'models'): models = self.models for field in fields: setattr(self,field,None) if not data: return None ...
[ "def", "create", "(", "self", ",", "data", ",", "fields", "=", "[", "]", ",", "models", "=", "{", "}", ")", ":", "if", "not", "fields", ":", "fields", "=", "self", ".", "fields", "if", "not", "models", "and", "hasattr", "(", "self", ",", "'models...
Create model attributes
[ "Create", "model", "attributes" ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/api.py#L182-L211
51,724
idmillington/layout
layout/managers/transform.py
RotateLM.get_minimum_size
def get_minimum_size(self, data): """Returns the rotated minimum size.""" size = self.element.get_minimum_size(data) if self.angle in (RotateLM.NORMAL, RotateLM.UPSIDE_DOWN): return size else: return datatypes.Point(size.y, size.x)
python
def get_minimum_size(self, data): """Returns the rotated minimum size.""" size = self.element.get_minimum_size(data) if self.angle in (RotateLM.NORMAL, RotateLM.UPSIDE_DOWN): return size else: return datatypes.Point(size.y, size.x)
[ "def", "get_minimum_size", "(", "self", ",", "data", ")", ":", "size", "=", "self", ".", "element", ".", "get_minimum_size", "(", "data", ")", "if", "self", ".", "angle", "in", "(", "RotateLM", ".", "NORMAL", ",", "RotateLM", ".", "UPSIDE_DOWN", ")", "...
Returns the rotated minimum size.
[ "Returns", "the", "rotated", "minimum", "size", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/transform.py#L43-L49
51,725
idmillington/layout
layout/managers/transform.py
AnyRotationLM._calculate_ms_from_base
def _calculate_ms_from_base(self, size): """Calculates the rotated minimum size from the given base minimum size.""" hw = size.x * 0.5 hh = size.y * 0.5 a = datatypes.Point(hw, hh).get_rotated(self.angle) b = datatypes.Point(-hw, hh).get_rotated(self.angle) c = d...
python
def _calculate_ms_from_base(self, size): """Calculates the rotated minimum size from the given base minimum size.""" hw = size.x * 0.5 hh = size.y * 0.5 a = datatypes.Point(hw, hh).get_rotated(self.angle) b = datatypes.Point(-hw, hh).get_rotated(self.angle) c = d...
[ "def", "_calculate_ms_from_base", "(", "self", ",", "size", ")", ":", "hw", "=", "size", ".", "x", "*", "0.5", "hh", "=", "size", ".", "y", "*", "0.5", "a", "=", "datatypes", ".", "Point", "(", "hw", ",", "hh", ")", ".", "get_rotated", "(", "self...
Calculates the rotated minimum size from the given base minimum size.
[ "Calculates", "the", "rotated", "minimum", "size", "from", "the", "given", "base", "minimum", "size", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/transform.py#L108-L121
51,726
senaite/senaite.jsonapi
src/senaite/jsonapi/datamanagers.py
BrainDataManager.json_data
def json_data(self, name, default=None): """Get a JSON compatible value of the field """ value = self.get(name) if value is Missing.Value: return default return value
python
def json_data(self, name, default=None): """Get a JSON compatible value of the field """ value = self.get(name) if value is Missing.Value: return default return value
[ "def", "json_data", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "value", "=", "self", ".", "get", "(", "name", ")", "if", "value", "is", "Missing", ".", "Value", ":", "return", "default", "return", "value" ]
Get a JSON compatible value of the field
[ "Get", "a", "JSON", "compatible", "value", "of", "the", "field" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/datamanagers.py#L60-L66
51,727
senaite/senaite.jsonapi
src/senaite/jsonapi/datamanagers.py
PortalDataManager.get
def get(self, name): """Get the value by name """ # check read permission sm = getSecurityManager() permission = permissions.View if not sm.checkPermission(permission, self.context): raise Unauthorized("Not allowed to view the Plone portal") # read t...
python
def get(self, name): """Get the value by name """ # check read permission sm = getSecurityManager() permission = permissions.View if not sm.checkPermission(permission, self.context): raise Unauthorized("Not allowed to view the Plone portal") # read t...
[ "def", "get", "(", "self", ",", "name", ")", ":", "# check read permission", "sm", "=", "getSecurityManager", "(", ")", "permission", "=", "permissions", ".", "View", "if", "not", "sm", ".", "checkPermission", "(", "permission", ",", "self", ".", "context", ...
Get the value by name
[ "Get", "the", "value", "by", "name" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/datamanagers.py#L73-L94
51,728
senaite/senaite.jsonapi
src/senaite/jsonapi/datamanagers.py
PortalDataManager.set
def set(self, name, value, **kw): """Set the attribute to the given value. The keyword arguments represent the other attribute values to integrate constraints to other values. """ # check write permission sm = getSecurityManager() permission = permissions.Manage...
python
def set(self, name, value, **kw): """Set the attribute to the given value. The keyword arguments represent the other attribute values to integrate constraints to other values. """ # check write permission sm = getSecurityManager() permission = permissions.Manage...
[ "def", "set", "(", "self", ",", "name", ",", "value", ",", "*", "*", "kw", ")", ":", "# check write permission", "sm", "=", "getSecurityManager", "(", ")", "permission", "=", "permissions", ".", "ManagePortal", "if", "not", "sm", ".", "checkPermission", "(...
Set the attribute to the given value. The keyword arguments represent the other attribute values to integrate constraints to other values.
[ "Set", "the", "attribute", "to", "the", "given", "value", "." ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/datamanagers.py#L96-L113
51,729
senaite/senaite.jsonapi
src/senaite/jsonapi/datamanagers.py
ATDataManager.set
def set(self, name, value, **kw): """Set the field to the given value. The keyword arguments represent the other field values to integrate constraints to other values. """ # fetch the field by name field = api.get_field(self.context, name) # bail out if we have...
python
def set(self, name, value, **kw): """Set the field to the given value. The keyword arguments represent the other field values to integrate constraints to other values. """ # fetch the field by name field = api.get_field(self.context, name) # bail out if we have...
[ "def", "set", "(", "self", ",", "name", ",", "value", ",", "*", "*", "kw", ")", ":", "# fetch the field by name", "field", "=", "api", ".", "get_field", "(", "self", ".", "context", ",", "name", ")", "# bail out if we have no field", "if", "not", "field", ...
Set the field to the given value. The keyword arguments represent the other field values to integrate constraints to other values.
[ "Set", "the", "field", "to", "the", "given", "value", "." ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/datamanagers.py#L141-L157
51,730
senaite/senaite.jsonapi
src/senaite/jsonapi/datamanagers.py
DexterityDataManager.can_write
def can_write(self): """Check if the field is writeable """ sm = getSecurityManager() permission = permissions.ModifyPortalContent if not sm.checkPermission(permission, self.context): return False return True
python
def can_write(self): """Check if the field is writeable """ sm = getSecurityManager() permission = permissions.ModifyPortalContent if not sm.checkPermission(permission, self.context): return False return True
[ "def", "can_write", "(", "self", ")", ":", "sm", "=", "getSecurityManager", "(", ")", "permission", "=", "permissions", ".", "ModifyPortalContent", "if", "not", "sm", ".", "checkPermission", "(", "permission", ",", "self", ".", "context", ")", ":", "return",...
Check if the field is writeable
[ "Check", "if", "the", "field", "is", "writeable" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/datamanagers.py#L240-L248
51,731
senaite/senaite.jsonapi
src/senaite/jsonapi/datamanagers.py
DexterityDataManager.can_read
def can_read(self): """Check if the field is readable """ sm = getSecurityManager() if not sm.checkPermission(permissions.View, self.context): return False return True
python
def can_read(self): """Check if the field is readable """ sm = getSecurityManager() if not sm.checkPermission(permissions.View, self.context): return False return True
[ "def", "can_read", "(", "self", ")", ":", "sm", "=", "getSecurityManager", "(", ")", "if", "not", "sm", ".", "checkPermission", "(", "permissions", ".", "View", ",", "self", ".", "context", ")", ":", "return", "False", "return", "True" ]
Check if the field is readable
[ "Check", "if", "the", "field", "is", "readable" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/datamanagers.py#L250-L256
51,732
Vauxoo/cfdilib
cfdilib/tools.py
Tools.send_s3_xsd
def send_s3_xsd(self, url_xsd): # pragma: no cover """This method will not be re-run always, only locally and when xsd are regenerated, read the test_008_force_s3_creation on test folder """ if self.check_s3(self.domain, urlparse(url_xsd).path[1:]): return url_xsd ...
python
def send_s3_xsd(self, url_xsd): # pragma: no cover """This method will not be re-run always, only locally and when xsd are regenerated, read the test_008_force_s3_creation on test folder """ if self.check_s3(self.domain, urlparse(url_xsd).path[1:]): return url_xsd ...
[ "def", "send_s3_xsd", "(", "self", ",", "url_xsd", ")", ":", "# pragma: no cover", "if", "self", ".", "check_s3", "(", "self", ".", "domain", ",", "urlparse", "(", "url_xsd", ")", ".", "path", "[", "1", ":", "]", ")", ":", "return", "url_xsd", "respons...
This method will not be re-run always, only locally and when xsd are regenerated, read the test_008_force_s3_creation on test folder
[ "This", "method", "will", "not", "be", "re", "-", "run", "always", "only", "locally", "and", "when", "xsd", "are", "regenerated", "read", "the", "test_008_force_s3_creation", "on", "test", "folder" ]
acd73d159f62119f3100d963a061820bbe3f93ea
https://github.com/Vauxoo/cfdilib/blob/acd73d159f62119f3100d963a061820bbe3f93ea/cfdilib/tools.py#L87-L142
51,733
Vauxoo/cfdilib
cfdilib/tools.py
Tools.check_s3
def check_s3(self, bucket, element): # pragma: no cover """This method is a helper con `cache_s3`. Read method `cache_s3` for more information. :param bucket: :param element: :return: """ session = boto3.Session(profile_name=self.profile_name) s3 = sessi...
python
def check_s3(self, bucket, element): # pragma: no cover """This method is a helper con `cache_s3`. Read method `cache_s3` for more information. :param bucket: :param element: :return: """ session = boto3.Session(profile_name=self.profile_name) s3 = sessi...
[ "def", "check_s3", "(", "self", ",", "bucket", ",", "element", ")", ":", "# pragma: no cover", "session", "=", "boto3", ".", "Session", "(", "profile_name", "=", "self", ".", "profile_name", ")", "s3", "=", "session", ".", "resource", "(", "'s3'", ")", "...
This method is a helper con `cache_s3`. Read method `cache_s3` for more information. :param bucket: :param element: :return:
[ "This", "method", "is", "a", "helper", "con", "cache_s3", ".", "Read", "method", "cache_s3", "for", "more", "information", "." ]
acd73d159f62119f3100d963a061820bbe3f93ea
https://github.com/Vauxoo/cfdilib/blob/acd73d159f62119f3100d963a061820bbe3f93ea/cfdilib/tools.py#L144-L169
51,734
Vauxoo/cfdilib
cfdilib/tools.py
Tools.cache_it
def cache_it(self, url): """Take an url which deliver a plain document and convert it to a temporary file, this document is an xslt file expecting contains all xslt definitions, then the cache process is recursive. :param url: document origin url :type url: str :return...
python
def cache_it(self, url): """Take an url which deliver a plain document and convert it to a temporary file, this document is an xslt file expecting contains all xslt definitions, then the cache process is recursive. :param url: document origin url :type url: str :return...
[ "def", "cache_it", "(", "self", ",", "url", ")", ":", "# TODO: Use directly the file object instead of the name of the file", "# with seek(0)", "cached", "=", "self", ".", "_cache_it", "(", "url", ")", "if", "not", "isfile", "(", "cached", ".", "name", ")", ...
Take an url which deliver a plain document and convert it to a temporary file, this document is an xslt file expecting contains all xslt definitions, then the cache process is recursive. :param url: document origin url :type url: str :return file_path: local new absolute path ...
[ "Take", "an", "url", "which", "deliver", "a", "plain", "document", "and", "convert", "it", "to", "a", "temporary", "file", "this", "document", "is", "an", "xslt", "file", "expecting", "contains", "all", "xslt", "definitions", "then", "the", "cache", "process...
acd73d159f62119f3100d963a061820bbe3f93ea
https://github.com/Vauxoo/cfdilib/blob/acd73d159f62119f3100d963a061820bbe3f93ea/cfdilib/tools.py#L256-L274
51,735
Vauxoo/cfdilib
cfdilib/tools.py
Tools.get_original
def get_original(document, xslt): """Get the original chain given document path and xslt local path :param str document: local absolute path to document :param str xslt: local absolute path to xst file :return: new chain generated. :rtype: str """ dom = etree.par...
python
def get_original(document, xslt): """Get the original chain given document path and xslt local path :param str document: local absolute path to document :param str xslt: local absolute path to xst file :return: new chain generated. :rtype: str """ dom = etree.par...
[ "def", "get_original", "(", "document", ",", "xslt", ")", ":", "dom", "=", "etree", ".", "parse", "(", "document", ")", "# TODO: cuando este probando -", "# fuente:", "# http://stackoverflow.com/questions/16698935/how-to-transform-an-xml-file-using-xslt-in-python", "xslt", "=...
Get the original chain given document path and xslt local path :param str document: local absolute path to document :param str xslt: local absolute path to xst file :return: new chain generated. :rtype: str
[ "Get", "the", "original", "chain", "given", "document", "path", "and", "xslt", "local", "path" ]
acd73d159f62119f3100d963a061820bbe3f93ea
https://github.com/Vauxoo/cfdilib/blob/acd73d159f62119f3100d963a061820bbe3f93ea/cfdilib/tools.py#L277-L291
51,736
zyga/python-glibc
pyglibc/_signalfd.py
signalfd.close
def close(self): """ Close the internal signalfd file descriptor if it isn't closed :raises OSError: If the underlying ``close(2)`` fails. The error message matches those found in the manual page. """ with self._close_lock: sfd = self._sfd ...
python
def close(self): """ Close the internal signalfd file descriptor if it isn't closed :raises OSError: If the underlying ``close(2)`` fails. The error message matches those found in the manual page. """ with self._close_lock: sfd = self._sfd ...
[ "def", "close", "(", "self", ")", ":", "with", "self", ".", "_close_lock", ":", "sfd", "=", "self", ".", "_sfd", "if", "sfd", ">=", "0", ":", "self", ".", "_sfd", "=", "-", "1", "self", ".", "_signals", "=", "frozenset", "(", ")", "close", "(", ...
Close the internal signalfd file descriptor if it isn't closed :raises OSError: If the underlying ``close(2)`` fails. The error message matches those found in the manual page.
[ "Close", "the", "internal", "signalfd", "file", "descriptor", "if", "it", "isn", "t", "closed" ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/_signalfd.py#L103-L116
51,737
zyga/python-glibc
pyglibc/_signalfd.py
signalfd.fromfd
def fromfd(cls, fd, signals): """ Create a new signalfd object from a given file descriptor :param fd: A pre-made file descriptor obtained from ``signalfd_create(2)` :param signals: A pre-made frozenset that describes the monitored signals :raises ValueEr...
python
def fromfd(cls, fd, signals): """ Create a new signalfd object from a given file descriptor :param fd: A pre-made file descriptor obtained from ``signalfd_create(2)` :param signals: A pre-made frozenset that describes the monitored signals :raises ValueEr...
[ "def", "fromfd", "(", "cls", ",", "fd", ",", "signals", ")", ":", "if", "fd", "<", "0", ":", "_err_closed", "(", ")", "self", "=", "cls", ".", "__new__", "(", ")", "object", ".", "__init__", "(", "self", ")", "self", ".", "_sfd", "=", "fd", "se...
Create a new signalfd object from a given file descriptor :param fd: A pre-made file descriptor obtained from ``signalfd_create(2)` :param signals: A pre-made frozenset that describes the monitored signals :raises ValueError: If fd is not a valid file descrip...
[ "Create", "a", "new", "signalfd", "object", "from", "a", "given", "file", "descriptor" ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/_signalfd.py#L157-L180
51,738
zyga/python-glibc
pyglibc/_signalfd.py
signalfd.update
def update(self, signals): """ Update the mask of signals this signalfd reacts to :param signals: A replacement set of signal numbers to monitor :raises ValueError: If :meth:`closed()` is True """ if self._sfd < 0: _err_closed() ...
python
def update(self, signals): """ Update the mask of signals this signalfd reacts to :param signals: A replacement set of signal numbers to monitor :raises ValueError: If :meth:`closed()` is True """ if self._sfd < 0: _err_closed() ...
[ "def", "update", "(", "self", ",", "signals", ")", ":", "if", "self", ".", "_sfd", "<", "0", ":", "_err_closed", "(", ")", "mask", "=", "sigset_t", "(", ")", "sigemptyset", "(", "mask", ")", "if", "signals", "is", "not", "None", ":", "for", "signal...
Update the mask of signals this signalfd reacts to :param signals: A replacement set of signal numbers to monitor :raises ValueError: If :meth:`closed()` is True
[ "Update", "the", "mask", "of", "signals", "this", "signalfd", "reacts", "to" ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/_signalfd.py#L182-L200
51,739
zyga/python-glibc
pyglibc/_signalfd.py
signalfd.read
def read(self, maxsignals=None): """ Read information about currently pending signals. :param maxsignals: Maximum number of signals to read. By default this is the same as the number of signals registered with this signalfd. :returns: A list of signal...
python
def read(self, maxsignals=None): """ Read information about currently pending signals. :param maxsignals: Maximum number of signals to read. By default this is the same as the number of signals registered with this signalfd. :returns: A list of signal...
[ "def", "read", "(", "self", ",", "maxsignals", "=", "None", ")", ":", "if", "maxsignals", "is", "None", ":", "maxsignals", "=", "len", "(", "self", ".", "_signals", ")", "if", "maxsignals", "<=", "0", ":", "raise", "ValueError", "(", "\"maxsignals must b...
Read information about currently pending signals. :param maxsignals: Maximum number of signals to read. By default this is the same as the number of signals registered with this signalfd. :returns: A list of signalfd_siginfo object with information about most ...
[ "Read", "information", "about", "currently", "pending", "signals", "." ]
d6fdb306b123a995471584a5201155c60a34448a
https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/pyglibc/_signalfd.py#L202-L227
51,740
wharris/dougrain
dougrain/builder.py
Builder.add_curie
def add_curie(self, name, href): """Adds a CURIE definition. A CURIE link with the given ``name`` and ``href`` is added to the document. This method returns self, allowing it to be chained with additional method calls. """ self.draft.set_curie(self, name, href) ...
python
def add_curie(self, name, href): """Adds a CURIE definition. A CURIE link with the given ``name`` and ``href`` is added to the document. This method returns self, allowing it to be chained with additional method calls. """ self.draft.set_curie(self, name, href) ...
[ "def", "add_curie", "(", "self", ",", "name", ",", "href", ")", ":", "self", ".", "draft", ".", "set_curie", "(", "self", ",", "name", ",", "href", ")", "return", "self" ]
Adds a CURIE definition. A CURIE link with the given ``name`` and ``href`` is added to the document. This method returns self, allowing it to be chained with additional method calls.
[ "Adds", "a", "CURIE", "definition", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/builder.py#L74-L84
51,741
wharris/dougrain
dougrain/builder.py
Builder._add_rel
def _add_rel(self, key, rel, thing, wrap): """Adds ``thing`` to links or embedded resources. Calling code should not use this method directly and should use ``embed`` or ``add_link`` instead. """ self.o.setdefault(key, {}) if wrap: self.o[key].setdefault(re...
python
def _add_rel(self, key, rel, thing, wrap): """Adds ``thing`` to links or embedded resources. Calling code should not use this method directly and should use ``embed`` or ``add_link`` instead. """ self.o.setdefault(key, {}) if wrap: self.o[key].setdefault(re...
[ "def", "_add_rel", "(", "self", ",", "key", ",", "rel", ",", "thing", ",", "wrap", ")", ":", "self", ".", "o", ".", "setdefault", "(", "key", ",", "{", "}", ")", "if", "wrap", ":", "self", ".", "o", "[", "key", "]", ".", "setdefault", "(", "r...
Adds ``thing`` to links or embedded resources. Calling code should not use this method directly and should use ``embed`` or ``add_link`` instead.
[ "Adds", "thing", "to", "links", "or", "embedded", "resources", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/builder.py#L191-L212
51,742
danilobellini/dose
dose/about.py
about_box
def about_box(): """A simple about dialog box using the distribution data files.""" about_info = wx.adv.AboutDialogInfo() for k, v in metadata.items(): setattr(about_info, snake2ucamel(k), v) wx.adv.AboutBox(about_info)
python
def about_box(): """A simple about dialog box using the distribution data files.""" about_info = wx.adv.AboutDialogInfo() for k, v in metadata.items(): setattr(about_info, snake2ucamel(k), v) wx.adv.AboutBox(about_info)
[ "def", "about_box", "(", ")", ":", "about_info", "=", "wx", ".", "adv", ".", "AboutDialogInfo", "(", ")", "for", "k", ",", "v", "in", "metadata", ".", "items", "(", ")", ":", "setattr", "(", "about_info", ",", "snake2ucamel", "(", "k", ")", ",", "v...
A simple about dialog box using the distribution data files.
[ "A", "simple", "about", "dialog", "box", "using", "the", "distribution", "data", "files", "." ]
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/about.py#L20-L25
51,743
Vauxoo/cfdilib
cfdilib/signatory.py
Signatory.sign
def sign(self, xml_doc): """Sign the document with a third party signatory. :param str xml_doc: Document self signed in plain xml :returns answer: Answer is given from the signatory itself if connected. """ try: self.client = Client(self.url) exce...
python
def sign(self, xml_doc): """Sign the document with a third party signatory. :param str xml_doc: Document self signed in plain xml :returns answer: Answer is given from the signatory itself if connected. """ try: self.client = Client(self.url) exce...
[ "def", "sign", "(", "self", ",", "xml_doc", ")", ":", "try", ":", "self", ".", "client", "=", "Client", "(", "self", ".", "url", ")", "except", "ValueError", "as", "e", ":", "self", ".", "message", "=", "e", ".", "message", "except", "URLError", ":...
Sign the document with a third party signatory. :param str xml_doc: Document self signed in plain xml :returns answer: Answer is given from the signatory itself if connected.
[ "Sign", "the", "document", "with", "a", "third", "party", "signatory", "." ]
acd73d159f62119f3100d963a061820bbe3f93ea
https://github.com/Vauxoo/cfdilib/blob/acd73d159f62119f3100d963a061820bbe3f93ea/cfdilib/signatory.py#L37-L50
51,744
senaite/senaite.jsonapi
src/senaite/jsonapi/request.py
get
def get(key, default=None): """ return the key from the request """ data = get_form() or get_query_string() return data.get(key, default)
python
def get(key, default=None): """ return the key from the request """ data = get_form() or get_query_string() return data.get(key, default)
[ "def", "get", "(", "key", ",", "default", "=", "None", ")", ":", "data", "=", "get_form", "(", ")", "or", "get_query_string", "(", ")", "return", "data", ".", "get", "(", "key", ",", "default", ")" ]
return the key from the request
[ "return", "the", "key", "from", "the", "request" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/request.py#L60-L64
51,745
senaite/senaite.jsonapi
src/senaite/jsonapi/request.py
is_true
def is_true(key, default=False): """ Check if the value is in TRUE_VALUES """ value = get(key, default) if isinstance(value, list): value = value[0] if isinstance(value, bool): return value if value is default: return default return value.lower() in TRUE_VALUES
python
def is_true(key, default=False): """ Check if the value is in TRUE_VALUES """ value = get(key, default) if isinstance(value, list): value = value[0] if isinstance(value, bool): return value if value is default: return default return value.lower() in TRUE_VALUES
[ "def", "is_true", "(", "key", ",", "default", "=", "False", ")", ":", "value", "=", "get", "(", "key", ",", "default", ")", "if", "isinstance", "(", "value", ",", "list", ")", ":", "value", "=", "value", "[", "0", "]", "if", "isinstance", "(", "v...
Check if the value is in TRUE_VALUES
[ "Check", "if", "the", "value", "is", "in", "TRUE_VALUES" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/request.py#L67-L77
51,746
senaite/senaite.jsonapi
src/senaite/jsonapi/request.py
get_sort_limit
def get_sort_limit(): """ returns the 'sort_limit' from the request """ limit = _.convert(get("sort_limit"), _.to_int) if (limit < 1): limit = None # catalog raises IndexError if limit < 1 return limit
python
def get_sort_limit(): """ returns the 'sort_limit' from the request """ limit = _.convert(get("sort_limit"), _.to_int) if (limit < 1): limit = None # catalog raises IndexError if limit < 1 return limit
[ "def", "get_sort_limit", "(", ")", ":", "limit", "=", "_", ".", "convert", "(", "get", "(", "\"sort_limit\"", ")", ",", "_", ".", "to_int", ")", "if", "(", "limit", "<", "1", ")", ":", "limit", "=", "None", "# catalog raises IndexError if limit < 1", "re...
returns the 'sort_limit' from the request
[ "returns", "the", "sort_limit", "from", "the", "request" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/request.py#L116-L122
51,747
senaite/senaite.jsonapi
src/senaite/jsonapi/request.py
get_sort_on
def get_sort_on(allowed_indexes=None): """ returns the 'sort_on' from the request """ sort_on = get("sort_on") if allowed_indexes and sort_on not in allowed_indexes: logger.warn("Index '{}' is not in allowed_indexes".format(sort_on)) return None return sort_on
python
def get_sort_on(allowed_indexes=None): """ returns the 'sort_on' from the request """ sort_on = get("sort_on") if allowed_indexes and sort_on not in allowed_indexes: logger.warn("Index '{}' is not in allowed_indexes".format(sort_on)) return None return sort_on
[ "def", "get_sort_on", "(", "allowed_indexes", "=", "None", ")", ":", "sort_on", "=", "get", "(", "\"sort_on\"", ")", "if", "allowed_indexes", "and", "sort_on", "not", "in", "allowed_indexes", ":", "logger", ".", "warn", "(", "\"Index '{}' is not in allowed_indexes...
returns the 'sort_on' from the request
[ "returns", "the", "sort_on", "from", "the", "request" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/request.py#L137-L144
51,748
senaite/senaite.jsonapi
src/senaite/jsonapi/request.py
set_json_item
def set_json_item(key, value): """ manipulate json data on the fly """ data = get_json() data[key] = value request = get_request() request["BODY"] = json.dumps(data)
python
def set_json_item(key, value): """ manipulate json data on the fly """ data = get_json() data[key] = value request = get_request() request["BODY"] = json.dumps(data)
[ "def", "set_json_item", "(", "key", ",", "value", ")", ":", "data", "=", "get_json", "(", ")", "data", "[", "key", "]", "=", "value", "request", "=", "get_request", "(", ")", "request", "[", "\"BODY\"", "]", "=", "json", ".", "dumps", "(", "data", ...
manipulate json data on the fly
[ "manipulate", "json", "data", "on", "the", "fly" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/request.py#L219-L226
51,749
danilobellini/dose
dose/_legacy.py
rounded_rectangle_region
def rounded_rectangle_region(width, height, radius): """ Returns a rounded rectangle wx.Region """ bmp = wx.Bitmap.FromRGBA(width, height) # Mask color is #000000 dc = wx.MemoryDC(bmp) dc.Brush = wx.Brush((255,) * 3) # Any non-black would do dc.DrawRoundedRectangle(0, 0, width, height, radius) dc.Select...
python
def rounded_rectangle_region(width, height, radius): """ Returns a rounded rectangle wx.Region """ bmp = wx.Bitmap.FromRGBA(width, height) # Mask color is #000000 dc = wx.MemoryDC(bmp) dc.Brush = wx.Brush((255,) * 3) # Any non-black would do dc.DrawRoundedRectangle(0, 0, width, height, radius) dc.Select...
[ "def", "rounded_rectangle_region", "(", "width", ",", "height", ",", "radius", ")", ":", "bmp", "=", "wx", ".", "Bitmap", ".", "FromRGBA", "(", "width", ",", "height", ")", "# Mask color is #000000", "dc", "=", "wx", ".", "MemoryDC", "(", "bmp", ")", "dc...
Returns a rounded rectangle wx.Region
[ "Returns", "a", "rounded", "rectangle", "wx", ".", "Region" ]
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/_legacy.py#L70-L80
51,750
danilobellini/dose
dose/_legacy.py
call_after
def call_after(lag): """ Parametrized decorator for calling a function after a time ``lag`` given in milliseconds. This cancels simultaneous calls. """ def decorator(func): @wraps(func) def wrapper(*args, **kwargs): wrapper.timer.cancel() # Debounce wrapper.timer = threading.Timer(lag, fun...
python
def call_after(lag): """ Parametrized decorator for calling a function after a time ``lag`` given in milliseconds. This cancels simultaneous calls. """ def decorator(func): @wraps(func) def wrapper(*args, **kwargs): wrapper.timer.cancel() # Debounce wrapper.timer = threading.Timer(lag, fun...
[ "def", "call_after", "(", "lag", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "wrapper", ".", "timer", ".", "cancel", "(", ")", "# Debo...
Parametrized decorator for calling a function after a time ``lag`` given in milliseconds. This cancels simultaneous calls.
[ "Parametrized", "decorator", "for", "calling", "a", "function", "after", "a", "time", "lag", "given", "in", "milliseconds", ".", "This", "cancels", "simultaneous", "calls", "." ]
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/_legacy.py#L497-L510
51,751
danilobellini/dose
dose/_legacy.py
DoseWatcher.start
def start(self): """Starts watching the path and running the test jobs.""" assert not self.watching def selector(evt): if evt.is_directory: return False path = evt.path if path in self._last_fnames: # Detected a "killing cycle" return False for pattern in self.skip_p...
python
def start(self): """Starts watching the path and running the test jobs.""" assert not self.watching def selector(evt): if evt.is_directory: return False path = evt.path if path in self._last_fnames: # Detected a "killing cycle" return False for pattern in self.skip_p...
[ "def", "start", "(", "self", ")", ":", "assert", "not", "self", ".", "watching", "def", "selector", "(", "evt", ")", ":", "if", "evt", ".", "is_directory", ":", "return", "False", "path", "=", "evt", ".", "path", "if", "path", "in", "self", ".", "_...
Starts watching the path and running the test jobs.
[ "Starts", "watching", "the", "path", "and", "running", "the", "test", "jobs", "." ]
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/_legacy.py#L460-L488
51,752
danilobellini/dose
dose/_legacy.py
DoseMainWindow.on_close
def on_close(self, evt): """ Pop-up menu and wx.EVT_CLOSE closing event """ self.stop() # DoseWatcher if evt.EventObject is not self: # Avoid deadlocks self.Close() # wx.Frame evt.Skip()
python
def on_close(self, evt): """ Pop-up menu and wx.EVT_CLOSE closing event """ self.stop() # DoseWatcher if evt.EventObject is not self: # Avoid deadlocks self.Close() # wx.Frame evt.Skip()
[ "def", "on_close", "(", "self", ",", "evt", ")", ":", "self", ".", "stop", "(", ")", "# DoseWatcher", "if", "evt", ".", "EventObject", "is", "not", "self", ":", "# Avoid deadlocks", "self", ".", "Close", "(", ")", "# wx.Frame", "evt", ".", "Skip", "(",...
Pop-up menu and wx.EVT_CLOSE closing event
[ "Pop", "-", "up", "menu", "and", "wx", ".", "EVT_CLOSE", "closing", "event" ]
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/_legacy.py#L627-L634
51,753
wharris/dougrain
dougrain/document.py
mutator
def mutator(*cache_names): """Decorator for ``Document`` methods that change the document. This decorator ensures that the object's caches are kept in sync when changes are made. """ def deco(fn): @wraps(fn) def _fn(self, *args, **kwargs): try: return fn...
python
def mutator(*cache_names): """Decorator for ``Document`` methods that change the document. This decorator ensures that the object's caches are kept in sync when changes are made. """ def deco(fn): @wraps(fn) def _fn(self, *args, **kwargs): try: return fn...
[ "def", "mutator", "(", "*", "cache_names", ")", ":", "def", "deco", "(", "fn", ")", ":", "@", "wraps", "(", "fn", ")", "def", "_fn", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "fn", "(", "self", ",...
Decorator for ``Document`` methods that change the document. This decorator ensures that the object's caches are kept in sync when changes are made.
[ "Decorator", "for", "Document", "methods", "that", "change", "the", "document", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L217-L235
51,754
wharris/dougrain
dougrain/document.py
CanonicalRels.canonical_key
def canonical_key(self, key): """Returns the canonical key for the given ``key``.""" if key.startswith('/'): return urlparse.urljoin(self.base_uri, key) else: return self.curies.expand(key)
python
def canonical_key(self, key): """Returns the canonical key for the given ``key``.""" if key.startswith('/'): return urlparse.urljoin(self.base_uri, key) else: return self.curies.expand(key)
[ "def", "canonical_key", "(", "self", ",", "key", ")", ":", "if", "key", ".", "startswith", "(", "'/'", ")", ":", "return", "urlparse", ".", "urljoin", "(", "self", ".", "base_uri", ",", "key", ")", "else", ":", "return", "self", ".", "curies", ".", ...
Returns the canonical key for the given ``key``.
[ "Returns", "the", "canonical", "key", "for", "the", "given", "key", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L99-L104
51,755
wharris/dougrain
dougrain/document.py
Document.url
def url(self): """Returns the URL for the resource based on the ``self`` link. This method returns the ``href`` of the document's ``self`` link if it has one, or ``None`` if the document lacks a ``self`` link, or the ``href`` of the document's first ``self`` link if it has more than one...
python
def url(self): """Returns the URL for the resource based on the ``self`` link. This method returns the ``href`` of the document's ``self`` link if it has one, or ``None`` if the document lacks a ``self`` link, or the ``href`` of the document's first ``self`` link if it has more than one...
[ "def", "url", "(", "self", ")", ":", "if", "not", "'self'", "in", "self", ".", "links", ":", "return", "None", "self_link", "=", "self", ".", "links", "[", "'self'", "]", "if", "isinstance", "(", "self_link", ",", "list", ")", ":", "for", "link", "...
Returns the URL for the resource based on the ``self`` link. This method returns the ``href`` of the document's ``self`` link if it has one, or ``None`` if the document lacks a ``self`` link, or the ``href`` of the document's first ``self`` link if it has more than one.
[ "Returns", "the", "URL", "for", "the", "resource", "based", "on", "the", "self", "link", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L366-L383
51,756
wharris/dougrain
dougrain/document.py
Document.set_property
def set_property(self, key, value): """Set a property on the document. Calling code should use this method to add and modify properties on the document instead of modifying ``properties`` directly. If ``key`` is ``"_links"`` or ``"_embedded"`` this method will silently fail. ...
python
def set_property(self, key, value): """Set a property on the document. Calling code should use this method to add and modify properties on the document instead of modifying ``properties`` directly. If ``key`` is ``"_links"`` or ``"_embedded"`` this method will silently fail. ...
[ "def", "set_property", "(", "self", ",", "key", ",", "value", ")", ":", "if", "key", "in", "self", ".", "RESERVED_ATTRIBUTE_NAMES", ":", "return", "self", ".", "o", "[", "key", "]", "=", "value" ]
Set a property on the document. Calling code should use this method to add and modify properties on the document instead of modifying ``properties`` directly. If ``key`` is ``"_links"`` or ``"_embedded"`` this method will silently fail. If there is no property with the name in...
[ "Set", "a", "property", "on", "the", "document", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L406-L423
51,757
wharris/dougrain
dougrain/document.py
Document.delete_property
def delete_property(self, key): """Remove a property from the document. Calling code should use this method to remove properties on the document instead of modifying ``properties`` directly. If there is a property with the name in ``key``, it will be removed. Otherwise, a ``Key...
python
def delete_property(self, key): """Remove a property from the document. Calling code should use this method to remove properties on the document instead of modifying ``properties`` directly. If there is a property with the name in ``key``, it will be removed. Otherwise, a ``Key...
[ "def", "delete_property", "(", "self", ",", "key", ")", ":", "if", "key", "in", "self", ".", "RESERVED_ATTRIBUTE_NAMES", ":", "raise", "KeyError", "(", "key", ")", "del", "self", ".", "o", "[", "key", "]" ]
Remove a property from the document. Calling code should use this method to remove properties on the document instead of modifying ``properties`` directly. If there is a property with the name in ``key``, it will be removed. Otherwise, a ``KeyError`` will be thrown.
[ "Remove", "a", "property", "from", "the", "document", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L426-L438
51,758
wharris/dougrain
dougrain/document.py
Document.link
def link(self, href, **kwargs): """Retuns a new link relative to this resource.""" return link.Link(dict(href=href, **kwargs), self.base_uri)
python
def link(self, href, **kwargs): """Retuns a new link relative to this resource.""" return link.Link(dict(href=href, **kwargs), self.base_uri)
[ "def", "link", "(", "self", ",", "href", ",", "*", "*", "kwargs", ")", ":", "return", "link", ".", "Link", "(", "dict", "(", "href", "=", "href", ",", "*", "*", "kwargs", ")", ",", "self", ".", "base_uri", ")" ]
Retuns a new link relative to this resource.
[ "Retuns", "a", "new", "link", "relative", "to", "this", "resource", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L440-L442
51,759
wharris/dougrain
dougrain/document.py
Document.delete_link
def delete_link(self, rel=None, href=lambda _: True): """Deletes links from the document. Calling code should use this method to remove links instead of modyfying ``links`` directly. The optional arguments, ``rel`` and ``href`` are used to select the links that will be deleted....
python
def delete_link(self, rel=None, href=lambda _: True): """Deletes links from the document. Calling code should use this method to remove links instead of modyfying ``links`` directly. The optional arguments, ``rel`` and ``href`` are used to select the links that will be deleted....
[ "def", "delete_link", "(", "self", ",", "rel", "=", "None", ",", "href", "=", "lambda", "_", ":", "True", ")", ":", "if", "not", "LINKS_KEY", "in", "self", ".", "o", ":", "return", "links", "=", "self", ".", "o", "[", "LINKS_KEY", "]", "if", "rel...
Deletes links from the document. Calling code should use this method to remove links instead of modyfying ``links`` directly. The optional arguments, ``rel`` and ``href`` are used to select the links that will be deleted. If neither of the optional arguments are given, this met...
[ "Deletes", "links", "from", "the", "document", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L505-L560
51,760
wharris/dougrain
dougrain/document.py
Document.from_object
def from_object(cls, o, base_uri=None, parent_curies=None, draft=AUTO): """Returns a new ``Document`` based on a JSON object or array. Arguments: - ``o``: a dictionary holding the deserializated JSON for the new ``Document``, or a ``list`` of such documents. - ``base_u...
python
def from_object(cls, o, base_uri=None, parent_curies=None, draft=AUTO): """Returns a new ``Document`` based on a JSON object or array. Arguments: - ``o``: a dictionary holding the deserializated JSON for the new ``Document``, or a ``list`` of such documents. - ``base_u...
[ "def", "from_object", "(", "cls", ",", "o", ",", "base_uri", "=", "None", ",", "parent_curies", "=", "None", ",", "draft", "=", "AUTO", ")", ":", "if", "isinstance", "(", "o", ",", "list", ")", ":", "return", "[", "cls", ".", "from_object", "(", "x...
Returns a new ``Document`` based on a JSON object or array. Arguments: - ``o``: a dictionary holding the deserializated JSON for the new ``Document``, or a ``list`` of such documents. - ``base_uri``: optional URL used as the basis when expanding ...
[ "Returns", "a", "new", "Document", "based", "on", "a", "JSON", "object", "or", "array", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L563-L586
51,761
wharris/dougrain
dougrain/document.py
Document.empty
def empty(cls, base_uri=None, draft=AUTO): """Returns an empty ``Document``. Arguments: - ``base_uri``: optional URL used as the basis when expanding relative URLs in the document. - ``draft``: a ``Draft`` instance that selects the version of the spec ...
python
def empty(cls, base_uri=None, draft=AUTO): """Returns an empty ``Document``. Arguments: - ``base_uri``: optional URL used as the basis when expanding relative URLs in the document. - ``draft``: a ``Draft`` instance that selects the version of the spec ...
[ "def", "empty", "(", "cls", ",", "base_uri", "=", "None", ",", "draft", "=", "AUTO", ")", ":", "return", "cls", ".", "from_object", "(", "{", "}", ",", "base_uri", "=", "base_uri", ",", "draft", "=", "draft", ")" ]
Returns an empty ``Document``. Arguments: - ``base_uri``: optional URL used as the basis when expanding relative URLs in the document. - ``draft``: a ``Draft`` instance that selects the version of the spec to which the document should conform...
[ "Returns", "an", "empty", "Document", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L589-L600
51,762
wharris/dougrain
dougrain/document.py
Document.delete_embedded
def delete_embedded(self, rel=None, href=lambda _: True): """Removes an embedded resource from this document. Calling code should use this method to remove embedded resources instead of modifying ``embedded`` directly. The optional arguments, ``rel`` and ``href`` are used to select the...
python
def delete_embedded(self, rel=None, href=lambda _: True): """Removes an embedded resource from this document. Calling code should use this method to remove embedded resources instead of modifying ``embedded`` directly. The optional arguments, ``rel`` and ``href`` are used to select the...
[ "def", "delete_embedded", "(", "self", ",", "rel", "=", "None", ",", "href", "=", "lambda", "_", ":", "True", ")", ":", "if", "EMBEDDED_KEY", "not", "in", "self", ".", "o", ":", "return", "if", "rel", "is", "None", ":", "for", "rel", "in", "list", ...
Removes an embedded resource from this document. Calling code should use this method to remove embedded resources instead of modifying ``embedded`` directly. The optional arguments, ``rel`` and ``href`` are used to select the embedded resources that will be removed. If neither of the o...
[ "Removes", "an", "embedded", "resource", "from", "this", "document", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L665-L731
51,763
wharris/dougrain
dougrain/document.py
Document.drop_curie
def drop_curie(self, name): """Removes a CURIE. The CURIE link with the given name is removed from the document. """ curies = self.o[LINKS_KEY][self.draft.curies_rel] if isinstance(curies, dict) and curies['name'] == name: del self.o[LINKS_KEY][self.draft.curies_rel...
python
def drop_curie(self, name): """Removes a CURIE. The CURIE link with the given name is removed from the document. """ curies = self.o[LINKS_KEY][self.draft.curies_rel] if isinstance(curies, dict) and curies['name'] == name: del self.o[LINKS_KEY][self.draft.curies_rel...
[ "def", "drop_curie", "(", "self", ",", "name", ")", ":", "curies", "=", "self", ".", "o", "[", "LINKS_KEY", "]", "[", "self", ".", "draft", ".", "curies_rel", "]", "if", "isinstance", "(", "curies", ",", "dict", ")", "and", "curies", "[", "'name'", ...
Removes a CURIE. The CURIE link with the given name is removed from the document.
[ "Removes", "a", "CURIE", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/document.py#L745-L761
51,764
brentp/cigar
cigar.py
Cigar.mask_left
def mask_left(self, n_seq_bases, mask="S"): """ Return a new cigar with cigar string where the first `n_seq_bases` are soft-masked unless they are already hard-masked. """ cigs = list(self.items()) new_cigs = [] c, cum_len = self.cigar, 0 for i, (l, op) ...
python
def mask_left(self, n_seq_bases, mask="S"): """ Return a new cigar with cigar string where the first `n_seq_bases` are soft-masked unless they are already hard-masked. """ cigs = list(self.items()) new_cigs = [] c, cum_len = self.cigar, 0 for i, (l, op) ...
[ "def", "mask_left", "(", "self", ",", "n_seq_bases", ",", "mask", "=", "\"S\"", ")", ":", "cigs", "=", "list", "(", "self", ".", "items", "(", ")", ")", "new_cigs", "=", "[", "]", "c", ",", "cum_len", "=", "self", ".", "cigar", ",", "0", "for", ...
Return a new cigar with cigar string where the first `n_seq_bases` are soft-masked unless they are already hard-masked.
[ "Return", "a", "new", "cigar", "with", "cigar", "string", "where", "the", "first", "n_seq_bases", "are", "soft", "-", "masked", "unless", "they", "are", "already", "hard", "-", "masked", "." ]
754cfed348364d390ec1aa40c951362ca1041f7a
https://github.com/brentp/cigar/blob/754cfed348364d390ec1aa40c951362ca1041f7a/cigar.py#L99-L129
51,765
brentp/cigar
cigar.py
Cigar.mask_right
def mask_right(self, n_seq_bases, mask="S"): """ Return a new cigar with cigar string where the last `n_seq_bases` are soft-masked unless they are already hard-masked. """ return Cigar(Cigar(self._reverse_cigar()).mask_left(n_seq_bases, mask)._reverse_cigar())
python
def mask_right(self, n_seq_bases, mask="S"): """ Return a new cigar with cigar string where the last `n_seq_bases` are soft-masked unless they are already hard-masked. """ return Cigar(Cigar(self._reverse_cigar()).mask_left(n_seq_bases, mask)._reverse_cigar())
[ "def", "mask_right", "(", "self", ",", "n_seq_bases", ",", "mask", "=", "\"S\"", ")", ":", "return", "Cigar", "(", "Cigar", "(", "self", ".", "_reverse_cigar", "(", ")", ")", ".", "mask_left", "(", "n_seq_bases", ",", "mask", ")", ".", "_reverse_cigar", ...
Return a new cigar with cigar string where the last `n_seq_bases` are soft-masked unless they are already hard-masked.
[ "Return", "a", "new", "cigar", "with", "cigar", "string", "where", "the", "last", "n_seq_bases", "are", "soft", "-", "masked", "unless", "they", "are", "already", "hard", "-", "masked", "." ]
754cfed348364d390ec1aa40c951362ca1041f7a
https://github.com/brentp/cigar/blob/754cfed348364d390ec1aa40c951362ca1041f7a/cigar.py#L137-L142
51,766
danilobellini/dose
dose/runner.py
runner
def runner(test_command, work_dir=None): """ Internal test job runner context manager. Run the test_command in a subprocess and instantiates 2 FlushStreamThread, one for each standard stream (output/stdout and error/stderr). It yields the subprocess.Popen instance that was spawned to run t...
python
def runner(test_command, work_dir=None): """ Internal test job runner context manager. Run the test_command in a subprocess and instantiates 2 FlushStreamThread, one for each standard stream (output/stdout and error/stderr). It yields the subprocess.Popen instance that was spawned to run t...
[ "def", "runner", "(", "test_command", ",", "work_dir", "=", "None", ")", ":", "process", "=", "subprocess", ".", "Popen", "(", "test_command", ",", "bufsize", "=", "0", ",", "shell", "=", "True", ",", "cwd", "=", "work_dir", ",", "stdout", "=", "subpro...
Internal test job runner context manager. Run the test_command in a subprocess and instantiates 2 FlushStreamThread, one for each standard stream (output/stdout and error/stderr). It yields the subprocess.Popen instance that was spawned to run the given test command in the given working directory....
[ "Internal", "test", "job", "runner", "context", "manager", "." ]
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/runner.py#L68-L90
51,767
danilobellini/dose
dose/runner.py
RunnerThreadCallback.kill
def kill(self, sig=signal.SIGTERM): """ Terminate the test job. Kill the subprocess if it was spawned, abort the spawning process otherwise. This information can be collected afterwards by reading the self.killed and self.spawned flags. Also join the 3 related threads t...
python
def kill(self, sig=signal.SIGTERM): """ Terminate the test job. Kill the subprocess if it was spawned, abort the spawning process otherwise. This information can be collected afterwards by reading the self.killed and self.spawned flags. Also join the 3 related threads t...
[ "def", "kill", "(", "self", ",", "sig", "=", "signal", ".", "SIGTERM", ")", ":", "while", "self", ".", "is_alive", "(", ")", ":", "self", ".", "killed", "=", "True", "time", ".", "sleep", "(", "POLLING_DELAY", ")", "# \"Was a process spawned?\" polling", ...
Terminate the test job. Kill the subprocess if it was spawned, abort the spawning process otherwise. This information can be collected afterwards by reading the self.killed and self.spawned flags. Also join the 3 related threads to the caller thread. This can be safely called f...
[ "Terminate", "the", "test", "job", "." ]
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/runner.py#L132-L164
51,768
morepath/more.cerberus
more/cerberus/loader.py
loader
def loader(schema, validator=CerberusValidator, update=None): """Create a load function based on schema dict and Validator class. :param schema: a Cerberus schema dict. :param validator: the validator class which must be a subclass of more.cerberus.CerberusValidator which is the default. :param...
python
def loader(schema, validator=CerberusValidator, update=None): """Create a load function based on schema dict and Validator class. :param schema: a Cerberus schema dict. :param validator: the validator class which must be a subclass of more.cerberus.CerberusValidator which is the default. :param...
[ "def", "loader", "(", "schema", ",", "validator", "=", "CerberusValidator", ",", "update", "=", "None", ")", ":", "if", "not", "issubclass", "(", "validator", ",", "CerberusValidator", ")", ":", "raise", "TypeError", "(", "\"Validator must be a subclass of more.ce...
Create a load function based on schema dict and Validator class. :param schema: a Cerberus schema dict. :param validator: the validator class which must be a subclass of more.cerberus.CerberusValidator which is the default. :param update: will pass the update flag to the validator, when ``True`` ...
[ "Create", "a", "load", "function", "based", "on", "schema", "dict", "and", "Validator", "class", "." ]
b8e578e814507174164746fb1ac039508786d517
https://github.com/morepath/more.cerberus/blob/b8e578e814507174164746fb1ac039508786d517/more/cerberus/loader.py#L19-L40
51,769
idmillington/layout
layout/elements/mark.py
SignatureMark.render
def render(self, rectangle, data): """Draws the signature mark. Note that this draws OUTSIDE the rectangle we're given. If cropping is involved, then this obviously won't work.""" size = (1.0 - 2.0*self.margin) * rectangle.h offset = self.margin * rectangle.h per_mark =...
python
def render(self, rectangle, data): """Draws the signature mark. Note that this draws OUTSIDE the rectangle we're given. If cropping is involved, then this obviously won't work.""" size = (1.0 - 2.0*self.margin) * rectangle.h offset = self.margin * rectangle.h per_mark =...
[ "def", "render", "(", "self", ",", "rectangle", ",", "data", ")", ":", "size", "=", "(", "1.0", "-", "2.0", "*", "self", ".", "margin", ")", "*", "rectangle", ".", "h", "offset", "=", "self", ".", "margin", "*", "rectangle", ".", "h", "per_mark", ...
Draws the signature mark. Note that this draws OUTSIDE the rectangle we're given. If cropping is involved, then this obviously won't work.
[ "Draws", "the", "signature", "mark", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/elements/mark.py#L57-L75
51,770
cvxopt/chompack
src/python/pybase/projected_inverse.py
projected_inverse
def projected_inverse(L): """ Supernodal multifrontal projected inverse. The routine computes the projected inverse .. math:: Y = P(L^{-T}L^{-1}) where :math:`L` is a Cholesky factor. On exit, the argument :math:`L` contains the projected inverse :math:`Y`. :param L: ...
python
def projected_inverse(L): """ Supernodal multifrontal projected inverse. The routine computes the projected inverse .. math:: Y = P(L^{-T}L^{-1}) where :math:`L` is a Cholesky factor. On exit, the argument :math:`L` contains the projected inverse :math:`Y`. :param L: ...
[ "def", "projected_inverse", "(", "L", ")", ":", "assert", "isinstance", "(", "L", ",", "cspmatrix", ")", "and", "L", ".", "is_factor", "is", "True", ",", "\"L must be a cspmatrix factor\"", "n", "=", "L", ".", "symb", ".", "n", "snpost", "=", "L", ".", ...
Supernodal multifrontal projected inverse. The routine computes the projected inverse .. math:: Y = P(L^{-T}L^{-1}) where :math:`L` is a Cholesky factor. On exit, the argument :math:`L` contains the projected inverse :math:`Y`. :param L: :py:class:`cspmatrix` (factor)
[ "Supernodal", "multifrontal", "projected", "inverse", ".", "The", "routine", "computes", "the", "projected", "inverse" ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/pybase/projected_inverse.py#L5-L75
51,771
phdata/sdc-api-tool
sdctool/sdc_tool.py
define_system_args
def define_system_args(subparsers): """Append the parser arguments for the 'system' commands""" system_parser = subparsers.add_parser("system", help='Available commands: \'info\'') system_subparsers = system_parser.add_subparsers(help='System commands') # system info arguments info_parser = system_...
python
def define_system_args(subparsers): """Append the parser arguments for the 'system' commands""" system_parser = subparsers.add_parser("system", help='Available commands: \'info\'') system_subparsers = system_parser.add_subparsers(help='System commands') # system info arguments info_parser = system_...
[ "def", "define_system_args", "(", "subparsers", ")", ":", "system_parser", "=", "subparsers", ".", "add_parser", "(", "\"system\"", ",", "help", "=", "'Available commands: \\'info\\''", ")", "system_subparsers", "=", "system_parser", ".", "add_subparsers", "(", "help"...
Append the parser arguments for the 'system' commands
[ "Append", "the", "parser", "arguments", "for", "the", "system", "commands" ]
8c86cfa89773ad411226264293d5b574194045de
https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/sdc_tool.py#L142-L151
51,772
senaite/senaite.jsonapi
src/senaite/jsonapi/v1/routes/users.py
get_user_info
def get_user_info(user): """Get the user information """ user = api.get_user(user) current = api.get_current_user() if api.is_anonymous(): return { "username": current.getUserName(), "authenticated": False, "roles": current.getRoles(), "api_ur...
python
def get_user_info(user): """Get the user information """ user = api.get_user(user) current = api.get_current_user() if api.is_anonymous(): return { "username": current.getUserName(), "authenticated": False, "roles": current.getRoles(), "api_ur...
[ "def", "get_user_info", "(", "user", ")", ":", "user", "=", "api", ".", "get_user", "(", "user", ")", "current", "=", "api", ".", "get_current_user", "(", ")", "if", "api", ".", "is_anonymous", "(", ")", ":", "return", "{", "\"username\"", ":", "curren...
Get the user information
[ "Get", "the", "user", "information" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/v1/routes/users.py#L11-L49
51,773
senaite/senaite.jsonapi
src/senaite/jsonapi/v1/routes/users.py
get
def get(context, request, username=None): """Plone users route """ user_ids = [] # Don't allow anonymous users to query a user other than themselves if api.is_anonymous(): username = "current" # query all users if no username was given if username is None: user_ids = api.ge...
python
def get(context, request, username=None): """Plone users route """ user_ids = [] # Don't allow anonymous users to query a user other than themselves if api.is_anonymous(): username = "current" # query all users if no username was given if username is None: user_ids = api.ge...
[ "def", "get", "(", "context", ",", "request", ",", "username", "=", "None", ")", ":", "user_ids", "=", "[", "]", "# Don't allow anonymous users to query a user other than themselves", "if", "api", ".", "is_anonymous", "(", ")", ":", "username", "=", "\"current\"",...
Plone users route
[ "Plone", "users", "route" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/v1/routes/users.py#L58-L92
51,774
cvxopt/chompack
src/python/misc.py
perm
def perm(A, p): """ Symmetric permutation of a symmetric sparse matrix. :param A: :py:class:`spmatrix` :param p: :py:class:`matrix` or :class:`list` of length `A.size[0]` """ assert isinstance(A,spmatrix), "argument must be a sparse matrix" assert A.size[0] == A.size[1], "A must be ...
python
def perm(A, p): """ Symmetric permutation of a symmetric sparse matrix. :param A: :py:class:`spmatrix` :param p: :py:class:`matrix` or :class:`list` of length `A.size[0]` """ assert isinstance(A,spmatrix), "argument must be a sparse matrix" assert A.size[0] == A.size[1], "A must be ...
[ "def", "perm", "(", "A", ",", "p", ")", ":", "assert", "isinstance", "(", "A", ",", "spmatrix", ")", ",", "\"argument must be a sparse matrix\"", "assert", "A", ".", "size", "[", "0", "]", "==", "A", ".", "size", "[", "1", "]", ",", "\"A must be a squa...
Symmetric permutation of a symmetric sparse matrix. :param A: :py:class:`spmatrix` :param p: :py:class:`matrix` or :class:`list` of length `A.size[0]`
[ "Symmetric", "permutation", "of", "a", "symmetric", "sparse", "matrix", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/misc.py#L42-L53
51,775
chukysoria/pyspotify-connect
spotifyconnect/player.py
Player.enable_shuffle
def enable_shuffle(self, value=None): """Enable shuffle mode """ if value is None: value = not self.shuffled spotifyconnect.Error.maybe_raise(lib.SpPlaybackEnableShuffle(value))
python
def enable_shuffle(self, value=None): """Enable shuffle mode """ if value is None: value = not self.shuffled spotifyconnect.Error.maybe_raise(lib.SpPlaybackEnableShuffle(value))
[ "def", "enable_shuffle", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "value", "=", "not", "self", ".", "shuffled", "spotifyconnect", ".", "Error", ".", "maybe_raise", "(", "lib", ".", "SpPlaybackEnableShuffle", "(", ...
Enable shuffle mode
[ "Enable", "shuffle", "mode" ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/player.py#L109-L114
51,776
chukysoria/pyspotify-connect
spotifyconnect/player.py
Player.enable_repeat
def enable_repeat(self, value=None): """Enable repeat mode """ if value is None: value = not self.repeated spotifyconnect.Error.maybe_raise(lib.SpPlaybackEnableRepeat(value))
python
def enable_repeat(self, value=None): """Enable repeat mode """ if value is None: value = not self.repeated spotifyconnect.Error.maybe_raise(lib.SpPlaybackEnableRepeat(value))
[ "def", "enable_repeat", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "value", "=", "not", "self", ".", "repeated", "spotifyconnect", ".", "Error", ".", "maybe_raise", "(", "lib", ".", "SpPlaybackEnableRepeat", "(", ...
Enable repeat mode
[ "Enable", "repeat", "mode" ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/player.py#L117-L122
51,777
wharris/dougrain
dougrain/drafts.py
DraftIdentifier.detect
def detect(self, obj): """Identifies the HAL draft level of a given JSON object.""" links = obj.get(LINKS_KEY, {}) for detector in [LATEST, DRAFT_3]: if detector.draft.curies_rel in links: return detector.detect(obj) return LATEST.detect(obj)
python
def detect(self, obj): """Identifies the HAL draft level of a given JSON object.""" links = obj.get(LINKS_KEY, {}) for detector in [LATEST, DRAFT_3]: if detector.draft.curies_rel in links: return detector.detect(obj) return LATEST.detect(obj)
[ "def", "detect", "(", "self", ",", "obj", ")", ":", "links", "=", "obj", ".", "get", "(", "LINKS_KEY", ",", "{", "}", ")", "for", "detector", "in", "[", "LATEST", ",", "DRAFT_3", "]", ":", "if", "detector", ".", "draft", ".", "curies_rel", "in", ...
Identifies the HAL draft level of a given JSON object.
[ "Identifies", "the", "HAL", "draft", "level", "of", "a", "given", "JSON", "object", "." ]
45062a1562fc34793e40c6253a93aa91eb4cf855
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/drafts.py#L87-L95
51,778
senaite/senaite.jsonapi
src/senaite/jsonapi/underscore.py
to_list
def to_list(thing): """ converts an object to a list >>> to_list(1) [1] >>> to_list([1,2,3]) [1, 2, 3] >>> to_list(("a", "b", "c")) ['a', 'b', 'c'] >>> to_list(dict(a=1, b=2)) [{'a': 1, 'b': 2}] >>> to_list(None) [] >>> to_list...
python
def to_list(thing): """ converts an object to a list >>> to_list(1) [1] >>> to_list([1,2,3]) [1, 2, 3] >>> to_list(("a", "b", "c")) ['a', 'b', 'c'] >>> to_list(dict(a=1, b=2)) [{'a': 1, 'b': 2}] >>> to_list(None) [] >>> to_list...
[ "def", "to_list", "(", "thing", ")", ":", "if", "thing", "is", "None", ":", "return", "[", "]", "if", "isinstance", "(", "thing", ",", "set", ")", ":", "return", "list", "(", "thing", ")", "if", "isinstance", "(", "thing", ",", "types", ".", "Strin...
converts an object to a list >>> to_list(1) [1] >>> to_list([1,2,3]) [1, 2, 3] >>> to_list(("a", "b", "c")) ['a', 'b', 'c'] >>> to_list(dict(a=1, b=2)) [{'a': 1, 'b': 2}] >>> to_list(None) [] >>> to_list("['a', 'b', 'c']") ...
[ "converts", "an", "object", "to", "a", "list" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/underscore.py#L133-L167
51,779
senaite/senaite.jsonapi
src/senaite/jsonapi/underscore.py
pluck
def pluck(col, key, default=None): """ Extracts a list of values from a collection of dictionaries >>> stooges = [{"name": "moe", "age": 40}, ... {"name": "larry", "age": 50}, ... {"name": "curly", "age": 60}] >>> pluck(stooges, "name") ['moe', 'larry...
python
def pluck(col, key, default=None): """ Extracts a list of values from a collection of dictionaries >>> stooges = [{"name": "moe", "age": 40}, ... {"name": "larry", "age": 50}, ... {"name": "curly", "age": 60}] >>> pluck(stooges, "name") ['moe', 'larry...
[ "def", "pluck", "(", "col", ",", "key", ",", "default", "=", "None", ")", ":", "if", "not", "(", "is_list", "(", "col", ")", "or", "is_tuple", "(", "col", ")", ")", ":", "fail", "(", "\"First argument must be a list or tuple\"", ")", "def", "_block", "...
Extracts a list of values from a collection of dictionaries >>> stooges = [{"name": "moe", "age": 40}, ... {"name": "larry", "age": 50}, ... {"name": "curly", "age": 60}] >>> pluck(stooges, "name") ['moe', 'larry', 'curly'] It only works with col...
[ "Extracts", "a", "list", "of", "values", "from", "a", "collection", "of", "dictionaries" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/underscore.py#L185-L210
51,780
senaite/senaite.jsonapi
src/senaite/jsonapi/underscore.py
rename
def rename(dct, mapping): """ Rename the keys of a dictionary with the given mapping >>> rename({"a": 1, "BBB": 2}, {"a": "AAA"}) {'AAA': 1, 'BBB': 2} """ def _block(memo, key): if key in dct: memo[mapping[key]] = dct[key] return memo else: ...
python
def rename(dct, mapping): """ Rename the keys of a dictionary with the given mapping >>> rename({"a": 1, "BBB": 2}, {"a": "AAA"}) {'AAA': 1, 'BBB': 2} """ def _block(memo, key): if key in dct: memo[mapping[key]] = dct[key] return memo else: ...
[ "def", "rename", "(", "dct", ",", "mapping", ")", ":", "def", "_block", "(", "memo", ",", "key", ")", ":", "if", "key", "in", "dct", ":", "memo", "[", "mapping", "[", "key", "]", "]", "=", "dct", "[", "key", "]", "return", "memo", "else", ":", ...
Rename the keys of a dictionary with the given mapping >>> rename({"a": 1, "BBB": 2}, {"a": "AAA"}) {'AAA': 1, 'BBB': 2}
[ "Rename", "the", "keys", "of", "a", "dictionary", "with", "the", "given", "mapping" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/underscore.py#L242-L255
51,781
senaite/senaite.jsonapi
src/senaite/jsonapi/underscore.py
alias
def alias(col, mapping): """ Returns a collection of dictionaries with the keys renamed according to the mapping >>> libraries = [{"isbn": 1, "ed": 1}, {"isbn": 2, "ed": 2}] >>> alias(libraries, {"ed": "edition"}) [{'edition': 1, 'isbn': 1}, {'edition': 2, 'isbn': 2}] >>> a...
python
def alias(col, mapping): """ Returns a collection of dictionaries with the keys renamed according to the mapping >>> libraries = [{"isbn": 1, "ed": 1}, {"isbn": 2, "ed": 2}] >>> alias(libraries, {"ed": "edition"}) [{'edition': 1, 'isbn': 1}, {'edition': 2, 'isbn': 2}] >>> a...
[ "def", "alias", "(", "col", ",", "mapping", ")", ":", "if", "not", "is_list", "(", "col", ")", ":", "col", "=", "[", "col", "]", "def", "_block", "(", "dct", ")", ":", "return", "rename", "(", "dct", ",", "mapping", ")", "return", "map", "(", "...
Returns a collection of dictionaries with the keys renamed according to the mapping >>> libraries = [{"isbn": 1, "ed": 1}, {"isbn": 2, "ed": 2}] >>> alias(libraries, {"ed": "edition"}) [{'edition': 1, 'isbn': 1}, {'edition': 2, 'isbn': 2}] >>> alias({"a": 1}, {"a": "b"}) ...
[ "Returns", "a", "collection", "of", "dictionaries", "with", "the", "keys", "renamed", "according", "to", "the", "mapping" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/underscore.py#L258-L275
51,782
senaite/senaite.jsonapi
src/senaite/jsonapi/underscore.py
first
def first(thing, n=0): """ get the first element of a list >>> lst = [1, 2, 3, 4, 5] >>> first(lst) 1 >>> first(lst, 3) [1, 2, 3] >>> first(lst, 10) [1, 2, 3, 4, 5] >>> first({"key": "value"}) {'key': 'value'} >>> first(("a", "b", "c")...
python
def first(thing, n=0): """ get the first element of a list >>> lst = [1, 2, 3, 4, 5] >>> first(lst) 1 >>> first(lst, 3) [1, 2, 3] >>> first(lst, 10) [1, 2, 3, 4, 5] >>> first({"key": "value"}) {'key': 'value'} >>> first(("a", "b", "c")...
[ "def", "first", "(", "thing", ",", "n", "=", "0", ")", ":", "n", "=", "to_int", "(", "n", ")", "if", "is_list", "(", "thing", ")", "or", "is_tuple", "(", "thing", ")", ":", "if", "len", "(", "thing", ")", "==", "0", ":", "return", "None", "if...
get the first element of a list >>> lst = [1, 2, 3, 4, 5] >>> first(lst) 1 >>> first(lst, 3) [1, 2, 3] >>> first(lst, 10) [1, 2, 3, 4, 5] >>> first({"key": "value"}) {'key': 'value'} >>> first(("a", "b", "c")) 'a' >>> first...
[ "get", "the", "first", "element", "of", "a", "list" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/underscore.py#L278-L312
51,783
dgomes/pymediaroom
pymediaroom/remote.py
discover
async def discover(ignore_list=[], max_wait=30, loop=None): """List STB in the network.""" stbs = [] try: async with timeout(max_wait, loop=loop): def responses_callback(notify): """Queue notify messages.""" _LOGGER.debug("Found: %s", notify.ip_address) ...
python
async def discover(ignore_list=[], max_wait=30, loop=None): """List STB in the network.""" stbs = [] try: async with timeout(max_wait, loop=loop): def responses_callback(notify): """Queue notify messages.""" _LOGGER.debug("Found: %s", notify.ip_address) ...
[ "async", "def", "discover", "(", "ignore_list", "=", "[", "]", ",", "max_wait", "=", "30", ",", "loop", "=", "None", ")", ":", "stbs", "=", "[", "]", "try", ":", "async", "with", "timeout", "(", "max_wait", ",", "loop", "=", "loop", ")", ":", "de...
List STB in the network.
[ "List", "STB", "in", "the", "network", "." ]
f4f2686c8d5622dd5ae1bcdd76900ba35e148529
https://github.com/dgomes/pymediaroom/blob/f4f2686c8d5622dd5ae1bcdd76900ba35e148529/pymediaroom/remote.py#L137-L153
51,784
dgomes/pymediaroom
pymediaroom/remote.py
Remote.send_cmd
async def send_cmd(self, cmd, loop=None): """Send remote command to STB.""" _LOGGER.info("Send cmd = %s", cmd) if cmd not in COMMANDS and cmd not in range(0, 999): _LOGGER.error("Unknown command") raise PyMediaroomError("Unknown commands") keys = [] if c...
python
async def send_cmd(self, cmd, loop=None): """Send remote command to STB.""" _LOGGER.info("Send cmd = %s", cmd) if cmd not in COMMANDS and cmd not in range(0, 999): _LOGGER.error("Unknown command") raise PyMediaroomError("Unknown commands") keys = [] if c...
[ "async", "def", "send_cmd", "(", "self", ",", "cmd", ",", "loop", "=", "None", ")", ":", "_LOGGER", ".", "info", "(", "\"Send cmd = %s\"", ",", "cmd", ")", "if", "cmd", "not", "in", "COMMANDS", "and", "cmd", "not", "in", "range", "(", "0", ",", "99...
Send remote command to STB.
[ "Send", "remote", "command", "to", "STB", "." ]
f4f2686c8d5622dd5ae1bcdd76900ba35e148529
https://github.com/dgomes/pymediaroom/blob/f4f2686c8d5622dd5ae1bcdd76900ba35e148529/pymediaroom/remote.py#L55-L94
51,785
dgomes/pymediaroom
pymediaroom/remote.py
Remote.notify_callback
def notify_callback(self, notify): """Process State from NOTIFY message.""" _LOGGER.debug(notify) if notify.ip_address != self.stb_ip: return if notify.tune: self._state = State.PLAYING_LIVE_TV self.tune_src = notify.tune['@src'] try: ...
python
def notify_callback(self, notify): """Process State from NOTIFY message.""" _LOGGER.debug(notify) if notify.ip_address != self.stb_ip: return if notify.tune: self._state = State.PLAYING_LIVE_TV self.tune_src = notify.tune['@src'] try: ...
[ "def", "notify_callback", "(", "self", ",", "notify", ")", ":", "_LOGGER", ".", "debug", "(", "notify", ")", "if", "notify", ".", "ip_address", "!=", "self", ".", "stb_ip", ":", "return", "if", "notify", ".", "tune", ":", "self", ".", "_state", "=", ...
Process State from NOTIFY message.
[ "Process", "State", "from", "NOTIFY", "message", "." ]
f4f2686c8d5622dd5ae1bcdd76900ba35e148529
https://github.com/dgomes/pymediaroom/blob/f4f2686c8d5622dd5ae1bcdd76900ba35e148529/pymediaroom/remote.py#L113-L135
51,786
dschreij/python-mediadecoder
mediadecoder/soundrenderers/pygamerenderer.py
SoundrendererPygame.run
def run(self): """ Main thread function. """ if not hasattr(self, 'queue'): raise RuntimeError("Audio queue is not intialized.") chunk = None channel = None self.keep_listening = True while self.keep_listening: if chunk is None: try: frame = self.queue.get(timeout=queue_timeout) chunk =...
python
def run(self): """ Main thread function. """ if not hasattr(self, 'queue'): raise RuntimeError("Audio queue is not intialized.") chunk = None channel = None self.keep_listening = True while self.keep_listening: if chunk is None: try: frame = self.queue.get(timeout=queue_timeout) chunk =...
[ "def", "run", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'queue'", ")", ":", "raise", "RuntimeError", "(", "\"Audio queue is not intialized.\"", ")", "chunk", "=", "None", "channel", "=", "None", "self", ".", "keep_listening", "=", "...
Main thread function.
[ "Main", "thread", "function", "." ]
f01b02d790f2abc52d9792e43076cf4cb7d3ce51
https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/soundrenderers/pygamerenderer.py#L50-L76
51,787
senaite/senaite.jsonapi
src/senaite/jsonapi/catalog.py
Catalog.search
def search(self, query): """search the catalog """ logger.info("Catalog query={}".format(query)) # Support to set the catalog as a request parameter catalogs = _.to_list(req.get("catalog", None)) if catalogs: return senaiteapi.search(query, catalog=catalogs) ...
python
def search(self, query): """search the catalog """ logger.info("Catalog query={}".format(query)) # Support to set the catalog as a request parameter catalogs = _.to_list(req.get("catalog", None)) if catalogs: return senaiteapi.search(query, catalog=catalogs) ...
[ "def", "search", "(", "self", ",", "query", ")", ":", "logger", ".", "info", "(", "\"Catalog query={}\"", ".", "format", "(", "query", ")", ")", "# Support to set the catalog as a request parameter", "catalogs", "=", "_", ".", "to_list", "(", "req", ".", "get"...
search the catalog
[ "search", "the", "catalog" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/catalog.py#L38-L48
51,788
senaite/senaite.jsonapi
src/senaite/jsonapi/catalog.py
Catalog.get_index
def get_index(self, name): """get an index by name TODO: Combine indexes of relevant catalogs depending on the portal_type which is searched for. """ catalog = self.get_catalog() index = catalog._catalog.getIndex(name) logger.debug("get_index={} of catalog '{}' -...
python
def get_index(self, name): """get an index by name TODO: Combine indexes of relevant catalogs depending on the portal_type which is searched for. """ catalog = self.get_catalog() index = catalog._catalog.getIndex(name) logger.debug("get_index={} of catalog '{}' -...
[ "def", "get_index", "(", "self", ",", "name", ")", ":", "catalog", "=", "self", ".", "get_catalog", "(", ")", "index", "=", "catalog", ".", "_catalog", ".", "getIndex", "(", "name", ")", "logger", ".", "debug", "(", "\"get_index={} of catalog '{}' --> {}\"",...
get an index by name TODO: Combine indexes of relevant catalogs depending on the portal_type which is searched for.
[ "get", "an", "index", "by", "name" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/catalog.py#L70-L80
51,789
senaite/senaite.jsonapi
src/senaite/jsonapi/catalog.py
Catalog.to_index_value
def to_index_value(self, value, index): """Convert the value for a given index """ # ZPublisher records can be passed to the catalog as is. if isinstance(value, HTTPRequest.record): return value if isinstance(index, basestring): index = self.get_index(in...
python
def to_index_value(self, value, index): """Convert the value for a given index """ # ZPublisher records can be passed to the catalog as is. if isinstance(value, HTTPRequest.record): return value if isinstance(index, basestring): index = self.get_index(in...
[ "def", "to_index_value", "(", "self", ",", "value", ",", "index", ")", ":", "# ZPublisher records can be passed to the catalog as is.", "if", "isinstance", "(", "value", ",", "HTTPRequest", ".", "record", ")", ":", "return", "value", "if", "isinstance", "(", "inde...
Convert the value for a given index
[ "Convert", "the", "value", "for", "a", "given", "index" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/catalog.py#L82-L102
51,790
senaite/senaite.jsonapi
src/senaite/jsonapi/catalog.py
CatalogQuery.make_query
def make_query(self, **kw): """create a query suitable for the catalog """ query = kw.pop("query", {}) query.update(self.get_request_query()) query.update(self.get_custom_query()) query.update(self.get_keyword_query(**kw)) sort_on, sort_order = self.get_sort_spe...
python
def make_query(self, **kw): """create a query suitable for the catalog """ query = kw.pop("query", {}) query.update(self.get_request_query()) query.update(self.get_custom_query()) query.update(self.get_keyword_query(**kw)) sort_on, sort_order = self.get_sort_spe...
[ "def", "make_query", "(", "self", ",", "*", "*", "kw", ")", ":", "query", "=", "kw", ".", "pop", "(", "\"query\"", ",", "{", "}", ")", "query", ".", "update", "(", "self", ".", "get_request_query", "(", ")", ")", "query", ".", "update", "(", "sel...
create a query suitable for the catalog
[ "create", "a", "query", "suitable", "for", "the", "catalog" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/catalog.py#L113-L131
51,791
senaite/senaite.jsonapi
src/senaite/jsonapi/catalog.py
CatalogQuery.get_request_query
def get_request_query(self): """Checks the request for known catalog indexes and converts the values to fit the type of the catalog index. :param catalog: The catalog to build the query for :type catalog: ZCatalog :returns: Catalog query :rtype: dict """ ...
python
def get_request_query(self): """Checks the request for known catalog indexes and converts the values to fit the type of the catalog index. :param catalog: The catalog to build the query for :type catalog: ZCatalog :returns: Catalog query :rtype: dict """ ...
[ "def", "get_request_query", "(", "self", ")", ":", "query", "=", "{", "}", "# only known indexes get observed", "indexes", "=", "self", ".", "catalog", ".", "get_indexes", "(", ")", "for", "index", "in", "indexes", ":", "# Check if the request contains a parameter n...
Checks the request for known catalog indexes and converts the values to fit the type of the catalog index. :param catalog: The catalog to build the query for :type catalog: ZCatalog :returns: Catalog query :rtype: dict
[ "Checks", "the", "request", "for", "known", "catalog", "indexes", "and", "converts", "the", "values", "to", "fit", "the", "type", "of", "the", "catalog", "index", "." ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/catalog.py#L133-L161
51,792
senaite/senaite.jsonapi
src/senaite/jsonapi/catalog.py
CatalogQuery.get_custom_query
def get_custom_query(self): """Extracts custom query keys from the index. Parameters which get extracted from the request: `q`: Passes the value to the `SearchableText` `path`: Creates a path query `recent_created`: Creates a date query `recent_modified`...
python
def get_custom_query(self): """Extracts custom query keys from the index. Parameters which get extracted from the request: `q`: Passes the value to the `SearchableText` `path`: Creates a path query `recent_created`: Creates a date query `recent_modified`...
[ "def", "get_custom_query", "(", "self", ")", ":", "query", "=", "{", "}", "# searchable text queries", "q", "=", "req", ".", "get_query", "(", ")", "if", "q", ":", "query", "[", "\"SearchableText\"", "]", "=", "q", "# physical path queries", "path", "=", "...
Extracts custom query keys from the index. Parameters which get extracted from the request: `q`: Passes the value to the `SearchableText` `path`: Creates a path query `recent_created`: Creates a date query `recent_modified`: Creates a date query :param ...
[ "Extracts", "custom", "query", "keys", "from", "the", "index", "." ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/catalog.py#L163-L201
51,793
senaite/senaite.jsonapi
src/senaite/jsonapi/catalog.py
CatalogQuery.get_keyword_query
def get_keyword_query(self, **kw): """Generates a query from the given keywords. Only known indexes make it into the generated query. :returns: Catalog query :rtype: dict """ query = dict() # Only known indexes get observed indexes = self.catalog.get_ind...
python
def get_keyword_query(self, **kw): """Generates a query from the given keywords. Only known indexes make it into the generated query. :returns: Catalog query :rtype: dict """ query = dict() # Only known indexes get observed indexes = self.catalog.get_ind...
[ "def", "get_keyword_query", "(", "self", ",", "*", "*", "kw", ")", ":", "query", "=", "dict", "(", ")", "# Only known indexes get observed", "indexes", "=", "self", ".", "catalog", ".", "get_indexes", "(", ")", "# Handle additional keyword parameters", "for", "k...
Generates a query from the given keywords. Only known indexes make it into the generated query. :returns: Catalog query :rtype: dict
[ "Generates", "a", "query", "from", "the", "given", "keywords", ".", "Only", "known", "indexes", "make", "it", "into", "the", "generated", "query", "." ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/catalog.py#L203-L233
51,794
senaite/senaite.jsonapi
src/senaite/jsonapi/catalog.py
CatalogQuery.get_sort_spec
def get_sort_spec(self): """Build sort specification """ all_indexes = self.catalog.get_indexes() si = req.get_sort_on(allowed_indexes=all_indexes) so = req.get_sort_order() return si, so
python
def get_sort_spec(self): """Build sort specification """ all_indexes = self.catalog.get_indexes() si = req.get_sort_on(allowed_indexes=all_indexes) so = req.get_sort_order() return si, so
[ "def", "get_sort_spec", "(", "self", ")", ":", "all_indexes", "=", "self", ".", "catalog", ".", "get_indexes", "(", ")", "si", "=", "req", ".", "get_sort_on", "(", "allowed_indexes", "=", "all_indexes", ")", "so", "=", "req", ".", "get_sort_order", "(", ...
Build sort specification
[ "Build", "sort", "specification" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/catalog.py#L235-L241
51,795
cvxopt/chompack
src/python/pfcholesky.py
pfcholesky.trsm
def trsm(self,B,trans='N'): r""" Solves a triangular system of equations with multiple righthand sides. Computes .. math:: B &:= L^{-1} B \text{ if trans is 'N'} B &:= L^{-T} B \text{ if trans is 'T'} """ if trans=='N': cp...
python
def trsm(self,B,trans='N'): r""" Solves a triangular system of equations with multiple righthand sides. Computes .. math:: B &:= L^{-1} B \text{ if trans is 'N'} B &:= L^{-T} B \text{ if trans is 'T'} """ if trans=='N': cp...
[ "def", "trsm", "(", "self", ",", "B", ",", "trans", "=", "'N'", ")", ":", "if", "trans", "==", "'N'", ":", "cp", ".", "trsm", "(", "self", ".", "_L0", ",", "B", ")", "pftrsm", "(", "self", ".", "_V", ",", "self", ".", "_L", ",", "self", "."...
r""" Solves a triangular system of equations with multiple righthand sides. Computes .. math:: B &:= L^{-1} B \text{ if trans is 'N'} B &:= L^{-T} B \text{ if trans is 'T'}
[ "r", "Solves", "a", "triangular", "system", "of", "equations", "with", "multiple", "righthand", "sides", ".", "Computes" ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/pfcholesky.py#L164-L186
51,796
idmillington/layout
layout/rl_utils.py
render_to_reportlab_canvas
def render_to_reportlab_canvas(rl_canvas, papersize_tuple, layout): """Renders the given layout manager on a page of the given canvas.""" rl_canvas.setPageSize(papersize_tuple) layout.render( Rectangle(0, 0, *papersize_tuple), dict(output=ReportlabOutput(rl_canvas)) )
python
def render_to_reportlab_canvas(rl_canvas, papersize_tuple, layout): """Renders the given layout manager on a page of the given canvas.""" rl_canvas.setPageSize(papersize_tuple) layout.render( Rectangle(0, 0, *papersize_tuple), dict(output=ReportlabOutput(rl_canvas)) )
[ "def", "render_to_reportlab_canvas", "(", "rl_canvas", ",", "papersize_tuple", ",", "layout", ")", ":", "rl_canvas", ".", "setPageSize", "(", "papersize_tuple", ")", "layout", ".", "render", "(", "Rectangle", "(", "0", ",", "0", ",", "*", "papersize_tuple", ")...
Renders the given layout manager on a page of the given canvas.
[ "Renders", "the", "given", "layout", "manager", "on", "a", "page", "of", "the", "given", "canvas", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/rl_utils.py#L18-L24
51,797
bububa/pyTOP
pyTOP/packages/requests/auth.py
http_basic
def http_basic(r, username, password): """Attaches HTTP Basic Authentication to the given Request object. Arguments should be considered non-positional. """ username = str(username) password = str(password) auth_s = b64encode('%s:%s' % (username, password)) r.headers['Authorization'] = ('B...
python
def http_basic(r, username, password): """Attaches HTTP Basic Authentication to the given Request object. Arguments should be considered non-positional. """ username = str(username) password = str(password) auth_s = b64encode('%s:%s' % (username, password)) r.headers['Authorization'] = ('B...
[ "def", "http_basic", "(", "r", ",", "username", ",", "password", ")", ":", "username", "=", "str", "(", "username", ")", "password", "=", "str", "(", "password", ")", "auth_s", "=", "b64encode", "(", "'%s:%s'", "%", "(", "username", ",", "password", ")...
Attaches HTTP Basic Authentication to the given Request object. Arguments should be considered non-positional.
[ "Attaches", "HTTP", "Basic", "Authentication", "to", "the", "given", "Request", "object", ".", "Arguments", "should", "be", "considered", "non", "-", "positional", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/auth.py#L19-L30
51,798
bububa/pyTOP
pyTOP/packages/requests/auth.py
http_digest
def http_digest(r, username, password): """Attaches HTTP Digest Authentication to the given Request object. Arguments should be considered non-positional. """ def handle_401(r): """Takes the given response and tries digest-auth, if needed.""" s_auth = r.headers.get('www-authenticate', ...
python
def http_digest(r, username, password): """Attaches HTTP Digest Authentication to the given Request object. Arguments should be considered non-positional. """ def handle_401(r): """Takes the given response and tries digest-auth, if needed.""" s_auth = r.headers.get('www-authenticate', ...
[ "def", "http_digest", "(", "r", ",", "username", ",", "password", ")", ":", "def", "handle_401", "(", "r", ")", ":", "\"\"\"Takes the given response and tries digest-auth, if needed.\"\"\"", "s_auth", "=", "r", ".", "headers", ".", "get", "(", "'www-authenticate'", ...
Attaches HTTP Digest Authentication to the given Request object. Arguments should be considered non-positional.
[ "Attaches", "HTTP", "Digest", "Authentication", "to", "the", "given", "Request", "object", ".", "Arguments", "should", "be", "considered", "non", "-", "positional", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/auth.py#L33-L118
51,799
bububa/pyTOP
pyTOP/packages/requests/auth.py
dispatch
def dispatch(t): """Given an auth tuple, return an expanded version.""" if not t: return t else: t = list(t) # Make sure they're passing in something. assert len(t) >= 2 # If only two items are passed in, assume HTTPBasic. if (len(t) == 2): t.insert(0, 'basic') ...
python
def dispatch(t): """Given an auth tuple, return an expanded version.""" if not t: return t else: t = list(t) # Make sure they're passing in something. assert len(t) >= 2 # If only two items are passed in, assume HTTPBasic. if (len(t) == 2): t.insert(0, 'basic') ...
[ "def", "dispatch", "(", "t", ")", ":", "if", "not", "t", ":", "return", "t", "else", ":", "t", "=", "list", "(", "t", ")", "# Make sure they're passing in something.", "assert", "len", "(", "t", ")", ">=", "2", "# If only two items are passed in, assume HTTPBa...
Given an auth tuple, return an expanded version.
[ "Given", "an", "auth", "tuple", "return", "an", "expanded", "version", "." ]
1e48009bcfe886be392628244b370e6374e1f2b2
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/packages/requests/auth.py#L121-L144