repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
hbldh/pybankid
bankid/jsonclient.py
BankIDJSONClient.authenticate
def authenticate( self, end_user_ip, personal_number=None, requirement=None, **kwargs ): """Request an authentication order. The :py:meth:`collect` method is used to query the status of the order. Note that personal number is not needed when authentication is to be done on t...
python
def authenticate( self, end_user_ip, personal_number=None, requirement=None, **kwargs ): """Request an authentication order. The :py:meth:`collect` method is used to query the status of the order. Note that personal number is not needed when authentication is to be done on t...
[ "def", "authenticate", "(", "self", ",", "end_user_ip", ",", "personal_number", "=", "None", ",", "requirement", "=", "None", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"endUserIp\"", ":", "end_user_ip", "}", "if", "personal_number", ":", "data...
Request an authentication order. The :py:meth:`collect` method is used to query the status of the order. Note that personal number is not needed when authentication is to be done on the same device, provided that the returned ``autoStartToken`` is used to open the BankID Client. ...
[ "Request", "an", "authentication", "order", ".", "The", ":", "py", ":", "meth", ":", "collect", "method", "is", "used", "to", "query", "the", "status", "of", "the", "order", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/jsonclient.py#L79-L126
hbldh/pybankid
bankid/jsonclient.py
BankIDJSONClient.sign
def sign( self, end_user_ip, user_visible_data, personal_number=None, requirement=None, user_non_visible_data=None, **kwargs ): """Request an signing order. The :py:meth:`collect` method is used to query the status of the order. Note t...
python
def sign( self, end_user_ip, user_visible_data, personal_number=None, requirement=None, user_non_visible_data=None, **kwargs ): """Request an signing order. The :py:meth:`collect` method is used to query the status of the order. Note t...
[ "def", "sign", "(", "self", ",", "end_user_ip", ",", "user_visible_data", ",", "personal_number", "=", "None", ",", "requirement", "=", "None", ",", "user_non_visible_data", "=", "None", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"endUserIp\"", ...
Request an signing order. The :py:meth:`collect` method is used to query the status of the order. Note that personal number is not needed when signing is to be done on the same device, provided that the returned ``autoStartToken`` is used to open the BankID Client. Example data...
[ "Request", "an", "signing", "order", ".", "The", ":", "py", ":", "meth", ":", "collect", "method", "is", "used", "to", "query", "the", "status", "of", "the", "order", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/jsonclient.py#L128-L190
hbldh/pybankid
bankid/jsonclient.py
BankIDJSONClient.collect
def collect(self, order_ref): """Collects the result of a sign or auth order using the ``orderRef`` as reference. RP should keep on calling collect every two seconds as long as status indicates pending. RP must abort if status indicates failed. The user identity is returned when...
python
def collect(self, order_ref): """Collects the result of a sign or auth order using the ``orderRef`` as reference. RP should keep on calling collect every two seconds as long as status indicates pending. RP must abort if status indicates failed. The user identity is returned when...
[ "def", "collect", "(", "self", ",", "order_ref", ")", ":", "response", "=", "self", ".", "client", ".", "post", "(", "self", ".", "_collect_endpoint", ",", "json", "=", "{", "\"orderRef\"", ":", "order_ref", "}", ")", "if", "response", ".", "status_code"...
Collects the result of a sign or auth order using the ``orderRef`` as reference. RP should keep on calling collect every two seconds as long as status indicates pending. RP must abort if status indicates failed. The user identity is returned when complete. Example collect resul...
[ "Collects", "the", "result", "of", "a", "sign", "or", "auth", "order", "using", "the", "orderRef", "as", "reference", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/jsonclient.py#L192-L267
hbldh/pybankid
bankid/jsonclient.py
BankIDJSONClient.cancel
def cancel(self, order_ref): """Cancels an ongoing sign or auth order. This is typically used if the user cancels the order in your service or app. :param order_ref: The UUID string specifying which order to cancel. :type order_ref: str :return: Boolean regarding succes...
python
def cancel(self, order_ref): """Cancels an ongoing sign or auth order. This is typically used if the user cancels the order in your service or app. :param order_ref: The UUID string specifying which order to cancel. :type order_ref: str :return: Boolean regarding succes...
[ "def", "cancel", "(", "self", ",", "order_ref", ")", ":", "response", "=", "self", ".", "client", ".", "post", "(", "self", ".", "_cancel_endpoint", ",", "json", "=", "{", "\"orderRef\"", ":", "order_ref", "}", ")", "if", "response", ".", "status_code", ...
Cancels an ongoing sign or auth order. This is typically used if the user cancels the order in your service or app. :param order_ref: The UUID string specifying which order to cancel. :type order_ref: str :return: Boolean regarding success of cancellation. :rtype: bool ...
[ "Cancels", "an", "ongoing", "sign", "or", "auth", "order", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/jsonclient.py#L269-L288
ianepperson/telnetsrvlib
telnetsrv/threaded.py
TelnetHandler.setup
def setup(self): '''Called after instantiation''' TelnetHandlerBase.setup(self) # Spawn a thread to handle socket input self.thread_ic = threading.Thread(target=self.inputcooker) self.thread_ic.setDaemon(True) self.thread_ic.start() # Note that inputcooker exits o...
python
def setup(self): '''Called after instantiation''' TelnetHandlerBase.setup(self) # Spawn a thread to handle socket input self.thread_ic = threading.Thread(target=self.inputcooker) self.thread_ic.setDaemon(True) self.thread_ic.start() # Note that inputcooker exits o...
[ "def", "setup", "(", "self", ")", ":", "TelnetHandlerBase", ".", "setup", "(", "self", ")", "# Spawn a thread to handle socket input", "self", ".", "thread_ic", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "inputcooker", ")", "self", ".", ...
Called after instantiation
[ "Called", "after", "instantiation" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/threaded.py#L23-L33
ianepperson/telnetsrvlib
telnetsrv/threaded.py
TelnetHandler.getc
def getc(self, block=True): """Return one character from the input queue""" if not block: if not len(self.cookedq): return '' while not len(self.cookedq): time.sleep(0.05) self.IQUEUELOCK.acquire() ret = self.cookedq[0] self.cookedq...
python
def getc(self, block=True): """Return one character from the input queue""" if not block: if not len(self.cookedq): return '' while not len(self.cookedq): time.sleep(0.05) self.IQUEUELOCK.acquire() ret = self.cookedq[0] self.cookedq...
[ "def", "getc", "(", "self", ",", "block", "=", "True", ")", ":", "if", "not", "block", ":", "if", "not", "len", "(", "self", ".", "cookedq", ")", ":", "return", "''", "while", "not", "len", "(", "self", ".", "cookedq", ")", ":", "time", ".", "s...
Return one character from the input queue
[ "Return", "one", "character", "from", "the", "input", "queue" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/threaded.py#L44-L55
ianepperson/telnetsrvlib
telnetsrv/threaded.py
TelnetHandler.inputcooker_store_queue
def inputcooker_store_queue(self, char): """Put the cooked data in the input queue (with locking)""" self.IQUEUELOCK.acquire() if type(char) in [type(()), type([]), type("")]: for v in char: self.cookedq.append(v) else: self.cookedq.append(char) ...
python
def inputcooker_store_queue(self, char): """Put the cooked data in the input queue (with locking)""" self.IQUEUELOCK.acquire() if type(char) in [type(()), type([]), type("")]: for v in char: self.cookedq.append(v) else: self.cookedq.append(char) ...
[ "def", "inputcooker_store_queue", "(", "self", ",", "char", ")", ":", "self", ".", "IQUEUELOCK", ".", "acquire", "(", ")", "if", "type", "(", "char", ")", "in", "[", "type", "(", "(", ")", ")", ",", "type", "(", "[", "]", ")", ",", "type", "(", ...
Put the cooked data in the input queue (with locking)
[ "Put", "the", "cooked", "data", "in", "the", "input", "queue", "(", "with", "locking", ")" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/threaded.py#L61-L69
ianepperson/telnetsrvlib
telnetsrv/threaded.py
TelnetHandler.writemessage
def writemessage(self, text): """Put data in output queue, rebuild the prompt and entered data""" # Need to grab the input queue lock to ensure the entered data doesn't change # before we're done rebuilding it. # Note that writemessage will eventually call writecooked self.IQUEUE...
python
def writemessage(self, text): """Put data in output queue, rebuild the prompt and entered data""" # Need to grab the input queue lock to ensure the entered data doesn't change # before we're done rebuilding it. # Note that writemessage will eventually call writecooked self.IQUEUE...
[ "def", "writemessage", "(", "self", ",", "text", ")", ":", "# Need to grab the input queue lock to ensure the entered data doesn't change", "# before we're done rebuilding it.", "# Note that writemessage will eventually call writecooked", "self", ".", "IQUEUELOCK", ".", "acquire", "(...
Put data in output queue, rebuild the prompt and entered data
[ "Put", "data", "in", "output", "queue", "rebuild", "the", "prompt", "and", "entered", "data" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/threaded.py#L74-L81
ianepperson/telnetsrvlib
telnetsrv/threaded.py
TelnetHandler.writecooked
def writecooked(self, text): """Put data directly into the output queue""" # Ensure this is the only thread writing self.OQUEUELOCK.acquire() TelnetHandlerBase.writecooked(self, text) self.OQUEUELOCK.release()
python
def writecooked(self, text): """Put data directly into the output queue""" # Ensure this is the only thread writing self.OQUEUELOCK.acquire() TelnetHandlerBase.writecooked(self, text) self.OQUEUELOCK.release()
[ "def", "writecooked", "(", "self", ",", "text", ")", ":", "# Ensure this is the only thread writing", "self", ".", "OQUEUELOCK", ".", "acquire", "(", ")", "TelnetHandlerBase", ".", "writecooked", "(", "self", ",", "text", ")", "self", ".", "OQUEUELOCK", ".", "...
Put data directly into the output queue
[ "Put", "data", "directly", "into", "the", "output", "queue" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/threaded.py#L83-L88
hbldh/pybankid
bankid/certutils.py
split_certificate
def split_certificate(certificate_path, destination_folder, password=None): """Splits a PKCS12 certificate into Base64-encoded DER certificate and key. This method splits a potentially password-protected `PKCS12 <https://en.wikipedia.org/wiki/PKCS_12>`_ certificate (format ``.p12`` or ``.pfx``) into on...
python
def split_certificate(certificate_path, destination_folder, password=None): """Splits a PKCS12 certificate into Base64-encoded DER certificate and key. This method splits a potentially password-protected `PKCS12 <https://en.wikipedia.org/wiki/PKCS_12>`_ certificate (format ``.p12`` or ``.pfx``) into on...
[ "def", "split_certificate", "(", "certificate_path", ",", "destination_folder", ",", "password", "=", "None", ")", ":", "try", ":", "# Attempt Linux and Darwin call first.", "p", "=", "subprocess", ".", "Popen", "(", "[", "\"openssl\"", ",", "\"version\"", "]", ",...
Splits a PKCS12 certificate into Base64-encoded DER certificate and key. This method splits a potentially password-protected `PKCS12 <https://en.wikipedia.org/wiki/PKCS_12>`_ certificate (format ``.p12`` or ``.pfx``) into one certificate and one key part, both in `pem <https://en.wikipedia.org/wiki/X.5...
[ "Splits", "a", "PKCS12", "certificate", "into", "Base64", "-", "encoded", "DER", "certificate", "and", "key", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/certutils.py#L62-L152
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
InputBashLike.process_delimiter
def process_delimiter(self, char): '''Process chars while not in a part''' if char in self.whitespace: return if char in self.quote_chars: # Store the quote type (' or ") and switch to quote processing. self.inquote = char self.process_char = self....
python
def process_delimiter(self, char): '''Process chars while not in a part''' if char in self.whitespace: return if char in self.quote_chars: # Store the quote type (' or ") and switch to quote processing. self.inquote = char self.process_char = self....
[ "def", "process_delimiter", "(", "self", ",", "char", ")", ":", "if", "char", "in", "self", ".", "whitespace", ":", "return", "if", "char", "in", "self", ".", "quote_chars", ":", "# Store the quote type (' or \") and switch to quote processing.", "self", ".", "inq...
Process chars while not in a part
[ "Process", "chars", "while", "not", "in", "a", "part" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L287-L301
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
InputBashLike.process_part
def process_part(self, char): '''Process chars while in a part''' if char in self.whitespace or char == self.eol_char: # End of the part. self.parts.append( ''.join(self.part) ) self.part = [] # Switch back to processing a delimiter. self.proce...
python
def process_part(self, char): '''Process chars while in a part''' if char in self.whitespace or char == self.eol_char: # End of the part. self.parts.append( ''.join(self.part) ) self.part = [] # Switch back to processing a delimiter. self.proce...
[ "def", "process_part", "(", "self", ",", "char", ")", ":", "if", "char", "in", "self", ".", "whitespace", "or", "char", "==", "self", ".", "eol_char", ":", "# End of the part.", "self", ".", "parts", ".", "append", "(", "''", ".", "join", "(", "self", ...
Process chars while in a part
[ "Process", "chars", "while", "in", "a", "part" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L303-L319
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
InputBashLike.process_quote
def process_quote(self, char): '''Process character while in a quote''' if char == self.inquote: # Quote is finished, switch to part processing. self.process_char = self.process_part return try: self.part.append(char) except: se...
python
def process_quote(self, char): '''Process character while in a quote''' if char == self.inquote: # Quote is finished, switch to part processing. self.process_char = self.process_part return try: self.part.append(char) except: se...
[ "def", "process_quote", "(", "self", ",", "char", ")", ":", "if", "char", "==", "self", ".", "inquote", ":", "# Quote is finished, switch to part processing.", "self", ".", "process_char", "=", "self", ".", "process_part", "return", "try", ":", "self", ".", "p...
Process character while in a quote
[ "Process", "character", "while", "in", "a", "quote" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L321-L330
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
InputBashLike.process_escape
def process_escape(self, char): '''Handle the char after the escape char''' # Always only run once, switch back to the last processor. self.process_char = self.last_process_char if self.part == [] and char in self.whitespace: # Special case where \ is by itself and not at the...
python
def process_escape(self, char): '''Handle the char after the escape char''' # Always only run once, switch back to the last processor. self.process_char = self.last_process_char if self.part == [] and char in self.whitespace: # Special case where \ is by itself and not at the...
[ "def", "process_escape", "(", "self", ",", "char", ")", ":", "# Always only run once, switch back to the last processor.", "self", ".", "process_char", "=", "self", ".", "last_process_char", "if", "self", ".", "part", "==", "[", "]", "and", "char", "in", "self", ...
Handle the char after the escape char
[ "Handle", "the", "char", "after", "the", "escape", "char" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L332-L344
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
InputBashLike.process
def process(self, line): '''Step through the line and process each character''' self.raw = self.raw + line try: if not line[-1] == self.eol_char: # Should always be here, but add it just in case. line = line + self.eol_char except IndexError: ...
python
def process(self, line): '''Step through the line and process each character''' self.raw = self.raw + line try: if not line[-1] == self.eol_char: # Should always be here, but add it just in case. line = line + self.eol_char except IndexError: ...
[ "def", "process", "(", "self", ",", "line", ")", ":", "self", ".", "raw", "=", "self", ".", "raw", "+", "line", "try", ":", "if", "not", "line", "[", "-", "1", "]", "==", "self", ".", "eol_char", ":", "# Should always be here, but add it just in case.", ...
Step through the line and process each character
[ "Step", "through", "the", "line", "and", "process", "each", "character" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L347-L367
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.streamserver_handle
def streamserver_handle(cls, sock, address): '''Translate this class for use in a StreamServer''' request = cls.false_request() request._sock = sock server = None log.debug("Accepted connection, starting telnet session.") try: cls(request, address, server) ...
python
def streamserver_handle(cls, sock, address): '''Translate this class for use in a StreamServer''' request = cls.false_request() request._sock = sock server = None log.debug("Accepted connection, starting telnet session.") try: cls(request, address, server) ...
[ "def", "streamserver_handle", "(", "cls", ",", "sock", ",", "address", ")", ":", "request", "=", "cls", ".", "false_request", "(", ")", "request", ".", "_sock", "=", "sock", "server", "=", "None", "log", ".", "debug", "(", "\"Accepted connection, starting te...
Translate this class for use in a StreamServer
[ "Translate", "this", "class", "for", "use", "in", "a", "StreamServer" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L491-L500
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.setterm
def setterm(self, term): "Set the curses structures for this terminal" log.debug("Setting termtype to %s" % (term, )) curses.setupterm(term) # This will raise if the termtype is not supported self.TERM = term self.ESCSEQ = {} for k in self.KEYS.keys(): str = c...
python
def setterm(self, term): "Set the curses structures for this terminal" log.debug("Setting termtype to %s" % (term, )) curses.setupterm(term) # This will raise if the termtype is not supported self.TERM = term self.ESCSEQ = {} for k in self.KEYS.keys(): str = c...
[ "def", "setterm", "(", "self", ",", "term", ")", ":", "log", ".", "debug", "(", "\"Setting termtype to %s\"", "%", "(", "term", ",", ")", ")", "curses", ".", "setupterm", "(", "term", ")", "# This will raise if the termtype is not supported", "self", ".", "TER...
Set the curses structures for this terminal
[ "Set", "the", "curses", "structures", "for", "this", "terminal" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L502-L518
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.setup
def setup(self): "Connect incoming connection to a telnet session" try: self.TERM = self.request.term except: pass self.setterm(self.TERM) self.sock = self.request._sock for k in self.DOACK.keys(): self.sendcommand(self.DOACK[k], k) ...
python
def setup(self): "Connect incoming connection to a telnet session" try: self.TERM = self.request.term except: pass self.setterm(self.TERM) self.sock = self.request._sock for k in self.DOACK.keys(): self.sendcommand(self.DOACK[k], k) ...
[ "def", "setup", "(", "self", ")", ":", "try", ":", "self", ".", "TERM", "=", "self", ".", "request", ".", "term", "except", ":", "pass", "self", ".", "setterm", "(", "self", ".", "TERM", ")", "self", ".", "sock", "=", "self", ".", "request", ".",...
Connect incoming connection to a telnet session
[ "Connect", "incoming", "connection", "to", "a", "telnet", "session" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L520-L531
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.finish
def finish(self): "End this session" log.debug("Session disconnected.") try: self.sock.shutdown(socket.SHUT_RDWR) except: pass self.session_end()
python
def finish(self): "End this session" log.debug("Session disconnected.") try: self.sock.shutdown(socket.SHUT_RDWR) except: pass self.session_end()
[ "def", "finish", "(", "self", ")", ":", "log", ".", "debug", "(", "\"Session disconnected.\"", ")", "try", ":", "self", ".", "sock", ".", "shutdown", "(", "socket", ".", "SHUT_RDWR", ")", "except", ":", "pass", "self", ".", "session_end", "(", ")" ]
End this session
[ "End", "this", "session" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L534-L540
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.options_handler
def options_handler(self, sock, cmd, opt): "Negotiate options" if cmd == NOP: self.sendcommand(NOP) elif cmd == WILL or cmd == WONT: if self.WILLACK.has_key(opt): self.sendcommand(self.WILLACK[opt], opt) else: self.sendcommand(D...
python
def options_handler(self, sock, cmd, opt): "Negotiate options" if cmd == NOP: self.sendcommand(NOP) elif cmd == WILL or cmd == WONT: if self.WILLACK.has_key(opt): self.sendcommand(self.WILLACK[opt], opt) else: self.sendcommand(D...
[ "def", "options_handler", "(", "self", ",", "sock", ",", "cmd", ",", "opt", ")", ":", "if", "cmd", "==", "NOP", ":", "self", ".", "sendcommand", "(", "NOP", ")", "elif", "cmd", "==", "WILL", "or", "cmd", "==", "WONT", ":", "if", "self", ".", "WIL...
Negotiate options
[ "Negotiate", "options" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L550-L580
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.sendcommand
def sendcommand(self, cmd, opt=None): "Send a telnet command (IAC)" if cmd in [DO, DONT]: if not self.DOOPTS.has_key(opt): self.DOOPTS[opt] = None if (((cmd == DO) and (self.DOOPTS[opt] != True)) or ((cmd == DONT) and (self.DOOPTS[opt] != False))): ...
python
def sendcommand(self, cmd, opt=None): "Send a telnet command (IAC)" if cmd in [DO, DONT]: if not self.DOOPTS.has_key(opt): self.DOOPTS[opt] = None if (((cmd == DO) and (self.DOOPTS[opt] != True)) or ((cmd == DONT) and (self.DOOPTS[opt] != False))): ...
[ "def", "sendcommand", "(", "self", ",", "cmd", ",", "opt", "=", "None", ")", ":", "if", "cmd", "in", "[", "DO", ",", "DONT", "]", ":", "if", "not", "self", ".", "DOOPTS", ".", "has_key", "(", "opt", ")", ":", "self", ".", "DOOPTS", "[", "opt", ...
Send a telnet command (IAC)
[ "Send", "a", "telnet", "command", "(", "IAC", ")" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L582-L599
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase._readline_echo
def _readline_echo(self, char, echo): """Echo a recieved character, move cursor etc...""" if self._readline_do_echo(echo): self.write(char)
python
def _readline_echo(self, char, echo): """Echo a recieved character, move cursor etc...""" if self._readline_do_echo(echo): self.write(char)
[ "def", "_readline_echo", "(", "self", ",", "char", ",", "echo", ")", ":", "if", "self", ".", "_readline_do_echo", "(", "echo", ")", ":", "self", ".", "write", "(", "char", ")" ]
Echo a recieved character, move cursor etc...
[ "Echo", "a", "recieved", "character", "move", "cursor", "etc", "..." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L619-L622
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase._readline_insert
def _readline_insert(self, char, echo, insptr, line): """Deal properly with inserted chars in a line.""" if not self._readline_do_echo(echo): return # Write out the remainder of the line self.write(char + ''.join(line[insptr:])) # Cursor Left to the current insert poi...
python
def _readline_insert(self, char, echo, insptr, line): """Deal properly with inserted chars in a line.""" if not self._readline_do_echo(echo): return # Write out the remainder of the line self.write(char + ''.join(line[insptr:])) # Cursor Left to the current insert poi...
[ "def", "_readline_insert", "(", "self", ",", "char", ",", "echo", ",", "insptr", ",", "line", ")", ":", "if", "not", "self", ".", "_readline_do_echo", "(", "echo", ")", ":", "return", "# Write out the remainder of the line", "self", ".", "write", "(", "char"...
Deal properly with inserted chars in a line.
[ "Deal", "properly", "with", "inserted", "chars", "in", "a", "line", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L624-L632
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.ansi_to_curses
def ansi_to_curses(self, char): '''Handles reading ANSI escape sequences''' # ANSI sequences are: # ESC [ <key> # If we see ESC, read a char if char != ESC: return char # If we see [, read another char if self.getc(block=True) != ANSI_START_SEQ: ...
python
def ansi_to_curses(self, char): '''Handles reading ANSI escape sequences''' # ANSI sequences are: # ESC [ <key> # If we see ESC, read a char if char != ESC: return char # If we see [, read another char if self.getc(block=True) != ANSI_START_SEQ: ...
[ "def", "ansi_to_curses", "(", "self", ",", "char", ")", ":", "# ANSI sequences are:", "# ESC [ <key>", "# If we see ESC, read a char", "if", "char", "!=", "ESC", ":", "return", "char", "# If we see [, read another char", "if", "self", ".", "getc", "(", "block", "=",...
Handles reading ANSI escape sequences
[ "Handles", "reading", "ANSI", "escape", "sequences" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L637-L654
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.readline
def readline(self, echo=None, prompt='', use_history=True): """Return a line of text, including the terminating LF If echo is true always echo, if echo is false never echo If echo is None follow the negotiated setting. prompt is the current prompt to write (and rewrite if needed...
python
def readline(self, echo=None, prompt='', use_history=True): """Return a line of text, including the terminating LF If echo is true always echo, if echo is false never echo If echo is None follow the negotiated setting. prompt is the current prompt to write (and rewrite if needed...
[ "def", "readline", "(", "self", ",", "echo", "=", "None", ",", "prompt", "=", "''", ",", "use_history", "=", "True", ")", ":", "line", "=", "[", "]", "insptr", "=", "0", "ansi", "=", "0", "histptr", "=", "len", "(", "self", ".", "history", ")", ...
Return a line of text, including the terminating LF If echo is true always echo, if echo is false never echo If echo is None follow the negotiated setting. prompt is the current prompt to write (and rewrite if needed) use_history controls if this current line uses (and adds t...
[ "Return", "a", "line", "of", "text", "including", "the", "terminating", "LF", "If", "echo", "is", "true", "always", "echo", "if", "echo", "is", "false", "never", "echo", "If", "echo", "is", "None", "follow", "the", "negotiated", "setting", ".", "prompt", ...
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L656-L768
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.writeline
def writeline(self, text): """Send a packet with line ending.""" log.debug('writing line %r' % text) self.write(text+chr(10))
python
def writeline(self, text): """Send a packet with line ending.""" log.debug('writing line %r' % text) self.write(text+chr(10))
[ "def", "writeline", "(", "self", ",", "text", ")", ":", "log", ".", "debug", "(", "'writing line %r'", "%", "text", ")", "self", ".", "write", "(", "text", "+", "chr", "(", "10", ")", ")" ]
Send a packet with line ending.
[ "Send", "a", "packet", "with", "line", "ending", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L786-L789
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.writemessage
def writemessage(self, text): """Write out an asynchronous message, then reconstruct the prompt and entered text.""" log.debug('writing message %r', text) self.write(chr(10)+text+chr(10)) self.write(self._current_prompt+''.join(self._current_line))
python
def writemessage(self, text): """Write out an asynchronous message, then reconstruct the prompt and entered text.""" log.debug('writing message %r', text) self.write(chr(10)+text+chr(10)) self.write(self._current_prompt+''.join(self._current_line))
[ "def", "writemessage", "(", "self", ",", "text", ")", ":", "log", ".", "debug", "(", "'writing message %r'", ",", "text", ")", "self", ".", "write", "(", "chr", "(", "10", ")", "+", "text", "+", "chr", "(", "10", ")", ")", "self", ".", "write", "...
Write out an asynchronous message, then reconstruct the prompt and entered text.
[ "Write", "out", "an", "asynchronous", "message", "then", "reconstruct", "the", "prompt", "and", "entered", "text", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L791-L795
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.write
def write(self, text): """Send a packet to the socket. This function cooks output.""" text = str(text) # eliminate any unicode or other snigglets text = text.replace(IAC, IAC+IAC) text = text.replace(chr(10), chr(13)+chr(10)) self.writecooked(text)
python
def write(self, text): """Send a packet to the socket. This function cooks output.""" text = str(text) # eliminate any unicode or other snigglets text = text.replace(IAC, IAC+IAC) text = text.replace(chr(10), chr(13)+chr(10)) self.writecooked(text)
[ "def", "write", "(", "self", ",", "text", ")", ":", "text", "=", "str", "(", "text", ")", "# eliminate any unicode or other snigglets", "text", "=", "text", ".", "replace", "(", "IAC", ",", "IAC", "+", "IAC", ")", "text", "=", "text", ".", "replace", "...
Send a packet to the socket. This function cooks output.
[ "Send", "a", "packet", "to", "the", "socket", ".", "This", "function", "cooks", "output", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L797-L802
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase._inputcooker_getc
def _inputcooker_getc(self, block=True): """Get one character from the raw queue. Optionally blocking. Raise EOFError on end of stream. SHOULD ONLY BE CALLED FROM THE INPUT COOKER.""" if self.rawq: ret = self.rawq[0] self.rawq = self.rawq[1:] return re...
python
def _inputcooker_getc(self, block=True): """Get one character from the raw queue. Optionally blocking. Raise EOFError on end of stream. SHOULD ONLY BE CALLED FROM THE INPUT COOKER.""" if self.rawq: ret = self.rawq[0] self.rawq = self.rawq[1:] return re...
[ "def", "_inputcooker_getc", "(", "self", ",", "block", "=", "True", ")", ":", "if", "self", ".", "rawq", ":", "ret", "=", "self", ".", "rawq", "[", "0", "]", "self", ".", "rawq", "=", "self", ".", "rawq", "[", "1", ":", "]", "return", "ret", "i...
Get one character from the raw queue. Optionally blocking. Raise EOFError on end of stream. SHOULD ONLY BE CALLED FROM THE INPUT COOKER.
[ "Get", "one", "character", "from", "the", "raw", "queue", ".", "Optionally", "blocking", ".", "Raise", "EOFError", "on", "end", "of", "stream", ".", "SHOULD", "ONLY", "BE", "CALLED", "FROM", "THE", "INPUT", "COOKER", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L809-L825
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase._inputcooker_store
def _inputcooker_store(self, char): """Put the cooked data in the correct queue""" if self.sb: self.sbdataq = self.sbdataq + char else: self.inputcooker_store_queue(char)
python
def _inputcooker_store(self, char): """Put the cooked data in the correct queue""" if self.sb: self.sbdataq = self.sbdataq + char else: self.inputcooker_store_queue(char)
[ "def", "_inputcooker_store", "(", "self", ",", "char", ")", ":", "if", "self", ".", "sb", ":", "self", ".", "sbdataq", "=", "self", ".", "sbdataq", "+", "char", "else", ":", "self", ".", "inputcooker_store_queue", "(", "char", ")" ]
Put the cooked data in the correct queue
[ "Put", "the", "cooked", "data", "in", "the", "correct", "queue" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L839-L844
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.inputcooker
def inputcooker(self): """Input Cooker - Transfer from raw queue to cooked queue. Set self.eof when connection is closed. Don't block unless in the midst of an IAC sequence. """ try: while True: c = self._inputcooker_getc() if not sel...
python
def inputcooker(self): """Input Cooker - Transfer from raw queue to cooked queue. Set self.eof when connection is closed. Don't block unless in the midst of an IAC sequence. """ try: while True: c = self._inputcooker_getc() if not sel...
[ "def", "inputcooker", "(", "self", ")", ":", "try", ":", "while", "True", ":", "c", "=", "self", ".", "_inputcooker_getc", "(", ")", "if", "not", "self", ".", "iacseq", ":", "if", "c", "==", "IAC", ":", "self", ".", "iacseq", "+=", "c", "continue",...
Input Cooker - Transfer from raw queue to cooked queue. Set self.eof when connection is closed. Don't block unless in the midst of an IAC sequence.
[ "Input", "Cooker", "-", "Transfer", "from", "raw", "queue", "to", "cooked", "queue", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L851-L912
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.cmdHELP
def cmdHELP(self, params): """[<command>] Display help Display either brief help on all commands, or detailed help on a single command passed as a parameter. """ if params: cmd = params[0].upper() if self.COMMANDS.has_key(cmd): meth...
python
def cmdHELP(self, params): """[<command>] Display help Display either brief help on all commands, or detailed help on a single command passed as a parameter. """ if params: cmd = params[0].upper() if self.COMMANDS.has_key(cmd): meth...
[ "def", "cmdHELP", "(", "self", ",", "params", ")", ":", "if", "params", ":", "cmd", "=", "params", "[", "0", "]", ".", "upper", "(", ")", "if", "self", ".", "COMMANDS", ".", "has_key", "(", "cmd", ")", ":", "method", "=", "self", ".", "COMMANDS",...
[<command>] Display help Display either brief help on all commands, or detailed help on a single command passed as a parameter.
[ "[", "<command", ">", "]", "Display", "help", "Display", "either", "brief", "help", "on", "all", "commands", "or", "detailed", "help", "on", "a", "single", "command", "passed", "as", "a", "parameter", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L921-L969
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.cmdHISTORY
def cmdHISTORY(self, params): """ Display the command history """ cnt = 0 self.writeline('Command history\n') for line in self.history: cnt = cnt + 1 self.writeline("%-5d : %s" % (cnt, ''.join(line)))
python
def cmdHISTORY(self, params): """ Display the command history """ cnt = 0 self.writeline('Command history\n') for line in self.history: cnt = cnt + 1 self.writeline("%-5d : %s" % (cnt, ''.join(line)))
[ "def", "cmdHISTORY", "(", "self", ",", "params", ")", ":", "cnt", "=", "0", "self", ".", "writeline", "(", "'Command history\\n'", ")", "for", "line", "in", "self", ".", "history", ":", "cnt", "=", "cnt", "+", "1", "self", ".", "writeline", "(", "\"%...
Display the command history
[ "Display", "the", "command", "history" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L980-L988
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.handleException
def handleException(self, exc_type, exc_param, exc_tb): "Exception handler (False to abort)" self.writeline(''.join( traceback.format_exception(exc_type, exc_param, exc_tb) )) return True
python
def handleException(self, exc_type, exc_param, exc_tb): "Exception handler (False to abort)" self.writeline(''.join( traceback.format_exception(exc_type, exc_param, exc_tb) )) return True
[ "def", "handleException", "(", "self", ",", "exc_type", ",", "exc_param", ",", "exc_tb", ")", ":", "self", ".", "writeline", "(", "''", ".", "join", "(", "traceback", ".", "format_exception", "(", "exc_type", ",", "exc_param", ",", "exc_tb", ")", ")", ")...
Exception handler (False to abort)
[ "Exception", "handler", "(", "False", "to", "abort", ")" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L992-L995
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.authentication_ok
def authentication_ok(self): '''Checks the authentication and sets the username of the currently connected terminal. Returns True or False''' username = None password = None if self.authCallback: if self.authNeedUser: username = self.readline(prompt=self.PROM...
python
def authentication_ok(self): '''Checks the authentication and sets the username of the currently connected terminal. Returns True or False''' username = None password = None if self.authCallback: if self.authNeedUser: username = self.readline(prompt=self.PROM...
[ "def", "authentication_ok", "(", "self", ")", ":", "username", "=", "None", "password", "=", "None", "if", "self", ".", "authCallback", ":", "if", "self", ".", "authNeedUser", ":", "username", "=", "self", ".", "readline", "(", "prompt", "=", "self", "."...
Checks the authentication and sets the username of the currently connected terminal. Returns True or False
[ "Checks", "the", "authentication", "and", "sets", "the", "username", "of", "the", "currently", "connected", "terminal", ".", "Returns", "True", "or", "False" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L997-L1020
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
TelnetHandlerBase.handle
def handle(self): "The actual service to which the user has connected." if self.TELNET_ISSUE: self.writeline(self.TELNET_ISSUE) if not self.authentication_ok(): return if self.DOECHO: self.writeline(self.WELCOME) self.session_start() w...
python
def handle(self): "The actual service to which the user has connected." if self.TELNET_ISSUE: self.writeline(self.TELNET_ISSUE) if not self.authentication_ok(): return if self.DOECHO: self.writeline(self.WELCOME) self.session_start() w...
[ "def", "handle", "(", "self", ")", ":", "if", "self", ".", "TELNET_ISSUE", ":", "self", ".", "writeline", "(", "self", ".", "TELNET_ISSUE", ")", "if", "not", "self", ".", "authentication_ok", "(", ")", ":", "return", "if", "self", ".", "DOECHO", ":", ...
The actual service to which the user has connected.
[ "The", "actual", "service", "to", "which", "the", "user", "has", "connected", "." ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L1023-L1050
ianepperson/telnetsrvlib
telnetsrv/green.py
TelnetHandler.setup
def setup(self): '''Called after instantiation''' TelnetHandlerBase.setup(self) # Spawn a greenlet to handle socket input self.greenlet_ic = gevent.spawn(self.inputcooker) # Note that inputcooker exits on EOF # Sleep for 0.5 second to allow options negotiation ...
python
def setup(self): '''Called after instantiation''' TelnetHandlerBase.setup(self) # Spawn a greenlet to handle socket input self.greenlet_ic = gevent.spawn(self.inputcooker) # Note that inputcooker exits on EOF # Sleep for 0.5 second to allow options negotiation ...
[ "def", "setup", "(", "self", ")", ":", "TelnetHandlerBase", ".", "setup", "(", "self", ")", "# Spawn a greenlet to handle socket input", "self", ".", "greenlet_ic", "=", "gevent", ".", "spawn", "(", "self", ".", "inputcooker", ")", "# Note that inputcooker exits on ...
Called after instantiation
[ "Called", "after", "instantiation" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/green.py#L16-L24
ianepperson/telnetsrvlib
telnetsrv/green.py
TelnetHandler.getc
def getc(self, block=True): """Return one character from the input queue""" try: return self.cookedq.get(block) except gevent.queue.Empty: return ''
python
def getc(self, block=True): """Return one character from the input queue""" try: return self.cookedq.get(block) except gevent.queue.Empty: return ''
[ "def", "getc", "(", "self", ",", "block", "=", "True", ")", ":", "try", ":", "return", "self", ".", "cookedq", ".", "get", "(", "block", ")", "except", "gevent", ".", "queue", ".", "Empty", ":", "return", "''" ]
Return one character from the input queue
[ "Return", "one", "character", "from", "the", "input", "queue" ]
train
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/green.py#L35-L40
hbldh/pybankid
bankid/client.py
BankIDClient.authenticate
def authenticate(self, personal_number, **kwargs): """Request an authentication order. The :py:meth:`collect` method is used to query the status of the order. :param personal_number: The Swedish personal number in format YYYYMMDDXXXX. :type personal_number: str :retu...
python
def authenticate(self, personal_number, **kwargs): """Request an authentication order. The :py:meth:`collect` method is used to query the status of the order. :param personal_number: The Swedish personal number in format YYYYMMDDXXXX. :type personal_number: str :retu...
[ "def", "authenticate", "(", "self", ",", "personal_number", ",", "*", "*", "kwargs", ")", ":", "if", "\"requirementAlternatives\"", "in", "kwargs", ":", "warnings", ".", "warn", "(", "\"Requirement Alternatives \"", "\"option is not tested.\"", ",", "BankIDWarning", ...
Request an authentication order. The :py:meth:`collect` method is used to query the status of the order. :param personal_number: The Swedish personal number in format YYYYMMDDXXXX. :type personal_number: str :return: The OrderResponse parsed to a dictionary. :rtype: ...
[ "Request", "an", "authentication", "order", ".", "The", ":", "py", ":", "meth", ":", "collect", "method", "is", "used", "to", "query", "the", "status", "of", "the", "order", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/client.py#L84-L109
hbldh/pybankid
bankid/client.py
BankIDClient.sign
def sign(self, user_visible_data, personal_number=None, **kwargs): """Request an signing order. The :py:meth:`collect` method is used to query the status of the order. :param user_visible_data: The information that the end user is requested to sign. :type user_visible_data: ...
python
def sign(self, user_visible_data, personal_number=None, **kwargs): """Request an signing order. The :py:meth:`collect` method is used to query the status of the order. :param user_visible_data: The information that the end user is requested to sign. :type user_visible_data: ...
[ "def", "sign", "(", "self", ",", "user_visible_data", ",", "personal_number", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "\"requirementAlternatives\"", "in", "kwargs", ":", "warnings", ".", "warn", "(", "\"Requirement Alternatives option is not tested.\""...
Request an signing order. The :py:meth:`collect` method is used to query the status of the order. :param user_visible_data: The information that the end user is requested to sign. :type user_visible_data: str :param personal_number: The Swedish personal number in ...
[ "Request", "an", "signing", "order", ".", "The", ":", "py", ":", "meth", ":", "collect", "method", "is", "used", "to", "query", "the", "status", "of", "the", "order", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/client.py#L111-L144
hbldh/pybankid
bankid/client.py
BankIDClient.collect
def collect(self, order_ref): """Collect the progress status of the order with the specified order reference. :param order_ref: The UUID string specifying which order to collect status from. :type order_ref: str :return: The CollectResponse parsed to a dictionary. ...
python
def collect(self, order_ref): """Collect the progress status of the order with the specified order reference. :param order_ref: The UUID string specifying which order to collect status from. :type order_ref: str :return: The CollectResponse parsed to a dictionary. ...
[ "def", "collect", "(", "self", ",", "order_ref", ")", ":", "try", ":", "out", "=", "self", ".", "client", ".", "service", ".", "Collect", "(", "order_ref", ")", "except", "Error", "as", "e", ":", "raise", "get_error_class", "(", "e", ",", "\"Could not ...
Collect the progress status of the order with the specified order reference. :param order_ref: The UUID string specifying which order to collect status from. :type order_ref: str :return: The CollectResponse parsed to a dictionary. :rtype: dict :raises BankID...
[ "Collect", "the", "progress", "status", "of", "the", "order", "with", "the", "specified", "order", "reference", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/client.py#L146-L164
hbldh/pybankid
bankid/client.py
BankIDClient._dictify
def _dictify(self, doc): """Transforms the replies to a regular Python dict with strings and datetimes. Tested with BankID version 2.5 return data. :param doc: The response as interpreted by :py:mod:`zeep`. :returns: The response parsed to a dict. :rtype: dict ...
python
def _dictify(self, doc): """Transforms the replies to a regular Python dict with strings and datetimes. Tested with BankID version 2.5 return data. :param doc: The response as interpreted by :py:mod:`zeep`. :returns: The response parsed to a dict. :rtype: dict ...
[ "def", "_dictify", "(", "self", ",", "doc", ")", ":", "return", "{", "k", ":", "(", "self", ".", "_dictify", "(", "doc", "[", "k", "]", ")", "if", "hasattr", "(", "doc", "[", "k", "]", ",", "\"_xsd_type\"", ")", "else", "doc", "[", "k", "]", ...
Transforms the replies to a regular Python dict with strings and datetimes. Tested with BankID version 2.5 return data. :param doc: The response as interpreted by :py:mod:`zeep`. :returns: The response parsed to a dict. :rtype: dict
[ "Transforms", "the", "replies", "to", "a", "regular", "Python", "dict", "with", "strings", "and", "datetimes", "." ]
train
https://github.com/hbldh/pybankid/blob/1405f66e41f912cdda15e20aea08cdfa6b60480a/bankid/client.py#L181-L195
springload/wagtaildraftail
wagtaildraftail/widgets.py
DraftailTextArea.intercept_image_formats
def intercept_image_formats(self, options): """ Load all image formats if needed. """ if 'entityTypes' in options: for entity in options['entityTypes']: if entity['type'] == ENTITY_TYPES.IMAGE and 'imageFormats' in entity: if entity['imageF...
python
def intercept_image_formats(self, options): """ Load all image formats if needed. """ if 'entityTypes' in options: for entity in options['entityTypes']: if entity['type'] == ENTITY_TYPES.IMAGE and 'imageFormats' in entity: if entity['imageF...
[ "def", "intercept_image_formats", "(", "self", ",", "options", ")", ":", "if", "'entityTypes'", "in", "options", ":", "for", "entity", "in", "options", "[", "'entityTypes'", "]", ":", "if", "entity", "[", "'type'", "]", "==", "ENTITY_TYPES", ".", "IMAGE", ...
Load all image formats if needed.
[ "Load", "all", "image", "formats", "if", "needed", "." ]
train
https://github.com/springload/wagtaildraftail/blob/87f1ae3ade493c00daff021394051aa656136c10/wagtaildraftail/widgets.py#L75-L85
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "self", ".", "_timestamp", "is", "not", "None", ":", "self", ".", "_normalized_timestamp", "=", "decimal", ".", "Decimal", "(", "sel...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L51-L64
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTime.CopyFromDateTimeString
def CopyFromDateTimeString(self, time_string): """Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can...
python
def CopyFromDateTimeString(self, time_string): """Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can...
[ "def", "CopyFromDateTimeString", "(", "self", ",", "time_string", ")", ":", "date_time_values", "=", "self", ".", "_CopyDateTimeFromString", "(", "time_string", ")", "year", "=", "date_time_values", ".", "get", "(", "'year'", ",", "0", ")", "month", "=", "date...
Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The time of day, seconds ...
[ "Copies", "a", "POSIX", "timestamp", "from", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L66-L90
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTime.CopyToDateTimeString
def CopyToDateTimeString(self): """Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or None if the timestamp is missing. """ if self._timestamp is None: return None number_of_days, hours, minutes, seco...
python
def CopyToDateTimeString(self): """Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or None if the timestamp is missing. """ if self._timestamp is None: return None number_of_days, hours, minutes, seco...
[ "def", "CopyToDateTimeString", "(", "self", ")", ":", "if", "self", ".", "_timestamp", "is", "None", ":", "return", "None", "number_of_days", ",", "hours", ",", "minutes", ",", "seconds", "=", "self", ".", "_GetTimeValues", "(", "self", ".", "_timestamp", ...
Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or None if the timestamp is missing.
[ "Copies", "the", "POSIX", "timestamp", "to", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L92-L109
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTimeInMilliseconds._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "self", ".", "_timestamp", "is", "not", "None", ":", "self", ".", "_normalized_timestamp", "=", "(", "decimal", ".", "Decimal", "(",...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L138-L153
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTimeInMilliseconds.CopyFromDateTimeString
def CopyFromDateTimeString(self, time_string): """Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can...
python
def CopyFromDateTimeString(self, time_string): """Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can...
[ "def", "CopyFromDateTimeString", "(", "self", ",", "time_string", ")", ":", "date_time_values", "=", "self", ".", "_CopyDateTimeFromString", "(", "time_string", ")", "year", "=", "date_time_values", ".", "get", "(", "'year'", ",", "0", ")", "month", "=", "date...
Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The time of day, seconds ...
[ "Copies", "a", "POSIX", "timestamp", "from", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L155-L187
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTimeInMicroseconds._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "self", ".", "_timestamp", "is", "not", "None", ":", "self", ".", "_normalized_timestamp", "=", "(", "decimal", ".", "Decimal", "(",...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L236-L251
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTimeInNanoseconds._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "self", ".", "_timestamp", "is", "not", "None", ":", "self", ".", "_normalized_timestamp", "=", "(", "decimal", ".", "Decimal", "(",...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L330-L345
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTimeInNanoseconds._CopyFromDateTimeString
def _CopyFromDateTimeString(self, time_string): """Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction ca...
python
def _CopyFromDateTimeString(self, time_string): """Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction ca...
[ "def", "_CopyFromDateTimeString", "(", "self", ",", "time_string", ")", ":", "date_time_values", "=", "self", ".", "_CopyDateTimeFromString", "(", "time_string", ")", "year", "=", "date_time_values", ".", "get", "(", "'year'", ",", "0", ")", "month", "=", "dat...
Copies a POSIX timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The time of day, seconds ...
[ "Copies", "a", "POSIX", "timestamp", "from", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L347-L378
log2timeline/dfdatetime
dfdatetime/posix_time.py
PosixTimeInNanoseconds._CopyToDateTimeString
def _CopyToDateTimeString(self): """Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#########" or None if the timestamp is missing or invalid. """ if self._timestamp is None: return None timestamp, nan...
python
def _CopyToDateTimeString(self): """Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#########" or None if the timestamp is missing or invalid. """ if self._timestamp is None: return None timestamp, nan...
[ "def", "_CopyToDateTimeString", "(", "self", ")", ":", "if", "self", ".", "_timestamp", "is", "None", ":", "return", "None", "timestamp", ",", "nanoseconds", "=", "divmod", "(", "self", ".", "_timestamp", ",", "definitions", ".", "NANOSECONDS_PER_SECOND", ")",...
Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#########" or None if the timestamp is missing or invalid.
[ "Copies", "the", "POSIX", "timestamp", "to", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/posix_time.py#L394-L412
log2timeline/dfdatetime
dfdatetime/delphi_date_time.py
DelphiDateTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "self", ".", "_timestamp", "is", "not", "None", ":", "self", ".", "_normalized_timestamp", "=", "(", "decimal", ".", "Decimal", "(",...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/delphi_date_time.py#L56-L71
log2timeline/dfdatetime
dfdatetime/delphi_date_time.py
DelphiDateTime.CopyFromDateTimeString
def CopyFromDateTimeString(self, time_string): """Copies a Delphi TDateTime timestamp from a string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be...
python
def CopyFromDateTimeString(self, time_string): """Copies a Delphi TDateTime timestamp from a string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be...
[ "def", "CopyFromDateTimeString", "(", "self", ",", "time_string", ")", ":", "date_time_values", "=", "self", ".", "_CopyDateTimeFromString", "(", "time_string", ")", "year", "=", "date_time_values", ".", "get", "(", "'year'", ",", "0", ")", "month", "=", "date...
Copies a Delphi TDateTime timestamp from a string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The time of day, seconds ...
[ "Copies", "a", "Delphi", "TDateTime", "timestamp", "from", "a", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/delphi_date_time.py#L73-L111
log2timeline/dfdatetime
dfdatetime/webkit_time.py
WebKitTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: float: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be dete...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: float: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be dete...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "(", "self", ".", "_timestamp", "is", "not", "None", "and", "self", ".", "_timestamp", ">=", "self", ".", "_INT64_MIN", "and", "se...
Retrieves the normalized timestamp. Returns: float: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/webkit_time.py#L50-L66
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._AdjustForTimeZoneOffset
def _AdjustForTimeZoneOffset( self, year, month, day_of_month, hours, minutes, time_zone_offset): """Adjusts the date and time values for a time zone offset. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, where 1 r...
python
def _AdjustForTimeZoneOffset( self, year, month, day_of_month, hours, minutes, time_zone_offset): """Adjusts the date and time values for a time zone offset. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, where 1 r...
[ "def", "_AdjustForTimeZoneOffset", "(", "self", ",", "year", ",", "month", ",", "day_of_month", ",", "hours", ",", "minutes", ",", "time_zone_offset", ")", ":", "hours_from_utc", ",", "minutes_from_utc", "=", "divmod", "(", "time_zone_offset", ",", "60", ")", ...
Adjusts the date and time values for a time zone offset. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, where 1 represents the first day. hours (int): hours. minutes (int): minutes. time_zone_offset (int): ...
[ "Adjusts", "the", "date", "and", "time", "values", "for", "a", "time", "zone", "offset", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L235-L288
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._CopyDateFromString
def _CopyDateFromString(self, date_string): """Copies a date from a string. Args: date_string (str): date value formatted as: YYYY-MM-DD Returns: tuple[int, int, int]: year, month, day of month. Raises: ValueError: if the date string is invalid or not supported. """ date_str...
python
def _CopyDateFromString(self, date_string): """Copies a date from a string. Args: date_string (str): date value formatted as: YYYY-MM-DD Returns: tuple[int, int, int]: year, month, day of month. Raises: ValueError: if the date string is invalid or not supported. """ date_str...
[ "def", "_CopyDateFromString", "(", "self", ",", "date_string", ")", ":", "date_string_length", "=", "len", "(", "date_string", ")", "# The date string should at least contain 'YYYY-MM-DD'.", "if", "date_string_length", "<", "10", ":", "raise", "ValueError", "(", "'Date ...
Copies a date from a string. Args: date_string (str): date value formatted as: YYYY-MM-DD Returns: tuple[int, int, int]: year, month, day of month. Raises: ValueError: if the date string is invalid or not supported.
[ "Copies", "a", "date", "from", "a", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L290-L330
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._CopyTimeFromString
def _CopyTimeFromString(self, time_string): """Copies a time from a string. Args: time_string (str): time value formatted as: hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The seconds fraction a...
python
def _CopyTimeFromString(self, time_string): """Copies a time from a string. Args: time_string (str): time value formatted as: hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The seconds fraction a...
[ "def", "_CopyTimeFromString", "(", "self", ",", "time_string", ")", ":", "time_string_length", "=", "len", "(", "time_string", ")", "# The time string should at least contain 'hh:mm:ss'.", "if", "time_string_length", "<", "8", ":", "raise", "ValueError", "(", "'Time str...
Copies a time from a string. Args: time_string (str): time value formatted as: hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The seconds fraction and time zone offset are optional. Re...
[ "Copies", "a", "time", "from", "a", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L389-L503
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._GetDateValues
def _GetDateValues( self, number_of_days, epoch_year, epoch_month, epoch_day_of_month): """Determines date values. Args: number_of_days (int): number of days since epoch. epoch_year (int): year that is the start of the epoch e.g. 1970. epoch_month (int): month that is the start of the e...
python
def _GetDateValues( self, number_of_days, epoch_year, epoch_month, epoch_day_of_month): """Determines date values. Args: number_of_days (int): number of days since epoch. epoch_year (int): year that is the start of the epoch e.g. 1970. epoch_month (int): month that is the start of the e...
[ "def", "_GetDateValues", "(", "self", ",", "number_of_days", ",", "epoch_year", ",", "epoch_month", ",", "epoch_day_of_month", ")", ":", "if", "epoch_year", "<", "0", ":", "raise", "ValueError", "(", "'Epoch year value: {0:d} out of bounds.'", ".", "format", "(", ...
Determines date values. Args: number_of_days (int): number of days since epoch. epoch_year (int): year that is the start of the epoch e.g. 1970. epoch_month (int): month that is the start of the epoch, where 1 represents January. epoch_day_of_month (int): day of month that is the ...
[ "Determines", "date", "values", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L505-L628
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._GetDateValuesWithEpoch
def _GetDateValuesWithEpoch(self, number_of_days, date_time_epoch): """Determines date values. Args: number_of_days (int): number of days since epoch. date_time_epoch (DateTimeEpoch): date and time of the epoch. Returns: tuple[int, int, int]: year, month, day of month. """ retur...
python
def _GetDateValuesWithEpoch(self, number_of_days, date_time_epoch): """Determines date values. Args: number_of_days (int): number of days since epoch. date_time_epoch (DateTimeEpoch): date and time of the epoch. Returns: tuple[int, int, int]: year, month, day of month. """ retur...
[ "def", "_GetDateValuesWithEpoch", "(", "self", ",", "number_of_days", ",", "date_time_epoch", ")", ":", "return", "self", ".", "_GetDateValues", "(", "number_of_days", ",", "date_time_epoch", ".", "year", ",", "date_time_epoch", ".", "month", ",", "date_time_epoch",...
Determines date values. Args: number_of_days (int): number of days since epoch. date_time_epoch (DateTimeEpoch): date and time of the epoch. Returns: tuple[int, int, int]: year, month, day of month.
[ "Determines", "date", "values", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L630-L642
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._GetDayOfYear
def _GetDayOfYear(self, year, month, day_of_month): """Retrieves the day of the year for a specific day of a month in a year. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, where 1 represents the first day. Returns:...
python
def _GetDayOfYear(self, year, month, day_of_month): """Retrieves the day of the year for a specific day of a month in a year. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, where 1 represents the first day. Returns:...
[ "def", "_GetDayOfYear", "(", "self", ",", "year", ",", "month", ",", "day_of_month", ")", ":", "if", "month", "not", "in", "range", "(", "1", ",", "13", ")", ":", "raise", "ValueError", "(", "'Month value out of bounds.'", ")", "days_per_month", "=", "self...
Retrieves the day of the year for a specific day of a month in a year. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, where 1 represents the first day. Returns: int: day of year. Raises: ValueError: if ...
[ "Retrieves", "the", "day", "of", "the", "year", "for", "a", "specific", "day", "of", "a", "month", "in", "a", "year", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L644-L669
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._GetDaysPerMonth
def _GetDaysPerMonth(self, year, month): """Retrieves the number of days in a month of a specific year. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. Returns: int: number of days in the month. Raises: ValueError: if the month value is out of...
python
def _GetDaysPerMonth(self, year, month): """Retrieves the number of days in a month of a specific year. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. Returns: int: number of days in the month. Raises: ValueError: if the month value is out of...
[ "def", "_GetDaysPerMonth", "(", "self", ",", "year", ",", "month", ")", ":", "if", "month", "not", "in", "range", "(", "1", ",", "13", ")", ":", "raise", "ValueError", "(", "'Month value out of bounds.'", ")", "days_per_month", "=", "self", ".", "_DAYS_PER...
Retrieves the number of days in a month of a specific year. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. Returns: int: number of days in the month. Raises: ValueError: if the month value is out of bounds.
[ "Retrieves", "the", "number", "of", "days", "in", "a", "month", "of", "a", "specific", "year", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L671-L691
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._GetNumberOfDaysInCentury
def _GetNumberOfDaysInCentury(self, year): """Retrieves the number of days in a century. Args: year (int): year in the century e.g. 1970. Returns: int: number of (remaining) days in the century. Raises: ValueError: if the year value is out of bounds. """ if year < 0: r...
python
def _GetNumberOfDaysInCentury(self, year): """Retrieves the number of days in a century. Args: year (int): year in the century e.g. 1970. Returns: int: number of (remaining) days in the century. Raises: ValueError: if the year value is out of bounds. """ if year < 0: r...
[ "def", "_GetNumberOfDaysInCentury", "(", "self", ",", "year", ")", ":", "if", "year", "<", "0", ":", "raise", "ValueError", "(", "'Year value out of bounds.'", ")", "year", ",", "_", "=", "divmod", "(", "year", ",", "100", ")", "if", "self", ".", "_IsLea...
Retrieves the number of days in a century. Args: year (int): year in the century e.g. 1970. Returns: int: number of (remaining) days in the century. Raises: ValueError: if the year value is out of bounds.
[ "Retrieves", "the", "number", "of", "days", "in", "a", "century", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L704-L723
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._GetNumberOfSecondsFromElements
def _GetNumberOfSecondsFromElements( self, year, month, day_of_month, hours, minutes, seconds): """Retrieves the number of seconds from the date and time elements. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, whe...
python
def _GetNumberOfSecondsFromElements( self, year, month, day_of_month, hours, minutes, seconds): """Retrieves the number of seconds from the date and time elements. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, whe...
[ "def", "_GetNumberOfSecondsFromElements", "(", "self", ",", "year", ",", "month", ",", "day_of_month", ",", "hours", ",", "minutes", ",", "seconds", ")", ":", "if", "not", "year", "or", "not", "month", "or", "not", "day_of_month", ":", "return", "None", "#...
Retrieves the number of seconds from the date and time elements. Args: year (int): year e.g. 1970. month (int): month, where 1 represents January. day_of_month (int): day of the month, where 1 represents the first day. hours (int): hours. minutes (int): minutes. seconds (int): s...
[ "Retrieves", "the", "number", "of", "seconds", "from", "the", "date", "and", "time", "elements", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L738-L788
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues._GetTimeValues
def _GetTimeValues(self, number_of_seconds): """Determines time values. Args: number_of_seconds (int|decimal.Decimal): number of seconds. Returns: tuple[int, int, int, int]: days, hours, minutes, seconds. """ number_of_seconds = int(number_of_seconds) number_of_minutes, seconds = ...
python
def _GetTimeValues(self, number_of_seconds): """Determines time values. Args: number_of_seconds (int|decimal.Decimal): number of seconds. Returns: tuple[int, int, int, int]: days, hours, minutes, seconds. """ number_of_seconds = int(number_of_seconds) number_of_minutes, seconds = ...
[ "def", "_GetTimeValues", "(", "self", ",", "number_of_seconds", ")", ":", "number_of_seconds", "=", "int", "(", "number_of_seconds", ")", "number_of_minutes", ",", "seconds", "=", "divmod", "(", "number_of_seconds", ",", "60", ")", "number_of_hours", ",", "minutes...
Determines time values. Args: number_of_seconds (int|decimal.Decimal): number of seconds. Returns: tuple[int, int, int, int]: days, hours, minutes, seconds.
[ "Determines", "time", "values", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L790-L803
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues.CopyToStatTimeTuple
def CopyToStatTimeTuple(self): """Copies the date time value to a stat timestamp tuple. Returns: tuple[int, int]: a POSIX timestamp in seconds and the remainder in 100 nano seconds or (None, None) on error. """ normalized_timestamp = self._GetNormalizedTimestamp() if normalized_time...
python
def CopyToStatTimeTuple(self): """Copies the date time value to a stat timestamp tuple. Returns: tuple[int, int]: a POSIX timestamp in seconds and the remainder in 100 nano seconds or (None, None) on error. """ normalized_timestamp = self._GetNormalizedTimestamp() if normalized_time...
[ "def", "CopyToStatTimeTuple", "(", "self", ")", ":", "normalized_timestamp", "=", "self", ".", "_GetNormalizedTimestamp", "(", ")", "if", "normalized_timestamp", "is", "None", ":", "return", "None", ",", "None", "if", "self", ".", "_precision", "in", "(", "def...
Copies the date time value to a stat timestamp tuple. Returns: tuple[int, int]: a POSIX timestamp in seconds and the remainder in 100 nano seconds or (None, None) on error.
[ "Copies", "the", "date", "time", "value", "to", "a", "stat", "timestamp", "tuple", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L865-L886
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues.CopyToDateTimeStringISO8601
def CopyToDateTimeStringISO8601(self): """Copies the date time value to an ISO 8601 date and time string. Returns: str: date and time value formatted as an ISO 8601 date and time string or None if the timestamp cannot be copied to a date and time string. """ date_time_string = self.Copy...
python
def CopyToDateTimeStringISO8601(self): """Copies the date time value to an ISO 8601 date and time string. Returns: str: date and time value formatted as an ISO 8601 date and time string or None if the timestamp cannot be copied to a date and time string. """ date_time_string = self.Copy...
[ "def", "CopyToDateTimeStringISO8601", "(", "self", ")", ":", "date_time_string", "=", "self", ".", "CopyToDateTimeString", "(", ")", "if", "date_time_string", ":", "date_time_string", "=", "date_time_string", ".", "replace", "(", "' '", ",", "'T'", ")", "date_time...
Copies the date time value to an ISO 8601 date and time string. Returns: str: date and time value formatted as an ISO 8601 date and time string or None if the timestamp cannot be copied to a date and time string.
[ "Copies", "the", "date", "time", "value", "to", "an", "ISO", "8601", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L897-L908
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues.GetDate
def GetDate(self): """Retrieves the date represented by the date and time values. Returns: tuple[int, int, int]: year, month, day of month or (None, None, None) if the date and time values do not represent a date. """ normalized_timestamp = self._GetNormalizedTimestamp() if normal...
python
def GetDate(self): """Retrieves the date represented by the date and time values. Returns: tuple[int, int, int]: year, month, day of month or (None, None, None) if the date and time values do not represent a date. """ normalized_timestamp = self._GetNormalizedTimestamp() if normal...
[ "def", "GetDate", "(", "self", ")", ":", "normalized_timestamp", "=", "self", ".", "_GetNormalizedTimestamp", "(", ")", "if", "normalized_timestamp", "is", "None", ":", "return", "None", ",", "None", ",", "None", "number_of_days", ",", "_", ",", "_", ",", ...
Retrieves the date represented by the date and time values. Returns: tuple[int, int, int]: year, month, day of month or (None, None, None) if the date and time values do not represent a date.
[ "Retrieves", "the", "date", "represented", "by", "the", "date", "and", "time", "values", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L910-L928
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues.GetPlasoTimestamp
def GetPlasoTimestamp(self): """Retrieves a timestamp that is compatible with plaso. Returns: int: a POSIX timestamp in microseconds or None if no timestamp is available. """ normalized_timestamp = self._GetNormalizedTimestamp() if normalized_timestamp is None: return None ...
python
def GetPlasoTimestamp(self): """Retrieves a timestamp that is compatible with plaso. Returns: int: a POSIX timestamp in microseconds or None if no timestamp is available. """ normalized_timestamp = self._GetNormalizedTimestamp() if normalized_timestamp is None: return None ...
[ "def", "GetPlasoTimestamp", "(", "self", ")", ":", "normalized_timestamp", "=", "self", ".", "_GetNormalizedTimestamp", "(", ")", "if", "normalized_timestamp", "is", "None", ":", "return", "None", "normalized_timestamp", "*=", "definitions", ".", "MICROSECONDS_PER_SEC...
Retrieves a timestamp that is compatible with plaso. Returns: int: a POSIX timestamp in microseconds or None if no timestamp is available.
[ "Retrieves", "a", "timestamp", "that", "is", "compatible", "with", "plaso", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L931-L945
log2timeline/dfdatetime
dfdatetime/interface.py
DateTimeValues.GetTimeOfDay
def GetTimeOfDay(self): """Retrieves the time of day represented by the date and time values. Returns: tuple[int, int, int]: hours, minutes, seconds or (None, None, None) if the date and time values do not represent a time of day. """ normalized_timestamp = self._GetNormalizedTimestam...
python
def GetTimeOfDay(self): """Retrieves the time of day represented by the date and time values. Returns: tuple[int, int, int]: hours, minutes, seconds or (None, None, None) if the date and time values do not represent a time of day. """ normalized_timestamp = self._GetNormalizedTimestam...
[ "def", "GetTimeOfDay", "(", "self", ")", ":", "normalized_timestamp", "=", "self", ".", "_GetNormalizedTimestamp", "(", ")", "if", "normalized_timestamp", "is", "None", ":", "return", "None", ",", "None", ",", "None", "_", ",", "hours", ",", "minutes", ",", ...
Retrieves the time of day represented by the date and time values. Returns: tuple[int, int, int]: hours, minutes, seconds or (None, None, None) if the date and time values do not represent a time of day.
[ "Retrieves", "the", "time", "of", "day", "represented", "by", "the", "date", "and", "time", "values", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L947-L959
log2timeline/dfdatetime
dfdatetime/hfs_time.py
HFSTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "(", "self", ".", "_timestamp", "is", "not", "None", "and", "self", ".", "_timestamp", ">=", "0", "and", "self", ".", "_timestamp"...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/hfs_time.py#L50-L65
log2timeline/dfdatetime
dfdatetime/fake_time.py
FakeTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "self", ".", "_number_of_seconds", "is", "not", "None", ":", "self", ".", "_normalized_timestamp", "=", "(", "decimal", ".", "Decimal"...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/fake_time.py#L37-L53
log2timeline/dfdatetime
dfdatetime/fake_time.py
FakeTime.CopyFromDateTimeString
def CopyFromDateTimeString(self, time_string): """Copies a fake timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can ...
python
def CopyFromDateTimeString(self, time_string): """Copies a fake timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can ...
[ "def", "CopyFromDateTimeString", "(", "self", ",", "time_string", ")", ":", "date_time_values", "=", "self", ".", "_CopyDateTimeFromString", "(", "time_string", ")", "year", "=", "date_time_values", ".", "get", "(", "'year'", ",", "0", ")", "month", "=", "date...
Copies a fake timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The time of day, seconds ...
[ "Copies", "a", "fake", "timestamp", "from", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/fake_time.py#L55-L81
log2timeline/dfdatetime
dfdatetime/rfc2579_date_time.py
RFC2579DateTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "self", ".", "_number_of_seconds", "is", "not", "None", ":", "self", ".", "_normalized_timestamp", "=", "(", "decimal", ".", "Decimal"...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/rfc2579_date_time.py#L131-L147
log2timeline/dfdatetime
dfdatetime/rfc2579_date_time.py
RFC2579DateTime.CopyToDateTimeString
def CopyToDateTimeString(self): """Copies the RFC2579 date-time to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#" or None if the number of seconds is missing. """ if self._number_of_seconds is None: return None return '{0:04d}-...
python
def CopyToDateTimeString(self): """Copies the RFC2579 date-time to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#" or None if the number of seconds is missing. """ if self._number_of_seconds is None: return None return '{0:04d}-...
[ "def", "CopyToDateTimeString", "(", "self", ")", ":", "if", "self", ".", "_number_of_seconds", "is", "None", ":", "return", "None", "return", "'{0:04d}-{1:02d}-{2:02d} {3:02d}:{4:02d}:{5:02d}.{6:01d}'", ".", "format", "(", "self", ".", "year", ",", "self", ".", "m...
Copies the RFC2579 date-time to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#" or None if the number of seconds is missing.
[ "Copies", "the", "RFC2579", "date", "-", "time", "to", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/rfc2579_date_time.py#L194-L206
RyanBalfanz/django-smsish
smsish/sms/backends/twilio.py
SMSBackend.open
def open(self): """ Ensures we have a connection to the SMS gateway. Returns whether or not a new connection was required (True or False). """ if self.connection: # Nothing to do if the connection is already open. return False self.connection = self._get_twilio_client() return True
python
def open(self): """ Ensures we have a connection to the SMS gateway. Returns whether or not a new connection was required (True or False). """ if self.connection: # Nothing to do if the connection is already open. return False self.connection = self._get_twilio_client() return True
[ "def", "open", "(", "self", ")", ":", "if", "self", ".", "connection", ":", "# Nothing to do if the connection is already open.", "return", "False", "self", ".", "connection", "=", "self", ".", "_get_twilio_client", "(", ")", "return", "True" ]
Ensures we have a connection to the SMS gateway. Returns whether or not a new connection was required (True or False).
[ "Ensures", "we", "have", "a", "connection", "to", "the", "SMS", "gateway", ".", "Returns", "whether", "or", "not", "a", "new", "connection", "was", "required", "(", "True", "or", "False", ")", "." ]
train
https://github.com/RyanBalfanz/django-smsish/blob/4d450e3d217cea9e373f16c5e4f0beb3218bd5c9/smsish/sms/backends/twilio.py#L12-L21
RyanBalfanz/django-smsish
smsish/sms/backends/twilio.py
SMSBackend._send
def _send(self, email_message): """A helper method that does the actual sending.""" if not email_message.recipients(): return False from_email = email_message.from_email recipients = email_message.recipients() try: self.connection.messages.create( to=recipients, from_=from_email, body=email_...
python
def _send(self, email_message): """A helper method that does the actual sending.""" if not email_message.recipients(): return False from_email = email_message.from_email recipients = email_message.recipients() try: self.connection.messages.create( to=recipients, from_=from_email, body=email_...
[ "def", "_send", "(", "self", ",", "email_message", ")", ":", "if", "not", "email_message", ".", "recipients", "(", ")", ":", "return", "False", "from_email", "=", "email_message", ".", "from_email", "recipients", "=", "email_message", ".", "recipients", "(", ...
A helper method that does the actual sending.
[ "A", "helper", "method", "that", "does", "the", "actual", "sending", "." ]
train
https://github.com/RyanBalfanz/django-smsish/blob/4d450e3d217cea9e373f16c5e4f0beb3218bd5c9/smsish/sms/backends/twilio.py#L47-L63
log2timeline/dfdatetime
dfdatetime/fat_date_time.py
FATDateTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "self", ".", "_number_of_seconds", "is", "not", "None", "and", "self", ".", "_number_of_seconds", ">=", "0", ":", "self", ".", "_nor...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/fat_date_time.py#L61-L76
log2timeline/dfdatetime
dfdatetime/fat_date_time.py
FATDateTime._GetNumberOfSeconds
def _GetNumberOfSeconds(self, fat_date_time): """Retrieves the number of seconds from a FAT date time. Args: fat_date_time (int): FAT date time. Returns: int: number of seconds since January 1, 1980 00:00:00. Raises: ValueError: if the month, day of month, hours, minutes or seconds ...
python
def _GetNumberOfSeconds(self, fat_date_time): """Retrieves the number of seconds from a FAT date time. Args: fat_date_time (int): FAT date time. Returns: int: number of seconds since January 1, 1980 00:00:00. Raises: ValueError: if the month, day of month, hours, minutes or seconds ...
[ "def", "_GetNumberOfSeconds", "(", "self", ",", "fat_date_time", ")", ":", "day_of_month", "=", "(", "fat_date_time", "&", "0x1f", ")", "month", "=", "(", "(", "fat_date_time", ">>", "5", ")", "&", "0x0f", ")", "year", "=", "(", "fat_date_time", ">>", "9...
Retrieves the number of seconds from a FAT date time. Args: fat_date_time (int): FAT date time. Returns: int: number of seconds since January 1, 1980 00:00:00. Raises: ValueError: if the month, day of month, hours, minutes or seconds value is out of bounds.
[ "Retrieves", "the", "number", "of", "seconds", "from", "a", "FAT", "date", "time", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/fat_date_time.py#L78-L121
RyanBalfanz/django-smsish
smsish/sms/__init__.py
get_sms_connection
def get_sms_connection(backend=None, fail_silently=False, **kwds): """Load an sms backend and return an instance of it. If backend is None (default) settings.SMS_BACKEND is used. Both fail_silently and other keyword arguments are used in the constructor of the backend. https://github.com/django/django/blob/mast...
python
def get_sms_connection(backend=None, fail_silently=False, **kwds): """Load an sms backend and return an instance of it. If backend is None (default) settings.SMS_BACKEND is used. Both fail_silently and other keyword arguments are used in the constructor of the backend. https://github.com/django/django/blob/mast...
[ "def", "get_sms_connection", "(", "backend", "=", "None", ",", "fail_silently", "=", "False", ",", "*", "*", "kwds", ")", ":", "klass", "=", "import_string", "(", "backend", "or", "settings", ".", "SMS_BACKEND", ")", "return", "klass", "(", "fail_silently", ...
Load an sms backend and return an instance of it. If backend is None (default) settings.SMS_BACKEND is used. Both fail_silently and other keyword arguments are used in the constructor of the backend. https://github.com/django/django/blob/master/django/core/mail/__init__.py#L28
[ "Load", "an", "sms", "backend", "and", "return", "an", "instance", "of", "it", "." ]
train
https://github.com/RyanBalfanz/django-smsish/blob/4d450e3d217cea9e373f16c5e4f0beb3218bd5c9/smsish/sms/__init__.py#L20-L31
RyanBalfanz/django-smsish
smsish/sms/__init__.py
send_sms
def send_sms(message, from_number, recipient_list, fail_silently=False, auth_user=None, auth_password=None, connection=None): """ Easy wrapper for sending a single message to a recipient list. All members of the recipient list will see the other recipients in the 'To' field. If auth_user is None, the EMAIL_HOST_US...
python
def send_sms(message, from_number, recipient_list, fail_silently=False, auth_user=None, auth_password=None, connection=None): """ Easy wrapper for sending a single message to a recipient list. All members of the recipient list will see the other recipients in the 'To' field. If auth_user is None, the EMAIL_HOST_US...
[ "def", "send_sms", "(", "message", ",", "from_number", ",", "recipient_list", ",", "fail_silently", "=", "False", ",", "auth_user", "=", "None", ",", "auth_password", "=", "None", ",", "connection", "=", "None", ")", ":", "connection", "=", "connection", "or...
Easy wrapper for sending a single message to a recipient list. All members of the recipient list will see the other recipients in the 'To' field. If auth_user is None, the EMAIL_HOST_USER setting is used. If auth_password is None, the EMAIL_HOST_PASSWORD setting is used. Note: The API for this method is frozen. N...
[ "Easy", "wrapper", "for", "sending", "a", "single", "message", "to", "a", "recipient", "list", ".", "All", "members", "of", "the", "recipient", "list", "will", "see", "the", "other", "recipients", "in", "the", "To", "field", "." ]
train
https://github.com/RyanBalfanz/django-smsish/blob/4d450e3d217cea9e373f16c5e4f0beb3218bd5c9/smsish/sms/__init__.py#L34-L50
RyanBalfanz/django-smsish
smsish/sms/__init__.py
send_mass_sms
def send_mass_sms(datatuple, fail_silently=False, auth_user=None, auth_password=None, connection=None): """ Given a datatuple of (subject, message, from_email, recipient_list), sends each message to each recipient list. Returns the number of emails sent. If from_email is None, the DEFAULT_FROM_EMAIL setting is use...
python
def send_mass_sms(datatuple, fail_silently=False, auth_user=None, auth_password=None, connection=None): """ Given a datatuple of (subject, message, from_email, recipient_list), sends each message to each recipient list. Returns the number of emails sent. If from_email is None, the DEFAULT_FROM_EMAIL setting is use...
[ "def", "send_mass_sms", "(", "datatuple", ",", "fail_silently", "=", "False", ",", "auth_user", "=", "None", ",", "auth_password", "=", "None", ",", "connection", "=", "None", ")", ":", "import", "smsish", ".", "sms", ".", "backends", ".", "rq", "if", "i...
Given a datatuple of (subject, message, from_email, recipient_list), sends each message to each recipient list. Returns the number of emails sent. If from_email is None, the DEFAULT_FROM_EMAIL setting is used. If auth_user and auth_password are set, they're used to log in. If auth_user is None, the EMAIL_HOST_USER...
[ "Given", "a", "datatuple", "of", "(", "subject", "message", "from_email", "recipient_list", ")", "sends", "each", "message", "to", "each", "recipient", "list", ".", "Returns", "the", "number", "of", "emails", "sent", "." ]
train
https://github.com/RyanBalfanz/django-smsish/blob/4d450e3d217cea9e373f16c5e4f0beb3218bd5c9/smsish/sms/__init__.py#L53-L73
log2timeline/dfdatetime
dfdatetime/filetime.py
Filetime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "(", "self", ".", "_timestamp", "is", "not", "None", "and", "self", ".", "_timestamp", ">=", "0", "and", "self", ".", "_timestamp"...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/filetime.py#L53-L69
log2timeline/dfdatetime
dfdatetime/filetime.py
Filetime.CopyToDateTimeString
def CopyToDateTimeString(self): """Copies the FILETIME timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#######" or None if the timestamp is missing or invalid. """ if (self._timestamp is None or self._timestamp < 0 or sel...
python
def CopyToDateTimeString(self): """Copies the FILETIME timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#######" or None if the timestamp is missing or invalid. """ if (self._timestamp is None or self._timestamp < 0 or sel...
[ "def", "CopyToDateTimeString", "(", "self", ")", ":", "if", "(", "self", ".", "_timestamp", "is", "None", "or", "self", ".", "_timestamp", "<", "0", "or", "self", ".", "_timestamp", ">", "self", ".", "_UINT64_MAX", ")", ":", "return", "None", "timestamp"...
Copies the FILETIME timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#######" or None if the timestamp is missing or invalid.
[ "Copies", "the", "FILETIME", "timestamp", "to", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/filetime.py#L109-L127
log2timeline/dfdatetime
dfdatetime/uuid_time.py
UUIDTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp ...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp ...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "(", "self", ".", "_timestamp", "is", "not", "None", "and", "self", ".", "_timestamp", ">=", "0", "and", "self", ".", "_timestamp"...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/uuid_time.py#L58-L74
log2timeline/dfdatetime
dfdatetime/precisions.py
SecondsPrecisionHelper.CopyToDateTimeString
def CopyToDateTimeString(cls, time_elements_tuple, fraction_of_second): """Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. ...
python
def CopyToDateTimeString(cls, time_elements_tuple, fraction_of_second): """Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. ...
[ "def", "CopyToDateTimeString", "(", "cls", ",", "time_elements_tuple", ",", "fraction_of_second", ")", ":", "if", "fraction_of_second", "<", "0.0", "or", "fraction_of_second", ">=", "1.0", ":", "raise", "ValueError", "(", "'Fraction of second value: {0:f} out of bounds.'"...
Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. fraction_of_second (decimal.Decimal): fraction of second, which must be a ...
[ "Copies", "the", "time", "elements", "and", "fraction", "of", "second", "to", "a", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/precisions.py#L78-L101
log2timeline/dfdatetime
dfdatetime/precisions.py
MillisecondsPrecisionHelper.CopyMicrosecondsToFractionOfSecond
def CopyMicrosecondsToFractionOfSecond(cls, microseconds): """Copies the number of microseconds to a fraction of second value. Args: microseconds (int): number of microseconds. Returns: decimal.Decimal: fraction of second, which must be a value between 0.0 and 1.0. Raises: ...
python
def CopyMicrosecondsToFractionOfSecond(cls, microseconds): """Copies the number of microseconds to a fraction of second value. Args: microseconds (int): number of microseconds. Returns: decimal.Decimal: fraction of second, which must be a value between 0.0 and 1.0. Raises: ...
[ "def", "CopyMicrosecondsToFractionOfSecond", "(", "cls", ",", "microseconds", ")", ":", "if", "microseconds", "<", "0", "or", "microseconds", ">=", "definitions", ".", "MICROSECONDS_PER_SECOND", ":", "raise", "ValueError", "(", "'Number of microseconds value: {0:d} out of...
Copies the number of microseconds to a fraction of second value. Args: microseconds (int): number of microseconds. Returns: decimal.Decimal: fraction of second, which must be a value between 0.0 and 1.0. Raises: ValueError: if the number of microseconds is out of bounds.
[ "Copies", "the", "number", "of", "microseconds", "to", "a", "fraction", "of", "second", "value", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/precisions.py#L108-L128
log2timeline/dfdatetime
dfdatetime/precisions.py
MillisecondsPrecisionHelper.CopyToDateTimeString
def CopyToDateTimeString(cls, time_elements_tuple, fraction_of_second): """Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. ...
python
def CopyToDateTimeString(cls, time_elements_tuple, fraction_of_second): """Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. ...
[ "def", "CopyToDateTimeString", "(", "cls", ",", "time_elements_tuple", ",", "fraction_of_second", ")", ":", "if", "fraction_of_second", "<", "0.0", "or", "fraction_of_second", ">=", "1.0", ":", "raise", "ValueError", "(", "'Fraction of second value: {0:f} out of bounds.'"...
Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. fraction_of_second (decimal.Decimal): fraction of second, which must be a ...
[ "Copies", "the", "time", "elements", "and", "fraction", "of", "second", "to", "a", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/precisions.py#L131-L157
log2timeline/dfdatetime
dfdatetime/precisions.py
MicrosecondsPrecisionHelper.CopyMicrosecondsToFractionOfSecond
def CopyMicrosecondsToFractionOfSecond(cls, microseconds): """Copies the number of microseconds to a fraction of second value. Args: microseconds (int): number of microseconds. Returns: decimal.Decimal: fraction of second, which must be a value between 0.0 and 1.0. Raises: ...
python
def CopyMicrosecondsToFractionOfSecond(cls, microseconds): """Copies the number of microseconds to a fraction of second value. Args: microseconds (int): number of microseconds. Returns: decimal.Decimal: fraction of second, which must be a value between 0.0 and 1.0. Raises: ...
[ "def", "CopyMicrosecondsToFractionOfSecond", "(", "cls", ",", "microseconds", ")", ":", "if", "microseconds", "<", "0", "or", "microseconds", ">=", "definitions", ".", "MICROSECONDS_PER_SECOND", ":", "raise", "ValueError", "(", "'Number of microseconds value: {0:d} out of...
Copies the number of microseconds to a fraction of second value. Args: microseconds (int): number of microseconds. Returns: decimal.Decimal: fraction of second, which must be a value between 0.0 and 1.0. Raises: ValueError: if the number of microseconds is out of bounds.
[ "Copies", "the", "number", "of", "microseconds", "to", "a", "fraction", "of", "second", "value", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/precisions.py#L164-L182
log2timeline/dfdatetime
dfdatetime/precisions.py
MicrosecondsPrecisionHelper.CopyToDateTimeString
def CopyToDateTimeString(cls, time_elements_tuple, fraction_of_second): """Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. ...
python
def CopyToDateTimeString(cls, time_elements_tuple, fraction_of_second): """Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. ...
[ "def", "CopyToDateTimeString", "(", "cls", ",", "time_elements_tuple", ",", "fraction_of_second", ")", ":", "if", "fraction_of_second", "<", "0.0", "or", "fraction_of_second", ">=", "1.0", ":", "raise", "ValueError", "(", "'Fraction of second value: {0:f} out of bounds.'"...
Copies the time elements and fraction of second to a string. Args: time_elements_tuple (tuple[int, int, int, int, int, int]): time elements, contains year, month, day of month, hours, minutes and seconds. fraction_of_second (decimal.Decimal): fraction of second, which must be a ...
[ "Copies", "the", "time", "elements", "and", "fraction", "of", "second", "to", "a", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/precisions.py#L185-L211
log2timeline/dfdatetime
dfdatetime/precisions.py
PrecisionHelperFactory.CreatePrecisionHelper
def CreatePrecisionHelper(cls, precision): """Creates a precision helper. Args: precision (str): precision of the date and time value, which should be one of the PRECISION_VALUES in definitions. Returns: class: date time precision helper class. Raises: ValueError: if the p...
python
def CreatePrecisionHelper(cls, precision): """Creates a precision helper. Args: precision (str): precision of the date and time value, which should be one of the PRECISION_VALUES in definitions. Returns: class: date time precision helper class. Raises: ValueError: if the p...
[ "def", "CreatePrecisionHelper", "(", "cls", ",", "precision", ")", ":", "precision_helper_class", "=", "cls", ".", "_PRECISION_CLASSES", ".", "get", "(", "precision", ",", "None", ")", "if", "not", "precision_helper_class", ":", "raise", "ValueError", "(", "'Uns...
Creates a precision helper. Args: precision (str): precision of the date and time value, which should be one of the PRECISION_VALUES in definitions. Returns: class: date time precision helper class. Raises: ValueError: if the precision value is unsupported.
[ "Creates", "a", "precision", "helper", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/precisions.py#L224-L241
log2timeline/dfdatetime
dfdatetime/apfs_time.py
APFSTime.CopyFromDateTimeString
def CopyFromDateTimeString(self, time_string): """Copies a APFS timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can ...
python
def CopyFromDateTimeString(self, time_string): """Copies a APFS timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can ...
[ "def", "CopyFromDateTimeString", "(", "self", ",", "time_string", ")", ":", "super", "(", "APFSTime", ",", "self", ")", ".", "_CopyFromDateTimeString", "(", "time_string", ")", "if", "(", "self", ".", "_timestamp", "is", "None", "or", "self", ".", "_timestam...
Copies a APFS timestamp from a date and time string. Args: time_string (str): date and time value formatted as: YYYY-MM-DD hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The time of day, seconds ...
[ "Copies", "a", "APFS", "timestamp", "from", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/apfs_time.py#L40-L59
log2timeline/dfdatetime
dfdatetime/apfs_time.py
APFSTime.CopyToDateTimeString
def CopyToDateTimeString(self): """Copies the APFS timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#########" or None if the timestamp is missing or invalid. """ if (self._timestamp is None or self._timestamp < self._INT64_MIN or...
python
def CopyToDateTimeString(self): """Copies the APFS timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#########" or None if the timestamp is missing or invalid. """ if (self._timestamp is None or self._timestamp < self._INT64_MIN or...
[ "def", "CopyToDateTimeString", "(", "self", ")", ":", "if", "(", "self", ".", "_timestamp", "is", "None", "or", "self", ".", "_timestamp", "<", "self", ".", "_INT64_MIN", "or", "self", ".", "_timestamp", ">", "self", ".", "_INT64_MAX", ")", ":", "return"...
Copies the APFS timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.#########" or None if the timestamp is missing or invalid.
[ "Copies", "the", "APFS", "timestamp", "to", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/apfs_time.py#L61-L72
log2timeline/dfdatetime
dfdatetime/cocoa_time.py
CocoaTime.CopyToDateTimeString
def CopyToDateTimeString(self): """Copies the Cocoa timestamp to a date and time string. Returns: str: date and time value formatted as: YYYY-MM-DD hh:mm:ss.###### or None if the timestamp cannot be copied to a date and time string. """ if self._timestamp is None: return None ...
python
def CopyToDateTimeString(self): """Copies the Cocoa timestamp to a date and time string. Returns: str: date and time value formatted as: YYYY-MM-DD hh:mm:ss.###### or None if the timestamp cannot be copied to a date and time string. """ if self._timestamp is None: return None ...
[ "def", "CopyToDateTimeString", "(", "self", ")", ":", "if", "self", ".", "_timestamp", "is", "None", ":", "return", "None", "number_of_days", ",", "hours", ",", "minutes", ",", "seconds", "=", "self", ".", "_GetTimeValues", "(", "int", "(", "self", ".", ...
Copies the Cocoa timestamp to a date and time string. Returns: str: date and time value formatted as: YYYY-MM-DD hh:mm:ss.###### or None if the timestamp cannot be copied to a date and time string.
[ "Copies", "the", "Cocoa", "timestamp", "to", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/cocoa_time.py#L106-L126
RyanBalfanz/django-smsish
smsish/sms/backends/rq.py
send_sms_message
def send_sms_message(sms_message, backend=None, fail_silently=False): """ Send an SMSMessage instance using a connection given by the specified `backend`. """ with get_sms_connection(backend=backend, fail_silently=fail_silently) as connection: result = connection.send_messages([sms_message]) return result
python
def send_sms_message(sms_message, backend=None, fail_silently=False): """ Send an SMSMessage instance using a connection given by the specified `backend`. """ with get_sms_connection(backend=backend, fail_silently=fail_silently) as connection: result = connection.send_messages([sms_message]) return result
[ "def", "send_sms_message", "(", "sms_message", ",", "backend", "=", "None", ",", "fail_silently", "=", "False", ")", ":", "with", "get_sms_connection", "(", "backend", "=", "backend", ",", "fail_silently", "=", "fail_silently", ")", "as", "connection", ":", "r...
Send an SMSMessage instance using a connection given by the specified `backend`.
[ "Send", "an", "SMSMessage", "instance", "using", "a", "connection", "given", "by", "the", "specified", "backend", "." ]
train
https://github.com/RyanBalfanz/django-smsish/blob/4d450e3d217cea9e373f16c5e4f0beb3218bd5c9/smsish/sms/backends/rq.py#L45-L51
RyanBalfanz/django-smsish
smsish/sms/backends/rq.py
SMSBackend.send_messages
def send_messages(self, sms_messages): """ Receives a list of SMSMessage instances and returns a list of RQ `Job` instances. """ results = [] for message in sms_messages: try: assert message.connection is None except AssertionError: if not self.fail_silently: raise backend = self.backend...
python
def send_messages(self, sms_messages): """ Receives a list of SMSMessage instances and returns a list of RQ `Job` instances. """ results = [] for message in sms_messages: try: assert message.connection is None except AssertionError: if not self.fail_silently: raise backend = self.backend...
[ "def", "send_messages", "(", "self", ",", "sms_messages", ")", ":", "results", "=", "[", "]", "for", "message", "in", "sms_messages", ":", "try", ":", "assert", "message", ".", "connection", "is", "None", "except", "AssertionError", ":", "if", "not", "self...
Receives a list of SMSMessage instances and returns a list of RQ `Job` instances.
[ "Receives", "a", "list", "of", "SMSMessage", "instances", "and", "returns", "a", "list", "of", "RQ", "Job", "instances", "." ]
train
https://github.com/RyanBalfanz/django-smsish/blob/4d450e3d217cea9e373f16c5e4f0beb3218bd5c9/smsish/sms/backends/rq.py#L24-L39
log2timeline/dfdatetime
dfdatetime/java_time.py
JavaTime._GetNormalizedTimestamp
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
python
def _GetNormalizedTimestamp(self): """Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cann...
[ "def", "_GetNormalizedTimestamp", "(", "self", ")", ":", "if", "self", ".", "_normalized_timestamp", "is", "None", ":", "if", "(", "self", ".", "_timestamp", "is", "not", "None", "and", "self", ".", "_timestamp", ">=", "self", ".", "_INT64_MIN", "and", "se...
Retrieves the normalized timestamp. Returns: decimal.Decimal: normalized timestamp, which contains the number of seconds since January 1, 1970 00:00:00 and a fraction of second used for increased precision, or None if the normalized timestamp cannot be determined.
[ "Retrieves", "the", "normalized", "timestamp", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/java_time.py#L26-L42
log2timeline/dfdatetime
dfdatetime/java_time.py
JavaTime.CopyToDateTimeString
def CopyToDateTimeString(self): """Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######" or None if the timestamp is missing. """ if (self._timestamp is None or self._timestamp < self._INT64_MIN or self...
python
def CopyToDateTimeString(self): """Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######" or None if the timestamp is missing. """ if (self._timestamp is None or self._timestamp < self._INT64_MIN or self...
[ "def", "CopyToDateTimeString", "(", "self", ")", ":", "if", "(", "self", ".", "_timestamp", "is", "None", "or", "self", ".", "_timestamp", "<", "self", ".", "_INT64_MIN", "or", "self", ".", "_timestamp", ">", "self", ".", "_INT64_MAX", ")", ":", "return"...
Copies the POSIX timestamp to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss.######" or None if the timestamp is missing.
[ "Copies", "the", "POSIX", "timestamp", "to", "a", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/java_time.py#L44-L55
springload/wagtaildraftail
wagtaildraftail/decorators.py
Image
def Image(props): """ Inspired by: - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/rich_text.py - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/shortcuts.py - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/formats.py """ ...
python
def Image(props): """ Inspired by: - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/rich_text.py - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/shortcuts.py - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/formats.py """ ...
[ "def", "Image", "(", "props", ")", ":", "image_model", "=", "get_image_model", "(", ")", "alignment", "=", "props", ".", "get", "(", "'alignment'", ",", "'left'", ")", "alt_text", "=", "props", ".", "get", "(", "'altText'", ",", "''", ")", "try", ":", ...
Inspired by: - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/rich_text.py - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/shortcuts.py - https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailimages/formats.py
[ "Inspired", "by", ":", "-", "https", ":", "//", "github", ".", "com", "/", "torchbox", "/", "wagtail", "/", "blob", "/", "master", "/", "wagtail", "/", "wagtailimages", "/", "rich_text", ".", "py", "-", "https", ":", "//", "github", ".", "com", "/", ...
train
https://github.com/springload/wagtaildraftail/blob/87f1ae3ade493c00daff021394051aa656136c10/wagtaildraftail/decorators.py#L53-L76
log2timeline/dfdatetime
dfdatetime/time_elements.py
TimeElements._CopyDateTimeFromStringISO8601
def _CopyDateTimeFromStringISO8601(self, time_string): """Copies a date and time from an ISO 8601 date and time string. Args: time_string (str): time value formatted as: hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be ...
python
def _CopyDateTimeFromStringISO8601(self, time_string): """Copies a date and time from an ISO 8601 date and time string. Args: time_string (str): time value formatted as: hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be ...
[ "def", "_CopyDateTimeFromStringISO8601", "(", "self", ",", "time_string", ")", ":", "if", "not", "time_string", ":", "raise", "ValueError", "(", "'Invalid time string.'", ")", "time_string_length", "=", "len", "(", "time_string", ")", "year", ",", "month", ",", ...
Copies a date and time from an ISO 8601 date and time string. Args: time_string (str): time value formatted as: hh:mm:ss.######[+-]##:## Where # are numeric digits ranging from 0 to 9 and the seconds fraction can be either 3 or 6 digits. The fraction of second and tim...
[ "Copies", "a", "date", "and", "time", "from", "an", "ISO", "8601", "date", "and", "time", "string", "." ]
train
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/time_elements.py#L63-L117