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
50,000
zyga/json-schema-validator
json_schema_validator/schema.py
Schema.divisibleBy
def divisibleBy(self): """Integer that divides the object without reminder.""" value = self._schema.get("divisibleBy", 1) if value is None: return if not isinstance(value, NUMERIC_TYPES): raise SchemaError( "divisibleBy value {0!r} is not a numeric...
python
def divisibleBy(self): """Integer that divides the object without reminder.""" value = self._schema.get("divisibleBy", 1) if value is None: return if not isinstance(value, NUMERIC_TYPES): raise SchemaError( "divisibleBy value {0!r} is not a numeric...
[ "def", "divisibleBy", "(", "self", ")", ":", "value", "=", "self", ".", "_schema", ".", "get", "(", "\"divisibleBy\"", ",", "1", ")", "if", "value", "is", "None", ":", "return", "if", "not", "isinstance", "(", "value", ",", "NUMERIC_TYPES", ")", ":", ...
Integer that divides the object without reminder.
[ "Integer", "that", "divides", "the", "object", "without", "reminder", "." ]
0504605da5c0a9a5b5b05c41b37661aec9652144
https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L374-L387
50,001
zyga/json-schema-validator
json_schema_validator/schema.py
Schema.disallow
def disallow(self): """ Description of disallowed objects. Disallow must be a type name, a nested schema or a list of those. Type name must be one of ``string``, ``number``, ``integer``, ``boolean``, ``object``, ``array``, ``null`` or ``any``. """ value = self._...
python
def disallow(self): """ Description of disallowed objects. Disallow must be a type name, a nested schema or a list of those. Type name must be one of ``string``, ``number``, ``integer``, ``boolean``, ``object``, ``array``, ``null`` or ``any``. """ value = self._...
[ "def", "disallow", "(", "self", ")", ":", "value", "=", "self", ".", "_schema", ".", "get", "(", "\"disallow\"", ",", "None", ")", "if", "value", "is", "None", ":", "return", "if", "not", "isinstance", "(", "value", ",", "(", "basestring", ",", "dict...
Description of disallowed objects. Disallow must be a type name, a nested schema or a list of those. Type name must be one of ``string``, ``number``, ``integer``, ``boolean``, ``object``, ``array``, ``null`` or ``any``.
[ "Description", "of", "disallowed", "objects", "." ]
0504605da5c0a9a5b5b05c41b37661aec9652144
https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L390-L427
50,002
zyga/json-schema-validator
json_schema_validator/shortcuts.py
validate
def validate(schema_text, data_text, deserializer=_default_deserializer): """ Validate specified JSON text with specified schema. Both arguments are converted to JSON objects with :func:`simplejson.loads`, if present, or :func:`json.loads`. :param schema_text: Text of the JSON schema to ch...
python
def validate(schema_text, data_text, deserializer=_default_deserializer): """ Validate specified JSON text with specified schema. Both arguments are converted to JSON objects with :func:`simplejson.loads`, if present, or :func:`json.loads`. :param schema_text: Text of the JSON schema to ch...
[ "def", "validate", "(", "schema_text", ",", "data_text", ",", "deserializer", "=", "_default_deserializer", ")", ":", "schema", "=", "Schema", "(", "deserializer", "(", "schema_text", ")", ")", "data", "=", "deserializer", "(", "data_text", ")", "return", "Val...
Validate specified JSON text with specified schema. Both arguments are converted to JSON objects with :func:`simplejson.loads`, if present, or :func:`json.loads`. :param schema_text: Text of the JSON schema to check against :type schema_text: :class:`str` :param data_text: ...
[ "Validate", "specified", "JSON", "text", "with", "specified", "schema", "." ]
0504605da5c0a9a5b5b05c41b37661aec9652144
https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/shortcuts.py#L33-L66
50,003
alej0varas/django-registration-rest-framework
registration_api/utils.py
activate_user
def activate_user(activation_key): """ Validate an activation key and activate the corresponding ``User`` if valid. If the key is valid and has not expired, return the ``User`` after activating. If the key is not valid or has expired, return ``False``. If the key is valid but the ``User`` is...
python
def activate_user(activation_key): """ Validate an activation key and activate the corresponding ``User`` if valid. If the key is valid and has not expired, return the ``User`` after activating. If the key is not valid or has expired, return ``False``. If the key is valid but the ``User`` is...
[ "def", "activate_user", "(", "activation_key", ")", ":", "# Make sure the key we're trying conforms to the pattern of a", "# SHA1 hash; if it doesn't, no point trying to look it up in", "# the database.", "if", "SHA1_RE", ".", "search", "(", "activation_key", ")", ":", "try", ":"...
Validate an activation key and activate the corresponding ``User`` if valid. If the key is valid and has not expired, return the ``User`` after activating. If the key is not valid or has expired, return ``False``. If the key is valid but the ``User`` is already active, return ``False``. To p...
[ "Validate", "an", "activation", "key", "and", "activate", "the", "corresponding", "User", "if", "valid", ".", "If", "the", "key", "is", "valid", "and", "has", "not", "expired", "return", "the", "User", "after", "activating", ".", "If", "the", "key", "is", ...
485be6bd9c366c79d9974a4cdeb6d4931d6c6183
https://github.com/alej0varas/django-registration-rest-framework/blob/485be6bd9c366c79d9974a4cdeb6d4931d6c6183/registration_api/utils.py#L89-L120
50,004
6809/MC6809
MC6809/components/mc6809_ops_branches.py
OpsBranchesMixin.instruction_RTS
def instruction_RTS(self, opcode): """ Program control is returned from the subroutine to the calling program. The return address is pulled from the stack. source code forms: RTS CC bits "HNZVC": ----- """ ea = self.pull_word(self.system_stack_pointer) # ...
python
def instruction_RTS(self, opcode): """ Program control is returned from the subroutine to the calling program. The return address is pulled from the stack. source code forms: RTS CC bits "HNZVC": ----- """ ea = self.pull_word(self.system_stack_pointer) # ...
[ "def", "instruction_RTS", "(", "self", ",", "opcode", ")", ":", "ea", "=", "self", ".", "pull_word", "(", "self", ".", "system_stack_pointer", ")", "# log.info(\"%x|\\tRTS to $%x \\t| %s\" % (", "# self.last_op_address,", "# ea,", "# ...
Program control is returned from the subroutine to the calling program. The return address is pulled from the stack. source code forms: RTS CC bits "HNZVC": -----
[ "Program", "control", "is", "returned", "from", "the", "subroutine", "to", "the", "calling", "program", ".", "The", "return", "address", "is", "pulled", "from", "the", "stack", "." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_branches.py#L54-L69
50,005
6809/MC6809
MC6809/components/mc6809_ops_branches.py
OpsBranchesMixin.instruction_BSR_JSR
def instruction_BSR_JSR(self, opcode, ea): """ Program control is transferred to the effective address after storing the return address on the hardware stack. A return from subroutine (RTS) instruction is used to reverse this process and must be the last instruction executed in ...
python
def instruction_BSR_JSR(self, opcode, ea): """ Program control is transferred to the effective address after storing the return address on the hardware stack. A return from subroutine (RTS) instruction is used to reverse this process and must be the last instruction executed in ...
[ "def", "instruction_BSR_JSR", "(", "self", ",", "opcode", ",", "ea", ")", ":", "# log.info(\"%x|\\tJSR/BSR to $%x \\t| %s\" % (", "# self.last_op_address,", "# ea, self.cfg.mem_info.get_shortest(ea)", "# ))", "self", ".", "push_word", "(", "sel...
Program control is transferred to the effective address after storing the return address on the hardware stack. A return from subroutine (RTS) instruction is used to reverse this process and must be the last instruction executed in a subroutine. source code forms: BSR dd; LBSR DDDD; JS...
[ "Program", "control", "is", "transferred", "to", "the", "effective", "address", "after", "storing", "the", "return", "address", "on", "the", "hardware", "stack", "." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_branches.py#L78-L95
50,006
6809/MC6809
MC6809/components/mc6809_ops_branches.py
OpsBranchesMixin.instruction_BHI
def instruction_BHI(self, opcode, ea): """ Causes a branch if the previous operation caused neither a carry nor a zero result. When used after a subtract or compare operation on unsigned binary values, this instruction will branch if the register was higher than the memory regist...
python
def instruction_BHI(self, opcode, ea): """ Causes a branch if the previous operation caused neither a carry nor a zero result. When used after a subtract or compare operation on unsigned binary values, this instruction will branch if the register was higher than the memory regist...
[ "def", "instruction_BHI", "(", "self", ",", "opcode", ",", "ea", ")", ":", "if", "self", ".", "C", "==", "0", "and", "self", ".", "Z", "==", "0", ":", "# log.info(\"$%x BHI branch to $%x, because C==0 and Z==0 \\t| %s\" % (", "# self.program_...
Causes a branch if the previous operation caused neither a carry nor a zero result. When used after a subtract or compare operation on unsigned binary values, this instruction will branch if the register was higher than the memory register. Generally not useful after INC/DEC, LD/TST, an...
[ "Causes", "a", "branch", "if", "the", "previous", "operation", "caused", "neither", "a", "carry", "nor", "a", "zero", "result", ".", "When", "used", "after", "a", "subtract", "or", "compare", "operation", "on", "unsigned", "binary", "values", "this", "instru...
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_branches.py#L193-L211
50,007
6809/MC6809
MC6809/components/mc6809_ops_branches.py
OpsBranchesMixin.instruction_BLS
def instruction_BLS(self, opcode, ea): """ Causes a branch if the previous operation caused either a carry or a zero result. When used after a subtract or compare operation on unsigned binary values, this instruction will branch if the register was lower than or the same as the m...
python
def instruction_BLS(self, opcode, ea): """ Causes a branch if the previous operation caused either a carry or a zero result. When used after a subtract or compare operation on unsigned binary values, this instruction will branch if the register was lower than or the same as the m...
[ "def", "instruction_BLS", "(", "self", ",", "opcode", ",", "ea", ")", ":", "# if (self.C|self.Z) == 0:", "if", "self", ".", "C", "==", "1", "or", "self", ".", "Z", "==", "1", ":", "# log.info(\"$%x BLS branch to $%x, because C|Z==1 \\t| %s\" % (", ...
Causes a branch if the previous operation caused either a carry or a zero result. When used after a subtract or compare operation on unsigned binary values, this instruction will branch if the register was lower than or the same as the memory register. Generally not useful after INC/DEC...
[ "Causes", "a", "branch", "if", "the", "previous", "operation", "caused", "either", "a", "carry", "or", "a", "zero", "result", ".", "When", "used", "after", "a", "subtract", "or", "compare", "operation", "on", "unsigned", "binary", "values", "this", "instruct...
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_branches.py#L248-L266
50,008
6809/MC6809
MC6809/components/mc6809_ops_load_store.py
OpsLoadStoreMixin.instruction_LD8
def instruction_LD8(self, opcode, m, register): """ Loads the contents of memory location M into the designated register. source code forms: LDA P; LDB P CC bits "HNZVC": -aa0- """ # log.debug("$%x LD8 %s = $%x" % ( # self.program_counter, # registe...
python
def instruction_LD8(self, opcode, m, register): """ Loads the contents of memory location M into the designated register. source code forms: LDA P; LDB P CC bits "HNZVC": -aa0- """ # log.debug("$%x LD8 %s = $%x" % ( # self.program_counter, # registe...
[ "def", "instruction_LD8", "(", "self", ",", "opcode", ",", "m", ",", "register", ")", ":", "# log.debug(\"$%x LD8 %s = $%x\" % (", "# self.program_counter,", "# register.name, m,", "# ))", "register", ".", "set", "(", "m", ")", "self", ...
Loads the contents of memory location M into the designated register. source code forms: LDA P; LDB P CC bits "HNZVC": -aa0-
[ "Loads", "the", "contents", "of", "memory", "location", "M", "into", "the", "designated", "register", "." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_load_store.py#L63-L77
50,009
6809/MC6809
MC6809/components/mc6809_ops_load_store.py
OpsLoadStoreMixin.instruction_ST16
def instruction_ST16(self, opcode, ea, register): """ Writes the contents of a 16-bit register into two consecutive memory locations. source code forms: STD P; STX P; STY P; STS P; STU P CC bits "HNZVC": -aa0- """ value = register.value # log.debug("$%x S...
python
def instruction_ST16(self, opcode, ea, register): """ Writes the contents of a 16-bit register into two consecutive memory locations. source code forms: STD P; STX P; STY P; STS P; STU P CC bits "HNZVC": -aa0- """ value = register.value # log.debug("$%x S...
[ "def", "instruction_ST16", "(", "self", ",", "opcode", ",", "ea", ",", "register", ")", ":", "value", "=", "register", ".", "value", "# log.debug(\"$%x ST16 store value $%x from %s at $%x \\t| %s\" % (", "# self.program_counter,", "# value, regist...
Writes the contents of a 16-bit register into two consecutive memory locations. source code forms: STD P; STX P; STY P; STS P; STU P CC bits "HNZVC": -aa0-
[ "Writes", "the", "contents", "of", "a", "16", "-", "bit", "register", "into", "two", "consecutive", "memory", "locations", "." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_load_store.py#L86-L103
50,010
6809/MC6809
MC6809/components/mc6809_ops_load_store.py
OpsLoadStoreMixin.instruction_ST8
def instruction_ST8(self, opcode, ea, register): """ Writes the contents of an 8-bit register into a memory location. source code forms: STA P; STB P CC bits "HNZVC": -aa0- """ value = register.value # log.debug("$%x ST8 store value $%x from %s at $%x \t| %s" % (...
python
def instruction_ST8(self, opcode, ea, register): """ Writes the contents of an 8-bit register into a memory location. source code forms: STA P; STB P CC bits "HNZVC": -aa0- """ value = register.value # log.debug("$%x ST8 store value $%x from %s at $%x \t| %s" % (...
[ "def", "instruction_ST8", "(", "self", ",", "opcode", ",", "ea", ",", "register", ")", ":", "value", "=", "register", ".", "value", "# log.debug(\"$%x ST8 store value $%x from %s at $%x \\t| %s\" % (", "# self.program_counter,", "# value, register...
Writes the contents of an 8-bit register into a memory location. source code forms: STA P; STB P CC bits "HNZVC": -aa0-
[ "Writes", "the", "contents", "of", "an", "8", "-", "bit", "register", "into", "a", "memory", "location", "." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_load_store.py#L109-L125
50,011
alej0varas/django-registration-rest-framework
registration_api/serializers.py
UserSerializer.to_native
def to_native(self, obj): """Remove password field when serializing an object""" ret = super(UserSerializer, self).to_native(obj) del ret['password'] return ret
python
def to_native(self, obj): """Remove password field when serializing an object""" ret = super(UserSerializer, self).to_native(obj) del ret['password'] return ret
[ "def", "to_native", "(", "self", ",", "obj", ")", ":", "ret", "=", "super", "(", "UserSerializer", ",", "self", ")", ".", "to_native", "(", "obj", ")", "del", "ret", "[", "'password'", "]", "return", "ret" ]
Remove password field when serializing an object
[ "Remove", "password", "field", "when", "serializing", "an", "object" ]
485be6bd9c366c79d9974a4cdeb6d4931d6c6183
https://github.com/alej0varas/django-registration-rest-framework/blob/485be6bd9c366c79d9974a4cdeb6d4931d6c6183/registration_api/serializers.py#L11-L15
50,012
websauna/pyramid_notebook
pyramid_notebook/uwsgi.py
serve_websocket
def serve_websocket(request, port): """Start UWSGI websocket loop and proxy.""" env = request.environ # Send HTTP response 101 Switch Protocol downstream uwsgi.websocket_handshake(env['HTTP_SEC_WEBSOCKET_KEY'], env.get('HTTP_ORIGIN', '')) # Map the websocket URL to the upstream localhost:4000x Not...
python
def serve_websocket(request, port): """Start UWSGI websocket loop and proxy.""" env = request.environ # Send HTTP response 101 Switch Protocol downstream uwsgi.websocket_handshake(env['HTTP_SEC_WEBSOCKET_KEY'], env.get('HTTP_ORIGIN', '')) # Map the websocket URL to the upstream localhost:4000x Not...
[ "def", "serve_websocket", "(", "request", ",", "port", ")", ":", "env", "=", "request", ".", "environ", "# Send HTTP response 101 Switch Protocol downstream", "uwsgi", ".", "websocket_handshake", "(", "env", "[", "'HTTP_SEC_WEBSOCKET_KEY'", "]", ",", "env", ".", "ge...
Start UWSGI websocket loop and proxy.
[ "Start", "UWSGI", "websocket", "loop", "and", "proxy", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/uwsgi.py#L112-L133
50,013
websauna/pyramid_notebook
pyramid_notebook/uwsgi.py
ProxyClient.handshake_headers
def handshake_headers(self): """ List of headers appropriate for the upgrade handshake. """ headers = [ ('Host', self.host), ('Connection', 'Upgrade'), ('Upgrade', 'WebSocket'), ('Sec-WebSocket-Key', self.key.decode('utf-8')), ...
python
def handshake_headers(self): """ List of headers appropriate for the upgrade handshake. """ headers = [ ('Host', self.host), ('Connection', 'Upgrade'), ('Upgrade', 'WebSocket'), ('Sec-WebSocket-Key', self.key.decode('utf-8')), ...
[ "def", "handshake_headers", "(", "self", ")", ":", "headers", "=", "[", "(", "'Host'", ",", "self", ".", "host", ")", ",", "(", "'Connection'", ",", "'Upgrade'", ")", ",", "(", "'Upgrade'", ",", "'WebSocket'", ")", ",", "(", "'Sec-WebSocket-Key'", ",", ...
List of headers appropriate for the upgrade handshake.
[ "List", "of", "headers", "appropriate", "for", "the", "upgrade", "handshake", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/uwsgi.py#L30-L52
50,014
websauna/pyramid_notebook
pyramid_notebook/uwsgi.py
ProxyClient.received_message
def received_message(self, m): """Push upstream messages to downstream.""" # TODO: No support for binary messages m = str(m) logger.debug("Incoming upstream WS: %s", m) uwsgi.websocket_send(m) logger.debug("Send ok")
python
def received_message(self, m): """Push upstream messages to downstream.""" # TODO: No support for binary messages m = str(m) logger.debug("Incoming upstream WS: %s", m) uwsgi.websocket_send(m) logger.debug("Send ok")
[ "def", "received_message", "(", "self", ",", "m", ")", ":", "# TODO: No support for binary messages", "m", "=", "str", "(", "m", ")", "logger", ".", "debug", "(", "\"Incoming upstream WS: %s\"", ",", "m", ")", "uwsgi", ".", "websocket_send", "(", "m", ")", "...
Push upstream messages to downstream.
[ "Push", "upstream", "messages", "to", "downstream", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/uwsgi.py#L54-L61
50,015
websauna/pyramid_notebook
pyramid_notebook/uwsgi.py
ProxyClient.run
def run(self): """Combine async uwsgi message loop with ws4py message loop. TODO: This could do some serious optimizations and behave asynchronously correct instead of just sleep(). """ self.sock.setblocking(False) try: while not self.terminated: log...
python
def run(self): """Combine async uwsgi message loop with ws4py message loop. TODO: This could do some serious optimizations and behave asynchronously correct instead of just sleep(). """ self.sock.setblocking(False) try: while not self.terminated: log...
[ "def", "run", "(", "self", ")", ":", "self", ".", "sock", ".", "setblocking", "(", "False", ")", "try", ":", "while", "not", "self", ".", "terminated", ":", "logger", ".", "debug", "(", "\"Doing nothing\"", ")", "time", ".", "sleep", "(", "0.050", ")...
Combine async uwsgi message loop with ws4py message loop. TODO: This could do some serious optimizations and behave asynchronously correct instead of just sleep().
[ "Combine", "async", "uwsgi", "message", "loop", "with", "ws4py", "message", "loop", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/uwsgi.py#L75-L109
50,016
cykl/infoqscraper
infoqscraper/cache.py
XDGCache.get_content
def get_content(self, url): """Returns the content of a cached resource. Args: url: The url of the resource Returns: The content of the cached resource or None if not in the cache """ cache_path = self._url_to_path(url) try: with open...
python
def get_content(self, url): """Returns the content of a cached resource. Args: url: The url of the resource Returns: The content of the cached resource or None if not in the cache """ cache_path = self._url_to_path(url) try: with open...
[ "def", "get_content", "(", "self", ",", "url", ")", ":", "cache_path", "=", "self", ".", "_url_to_path", "(", "url", ")", "try", ":", "with", "open", "(", "cache_path", ",", "'rb'", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")", "except...
Returns the content of a cached resource. Args: url: The url of the resource Returns: The content of the cached resource or None if not in the cache
[ "Returns", "the", "content", "of", "a", "cached", "resource", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/cache.py#L56-L70
50,017
cykl/infoqscraper
infoqscraper/cache.py
XDGCache.get_path
def get_path(self, url): """Returns the path of a cached resource. Args: url: The url of the resource Returns: The path to the cached resource or None if not in the cache """ cache_path = self._url_to_path(url) if os.path.exists(cache_path): ...
python
def get_path(self, url): """Returns the path of a cached resource. Args: url: The url of the resource Returns: The path to the cached resource or None if not in the cache """ cache_path = self._url_to_path(url) if os.path.exists(cache_path): ...
[ "def", "get_path", "(", "self", ",", "url", ")", ":", "cache_path", "=", "self", ".", "_url_to_path", "(", "url", ")", "if", "os", ".", "path", ".", "exists", "(", "cache_path", ")", ":", "return", "cache_path", "return", "None" ]
Returns the path of a cached resource. Args: url: The url of the resource Returns: The path to the cached resource or None if not in the cache
[ "Returns", "the", "path", "of", "a", "cached", "resource", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/cache.py#L72-L85
50,018
cykl/infoqscraper
infoqscraper/cache.py
XDGCache.put_content
def put_content(self, url, content): """Stores the content of a resource into the disk cache. Args: url: The url of the resource content: The content of the resource Raises: CacheError: If the content cannot be put in cache """ cache_path = s...
python
def put_content(self, url, content): """Stores the content of a resource into the disk cache. Args: url: The url of the resource content: The content of the resource Raises: CacheError: If the content cannot be put in cache """ cache_path = s...
[ "def", "put_content", "(", "self", ",", "url", ",", "content", ")", ":", "cache_path", "=", "self", ".", "_url_to_path", "(", "url", ")", "# Ensure that cache directories exist", "try", ":", "dir", "=", "os", ".", "path", ".", "dirname", "(", "cache_path", ...
Stores the content of a resource into the disk cache. Args: url: The url of the resource content: The content of the resource Raises: CacheError: If the content cannot be put in cache
[ "Stores", "the", "content", "of", "a", "resource", "into", "the", "disk", "cache", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/cache.py#L87-L111
50,019
cykl/infoqscraper
infoqscraper/cache.py
XDGCache.put_path
def put_path(self, url, path): """Puts a resource already on disk into the disk cache. Args: url: The original url of the resource path: The resource already available on disk Raises: CacheError: If the file cannot be put in cache """ cache_p...
python
def put_path(self, url, path): """Puts a resource already on disk into the disk cache. Args: url: The original url of the resource path: The resource already available on disk Raises: CacheError: If the file cannot be put in cache """ cache_p...
[ "def", "put_path", "(", "self", ",", "url", ",", "path", ")", ":", "cache_path", "=", "self", ".", "_url_to_path", "(", "url", ")", "# Ensure that cache directories exist", "try", ":", "dir", "=", "os", ".", "path", ".", "dirname", "(", "cache_path", ")", ...
Puts a resource already on disk into the disk cache. Args: url: The original url of the resource path: The resource already available on disk Raises: CacheError: If the file cannot be put in cache
[ "Puts", "a", "resource", "already", "on", "disk", "into", "the", "disk", "cache", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/cache.py#L113-L147
50,020
cykl/infoqscraper
infoqscraper/cache.py
XDGCache.size
def size(self): """Returns the size of the cache in bytes.""" total_size = 0 for dir_path, dir_names, filenames in os.walk(self.dir): for f in filenames: fp = os.path.join(dir_path, f) total_size += os.path.getsize(fp) return total_size
python
def size(self): """Returns the size of the cache in bytes.""" total_size = 0 for dir_path, dir_names, filenames in os.walk(self.dir): for f in filenames: fp = os.path.join(dir_path, f) total_size += os.path.getsize(fp) return total_size
[ "def", "size", "(", "self", ")", ":", "total_size", "=", "0", "for", "dir_path", ",", "dir_names", ",", "filenames", "in", "os", ".", "walk", "(", "self", ".", "dir", ")", ":", "for", "f", "in", "filenames", ":", "fp", "=", "os", ".", "path", "."...
Returns the size of the cache in bytes.
[ "Returns", "the", "size", "of", "the", "cache", "in", "bytes", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/cache.py#L158-L165
50,021
6809/MC6809
MC6809/components/cpu_utils/instruction_caller.py
opcode
def opcode(*opcodes): """A decorator for opcodes""" def decorator(func): setattr(func, "_is_opcode", True) setattr(func, "_opcodes", opcodes) return func return decorator
python
def opcode(*opcodes): """A decorator for opcodes""" def decorator(func): setattr(func, "_is_opcode", True) setattr(func, "_opcodes", opcodes) return func return decorator
[ "def", "opcode", "(", "*", "opcodes", ")", ":", "def", "decorator", "(", "func", ")", ":", "setattr", "(", "func", ",", "\"_is_opcode\"", ",", "True", ")", "setattr", "(", "func", ",", "\"_opcodes\"", ",", "opcodes", ")", "return", "func", "return", "d...
A decorator for opcodes
[ "A", "decorator", "for", "opcodes" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/cpu_utils/instruction_caller.py#L20-L26
50,022
websauna/pyramid_notebook
pyramid_notebook/server/notebook_daemon.py
create_named_notebook
def create_named_notebook(fname, context): """Create a named notebook if one doesn't exist.""" if os.path.exists(fname): return from nbformat import v4 as nbf # Courtesy of http://nbviewer.ipython.org/gist/fperez/9716279 text = "Welcome to *pyramid_notebook!* Use *File* *>* *Shutdown* to ...
python
def create_named_notebook(fname, context): """Create a named notebook if one doesn't exist.""" if os.path.exists(fname): return from nbformat import v4 as nbf # Courtesy of http://nbviewer.ipython.org/gist/fperez/9716279 text = "Welcome to *pyramid_notebook!* Use *File* *>* *Shutdown* to ...
[ "def", "create_named_notebook", "(", "fname", ",", "context", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "fname", ")", ":", "return", "from", "nbformat", "import", "v4", "as", "nbf", "# Courtesy of http://nbviewer.ipython.org/gist/fperez/9716279", "tex...
Create a named notebook if one doesn't exist.
[ "Create", "a", "named", "notebook", "if", "one", "doesn", "t", "exist", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/server/notebook_daemon.py#L91-L113
50,023
6809/MC6809
MC6809/example6809.py
MC6809Example.crc32
def crc32(self, data): """ Calculate a ZIP 32-bit CRC from data in memory. Origin code by Johann E. Klasek, j AT klasek at """ data_address = 0x1000 # position of the test data self.cpu.memory.load(data_address, data) # write test data into RAM self.cpu.index_x.s...
python
def crc32(self, data): """ Calculate a ZIP 32-bit CRC from data in memory. Origin code by Johann E. Klasek, j AT klasek at """ data_address = 0x1000 # position of the test data self.cpu.memory.load(data_address, data) # write test data into RAM self.cpu.index_x.s...
[ "def", "crc32", "(", "self", ",", "data", ")", ":", "data_address", "=", "0x1000", "# position of the test data", "self", ".", "cpu", ".", "memory", ".", "load", "(", "data_address", ",", "data", ")", "# write test data into RAM", "self", ".", "cpu", ".", "i...
Calculate a ZIP 32-bit CRC from data in memory. Origin code by Johann E. Klasek, j AT klasek at
[ "Calculate", "a", "ZIP", "32", "-", "bit", "CRC", "from", "data", "in", "memory", ".", "Origin", "code", "by", "Johann", "E", ".", "Klasek", "j", "AT", "klasek", "at" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/example6809.py#L65-L127
50,024
6809/MC6809
MC6809/components/mc6809_interrupt.py
InterruptMixin.push_irq_registers
def push_irq_registers(self): """ push PC, U, Y, X, DP, B, A, CC on System stack pointer """ self.cycles += 1 self.push_word(self.system_stack_pointer, self.program_counter.value) # PC self.push_word(self.system_stack_pointer, self.user_stack_pointer.value) # U se...
python
def push_irq_registers(self): """ push PC, U, Y, X, DP, B, A, CC on System stack pointer """ self.cycles += 1 self.push_word(self.system_stack_pointer, self.program_counter.value) # PC self.push_word(self.system_stack_pointer, self.user_stack_pointer.value) # U se...
[ "def", "push_irq_registers", "(", "self", ")", ":", "self", ".", "cycles", "+=", "1", "self", ".", "push_word", "(", "self", ".", "system_stack_pointer", ",", "self", ".", "program_counter", ".", "value", ")", "# PC", "self", ".", "push_word", "(", "self",...
push PC, U, Y, X, DP, B, A, CC on System stack pointer
[ "push", "PC", "U", "Y", "X", "DP", "B", "A", "CC", "on", "System", "stack", "pointer" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_interrupt.py#L99-L111
50,025
6809/MC6809
MC6809/components/mc6809_interrupt.py
InterruptMixin.push_firq_registers
def push_firq_registers(self): """ FIRQ - Fast Interrupt Request push PC and CC on System stack pointer """ self.cycles += 1 self.push_word(self.system_stack_pointer, self.program_counter.value) # PC self.push_byte(self.system_stack_pointer, self.get_cc_value())
python
def push_firq_registers(self): """ FIRQ - Fast Interrupt Request push PC and CC on System stack pointer """ self.cycles += 1 self.push_word(self.system_stack_pointer, self.program_counter.value) # PC self.push_byte(self.system_stack_pointer, self.get_cc_value())
[ "def", "push_firq_registers", "(", "self", ")", ":", "self", ".", "cycles", "+=", "1", "self", ".", "push_word", "(", "self", ".", "system_stack_pointer", ",", "self", ".", "program_counter", ".", "value", ")", "# PC", "self", ".", "push_byte", "(", "self"...
FIRQ - Fast Interrupt Request push PC and CC on System stack pointer
[ "FIRQ", "-", "Fast", "Interrupt", "Request", "push", "PC", "and", "CC", "on", "System", "stack", "pointer" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_interrupt.py#L113-L120
50,026
bureaucratic-labs/models
b_labs_models/segmentation.py
text2sentences
def text2sentences(text, labels): ''' Splits given text at predicted positions from `labels` ''' sentence = '' for i, label in enumerate(labels): if label == '1': if sentence: yield sentence sentence = '' else: sentence += text[i] ...
python
def text2sentences(text, labels): ''' Splits given text at predicted positions from `labels` ''' sentence = '' for i, label in enumerate(labels): if label == '1': if sentence: yield sentence sentence = '' else: sentence += text[i] ...
[ "def", "text2sentences", "(", "text", ",", "labels", ")", ":", "sentence", "=", "''", "for", "i", ",", "label", "in", "enumerate", "(", "labels", ")", ":", "if", "label", "==", "'1'", ":", "if", "sentence", ":", "yield", "sentence", "sentence", "=", ...
Splits given text at predicted positions from `labels`
[ "Splits", "given", "text", "at", "predicted", "positions", "from", "labels" ]
e674c622af883abd094293fb20c325742080577a
https://github.com/bureaucratic-labs/models/blob/e674c622af883abd094293fb20c325742080577a/b_labs_models/segmentation.py#L110-L123
50,027
websauna/pyramid_notebook
pyramid_notebook/proxy.py
reconstruct_url
def reconstruct_url(environ, port): """Reconstruct the remote url from the given WSGI ``environ`` dictionary. :param environ: the WSGI environment :type environ: :class:`collections.MutableMapping` :returns: the remote url to proxy :rtype: :class:`basestring` """ # From WSGI spec, PEP 333 ...
python
def reconstruct_url(environ, port): """Reconstruct the remote url from the given WSGI ``environ`` dictionary. :param environ: the WSGI environment :type environ: :class:`collections.MutableMapping` :returns: the remote url to proxy :rtype: :class:`basestring` """ # From WSGI spec, PEP 333 ...
[ "def", "reconstruct_url", "(", "environ", ",", "port", ")", ":", "# From WSGI spec, PEP 333", "url", "=", "environ", ".", "get", "(", "'PATH_INFO'", ",", "''", ")", "if", "not", "url", ".", "startswith", "(", "(", "'http://'", ",", "'https://'", ")", ")", ...
Reconstruct the remote url from the given WSGI ``environ`` dictionary. :param environ: the WSGI environment :type environ: :class:`collections.MutableMapping` :returns: the remote url to proxy :rtype: :class:`basestring`
[ "Reconstruct", "the", "remote", "url", "from", "the", "given", "WSGI", "environ", "dictionary", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/proxy.py#L33-L66
50,028
cykl/infoqscraper
infoqscraper/scrap.py
get_summaries
def get_summaries(client, filter=None): """ Generate presentation summaries in a reverse chronological order. A filter class can be supplied to filter summaries or bound the fetching process. """ try: index = 0 while True: rb = _RightBarPage(client, index) summ...
python
def get_summaries(client, filter=None): """ Generate presentation summaries in a reverse chronological order. A filter class can be supplied to filter summaries or bound the fetching process. """ try: index = 0 while True: rb = _RightBarPage(client, index) summ...
[ "def", "get_summaries", "(", "client", ",", "filter", "=", "None", ")", ":", "try", ":", "index", "=", "0", "while", "True", ":", "rb", "=", "_RightBarPage", "(", "client", ",", "index", ")", "summaries", "=", "rb", ".", "summaries", "(", ")", "if", ...
Generate presentation summaries in a reverse chronological order. A filter class can be supplied to filter summaries or bound the fetching process.
[ "Generate", "presentation", "summaries", "in", "a", "reverse", "chronological", "order", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/scrap.py#L36-L55
50,029
cykl/infoqscraper
infoqscraper/scrap.py
_RightBarPage.summaries
def summaries(self): """Return a list of all the presentation summaries contained in this page""" def create_summary(div): def get_id(div): return get_url(div).rsplit('/')[-1] def get_url(div): return client.get_url(div.find('h2', class_='itemtitl...
python
def summaries(self): """Return a list of all the presentation summaries contained in this page""" def create_summary(div): def get_id(div): return get_url(div).rsplit('/')[-1] def get_url(div): return client.get_url(div.find('h2', class_='itemtitl...
[ "def", "summaries", "(", "self", ")", ":", "def", "create_summary", "(", "div", ")", ":", "def", "get_id", "(", "div", ")", ":", "return", "get_url", "(", "div", ")", ".", "rsplit", "(", "'/'", ")", "[", "-", "1", "]", "def", "get_url", "(", "div...
Return a list of all the presentation summaries contained in this page
[ "Return", "a", "list", "of", "all", "the", "presentation", "summaries", "contained", "in", "this", "page" ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/scrap.py#L214-L249
50,030
websauna/pyramid_notebook
pyramid_notebook/startup.py
make_startup
def make_startup(notebook_context, config_file, bootstrap_py=PYRAMID_BOOSTRAP, bootstrap_greeting=PYRAMID_GREETING, cwd=""): """Populate notebook context with startup.py initialization file skeleton and greeting. This will set up context ``startup`` and ``greeting`` for their default values. :param notebo...
python
def make_startup(notebook_context, config_file, bootstrap_py=PYRAMID_BOOSTRAP, bootstrap_greeting=PYRAMID_GREETING, cwd=""): """Populate notebook context with startup.py initialization file skeleton and greeting. This will set up context ``startup`` and ``greeting`` for their default values. :param notebo...
[ "def", "make_startup", "(", "notebook_context", ",", "config_file", ",", "bootstrap_py", "=", "PYRAMID_BOOSTRAP", ",", "bootstrap_greeting", "=", "PYRAMID_GREETING", ",", "cwd", "=", "\"\"", ")", ":", "# Set up some default imports and variables", "nc", "=", "notebook_c...
Populate notebook context with startup.py initialization file skeleton and greeting. This will set up context ``startup`` and ``greeting`` for their default values. :param notebook_context: Dictionary of notebook context info to be to passed to NotebookManager :param config_file: The current .ini file us...
[ "Populate", "notebook", "context", "with", "startup", ".", "py", "initialization", "file", "skeleton", "and", "greeting", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/startup.py#L42-L85
50,031
websauna/pyramid_notebook
pyramid_notebook/startup.py
include_sqlalchemy_models
def include_sqlalchemy_models(nc, Base): """Include all SQLAlchemy models in the script context. :param nc: notebook_context dictionary :param Base: SQLAlchemy model Base class from where the all models inherit. """ from sqlalchemy.ext.declarative.clsregistry import _ModuleMarker # Include al...
python
def include_sqlalchemy_models(nc, Base): """Include all SQLAlchemy models in the script context. :param nc: notebook_context dictionary :param Base: SQLAlchemy model Base class from where the all models inherit. """ from sqlalchemy.ext.declarative.clsregistry import _ModuleMarker # Include al...
[ "def", "include_sqlalchemy_models", "(", "nc", ",", "Base", ")", ":", "from", "sqlalchemy", ".", "ext", ".", "declarative", ".", "clsregistry", "import", "_ModuleMarker", "# Include all SQLAlchemy models in the local namespace", "for", "name", ",", "klass", "in", "Bas...
Include all SQLAlchemy models in the script context. :param nc: notebook_context dictionary :param Base: SQLAlchemy model Base class from where the all models inherit.
[ "Include", "all", "SQLAlchemy", "models", "in", "the", "script", "context", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/startup.py#L88-L104
50,032
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_OR
def instruction_OR(self, opcode, m, register): """ Performs an inclusive OR operation between the contents of accumulator A or B and the contents of memory location M and the result is stored in accumulator A or B. source code forms: ORA P; ORB P CC bits "HNZVC": -aa0- ...
python
def instruction_OR(self, opcode, m, register): """ Performs an inclusive OR operation between the contents of accumulator A or B and the contents of memory location M and the result is stored in accumulator A or B. source code forms: ORA P; ORB P CC bits "HNZVC": -aa0- ...
[ "def", "instruction_OR", "(", "self", ",", "opcode", ",", "m", ",", "register", ")", ":", "a", "=", "register", ".", "value", "r", "=", "a", "|", "m", "register", ".", "set", "(", "r", ")", "self", ".", "clear_NZV", "(", ")", "self", ".", "update...
Performs an inclusive OR operation between the contents of accumulator A or B and the contents of memory location M and the result is stored in accumulator A or B. source code forms: ORA P; ORB P CC bits "HNZVC": -aa0-
[ "Performs", "an", "inclusive", "OR", "operation", "between", "the", "contents", "of", "accumulator", "A", "or", "B", "and", "the", "contents", "of", "memory", "location", "M", "and", "the", "result", "is", "stored", "in", "accumulator", "A", "or", "B", "."...
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L84-L98
50,033
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_ANDCC
def instruction_ANDCC(self, opcode, m, register): """ Performs a logical AND between the condition code register and the immediate byte specified in the instruction and places the result in the condition code register. source code forms: ANDCC #xx CC bits "HNZVC": ddddd...
python
def instruction_ANDCC(self, opcode, m, register): """ Performs a logical AND between the condition code register and the immediate byte specified in the instruction and places the result in the condition code register. source code forms: ANDCC #xx CC bits "HNZVC": ddddd...
[ "def", "instruction_ANDCC", "(", "self", ",", "opcode", ",", "m", ",", "register", ")", ":", "assert", "register", "==", "self", ".", "cc_register", "old_cc", "=", "self", ".", "get_cc_value", "(", ")", "new_cc", "=", "old_cc", "&", "m", "self", ".", "...
Performs a logical AND between the condition code register and the immediate byte specified in the instruction and places the result in the condition code register. source code forms: ANDCC #xx CC bits "HNZVC": ddddd
[ "Performs", "a", "logical", "AND", "between", "the", "condition", "code", "register", "and", "the", "immediate", "byte", "specified", "in", "the", "instruction", "and", "places", "the", "result", "in", "the", "condition", "code", "register", "." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L109-L123
50,034
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_LSR_memory
def instruction_LSR_memory(self, opcode, ea, m): """ Logical shift right memory location """ r = self.LSR(m) # log.debug("$%x LSR memory value $%x >> 1 = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea) #...
python
def instruction_LSR_memory(self, opcode, ea, m): """ Logical shift right memory location """ r = self.LSR(m) # log.debug("$%x LSR memory value $%x >> 1 = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea) #...
[ "def", "instruction_LSR_memory", "(", "self", ",", "opcode", ",", "ea", ",", "m", ")", ":", "r", "=", "self", ".", "LSR", "(", "m", ")", "# log.debug(\"$%x LSR memory value $%x >> 1 = $%x and write it to $%x \\t| %s\" % (", "# self.program_counter,", "# ...
Logical shift right memory location
[ "Logical", "shift", "right", "memory", "location" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L213-L221
50,035
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_LSR_register
def instruction_LSR_register(self, opcode, register): """ Logical shift right accumulator """ a = register.value r = self.LSR(a) # log.debug("$%x LSR %s value $%x >> 1 = $%x" % ( # self.program_counter, # register.name, a, r # )) register.set(r)
python
def instruction_LSR_register(self, opcode, register): """ Logical shift right accumulator """ a = register.value r = self.LSR(a) # log.debug("$%x LSR %s value $%x >> 1 = $%x" % ( # self.program_counter, # register.name, a, r # )) register.set(r)
[ "def", "instruction_LSR_register", "(", "self", ",", "opcode", ",", "register", ")", ":", "a", "=", "register", ".", "value", "r", "=", "self", ".", "LSR", "(", "a", ")", "# log.debug(\"$%x LSR %s value $%x >> 1 = $%x\" % (", "# self.program_counter,...
Logical shift right accumulator
[ "Logical", "shift", "right", "accumulator" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L224-L232
50,036
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_ASR_memory
def instruction_ASR_memory(self, opcode, ea, m): """ Arithmetic shift memory right """ r = self.ASR(m) # log.debug("$%x ASR memory value $%x >> 1 | Carry = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea)...
python
def instruction_ASR_memory(self, opcode, ea, m): """ Arithmetic shift memory right """ r = self.ASR(m) # log.debug("$%x ASR memory value $%x >> 1 | Carry = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea)...
[ "def", "instruction_ASR_memory", "(", "self", ",", "opcode", ",", "ea", ",", "m", ")", ":", "r", "=", "self", ".", "ASR", "(", "m", ")", "# log.debug(\"$%x ASR memory value $%x >> 1 | Carry = $%x and write it to $%x \\t| %s\" % (", "# self.program_counter,...
Arithmetic shift memory right
[ "Arithmetic", "shift", "memory", "right" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L252-L260
50,037
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_ASR_register
def instruction_ASR_register(self, opcode, register): """ Arithmetic shift accumulator right """ a = register.value r = self.ASR(a) # log.debug("$%x ASR %s value $%x >> 1 | Carry = $%x" % ( # self.program_counter, # register.name, a, r # )) register.se...
python
def instruction_ASR_register(self, opcode, register): """ Arithmetic shift accumulator right """ a = register.value r = self.ASR(a) # log.debug("$%x ASR %s value $%x >> 1 | Carry = $%x" % ( # self.program_counter, # register.name, a, r # )) register.se...
[ "def", "instruction_ASR_register", "(", "self", ",", "opcode", ",", "register", ")", ":", "a", "=", "register", ".", "value", "r", "=", "self", ".", "ASR", "(", "a", ")", "# log.debug(\"$%x ASR %s value $%x >> 1 | Carry = $%x\" % (", "# self.program_...
Arithmetic shift accumulator right
[ "Arithmetic", "shift", "accumulator", "right" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L263-L271
50,038
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_ROL_memory
def instruction_ROL_memory(self, opcode, ea, m): """ Rotate memory left """ r = self.ROL(m) # log.debug("$%x ROL memory value $%x << 1 | Carry = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea) # )...
python
def instruction_ROL_memory(self, opcode, ea, m): """ Rotate memory left """ r = self.ROL(m) # log.debug("$%x ROL memory value $%x << 1 | Carry = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea) # )...
[ "def", "instruction_ROL_memory", "(", "self", ",", "opcode", ",", "ea", ",", "m", ")", ":", "r", "=", "self", ".", "ROL", "(", "m", ")", "# log.debug(\"$%x ROL memory value $%x << 1 | Carry = $%x and write it to $%x \\t| %s\" % (", "# self.program_counter,...
Rotate memory left
[ "Rotate", "memory", "left" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L292-L300
50,039
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_ROL_register
def instruction_ROL_register(self, opcode, register): """ Rotate accumulator left """ a = register.value r = self.ROL(a) # log.debug("$%x ROL %s value $%x << 1 | Carry = $%x" % ( # self.program_counter, # register.name, a, r # )) register.set(r)
python
def instruction_ROL_register(self, opcode, register): """ Rotate accumulator left """ a = register.value r = self.ROL(a) # log.debug("$%x ROL %s value $%x << 1 | Carry = $%x" % ( # self.program_counter, # register.name, a, r # )) register.set(r)
[ "def", "instruction_ROL_register", "(", "self", ",", "opcode", ",", "register", ")", ":", "a", "=", "register", ".", "value", "r", "=", "self", ".", "ROL", "(", "a", ")", "# log.debug(\"$%x ROL %s value $%x << 1 | Carry = $%x\" % (", "# self.program_...
Rotate accumulator left
[ "Rotate", "accumulator", "left" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L303-L311
50,040
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_ROR_memory
def instruction_ROR_memory(self, opcode, ea, m): """ Rotate memory right """ r = self.ROR(m) # log.debug("$%x ROR memory value $%x >> 1 | Carry = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea) # ...
python
def instruction_ROR_memory(self, opcode, ea, m): """ Rotate memory right """ r = self.ROR(m) # log.debug("$%x ROR memory value $%x >> 1 | Carry = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea) # ...
[ "def", "instruction_ROR_memory", "(", "self", ",", "opcode", ",", "ea", ",", "m", ")", ":", "r", "=", "self", ".", "ROR", "(", "m", ")", "# log.debug(\"$%x ROR memory value $%x >> 1 | Carry = $%x and write it to $%x \\t| %s\" % (", "# self.program_counter,...
Rotate memory right
[ "Rotate", "memory", "right" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L332-L340
50,041
6809/MC6809
MC6809/components/mc6809_ops_logic.py
OpsLogicalMixin.instruction_ROR_register
def instruction_ROR_register(self, opcode, register): """ Rotate accumulator right """ a = register.value r = self.ROR(a) # log.debug("$%x ROR %s value $%x >> 1 | Carry = $%x" % ( # self.program_counter, # register.name, a, r # )) register.set(r)
python
def instruction_ROR_register(self, opcode, register): """ Rotate accumulator right """ a = register.value r = self.ROR(a) # log.debug("$%x ROR %s value $%x >> 1 | Carry = $%x" % ( # self.program_counter, # register.name, a, r # )) register.set(r)
[ "def", "instruction_ROR_register", "(", "self", ",", "opcode", ",", "register", ")", ":", "a", "=", "register", ".", "value", "r", "=", "self", ".", "ROR", "(", "a", ")", "# log.debug(\"$%x ROR %s value $%x >> 1 | Carry = $%x\" % (", "# self.program_...
Rotate accumulator right
[ "Rotate", "accumulator", "right" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L343-L351
50,042
6809/MC6809
MC6809/components/mc6809_addressing.py
AddressingMixin.get_ea_indexed
def get_ea_indexed(self): """ Calculate the address for all indexed addressing modes """ addr, postbyte = self.read_pc_byte() # log.debug("\tget_ea_indexed(): postbyte: $%02x (%s) from $%04x", # postbyte, byte2bit_string(postbyte), addr # ) rr = (postb...
python
def get_ea_indexed(self): """ Calculate the address for all indexed addressing modes """ addr, postbyte = self.read_pc_byte() # log.debug("\tget_ea_indexed(): postbyte: $%02x (%s) from $%04x", # postbyte, byte2bit_string(postbyte), addr # ) rr = (postb...
[ "def", "get_ea_indexed", "(", "self", ")", ":", "addr", ",", "postbyte", "=", "self", ".", "read_pc_byte", "(", ")", "# log.debug(\"\\tget_ea_indexed(): postbyte: $%02x (%s) from $%04x\",", "# postbyte, byte2bit_string(postbyte), addr", "# )", "rr", "...
Calculate the address for all indexed addressing modes
[ "Calculate", "the", "address", "for", "all", "indexed", "addressing", "modes" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_addressing.py#L76-L196
50,043
websauna/pyramid_notebook
pyramid_notebook/notebookmanager.py
NotebookManager.discover_python
def discover_python(self): """Get the Python interpreter we need to use to run our Notebook daemon.""" python = sys.executable #: XXX fix this hack, uwsgi sets itself as Python #: Make better used Python interpreter autodiscovery if python.endswith("/uwsgi"): python ...
python
def discover_python(self): """Get the Python interpreter we need to use to run our Notebook daemon.""" python = sys.executable #: XXX fix this hack, uwsgi sets itself as Python #: Make better used Python interpreter autodiscovery if python.endswith("/uwsgi"): python ...
[ "def", "discover_python", "(", "self", ")", ":", "python", "=", "sys", ".", "executable", "#: XXX fix this hack, uwsgi sets itself as Python", "#: Make better used Python interpreter autodiscovery", "if", "python", ".", "endswith", "(", "\"/uwsgi\"", ")", ":", "python", "...
Get the Python interpreter we need to use to run our Notebook daemon.
[ "Get", "the", "Python", "interpreter", "we", "need", "to", "use", "to", "run", "our", "Notebook", "daemon", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/notebookmanager.py#L44-L52
50,044
websauna/pyramid_notebook
pyramid_notebook/notebookmanager.py
NotebookManager.get_pid
def get_pid(self, name): """Get PID file name for a named notebook.""" pid_file = os.path.join(self.get_work_folder(name), "notebook.pid") return pid_file
python
def get_pid(self, name): """Get PID file name for a named notebook.""" pid_file = os.path.join(self.get_work_folder(name), "notebook.pid") return pid_file
[ "def", "get_pid", "(", "self", ",", "name", ")", ":", "pid_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "get_work_folder", "(", "name", ")", ",", "\"notebook.pid\"", ")", "return", "pid_file" ]
Get PID file name for a named notebook.
[ "Get", "PID", "file", "name", "for", "a", "named", "notebook", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/notebookmanager.py#L63-L66
50,045
websauna/pyramid_notebook
pyramid_notebook/notebookmanager.py
NotebookManager.get_manager_cmd
def get_manager_cmd(self): """Get our daemon script path.""" cmd = os.path.abspath(os.path.join(os.path.dirname(__file__), "server", "notebook_daemon.py")) assert os.path.exists(cmd) return cmd
python
def get_manager_cmd(self): """Get our daemon script path.""" cmd = os.path.abspath(os.path.join(os.path.dirname(__file__), "server", "notebook_daemon.py")) assert os.path.exists(cmd) return cmd
[ "def", "get_manager_cmd", "(", "self", ")", ":", "cmd", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"server\"", ",", "\"notebook_daemon.py\"", ")", ...
Get our daemon script path.
[ "Get", "our", "daemon", "script", "path", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/notebookmanager.py#L71-L75
50,046
websauna/pyramid_notebook
pyramid_notebook/notebookmanager.py
NotebookManager.get_notebook_daemon_command
def get_notebook_daemon_command(self, name, action, port=0, *extra): """ Assume we launch Notebook with the same Python which executed us. """ return [self.python, self.cmd, action, self.get_pid(name), self.get_work_folder(name), port, self.kill_timeout] + list(extra)
python
def get_notebook_daemon_command(self, name, action, port=0, *extra): """ Assume we launch Notebook with the same Python which executed us. """ return [self.python, self.cmd, action, self.get_pid(name), self.get_work_folder(name), port, self.kill_timeout] + list(extra)
[ "def", "get_notebook_daemon_command", "(", "self", ",", "name", ",", "action", ",", "port", "=", "0", ",", "*", "extra", ")", ":", "return", "[", "self", ".", "python", ",", "self", ".", "cmd", ",", "action", ",", "self", ".", "get_pid", "(", "name",...
Assume we launch Notebook with the same Python which executed us.
[ "Assume", "we", "launch", "Notebook", "with", "the", "same", "Python", "which", "executed", "us", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/notebookmanager.py#L82-L87
50,047
websauna/pyramid_notebook
pyramid_notebook/notebookmanager.py
NotebookManager.exec_notebook_daemon_command
def exec_notebook_daemon_command(self, name, cmd, port=0): """Run a daemon script command.""" cmd = self.get_notebook_daemon_command(name, cmd, port) # Make all arguments explicit strings cmd = [str(arg) for arg in cmd] logger.info("Running notebook command: %s", " ".join(cmd))...
python
def exec_notebook_daemon_command(self, name, cmd, port=0): """Run a daemon script command.""" cmd = self.get_notebook_daemon_command(name, cmd, port) # Make all arguments explicit strings cmd = [str(arg) for arg in cmd] logger.info("Running notebook command: %s", " ".join(cmd))...
[ "def", "exec_notebook_daemon_command", "(", "self", ",", "name", ",", "cmd", ",", "port", "=", "0", ")", ":", "cmd", "=", "self", ".", "get_notebook_daemon_command", "(", "name", ",", "cmd", ",", "port", ")", "# Make all arguments explicit strings", "cmd", "="...
Run a daemon script command.
[ "Run", "a", "daemon", "script", "command", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/notebookmanager.py#L89-L116
50,048
websauna/pyramid_notebook
pyramid_notebook/notebookmanager.py
NotebookManager.get_notebook_status
def get_notebook_status(self, name): """Get the running named Notebook status. :return: None if no notebook is running, otherwise context dictionary """ context = comm.get_context(self.get_pid(name)) if not context: return None return context
python
def get_notebook_status(self, name): """Get the running named Notebook status. :return: None if no notebook is running, otherwise context dictionary """ context = comm.get_context(self.get_pid(name)) if not context: return None return context
[ "def", "get_notebook_status", "(", "self", ",", "name", ")", ":", "context", "=", "comm", ".", "get_context", "(", "self", ".", "get_pid", "(", "name", ")", ")", "if", "not", "context", ":", "return", "None", "return", "context" ]
Get the running named Notebook status. :return: None if no notebook is running, otherwise context dictionary
[ "Get", "the", "running", "named", "Notebook", "status", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/notebookmanager.py#L118-L126
50,049
websauna/pyramid_notebook
pyramid_notebook/notebookmanager.py
NotebookManager.start_notebook
def start_notebook(self, name, context: dict, fg=False): """Start new IPython Notebook daemon. :param name: The owner of the Notebook will be *name*. He/she gets a new Notebook content folder created where all files are placed. :param context: Extra context information passed to the started No...
python
def start_notebook(self, name, context: dict, fg=False): """Start new IPython Notebook daemon. :param name: The owner of the Notebook will be *name*. He/she gets a new Notebook content folder created where all files are placed. :param context: Extra context information passed to the started No...
[ "def", "start_notebook", "(", "self", ",", "name", ",", "context", ":", "dict", ",", "fg", "=", "False", ")", ":", "assert", "context", "assert", "type", "(", "context", ")", "==", "dict", "assert", "\"context_hash\"", "in", "context", "assert", "type", ...
Start new IPython Notebook daemon. :param name: The owner of the Notebook will be *name*. He/she gets a new Notebook content folder created where all files are placed. :param context: Extra context information passed to the started Notebook. This must contain {context_hash:int} parameter used to ident...
[ "Start", "new", "IPython", "Notebook", "daemon", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/notebookmanager.py#L128-L161
50,050
websauna/pyramid_notebook
pyramid_notebook/notebookmanager.py
NotebookManager.start_notebook_on_demand
def start_notebook_on_demand(self, name, context): """Start notebook if not yet running with these settings. Return the updated settings with a port info. :return: (context dict, created flag) """ if self.is_running(name): last_context = self.get_context(name) ...
python
def start_notebook_on_demand(self, name, context): """Start notebook if not yet running with these settings. Return the updated settings with a port info. :return: (context dict, created flag) """ if self.is_running(name): last_context = self.get_context(name) ...
[ "def", "start_notebook_on_demand", "(", "self", ",", "name", ",", "context", ")", ":", "if", "self", ".", "is_running", "(", "name", ")", ":", "last_context", "=", "self", ".", "get_context", "(", "name", ")", "logger", ".", "info", "(", "\"Notebook contex...
Start notebook if not yet running with these settings. Return the updated settings with a port info. :return: (context dict, created flag)
[ "Start", "notebook", "if", "not", "yet", "running", "with", "these", "settings", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/notebookmanager.py#L181-L210
50,051
mgood/flask-failsafe
flask_failsafe.py
failsafe
def failsafe(func): """ Wraps an app factory to provide a fallback in case of import errors. Takes a factory function to generate a Flask app. If there is an error creating the app, it will return a dummy app that just returns the Flask error page for the exception. This works with the Flask c...
python
def failsafe(func): """ Wraps an app factory to provide a fallback in case of import errors. Takes a factory function to generate a Flask app. If there is an error creating the app, it will return a dummy app that just returns the Flask error page for the exception. This works with the Flask c...
[ "def", "failsafe", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "extra_files", "=", "[", "]", "try", ":", "return", "func", "(", "*", "args", ",", ...
Wraps an app factory to provide a fallback in case of import errors. Takes a factory function to generate a Flask app. If there is an error creating the app, it will return a dummy app that just returns the Flask error page for the exception. This works with the Flask code reloader so that if the app ...
[ "Wraps", "an", "app", "factory", "to", "provide", "a", "fallback", "in", "case", "of", "import", "errors", "." ]
03843348adb5cd202e90304f4fc75c0345572f76
https://github.com/mgood/flask-failsafe/blob/03843348adb5cd202e90304f4fc75c0345572f76/flask_failsafe.py#L11-L53
50,052
zyga/json-schema-validator
json_schema_validator/validator.py
Validator.validate
def validate(cls, schema, obj): """ Validate specified JSON object obj with specified schema. :param schema: Schema to validate against :type schema: :class:`json_schema_validator.schema.Schema` :param obj: JSON object to validate :rty...
python
def validate(cls, schema, obj): """ Validate specified JSON object obj with specified schema. :param schema: Schema to validate against :type schema: :class:`json_schema_validator.schema.Schema` :param obj: JSON object to validate :rty...
[ "def", "validate", "(", "cls", ",", "schema", ",", "obj", ")", ":", "if", "not", "isinstance", "(", "schema", ",", "Schema", ")", ":", "raise", "ValueError", "(", "\"schema value {0!r} is not a Schema\"", "\" object\"", ".", "format", "(", "schema", ")", ")"...
Validate specified JSON object obj with specified schema. :param schema: Schema to validate against :type schema: :class:`json_schema_validator.schema.Schema` :param obj: JSON object to validate :rtype: bool :returns: T...
[ "Validate", "specified", "JSON", "object", "obj", "with", "specified", "schema", "." ]
0504605da5c0a9a5b5b05c41b37661aec9652144
https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/validator.py#L81-L106
50,053
zyga/json-schema-validator
json_schema_validator/validator.py
Validator._report_error
def _report_error(self, legacy_message, new_message=None, schema_suffix=None): """ Report an error during validation. There are two error messages. The legacy message is used for backwards compatibility and usually contains the object (possibly very large) ...
python
def _report_error(self, legacy_message, new_message=None, schema_suffix=None): """ Report an error during validation. There are two error messages. The legacy message is used for backwards compatibility and usually contains the object (possibly very large) ...
[ "def", "_report_error", "(", "self", ",", "legacy_message", ",", "new_message", "=", "None", ",", "schema_suffix", "=", "None", ")", ":", "object_expr", "=", "self", ".", "_get_object_expression", "(", ")", "schema_expr", "=", "self", ".", "_get_schema_expressio...
Report an error during validation. There are two error messages. The legacy message is used for backwards compatibility and usually contains the object (possibly very large) that failed to validate. The new message is much better as it contains just a short message on what went wrong. U...
[ "Report", "an", "error", "during", "validation", "." ]
0504605da5c0a9a5b5b05c41b37661aec9652144
https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/validator.py#L142-L164
50,054
zyga/json-schema-validator
json_schema_validator/validator.py
Validator._push_property_schema
def _push_property_schema(self, prop): """Construct a sub-schema from a property of the current schema.""" schema = Schema(self._schema.properties[prop]) self._push_schema(schema, ".properties." + prop)
python
def _push_property_schema(self, prop): """Construct a sub-schema from a property of the current schema.""" schema = Schema(self._schema.properties[prop]) self._push_schema(schema, ".properties." + prop)
[ "def", "_push_property_schema", "(", "self", ",", "prop", ")", ":", "schema", "=", "Schema", "(", "self", ".", "_schema", ".", "properties", "[", "prop", "]", ")", "self", ".", "_push_schema", "(", "schema", ",", "\".properties.\"", "+", "prop", ")" ]
Construct a sub-schema from a property of the current schema.
[ "Construct", "a", "sub", "-", "schema", "from", "a", "property", "of", "the", "current", "schema", "." ]
0504605da5c0a9a5b5b05c41b37661aec9652144
https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/validator.py#L166-L169
50,055
websauna/pyramid_notebook
pyramid_notebook/server/comm.py
get_context_file_name
def get_context_file_name(pid_file): """When the daemon is started write out the information which port it was using.""" root = os.path.dirname(pid_file) port_file = os.path.join(root, "context.json") return port_file
python
def get_context_file_name(pid_file): """When the daemon is started write out the information which port it was using.""" root = os.path.dirname(pid_file) port_file = os.path.join(root, "context.json") return port_file
[ "def", "get_context_file_name", "(", "pid_file", ")", ":", "root", "=", "os", ".", "path", ".", "dirname", "(", "pid_file", ")", "port_file", "=", "os", ".", "path", ".", "join", "(", "root", ",", "\"context.json\"", ")", "return", "port_file" ]
When the daemon is started write out the information which port it was using.
[ "When", "the", "daemon", "is", "started", "write", "out", "the", "information", "which", "port", "it", "was", "using", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/server/comm.py#L31-L35
50,056
websauna/pyramid_notebook
pyramid_notebook/server/comm.py
set_context
def set_context(pid_file, context_info): """Set context of running notebook. :param context_info: dict of extra context parameters, see comm.py comments """ assert type(context_info) == dict port_file = get_context_file_name(pid_file) with open(port_file, "wt") as f: f.write(json.dumps...
python
def set_context(pid_file, context_info): """Set context of running notebook. :param context_info: dict of extra context parameters, see comm.py comments """ assert type(context_info) == dict port_file = get_context_file_name(pid_file) with open(port_file, "wt") as f: f.write(json.dumps...
[ "def", "set_context", "(", "pid_file", ",", "context_info", ")", ":", "assert", "type", "(", "context_info", ")", "==", "dict", "port_file", "=", "get_context_file_name", "(", "pid_file", ")", "with", "open", "(", "port_file", ",", "\"wt\"", ")", "as", "f", ...
Set context of running notebook. :param context_info: dict of extra context parameters, see comm.py comments
[ "Set", "context", "of", "running", "notebook", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/server/comm.py#L38-L47
50,057
websauna/pyramid_notebook
pyramid_notebook/server/comm.py
get_context
def get_context(pid_file, daemon=False): """Get context of running notebook. A context file is created when notebook starts. :param daemon: Are we trying to fetch the context inside the daemon. Otherwise do the death check. :return: dict or None if the process is dead/not launcherd """ port_f...
python
def get_context(pid_file, daemon=False): """Get context of running notebook. A context file is created when notebook starts. :param daemon: Are we trying to fetch the context inside the daemon. Otherwise do the death check. :return: dict or None if the process is dead/not launcherd """ port_f...
[ "def", "get_context", "(", "pid_file", ",", "daemon", "=", "False", ")", ":", "port_file", "=", "get_context_file_name", "(", "pid_file", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "port_file", ")", ":", "return", "None", "with", "open", "(...
Get context of running notebook. A context file is created when notebook starts. :param daemon: Are we trying to fetch the context inside the daemon. Otherwise do the death check. :return: dict or None if the process is dead/not launcherd
[ "Get", "context", "of", "running", "notebook", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/server/comm.py#L50-L79
50,058
websauna/pyramid_notebook
pyramid_notebook/server/comm.py
clear_context
def clear_context(pid_file): """Called at exit. Delete the context file to signal there is no active notebook. We don't delete the whole file, but leave it around for debugging purposes. Maybe later we want to pass some information back to the web site. """ return raise RuntimeError("Should not hap...
python
def clear_context(pid_file): """Called at exit. Delete the context file to signal there is no active notebook. We don't delete the whole file, but leave it around for debugging purposes. Maybe later we want to pass some information back to the web site. """ return raise RuntimeError("Should not hap...
[ "def", "clear_context", "(", "pid_file", ")", ":", "return", "raise", "RuntimeError", "(", "\"Should not happen\"", ")", "fname", "=", "get_context_file_name", "(", "pid_file", ")", "shutil", ".", "move", "(", "fname", ",", "fname", ".", "replace", "(", "\"con...
Called at exit. Delete the context file to signal there is no active notebook. We don't delete the whole file, but leave it around for debugging purposes. Maybe later we want to pass some information back to the web site.
[ "Called", "at", "exit", ".", "Delete", "the", "context", "file", "to", "signal", "there", "is", "no", "active", "notebook", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/server/comm.py#L82-L94
50,059
6809/MC6809
MC6809/components/mc6809_speedlimited.py
CPUSpeedLimitMixin.delayed_burst_run
def delayed_burst_run(self, target_cycles_per_sec): """ Run CPU not faster than given speedlimit """ old_cycles = self.cycles start_time = time.time() self.burst_run() is_duration = time.time() - start_time new_cycles = self.cycles - old_cycles try: ...
python
def delayed_burst_run(self, target_cycles_per_sec): """ Run CPU not faster than given speedlimit """ old_cycles = self.cycles start_time = time.time() self.burst_run() is_duration = time.time() - start_time new_cycles = self.cycles - old_cycles try: ...
[ "def", "delayed_burst_run", "(", "self", ",", "target_cycles_per_sec", ")", ":", "old_cycles", "=", "self", ".", "cycles", "start_time", "=", "time", ".", "time", "(", ")", "self", ".", "burst_run", "(", ")", "is_duration", "=", "time", ".", "time", "(", ...
Run CPU not faster than given speedlimit
[ "Run", "CPU", "not", "faster", "than", "given", "speedlimit" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_speedlimited.py#L34-L58
50,060
pydanny/django-tagging-ext
tagging_ext/views.py
get_model_counts
def get_model_counts(tagged_models, tag): """ This does a model count so the side bar looks nice. """ model_counts = [] for model in tagged_models: model['count'] = model['query'](tag).count() if model['count']: model_counts.append(model) return model_co...
python
def get_model_counts(tagged_models, tag): """ This does a model count so the side bar looks nice. """ model_counts = [] for model in tagged_models: model['count'] = model['query'](tag).count() if model['count']: model_counts.append(model) return model_co...
[ "def", "get_model_counts", "(", "tagged_models", ",", "tag", ")", ":", "model_counts", "=", "[", "]", "for", "model", "in", "tagged_models", ":", "model", "[", "'count'", "]", "=", "model", "[", "'query'", "]", "(", "tag", ")", ".", "count", "(", ")", ...
This does a model count so the side bar looks nice.
[ "This", "does", "a", "model", "count", "so", "the", "side", "bar", "looks", "nice", "." ]
a25a79ddcd760c5ab272713178f40fedd9146b41
https://github.com/pydanny/django-tagging-ext/blob/a25a79ddcd760c5ab272713178f40fedd9146b41/tagging_ext/views.py#L21-L30
50,061
click-contrib/click-threading
click_threading/monkey.py
patch_ui_functions
def patch_ui_functions(wrapper): '''Wrap all termui functions with a custom decorator.''' NONE = object() import click saved = [] for name, info in sorted(_ui_functions.items()): f = getattr(click, name, NONE) if f is NONE: continue new_f = wrapper(_copy_fn(f),...
python
def patch_ui_functions(wrapper): '''Wrap all termui functions with a custom decorator.''' NONE = object() import click saved = [] for name, info in sorted(_ui_functions.items()): f = getattr(click, name, NONE) if f is NONE: continue new_f = wrapper(_copy_fn(f),...
[ "def", "patch_ui_functions", "(", "wrapper", ")", ":", "NONE", "=", "object", "(", ")", "import", "click", "saved", "=", "[", "]", "for", "name", ",", "info", "in", "sorted", "(", "_ui_functions", ".", "items", "(", ")", ")", ":", "f", "=", "getattr"...
Wrap all termui functions with a custom decorator.
[ "Wrap", "all", "termui", "functions", "with", "a", "custom", "decorator", "." ]
e85b2bc14e450516c3b10291d0732dc15bf3dd7a
https://github.com/click-contrib/click-threading/blob/e85b2bc14e450516c3b10291d0732dc15bf3dd7a/click_threading/monkey.py#L29-L71
50,062
williballenthin/python-pyqt5-hexview
hexview/tablecellstylemodels.py
compute_region_border
def compute_region_border(start, end): """ given the buffer start and end indices of a range, compute the border edges that should be drawn to enclose the range. this function currently assumes 0x10 length rows. the result is a dictionary from buffer index to Cell instance. the Cell instance ...
python
def compute_region_border(start, end): """ given the buffer start and end indices of a range, compute the border edges that should be drawn to enclose the range. this function currently assumes 0x10 length rows. the result is a dictionary from buffer index to Cell instance. the Cell instance ...
[ "def", "compute_region_border", "(", "start", ",", "end", ")", ":", "cells", "=", "defaultdict", "(", "Cell", ")", "start_row", "=", "row_number", "(", "start", ")", "end_row", "=", "row_number", "(", "end", ")", "if", "end", "%", "0x10", "==", "0", ":...
given the buffer start and end indices of a range, compute the border edges that should be drawn to enclose the range. this function currently assumes 0x10 length rows. the result is a dictionary from buffer index to Cell instance. the Cell instance has boolean properties "top", "bottom", "left", and...
[ "given", "the", "buffer", "start", "and", "end", "indices", "of", "a", "range", "compute", "the", "border", "edges", "that", "should", "be", "drawn", "to", "enclose", "the", "range", "." ]
461feb286dfde60bdbc12b3fb772d650f4b8ba71
https://github.com/williballenthin/python-pyqt5-hexview/blob/461feb286dfde60bdbc12b3fb772d650f4b8ba71/hexview/tablecellstylemodels.py#L101-L170
50,063
cykl/infoqscraper
infoqscraper/convert.py
swf2png
def swf2png(swf_path, png_path, swfrender_path="swfrender"): """Convert SWF slides into a PNG image Raises: OSError is raised if swfrender is not available. ConversionError is raised if image cannot be created. """ # Currently rely on swftools # # Would be great to have a native...
python
def swf2png(swf_path, png_path, swfrender_path="swfrender"): """Convert SWF slides into a PNG image Raises: OSError is raised if swfrender is not available. ConversionError is raised if image cannot be created. """ # Currently rely on swftools # # Would be great to have a native...
[ "def", "swf2png", "(", "swf_path", ",", "png_path", ",", "swfrender_path", "=", "\"swfrender\"", ")", ":", "# Currently rely on swftools", "#", "# Would be great to have a native python dependency to convert swf into png or jpg.", "# However it seems that pyswf isn't flawless. Some gr...
Convert SWF slides into a PNG image Raises: OSError is raised if swfrender is not available. ConversionError is raised if image cannot be created.
[ "Convert", "SWF", "slides", "into", "a", "PNG", "image" ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/convert.py#L340-L360
50,064
cykl/infoqscraper
infoqscraper/convert.py
Converter.create_presentation
def create_presentation(self): """ Create the presentation. The audio track is mixed with the slides. The resulting file is saved as self.output DownloadError is raised if some resources cannot be fetched. ConversionError is raised if the final video cannot be created. """ ...
python
def create_presentation(self): """ Create the presentation. The audio track is mixed with the slides. The resulting file is saved as self.output DownloadError is raised if some resources cannot be fetched. ConversionError is raised if the final video cannot be created. """ ...
[ "def", "create_presentation", "(", "self", ")", ":", "# Avoid wasting time and bandwidth if we known that conversion will fail.", "if", "not", "self", ".", "overwrite", "and", "os", ".", "path", ".", "exists", "(", "self", ".", "output", ")", ":", "raise", "Conversi...
Create the presentation. The audio track is mixed with the slides. The resulting file is saved as self.output DownloadError is raised if some resources cannot be fetched. ConversionError is raised if the final video cannot be created.
[ "Create", "the", "presentation", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/convert.py#L70-L90
50,065
cykl/infoqscraper
infoqscraper/convert.py
Converter.download_slides
def download_slides(self): """ Download all SWF slides. The location of the slides files are returned. A DownloadError is raised if at least one of the slides cannot be download.. """ return self.presentation.client.download_all(self.presentation.metadata['slides'], self.tmp_di...
python
def download_slides(self): """ Download all SWF slides. The location of the slides files are returned. A DownloadError is raised if at least one of the slides cannot be download.. """ return self.presentation.client.download_all(self.presentation.metadata['slides'], self.tmp_di...
[ "def", "download_slides", "(", "self", ")", ":", "return", "self", ".", "presentation", ".", "client", ".", "download_all", "(", "self", ".", "presentation", ".", "metadata", "[", "'slides'", "]", ",", "self", ".", "tmp_dir", ")" ]
Download all SWF slides. The location of the slides files are returned. A DownloadError is raised if at least one of the slides cannot be download..
[ "Download", "all", "SWF", "slides", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/convert.py#L147-L154
50,066
cykl/infoqscraper
infoqscraper/client.py
InfoQ.fetch_no_cache
def fetch_no_cache(self, url): """ Fetch the resource specified and return its content. DownloadError is raised if the resource cannot be fetched. """ try: with contextlib.closing(self.opener.open(url)) as response: # InfoQ does not send a 404 but a 302 ...
python
def fetch_no_cache(self, url): """ Fetch the resource specified and return its content. DownloadError is raised if the resource cannot be fetched. """ try: with contextlib.closing(self.opener.open(url)) as response: # InfoQ does not send a 404 but a 302 ...
[ "def", "fetch_no_cache", "(", "self", ",", "url", ")", ":", "try", ":", "with", "contextlib", ".", "closing", "(", "self", ".", "opener", ".", "open", "(", "url", ")", ")", "as", "response", ":", "# InfoQ does not send a 404 but a 302 redirecting to a valid URL....
Fetch the resource specified and return its content. DownloadError is raised if the resource cannot be fetched.
[ "Fetch", "the", "resource", "specified", "and", "return", "its", "content", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/client.py#L92-L105
50,067
cykl/infoqscraper
infoqscraper/client.py
InfoQ.download
def download(self, url, dir_path, filename=None): """ Download the resources specified by url into dir_path. The resulting file path is returned. DownloadError is raised the resources cannot be downloaded. """ if not filename: filename = url.rsplit('/', 1)[1]...
python
def download(self, url, dir_path, filename=None): """ Download the resources specified by url into dir_path. The resulting file path is returned. DownloadError is raised the resources cannot be downloaded. """ if not filename: filename = url.rsplit('/', 1)[1]...
[ "def", "download", "(", "self", ",", "url", ",", "dir_path", ",", "filename", "=", "None", ")", ":", "if", "not", "filename", ":", "filename", "=", "url", ".", "rsplit", "(", "'/'", ",", "1", ")", "[", "1", "]", "path", "=", "os", ".", "path", ...
Download the resources specified by url into dir_path. The resulting file path is returned. DownloadError is raised the resources cannot be downloaded.
[ "Download", "the", "resources", "specified", "by", "url", "into", "dir_path", ".", "The", "resulting", "file", "path", "is", "returned", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/client.py#L107-L121
50,068
cykl/infoqscraper
infoqscraper/client.py
InfoQ.download_all
def download_all(self, urls, dir_path): """ Download all the resources specified by urls into dir_path. The resulting file paths is returned. DownloadError is raised if at least one of the resources cannot be downloaded. In the case already downloaded resources are erased. ...
python
def download_all(self, urls, dir_path): """ Download all the resources specified by urls into dir_path. The resulting file paths is returned. DownloadError is raised if at least one of the resources cannot be downloaded. In the case already downloaded resources are erased. ...
[ "def", "download_all", "(", "self", ",", "urls", ",", "dir_path", ")", ":", "# TODO: Implement parallel download", "filenames", "=", "[", "]", "try", ":", "for", "url", "in", "urls", ":", "filenames", ".", "append", "(", "self", ".", "download", "(", "url"...
Download all the resources specified by urls into dir_path. The resulting file paths is returned. DownloadError is raised if at least one of the resources cannot be downloaded. In the case already downloaded resources are erased.
[ "Download", "all", "the", "resources", "specified", "by", "urls", "into", "dir_path", ".", "The", "resulting", "file", "paths", "is", "returned", "." ]
4fc026b994f98a0a7fe8578e0c9a3a9664982b2e
https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/client.py#L123-L141
50,069
6809/MC6809
MC6809/components/mc6809_stack.py
StackMixin.push_byte
def push_byte(self, stack_pointer, byte): """ pushed a byte onto stack """ # FIXME: self.system_stack_pointer -= 1 stack_pointer.decrement(1) addr = stack_pointer.value # log.info( # log.error( # "%x|\tpush $%x to %s stack at $%x\t|%s", # self.last_o...
python
def push_byte(self, stack_pointer, byte): """ pushed a byte onto stack """ # FIXME: self.system_stack_pointer -= 1 stack_pointer.decrement(1) addr = stack_pointer.value # log.info( # log.error( # "%x|\tpush $%x to %s stack at $%x\t|%s", # self.last_o...
[ "def", "push_byte", "(", "self", ",", "stack_pointer", ",", "byte", ")", ":", "# FIXME: self.system_stack_pointer -= 1", "stack_pointer", ".", "decrement", "(", "1", ")", "addr", "=", "stack_pointer", ".", "value", "# log.info(", "# log.error(", "# ...
pushed a byte onto stack
[ "pushed", "a", "byte", "onto", "stack" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_stack.py#L37-L49
50,070
6809/MC6809
MC6809/components/mc6809_stack.py
StackMixin.pull_byte
def pull_byte(self, stack_pointer): """ pulled a byte from stack """ addr = stack_pointer.value byte = self.memory.read_byte(addr) # log.info( # log.error( # "%x|\tpull $%x from %s stack at $%x\t|%s", # self.last_op_address, byte, stack_pointer.name, addr, # ...
python
def pull_byte(self, stack_pointer): """ pulled a byte from stack """ addr = stack_pointer.value byte = self.memory.read_byte(addr) # log.info( # log.error( # "%x|\tpull $%x from %s stack at $%x\t|%s", # self.last_op_address, byte, stack_pointer.name, addr, # ...
[ "def", "pull_byte", "(", "self", ",", "stack_pointer", ")", ":", "addr", "=", "stack_pointer", ".", "value", "byte", "=", "self", ".", "memory", ".", "read_byte", "(", "addr", ")", "# log.info(", "# log.error(", "# \"%x|\\tpull $%x from %s ...
pulled a byte from stack
[ "pulled", "a", "byte", "from", "stack" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_stack.py#L51-L65
50,071
websauna/pyramid_notebook
pyramid_notebook/views.py
proxy_it
def proxy_it(request, port): """Proxy HTTP request to upstream IPython Notebook Tornado server.""" # Check if we have websocket proxy configured websocket_proxy = request.registry.settings.get("pyramid_notebook.websocket_proxy", "") if websocket_proxy.strip(): r = DottedNameResolver() w...
python
def proxy_it(request, port): """Proxy HTTP request to upstream IPython Notebook Tornado server.""" # Check if we have websocket proxy configured websocket_proxy = request.registry.settings.get("pyramid_notebook.websocket_proxy", "") if websocket_proxy.strip(): r = DottedNameResolver() w...
[ "def", "proxy_it", "(", "request", ",", "port", ")", ":", "# Check if we have websocket proxy configured", "websocket_proxy", "=", "request", ".", "registry", ".", "settings", ".", "get", "(", "\"pyramid_notebook.websocket_proxy\"", ",", "\"\"", ")", "if", "websocket_...
Proxy HTTP request to upstream IPython Notebook Tornado server.
[ "Proxy", "HTTP", "request", "to", "upstream", "IPython", "Notebook", "Tornado", "server", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/views.py#L27-L45
50,072
websauna/pyramid_notebook
pyramid_notebook/views.py
prepare_notebook_context
def prepare_notebook_context(request, notebook_context): """Fill in notebook context with default values.""" if not notebook_context: notebook_context = {} # Override notebook Jinja templates if "extra_template_paths" not in notebook_context: notebook_context["extra_template_paths"] = ...
python
def prepare_notebook_context(request, notebook_context): """Fill in notebook context with default values.""" if not notebook_context: notebook_context = {} # Override notebook Jinja templates if "extra_template_paths" not in notebook_context: notebook_context["extra_template_paths"] = ...
[ "def", "prepare_notebook_context", "(", "request", ",", "notebook_context", ")", ":", "if", "not", "notebook_context", ":", "notebook_context", "=", "{", "}", "# Override notebook Jinja templates", "if", "\"extra_template_paths\"", "not", "in", "notebook_context", ":", ...
Fill in notebook context with default values.
[ "Fill", "in", "notebook", "context", "with", "default", "values", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/views.py#L53-L93
50,073
websauna/pyramid_notebook
pyramid_notebook/views.py
launch_on_demand
def launch_on_demand(request, username, notebook_context): """See if we have notebook already running this context and if not then launch new one.""" security_check(request, username) settings = request.registry.settings notebook_folder = settings.get("pyramid_notebook.notebook_folder", None) if n...
python
def launch_on_demand(request, username, notebook_context): """See if we have notebook already running this context and if not then launch new one.""" security_check(request, username) settings = request.registry.settings notebook_folder = settings.get("pyramid_notebook.notebook_folder", None) if n...
[ "def", "launch_on_demand", "(", "request", ",", "username", ",", "notebook_context", ")", ":", "security_check", "(", "request", ",", "username", ")", "settings", "=", "request", ".", "registry", ".", "settings", "notebook_folder", "=", "settings", ".", "get", ...
See if we have notebook already running this context and if not then launch new one.
[ "See", "if", "we", "have", "notebook", "already", "running", "this", "context", "and", "if", "not", "then", "launch", "new", "one", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/views.py#L96-L152
50,074
websauna/pyramid_notebook
pyramid_notebook/views.py
shutdown_notebook
def shutdown_notebook(request, username): """Stop any running notebook for a user.""" manager = get_notebook_manager(request) if manager.is_running(username): manager.stop_notebook(username)
python
def shutdown_notebook(request, username): """Stop any running notebook for a user.""" manager = get_notebook_manager(request) if manager.is_running(username): manager.stop_notebook(username)
[ "def", "shutdown_notebook", "(", "request", ",", "username", ")", ":", "manager", "=", "get_notebook_manager", "(", "request", ")", "if", "manager", ".", "is_running", "(", "username", ")", ":", "manager", ".", "stop_notebook", "(", "username", ")" ]
Stop any running notebook for a user.
[ "Stop", "any", "running", "notebook", "for", "a", "user", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/views.py#L190-L195
50,075
websauna/pyramid_notebook
pyramid_notebook/utils.py
route_to_alt_domain
def route_to_alt_domain(request, url): """Route URL to a different subdomain. Used to rewrite URLs to point to websocket serving domain. """ # Do we need to route IPython Notebook request from a different location alternative_domain = request.registry.settings.get("pyramid_notebook.alternative_dom...
python
def route_to_alt_domain(request, url): """Route URL to a different subdomain. Used to rewrite URLs to point to websocket serving domain. """ # Do we need to route IPython Notebook request from a different location alternative_domain = request.registry.settings.get("pyramid_notebook.alternative_dom...
[ "def", "route_to_alt_domain", "(", "request", ",", "url", ")", ":", "# Do we need to route IPython Notebook request from a different location", "alternative_domain", "=", "request", ".", "registry", ".", "settings", ".", "get", "(", "\"pyramid_notebook.alternative_domain\"", ...
Route URL to a different subdomain. Used to rewrite URLs to point to websocket serving domain.
[ "Route", "URL", "to", "a", "different", "subdomain", "." ]
8a7ecfa0259810de1a818e4b415a62811a7b077a
https://github.com/websauna/pyramid_notebook/blob/8a7ecfa0259810de1a818e4b415a62811a7b077a/pyramid_notebook/utils.py#L64-L75
50,076
williballenthin/python-pyqt5-hexview
hexview/hexview.py
HexItemSelectionModel._bselect
def _bselect(self, selection, start_bindex, end_bindex): """ add the given buffer indices to the given QItemSelection, both byte and char panes """ selection.select(self._model.index2qindexb(start_bindex), self._model.index2qindexb(end_bindex)) selection.select(self._model.index2qindexc(start_bi...
python
def _bselect(self, selection, start_bindex, end_bindex): """ add the given buffer indices to the given QItemSelection, both byte and char panes """ selection.select(self._model.index2qindexb(start_bindex), self._model.index2qindexb(end_bindex)) selection.select(self._model.index2qindexc(start_bi...
[ "def", "_bselect", "(", "self", ",", "selection", ",", "start_bindex", ",", "end_bindex", ")", ":", "selection", ".", "select", "(", "self", ".", "_model", ".", "index2qindexb", "(", "start_bindex", ")", ",", "self", ".", "_model", ".", "index2qindexb", "(...
add the given buffer indices to the given QItemSelection, both byte and char panes
[ "add", "the", "given", "buffer", "indices", "to", "the", "given", "QItemSelection", "both", "byte", "and", "char", "panes" ]
461feb286dfde60bdbc12b3fb772d650f4b8ba71
https://github.com/williballenthin/python-pyqt5-hexview/blob/461feb286dfde60bdbc12b3fb772d650f4b8ba71/hexview/hexview.py#L252-L255
50,077
williballenthin/python-pyqt5-hexview
hexview/hexview.py
HexItemSelectionModel._do_select
def _do_select(self, start_bindex, end_bindex): """ select the given range by buffer indices selects items like this: .................. ......xxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxx...... ............
python
def _do_select(self, start_bindex, end_bindex): """ select the given range by buffer indices selects items like this: .................. ......xxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxx...... ............
[ "def", "_do_select", "(", "self", ",", "start_bindex", ",", "end_bindex", ")", ":", "self", ".", "select", "(", "QItemSelection", "(", ")", ",", "QItemSelectionModel", ".", "Clear", ")", "if", "start_bindex", ">", "end_bindex", ":", "start_bindex", ",", "end...
select the given range by buffer indices selects items like this: .................. ......xxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxx...... .................. *not* like this: .................. ...
[ "select", "the", "given", "range", "by", "buffer", "indices" ]
461feb286dfde60bdbc12b3fb772d650f4b8ba71
https://github.com/williballenthin/python-pyqt5-hexview/blob/461feb286dfde60bdbc12b3fb772d650f4b8ba71/hexview/hexview.py#L257-L300
50,078
williballenthin/python-pyqt5-hexview
hexview/hexview.py
HexItemSelectionModel._update_selection
def _update_selection(self, qindex1, qindex2): """ select the given range by qmodel indices """ m = self.model() self._do_select(m.qindex2index(qindex1), m.qindex2index(qindex2))
python
def _update_selection(self, qindex1, qindex2): """ select the given range by qmodel indices """ m = self.model() self._do_select(m.qindex2index(qindex1), m.qindex2index(qindex2))
[ "def", "_update_selection", "(", "self", ",", "qindex1", ",", "qindex2", ")", ":", "m", "=", "self", ".", "model", "(", ")", "self", ".", "_do_select", "(", "m", ".", "qindex2index", "(", "qindex1", ")", ",", "m", ".", "qindex2index", "(", "qindex2", ...
select the given range by qmodel indices
[ "select", "the", "given", "range", "by", "qmodel", "indices" ]
461feb286dfde60bdbc12b3fb772d650f4b8ba71
https://github.com/williballenthin/python-pyqt5-hexview/blob/461feb286dfde60bdbc12b3fb772d650f4b8ba71/hexview/hexview.py#L403-L406
50,079
williballenthin/python-pyqt5-hexview
hexview/hexview.py
HexViewWidget.get_context_menu
def get_context_menu(self, qpoint): """ override this method to customize the context menu """ menu = QMenu(self) index = self.view.indexAt(qpoint) def add_action(menu, text, handler, icon=None): a = None if icon is None: a = QAction(text, self) ...
python
def get_context_menu(self, qpoint): """ override this method to customize the context menu """ menu = QMenu(self) index = self.view.indexAt(qpoint) def add_action(menu, text, handler, icon=None): a = None if icon is None: a = QAction(text, self) ...
[ "def", "get_context_menu", "(", "self", ",", "qpoint", ")", ":", "menu", "=", "QMenu", "(", "self", ")", "index", "=", "self", ".", "view", ".", "indexAt", "(", "qpoint", ")", "def", "add_action", "(", "menu", ",", "text", ",", "handler", ",", "icon"...
override this method to customize the context menu
[ "override", "this", "method", "to", "customize", "the", "context", "menu" ]
461feb286dfde60bdbc12b3fb772d650f4b8ba71
https://github.com/williballenthin/python-pyqt5-hexview/blob/461feb286dfde60bdbc12b3fb772d650f4b8ba71/hexview/hexview.py#L657-L714
50,080
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.add_sync_callback
def add_sync_callback(self, callback_cycles, callback): """ Add a CPU cycle triggered callback """ self.sync_callbacks_cyles[callback] = 0 self.sync_callbacks.append([callback_cycles, callback]) if self.quickest_sync_callback_cycles is None or \ self.quickest_sync...
python
def add_sync_callback(self, callback_cycles, callback): """ Add a CPU cycle triggered callback """ self.sync_callbacks_cyles[callback] = 0 self.sync_callbacks.append([callback_cycles, callback]) if self.quickest_sync_callback_cycles is None or \ self.quickest_sync...
[ "def", "add_sync_callback", "(", "self", ",", "callback_cycles", ",", "callback", ")", ":", "self", ".", "sync_callbacks_cyles", "[", "callback", "]", "=", "0", "self", ".", "sync_callbacks", ".", "append", "(", "[", "callback_cycles", ",", "callback", "]", ...
Add a CPU cycle triggered callback
[ "Add", "a", "CPU", "cycle", "triggered", "callback" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L259-L265
50,081
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.call_sync_callbacks
def call_sync_callbacks(self): """ Call every sync callback with CPU cycles trigger """ current_cycles = self.cycles for callback_cycles, callback in self.sync_callbacks: # get the CPU cycles count of the last call last_call_cycles = self.sync_callbacks_cyles[callback] ...
python
def call_sync_callbacks(self): """ Call every sync callback with CPU cycles trigger """ current_cycles = self.cycles for callback_cycles, callback in self.sync_callbacks: # get the CPU cycles count of the last call last_call_cycles = self.sync_callbacks_cyles[callback] ...
[ "def", "call_sync_callbacks", "(", "self", ")", ":", "current_cycles", "=", "self", ".", "cycles", "for", "callback_cycles", ",", "callback", "in", "self", ".", "sync_callbacks", ":", "# get the CPU cycles count of the last call", "last_call_cycles", "=", "self", ".",...
Call every sync callback with CPU cycles trigger
[ "Call", "every", "sync", "callback", "with", "CPU", "cycles", "trigger" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L267-L281
50,082
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.burst_run
def burst_run(self): """ Run CPU as fast as Python can... """ # https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Avoiding_dots... get_and_call_next_op = self.get_and_call_next_op for __ in range(self.outer_burst_op_count): for __ in range(self.inner_burst_op_count): ...
python
def burst_run(self): """ Run CPU as fast as Python can... """ # https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Avoiding_dots... get_and_call_next_op = self.get_and_call_next_op for __ in range(self.outer_burst_op_count): for __ in range(self.inner_burst_op_count): ...
[ "def", "burst_run", "(", "self", ")", ":", "# https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Avoiding_dots...", "get_and_call_next_op", "=", "self", ".", "get_and_call_next_op", "for", "__", "in", "range", "(", "self", ".", "outer_burst_op_count", ")", ":", "for...
Run CPU as fast as Python can...
[ "Run", "CPU", "as", "fast", "as", "Python", "can", "..." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L285-L294
50,083
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.instruction_PAGE
def instruction_PAGE(self, opcode): """ call op from page 2 or 3 """ op_address, opcode2 = self.read_pc_byte() paged_opcode = opcode * 256 + opcode2 # log.debug("$%x *** call paged opcode $%x" % ( # self.program_counter, paged_opcode # )) self.call_instruction_fu...
python
def instruction_PAGE(self, opcode): """ call op from page 2 or 3 """ op_address, opcode2 = self.read_pc_byte() paged_opcode = opcode * 256 + opcode2 # log.debug("$%x *** call paged opcode $%x" % ( # self.program_counter, paged_opcode # )) self.call_instruction_fu...
[ "def", "instruction_PAGE", "(", "self", ",", "opcode", ")", ":", "op_address", ",", "opcode2", "=", "self", ".", "read_pc_byte", "(", ")", "paged_opcode", "=", "opcode", "*", "256", "+", "opcode2", "# log.debug(\"$%x *** call paged opcode $%x\" % (", "# ...
call op from page 2 or 3
[ "call", "op", "from", "page", "2", "or", "3" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L389-L396
50,084
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.instruction_ADD16
def instruction_ADD16(self, opcode, m, register): """ Adds the 16-bit memory value into the 16-bit accumulator source code forms: ADDD P CC bits "HNZVC": -aaaa """ assert register.WIDTH == 16 old = register.value r = old + m register.set(r) # ...
python
def instruction_ADD16(self, opcode, m, register): """ Adds the 16-bit memory value into the 16-bit accumulator source code forms: ADDD P CC bits "HNZVC": -aaaa """ assert register.WIDTH == 16 old = register.value r = old + m register.set(r) # ...
[ "def", "instruction_ADD16", "(", "self", ",", "opcode", ",", "m", ",", "register", ")", ":", "assert", "register", ".", "WIDTH", "==", "16", "old", "=", "register", ".", "value", "r", "=", "old", "+", "m", "register", ".", "set", "(", "r", ")", "# ...
Adds the 16-bit memory value into the 16-bit accumulator source code forms: ADDD P CC bits "HNZVC": -aaaa
[ "Adds", "the", "16", "-", "bit", "memory", "value", "into", "the", "16", "-", "bit", "accumulator" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L437-L455
50,085
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.instruction_ADD8
def instruction_ADD8(self, opcode, m, register): """ Adds the memory byte into an 8-bit accumulator. source code forms: ADDA P; ADDB P CC bits "HNZVC": aaaaa """ assert register.WIDTH == 8 old = register.value r = old + m register.set(r) # ...
python
def instruction_ADD8(self, opcode, m, register): """ Adds the memory byte into an 8-bit accumulator. source code forms: ADDA P; ADDB P CC bits "HNZVC": aaaaa """ assert register.WIDTH == 8 old = register.value r = old + m register.set(r) # ...
[ "def", "instruction_ADD8", "(", "self", ",", "opcode", ",", "m", ",", "register", ")", ":", "assert", "register", ".", "WIDTH", "==", "8", "old", "=", "register", ".", "value", "r", "=", "old", "+", "m", "register", ".", "set", "(", "r", ")", "# ...
Adds the memory byte into an 8-bit accumulator. source code forms: ADDA P; ADDB P CC bits "HNZVC": aaaaa
[ "Adds", "the", "memory", "byte", "into", "an", "8", "-", "bit", "accumulator", "." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L461-L479
50,086
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.DEC
def DEC(self, a): """ Subtract one from the register. The carry bit is not affected, thus allowing this instruction to be used as a loop counter in multiple- precision computations. When operating on unsigned values, only BEQ and BNE branches can be expected to behave consistentl...
python
def DEC(self, a): """ Subtract one from the register. The carry bit is not affected, thus allowing this instruction to be used as a loop counter in multiple- precision computations. When operating on unsigned values, only BEQ and BNE branches can be expected to behave consistentl...
[ "def", "DEC", "(", "self", ",", "a", ")", ":", "r", "=", "a", "-", "1", "self", ".", "clear_NZV", "(", ")", "self", ".", "update_NZ_8", "(", "r", ")", "if", "r", "==", "0x7f", ":", "self", ".", "V", "=", "1", "return", "r" ]
Subtract one from the register. The carry bit is not affected, thus allowing this instruction to be used as a loop counter in multiple- precision computations. When operating on unsigned values, only BEQ and BNE branches can be expected to behave consistently. When operating on twos comp...
[ "Subtract", "one", "from", "the", "register", ".", "The", "carry", "bit", "is", "not", "affected", "thus", "allowing", "this", "instruction", "to", "be", "used", "as", "a", "loop", "counter", "in", "multiple", "-", "precision", "computations", ".", "When", ...
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L600-L617
50,087
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.instruction_DEC_memory
def instruction_DEC_memory(self, opcode, ea, m): """ Decrement memory location """ r = self.DEC(m) # log.debug("$%x DEC memory value $%x -1 = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea) # )) ...
python
def instruction_DEC_memory(self, opcode, ea, m): """ Decrement memory location """ r = self.DEC(m) # log.debug("$%x DEC memory value $%x -1 = $%x and write it to $%x \t| %s" % ( # self.program_counter, # m, r, ea, # self.cfg.mem_info.get_shortest(ea) # )) ...
[ "def", "instruction_DEC_memory", "(", "self", ",", "opcode", ",", "ea", ",", "m", ")", ":", "r", "=", "self", ".", "DEC", "(", "m", ")", "# log.debug(\"$%x DEC memory value $%x -1 = $%x and write it to $%x \\t| %s\" % (", "# self.program_counter,", "# ...
Decrement memory location
[ "Decrement", "memory", "location" ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L620-L628
50,088
6809/MC6809
MC6809/components/mc6809_base.py
CPUBase.instruction_SEX
def instruction_SEX(self, opcode): """ This instruction transforms a twos complement 8-bit value in accumulator B into a twos complement 16-bit value in the D accumulator. source code forms: SEX CC bits "HNZVC": -aa0- // 0x1d SEX inherent case 0x1d: ...
python
def instruction_SEX(self, opcode): """ This instruction transforms a twos complement 8-bit value in accumulator B into a twos complement 16-bit value in the D accumulator. source code forms: SEX CC bits "HNZVC": -aa0- // 0x1d SEX inherent case 0x1d: ...
[ "def", "instruction_SEX", "(", "self", ",", "opcode", ")", ":", "b", "=", "self", ".", "accu_b", ".", "value", "if", "b", "&", "0x80", "==", "0", ":", "self", ".", "accu_a", ".", "set", "(", "0x00", ")", "d", "=", "self", ".", "accu_d", ".", "v...
This instruction transforms a twos complement 8-bit value in accumulator B into a twos complement 16-bit value in the D accumulator. source code forms: SEX CC bits "HNZVC": -aa0- // 0x1d SEX inherent case 0x1d: WREG_A = (RREG_B & 0x80) ? 0xff : 0; ...
[ "This", "instruction", "transforms", "a", "twos", "complement", "8", "-", "bit", "value", "in", "accumulator", "B", "into", "a", "twos", "complement", "16", "-", "bit", "value", "in", "the", "D", "accumulator", "." ]
6ba2f5106df46689017b5d0b6d84d43b7ee6a240
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_base.py#L851-L879
50,089
facundobatista/yaswfp
yaswfp/swfparser.py
_str
def _str(obj): """Show nicely the generic object received.""" values = [] for name in obj._attribs: val = getattr(obj, name) if isinstance(val, str): val = repr(val) val = str(val) if len(str(val)) < 10 else "(...)" values.append((name, val)) values = ", ".joi...
python
def _str(obj): """Show nicely the generic object received.""" values = [] for name in obj._attribs: val = getattr(obj, name) if isinstance(val, str): val = repr(val) val = str(val) if len(str(val)) < 10 else "(...)" values.append((name, val)) values = ", ".joi...
[ "def", "_str", "(", "obj", ")", ":", "values", "=", "[", "]", "for", "name", "in", "obj", ".", "_attribs", ":", "val", "=", "getattr", "(", "obj", ",", "name", ")", "if", "isinstance", "(", "val", ",", "str", ")", ":", "val", "=", "repr", "(", ...
Show nicely the generic object received.
[ "Show", "nicely", "the", "generic", "object", "received", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L230-L240
50,090
facundobatista/yaswfp
yaswfp/swfparser.py
_repr
def _repr(obj): """Show the received object as precise as possible.""" vals = ", ".join("{}={!r}".format( name, getattr(obj, name)) for name in obj._attribs) if vals: t = "{}(name={}, {})".format(obj.__class__.__name__, obj.name, vals) else: t = "{}(name={})".format(obj.__class__...
python
def _repr(obj): """Show the received object as precise as possible.""" vals = ", ".join("{}={!r}".format( name, getattr(obj, name)) for name in obj._attribs) if vals: t = "{}(name={}, {})".format(obj.__class__.__name__, obj.name, vals) else: t = "{}(name={})".format(obj.__class__...
[ "def", "_repr", "(", "obj", ")", ":", "vals", "=", "\", \"", ".", "join", "(", "\"{}={!r}\"", ".", "format", "(", "name", ",", "getattr", "(", "obj", ",", "name", ")", ")", "for", "name", "in", "obj", ".", "_attribs", ")", "if", "vals", ":", "t",...
Show the received object as precise as possible.
[ "Show", "the", "received", "object", "as", "precise", "as", "possible", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L243-L251
50,091
facundobatista/yaswfp
yaswfp/swfparser.py
_make_object
def _make_object(name): """Create a generic object for the tags.""" klass = type(name, (SWFObject,), {'__str__': _str, '__repr__': _repr, 'name': name}) return klass()
python
def _make_object(name): """Create a generic object for the tags.""" klass = type(name, (SWFObject,), {'__str__': _str, '__repr__': _repr, 'name': name}) return klass()
[ "def", "_make_object", "(", "name", ")", ":", "klass", "=", "type", "(", "name", ",", "(", "SWFObject", ",", ")", ",", "{", "'__str__'", ":", "_str", ",", "'__repr__'", ":", "_repr", ",", "'name'", ":", "name", "}", ")", "return", "klass", "(", ")"...
Create a generic object for the tags.
[ "Create", "a", "generic", "object", "for", "the", "tags", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L267-L271
50,092
facundobatista/yaswfp
yaswfp/swfparser.py
parsefile
def parsefile(filename, read_twips=True): """Parse a SWF. If you have a file object already, just use SWFParser directly. read_twips: True - return values as read from the SWF False - return values in pixels (at 100% zoom) """ with open(filename, 'rb') as fh: return SWFPar...
python
def parsefile(filename, read_twips=True): """Parse a SWF. If you have a file object already, just use SWFParser directly. read_twips: True - return values as read from the SWF False - return values in pixels (at 100% zoom) """ with open(filename, 'rb') as fh: return SWFPar...
[ "def", "parsefile", "(", "filename", ",", "read_twips", "=", "True", ")", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "fh", ":", "return", "SWFParser", "(", "fh", ",", "read_twips", ")" ]
Parse a SWF. If you have a file object already, just use SWFParser directly. read_twips: True - return values as read from the SWF False - return values in pixels (at 100% zoom)
[ "Parse", "a", "SWF", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L1609-L1618
50,093
facundobatista/yaswfp
yaswfp/swfparser.py
SWFParser._get_header
def _get_header(self): """Parse the SWF header.""" fh = self._src obj = _make_object("Header") # first part of the header obj.Signature = sign = "".join(chr(unpack_ui8(fh)) for _ in range(3)) obj.Version = self._version = unpack_ui8(fh) obj.FileLength = file_leng...
python
def _get_header(self): """Parse the SWF header.""" fh = self._src obj = _make_object("Header") # first part of the header obj.Signature = sign = "".join(chr(unpack_ui8(fh)) for _ in range(3)) obj.Version = self._version = unpack_ui8(fh) obj.FileLength = file_leng...
[ "def", "_get_header", "(", "self", ")", ":", "fh", "=", "self", ".", "_src", "obj", "=", "_make_object", "(", "\"Header\"", ")", "# first part of the header", "obj", ".", "Signature", "=", "sign", "=", "\"\"", ".", "join", "(", "chr", "(", "unpack_ui8", ...
Parse the SWF header.
[ "Parse", "the", "SWF", "header", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L295-L316
50,094
facundobatista/yaswfp
yaswfp/swfparser.py
SWFParser._process_tags
def _process_tags(self): """Get a sequence of tags.""" tags = [] while True: tag_bf = unpack_ui16(self._src) tag_type = tag_bf >> 6 # upper 10 bits if tag_type == 0: # the end break tag_len = tag_bf & 0x3f # last...
python
def _process_tags(self): """Get a sequence of tags.""" tags = [] while True: tag_bf = unpack_ui16(self._src) tag_type = tag_bf >> 6 # upper 10 bits if tag_type == 0: # the end break tag_len = tag_bf & 0x3f # last...
[ "def", "_process_tags", "(", "self", ")", ":", "tags", "=", "[", "]", "while", "True", ":", "tag_bf", "=", "unpack_ui16", "(", "self", ".", "_src", ")", "tag_type", "=", "tag_bf", ">>", "6", "# upper 10 bits", "if", "tag_type", "==", "0", ":", "# the e...
Get a sequence of tags.
[ "Get", "a", "sequence", "of", "tags", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L318-L378
50,095
facundobatista/yaswfp
yaswfp/swfparser.py
SWFParser._generic_definetext_parser
def _generic_definetext_parser(self, obj, rgb_struct): """Generic parser for the DefineTextN tags.""" obj.CharacterID = unpack_ui16(self._src) obj.TextBounds = self._get_struct_rect() obj.TextMatrix = self._get_struct_matrix() obj.GlyphBits = glyph_bits = unpack_ui8(self._src) ...
python
def _generic_definetext_parser(self, obj, rgb_struct): """Generic parser for the DefineTextN tags.""" obj.CharacterID = unpack_ui16(self._src) obj.TextBounds = self._get_struct_rect() obj.TextMatrix = self._get_struct_matrix() obj.GlyphBits = glyph_bits = unpack_ui8(self._src) ...
[ "def", "_generic_definetext_parser", "(", "self", ",", "obj", ",", "rgb_struct", ")", ":", "obj", ".", "CharacterID", "=", "unpack_ui16", "(", "self", ".", "_src", ")", "obj", ".", "TextBounds", "=", "self", ".", "_get_struct_rect", "(", ")", "obj", ".", ...
Generic parser for the DefineTextN tags.
[ "Generic", "parser", "for", "the", "DefineTextN", "tags", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L414-L462
50,096
facundobatista/yaswfp
yaswfp/swfparser.py
SWFParser._handle_tag_definetext
def _handle_tag_definetext(self): """Handle the DefineText tag.""" obj = _make_object("DefineText") self._generic_definetext_parser(obj, self._get_struct_rgb) return obj
python
def _handle_tag_definetext(self): """Handle the DefineText tag.""" obj = _make_object("DefineText") self._generic_definetext_parser(obj, self._get_struct_rgb) return obj
[ "def", "_handle_tag_definetext", "(", "self", ")", ":", "obj", "=", "_make_object", "(", "\"DefineText\"", ")", "self", ".", "_generic_definetext_parser", "(", "obj", ",", "self", ".", "_get_struct_rgb", ")", "return", "obj" ]
Handle the DefineText tag.
[ "Handle", "the", "DefineText", "tag", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L464-L468
50,097
facundobatista/yaswfp
yaswfp/swfparser.py
SWFParser._handle_tag_definetext2
def _handle_tag_definetext2(self): """Handle the DefineText2 tag.""" obj = _make_object("DefineText2") self._generic_definetext_parser(obj, self._get_struct_rgba) return obj
python
def _handle_tag_definetext2(self): """Handle the DefineText2 tag.""" obj = _make_object("DefineText2") self._generic_definetext_parser(obj, self._get_struct_rgba) return obj
[ "def", "_handle_tag_definetext2", "(", "self", ")", ":", "obj", "=", "_make_object", "(", "\"DefineText2\"", ")", "self", ".", "_generic_definetext_parser", "(", "obj", ",", "self", ".", "_get_struct_rgba", ")", "return", "obj" ]
Handle the DefineText2 tag.
[ "Handle", "the", "DefineText2", "tag", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L470-L474
50,098
facundobatista/yaswfp
yaswfp/swfparser.py
SWFParser._handle_tag_defineedittext
def _handle_tag_defineedittext(self): """Handle the DefineEditText tag.""" obj = _make_object("DefineEditText") obj.CharacterID = unpack_ui16(self._src) obj.Bounds = self._get_struct_rect() bc = BitConsumer(self._src) obj.HasText = bc.u_get(1) obj.WordWrap = bc.u...
python
def _handle_tag_defineedittext(self): """Handle the DefineEditText tag.""" obj = _make_object("DefineEditText") obj.CharacterID = unpack_ui16(self._src) obj.Bounds = self._get_struct_rect() bc = BitConsumer(self._src) obj.HasText = bc.u_get(1) obj.WordWrap = bc.u...
[ "def", "_handle_tag_defineedittext", "(", "self", ")", ":", "obj", "=", "_make_object", "(", "\"DefineEditText\"", ")", "obj", ".", "CharacterID", "=", "unpack_ui16", "(", "self", ".", "_src", ")", "obj", ".", "Bounds", "=", "self", ".", "_get_struct_rect", ...
Handle the DefineEditText tag.
[ "Handle", "the", "DefineEditText", "tag", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L476-L520
50,099
facundobatista/yaswfp
yaswfp/swfparser.py
SWFParser._generic_placeobject_parser
def _generic_placeobject_parser(self, obj, version): """A generic parser for several PlaceObjectX.""" bc = BitConsumer(self._src) obj.PlaceFlagHasClipActions = bc.u_get(1) obj.PlaceFlagHasClipDepth = bc.u_get(1) obj.PlaceFlagHasName = bc.u_get(1) obj.PlaceFlagHasRatio = b...
python
def _generic_placeobject_parser(self, obj, version): """A generic parser for several PlaceObjectX.""" bc = BitConsumer(self._src) obj.PlaceFlagHasClipActions = bc.u_get(1) obj.PlaceFlagHasClipDepth = bc.u_get(1) obj.PlaceFlagHasName = bc.u_get(1) obj.PlaceFlagHasRatio = b...
[ "def", "_generic_placeobject_parser", "(", "self", ",", "obj", ",", "version", ")", ":", "bc", "=", "BitConsumer", "(", "self", ".", "_src", ")", "obj", ".", "PlaceFlagHasClipActions", "=", "bc", ".", "u_get", "(", "1", ")", "obj", ".", "PlaceFlagHasClipDe...
A generic parser for several PlaceObjectX.
[ "A", "generic", "parser", "for", "several", "PlaceObjectX", "." ]
2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c
https://github.com/facundobatista/yaswfp/blob/2a2cc6ca4c0b4d52bd2e658fb5f80fdc0db4924c/yaswfp/swfparser.py#L522-L576