id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
227,300
nabla-c0d3/sslyze
sslyze/plugins/plugins_repository.py
PluginsRepository.get_plugin_class_for_command
def get_plugin_class_for_command(self, scan_command: PluginScanCommand) -> Type[Plugin]: """Get the class of the plugin implementing the supplied scan command. """ return self._scan_command_classes_to_plugin_classes[scan_command.__class__]
python
def get_plugin_class_for_command(self, scan_command: PluginScanCommand) -> Type[Plugin]: """Get the class of the plugin implementing the supplied scan command. """ return self._scan_command_classes_to_plugin_classes[scan_command.__class__]
[ "def", "get_plugin_class_for_command", "(", "self", ",", "scan_command", ":", "PluginScanCommand", ")", "->", "Type", "[", "Plugin", "]", ":", "return", "self", ".", "_scan_command_classes_to_plugin_classes", "[", "scan_command", ".", "__class__", "]" ]
Get the class of the plugin implementing the supplied scan command.
[ "Get", "the", "class", "of", "the", "plugin", "implementing", "the", "supplied", "scan", "command", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/plugins_repository.py#L44-L47
227,301
nabla-c0d3/sslyze
sslyze/utils/http_response_parser.py
HttpResponseParser._parse
def _parse(read_method: Callable) -> HTTPResponse: """Trick to standardize the API between sockets and SSLConnection objects. """ response = read_method(4096) while b'HTTP/' not in response or b'\r\n\r\n' not in response: # Parse until the end of the headers respo...
python
def _parse(read_method: Callable) -> HTTPResponse: """Trick to standardize the API between sockets and SSLConnection objects. """ response = read_method(4096) while b'HTTP/' not in response or b'\r\n\r\n' not in response: # Parse until the end of the headers respo...
[ "def", "_parse", "(", "read_method", ":", "Callable", ")", "->", "HTTPResponse", ":", "response", "=", "read_method", "(", "4096", ")", "while", "b'HTTP/'", "not", "in", "response", "or", "b'\\r\\n\\r\\n'", "not", "in", "response", ":", "# Parse until the end of...
Trick to standardize the API between sockets and SSLConnection objects.
[ "Trick", "to", "standardize", "the", "API", "between", "sockets", "and", "SSLConnection", "objects", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/utils/http_response_parser.py#L26-L37
227,302
nabla-c0d3/sslyze
sslyze/utils/thread_pool.py
_work_function
def _work_function(job_q: Queue, result_q: Queue, error_q: Queue) -> None: """Work function expected to run within threads. """ while True: job = job_q.get() if isinstance(job, _ThreadPoolSentinel): # All the work is done, get out result_q.put(_ThreadPoolSentinel()) ...
python
def _work_function(job_q: Queue, result_q: Queue, error_q: Queue) -> None: """Work function expected to run within threads. """ while True: job = job_q.get() if isinstance(job, _ThreadPoolSentinel): # All the work is done, get out result_q.put(_ThreadPoolSentinel()) ...
[ "def", "_work_function", "(", "job_q", ":", "Queue", ",", "result_q", ":", "Queue", ",", "error_q", ":", "Queue", ")", "->", "None", ":", "while", "True", ":", "job", "=", "job_q", ".", "get", "(", ")", "if", "isinstance", "(", "job", ",", "_ThreadPo...
Work function expected to run within threads.
[ "Work", "function", "expected", "to", "run", "within", "threads", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/utils/thread_pool.py#L93-L115
227,303
nabla-c0d3/sslyze
sslyze/plugins/session_resumption_plugin.py
SessionResumptionPlugin._resume_with_session_id
def _resume_with_session_id( self, server_info: ServerConnectivityInfo, ssl_version_to_use: OpenSslVersionEnum ) -> bool: """Perform one session resumption using Session IDs. """ session1 = self._resume_ssl_session(server_info, ssl_version_to_use) ...
python
def _resume_with_session_id( self, server_info: ServerConnectivityInfo, ssl_version_to_use: OpenSslVersionEnum ) -> bool: """Perform one session resumption using Session IDs. """ session1 = self._resume_ssl_session(server_info, ssl_version_to_use) ...
[ "def", "_resume_with_session_id", "(", "self", ",", "server_info", ":", "ServerConnectivityInfo", ",", "ssl_version_to_use", ":", "OpenSslVersionEnum", ")", "->", "bool", ":", "session1", "=", "self", ".", "_resume_ssl_session", "(", "server_info", ",", "ssl_version_t...
Perform one session resumption using Session IDs.
[ "Perform", "one", "session", "resumption", "using", "Session", "IDs", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/session_resumption_plugin.py#L151-L184
227,304
nabla-c0d3/sslyze
sslyze/plugins/session_resumption_plugin.py
SessionResumptionPlugin._resume_with_session_ticket
def _resume_with_session_ticket( self, server_info: ServerConnectivityInfo, ssl_version_to_use: OpenSslVersionEnum, ) -> TslSessionTicketSupportEnum: """Perform one session resumption using TLS Session Tickets. """ # Connect to the server and keep the SSL ...
python
def _resume_with_session_ticket( self, server_info: ServerConnectivityInfo, ssl_version_to_use: OpenSslVersionEnum, ) -> TslSessionTicketSupportEnum: """Perform one session resumption using TLS Session Tickets. """ # Connect to the server and keep the SSL ...
[ "def", "_resume_with_session_ticket", "(", "self", ",", "server_info", ":", "ServerConnectivityInfo", ",", "ssl_version_to_use", ":", "OpenSslVersionEnum", ",", ")", "->", "TslSessionTicketSupportEnum", ":", "# Connect to the server and keep the SSL session", "try", ":", "ses...
Perform one session resumption using TLS Session Tickets.
[ "Perform", "one", "session", "resumption", "using", "TLS", "Session", "Tickets", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/session_resumption_plugin.py#L186-L220
227,305
nabla-c0d3/sslyze
sslyze/plugins/session_resumption_plugin.py
SessionResumptionPlugin._extract_session_id
def _extract_session_id(ssl_session: nassl._nassl.SSL_SESSION) -> str: """Extract the SSL session ID from a SSL session object or raises IndexError if the session ID was not set. """ session_string = ((ssl_session.as_text()).split('Session-ID:'))[1] session_id = (session_string.split('Se...
python
def _extract_session_id(ssl_session: nassl._nassl.SSL_SESSION) -> str: """Extract the SSL session ID from a SSL session object or raises IndexError if the session ID was not set. """ session_string = ((ssl_session.as_text()).split('Session-ID:'))[1] session_id = (session_string.split('Se...
[ "def", "_extract_session_id", "(", "ssl_session", ":", "nassl", ".", "_nassl", ".", "SSL_SESSION", ")", "->", "str", ":", "session_string", "=", "(", "(", "ssl_session", ".", "as_text", "(", ")", ")", ".", "split", "(", "'Session-ID:'", ")", ")", "[", "1...
Extract the SSL session ID from a SSL session object or raises IndexError if the session ID was not set.
[ "Extract", "the", "SSL", "session", "ID", "from", "a", "SSL", "session", "object", "or", "raises", "IndexError", "if", "the", "session", "ID", "was", "not", "set", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/session_resumption_plugin.py#L223-L228
227,306
nabla-c0d3/sslyze
sslyze/plugins/session_resumption_plugin.py
SessionResumptionPlugin._extract_tls_session_ticket
def _extract_tls_session_ticket(ssl_session: nassl._nassl.SSL_SESSION) -> str: """Extract the TLS session ticket from a SSL session object or raises IndexError if the ticket was not set. """ session_string = ((ssl_session.as_text()).split('TLS session ticket:'))[1] session_tls_ticket = (...
python
def _extract_tls_session_ticket(ssl_session: nassl._nassl.SSL_SESSION) -> str: """Extract the TLS session ticket from a SSL session object or raises IndexError if the ticket was not set. """ session_string = ((ssl_session.as_text()).split('TLS session ticket:'))[1] session_tls_ticket = (...
[ "def", "_extract_tls_session_ticket", "(", "ssl_session", ":", "nassl", ".", "_nassl", ".", "SSL_SESSION", ")", "->", "str", ":", "session_string", "=", "(", "(", "ssl_session", ".", "as_text", "(", ")", ")", ".", "split", "(", "'TLS session ticket:'", ")", ...
Extract the TLS session ticket from a SSL session object or raises IndexError if the ticket was not set.
[ "Extract", "the", "TLS", "session", "ticket", "from", "a", "SSL", "session", "object", "or", "raises", "IndexError", "if", "the", "ticket", "was", "not", "set", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/session_resumption_plugin.py#L231-L236
227,307
nabla-c0d3/sslyze
sslyze/plugins/session_resumption_plugin.py
SessionResumptionPlugin._resume_ssl_session
def _resume_ssl_session( server_info: ServerConnectivityInfo, ssl_version_to_use: OpenSslVersionEnum, ssl_session: Optional[nassl._nassl.SSL_SESSION] = None, should_enable_tls_ticket: bool = False ) -> nassl._nassl.SSL_SESSION: """Connect to the server and ret...
python
def _resume_ssl_session( server_info: ServerConnectivityInfo, ssl_version_to_use: OpenSslVersionEnum, ssl_session: Optional[nassl._nassl.SSL_SESSION] = None, should_enable_tls_ticket: bool = False ) -> nassl._nassl.SSL_SESSION: """Connect to the server and ret...
[ "def", "_resume_ssl_session", "(", "server_info", ":", "ServerConnectivityInfo", ",", "ssl_version_to_use", ":", "OpenSslVersionEnum", ",", "ssl_session", ":", "Optional", "[", "nassl", ".", "_nassl", ".", "SSL_SESSION", "]", "=", "None", ",", "should_enable_tls_ticke...
Connect to the server and returns the session object that was assigned for that connection. If ssl_session is given, tries to resume that session.
[ "Connect", "to", "the", "server", "and", "returns", "the", "session", "object", "that", "was", "assigned", "for", "that", "connection", ".", "If", "ssl_session", "is", "given", "tries", "to", "resume", "that", "session", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/session_resumption_plugin.py#L239-L265
227,308
nabla-c0d3/sslyze
sslyze/cli/json_output.py
_object_to_json_dict
def _object_to_json_dict(obj: Any) -> Union[bool, int, float, str, Dict[str, Any]]: """Convert an object to a dictionary suitable for the JSON output. """ if isinstance(obj, Enum): # Properly serialize Enums (such as OpenSslVersionEnum) result = obj.name elif isinstance(obj, ObjectIdent...
python
def _object_to_json_dict(obj: Any) -> Union[bool, int, float, str, Dict[str, Any]]: """Convert an object to a dictionary suitable for the JSON output. """ if isinstance(obj, Enum): # Properly serialize Enums (such as OpenSslVersionEnum) result = obj.name elif isinstance(obj, ObjectIdent...
[ "def", "_object_to_json_dict", "(", "obj", ":", "Any", ")", "->", "Union", "[", "bool", ",", "int", ",", "float", ",", "str", ",", "Dict", "[", "str", ",", "Any", "]", "]", ":", "if", "isinstance", "(", "obj", ",", "Enum", ")", ":", "# Properly ser...
Convert an object to a dictionary suitable for the JSON output.
[ "Convert", "an", "object", "to", "a", "dictionary", "suitable", "for", "the", "JSON", "output", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/cli/json_output.py#L84-L145
227,309
nabla-c0d3/sslyze
sslyze/plugins/certificate_info_plugin.py
CertificateInfoPlugin._get_and_verify_certificate_chain
def _get_and_verify_certificate_chain( server_info: ServerConnectivityInfo, trust_store: TrustStore ) -> Tuple[List[Certificate], str, Optional[OcspResponse]]: """Connects to the target server and uses the supplied trust store to validate the server's certificate. Returns the...
python
def _get_and_verify_certificate_chain( server_info: ServerConnectivityInfo, trust_store: TrustStore ) -> Tuple[List[Certificate], str, Optional[OcspResponse]]: """Connects to the target server and uses the supplied trust store to validate the server's certificate. Returns the...
[ "def", "_get_and_verify_certificate_chain", "(", "server_info", ":", "ServerConnectivityInfo", ",", "trust_store", ":", "TrustStore", ")", "->", "Tuple", "[", "List", "[", "Certificate", "]", ",", "str", ",", "Optional", "[", "OcspResponse", "]", "]", ":", "ssl_...
Connects to the target server and uses the supplied trust store to validate the server's certificate. Returns the server's certificate and OCSP response.
[ "Connects", "to", "the", "target", "server", "and", "uses", "the", "supplied", "trust", "store", "to", "validate", "the", "server", "s", "certificate", ".", "Returns", "the", "server", "s", "certificate", "and", "OCSP", "response", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/certificate_info_plugin.py#L171-L202
227,310
nabla-c0d3/sslyze
sslyze/plugins/plugin_base.py
PluginScanCommand.get_description
def get_description(cls) -> str: """The description is expected to be the command class' docstring. """ if cls.__doc__ is None: raise ValueError('No docstring found for {}'.format(cls.__name__)) return cls.__doc__.strip()
python
def get_description(cls) -> str: """The description is expected to be the command class' docstring. """ if cls.__doc__ is None: raise ValueError('No docstring found for {}'.format(cls.__name__)) return cls.__doc__.strip()
[ "def", "get_description", "(", "cls", ")", "->", "str", ":", "if", "cls", ".", "__doc__", "is", "None", ":", "raise", "ValueError", "(", "'No docstring found for {}'", ".", "format", "(", "cls", ".", "__name__", ")", ")", "return", "cls", ".", "__doc__", ...
The description is expected to be the command class' docstring.
[ "The", "description", "is", "expected", "to", "be", "the", "command", "class", "docstring", "." ]
0fb3ae668453d7ecf616d0755f237ca7be9f62fa
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/plugin_base.py#L30-L35
227,311
kennethreitz/inbox.py
inbox.py
Inbox.serve
def serve(self, port=None, address=None): """Serves the SMTP server on the given port and address.""" port = port or self.port address = address or self.address log.info('Starting SMTP server at {0}:{1}'.format(address, port)) server = InboxServer(self.collator, (address, port)...
python
def serve(self, port=None, address=None): """Serves the SMTP server on the given port and address.""" port = port or self.port address = address or self.address log.info('Starting SMTP server at {0}:{1}'.format(address, port)) server = InboxServer(self.collator, (address, port)...
[ "def", "serve", "(", "self", ",", "port", "=", "None", ",", "address", "=", "None", ")", ":", "port", "=", "port", "or", "self", ".", "port", "address", "=", "address", "or", "self", ".", "address", "log", ".", "info", "(", "'Starting SMTP server at {0...
Serves the SMTP server on the given port and address.
[ "Serves", "the", "SMTP", "server", "on", "the", "given", "port", "and", "address", "." ]
493f8d9834a41ac9012f13da5693697efdcb1826
https://github.com/kennethreitz/inbox.py/blob/493f8d9834a41ac9012f13da5693697efdcb1826/inbox.py#L41-L53
227,312
kennethreitz/inbox.py
inbox.py
Inbox.dispatch
def dispatch(self): """Command-line dispatch.""" parser = argparse.ArgumentParser(description='Run an Inbox server.') parser.add_argument('addr', metavar='addr', type=str, help='addr to bind to') parser.add_argument('port', metavar='port', type=int, help='port to bind to') args...
python
def dispatch(self): """Command-line dispatch.""" parser = argparse.ArgumentParser(description='Run an Inbox server.') parser.add_argument('addr', metavar='addr', type=str, help='addr to bind to') parser.add_argument('port', metavar='port', type=int, help='port to bind to') args...
[ "def", "dispatch", "(", "self", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Run an Inbox server.'", ")", "parser", ".", "add_argument", "(", "'addr'", ",", "metavar", "=", "'addr'", ",", "type", "=", "str", ",", "...
Command-line dispatch.
[ "Command", "-", "line", "dispatch", "." ]
493f8d9834a41ac9012f13da5693697efdcb1826
https://github.com/kennethreitz/inbox.py/blob/493f8d9834a41ac9012f13da5693697efdcb1826/inbox.py#L55-L64
227,313
securestate/termineter
lib/c1219/data.py
format_ltime
def format_ltime(endianess, tm_format, data): """ Return data formatted into a human readable time stamp. :param str endianess: The endianess to use when packing values ('>' or '<') :param int tm_format: The format that the data is packed in, this typically corresponds with the value in the GEN_CONFIG_TBL (tabl...
python
def format_ltime(endianess, tm_format, data): """ Return data formatted into a human readable time stamp. :param str endianess: The endianess to use when packing values ('>' or '<') :param int tm_format: The format that the data is packed in, this typically corresponds with the value in the GEN_CONFIG_TBL (tabl...
[ "def", "format_ltime", "(", "endianess", ",", "tm_format", ",", "data", ")", ":", "if", "tm_format", "==", "0", ":", "return", "''", "elif", "tm_format", "==", "1", "or", "tm_format", "==", "2", ":", "# I can't find solid documentation on the BCD data-type", "y"...
Return data formatted into a human readable time stamp. :param str endianess: The endianess to use when packing values ('>' or '<') :param int tm_format: The format that the data is packed in, this typically corresponds with the value in the GEN_CONFIG_TBL (table #0) (1 <= tm_format <= 4) :param bytes data: The ...
[ "Return", "data", "formatted", "into", "a", "human", "readable", "time", "stamp", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1219/data.py#L40-L80
227,314
securestate/termineter
lib/c1219/data.py
get_history_entry_record
def get_history_entry_record(endianess, hist_date_time_flag, tm_format, event_number_flag, hist_seq_nbr_flag, data): """ Return data formatted into a log entry. :param str endianess: The endianess to use when packing values ('>' or '<') :param bool hist_date_time_flag: Whether or not a time stamp is included. :pa...
python
def get_history_entry_record(endianess, hist_date_time_flag, tm_format, event_number_flag, hist_seq_nbr_flag, data): """ Return data formatted into a log entry. :param str endianess: The endianess to use when packing values ('>' or '<') :param bool hist_date_time_flag: Whether or not a time stamp is included. :pa...
[ "def", "get_history_entry_record", "(", "endianess", ",", "hist_date_time_flag", ",", "tm_format", ",", "event_number_flag", ",", "hist_seq_nbr_flag", ",", "data", ")", ":", "rcd", "=", "{", "}", "if", "hist_date_time_flag", ":", "tmstmp", "=", "format_ltime", "("...
Return data formatted into a log entry. :param str endianess: The endianess to use when packing values ('>' or '<') :param bool hist_date_time_flag: Whether or not a time stamp is included. :param int tm_format: The format that the data is packed in, this typically corresponds with the value in the GEN_CONFIG_TB...
[ "Return", "data", "formatted", "into", "a", "log", "entry", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1219/data.py#L82-L111
227,315
securestate/termineter
lib/c1219/data.py
get_table_idbb_field
def get_table_idbb_field(endianess, data): """ Return data from a packed TABLE_IDB_BFLD bit-field. :param str endianess: The endianess to use when packing values ('>' or '<') :param str data: The packed and machine-formatted data to parse :rtype: tuple :return: Tuple of (proc_nbr, std_vs_mfg) """ bfld = struct...
python
def get_table_idbb_field(endianess, data): """ Return data from a packed TABLE_IDB_BFLD bit-field. :param str endianess: The endianess to use when packing values ('>' or '<') :param str data: The packed and machine-formatted data to parse :rtype: tuple :return: Tuple of (proc_nbr, std_vs_mfg) """ bfld = struct...
[ "def", "get_table_idbb_field", "(", "endianess", ",", "data", ")", ":", "bfld", "=", "struct", ".", "unpack", "(", "endianess", "+", "'H'", ",", "data", "[", ":", "2", "]", ")", "[", "0", "]", "proc_nbr", "=", "bfld", "&", "0x7ff", "std_vs_mfg", "=",...
Return data from a packed TABLE_IDB_BFLD bit-field. :param str endianess: The endianess to use when packing values ('>' or '<') :param str data: The packed and machine-formatted data to parse :rtype: tuple :return: Tuple of (proc_nbr, std_vs_mfg)
[ "Return", "data", "from", "a", "packed", "TABLE_IDB_BFLD", "bit", "-", "field", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1219/data.py#L113-L126
227,316
securestate/termineter
lib/c1219/data.py
get_table_idcb_field
def get_table_idcb_field(endianess, data): """ Return data from a packed TABLE_IDC_BFLD bit-field. :param str endianess: The endianess to use when packing values ('>' or '<') :param str data: The packed and machine-formatted data to parse :rtype: tuple :return: Tuple of (proc_nbr, std_vs_mfg, proc_flag, flag1, f...
python
def get_table_idcb_field(endianess, data): """ Return data from a packed TABLE_IDC_BFLD bit-field. :param str endianess: The endianess to use when packing values ('>' or '<') :param str data: The packed and machine-formatted data to parse :rtype: tuple :return: Tuple of (proc_nbr, std_vs_mfg, proc_flag, flag1, f...
[ "def", "get_table_idcb_field", "(", "endianess", ",", "data", ")", ":", "bfld", "=", "struct", ".", "unpack", "(", "endianess", "+", "'H'", ",", "data", "[", ":", "2", "]", ")", "[", "0", "]", "proc_nbr", "=", "bfld", "&", "2047", "std_vs_mfg", "=", ...
Return data from a packed TABLE_IDC_BFLD bit-field. :param str endianess: The endianess to use when packing values ('>' or '<') :param str data: The packed and machine-formatted data to parse :rtype: tuple :return: Tuple of (proc_nbr, std_vs_mfg, proc_flag, flag1, flag2, flag3)
[ "Return", "data", "from", "a", "packed", "TABLE_IDC_BFLD", "bit", "-", "field", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1219/data.py#L128-L144
227,317
securestate/termineter
lib/termineter/utilities.py
unique
def unique(seq, idfunc=None): """ Unique a list or tuple and preserve the order @type idfunc: Function or None @param idfunc: If idfunc is provided it will be called during the comparison process. """ if idfunc is None: idfunc = lambda x: x preserved_type = type(seq) seen = {} result = [] for item in seq:...
python
def unique(seq, idfunc=None): """ Unique a list or tuple and preserve the order @type idfunc: Function or None @param idfunc: If idfunc is provided it will be called during the comparison process. """ if idfunc is None: idfunc = lambda x: x preserved_type = type(seq) seen = {} result = [] for item in seq:...
[ "def", "unique", "(", "seq", ",", "idfunc", "=", "None", ")", ":", "if", "idfunc", "is", "None", ":", "idfunc", "=", "lambda", "x", ":", "x", "preserved_type", "=", "type", "(", "seq", ")", "seen", "=", "{", "}", "result", "=", "[", "]", "for", ...
Unique a list or tuple and preserve the order @type idfunc: Function or None @param idfunc: If idfunc is provided it will be called during the comparison process.
[ "Unique", "a", "list", "or", "tuple", "and", "preserve", "the", "order" ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/utilities.py#L63-L82
227,318
securestate/termineter
lib/termineter/interface.py
InteractiveInterpreter.do_ipy
def do_ipy(self, args): """Start an interactive Python interpreter""" import c1218.data import c1219.data from c1219.access.general import C1219GeneralAccess from c1219.access.security import C1219SecurityAccess from c1219.access.log import C1219LogAccess from c1219.access.telephone import C1219TelephoneA...
python
def do_ipy(self, args): """Start an interactive Python interpreter""" import c1218.data import c1219.data from c1219.access.general import C1219GeneralAccess from c1219.access.security import C1219SecurityAccess from c1219.access.log import C1219LogAccess from c1219.access.telephone import C1219TelephoneA...
[ "def", "do_ipy", "(", "self", ",", "args", ")", ":", "import", "c1218", ".", "data", "import", "c1219", ".", "data", "from", "c1219", ".", "access", ".", "general", "import", "C1219GeneralAccess", "from", "c1219", ".", "access", ".", "security", "import", ...
Start an interactive Python interpreter
[ "Start", "an", "interactive", "Python", "interpreter" ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/interface.py#L308-L355
227,319
securestate/termineter
lib/termineter/interface.py
InteractiveInterpreter.do_reload
def do_reload(self, args): """Reload a module in to the framework""" if args.module is not None: if args.module not in self.frmwk.modules: self.print_error('Invalid Module Selected.') return module = self.frmwk.modules[args.module] elif self.frmwk.current_module: module = self.frmwk.current_modul...
python
def do_reload(self, args): """Reload a module in to the framework""" if args.module is not None: if args.module not in self.frmwk.modules: self.print_error('Invalid Module Selected.') return module = self.frmwk.modules[args.module] elif self.frmwk.current_module: module = self.frmwk.current_modul...
[ "def", "do_reload", "(", "self", ",", "args", ")", ":", "if", "args", ".", "module", "is", "not", "None", ":", "if", "args", ".", "module", "not", "in", "self", ".", "frmwk", ".", "modules", ":", "self", ".", "print_error", "(", "'Invalid Module Select...
Reload a module in to the framework
[ "Reload", "a", "module", "in", "to", "the", "framework" ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/interface.py#L428-L440
227,320
securestate/termineter
lib/c1218/connection.py
ConnectionBase.send
def send(self, data): """ This sends a raw C12.18 frame and waits checks for an ACK response. In the event that a NACK is received, this function will attempt to resend the frame up to 3 times. :param data: the data to be transmitted :type data: str, :py:class:`~c1218.data.C1218Packet` """ if not isins...
python
def send(self, data): """ This sends a raw C12.18 frame and waits checks for an ACK response. In the event that a NACK is received, this function will attempt to resend the frame up to 3 times. :param data: the data to be transmitted :type data: str, :py:class:`~c1218.data.C1218Packet` """ if not isins...
[ "def", "send", "(", "self", ",", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "C1218Packet", ")", ":", "data", "=", "C1218Packet", "(", "data", ")", "if", "self", ".", "toggle_control", ":", "# bit wise, fuck yeah", "if", "self", ".", ...
This sends a raw C12.18 frame and waits checks for an ACK response. In the event that a NACK is received, this function will attempt to resend the frame up to 3 times. :param data: the data to be transmitted :type data: str, :py:class:`~c1218.data.C1218Packet`
[ "This", "sends", "a", "raw", "C12", ".", "18", "frame", "and", "waits", "checks", "for", "an", "ACK", "response", ".", "In", "the", "event", "that", "a", "NACK", "is", "received", "this", "function", "will", "attempt", "to", "resend", "the", "frame", "...
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L120-L157
227,321
securestate/termineter
lib/c1218/connection.py
ConnectionBase.recv
def recv(self, full_frame=False): """ Receive a C1218Packet, the payload data is returned. :param bool full_frame: If set to True, the entire C1218 frame is returned instead of just the payload. """ payloadbuffer = b'' tries = 3 while tries: tmpbuffer = self.serial_h.read(1) if tmpbuffer != b'\...
python
def recv(self, full_frame=False): """ Receive a C1218Packet, the payload data is returned. :param bool full_frame: If set to True, the entire C1218 frame is returned instead of just the payload. """ payloadbuffer = b'' tries = 3 while tries: tmpbuffer = self.serial_h.read(1) if tmpbuffer != b'\...
[ "def", "recv", "(", "self", ",", "full_frame", "=", "False", ")", ":", "payloadbuffer", "=", "b''", "tries", "=", "3", "while", "tries", ":", "tmpbuffer", "=", "self", ".", "serial_h", ".", "read", "(", "1", ")", "if", "tmpbuffer", "!=", "b'\\xee'", ...
Receive a C1218Packet, the payload data is returned. :param bool full_frame: If set to True, the entire C1218 frame is returned instead of just the payload.
[ "Receive", "a", "C1218Packet", "the", "payload", "data", "is", "returned", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L159-L198
227,322
securestate/termineter
lib/c1218/connection.py
ConnectionBase.read
def read(self, size): """ Read raw data from the serial connection. This function is not meant to be called directly. :param int size: The number of bytes to read from the serial connection. """ data = self.serial_h.read(size) self.logger.debug('read data, length: ' + str(len(data)) + ' data: ' + binasci...
python
def read(self, size): """ Read raw data from the serial connection. This function is not meant to be called directly. :param int size: The number of bytes to read from the serial connection. """ data = self.serial_h.read(size) self.logger.debug('read data, length: ' + str(len(data)) + ' data: ' + binasci...
[ "def", "read", "(", "self", ",", "size", ")", ":", "data", "=", "self", ".", "serial_h", ".", "read", "(", "size", ")", "self", ".", "logger", ".", "debug", "(", "'read data, length: '", "+", "str", "(", "len", "(", "data", ")", ")", "+", "' data: ...
Read raw data from the serial connection. This function is not meant to be called directly. :param int size: The number of bytes to read from the serial connection.
[ "Read", "raw", "data", "from", "the", "serial", "connection", ".", "This", "function", "is", "not", "meant", "to", "be", "called", "directly", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L210-L222
227,323
securestate/termineter
lib/c1218/connection.py
ConnectionBase.close
def close(self): """ Send a terminate request and then disconnect from the serial device. """ if self._initialized: self.stop() self.logged_in = False return self.serial_h.close()
python
def close(self): """ Send a terminate request and then disconnect from the serial device. """ if self._initialized: self.stop() self.logged_in = False return self.serial_h.close()
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_initialized", ":", "self", ".", "stop", "(", ")", "self", ".", "logged_in", "=", "False", "return", "self", ".", "serial_h", ".", "close", "(", ")" ]
Send a terminate request and then disconnect from the serial device.
[ "Send", "a", "terminate", "request", "and", "then", "disconnect", "from", "the", "serial", "device", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L224-L231
227,324
securestate/termineter
lib/c1218/connection.py
Connection.start
def start(self): """ Send an identity request and then a negotiation request. """ self.serial_h.flushOutput() self.serial_h.flushInput() self.send(C1218IdentRequest()) data = self.recv() if data[0] != 0x00: self.logger.error('received incorrect response to identification service request') return F...
python
def start(self): """ Send an identity request and then a negotiation request. """ self.serial_h.flushOutput() self.serial_h.flushInput() self.send(C1218IdentRequest()) data = self.recv() if data[0] != 0x00: self.logger.error('received incorrect response to identification service request') return F...
[ "def", "start", "(", "self", ")", ":", "self", ".", "serial_h", ".", "flushOutput", "(", ")", "self", ".", "serial_h", ".", "flushInput", "(", ")", "self", ".", "send", "(", "C1218IdentRequest", "(", ")", ")", "data", "=", "self", ".", "recv", "(", ...
Send an identity request and then a negotiation request.
[ "Send", "an", "identity", "request", "and", "then", "a", "negotiation", "request", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L278-L297
227,325
securestate/termineter
lib/c1218/connection.py
Connection.stop
def stop(self, force=False): """ Send a terminate request. :param bool force: ignore the remote devices response """ if self._initialized: self.send(C1218TerminateRequest()) data = self.recv() if data == b'\x00' or force: self._initialized = False self._toggle_bit = False return True r...
python
def stop(self, force=False): """ Send a terminate request. :param bool force: ignore the remote devices response """ if self._initialized: self.send(C1218TerminateRequest()) data = self.recv() if data == b'\x00' or force: self._initialized = False self._toggle_bit = False return True r...
[ "def", "stop", "(", "self", ",", "force", "=", "False", ")", ":", "if", "self", ".", "_initialized", ":", "self", ".", "send", "(", "C1218TerminateRequest", "(", ")", ")", "data", "=", "self", ".", "recv", "(", ")", "if", "data", "==", "b'\\x00'", ...
Send a terminate request. :param bool force: ignore the remote devices response
[ "Send", "a", "terminate", "request", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L299-L312
227,326
securestate/termineter
lib/c1218/connection.py
Connection.login
def login(self, username='0000', userid=0, password=None): """ Log into the connected device. :param str username: the username to log in with (len(username) <= 10) :param int userid: the userid to log in with (0x0000 <= userid <= 0xffff) :param str password: password to log in with (len(password) <= 20) :...
python
def login(self, username='0000', userid=0, password=None): """ Log into the connected device. :param str username: the username to log in with (len(username) <= 10) :param int userid: the userid to log in with (0x0000 <= userid <= 0xffff) :param str password: password to log in with (len(password) <= 20) :...
[ "def", "login", "(", "self", ",", "username", "=", "'0000'", ",", "userid", "=", "0", ",", "password", "=", "None", ")", ":", "if", "password", "and", "len", "(", "password", ")", ">", "20", ":", "self", ".", "logger", ".", "error", "(", "'password...
Log into the connected device. :param str username: the username to log in with (len(username) <= 10) :param int userid: the userid to log in with (0x0000 <= userid <= 0xffff) :param str password: password to log in with (len(password) <= 20) :rtype: bool
[ "Log", "into", "the", "connected", "device", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L314-L341
227,327
securestate/termineter
lib/c1218/connection.py
Connection.logoff
def logoff(self): """ Send a logoff request. :rtype: bool """ self.send(C1218LogoffRequest()) data = self.recv() if data == b'\x00': self._initialized = False return True return False
python
def logoff(self): """ Send a logoff request. :rtype: bool """ self.send(C1218LogoffRequest()) data = self.recv() if data == b'\x00': self._initialized = False return True return False
[ "def", "logoff", "(", "self", ")", ":", "self", ".", "send", "(", "C1218LogoffRequest", "(", ")", ")", "data", "=", "self", ".", "recv", "(", ")", "if", "data", "==", "b'\\x00'", ":", "self", ".", "_initialized", "=", "False", "return", "True", "retu...
Send a logoff request. :rtype: bool
[ "Send", "a", "logoff", "request", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L343-L354
227,328
securestate/termineter
lib/c1218/connection.py
Connection.get_table_data
def get_table_data(self, tableid, octetcount=None, offset=None): """ Read data from a table. If successful, all of the data from the requested table will be returned. :param int tableid: The table number to read from (0x0000 <= tableid <= 0xffff) :param int octetcount: Limit the amount of data read, only wor...
python
def get_table_data(self, tableid, octetcount=None, offset=None): """ Read data from a table. If successful, all of the data from the requested table will be returned. :param int tableid: The table number to read from (0x0000 <= tableid <= 0xffff) :param int octetcount: Limit the amount of data read, only wor...
[ "def", "get_table_data", "(", "self", ",", "tableid", ",", "octetcount", "=", "None", ",", "offset", "=", "None", ")", ":", "if", "self", ".", "caching_enabled", "and", "tableid", "in", "self", ".", "_cacheable_tables", "and", "tableid", "in", "self", ".",...
Read data from a table. If successful, all of the data from the requested table will be returned. :param int tableid: The table number to read from (0x0000 <= tableid <= 0xffff) :param int octetcount: Limit the amount of data read, only works if the meter supports this type of reading. :param int offset: T...
[ "Read", "data", "from", "a", "table", ".", "If", "successful", "all", "of", "the", "data", "from", "the", "requested", "table", "will", "be", "returned", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L356-L396
227,329
securestate/termineter
lib/c1218/connection.py
Connection.set_table_data
def set_table_data(self, tableid, data, offset=None): """ Write data to a table. :param int tableid: The table number to write to (0x0000 <= tableid <= 0xffff) :param str data: The data to write into the table. :param int offset: The offset at which to start to write the data (0x000000 <= octetcount <= 0xfff...
python
def set_table_data(self, tableid, data, offset=None): """ Write data to a table. :param int tableid: The table number to write to (0x0000 <= tableid <= 0xffff) :param str data: The data to write into the table. :param int offset: The offset at which to start to write the data (0x000000 <= octetcount <= 0xfff...
[ "def", "set_table_data", "(", "self", ",", "tableid", ",", "data", ",", "offset", "=", "None", ")", ":", "self", ".", "send", "(", "C1218WriteRequest", "(", "tableid", ",", "data", ",", "offset", ")", ")", "data", "=", "self", ".", "recv", "(", ")", ...
Write data to a table. :param int tableid: The table number to write to (0x0000 <= tableid <= 0xffff) :param str data: The data to write into the table. :param int offset: The offset at which to start to write the data (0x000000 <= octetcount <= 0xffffff).
[ "Write", "data", "to", "a", "table", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L398-L413
227,330
securestate/termineter
lib/c1218/connection.py
Connection.run_procedure
def run_procedure(self, process_number, std_vs_mfg, params=''): """ Initiate a C1219 procedure, the request is written to table 7 and the response is read from table 8. :param int process_number: The numeric procedure identifier (0 <= process_number <= 2047). :param bool std_vs_mfg: Whether the procedure is ...
python
def run_procedure(self, process_number, std_vs_mfg, params=''): """ Initiate a C1219 procedure, the request is written to table 7 and the response is read from table 8. :param int process_number: The numeric procedure identifier (0 <= process_number <= 2047). :param bool std_vs_mfg: Whether the procedure is ...
[ "def", "run_procedure", "(", "self", ",", "process_number", ",", "std_vs_mfg", ",", "params", "=", "''", ")", ":", "seqnum", "=", "random", ".", "randint", "(", "2", ",", "254", ")", "self", ".", "logger", ".", "info", "(", "'starting procedure: '", "+",...
Initiate a C1219 procedure, the request is written to table 7 and the response is read from table 8. :param int process_number: The numeric procedure identifier (0 <= process_number <= 2047). :param bool std_vs_mfg: Whether the procedure is manufacturer specified or not. True is manufacturer specified. :pa...
[ "Initiate", "a", "C1219", "procedure", "the", "request", "is", "written", "to", "table", "7", "and", "the", "response", "is", "read", "from", "table", "8", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/c1218/connection.py#L415-L437
227,331
securestate/termineter
lib/termineter/options.py
Options.add_string
def add_string(self, name, help, required=True, default=None): """ Add a new option with a type of String. :param str name: The name of the option, how it will be referenced. :param str help: The string returned as help to describe how the option is used. :param bool required: Whether to require that this op...
python
def add_string(self, name, help, required=True, default=None): """ Add a new option with a type of String. :param str name: The name of the option, how it will be referenced. :param str help: The string returned as help to describe how the option is used. :param bool required: Whether to require that this op...
[ "def", "add_string", "(", "self", ",", "name", ",", "help", ",", "required", "=", "True", ",", "default", "=", "None", ")", ":", "self", ".", "_options", "[", "name", "]", "=", "Option", "(", "name", ",", "'str'", ",", "help", ",", "required", ",",...
Add a new option with a type of String. :param str name: The name of the option, how it will be referenced. :param str help: The string returned as help to describe how the option is used. :param bool required: Whether to require that this option be set or not. :param str default: The default value for this op...
[ "Add", "a", "new", "option", "with", "a", "type", "of", "String", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/options.py#L80-L89
227,332
securestate/termineter
lib/termineter/options.py
Options.set_option_value
def set_option_value(self, name, value): """ Set an option's value. :param str name: The name of the option to set the value for. :param str value: The value to set the option to, it will be converted from a string. :return: The previous value for the specified option. """ option = self.get_option(name) ...
python
def set_option_value(self, name, value): """ Set an option's value. :param str name: The name of the option to set the value for. :param str value: The value to set the option to, it will be converted from a string. :return: The previous value for the specified option. """ option = self.get_option(name) ...
[ "def", "set_option_value", "(", "self", ",", "name", ",", "value", ")", ":", "option", "=", "self", ".", "get_option", "(", "name", ")", "old_value", "=", "option", ".", "value", "if", "option", ".", "type", "in", "(", "'str'", ",", "'rfile'", ")", "...
Set an option's value. :param str name: The name of the option to set the value for. :param str value: The value to set the option to, it will be converted from a string. :return: The previous value for the specified option.
[ "Set", "an", "option", "s", "value", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/options.py#L153-L191
227,333
securestate/termineter
lib/termineter/options.py
Options.get_missing_options
def get_missing_options(self): """ Get a list of options that are required, but with default values of None. """ return [option.name for option in self._options.values() if option.required and option.value is None]
python
def get_missing_options(self): """ Get a list of options that are required, but with default values of None. """ return [option.name for option in self._options.values() if option.required and option.value is None]
[ "def", "get_missing_options", "(", "self", ")", ":", "return", "[", "option", ".", "name", "for", "option", "in", "self", ".", "_options", ".", "values", "(", ")", "if", "option", ".", "required", "and", "option", ".", "value", "is", "None", "]" ]
Get a list of options that are required, but with default values of None.
[ "Get", "a", "list", "of", "options", "that", "are", "required", "but", "with", "default", "values", "of", "None", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/options.py#L193-L198
227,334
securestate/termineter
lib/termineter/__init__.py
get_revision
def get_revision(): """ Retrieve the current git revision identifier. If the git binary can not be found or the repository information is unavailable, None will be returned. :return: The git revision tag if it's available. :rtype: str """ git_bin = smoke_zephyr.utilities.which('git') if not git_bin: return N...
python
def get_revision(): """ Retrieve the current git revision identifier. If the git binary can not be found or the repository information is unavailable, None will be returned. :return: The git revision tag if it's available. :rtype: str """ git_bin = smoke_zephyr.utilities.which('git') if not git_bin: return N...
[ "def", "get_revision", "(", ")", ":", "git_bin", "=", "smoke_zephyr", ".", "utilities", ".", "which", "(", "'git'", ")", "if", "not", "git_bin", ":", "return", "None", "proc_h", "=", "subprocess", ".", "Popen", "(", "(", "git_bin", ",", "'rev-parse'", ",...
Retrieve the current git revision identifier. If the git binary can not be found or the repository information is unavailable, None will be returned. :return: The git revision tag if it's available. :rtype: str
[ "Retrieve", "the", "current", "git", "revision", "identifier", ".", "If", "the", "git", "binary", "can", "not", "be", "found", "or", "the", "repository", "information", "is", "unavailable", "None", "will", "be", "returned", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/__init__.py#L42-L64
227,335
securestate/termineter
lib/termineter/core.py
Framework.reload_module
def reload_module(self, module_path=None): """ Reloads a module into the framework. If module_path is not specified, then the current_module variable is used. Returns True on success, False on error. @type module_path: String @param module_path: The name of the module to reload """ if module_path is ...
python
def reload_module(self, module_path=None): """ Reloads a module into the framework. If module_path is not specified, then the current_module variable is used. Returns True on success, False on error. @type module_path: String @param module_path: The name of the module to reload """ if module_path is ...
[ "def", "reload_module", "(", "self", ",", "module_path", "=", "None", ")", ":", "if", "module_path", "is", "None", ":", "if", "self", ".", "current_module", "is", "not", "None", ":", "module_path", "=", "self", ".", "current_module", ".", "name", "else", ...
Reloads a module into the framework. If module_path is not specified, then the current_module variable is used. Returns True on success, False on error. @type module_path: String @param module_path: The name of the module to reload
[ "Reloads", "a", "module", "into", "the", "framework", ".", "If", "module_path", "is", "not", "specified", "then", "the", "current_module", "variable", "is", "used", ".", "Returns", "True", "on", "success", "False", "on", "error", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/core.py#L168-L204
227,336
securestate/termineter
lib/termineter/core.py
Framework.serial_disconnect
def serial_disconnect(self): """ Closes the serial connection to the meter and disconnects from the device. """ if self._serial_connected: try: self.serial_connection.close() except c1218.errors.C1218IOError as error: self.logger.error('caught C1218IOError: ' + str(error)) except serial.seria...
python
def serial_disconnect(self): """ Closes the serial connection to the meter and disconnects from the device. """ if self._serial_connected: try: self.serial_connection.close() except c1218.errors.C1218IOError as error: self.logger.error('caught C1218IOError: ' + str(error)) except serial.seria...
[ "def", "serial_disconnect", "(", "self", ")", ":", "if", "self", ".", "_serial_connected", ":", "try", ":", "self", ".", "serial_connection", ".", "close", "(", ")", "except", "c1218", ".", "errors", ".", "C1218IOError", "as", "error", ":", "self", ".", ...
Closes the serial connection to the meter and disconnects from the device.
[ "Closes", "the", "serial", "connection", "to", "the", "meter", "and", "disconnects", "from", "the", "device", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/core.py#L324-L338
227,337
securestate/termineter
lib/termineter/core.py
Framework.serial_get
def serial_get(self): """ Create the serial connection from the framework settings and return it, setting the framework instance in the process. """ frmwk_c1218_settings = { 'nbrpkts': self.advanced_options['C1218_MAX_PACKETS'], 'pktsize': self.advanced_options['C1218_PACKET_SIZE'] } frmwk_serial_s...
python
def serial_get(self): """ Create the serial connection from the framework settings and return it, setting the framework instance in the process. """ frmwk_c1218_settings = { 'nbrpkts': self.advanced_options['C1218_MAX_PACKETS'], 'pktsize': self.advanced_options['C1218_PACKET_SIZE'] } frmwk_serial_s...
[ "def", "serial_get", "(", "self", ")", ":", "frmwk_c1218_settings", "=", "{", "'nbrpkts'", ":", "self", ".", "advanced_options", "[", "'C1218_MAX_PACKETS'", "]", ",", "'pktsize'", ":", "self", ".", "advanced_options", "[", "'C1218_PACKET_SIZE'", "]", "}", "frmwk...
Create the serial connection from the framework settings and return it, setting the framework instance in the process.
[ "Create", "the", "serial", "connection", "from", "the", "framework", "settings", "and", "return", "it", "setting", "the", "framework", "instance", "in", "the", "process", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/core.py#L340-L361
227,338
securestate/termineter
lib/termineter/core.py
Framework.serial_connect
def serial_connect(self): """ Connect to the serial device. """ self.serial_get() try: self.serial_connection.start() except c1218.errors.C1218IOError as error: self.logger.error('serial connection has been opened but the meter is unresponsive') raise error self._serial_connected = True return ...
python
def serial_connect(self): """ Connect to the serial device. """ self.serial_get() try: self.serial_connection.start() except c1218.errors.C1218IOError as error: self.logger.error('serial connection has been opened but the meter is unresponsive') raise error self._serial_connected = True return ...
[ "def", "serial_connect", "(", "self", ")", ":", "self", ".", "serial_get", "(", ")", "try", ":", "self", ".", "serial_connection", ".", "start", "(", ")", "except", "c1218", ".", "errors", ".", "C1218IOError", "as", "error", ":", "self", ".", "logger", ...
Connect to the serial device.
[ "Connect", "to", "the", "serial", "device", "." ]
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/core.py#L363-L374
227,339
securestate/termineter
lib/termineter/core.py
Framework.serial_login
def serial_login(self): """ Attempt to log into the meter over the C12.18 protocol. Returns True on success, False on a failure. This can be called by modules in order to login with a username and password configured within the framework instance. """ if not self._serial_connected: raise termineter.errors....
python
def serial_login(self): """ Attempt to log into the meter over the C12.18 protocol. Returns True on success, False on a failure. This can be called by modules in order to login with a username and password configured within the framework instance. """ if not self._serial_connected: raise termineter.errors....
[ "def", "serial_login", "(", "self", ")", ":", "if", "not", "self", ".", "_serial_connected", ":", "raise", "termineter", ".", "errors", ".", "FrameworkRuntimeError", "(", "'the serial interface is disconnected'", ")", "username", "=", "self", ".", "options", "[", ...
Attempt to log into the meter over the C12.18 protocol. Returns True on success, False on a failure. This can be called by modules in order to login with a username and password configured within the framework instance.
[ "Attempt", "to", "log", "into", "the", "meter", "over", "the", "C12", ".", "18", "protocol", ".", "Returns", "True", "on", "success", "False", "on", "a", "failure", ".", "This", "can", "be", "called", "by", "modules", "in", "order", "to", "login", "wit...
d657d25d97c7739e650b951c396404e857e56625
https://github.com/securestate/termineter/blob/d657d25d97c7739e650b951c396404e857e56625/lib/termineter/core.py#L376-L405
227,340
MasoniteFramework/masonite
databases/seeds/user_table_seeder.py
UserTableSeeder.run
def run(self): """ Run the database seeds. """ self.factory.register(User, self.users_factory) self.factory(User, 50).create()
python
def run(self): """ Run the database seeds. """ self.factory.register(User, self.users_factory) self.factory(User, 50).create()
[ "def", "run", "(", "self", ")", ":", "self", ".", "factory", ".", "register", "(", "User", ",", "self", ".", "users_factory", ")", "self", ".", "factory", "(", "User", ",", "50", ")", ".", "create", "(", ")" ]
Run the database seeds.
[ "Run", "the", "database", "seeds", "." ]
c9bcca8f59169934c2accd8cecb2b996bb5e1a0d
https://github.com/MasoniteFramework/masonite/blob/c9bcca8f59169934c2accd8cecb2b996bb5e1a0d/databases/seeds/user_table_seeder.py#L18-L24
227,341
MasoniteFramework/masonite
bootstrap/start.py
app
def app(environ, start_response): """The WSGI Application Server. Arguments: environ {dict} -- The WSGI environ dictionary start_response {WSGI callable} Returns: WSGI Response """ from wsgi import container """Add Environ To Service Container Add the environ to th...
python
def app(environ, start_response): """The WSGI Application Server. Arguments: environ {dict} -- The WSGI environ dictionary start_response {WSGI callable} Returns: WSGI Response """ from wsgi import container """Add Environ To Service Container Add the environ to th...
[ "def", "app", "(", "environ", ",", "start_response", ")", ":", "from", "wsgi", "import", "container", "\"\"\"Add Environ To Service Container\n Add the environ to the service container. The environ is generated by the\n the WSGI server above and used by a service provider to manipulate...
The WSGI Application Server. Arguments: environ {dict} -- The WSGI environ dictionary start_response {WSGI callable} Returns: WSGI Response
[ "The", "WSGI", "Application", "Server", "." ]
c9bcca8f59169934c2accd8cecb2b996bb5e1a0d
https://github.com/MasoniteFramework/masonite/blob/c9bcca8f59169934c2accd8cecb2b996bb5e1a0d/bootstrap/start.py#L12-L57
227,342
MasoniteFramework/masonite
databases/migrations/2018_01_09_043202_create_users_table.py
CreateUsersTable.up
def up(self): """Run the migrations.""" with self.schema.create('users') as table: table.increments('id') table.string('name') table.string('email').unique() table.string('password') table.string('remember_token').nullable() table.t...
python
def up(self): """Run the migrations.""" with self.schema.create('users') as table: table.increments('id') table.string('name') table.string('email').unique() table.string('password') table.string('remember_token').nullable() table.t...
[ "def", "up", "(", "self", ")", ":", "with", "self", ".", "schema", ".", "create", "(", "'users'", ")", "as", "table", ":", "table", ".", "increments", "(", "'id'", ")", "table", ".", "string", "(", "'name'", ")", "table", ".", "string", "(", "'emai...
Run the migrations.
[ "Run", "the", "migrations", "." ]
c9bcca8f59169934c2accd8cecb2b996bb5e1a0d
https://github.com/MasoniteFramework/masonite/blob/c9bcca8f59169934c2accd8cecb2b996bb5e1a0d/databases/migrations/2018_01_09_043202_create_users_table.py#L6-L15
227,343
MasoniteFramework/masonite
app/http/middleware/VerifyEmailMiddleware.py
VerifyEmailMiddleware.before
def before(self): """Run This Middleware Before The Route Executes.""" user = self.request.user() if user and user.verified_at is None: self.request.redirect('/email/verify')
python
def before(self): """Run This Middleware Before The Route Executes.""" user = self.request.user() if user and user.verified_at is None: self.request.redirect('/email/verify')
[ "def", "before", "(", "self", ")", ":", "user", "=", "self", ".", "request", ".", "user", "(", ")", "if", "user", "and", "user", ".", "verified_at", "is", "None", ":", "self", ".", "request", ".", "redirect", "(", "'/email/verify'", ")" ]
Run This Middleware Before The Route Executes.
[ "Run", "This", "Middleware", "Before", "The", "Route", "Executes", "." ]
c9bcca8f59169934c2accd8cecb2b996bb5e1a0d
https://github.com/MasoniteFramework/masonite/blob/c9bcca8f59169934c2accd8cecb2b996bb5e1a0d/app/http/middleware/VerifyEmailMiddleware.py#L17-L22
227,344
MasoniteFramework/masonite
app/http/controllers/WelcomeController.py
WelcomeController.show
def show(self, view: View, request: Request): """Show the welcome page. Arguments: view {masonite.view.View} -- The Masonite view class. Application {config.application} -- The application config module. Returns: masonite.view.View -- The Masonite view class...
python
def show(self, view: View, request: Request): """Show the welcome page. Arguments: view {masonite.view.View} -- The Masonite view class. Application {config.application} -- The application config module. Returns: masonite.view.View -- The Masonite view class...
[ "def", "show", "(", "self", ",", "view", ":", "View", ",", "request", ":", "Request", ")", ":", "return", "view", ".", "render", "(", "'welcome'", ",", "{", "'app'", ":", "request", ".", "app", "(", ")", ".", "make", "(", "'Application'", ")", "}",...
Show the welcome page. Arguments: view {masonite.view.View} -- The Masonite view class. Application {config.application} -- The application config module. Returns: masonite.view.View -- The Masonite view class.
[ "Show", "the", "welcome", "page", "." ]
c9bcca8f59169934c2accd8cecb2b996bb5e1a0d
https://github.com/MasoniteFramework/masonite/blob/c9bcca8f59169934c2accd8cecb2b996bb5e1a0d/app/http/controllers/WelcomeController.py#L10-L22
227,345
pybluez/pybluez
bluetooth/btcommon.py
is_valid_address
def is_valid_address (s): """ returns True if address is a valid Bluetooth address valid address are always strings of the form XX:XX:XX:XX:XX:XX where X is a hexadecimal character. For example, 01:23:45:67:89:AB is a valid address, but IN:VA:LI:DA:DD:RE is not """ try: ...
python
def is_valid_address (s): """ returns True if address is a valid Bluetooth address valid address are always strings of the form XX:XX:XX:XX:XX:XX where X is a hexadecimal character. For example, 01:23:45:67:89:AB is a valid address, but IN:VA:LI:DA:DD:RE is not """ try: ...
[ "def", "is_valid_address", "(", "s", ")", ":", "try", ":", "pairs", "=", "s", ".", "split", "(", "\":\"", ")", "if", "len", "(", "pairs", ")", "!=", "6", ":", "return", "False", "if", "not", "all", "(", "0", "<=", "int", "(", "b", ",", "16", ...
returns True if address is a valid Bluetooth address valid address are always strings of the form XX:XX:XX:XX:XX:XX where X is a hexadecimal character. For example, 01:23:45:67:89:AB is a valid address, but IN:VA:LI:DA:DD:RE is not
[ "returns", "True", "if", "address", "is", "a", "valid", "Bluetooth", "address" ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/bluetooth/btcommon.py#L182-L197
227,346
pybluez/pybluez
bluetooth/btcommon.py
to_full_uuid
def to_full_uuid (uuid): """ converts a short 16-bit or 32-bit reserved UUID to a full 128-bit Bluetooth UUID. """ if not is_valid_uuid (uuid): raise ValueError ("invalid UUID") if len (uuid) == 4: return "0000%s-0000-1000-8000-00805F9B34FB" % uuid elif len (uuid) == 8: retur...
python
def to_full_uuid (uuid): """ converts a short 16-bit or 32-bit reserved UUID to a full 128-bit Bluetooth UUID. """ if not is_valid_uuid (uuid): raise ValueError ("invalid UUID") if len (uuid) == 4: return "0000%s-0000-1000-8000-00805F9B34FB" % uuid elif len (uuid) == 8: retur...
[ "def", "to_full_uuid", "(", "uuid", ")", ":", "if", "not", "is_valid_uuid", "(", "uuid", ")", ":", "raise", "ValueError", "(", "\"invalid UUID\"", ")", "if", "len", "(", "uuid", ")", "==", "4", ":", "return", "\"0000%s-0000-1000-8000-00805F9B34FB\"", "%", "u...
converts a short 16-bit or 32-bit reserved UUID to a full 128-bit Bluetooth UUID.
[ "converts", "a", "short", "16", "-", "bit", "or", "32", "-", "bit", "reserved", "UUID", "to", "a", "full", "128", "-", "bit", "Bluetooth", "UUID", "." ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/bluetooth/btcommon.py#L234-L245
227,347
pybluez/pybluez
bluetooth/bluez.py
DeviceDiscoverer.cancel_inquiry
def cancel_inquiry (self): """ Call this method to cancel an inquiry in process. inquiry_complete will still be called. """ self.names_to_find = {} if self.is_inquiring: try: _bt.hci_send_cmd (self.sock, _bt.OGF_LINK_CTL, \ ...
python
def cancel_inquiry (self): """ Call this method to cancel an inquiry in process. inquiry_complete will still be called. """ self.names_to_find = {} if self.is_inquiring: try: _bt.hci_send_cmd (self.sock, _bt.OGF_LINK_CTL, \ ...
[ "def", "cancel_inquiry", "(", "self", ")", ":", "self", ".", "names_to_find", "=", "{", "}", "if", "self", ".", "is_inquiring", ":", "try", ":", "_bt", ".", "hci_send_cmd", "(", "self", ".", "sock", ",", "_bt", ".", "OGF_LINK_CTL", ",", "_bt", ".", "...
Call this method to cancel an inquiry in process. inquiry_complete will still be called.
[ "Call", "this", "method", "to", "cancel", "an", "inquiry", "in", "process", ".", "inquiry_complete", "will", "still", "be", "called", "." ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/bluetooth/bluez.py#L451-L468
227,348
pybluez/pybluez
bluetooth/bluez.py
DeviceDiscoverer.device_discovered
def device_discovered (self, address, device_class, rssi, name): """ Called when a bluetooth device is discovered. address is the bluetooth address of the device device_class is the Class of Device, as specified in [1] passed in as a 3-byte string name is ...
python
def device_discovered (self, address, device_class, rssi, name): """ Called when a bluetooth device is discovered. address is the bluetooth address of the device device_class is the Class of Device, as specified in [1] passed in as a 3-byte string name is ...
[ "def", "device_discovered", "(", "self", ",", "address", ",", "device_class", ",", "rssi", ",", "name", ")", ":", "if", "name", ":", "print", "(", "(", "\"found: %s - %s (class 0x%X, rssi %s)\"", "%", "(", "address", ",", "name", ",", "device_class", ",", "r...
Called when a bluetooth device is discovered. address is the bluetooth address of the device device_class is the Class of Device, as specified in [1] passed in as a 3-byte string name is the user-friendly name of the device if lookup_names was set when the inquiry...
[ "Called", "when", "a", "bluetooth", "device", "is", "discovered", "." ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/bluetooth/bluez.py#L646-L668
227,349
pybluez/pybluez
examples/advanced/write-inquiry-scan.py
read_inquiry_scan_activity
def read_inquiry_scan_activity(sock): """returns the current inquiry scan interval and window, or -1 on failure""" # save current filter old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) # Setup socket filter to receive only events related to the # read_inquiry_mode command ...
python
def read_inquiry_scan_activity(sock): """returns the current inquiry scan interval and window, or -1 on failure""" # save current filter old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) # Setup socket filter to receive only events related to the # read_inquiry_mode command ...
[ "def", "read_inquiry_scan_activity", "(", "sock", ")", ":", "# save current filter", "old_filter", "=", "sock", ".", "getsockopt", "(", "bluez", ".", "SOL_HCI", ",", "bluez", ".", "HCI_FILTER", ",", "14", ")", "# Setup socket filter to receive only events related to the...
returns the current inquiry scan interval and window, or -1 on failure
[ "returns", "the", "current", "inquiry", "scan", "interval", "and", "window", "or", "-", "1", "on", "failure" ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/examples/advanced/write-inquiry-scan.py#L6-L36
227,350
pybluez/pybluez
examples/advanced/write-inquiry-scan.py
write_inquiry_scan_activity
def write_inquiry_scan_activity(sock, interval, window): """returns 0 on success, -1 on failure""" # save current filter old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) # Setup socket filter to receive only events related to the # write_inquiry_mode command flt = bluez.hci_fi...
python
def write_inquiry_scan_activity(sock, interval, window): """returns 0 on success, -1 on failure""" # save current filter old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) # Setup socket filter to receive only events related to the # write_inquiry_mode command flt = bluez.hci_fi...
[ "def", "write_inquiry_scan_activity", "(", "sock", ",", "interval", ",", "window", ")", ":", "# save current filter", "old_filter", "=", "sock", ".", "getsockopt", "(", "bluez", ".", "SOL_HCI", ",", "bluez", ".", "HCI_FILTER", ",", "14", ")", "# Setup socket fil...
returns 0 on success, -1 on failure
[ "returns", "0", "on", "success", "-", "1", "on", "failure" ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/examples/advanced/write-inquiry-scan.py#L38-L65
227,351
pybluez/pybluez
examples/advanced/inquiry-with-rssi.py
read_inquiry_mode
def read_inquiry_mode(sock): """returns the current mode, or -1 on failure""" # save current filter old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) # Setup socket filter to receive only events related to the # read_inquiry_mode command flt = bluez.hci_filter_new() opcode ...
python
def read_inquiry_mode(sock): """returns the current mode, or -1 on failure""" # save current filter old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) # Setup socket filter to receive only events related to the # read_inquiry_mode command flt = bluez.hci_filter_new() opcode ...
[ "def", "read_inquiry_mode", "(", "sock", ")", ":", "# save current filter", "old_filter", "=", "sock", ".", "getsockopt", "(", "bluez", ".", "SOL_HCI", ",", "bluez", ".", "HCI_FILTER", ",", "14", ")", "# Setup socket filter to receive only events related to the", "# r...
returns the current mode, or -1 on failure
[ "returns", "the", "current", "mode", "or", "-", "1", "on", "failure" ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/examples/advanced/inquiry-with-rssi.py#L16-L42
227,352
pybluez/pybluez
macos/_lightbluecommon.py
splitclass
def splitclass(classofdevice): """ Splits the given class of device to return a 3-item tuple with the major service class, major device class and minor device class values. These values indicate the device's major services and the type of the device (e.g. mobile phone, laptop, etc.). If you google ...
python
def splitclass(classofdevice): """ Splits the given class of device to return a 3-item tuple with the major service class, major device class and minor device class values. These values indicate the device's major services and the type of the device (e.g. mobile phone, laptop, etc.). If you google ...
[ "def", "splitclass", "(", "classofdevice", ")", ":", "if", "not", "isinstance", "(", "classofdevice", ",", "int", ")", ":", "try", ":", "classofdevice", "=", "int", "(", "classofdevice", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "raise"...
Splits the given class of device to return a 3-item tuple with the major service class, major device class and minor device class values. These values indicate the device's major services and the type of the device (e.g. mobile phone, laptop, etc.). If you google for "assigned numbers bluetooth baseban...
[ "Splits", "the", "given", "class", "of", "device", "to", "return", "a", "3", "-", "item", "tuple", "with", "the", "major", "service", "class", "major", "device", "class", "and", "minor", "device", "class", "values", "." ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/macos/_lightbluecommon.py#L43-L69
227,353
pybluez/pybluez
macos/_lightblue.py
_searchservices
def _searchservices(device, name=None, uuid=None, uuidbad=None): """ Searches the given IOBluetoothDevice using the specified parameters. Returns an empty list if the device has no services. uuid should be IOBluetoothSDPUUID object. """ if not isinstance(device, _IOBluetooth.IOBluetoothDevice):...
python
def _searchservices(device, name=None, uuid=None, uuidbad=None): """ Searches the given IOBluetoothDevice using the specified parameters. Returns an empty list if the device has no services. uuid should be IOBluetoothSDPUUID object. """ if not isinstance(device, _IOBluetooth.IOBluetoothDevice):...
[ "def", "_searchservices", "(", "device", ",", "name", "=", "None", ",", "uuid", "=", "None", ",", "uuidbad", "=", "None", ")", ":", "if", "not", "isinstance", "(", "device", ",", "_IOBluetooth", ".", "IOBluetoothDevice", ")", ":", "raise", "ValueError", ...
Searches the given IOBluetoothDevice using the specified parameters. Returns an empty list if the device has no services. uuid should be IOBluetoothSDPUUID object.
[ "Searches", "the", "given", "IOBluetoothDevice", "using", "the", "specified", "parameters", ".", "Returns", "an", "empty", "list", "if", "the", "device", "has", "no", "services", "." ]
e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/macos/_lightblue.py#L485-L515
227,354
bambinos/bambi
bambi/backends/pymc.py
PyMC3BackEnd.reset
def reset(self): ''' Reset PyMC3 model and all tracked distributions and parameters. ''' self.model = pm.Model() self.mu = None self.par_groups = {}
python
def reset(self): ''' Reset PyMC3 model and all tracked distributions and parameters. ''' self.model = pm.Model() self.mu = None self.par_groups = {}
[ "def", "reset", "(", "self", ")", ":", "self", ".", "model", "=", "pm", ".", "Model", "(", ")", "self", ".", "mu", "=", "None", "self", ".", "par_groups", "=", "{", "}" ]
Reset PyMC3 model and all tracked distributions and parameters.
[ "Reset", "PyMC3", "model", "and", "all", "tracked", "distributions", "and", "parameters", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/backends/pymc.py#L37-L43
227,355
bambinos/bambi
bambi/backends/pymc.py
PyMC3BackEnd._build_dist
def _build_dist(self, spec, label, dist, **kwargs): ''' Build and return a PyMC3 Distribution. ''' if isinstance(dist, string_types): if hasattr(pm, dist): dist = getattr(pm, dist) elif dist in self.dists: dist = self.dists[dist] else: ...
python
def _build_dist(self, spec, label, dist, **kwargs): ''' Build and return a PyMC3 Distribution. ''' if isinstance(dist, string_types): if hasattr(pm, dist): dist = getattr(pm, dist) elif dist in self.dists: dist = self.dists[dist] else: ...
[ "def", "_build_dist", "(", "self", ",", "spec", ",", "label", ",", "dist", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "dist", ",", "string_types", ")", ":", "if", "hasattr", "(", "pm", ",", "dist", ")", ":", "dist", "=", "getattr",...
Build and return a PyMC3 Distribution.
[ "Build", "and", "return", "a", "PyMC3", "Distribution", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/backends/pymc.py#L45-L73
227,356
bambinos/bambi
bambi/results.py
MCMCResults.to_df
def to_df(self, varnames=None, ranefs=False, transformed=False, chains=None): ''' Returns the MCMC samples in a nice, neat pandas DataFrame with all MCMC chains concatenated. Args: varnames (list): List of variable names to include; if None (def...
python
def to_df(self, varnames=None, ranefs=False, transformed=False, chains=None): ''' Returns the MCMC samples in a nice, neat pandas DataFrame with all MCMC chains concatenated. Args: varnames (list): List of variable names to include; if None (def...
[ "def", "to_df", "(", "self", ",", "varnames", "=", "None", ",", "ranefs", "=", "False", ",", "transformed", "=", "False", ",", "chains", "=", "None", ")", ":", "# filter out unwanted variables", "names", "=", "self", ".", "_filter_names", "(", "varnames", ...
Returns the MCMC samples in a nice, neat pandas DataFrame with all MCMC chains concatenated. Args: varnames (list): List of variable names to include; if None (default), all eligible variables are included. ranefs (bool): Whether or not to include random effects ...
[ "Returns", "the", "MCMC", "samples", "in", "a", "nice", "neat", "pandas", "DataFrame", "with", "all", "MCMC", "chains", "concatenated", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/results.py#L369-L402
227,357
bambinos/bambi
bambi/diagnostics.py
autocov
def autocov(x): """Compute autocovariance estimates for every lag for the input array. Args: x (array-like): An array containing MCMC samples. Returns: np.ndarray: An array of the same size as the input array. """ acorr = autocorr(x) varx = np.var(x, ddof=1) * (len(x) - 1) / l...
python
def autocov(x): """Compute autocovariance estimates for every lag for the input array. Args: x (array-like): An array containing MCMC samples. Returns: np.ndarray: An array of the same size as the input array. """ acorr = autocorr(x) varx = np.var(x, ddof=1) * (len(x) - 1) / l...
[ "def", "autocov", "(", "x", ")", ":", "acorr", "=", "autocorr", "(", "x", ")", "varx", "=", "np", ".", "var", "(", "x", ",", "ddof", "=", "1", ")", "*", "(", "len", "(", "x", ")", "-", "1", ")", "/", "len", "(", "x", ")", "acov", "=", "...
Compute autocovariance estimates for every lag for the input array. Args: x (array-like): An array containing MCMC samples. Returns: np.ndarray: An array of the same size as the input array.
[ "Compute", "autocovariance", "estimates", "for", "every", "lag", "for", "the", "input", "array", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/diagnostics.py#L30-L43
227,358
bambinos/bambi
bambi/models.py
Model.reset
def reset(self): ''' Reset list of terms and y-variable. ''' self.terms = OrderedDict() self.y = None self.backend = None self.added_terms = [] self._added_priors = {} self.completes = [] self.clean_data = None
python
def reset(self): ''' Reset list of terms and y-variable. ''' self.terms = OrderedDict() self.y = None self.backend = None self.added_terms = [] self._added_priors = {} self.completes = [] self.clean_data = None
[ "def", "reset", "(", "self", ")", ":", "self", ".", "terms", "=", "OrderedDict", "(", ")", "self", ".", "y", "=", "None", "self", ".", "backend", "=", "None", "self", ".", "added_terms", "=", "[", "]", "self", ".", "_added_priors", "=", "{", "}", ...
Reset list of terms and y-variable.
[ "Reset", "list", "of", "terms", "and", "y", "-", "variable", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/models.py#L83-L93
227,359
bambinos/bambi
bambi/models.py
Model.fit
def fit(self, fixed=None, random=None, priors=None, family='gaussian', link=None, run=True, categorical=None, backend=None, **kwargs): '''Fit the model using the specified BackEnd. Args: fixed (str): Optional formula specification of fixed effects. random (list): Opt...
python
def fit(self, fixed=None, random=None, priors=None, family='gaussian', link=None, run=True, categorical=None, backend=None, **kwargs): '''Fit the model using the specified BackEnd. Args: fixed (str): Optional formula specification of fixed effects. random (list): Opt...
[ "def", "fit", "(", "self", ",", "fixed", "=", "None", ",", "random", "=", "None", ",", "priors", "=", "None", ",", "family", "=", "'gaussian'", ",", "link", "=", "None", ",", "run", "=", "True", ",", "categorical", "=", "None", ",", "backend", "=",...
Fit the model using the specified BackEnd. Args: fixed (str): Optional formula specification of fixed effects. random (list): Optional list-based specification of random effects. priors (dict): Optional specification of priors for one or more terms. A dict wh...
[ "Fit", "the", "model", "using", "the", "specified", "BackEnd", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/models.py#L236-L286
227,360
bambinos/bambi
bambi/models.py
Model.add
def add(self, fixed=None, random=None, priors=None, family='gaussian', link=None, categorical=None, append=True): '''Adds one or more terms to the model via an R-like formula syntax. Args: fixed (str): Optional formula specification of fixed effects. random (list): O...
python
def add(self, fixed=None, random=None, priors=None, family='gaussian', link=None, categorical=None, append=True): '''Adds one or more terms to the model via an R-like formula syntax. Args: fixed (str): Optional formula specification of fixed effects. random (list): O...
[ "def", "add", "(", "self", ",", "fixed", "=", "None", ",", "random", "=", "None", ",", "priors", "=", "None", ",", "family", "=", "'gaussian'", ",", "link", "=", "None", ",", "categorical", "=", "None", ",", "append", "=", "True", ")", ":", "data",...
Adds one or more terms to the model via an R-like formula syntax. Args: fixed (str): Optional formula specification of fixed effects. random (list): Optional list-based specification of random effects. priors (dict): Optional specification of priors for one or more ...
[ "Adds", "one", "or", "more", "terms", "to", "the", "model", "via", "an", "R", "-", "like", "formula", "syntax", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/models.py#L288-L372
227,361
bambinos/bambi
bambi/models.py
Model.set_priors
def set_priors(self, priors=None, fixed=None, random=None, match_derived_names=True): '''Set priors for one or more existing terms. Args: priors (dict): Dict of priors to update. Keys are names of terms to update; values are the new priors (either a Prior ...
python
def set_priors(self, priors=None, fixed=None, random=None, match_derived_names=True): '''Set priors for one or more existing terms. Args: priors (dict): Dict of priors to update. Keys are names of terms to update; values are the new priors (either a Prior ...
[ "def", "set_priors", "(", "self", ",", "priors", "=", "None", ",", "fixed", "=", "None", ",", "random", "=", "None", ",", "match_derived_names", "=", "True", ")", ":", "# save arguments to pass to _set_priors() at build time", "kwargs", "=", "dict", "(", "zip", ...
Set priors for one or more existing terms. Args: priors (dict): Dict of priors to update. Keys are names of terms to update; values are the new priors (either a Prior instance, or an int or float that scales the default priors). Note that a tuple can ...
[ "Set", "priors", "for", "one", "or", "more", "existing", "terms", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/models.py#L576-L605
227,362
bambinos/bambi
bambi/models.py
Model.fixed_terms
def fixed_terms(self): '''Return dict of all and only fixed effects in model.''' return {k: v for (k, v) in self.terms.items() if not v.random}
python
def fixed_terms(self): '''Return dict of all and only fixed effects in model.''' return {k: v for (k, v) in self.terms.items() if not v.random}
[ "def", "fixed_terms", "(", "self", ")", ":", "return", "{", "k", ":", "v", "for", "(", "k", ",", "v", ")", "in", "self", ".", "terms", ".", "items", "(", ")", "if", "not", "v", ".", "random", "}" ]
Return dict of all and only fixed effects in model.
[ "Return", "dict", "of", "all", "and", "only", "fixed", "effects", "in", "model", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/models.py#L722-L724
227,363
bambinos/bambi
bambi/models.py
Model.random_terms
def random_terms(self): '''Return dict of all and only random effects in model.''' return {k: v for (k, v) in self.terms.items() if v.random}
python
def random_terms(self): '''Return dict of all and only random effects in model.''' return {k: v for (k, v) in self.terms.items() if v.random}
[ "def", "random_terms", "(", "self", ")", ":", "return", "{", "k", ":", "v", "for", "(", "k", ",", "v", ")", "in", "self", ".", "terms", ".", "items", "(", ")", "if", "v", ".", "random", "}" ]
Return dict of all and only random effects in model.
[ "Return", "dict", "of", "all", "and", "only", "random", "effects", "in", "model", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/models.py#L727-L729
227,364
bambinos/bambi
bambi/priors.py
Prior.update
def update(self, **kwargs): '''Update the model arguments with additional arguments. Args: kwargs (dict): Optional keyword arguments to add to prior args. ''' # Backends expect numpy arrays, so make sure all numeric values are # represented as such. kwargs =...
python
def update(self, **kwargs): '''Update the model arguments with additional arguments. Args: kwargs (dict): Optional keyword arguments to add to prior args. ''' # Backends expect numpy arrays, so make sure all numeric values are # represented as such. kwargs =...
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Backends expect numpy arrays, so make sure all numeric values are", "# represented as such.", "kwargs", "=", "{", "k", ":", "(", "np", ".", "array", "(", "v", ")", "if", "isinstance", "(", "v", ...
Update the model arguments with additional arguments. Args: kwargs (dict): Optional keyword arguments to add to prior args.
[ "Update", "the", "model", "arguments", "with", "additional", "arguments", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/priors.py#L59-L70
227,365
bambinos/bambi
bambi/priors.py
PriorFactory.get
def get(self, dist=None, term=None, family=None): '''Retrieve default prior for a named distribution, term type, or family. Args: dist (str): Name of desired distribution. Note that the name is the key in the defaults dictionary, not the name of the Distribut...
python
def get(self, dist=None, term=None, family=None): '''Retrieve default prior for a named distribution, term type, or family. Args: dist (str): Name of desired distribution. Note that the name is the key in the defaults dictionary, not the name of the Distribut...
[ "def", "get", "(", "self", ",", "dist", "=", "None", ",", "term", "=", "None", ",", "family", "=", "None", ")", ":", "if", "dist", "is", "not", "None", ":", "if", "dist", "not", "in", "self", ".", "dists", ":", "raise", "ValueError", "(", "\"'%s'...
Retrieve default prior for a named distribution, term type, or family. Args: dist (str): Name of desired distribution. Note that the name is the key in the defaults dictionary, not the name of the Distribution object used to construct the prior. term (str...
[ "Retrieve", "default", "prior", "for", "a", "named", "distribution", "term", "type", "or", "family", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/priors.py#L153-L181
227,366
bambinos/bambi
bambi/backends/stan.py
StanBackEnd.reset
def reset(self): ''' Reset Stan model and all tracked distributions and parameters. ''' self.parameters = [] self.transformed_parameters = [] self.expressions = [] self.data = [] self.transformed_data = [] self.X = {} self.model = [] ...
python
def reset(self): ''' Reset Stan model and all tracked distributions and parameters. ''' self.parameters = [] self.transformed_parameters = [] self.expressions = [] self.data = [] self.transformed_data = [] self.X = {} self.model = [] ...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "parameters", "=", "[", "]", "self", ".", "transformed_parameters", "=", "[", "]", "self", ".", "expressions", "=", "[", "]", "self", ".", "data", "=", "[", "]", "self", ".", "transformed_data", "="...
Reset Stan model and all tracked distributions and parameters.
[ "Reset", "Stan", "model", "and", "all", "tracked", "distributions", "and", "parameters", "." ]
b4a0ced917968bb99ca20915317417d708387946
https://github.com/bambinos/bambi/blob/b4a0ced917968bb99ca20915317417d708387946/bambi/backends/stan.py#L63-L80
227,367
nfcpy/nfcpy
src/nfc/clf/rcs956.py
Chipset.reset_mode
def reset_mode(self): """Send a Reset command to set the operation mode to 0.""" self.command(0x18, b"\x01", timeout=0.1) self.transport.write(Chipset.ACK) time.sleep(0.010)
python
def reset_mode(self): """Send a Reset command to set the operation mode to 0.""" self.command(0x18, b"\x01", timeout=0.1) self.transport.write(Chipset.ACK) time.sleep(0.010)
[ "def", "reset_mode", "(", "self", ")", ":", "self", ".", "command", "(", "0x18", ",", "b\"\\x01\"", ",", "timeout", "=", "0.1", ")", "self", ".", "transport", ".", "write", "(", "Chipset", ".", "ACK", ")", "time", ".", "sleep", "(", "0.010", ")" ]
Send a Reset command to set the operation mode to 0.
[ "Send", "a", "Reset", "command", "to", "set", "the", "operation", "mode", "to", "0", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/rcs956.py#L149-L153
227,368
nfcpy/nfcpy
src/nfc/clf/rcs956.py
Device.sense_ttb
def sense_ttb(self, target): """Activate the RF field and probe for a Type B Target. The RC-S956 can discover Type B Targets (Type 4B Tag) at 106 kbps. For a Type 4B Tag the firmware automatically sends an ATTRIB command that configures the use of DID and 64 byte maximum frame s...
python
def sense_ttb(self, target): """Activate the RF field and probe for a Type B Target. The RC-S956 can discover Type B Targets (Type 4B Tag) at 106 kbps. For a Type 4B Tag the firmware automatically sends an ATTRIB command that configures the use of DID and 64 byte maximum frame s...
[ "def", "sense_ttb", "(", "self", ",", "target", ")", ":", "return", "super", "(", "Device", ",", "self", ")", ".", "sense_ttb", "(", "target", ",", "did", "=", "b'\\x01'", ")" ]
Activate the RF field and probe for a Type B Target. The RC-S956 can discover Type B Targets (Type 4B Tag) at 106 kbps. For a Type 4B Tag the firmware automatically sends an ATTRIB command that configures the use of DID and 64 byte maximum frame size. The driver reverts this configurati...
[ "Activate", "the", "RF", "field", "and", "probe", "for", "a", "Type", "B", "Target", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/rcs956.py#L231-L242
227,369
nfcpy/nfcpy
src/nfc/clf/rcs956.py
Device.sense_dep
def sense_dep(self, target): """Search for a DEP Target in active or passive communication mode. """ # Set timeout for PSL_RES and ATR_RES self.chipset.rf_configuration(0x02, b"\x0B\x0B\x0A") return super(Device, self).sense_dep(target)
python
def sense_dep(self, target): """Search for a DEP Target in active or passive communication mode. """ # Set timeout for PSL_RES and ATR_RES self.chipset.rf_configuration(0x02, b"\x0B\x0B\x0A") return super(Device, self).sense_dep(target)
[ "def", "sense_dep", "(", "self", ",", "target", ")", ":", "# Set timeout for PSL_RES and ATR_RES", "self", ".", "chipset", ".", "rf_configuration", "(", "0x02", ",", "b\"\\x0B\\x0B\\x0A\"", ")", "return", "super", "(", "Device", ",", "self", ")", ".", "sense_dep...
Search for a DEP Target in active or passive communication mode.
[ "Search", "for", "a", "DEP", "Target", "in", "active", "or", "passive", "communication", "mode", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/rcs956.py#L250-L256
227,370
nfcpy/nfcpy
src/nfc/handover/client.py
HandoverClient.send
def send(self, message): """Send a handover request message to the remote server.""" log.debug("sending '{0}' message".format(message.type)) send_miu = self.socket.getsockopt(nfc.llcp.SO_SNDMIU) try: data = str(message) except nfc.llcp.EncodeError as e: lo...
python
def send(self, message): """Send a handover request message to the remote server.""" log.debug("sending '{0}' message".format(message.type)) send_miu = self.socket.getsockopt(nfc.llcp.SO_SNDMIU) try: data = str(message) except nfc.llcp.EncodeError as e: lo...
[ "def", "send", "(", "self", ",", "message", ")", ":", "log", ".", "debug", "(", "\"sending '{0}' message\"", ".", "format", "(", "message", ".", "type", ")", ")", "send_miu", "=", "self", ".", "socket", ".", "getsockopt", "(", "nfc", ".", "llcp", ".", ...
Send a handover request message to the remote server.
[ "Send", "a", "handover", "request", "message", "to", "the", "remote", "server", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/handover/client.py#L59-L68
227,371
nfcpy/nfcpy
src/nfc/handover/client.py
HandoverClient.recv
def recv(self, timeout=None): """Receive a handover select message from the remote server.""" message = self._recv(timeout) if message and message.type == "urn:nfc:wkt:Hs": log.debug("received '{0}' message".format(message.type)) return nfc.ndef.HandoverSelectMessage(mess...
python
def recv(self, timeout=None): """Receive a handover select message from the remote server.""" message = self._recv(timeout) if message and message.type == "urn:nfc:wkt:Hs": log.debug("received '{0}' message".format(message.type)) return nfc.ndef.HandoverSelectMessage(mess...
[ "def", "recv", "(", "self", ",", "timeout", "=", "None", ")", ":", "message", "=", "self", ".", "_recv", "(", "timeout", ")", "if", "message", "and", "message", ".", "type", "==", "\"urn:nfc:wkt:Hs\"", ":", "log", ".", "debug", "(", "\"received '{0}' mes...
Receive a handover select message from the remote server.
[ "Receive", "a", "handover", "select", "message", "from", "the", "remote", "server", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/handover/client.py#L78-L86
227,372
nfcpy/nfcpy
src/nfc/clf/pn531.py
Device.sense_ttb
def sense_ttb(self, target): """Sense for a Type B Target is not supported.""" info = "{device} does not support sense for Type B Target" raise nfc.clf.UnsupportedTargetError(info.format(device=self))
python
def sense_ttb(self, target): """Sense for a Type B Target is not supported.""" info = "{device} does not support sense for Type B Target" raise nfc.clf.UnsupportedTargetError(info.format(device=self))
[ "def", "sense_ttb", "(", "self", ",", "target", ")", ":", "info", "=", "\"{device} does not support sense for Type B Target\"", "raise", "nfc", ".", "clf", ".", "UnsupportedTargetError", "(", "info", ".", "format", "(", "device", "=", "self", ")", ")" ]
Sense for a Type B Target is not supported.
[ "Sense", "for", "a", "Type", "B", "Target", "is", "not", "supported", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/pn531.py#L231-L234
227,373
nfcpy/nfcpy
src/nfc/clf/pn531.py
Device.sense_dep
def sense_dep(self, target): """Search for a DEP Target in active communication mode. Because the PN531 does not implement the extended frame syntax for host controller communication, it can not support the maximum payload size of 254 byte. The driver handles this by modifying t...
python
def sense_dep(self, target): """Search for a DEP Target in active communication mode. Because the PN531 does not implement the extended frame syntax for host controller communication, it can not support the maximum payload size of 254 byte. The driver handles this by modifying t...
[ "def", "sense_dep", "(", "self", ",", "target", ")", ":", "if", "target", ".", "atr_req", "[", "15", "]", "&", "0x30", "==", "0x30", ":", "self", ".", "log", ".", "warning", "(", "\"must reduce the max payload size in atr_req\"", ")", "target", ".", "atr_r...
Search for a DEP Target in active communication mode. Because the PN531 does not implement the extended frame syntax for host controller communication, it can not support the maximum payload size of 254 byte. The driver handles this by modifying the length-reduction values in atr_req an...
[ "Search", "for", "a", "DEP", "Target", "in", "active", "communication", "mode", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/pn531.py#L242-L263
227,374
nfcpy/nfcpy
src/nfc/tag/tt2_nxp.py
NTAG203.protect
def protect(self, password=None, read_protect=False, protect_from=0): """Set lock bits to disable future memory modifications. If *password* is None, all memory pages except the 16-bit counter in page 41 are protected by setting the relevant lock bits (note that lock bits can not be res...
python
def protect(self, password=None, read_protect=False, protect_from=0): """Set lock bits to disable future memory modifications. If *password* is None, all memory pages except the 16-bit counter in page 41 are protected by setting the relevant lock bits (note that lock bits can not be res...
[ "def", "protect", "(", "self", ",", "password", "=", "None", ",", "read_protect", "=", "False", ",", "protect_from", "=", "0", ")", ":", "return", "super", "(", "NTAG203", ",", "self", ")", ".", "protect", "(", "password", ",", "read_protect", ",", "pr...
Set lock bits to disable future memory modifications. If *password* is None, all memory pages except the 16-bit counter in page 41 are protected by setting the relevant lock bits (note that lock bits can not be reset). If valid NDEF management data is found in page 4, protect() also set...
[ "Set", "lock", "bits", "to", "disable", "future", "memory", "modifications", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2_nxp.py#L268-L283
227,375
nfcpy/nfcpy
src/nfc/tag/tt2_nxp.py
NTAG21x.signature
def signature(self): """The 32-byte ECC tag signature programmed at chip production. The signature is provided as a string and can only be read. The signature attribute is always loaded from the tag when it is accessed, i.e. it is not cached. If communication with the tag fails ...
python
def signature(self): """The 32-byte ECC tag signature programmed at chip production. The signature is provided as a string and can only be read. The signature attribute is always loaded from the tag when it is accessed, i.e. it is not cached. If communication with the tag fails ...
[ "def", "signature", "(", "self", ")", ":", "log", ".", "debug", "(", "\"read tag signature\"", ")", "try", ":", "return", "bytes", "(", "self", ".", "transceive", "(", "b\"\\x3C\\x00\"", ")", ")", "except", "tt2", ".", "Type2TagCommandError", ":", "return", ...
The 32-byte ECC tag signature programmed at chip production. The signature is provided as a string and can only be read. The signature attribute is always loaded from the tag when it is accessed, i.e. it is not cached. If communication with the tag fails for some reason the signature at...
[ "The", "32", "-", "byte", "ECC", "tag", "signature", "programmed", "at", "chip", "production", ".", "The", "signature", "is", "provided", "as", "a", "string", "and", "can", "only", "be", "read", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2_nxp.py#L330-L344
227,376
nfcpy/nfcpy
src/nfc/tag/tt2_nxp.py
NTAG21x.protect
def protect(self, password=None, read_protect=False, protect_from=0): """Set password protection or permanent lock bits. If the *password* argument is None, all memory pages will be protected by setting the relevant lock bits (note that lock bits can not be reset). If valid NDEF managem...
python
def protect(self, password=None, read_protect=False, protect_from=0): """Set password protection or permanent lock bits. If the *password* argument is None, all memory pages will be protected by setting the relevant lock bits (note that lock bits can not be reset). If valid NDEF managem...
[ "def", "protect", "(", "self", ",", "password", "=", "None", ",", "read_protect", "=", "False", ",", "protect_from", "=", "0", ")", ":", "args", "=", "(", "password", ",", "read_protect", ",", "protect_from", ")", "return", "super", "(", "NTAG21x", ",", ...
Set password protection or permanent lock bits. If the *password* argument is None, all memory pages will be protected by setting the relevant lock bits (note that lock bits can not be reset). If valid NDEF management data is found, protect() also sets the NDEF write flag to read-only. ...
[ "Set", "password", "protection", "or", "permanent", "lock", "bits", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2_nxp.py#L346-L374
227,377
nfcpy/nfcpy
src/nfc/clf/device.py
Device.mute
def mute(self): """Mutes all existing communication, most notably the device will no longer generate a 13.56 MHz carrier signal when operating as Initiator. """ fname = "mute" cname = self.__class__.__module__ + '.' + self.__class__.__name__ raise NotImplementedE...
python
def mute(self): """Mutes all existing communication, most notably the device will no longer generate a 13.56 MHz carrier signal when operating as Initiator. """ fname = "mute" cname = self.__class__.__module__ + '.' + self.__class__.__name__ raise NotImplementedE...
[ "def", "mute", "(", "self", ")", ":", "fname", "=", "\"mute\"", "cname", "=", "self", ".", "__class__", ".", "__module__", "+", "'.'", "+", "self", ".", "__class__", ".", "__name__", "raise", "NotImplementedError", "(", "\"%s.%s() is required\"", "%", "(", ...
Mutes all existing communication, most notably the device will no longer generate a 13.56 MHz carrier signal when operating as Initiator.
[ "Mutes", "all", "existing", "communication", "most", "notably", "the", "device", "will", "no", "longer", "generate", "a", "13", ".", "56", "MHz", "carrier", "signal", "when", "operating", "as", "Initiator", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/device.py#L174-L182
227,378
nfcpy/nfcpy
src/nfc/clf/device.py
Device.listen_tta
def listen_tta(self, target, timeout): """Listen as Type A Target. Waits to receive a SENS_REQ command at the bitrate set by **target.brty** and sends the **target.sens_res** response. Depending on the SENS_RES bytes, the Initiator then sends an RID_CMD (SENS_RES coded for a Typ...
python
def listen_tta(self, target, timeout): """Listen as Type A Target. Waits to receive a SENS_REQ command at the bitrate set by **target.brty** and sends the **target.sens_res** response. Depending on the SENS_RES bytes, the Initiator then sends an RID_CMD (SENS_RES coded for a Typ...
[ "def", "listen_tta", "(", "self", ",", "target", ",", "timeout", ")", ":", "fname", "=", "\"listen_tta\"", "cname", "=", "self", ".", "__class__", ".", "__module__", "+", "'.'", "+", "self", ".", "__class__", ".", "__name__", "raise", "NotImplementedError", ...
Listen as Type A Target. Waits to receive a SENS_REQ command at the bitrate set by **target.brty** and sends the **target.sens_res** response. Depending on the SENS_RES bytes, the Initiator then sends an RID_CMD (SENS_RES coded for a Type 1 Tag) or SDD_REQ and SEL_REQ (SENS_RES ...
[ "Listen", "as", "Type", "A", "Target", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/device.py#L324-L369
227,379
nfcpy/nfcpy
src/nfc/clf/device.py
Device.send_cmd_recv_rsp
def send_cmd_recv_rsp(self, target, data, timeout): """Exchange data with a remote Target Sends command *data* to the remote *target* discovered in the most recent call to one of the sense_xxx() methods. Note that *target* becomes invalid with any call to mute(), sense_xxx() or ...
python
def send_cmd_recv_rsp(self, target, data, timeout): """Exchange data with a remote Target Sends command *data* to the remote *target* discovered in the most recent call to one of the sense_xxx() methods. Note that *target* becomes invalid with any call to mute(), sense_xxx() or ...
[ "def", "send_cmd_recv_rsp", "(", "self", ",", "target", ",", "data", ",", "timeout", ")", ":", "fname", "=", "\"send_cmd_recv_rsp\"", "cname", "=", "self", ".", "__class__", ".", "__module__", "+", "'.'", "+", "self", ".", "__class__", ".", "__name__", "ra...
Exchange data with a remote Target Sends command *data* to the remote *target* discovered in the most recent call to one of the sense_xxx() methods. Note that *target* becomes invalid with any call to mute(), sense_xxx() or listen_xxx() Arguments: target (nfc.clf.Rem...
[ "Exchange", "data", "with", "a", "remote", "Target" ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/device.py#L496-L526
227,380
nfcpy/nfcpy
src/nfc/clf/device.py
Device.get_max_recv_data_size
def get_max_recv_data_size(self, target): """Returns the maximum number of data bytes for receiving. The maximum number of data bytes acceptable for receiving with either :meth:`send_cmd_recv_rsp` or :meth:`send_rsp_recv_cmd`. The value reflects the local device capabilities for receivi...
python
def get_max_recv_data_size(self, target): """Returns the maximum number of data bytes for receiving. The maximum number of data bytes acceptable for receiving with either :meth:`send_cmd_recv_rsp` or :meth:`send_rsp_recv_cmd`. The value reflects the local device capabilities for receivi...
[ "def", "get_max_recv_data_size", "(", "self", ",", "target", ")", ":", "fname", "=", "\"get_max_recv_data_size\"", "cname", "=", "self", ".", "__class__", ".", "__module__", "+", "'.'", "+", "self", ".", "__class__", ".", "__name__", "raise", "NotImplementedErro...
Returns the maximum number of data bytes for receiving. The maximum number of data bytes acceptable for receiving with either :meth:`send_cmd_recv_rsp` or :meth:`send_rsp_recv_cmd`. The value reflects the local device capabilities for receiving in the mode determined by *target*. It doe...
[ "Returns", "the", "maximum", "number", "of", "data", "bytes", "for", "receiving", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/clf/device.py#L583-L604
227,381
nfcpy/nfcpy
src/nfc/tag/tt2.py
Type2Tag.format
def format(self, version=None, wipe=None): """Erase the NDEF message on a Type 2 Tag. The :meth:`format` method will reset the length of the NDEF message on a type 2 tag to zero, thus the tag will appear to be empty. Additionally, if the *wipe* argument is set to some integer th...
python
def format(self, version=None, wipe=None): """Erase the NDEF message on a Type 2 Tag. The :meth:`format` method will reset the length of the NDEF message on a type 2 tag to zero, thus the tag will appear to be empty. Additionally, if the *wipe* argument is set to some integer th...
[ "def", "format", "(", "self", ",", "version", "=", "None", ",", "wipe", "=", "None", ")", ":", "return", "super", "(", "Type2Tag", ",", "self", ")", ".", "format", "(", "version", ",", "wipe", ")" ]
Erase the NDEF message on a Type 2 Tag. The :meth:`format` method will reset the length of the NDEF message on a type 2 tag to zero, thus the tag will appear to be empty. Additionally, if the *wipe* argument is set to some integer then :meth:`format` will overwrite all user date that ...
[ "Erase", "the", "NDEF", "message", "on", "a", "Type", "2", "Tag", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2.py#L346-L368
227,382
nfcpy/nfcpy
src/nfc/tag/tt2.py
Type2Tag.protect
def protect(self, password=None, read_protect=False, protect_from=0): """Protect the tag against write access, i.e. make it read-only. :meth:`Type2Tag.protect` switches an NFC Forum Type 2 Tag to read-only state by setting all lock bits to 1. This operation can not be reversed. If the t...
python
def protect(self, password=None, read_protect=False, protect_from=0): """Protect the tag against write access, i.e. make it read-only. :meth:`Type2Tag.protect` switches an NFC Forum Type 2 Tag to read-only state by setting all lock bits to 1. This operation can not be reversed. If the t...
[ "def", "protect", "(", "self", ",", "password", "=", "None", ",", "read_protect", "=", "False", ",", "protect_from", "=", "0", ")", ":", "return", "super", "(", "Type2Tag", ",", "self", ")", ".", "protect", "(", "password", ",", "read_protect", ",", "p...
Protect the tag against write access, i.e. make it read-only. :meth:`Type2Tag.protect` switches an NFC Forum Type 2 Tag to read-only state by setting all lock bits to 1. This operation can not be reversed. If the tag is not an NFC Forum Tag, i.e. it is not formatted with an NDEF Capabil...
[ "Protect", "the", "tag", "against", "write", "access", "i", ".", "e", ".", "make", "it", "read", "-", "only", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2.py#L385-L402
227,383
nfcpy/nfcpy
src/nfc/tag/tt2.py
Type2Tag.read
def read(self, page): """Send a READ command to retrieve data from the tag. The *page* argument specifies the offset in multiples of 4 bytes (i.e. page number 1 will return bytes 4 to 19). The data returned is a byte array of length 16 or None if the block is outside the readabl...
python
def read(self, page): """Send a READ command to retrieve data from the tag. The *page* argument specifies the offset in multiples of 4 bytes (i.e. page number 1 will return bytes 4 to 19). The data returned is a byte array of length 16 or None if the block is outside the readabl...
[ "def", "read", "(", "self", ",", "page", ")", ":", "log", ".", "debug", "(", "\"read pages {0} to {1}\"", ".", "format", "(", "page", ",", "page", "+", "3", ")", ")", "data", "=", "self", ".", "transceive", "(", "\"\\x30\"", "+", "chr", "(", "page", ...
Send a READ command to retrieve data from the tag. The *page* argument specifies the offset in multiples of 4 bytes (i.e. page number 1 will return bytes 4 to 19). The data returned is a byte array of length 16 or None if the block is outside the readable memory range. Command ...
[ "Send", "a", "READ", "command", "to", "retrieve", "data", "from", "the", "tag", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2.py#L468-L494
227,384
nfcpy/nfcpy
src/nfc/tag/tt2.py
Type2Tag.write
def write(self, page, data): """Send a WRITE command to store data on the tag. The *page* argument specifies the offset in multiples of 4 bytes. The *data* argument must be a string or bytearray of length 4. Command execution errors raise :exc:`Type2TagCommandError`. "...
python
def write(self, page, data): """Send a WRITE command to store data on the tag. The *page* argument specifies the offset in multiples of 4 bytes. The *data* argument must be a string or bytearray of length 4. Command execution errors raise :exc:`Type2TagCommandError`. "...
[ "def", "write", "(", "self", ",", "page", ",", "data", ")", ":", "if", "len", "(", "data", ")", "!=", "4", ":", "raise", "ValueError", "(", "\"data must be a four byte string or array\"", ")", "log", ".", "debug", "(", "\"write {0} to page {1}\"", ".", "form...
Send a WRITE command to store data on the tag. The *page* argument specifies the offset in multiples of 4 bytes. The *data* argument must be a string or bytearray of length 4. Command execution errors raise :exc:`Type2TagCommandError`.
[ "Send", "a", "WRITE", "command", "to", "store", "data", "on", "the", "tag", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2.py#L496-L520
227,385
nfcpy/nfcpy
src/nfc/tag/tt2.py
Type2Tag.sector_select
def sector_select(self, sector): """Send a SECTOR_SELECT command to switch the 1K address sector. The command is only send to the tag if the *sector* number is different from the currently selected sector number (set to 0 when the tag instance is created). If the command was suc...
python
def sector_select(self, sector): """Send a SECTOR_SELECT command to switch the 1K address sector. The command is only send to the tag if the *sector* number is different from the currently selected sector number (set to 0 when the tag instance is created). If the command was suc...
[ "def", "sector_select", "(", "self", ",", "sector", ")", ":", "if", "sector", "!=", "self", ".", "_current_sector", ":", "log", ".", "debug", "(", "\"select sector {0} (pages {1} to {2})\"", ".", "format", "(", "sector", ",", "sector", "<<", "10", ",", "(", ...
Send a SECTOR_SELECT command to switch the 1K address sector. The command is only send to the tag if the *sector* number is different from the currently selected sector number (set to 0 when the tag instance is created). If the command was successful, the currently selected sector numbe...
[ "Send", "a", "SECTOR_SELECT", "command", "to", "switch", "the", "1K", "address", "sector", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2.py#L522-L559
227,386
nfcpy/nfcpy
src/nfc/tag/tt2.py
Type2Tag.transceive
def transceive(self, data, timeout=0.1, retries=2): """Send a Type 2 Tag command and receive the response. :meth:`transceive` is a type 2 tag specific wrapper around the :meth:`nfc.ContactlessFrontend.exchange` method. It can be used to send custom commands as a sequence of *data* bytes...
python
def transceive(self, data, timeout=0.1, retries=2): """Send a Type 2 Tag command and receive the response. :meth:`transceive` is a type 2 tag specific wrapper around the :meth:`nfc.ContactlessFrontend.exchange` method. It can be used to send custom commands as a sequence of *data* bytes...
[ "def", "transceive", "(", "self", ",", "data", ",", "timeout", "=", "0.1", ",", "retries", "=", "2", ")", ":", "log", ".", "debug", "(", "\">> {0} ({1:f}s)\"", ".", "format", "(", "hexlify", "(", "data", ")", ",", "timeout", ")", ")", "if", "not", ...
Send a Type 2 Tag command and receive the response. :meth:`transceive` is a type 2 tag specific wrapper around the :meth:`nfc.ContactlessFrontend.exchange` method. It can be used to send custom commands as a sequence of *data* bytes to the tag and receive the response data bytes. If *ti...
[ "Send", "a", "Type", "2", "Tag", "command", "and", "receive", "the", "response", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt2.py#L561-L603
227,387
nfcpy/nfcpy
src/nfc/llcp/socket.py
Socket.setsockopt
def setsockopt(self, option, value): """Set the value of the given socket option and return the current value which may have been corrected if it was out of bounds.""" return self.llc.setsockopt(self._tco, option, value)
python
def setsockopt(self, option, value): """Set the value of the given socket option and return the current value which may have been corrected if it was out of bounds.""" return self.llc.setsockopt(self._tco, option, value)
[ "def", "setsockopt", "(", "self", ",", "option", ",", "value", ")", ":", "return", "self", ".", "llc", ".", "setsockopt", "(", "self", ".", "_tco", ",", "option", ",", "value", ")" ]
Set the value of the given socket option and return the current value which may have been corrected if it was out of bounds.
[ "Set", "the", "value", "of", "the", "given", "socket", "option", "and", "return", "the", "current", "value", "which", "may", "have", "been", "corrected", "if", "it", "was", "out", "of", "bounds", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/llcp/socket.py#L64-L68
227,388
nfcpy/nfcpy
src/nfc/llcp/socket.py
Socket.accept
def accept(self): """Accept a connection. The socket must be bound to an address and listening for connections. The return value is a new socket object usable to send and receive data on the connection.""" socket = Socket(self._llc, None) socket._tco = self.llc.accept(sel...
python
def accept(self): """Accept a connection. The socket must be bound to an address and listening for connections. The return value is a new socket object usable to send and receive data on the connection.""" socket = Socket(self._llc, None) socket._tco = self.llc.accept(sel...
[ "def", "accept", "(", "self", ")", ":", "socket", "=", "Socket", "(", "self", ".", "_llc", ",", "None", ")", "socket", ".", "_tco", "=", "self", ".", "llc", ".", "accept", "(", "self", ".", "_tco", ")", "return", "socket" ]
Accept a connection. The socket must be bound to an address and listening for connections. The return value is a new socket object usable to send and receive data on the connection.
[ "Accept", "a", "connection", ".", "The", "socket", "must", "be", "bound", "to", "an", "address", "and", "listening", "for", "connections", ".", "The", "return", "value", "is", "a", "new", "socket", "object", "usable", "to", "send", "and", "receive", "data"...
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/llcp/socket.py#L102-L109
227,389
nfcpy/nfcpy
src/nfc/llcp/socket.py
Socket.send
def send(self, data, flags=0): """Send data to the socket. The socket must be connected to a remote socket. Returns a boolean value that indicates success or failure. A false value is typically an indication that the socket or connection was closed. """ return self.llc.s...
python
def send(self, data, flags=0): """Send data to the socket. The socket must be connected to a remote socket. Returns a boolean value that indicates success or failure. A false value is typically an indication that the socket or connection was closed. """ return self.llc.s...
[ "def", "send", "(", "self", ",", "data", ",", "flags", "=", "0", ")", ":", "return", "self", ".", "llc", ".", "send", "(", "self", ".", "_tco", ",", "data", ",", "flags", ")" ]
Send data to the socket. The socket must be connected to a remote socket. Returns a boolean value that indicates success or failure. A false value is typically an indication that the socket or connection was closed.
[ "Send", "data", "to", "the", "socket", ".", "The", "socket", "must", "be", "connected", "to", "a", "remote", "socket", ".", "Returns", "a", "boolean", "value", "that", "indicates", "success", "or", "failure", ".", "A", "false", "value", "is", "typically", ...
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/llcp/socket.py#L111-L118
227,390
nfcpy/nfcpy
src/nfc/llcp/socket.py
Socket.sendto
def sendto(self, data, addr, flags=0): """Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by addr. Returns a boolean value that indicates success or failure. Failure to send is generally an indication that ...
python
def sendto(self, data, addr, flags=0): """Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by addr. Returns a boolean value that indicates success or failure. Failure to send is generally an indication that ...
[ "def", "sendto", "(", "self", ",", "data", ",", "addr", ",", "flags", "=", "0", ")", ":", "return", "self", ".", "llc", ".", "sendto", "(", "self", ".", "_tco", ",", "data", ",", "addr", ",", "flags", ")" ]
Send data to the socket. The socket should not be connected to a remote socket, since the destination socket is specified by addr. Returns a boolean value that indicates success or failure. Failure to send is generally an indication that the socket was closed.
[ "Send", "data", "to", "the", "socket", ".", "The", "socket", "should", "not", "be", "connected", "to", "a", "remote", "socket", "since", "the", "destination", "socket", "is", "specified", "by", "addr", ".", "Returns", "a", "boolean", "value", "that", "indi...
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/llcp/socket.py#L120-L126
227,391
nfcpy/nfcpy
src/nfc/ndef/bt_record.py
BluetoothConfigRecord.simple_pairing_hash
def simple_pairing_hash(self): """Simple Pairing Hash C. Received and transmitted as EIR type 0x0E. Set to None if not received or not to be transmitted. Raises nfc.ndef.DecodeError if the received value or nfc.ndef.EncodeError if the assigned value is not a sequence of 16 octets...
python
def simple_pairing_hash(self): """Simple Pairing Hash C. Received and transmitted as EIR type 0x0E. Set to None if not received or not to be transmitted. Raises nfc.ndef.DecodeError if the received value or nfc.ndef.EncodeError if the assigned value is not a sequence of 16 octets...
[ "def", "simple_pairing_hash", "(", "self", ")", ":", "try", ":", "if", "len", "(", "self", ".", "eir", "[", "0x0E", "]", ")", "!=", "16", ":", "raise", "DecodeError", "(", "\"wrong length of simple pairing hash\"", ")", "return", "bytearray", "(", "self", ...
Simple Pairing Hash C. Received and transmitted as EIR type 0x0E. Set to None if not received or not to be transmitted. Raises nfc.ndef.DecodeError if the received value or nfc.ndef.EncodeError if the assigned value is not a sequence of 16 octets.
[ "Simple", "Pairing", "Hash", "C", ".", "Received", "and", "transmitted", "as", "EIR", "type", "0x0E", ".", "Set", "to", "None", "if", "not", "received", "or", "not", "to", "be", "transmitted", ".", "Raises", "nfc", ".", "ndef", ".", "DecodeError", "if", ...
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/ndef/bt_record.py#L101-L112
227,392
nfcpy/nfcpy
src/nfc/ndef/bt_record.py
BluetoothConfigRecord.simple_pairing_rand
def simple_pairing_rand(self): """Simple Pairing Randomizer R. Received and transmitted as EIR type 0x0F. Set to None if not received or not to be transmitted. Raises nfc.ndef.DecodeError if the received value or nfc.ndef.EncodeError if the assigned value is not a sequence of 16 ...
python
def simple_pairing_rand(self): """Simple Pairing Randomizer R. Received and transmitted as EIR type 0x0F. Set to None if not received or not to be transmitted. Raises nfc.ndef.DecodeError if the received value or nfc.ndef.EncodeError if the assigned value is not a sequence of 16 ...
[ "def", "simple_pairing_rand", "(", "self", ")", ":", "try", ":", "if", "len", "(", "self", ".", "eir", "[", "0x0F", "]", ")", "!=", "16", ":", "raise", "DecodeError", "(", "\"wrong length of simple pairing hash\"", ")", "return", "bytearray", "(", "self", ...
Simple Pairing Randomizer R. Received and transmitted as EIR type 0x0F. Set to None if not received or not to be transmitted. Raises nfc.ndef.DecodeError if the received value or nfc.ndef.EncodeError if the assigned value is not a sequence of 16 octets.
[ "Simple", "Pairing", "Randomizer", "R", ".", "Received", "and", "transmitted", "as", "EIR", "type", "0x0F", ".", "Set", "to", "None", "if", "not", "received", "or", "not", "to", "be", "transmitted", ".", "Raises", "nfc", ".", "ndef", ".", "DecodeError", ...
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/ndef/bt_record.py#L124-L135
227,393
nfcpy/nfcpy
src/nfc/ndef/handover.py
HandoverRequestMessage.add_carrier
def add_carrier(self, carrier_record, power_state, aux_data_records=None): """Add a new carrier to the handover request message. :param carrier_record: a record providing carrier information :param power_state: a string describing the carrier power state :param aux_data_records: list of...
python
def add_carrier(self, carrier_record, power_state, aux_data_records=None): """Add a new carrier to the handover request message. :param carrier_record: a record providing carrier information :param power_state: a string describing the carrier power state :param aux_data_records: list of...
[ "def", "add_carrier", "(", "self", ",", "carrier_record", ",", "power_state", ",", "aux_data_records", "=", "None", ")", ":", "carrier", "=", "Carrier", "(", "carrier_record", ",", "power_state", ")", "if", "aux_data_records", "is", "not", "None", ":", "for", ...
Add a new carrier to the handover request message. :param carrier_record: a record providing carrier information :param power_state: a string describing the carrier power state :param aux_data_records: list of auxiliary data records :type carrier_record: :class:`nfc.ndef.Record` ...
[ "Add", "a", "new", "carrier", "to", "the", "handover", "request", "message", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/ndef/handover.py#L172-L189
227,394
nfcpy/nfcpy
src/nfc/ndef/handover.py
HandoverSelectMessage.pretty
def pretty(self, indent=0): """Returns a string with a formatted representation that might be considered pretty-printable.""" indent = indent * ' ' lines = list() version_string = "{v.major}.{v.minor}".format(v=self.version) lines.append(("handover version", version_strin...
python
def pretty(self, indent=0): """Returns a string with a formatted representation that might be considered pretty-printable.""" indent = indent * ' ' lines = list() version_string = "{v.major}.{v.minor}".format(v=self.version) lines.append(("handover version", version_strin...
[ "def", "pretty", "(", "self", ",", "indent", "=", "0", ")", ":", "indent", "=", "indent", "*", "' '", "lines", "=", "list", "(", ")", "version_string", "=", "\"{v.major}.{v.minor}\"", ".", "format", "(", "v", "=", "self", ".", "version", ")", "lines", ...
Returns a string with a formatted representation that might be considered pretty-printable.
[ "Returns", "a", "string", "with", "a", "formatted", "representation", "that", "might", "be", "considered", "pretty", "-", "printable", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/ndef/handover.py#L431-L468
227,395
nfcpy/nfcpy
src/nfc/dep.py
Target.activate
def activate(self, timeout=None, **options): """Activate DEP communication as a target.""" if timeout is None: timeout = 1.0 gbt = options.get('gbt', '')[0:47] lrt = min(max(0, options.get('lrt', 3)), 3) rwt = min(max(0, options.get('rwt', 8)), 14) pp = (lrt...
python
def activate(self, timeout=None, **options): """Activate DEP communication as a target.""" if timeout is None: timeout = 1.0 gbt = options.get('gbt', '')[0:47] lrt = min(max(0, options.get('lrt', 3)), 3) rwt = min(max(0, options.get('rwt', 8)), 14) pp = (lrt...
[ "def", "activate", "(", "self", ",", "timeout", "=", "None", ",", "*", "*", "options", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "1.0", "gbt", "=", "options", ".", "get", "(", "'gbt'", ",", "''", ")", "[", "0", ":", "47", "]...
Activate DEP communication as a target.
[ "Activate", "DEP", "communication", "as", "a", "target", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/dep.py#L417-L460
227,396
nfcpy/nfcpy
src/nfc/ndef/message.py
Message.pretty
def pretty(self): """Returns a message representation that might be considered pretty-printable.""" lines = list() for index, record in enumerate(self._records): lines.append(("record {0}".format(index+1),)) lines.append((" type", repr(record.type))) ...
python
def pretty(self): """Returns a message representation that might be considered pretty-printable.""" lines = list() for index, record in enumerate(self._records): lines.append(("record {0}".format(index+1),)) lines.append((" type", repr(record.type))) ...
[ "def", "pretty", "(", "self", ")", ":", "lines", "=", "list", "(", ")", "for", "index", ",", "record", "in", "enumerate", "(", "self", ".", "_records", ")", ":", "lines", ".", "append", "(", "(", "\"record {0}\"", ".", "format", "(", "index", "+", ...
Returns a message representation that might be considered pretty-printable.
[ "Returns", "a", "message", "representation", "that", "might", "be", "considered", "pretty", "-", "printable", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/ndef/message.py#L161-L173
227,397
nfcpy/nfcpy
src/nfc/tag/tt1_broadcom.py
Topaz.format
def format(self, version=None, wipe=None): """Format a Topaz tag for NDEF use. The implementation of :meth:`nfc.tag.Tag.format` for a Topaz tag creates a capability container and an NDEF TLV with length zero. Data bytes of the NDEF data area are left untouched unless the wipe ar...
python
def format(self, version=None, wipe=None): """Format a Topaz tag for NDEF use. The implementation of :meth:`nfc.tag.Tag.format` for a Topaz tag creates a capability container and an NDEF TLV with length zero. Data bytes of the NDEF data area are left untouched unless the wipe ar...
[ "def", "format", "(", "self", ",", "version", "=", "None", ",", "wipe", "=", "None", ")", ":", "return", "super", "(", "Topaz", ",", "self", ")", ".", "format", "(", "version", ",", "wipe", ")" ]
Format a Topaz tag for NDEF use. The implementation of :meth:`nfc.tag.Tag.format` for a Topaz tag creates a capability container and an NDEF TLV with length zero. Data bytes of the NDEF data area are left untouched unless the wipe argument is set.
[ "Format", "a", "Topaz", "tag", "for", "NDEF", "use", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt1_broadcom.py#L40-L49
227,398
nfcpy/nfcpy
src/nfc/tag/tt1_broadcom.py
Topaz512.format
def format(self, version=None, wipe=None): """Format a Topaz-512 tag for NDEF use. The implementation of :meth:`nfc.tag.Tag.format` for a Topaz-512 tag creates a capability container, a Lock Control and a Memory Control TLV, and an NDEF TLV with length zero. Data bytes of the ND...
python
def format(self, version=None, wipe=None): """Format a Topaz-512 tag for NDEF use. The implementation of :meth:`nfc.tag.Tag.format` for a Topaz-512 tag creates a capability container, a Lock Control and a Memory Control TLV, and an NDEF TLV with length zero. Data bytes of the ND...
[ "def", "format", "(", "self", ",", "version", "=", "None", ",", "wipe", "=", "None", ")", ":", "return", "super", "(", "Topaz512", ",", "self", ")", ".", "format", "(", "version", ",", "wipe", ")" ]
Format a Topaz-512 tag for NDEF use. The implementation of :meth:`nfc.tag.Tag.format` for a Topaz-512 tag creates a capability container, a Lock Control and a Memory Control TLV, and an NDEF TLV with length zero. Data bytes of the NDEF data area are left untouched unless the wip...
[ "Format", "a", "Topaz", "-", "512", "tag", "for", "NDEF", "use", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt1_broadcom.py#L100-L110
227,399
nfcpy/nfcpy
src/nfc/tag/tt1.py
Type1Tag.read_all
def read_all(self): """Returns the 2 byte Header ROM and all 120 byte static memory. """ log.debug("read all static memory") cmd = "\x00\x00\x00" + self.uid return self.transceive(cmd)
python
def read_all(self): """Returns the 2 byte Header ROM and all 120 byte static memory. """ log.debug("read all static memory") cmd = "\x00\x00\x00" + self.uid return self.transceive(cmd)
[ "def", "read_all", "(", "self", ")", ":", "log", ".", "debug", "(", "\"read all static memory\"", ")", "cmd", "=", "\"\\x00\\x00\\x00\"", "+", "self", ".", "uid", "return", "self", ".", "transceive", "(", "cmd", ")" ]
Returns the 2 byte Header ROM and all 120 byte static memory.
[ "Returns", "the", "2", "byte", "Header", "ROM", "and", "all", "120", "byte", "static", "memory", "." ]
6649146d1afdd5e82b2b6b1ea00aa58d50785117
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/tag/tt1.py#L387-L392