partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
XidScanner.device_at_index
Returns the device at the specified index
pyxid/pyxid_impl.py
def device_at_index(self, index): """ Returns the device at the specified index """ if index >= len(self.__xid_cons): raise ValueError("Invalid device index") return self.__xid_cons[index]
def device_at_index(self, index): """ Returns the device at the specified index """ if index >= len(self.__xid_cons): raise ValueError("Invalid device index") return self.__xid_cons[index]
[ "Returns", "the", "device", "at", "the", "specified", "index" ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/pyxid_impl.py#L63-L70
[ "def", "device_at_index", "(", "self", ",", "index", ")", ":", "if", "index", ">=", "len", "(", "self", ".", "__xid_cons", ")", ":", "raise", "ValueError", "(", "\"Invalid device index\"", ")", "return", "self", ".", "__xid_cons", "[", "index", "]" ]
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
BaseDevice.query_base_timer
gets the value from the device's base timer
pyxid/pyxid_impl.py
def query_base_timer(self): """ gets the value from the device's base timer """ (_, _, time) = unpack('<ccI', self.con.send_xid_command("e3", 6)) return time
def query_base_timer(self): """ gets the value from the device's base timer """ (_, _, time) = unpack('<ccI', self.con.send_xid_command("e3", 6)) return time
[ "gets", "the", "value", "from", "the", "device", "s", "base", "timer" ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/pyxid_impl.py#L96-L101
[ "def", "query_base_timer", "(", "self", ")", ":", "(", "_", ",", "_", ",", "time", ")", "=", "unpack", "(", "'<ccI'", ",", "self", ".", "con", ".", "send_xid_command", "(", "\"e3\"", ",", "6", ")", ")", "return", "time" ]
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
ResponseDevice.poll_for_response
Polls the device for user input If there is a keymapping for the device, the key map is applied to the key reported from the device. If a response is waiting to be processed, the response is appended to the internal response_queue
pyxid/pyxid_impl.py
def poll_for_response(self): """ Polls the device for user input If there is a keymapping for the device, the key map is applied to the key reported from the device. If a response is waiting to be processed, the response is appended to the internal response_queue ...
def poll_for_response(self): """ Polls the device for user input If there is a keymapping for the device, the key map is applied to the key reported from the device. If a response is waiting to be processed, the response is appended to the internal response_queue ...
[ "Polls", "the", "device", "for", "user", "input" ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/pyxid_impl.py#L114-L134
[ "def", "poll_for_response", "(", "self", ")", ":", "key_state", "=", "self", ".", "con", ".", "check_for_keypress", "(", ")", "if", "key_state", "!=", "NO_KEY_DETECTED", ":", "response", "=", "self", ".", "con", ".", "get_current_response", "(", ")", "if", ...
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
StimTracker.set_pulse_duration
Sets the pulse duration for events in miliseconds when activate_line is called
pyxid/pyxid_impl.py
def set_pulse_duration(self, duration): """ Sets the pulse duration for events in miliseconds when activate_line is called """ if duration > 4294967295: raise ValueError('Duration is too long. Please choose a value ' 'less than 4294967296....
def set_pulse_duration(self, duration): """ Sets the pulse duration for events in miliseconds when activate_line is called """ if duration > 4294967295: raise ValueError('Duration is too long. Please choose a value ' 'less than 4294967296....
[ "Sets", "the", "pulse", "duration", "for", "events", "in", "miliseconds", "when", "activate_line", "is", "called" ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/pyxid_impl.py#L196-L221
[ "def", "set_pulse_duration", "(", "self", ",", "duration", ")", ":", "if", "duration", ">", "4294967295", ":", "raise", "ValueError", "(", "'Duration is too long. Please choose a value '", "'less than 4294967296.'", ")", "big_endian", "=", "hex", "(", "duration", ")",...
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
StimTracker.activate_line
Triggers an output line on StimTracker. There are 8 output lines on StimTracker that can be raised in any combination. To raise lines 1 and 7, for example, you pass in the list: activate_line(lines=[1, 7]). To raise a single line, pass in just an integer, or a list with a sing...
pyxid/pyxid_impl.py
def activate_line(self, lines=None, bitmask=None, leave_remaining_lines=False): """ Triggers an output line on StimTracker. There are 8 output lines on StimTracker that can be raised in any combination. To raise lines 1 and 7, for example, you pass in the ...
def activate_line(self, lines=None, bitmask=None, leave_remaining_lines=False): """ Triggers an output line on StimTracker. There are 8 output lines on StimTracker that can be raised in any combination. To raise lines 1 and 7, for example, you pass in the ...
[ "Triggers", "an", "output", "line", "on", "StimTracker", "." ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/pyxid_impl.py#L223-L287
[ "def", "activate_line", "(", "self", ",", "lines", "=", "None", ",", "bitmask", "=", "None", ",", "leave_remaining_lines", "=", "False", ")", ":", "if", "lines", "is", "None", "and", "bitmask", "is", "None", ":", "raise", "ValueError", "(", "'Must set one ...
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
StimTracker.clear_line
The inverse of activate_line. If a line is active, it deactivates it. This has the same parameters as activate_line()
pyxid/pyxid_impl.py
def clear_line(self, lines=None, bitmask=None, leave_remaining_lines=False): """ The inverse of activate_line. If a line is active, it deactivates it. This has the same parameters as activate_line() """ if lines is None and bitmask is None: raise ...
def clear_line(self, lines=None, bitmask=None, leave_remaining_lines=False): """ The inverse of activate_line. If a line is active, it deactivates it. This has the same parameters as activate_line() """ if lines is None and bitmask is None: raise ...
[ "The", "inverse", "of", "activate_line", ".", "If", "a", "line", "is", "active", "it", "deactivates", "it", "." ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/pyxid_impl.py#L289-L317
[ "def", "clear_line", "(", "self", ",", "lines", "=", "None", ",", "bitmask", "=", "None", ",", "leave_remaining_lines", "=", "False", ")", ":", "if", "lines", "is", "None", "and", "bitmask", "is", "None", ":", "raise", "ValueError", "(", "'Must set one of ...
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
XidDevice.init_device
Initializes the device with the proper keymaps and name
pyxid/pyxid_impl.py
def init_device(self): """ Initializes the device with the proper keymaps and name """ try: product_id = int(self._send_command('_d2', 1)) except ValueError: product_id = self._send_command('_d2', 1) if product_id == 0: self._impl = Re...
def init_device(self): """ Initializes the device with the proper keymaps and name """ try: product_id = int(self._send_command('_d2', 1)) except ValueError: product_id = self._send_command('_d2', 1) if product_id == 0: self._impl = Re...
[ "Initializes", "the", "device", "with", "the", "proper", "keymaps", "and", "name" ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/pyxid_impl.py#L363-L417
[ "def", "init_device", "(", "self", ")", ":", "try", ":", "product_id", "=", "int", "(", "self", ".", "_send_command", "(", "'_d2'", ",", "1", ")", ")", "except", "ValueError", ":", "product_id", "=", "self", ".", "_send_command", "(", "'_d2'", ",", "1"...
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
XidDevice._send_command
Send an XID command to the device
pyxid/pyxid_impl.py
def _send_command(self, command, expected_bytes): """ Send an XID command to the device """ response = self.con.send_xid_command(command, expected_bytes) return response
def _send_command(self, command, expected_bytes): """ Send an XID command to the device """ response = self.con.send_xid_command(command, expected_bytes) return response
[ "Send", "an", "XID", "command", "to", "the", "device" ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/pyxid_impl.py#L419-L425
[ "def", "_send_command", "(", "self", ",", "command", ",", "expected_bytes", ")", ":", "response", "=", "self", ".", "con", ".", "send_xid_command", "(", "command", ",", "expected_bytes", ")", "return", "response" ]
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
get_xid_devices
Returns a list of all Xid devices connected to your computer.
pyxid/__init__.py
def get_xid_devices(): """ Returns a list of all Xid devices connected to your computer. """ devices = [] scanner = XidScanner() for i in range(scanner.device_count()): com = scanner.device_at_index(i) com.open() device = XidDevice(com) devices.append(device) ...
def get_xid_devices(): """ Returns a list of all Xid devices connected to your computer. """ devices = [] scanner = XidScanner() for i in range(scanner.device_count()): com = scanner.device_at_index(i) com.open() device = XidDevice(com) devices.append(device) ...
[ "Returns", "a", "list", "of", "all", "Xid", "devices", "connected", "to", "your", "computer", "." ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/__init__.py#L14-L25
[ "def", "get_xid_devices", "(", ")", ":", "devices", "=", "[", "]", "scanner", "=", "XidScanner", "(", ")", "for", "i", "in", "range", "(", "scanner", ".", "device_count", "(", ")", ")", ":", "com", "=", "scanner", ".", "device_at_index", "(", "i", ")...
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
get_xid_device
returns device at a given index. Raises ValueError if the device at the passed in index doesn't exist.
pyxid/__init__.py
def get_xid_device(device_number): """ returns device at a given index. Raises ValueError if the device at the passed in index doesn't exist. """ scanner = XidScanner() com = scanner.device_at_index(device_number) com.open() return XidDevice(com)
def get_xid_device(device_number): """ returns device at a given index. Raises ValueError if the device at the passed in index doesn't exist. """ scanner = XidScanner() com = scanner.device_at_index(device_number) com.open() return XidDevice(com)
[ "returns", "device", "at", "a", "given", "index", "." ]
cedrus-opensource/pyxid
python
https://github.com/cedrus-opensource/pyxid/blob/02dba3a825f0d4f4c0bfa044c6a361492e4c25b6/pyxid/__init__.py#L28-L38
[ "def", "get_xid_device", "(", "device_number", ")", ":", "scanner", "=", "XidScanner", "(", ")", "com", "=", "scanner", ".", "device_at_index", "(", "device_number", ")", "com", ".", "open", "(", ")", "return", "XidDevice", "(", "com", ")" ]
02dba3a825f0d4f4c0bfa044c6a361492e4c25b6
train
Signal.connect
Append receiver.
flask_pw/models.py
def connect(self, receiver): """Append receiver.""" if not callable(receiver): raise ValueError('Invalid receiver: %s' % receiver) self.receivers.append(receiver)
def connect(self, receiver): """Append receiver.""" if not callable(receiver): raise ValueError('Invalid receiver: %s' % receiver) self.receivers.append(receiver)
[ "Append", "receiver", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/models.py#L56-L60
[ "def", "connect", "(", "self", ",", "receiver", ")", ":", "if", "not", "callable", "(", "receiver", ")", ":", "raise", "ValueError", "(", "'Invalid receiver: %s'", "%", "receiver", ")", "self", ".", "receivers", ".", "append", "(", "receiver", ")" ]
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Signal.disconnect
Remove receiver.
flask_pw/models.py
def disconnect(self, receiver): """Remove receiver.""" try: self.receivers.remove(receiver) except ValueError: raise ValueError('Unknown receiver: %s' % receiver)
def disconnect(self, receiver): """Remove receiver.""" try: self.receivers.remove(receiver) except ValueError: raise ValueError('Unknown receiver: %s' % receiver)
[ "Remove", "receiver", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/models.py#L67-L72
[ "def", "disconnect", "(", "self", ",", "receiver", ")", ":", "try", ":", "self", ".", "receivers", ".", "remove", "(", "receiver", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'Unknown receiver: %s'", "%", "receiver", ")" ]
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Signal.send
Send signal.
flask_pw/models.py
def send(self, instance, *args, **kwargs): """Send signal.""" for receiver in self.receivers: receiver(instance, *args, **kwargs)
def send(self, instance, *args, **kwargs): """Send signal.""" for receiver in self.receivers: receiver(instance, *args, **kwargs)
[ "Send", "signal", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/models.py#L74-L77
[ "def", "send", "(", "self", ",", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "receiver", "in", "self", ".", "receivers", ":", "receiver", "(", "instance", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Model.select
Support read slaves.
flask_pw/models.py
def select(cls, *args, **kwargs): """Support read slaves.""" query = super(Model, cls).select(*args, **kwargs) query.database = cls._get_read_database() return query
def select(cls, *args, **kwargs): """Support read slaves.""" query = super(Model, cls).select(*args, **kwargs) query.database = cls._get_read_database() return query
[ "Support", "read", "slaves", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/models.py#L105-L109
[ "def", "select", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "query", "=", "super", "(", "Model", ",", "cls", ")", ".", "select", "(", "*", "args", ",", "*", "*", "kwargs", ")", "query", ".", "database", "=", "cls", ".", ...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Model.save
Send signals.
flask_pw/models.py
def save(self, force_insert=False, **kwargs): """Send signals.""" created = force_insert or not bool(self.pk) self.pre_save.send(self, created=created) super(Model, self).save(force_insert=force_insert, **kwargs) self.post_save.send(self, created=created)
def save(self, force_insert=False, **kwargs): """Send signals.""" created = force_insert or not bool(self.pk) self.pre_save.send(self, created=created) super(Model, self).save(force_insert=force_insert, **kwargs) self.post_save.send(self, created=created)
[ "Send", "signals", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/models.py#L130-L135
[ "def", "save", "(", "self", ",", "force_insert", "=", "False", ",", "*", "*", "kwargs", ")", ":", "created", "=", "force_insert", "or", "not", "bool", "(", "self", ".", "pk", ")", "self", ".", "pre_save", ".", "send", "(", "self", ",", "created", "...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Model.delete_instance
Send signals.
flask_pw/models.py
def delete_instance(self, *args, **kwargs): """Send signals.""" self.pre_delete.send(self) super(Model, self).delete_instance(*args, **kwargs) self.post_delete.send(self)
def delete_instance(self, *args, **kwargs): """Send signals.""" self.pre_delete.send(self) super(Model, self).delete_instance(*args, **kwargs) self.post_delete.send(self)
[ "Send", "signals", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/models.py#L137-L141
[ "def", "delete_instance", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "pre_delete", ".", "send", "(", "self", ")", "super", "(", "Model", ",", "self", ")", ".", "delete_instance", "(", "*", "args", ",", "*", "*", ...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
get_database
Get database from given URI/Object.
flask_pw/__init__.py
def get_database(obj, **params): """Get database from given URI/Object.""" if isinstance(obj, string_types): return connect(obj, **params) return obj
def get_database(obj, **params): """Get database from given URI/Object.""" if isinstance(obj, string_types): return connect(obj, **params) return obj
[ "Get", "database", "from", "given", "URI", "/", "Object", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L244-L248
[ "def", "get_database", "(", "obj", ",", "*", "*", "params", ")", ":", "if", "isinstance", "(", "obj", ",", "string_types", ")", ":", "return", "connect", "(", "obj", ",", "*", "*", "params", ")", "return", "obj" ]
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.init_app
Initialize application.
flask_pw/__init__.py
def init_app(self, app, database=None): """Initialize application.""" # Register application if not app: raise RuntimeError('Invalid application.') self.app = app if not hasattr(app, 'extensions'): app.extensions = {} app.extensions['peewee'] = se...
def init_app(self, app, database=None): """Initialize application.""" # Register application if not app: raise RuntimeError('Invalid application.') self.app = app if not hasattr(app, 'extensions'): app.extensions = {} app.extensions['peewee'] = se...
[ "Initialize", "application", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L30-L70
[ "def", "init_app", "(", "self", ",", "app", ",", "database", "=", "None", ")", ":", "# Register application", "if", "not", "app", ":", "raise", "RuntimeError", "(", "'Invalid application.'", ")", "self", ".", "app", "=", "app", "if", "not", "hasattr", "(",...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.close
Close connection to database.
flask_pw/__init__.py
def close(self, response): """Close connection to database.""" LOGGER.info('Closing [%s]', os.getpid()) if not self.database.is_closed(): self.database.close() return response
def close(self, response): """Close connection to database.""" LOGGER.info('Closing [%s]', os.getpid()) if not self.database.is_closed(): self.database.close() return response
[ "Close", "connection", "to", "database", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L77-L82
[ "def", "close", "(", "self", ",", "response", ")", ":", "LOGGER", ".", "info", "(", "'Closing [%s]'", ",", "os", ".", "getpid", "(", ")", ")", "if", "not", "self", ".", "database", ".", "is_closed", "(", ")", ":", "self", ".", "database", ".", "clo...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.Model
Bind model to self database.
flask_pw/__init__.py
def Model(self): """Bind model to self database.""" Model_ = self.app.config['PEEWEE_MODELS_CLASS'] meta_params = {'database': self.database} if self.slaves and self.app.config['PEEWEE_USE_READ_SLAVES']: meta_params['read_slaves'] = self.slaves Meta = type('Meta', ()...
def Model(self): """Bind model to self database.""" Model_ = self.app.config['PEEWEE_MODELS_CLASS'] meta_params = {'database': self.database} if self.slaves and self.app.config['PEEWEE_USE_READ_SLAVES']: meta_params['read_slaves'] = self.slaves Meta = type('Meta', ()...
[ "Bind", "model", "to", "self", "database", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L85-L93
[ "def", "Model", "(", "self", ")", ":", "Model_", "=", "self", ".", "app", ".", "config", "[", "'PEEWEE_MODELS_CLASS'", "]", "meta_params", "=", "{", "'database'", ":", "self", ".", "database", "}", "if", "self", ".", "slaves", "and", "self", ".", "app"...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.models
Return self.application models.
flask_pw/__init__.py
def models(self): """Return self.application models.""" Model_ = self.app.config['PEEWEE_MODELS_CLASS'] ignore = self.app.config['PEEWEE_MODELS_IGNORE'] models = [] if Model_ is not Model: try: mod = import_module(self.app.config['PEEWEE_MODELS_MODULE...
def models(self): """Return self.application models.""" Model_ = self.app.config['PEEWEE_MODELS_CLASS'] ignore = self.app.config['PEEWEE_MODELS_IGNORE'] models = [] if Model_ is not Model: try: mod = import_module(self.app.config['PEEWEE_MODELS_MODULE...
[ "Return", "self", ".", "application", "models", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L96-L115
[ "def", "models", "(", "self", ")", ":", "Model_", "=", "self", ".", "app", ".", "config", "[", "'PEEWEE_MODELS_CLASS'", "]", "ignore", "=", "self", ".", "app", ".", "config", "[", "'PEEWEE_MODELS_IGNORE'", "]", "models", "=", "[", "]", "if", "Model_", ...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.cmd_create
Create a new migration.
flask_pw/__init__.py
def cmd_create(self, name, auto=False): """Create a new migration.""" LOGGER.setLevel('INFO') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], migrate_table=self.app.config['PEEWEE_MIG...
def cmd_create(self, name, auto=False): """Create a new migration.""" LOGGER.setLevel('INFO') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], migrate_table=self.app.config['PEEWEE_MIG...
[ "Create", "a", "new", "migration", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L117-L130
[ "def", "cmd_create", "(", "self", ",", "name", ",", "auto", "=", "False", ")", ":", "LOGGER", ".", "setLevel", "(", "'INFO'", ")", "LOGGER", ".", "propagate", "=", "0", "router", "=", "Router", "(", "self", ".", "database", ",", "migrate_dir", "=", "...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.cmd_migrate
Run migrations.
flask_pw/__init__.py
def cmd_migrate(self, name=None, fake=False): """Run migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('INFO') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], ...
def cmd_migrate(self, name=None, fake=False): """Run migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('INFO') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], ...
[ "Run", "migrations", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L132-L145
[ "def", "cmd_migrate", "(", "self", ",", "name", "=", "None", ",", "fake", "=", "False", ")", ":", "from", "peewee_migrate", ".", "router", "import", "Router", ",", "LOGGER", "LOGGER", ".", "setLevel", "(", "'INFO'", ")", "LOGGER", ".", "propagate", "=", ...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.cmd_rollback
Rollback migrations.
flask_pw/__init__.py
def cmd_rollback(self, name): """Rollback migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('INFO') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], ...
def cmd_rollback(self, name): """Rollback migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('INFO') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], ...
[ "Rollback", "migrations", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L147-L158
[ "def", "cmd_rollback", "(", "self", ",", "name", ")", ":", "from", "peewee_migrate", ".", "router", "import", "Router", ",", "LOGGER", "LOGGER", ".", "setLevel", "(", "'INFO'", ")", "LOGGER", ".", "propagate", "=", "0", "router", "=", "Router", "(", "sel...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.cmd_list
List migrations.
flask_pw/__init__.py
def cmd_list(self): """List migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('DEBUG') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], migrate_ta...
def cmd_list(self): """List migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('DEBUG') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], migrate_ta...
[ "List", "migrations", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L160-L175
[ "def", "cmd_list", "(", "self", ")", ":", "from", "peewee_migrate", ".", "router", "import", "Router", ",", "LOGGER", "LOGGER", ".", "setLevel", "(", "'DEBUG'", ")", "LOGGER", ".", "propagate", "=", "0", "router", "=", "Router", "(", "self", ".", "databa...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.cmd_merge
Merge migrations.
flask_pw/__init__.py
def cmd_merge(self): """Merge migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('DEBUG') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], migrate_...
def cmd_merge(self): """Merge migrations.""" from peewee_migrate.router import Router, LOGGER LOGGER.setLevel('DEBUG') LOGGER.propagate = 0 router = Router(self.database, migrate_dir=self.app.config['PEEWEE_MIGRATE_DIR'], migrate_...
[ "Merge", "migrations", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L177-L188
[ "def", "cmd_merge", "(", "self", ")", ":", "from", "peewee_migrate", ".", "router", "import", "Router", ",", "LOGGER", "LOGGER", ".", "setLevel", "(", "'DEBUG'", ")", "LOGGER", ".", "propagate", "=", "0", "router", "=", "Router", "(", "self", ".", "datab...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
Peewee.manager
Integrate a Flask-Script.
flask_pw/__init__.py
def manager(self): """Integrate a Flask-Script.""" from flask_script import Manager, Command manager = Manager(usage="Migrate database.") manager.add_command('create', Command(self.cmd_create)) manager.add_command('migrate', Command(self.cmd_migrate)) manager.add_command...
def manager(self): """Integrate a Flask-Script.""" from flask_script import Manager, Command manager = Manager(usage="Migrate database.") manager.add_command('create', Command(self.cmd_create)) manager.add_command('migrate', Command(self.cmd_migrate)) manager.add_command...
[ "Integrate", "a", "Flask", "-", "Script", "." ]
klen/flask-pw
python
https://github.com/klen/flask-pw/blob/04d7846f0c89f2b2331b238b1c8223368c2a40a7/flask_pw/__init__.py#L191-L202
[ "def", "manager", "(", "self", ")", ":", "from", "flask_script", "import", "Manager", ",", "Command", "manager", "=", "Manager", "(", "usage", "=", "\"Migrate database.\"", ")", "manager", ".", "add_command", "(", "'create'", ",", "Command", "(", "self", "."...
04d7846f0c89f2b2331b238b1c8223368c2a40a7
train
restart_program
DOES NOT WORK WELL WITH MOPIDY Hack from https://www.daniweb.com/software-development/python/code/260268/restart-your-python-program to support updating the settings, since mopidy is not able to do that yet Restarts the current program Note: this function does not return. Any cleanup action (like ...
mopidy_websettings/__init__.py
def restart_program(): """ DOES NOT WORK WELL WITH MOPIDY Hack from https://www.daniweb.com/software-development/python/code/260268/restart-your-python-program to support updating the settings, since mopidy is not able to do that yet Restarts the current program Note: this function does not ...
def restart_program(): """ DOES NOT WORK WELL WITH MOPIDY Hack from https://www.daniweb.com/software-development/python/code/260268/restart-your-python-program to support updating the settings, since mopidy is not able to do that yet Restarts the current program Note: this function does not ...
[ "DOES", "NOT", "WORK", "WELL", "WITH", "MOPIDY", "Hack", "from", "https", ":", "//", "www", ".", "daniweb", ".", "com", "/", "software", "-", "development", "/", "python", "/", "code", "/", "260268", "/", "restart", "-", "your", "-", "python", "-", "...
pimusicbox/mopidy-websettings
python
https://github.com/pimusicbox/mopidy-websettings/blob/a9aca8e15a29f323e7d91e3f2237f4605e2892e3/mopidy_websettings/__init__.py#L33-L45
[ "def", "restart_program", "(", ")", ":", "python", "=", "sys", ".", "executable", "os", ".", "execl", "(", "python", ",", "python", ",", "*", "sys", ".", "argv", ")" ]
a9aca8e15a29f323e7d91e3f2237f4605e2892e3
train
__load
load liac-arff to pandas DataFrame :param dict arff:arff dict created liac-arff :rtype: DataFrame :return: pandas DataFrame
arff2pandas/a2p.py
def __load(arff): """ load liac-arff to pandas DataFrame :param dict arff:arff dict created liac-arff :rtype: DataFrame :return: pandas DataFrame """ attrs = arff['attributes'] attrs_t = [] for attr in attrs: if isinstance(attr[1], list): attrs_t.append("%s@{%s}" ...
def __load(arff): """ load liac-arff to pandas DataFrame :param dict arff:arff dict created liac-arff :rtype: DataFrame :return: pandas DataFrame """ attrs = arff['attributes'] attrs_t = [] for attr in attrs: if isinstance(attr[1], list): attrs_t.append("%s@{%s}" ...
[ "load", "liac", "-", "arff", "to", "pandas", "DataFrame", ":", "param", "dict", "arff", ":", "arff", "dict", "created", "liac", "-", "arff", ":", "rtype", ":", "DataFrame", ":", "return", ":", "pandas", "DataFrame" ]
garicchi/arff2pandas
python
https://github.com/garicchi/arff2pandas/blob/6698a3f57a9c227c8f38deb827b53b80b8c6a231/arff2pandas/a2p.py#L5-L21
[ "def", "__load", "(", "arff", ")", ":", "attrs", "=", "arff", "[", "'attributes'", "]", "attrs_t", "=", "[", "]", "for", "attr", "in", "attrs", ":", "if", "isinstance", "(", "attr", "[", "1", "]", ",", "list", ")", ":", "attrs_t", ".", "append", ...
6698a3f57a9c227c8f38deb827b53b80b8c6a231
train
__dump
dump DataFrame to liac-arff :param DataFrame df: :param str relation: :param str description: :rtype: dict :return: liac-arff dict
arff2pandas/a2p.py
def __dump(df,relation='data',description=''): """ dump DataFrame to liac-arff :param DataFrame df: :param str relation: :param str description: :rtype: dict :return: liac-arff dict """ attrs = [] for col in df.columns: attr = col.split('@') if attr[1].count('...
def __dump(df,relation='data',description=''): """ dump DataFrame to liac-arff :param DataFrame df: :param str relation: :param str description: :rtype: dict :return: liac-arff dict """ attrs = [] for col in df.columns: attr = col.split('@') if attr[1].count('...
[ "dump", "DataFrame", "to", "liac", "-", "arff", ":", "param", "DataFrame", "df", ":", ":", "param", "str", "relation", ":", ":", "param", "str", "description", ":", ":", "rtype", ":", "dict", ":", "return", ":", "liac", "-", "arff", "dict" ]
garicchi/arff2pandas
python
https://github.com/garicchi/arff2pandas/blob/6698a3f57a9c227c8f38deb827b53b80b8c6a231/arff2pandas/a2p.py#L46-L71
[ "def", "__dump", "(", "df", ",", "relation", "=", "'data'", ",", "description", "=", "''", ")", ":", "attrs", "=", "[", "]", "for", "col", "in", "df", ".", "columns", ":", "attr", "=", "col", ".", "split", "(", "'@'", ")", "if", "attr", "[", "1...
6698a3f57a9c227c8f38deb827b53b80b8c6a231
train
dump
dump DataFrame to file :param DataFrame df: :param file fp:
arff2pandas/a2p.py
def dump(df,fp): """ dump DataFrame to file :param DataFrame df: :param file fp: """ arff = __dump(df) liacarff.dump(arff,fp)
def dump(df,fp): """ dump DataFrame to file :param DataFrame df: :param file fp: """ arff = __dump(df) liacarff.dump(arff,fp)
[ "dump", "DataFrame", "to", "file", ":", "param", "DataFrame", "df", ":", ":", "param", "file", "fp", ":" ]
garicchi/arff2pandas
python
https://github.com/garicchi/arff2pandas/blob/6698a3f57a9c227c8f38deb827b53b80b8c6a231/arff2pandas/a2p.py#L74-L81
[ "def", "dump", "(", "df", ",", "fp", ")", ":", "arff", "=", "__dump", "(", "df", ")", "liacarff", ".", "dump", "(", "arff", ",", "fp", ")" ]
6698a3f57a9c227c8f38deb827b53b80b8c6a231
train
markup_line
Insert `marker` at `offset` into `text`, and return the marked line. .. code-block:: python >>> markup_line('0\\n1234\\n56', 3) 1>>!<<234
textparser.py
def markup_line(text, offset, marker='>>!<<'): """Insert `marker` at `offset` into `text`, and return the marked line. .. code-block:: python >>> markup_line('0\\n1234\\n56', 3) 1>>!<<234 """ begin = text.rfind('\n', 0, offset) begin += 1 end = text.find('\n', offset) ...
def markup_line(text, offset, marker='>>!<<'): """Insert `marker` at `offset` into `text`, and return the marked line. .. code-block:: python >>> markup_line('0\\n1234\\n56', 3) 1>>!<<234 """ begin = text.rfind('\n', 0, offset) begin += 1 end = text.find('\n', offset) ...
[ "Insert", "marker", "at", "offset", "into", "text", "and", "return", "the", "marked", "line", "." ]
eerimoq/textparser
python
https://github.com/eerimoq/textparser/blob/5f158210cfd3a20b19775191e92f22a13054a852/textparser.py#L698-L717
[ "def", "markup_line", "(", "text", ",", "offset", ",", "marker", "=", "'>>!<<'", ")", ":", "begin", "=", "text", ".", "rfind", "(", "'\\n'", ",", "0", ",", "offset", ")", "begin", "+=", "1", "end", "=", "text", ".", "find", "(", "'\\n'", ",", "of...
5f158210cfd3a20b19775191e92f22a13054a852
train
tokenize_init
Initialize a tokenizer. Should only be called by the :func:`~textparser.Parser.tokenize` method in the parser.
textparser.py
def tokenize_init(spec): """Initialize a tokenizer. Should only be called by the :func:`~textparser.Parser.tokenize` method in the parser. """ tokens = [Token('__SOF__', '__SOF__', 0)] re_token = '|'.join([ '(?P<{}>{})'.format(name, regex) for name, regex in spec ]) return tokens,...
def tokenize_init(spec): """Initialize a tokenizer. Should only be called by the :func:`~textparser.Parser.tokenize` method in the parser. """ tokens = [Token('__SOF__', '__SOF__', 0)] re_token = '|'.join([ '(?P<{}>{})'.format(name, regex) for name, regex in spec ]) return tokens,...
[ "Initialize", "a", "tokenizer", ".", "Should", "only", "be", "called", "by", "the", ":", "func", ":", "~textparser", ".", "Parser", ".", "tokenize", "method", "in", "the", "parser", "." ]
eerimoq/textparser
python
https://github.com/eerimoq/textparser/blob/5f158210cfd3a20b19775191e92f22a13054a852/textparser.py#L730-L741
[ "def", "tokenize_init", "(", "spec", ")", ":", "tokens", "=", "[", "Token", "(", "'__SOF__'", ",", "'__SOF__'", ",", "0", ")", "]", "re_token", "=", "'|'", ".", "join", "(", "[", "'(?P<{}>{})'", ".", "format", "(", "name", ",", "regex", ")", "for", ...
5f158210cfd3a20b19775191e92f22a13054a852
train
Parser.tokenize
Tokenize given string `text`, and return a list of tokens. Raises :class:`~textparser.TokenizeError` on failure. This method should only be called by :func:`~textparser.Parser.parse()`, but may very well be overridden if the default implementation does not match the parser needs...
textparser.py
def tokenize(self, text): """Tokenize given string `text`, and return a list of tokens. Raises :class:`~textparser.TokenizeError` on failure. This method should only be called by :func:`~textparser.Parser.parse()`, but may very well be overridden if the default implementation do...
def tokenize(self, text): """Tokenize given string `text`, and return a list of tokens. Raises :class:`~textparser.TokenizeError` on failure. This method should only be called by :func:`~textparser.Parser.parse()`, but may very well be overridden if the default implementation do...
[ "Tokenize", "given", "string", "text", "and", "return", "a", "list", "of", "tokens", ".", "Raises", ":", "class", ":", "~textparser", ".", "TokenizeError", "on", "failure", "." ]
eerimoq/textparser
python
https://github.com/eerimoq/textparser/blob/5f158210cfd3a20b19775191e92f22a13054a852/textparser.py#L809-L842
[ "def", "tokenize", "(", "self", ",", "text", ")", ":", "names", ",", "specs", "=", "self", ".", "_unpack_token_specs", "(", ")", "keywords", "=", "self", ".", "keywords", "(", ")", "tokens", ",", "re_token", "=", "tokenize_init", "(", "specs", ")", "fo...
5f158210cfd3a20b19775191e92f22a13054a852
train
Parser.parse
Parse given string `text` and return the parse tree. Raises :class:`~textparser.ParseError` on failure. Returns a parse tree of tokens if `token_tree` is ``True``. .. code-block:: python >>> MyParser().parse('Hello, World!') ['Hello', ',', 'World', '!'] >>> tr...
textparser.py
def parse(self, text, token_tree=False, match_sof=False): """Parse given string `text` and return the parse tree. Raises :class:`~textparser.ParseError` on failure. Returns a parse tree of tokens if `token_tree` is ``True``. .. code-block:: python >>> MyParser().parse('Hell...
def parse(self, text, token_tree=False, match_sof=False): """Parse given string `text` and return the parse tree. Raises :class:`~textparser.ParseError` on failure. Returns a parse tree of tokens if `token_tree` is ``True``. .. code-block:: python >>> MyParser().parse('Hell...
[ "Parse", "given", "string", "text", "and", "return", "the", "parse", "tree", ".", "Raises", ":", "class", ":", "~textparser", ".", "ParseError", "on", "failure", "." ]
eerimoq/textparser
python
https://github.com/eerimoq/textparser/blob/5f158210cfd3a20b19775191e92f22a13054a852/textparser.py#L854-L886
[ "def", "parse", "(", "self", ",", "text", ",", "token_tree", "=", "False", ",", "match_sof", "=", "False", ")", ":", "try", ":", "tokens", "=", "self", ".", "tokenize", "(", "text", ")", "if", "len", "(", "tokens", ")", "==", "0", "or", "tokens", ...
5f158210cfd3a20b19775191e92f22a13054a852
train
Profile.x_at_y
Calculates inverse profile - for given y returns x such that f(x) = y If given y is not found in the self.y, then interpolation is used. By default returns first result looking from left, if reverse argument set to True, looks from right. If y is outside range of self.y then np.n...
beprof/profile.py
def x_at_y(self, y, reverse=False): """ Calculates inverse profile - for given y returns x such that f(x) = y If given y is not found in the self.y, then interpolation is used. By default returns first result looking from left, if reverse argument set to True, looks from ...
def x_at_y(self, y, reverse=False): """ Calculates inverse profile - for given y returns x such that f(x) = y If given y is not found in the self.y, then interpolation is used. By default returns first result looking from left, if reverse argument set to True, looks from ...
[ "Calculates", "inverse", "profile", "-", "for", "given", "y", "returns", "x", "such", "that", "f", "(", "x", ")", "=", "y", "If", "given", "y", "is", "not", "found", "in", "the", "self", ".", "y", "then", "interpolation", "is", "used", ".", "By", "...
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/profile.py#L31-L117
[ "def", "x_at_y", "(", "self", ",", "y", ",", "reverse", "=", "False", ")", ":", "logger", ".", "info", "(", "'Running %(name)s.y_at_x(y=%(y)s, reverse=%(rev)s)'", ",", "{", "\"name\"", ":", "self", ".", "__class__", ",", "\"y\"", ":", "y", ",", "\"rev\"", ...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
Profile.width
Width at given level :param level: :return:
beprof/profile.py
def width(self, level): """ Width at given level :param level: :return: """ return self.x_at_y(level, reverse=True) - self.x_at_y(level)
def width(self, level): """ Width at given level :param level: :return: """ return self.x_at_y(level, reverse=True) - self.x_at_y(level)
[ "Width", "at", "given", "level", ":", "param", "level", ":", ":", "return", ":" ]
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/profile.py#L119-L125
[ "def", "width", "(", "self", ",", "level", ")", ":", "return", "self", ".", "x_at_y", "(", "level", ",", "reverse", "=", "True", ")", "-", "self", ".", "x_at_y", "(", "level", ")" ]
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
Profile.normalize
Normalize to 1 over [-dt, +dt] area, if allow_cast is set to True, division not in place and casting may occur. If division in place is not possible and allow_cast is False an exception is raised. >>> a = Profile([[0, 0], [1, 5], [2, 10], [3, 5], [4, 0]]) >>> a.normalize(1, allo...
beprof/profile.py
def normalize(self, dt, allow_cast=True): """ Normalize to 1 over [-dt, +dt] area, if allow_cast is set to True, division not in place and casting may occur. If division in place is not possible and allow_cast is False an exception is raised. >>> a = Profile([[0, 0], [1,...
def normalize(self, dt, allow_cast=True): """ Normalize to 1 over [-dt, +dt] area, if allow_cast is set to True, division not in place and casting may occur. If division in place is not possible and allow_cast is False an exception is raised. >>> a = Profile([[0, 0], [1,...
[ "Normalize", "to", "1", "over", "[", "-", "dt", "+", "dt", "]", "area", "if", "allow_cast", "is", "set", "to", "True", "division", "not", "in", "place", "and", "casting", "may", "occur", ".", "If", "division", "in", "place", "is", "not", "possible", ...
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/profile.py#L135-L166
[ "def", "normalize", "(", "self", ",", "dt", ",", "allow_cast", "=", "True", ")", ":", "if", "dt", "<=", "0", ":", "raise", "ValueError", "(", "\"Expected positive input\"", ")", "logger", ".", "info", "(", "'Running %(name)s.normalize(dt=%(dt)s)'", ",", "{", ...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
Curve.rescale
Rescales self.y by given factor, if allow_cast is set to True and division in place is impossible - casting and not in place division may occur occur. If in place is impossible and allow_cast is set to False - an exception is raised. Check simple rescaling by 2 with no casting >...
beprof/curve.py
def rescale(self, factor=1.0, allow_cast=True): """ Rescales self.y by given factor, if allow_cast is set to True and division in place is impossible - casting and not in place division may occur occur. If in place is impossible and allow_cast is set to False - an exception is ra...
def rescale(self, factor=1.0, allow_cast=True): """ Rescales self.y by given factor, if allow_cast is set to True and division in place is impossible - casting and not in place division may occur occur. If in place is impossible and allow_cast is set to False - an exception is ra...
[ "Rescales", "self", ".", "y", "by", "given", "factor", "if", "allow_cast", "is", "set", "to", "True", "and", "division", "in", "place", "is", "impossible", "-", "casting", "and", "not", "in", "place", "division", "may", "occur", "occur", ".", "If", "in",...
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/curve.py#L80-L115
[ "def", "rescale", "(", "self", ",", "factor", "=", "1.0", ",", "allow_cast", "=", "True", ")", ":", "try", ":", "self", ".", "y", "/=", "factor", "except", "TypeError", "as", "e", ":", "logger", ".", "warning", "(", "\"Division in place is impossible: %s\"...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
Curve.change_domain
Creating new Curve object in memory with domain passed as a parameter. New domain must include in the original domain. Copies values from original curve and uses interpolation to calculate values for new points in domain. Calculate y - values of example curve with changed domain: ...
beprof/curve.py
def change_domain(self, domain): """ Creating new Curve object in memory with domain passed as a parameter. New domain must include in the original domain. Copies values from original curve and uses interpolation to calculate values for new points in domain. Calculate y ...
def change_domain(self, domain): """ Creating new Curve object in memory with domain passed as a parameter. New domain must include in the original domain. Copies values from original curve and uses interpolation to calculate values for new points in domain. Calculate y ...
[ "Creating", "new", "Curve", "object", "in", "memory", "with", "domain", "passed", "as", "a", "parameter", ".", "New", "domain", "must", "include", "in", "the", "original", "domain", ".", "Copies", "values", "from", "original", "curve", "and", "uses", "interp...
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/curve.py#L125-L160
[ "def", "change_domain", "(", "self", ",", "domain", ")", ":", "logger", ".", "info", "(", "'Running %(name)s.change_domain() with new domain range:[%(ymin)s, %(ymax)s]'", ",", "{", "\"name\"", ":", "self", ".", "__class__", ",", "\"ymin\"", ":", "np", ".", "min", ...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
Curve.rebinned
Provides effective way to compute new domain basing on step and fixp parameters. Then using change_domain() method to create new object with calculated domain and returns it. fixp doesn't have to be inside original domain. Return domain of a new curve specified by fixp=0 and st...
beprof/curve.py
def rebinned(self, step=0.1, fixp=0): """ Provides effective way to compute new domain basing on step and fixp parameters. Then using change_domain() method to create new object with calculated domain and returns it. fixp doesn't have to be inside original domain. Retur...
def rebinned(self, step=0.1, fixp=0): """ Provides effective way to compute new domain basing on step and fixp parameters. Then using change_domain() method to create new object with calculated domain and returns it. fixp doesn't have to be inside original domain. Retur...
[ "Provides", "effective", "way", "to", "compute", "new", "domain", "basing", "on", "step", "and", "fixp", "parameters", ".", "Then", "using", "change_domain", "()", "method", "to", "create", "new", "object", "with", "calculated", "domain", "and", "returns", "it...
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/curve.py#L162-L199
[ "def", "rebinned", "(", "self", ",", "step", "=", "0.1", ",", "fixp", "=", "0", ")", ":", "logger", ".", "info", "(", "'Running %(name)s.rebinned(step=%(st)s, fixp=%(fx)s)'", ",", "{", "\"name\"", ":", "self", ".", "__class__", ",", "\"st\"", ":", "step", ...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
Curve.evaluate_at_x
Returns Y value at arg of self. Arg can be a scalar, but also might be np.array or other iterable (like list). If domain of self is not wide enough to interpolate the value of Y, method will return def_val for those arguments instead. Check the interpolation when arg in domain o...
beprof/curve.py
def evaluate_at_x(self, arg, def_val=0): """ Returns Y value at arg of self. Arg can be a scalar, but also might be np.array or other iterable (like list). If domain of self is not wide enough to interpolate the value of Y, method will return def_val for those arguments i...
def evaluate_at_x(self, arg, def_val=0): """ Returns Y value at arg of self. Arg can be a scalar, but also might be np.array or other iterable (like list). If domain of self is not wide enough to interpolate the value of Y, method will return def_val for those arguments i...
[ "Returns", "Y", "value", "at", "arg", "of", "self", ".", "Arg", "can", "be", "a", "scalar", "but", "also", "might", "be", "np", ".", "array", "or", "other", "iterable", "(", "like", "list", ")", ".", "If", "domain", "of", "self", "is", "not", "wide...
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/curve.py#L201-L225
[ "def", "evaluate_at_x", "(", "self", ",", "arg", ",", "def_val", "=", "0", ")", ":", "y", "=", "np", ".", "interp", "(", "arg", ",", "self", ".", "x", ",", "self", ".", "y", ",", "left", "=", "def_val", ",", "right", "=", "def_val", ")", "retur...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
Curve.subtract
Method that calculates difference between 2 curves (or subclasses of curves). Domain of self must be in domain of curve2 what means min(self.x) >= min(curve2.x) and max(self.x) <= max(curve2.x). Might modify self, and can return the result or None Use subtract as -= operator, ch...
beprof/curve.py
def subtract(self, curve2, new_obj=False): """ Method that calculates difference between 2 curves (or subclasses of curves). Domain of self must be in domain of curve2 what means min(self.x) >= min(curve2.x) and max(self.x) <= max(curve2.x). Might modify self, and can ret...
def subtract(self, curve2, new_obj=False): """ Method that calculates difference between 2 curves (or subclasses of curves). Domain of self must be in domain of curve2 what means min(self.x) >= min(curve2.x) and max(self.x) <= max(curve2.x). Might modify self, and can ret...
[ "Method", "that", "calculates", "difference", "between", "2", "curves", "(", "or", "subclasses", "of", "curves", ")", ".", "Domain", "of", "self", "must", "be", "in", "domain", "of", "curve2", "what", "means", "min", "(", "self", ".", "x", ")", ">", "=...
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/curve.py#L227-L275
[ "def", "subtract", "(", "self", ",", "curve2", ",", "new_obj", "=", "False", ")", ":", "# domain1 = [a1, b1]", "# domain2 = [a2, b2]", "a1", ",", "b1", "=", "np", ".", "min", "(", "self", ".", "x", ")", ",", "np", ".", "max", "(", "self", ".", "x", ...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
alert
Displays a simple message box with text and a single OK button. Returns the text of the button clicked on.
pymsgbox/_native_win.py
def alert(text='', title='', button='OK'): """Displays a simple message box with text and a single OK button. Returns the text of the button clicked on.""" messageBoxFunc(0, text, title, MB_OK | MB_SETFOREGROUND | MB_TOPMOST) return button
def alert(text='', title='', button='OK'): """Displays a simple message box with text and a single OK button. Returns the text of the button clicked on.""" messageBoxFunc(0, text, title, MB_OK | MB_SETFOREGROUND | MB_TOPMOST) return button
[ "Displays", "a", "simple", "message", "box", "with", "text", "and", "a", "single", "OK", "button", ".", "Returns", "the", "text", "of", "the", "button", "clicked", "on", "." ]
asweigart/PyMsgBox
python
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/_native_win.py#L39-L42
[ "def", "alert", "(", "text", "=", "''", ",", "title", "=", "''", ",", "button", "=", "'OK'", ")", ":", "messageBoxFunc", "(", "0", ",", "text", ",", "title", ",", "MB_OK", "|", "MB_SETFOREGROUND", "|", "MB_TOPMOST", ")", "return", "button" ]
c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da
train
confirm
Displays a message box with OK and Cancel buttons. Number and text of buttons can be customized. Returns the text of the button clicked on.
pymsgbox/_native_win.py
def confirm(text='', title='', buttons=['OK', 'Cancel']): """Displays a message box with OK and Cancel buttons. Number and text of buttons can be customized. Returns the text of the button clicked on.""" retVal = messageBoxFunc(0, text, title, MB_OKCANCEL | MB_ICONQUESTION | MB_SETFOREGROUND | MB_TOPMOST) i...
def confirm(text='', title='', buttons=['OK', 'Cancel']): """Displays a message box with OK and Cancel buttons. Number and text of buttons can be customized. Returns the text of the button clicked on.""" retVal = messageBoxFunc(0, text, title, MB_OKCANCEL | MB_ICONQUESTION | MB_SETFOREGROUND | MB_TOPMOST) i...
[ "Displays", "a", "message", "box", "with", "OK", "and", "Cancel", "buttons", ".", "Number", "and", "text", "of", "buttons", "can", "be", "customized", ".", "Returns", "the", "text", "of", "the", "button", "clicked", "on", "." ]
asweigart/PyMsgBox
python
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/_native_win.py#L44-L52
[ "def", "confirm", "(", "text", "=", "''", ",", "title", "=", "''", ",", "buttons", "=", "[", "'OK'", ",", "'Cancel'", "]", ")", ":", "retVal", "=", "messageBoxFunc", "(", "0", ",", "text", ",", "title", ",", "MB_OKCANCEL", "|", "MB_ICONQUESTION", "|"...
c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da
train
subtract
Function calculates difference between curve1 and curve2 and returns new object which domain is an union of curve1 and curve2 domains Returned object is of type type(curve1) and has same metadata as curve1 object :param curve1: first curve to calculate the difference :param curve2: second curve...
beprof/functions.py
def subtract(curve1, curve2, def_val=0): """ Function calculates difference between curve1 and curve2 and returns new object which domain is an union of curve1 and curve2 domains Returned object is of type type(curve1) and has same metadata as curve1 object :param curve1: first curve to cal...
def subtract(curve1, curve2, def_val=0): """ Function calculates difference between curve1 and curve2 and returns new object which domain is an union of curve1 and curve2 domains Returned object is of type type(curve1) and has same metadata as curve1 object :param curve1: first curve to cal...
[ "Function", "calculates", "difference", "between", "curve1", "and", "curve2", "and", "returns", "new", "object", "which", "domain", "is", "an", "union", "of", "curve1", "and", "curve2", "domains", "Returned", "object", "is", "of", "type", "type", "(", "curve1"...
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/functions.py#L4-L24
[ "def", "subtract", "(", "curve1", ",", "curve2", ",", "def_val", "=", "0", ")", ":", "coord1", "=", "np", ".", "union1d", "(", "curve1", ".", "x", ",", "curve2", ".", "x", ")", "y1", "=", "curve1", ".", "evaluate_at_x", "(", "coord1", ",", "def_val...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
medfilt
Apply a window-length median filter to a 1D array vector. Should get rid of 'spike' value 15. >>> print(medfilt(np.array([1., 15., 1., 1., 1.]), 3)) [1. 1. 1. 1. 1.] The 'edge' case is a bit tricky... >>> print(medfilt(np.array([15., 1., 1., 1., 1.]), 3)) [15. 1. 1. 1. 1.] Inspired by...
beprof/functions.py
def medfilt(vector, window): """ Apply a window-length median filter to a 1D array vector. Should get rid of 'spike' value 15. >>> print(medfilt(np.array([1., 15., 1., 1., 1.]), 3)) [1. 1. 1. 1. 1.] The 'edge' case is a bit tricky... >>> print(medfilt(np.array([15., 1., 1., 1., 1.]), 3)) ...
def medfilt(vector, window): """ Apply a window-length median filter to a 1D array vector. Should get rid of 'spike' value 15. >>> print(medfilt(np.array([1., 15., 1., 1., 1.]), 3)) [1. 1. 1. 1. 1.] The 'edge' case is a bit tricky... >>> print(medfilt(np.array([15., 1., 1., 1., 1.]), 3)) ...
[ "Apply", "a", "window", "-", "length", "median", "filter", "to", "a", "1D", "array", "vector", "." ]
DataMedSci/beprof
python
https://github.com/DataMedSci/beprof/blob/f94c10929ea357bd0e5ead8f7a2d3061acfd6494/beprof/functions.py#L27-L56
[ "def", "medfilt", "(", "vector", ",", "window", ")", ":", "if", "not", "window", "%", "2", "==", "1", ":", "raise", "ValueError", "(", "\"Median filter length must be odd.\"", ")", "if", "not", "vector", ".", "ndim", "==", "1", ":", "raise", "ValueError", ...
f94c10929ea357bd0e5ead8f7a2d3061acfd6494
train
interpn
Interpolation on N-D. ai = interpn(x, y, z, ..., a, xi, yi, zi, ...) where the arrays x, y, z, ... define a rectangular grid and a.shape == (len(x), len(y), len(z), ...) are the values interpolate at xi, yi, zi, ...
regulargrid/interpn.py
def interpn(*args, **kw): """Interpolation on N-D. ai = interpn(x, y, z, ..., a, xi, yi, zi, ...) where the arrays x, y, z, ... define a rectangular grid and a.shape == (len(x), len(y), len(z), ...) are the values interpolate at xi, yi, zi, ... """ method = kw.pop('method', 'cubic') if kw: raise ValueError(...
def interpn(*args, **kw): """Interpolation on N-D. ai = interpn(x, y, z, ..., a, xi, yi, zi, ...) where the arrays x, y, z, ... define a rectangular grid and a.shape == (len(x), len(y), len(z), ...) are the values interpolate at xi, yi, zi, ... """ method = kw.pop('method', 'cubic') if kw: raise ValueError(...
[ "Interpolation", "on", "N", "-", "D", "." ]
JohannesBuchner/regulargrid
python
https://github.com/JohannesBuchner/regulargrid/blob/8803d8367c6b413d7a70ec474c67cc45ad8c00c8/regulargrid/interpn.py#L4-L24
[ "def", "interpn", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "method", "=", "kw", ".", "pop", "(", "'method'", ",", "'cubic'", ")", "if", "kw", ":", "raise", "ValueError", "(", "\"Unknown arguments: \"", "%", "kw", ".", "keys", "(", ")", ")",...
8803d8367c6b413d7a70ec474c67cc45ad8c00c8
train
npinterpn
Interpolation on N-D. ai = interpn(x, y, z, ..., a, xi, yi, zi, ...) where the arrays x, y, z, ... define a rectangular grid and a.shape == (len(x), len(y), len(z), ...) are the values interpolate at xi, yi, zi, ...
regulargrid/interpn.py
def npinterpn(*args, **kw): """Interpolation on N-D. ai = interpn(x, y, z, ..., a, xi, yi, zi, ...) where the arrays x, y, z, ... define a rectangular grid and a.shape == (len(x), len(y), len(z), ...) are the values interpolate at xi, yi, zi, ... """ method = kw.pop('method', 'cubic') if kw: raise ValueErro...
def npinterpn(*args, **kw): """Interpolation on N-D. ai = interpn(x, y, z, ..., a, xi, yi, zi, ...) where the arrays x, y, z, ... define a rectangular grid and a.shape == (len(x), len(y), len(z), ...) are the values interpolate at xi, yi, zi, ... """ method = kw.pop('method', 'cubic') if kw: raise ValueErro...
[ "Interpolation", "on", "N", "-", "D", "." ]
JohannesBuchner/regulargrid
python
https://github.com/JohannesBuchner/regulargrid/blob/8803d8367c6b413d7a70ec474c67cc45ad8c00c8/regulargrid/interpn.py#L26-L46
[ "def", "npinterpn", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "method", "=", "kw", ".", "pop", "(", "'method'", ",", "'cubic'", ")", "if", "kw", ":", "raise", "ValueError", "(", "\"Unknown arguments: \"", "%", "kw", ".", "keys", "(", ")", ")...
8803d8367c6b413d7a70ec474c67cc45ad8c00c8
train
model_fields
Generate a dictionary of fields for a given Peewee model. See `model_form` docstring for description of parameters.
wtfpeewee/orm.py
def model_fields(model, allow_pk=False, only=None, exclude=None, field_args=None, converter=None): """ Generate a dictionary of fields for a given Peewee model. See `model_form` docstring for description of parameters. """ converter = converter or ModelConverter() field_args = ...
def model_fields(model, allow_pk=False, only=None, exclude=None, field_args=None, converter=None): """ Generate a dictionary of fields for a given Peewee model. See `model_form` docstring for description of parameters. """ converter = converter or ModelConverter() field_args = ...
[ "Generate", "a", "dictionary", "of", "fields", "for", "a", "given", "Peewee", "model", "." ]
coleifer/wtf-peewee
python
https://github.com/coleifer/wtf-peewee/blob/f062c59b05ce9ba74467514a272d353f803f37d1/wtfpeewee/orm.py#L194-L221
[ "def", "model_fields", "(", "model", ",", "allow_pk", "=", "False", ",", "only", "=", "None", ",", "exclude", "=", "None", ",", "field_args", "=", "None", ",", "converter", "=", "None", ")", ":", "converter", "=", "converter", "or", "ModelConverter", "("...
f062c59b05ce9ba74467514a272d353f803f37d1
train
model_form
Create a wtforms Form for a given Peewee model class:: from wtfpeewee.orm import model_form from myproject.myapp.models import User UserForm = model_form(User) :param model: A Peewee model class :param base_class: Base form class to extend from. Must be a ``wtforms.Form...
wtfpeewee/orm.py
def model_form(model, base_class=Form, allow_pk=False, only=None, exclude=None, field_args=None, converter=None): """ Create a wtforms Form for a given Peewee model class:: from wtfpeewee.orm import model_form from myproject.myapp.models import User UserForm = model_form(...
def model_form(model, base_class=Form, allow_pk=False, only=None, exclude=None, field_args=None, converter=None): """ Create a wtforms Form for a given Peewee model class:: from wtfpeewee.orm import model_form from myproject.myapp.models import User UserForm = model_form(...
[ "Create", "a", "wtforms", "Form", "for", "a", "given", "Peewee", "model", "class", "::" ]
coleifer/wtf-peewee
python
https://github.com/coleifer/wtf-peewee/blob/f062c59b05ce9ba74467514a272d353f803f37d1/wtfpeewee/orm.py#L224-L251
[ "def", "model_form", "(", "model", ",", "base_class", "=", "Form", ",", "allow_pk", "=", "False", ",", "only", "=", "None", ",", "exclude", "=", "None", ",", "field_args", "=", "None", ",", "converter", "=", "None", ")", ":", "field_dict", "=", "model_...
f062c59b05ce9ba74467514a272d353f803f37d1
train
alert
Displays a simple message box with text and a single OK button. Returns the text of the button clicked on.
pymsgbox/__init__.py
def alert(text='', title='', button=OK_TEXT, root=None, timeout=None): """Displays a simple message box with text and a single OK button. Returns the text of the button clicked on.""" assert TKINTER_IMPORT_SUCCEEDED, 'Tkinter is required for pymsgbox' return _buttonbox(msg=text, title=title, choices=[str(bu...
def alert(text='', title='', button=OK_TEXT, root=None, timeout=None): """Displays a simple message box with text and a single OK button. Returns the text of the button clicked on.""" assert TKINTER_IMPORT_SUCCEEDED, 'Tkinter is required for pymsgbox' return _buttonbox(msg=text, title=title, choices=[str(bu...
[ "Displays", "a", "simple", "message", "box", "with", "text", "and", "a", "single", "OK", "button", ".", "Returns", "the", "text", "of", "the", "button", "clicked", "on", "." ]
asweigart/PyMsgBox
python
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L97-L100
[ "def", "alert", "(", "text", "=", "''", ",", "title", "=", "''", ",", "button", "=", "OK_TEXT", ",", "root", "=", "None", ",", "timeout", "=", "None", ")", ":", "assert", "TKINTER_IMPORT_SUCCEEDED", ",", "'Tkinter is required for pymsgbox'", "return", "_butt...
c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da
train
confirm
Displays a message box with OK and Cancel buttons. Number and text of buttons can be customized. Returns the text of the button clicked on.
pymsgbox/__init__.py
def confirm(text='', title='', buttons=[OK_TEXT, CANCEL_TEXT], root=None, timeout=None): """Displays a message box with OK and Cancel buttons. Number and text of buttons can be customized. Returns the text of the button clicked on.""" assert TKINTER_IMPORT_SUCCEEDED, 'Tkinter is required for pymsgbox' retur...
def confirm(text='', title='', buttons=[OK_TEXT, CANCEL_TEXT], root=None, timeout=None): """Displays a message box with OK and Cancel buttons. Number and text of buttons can be customized. Returns the text of the button clicked on.""" assert TKINTER_IMPORT_SUCCEEDED, 'Tkinter is required for pymsgbox' retur...
[ "Displays", "a", "message", "box", "with", "OK", "and", "Cancel", "buttons", ".", "Number", "and", "text", "of", "buttons", "can", "be", "customized", ".", "Returns", "the", "text", "of", "the", "button", "clicked", "on", "." ]
asweigart/PyMsgBox
python
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L103-L106
[ "def", "confirm", "(", "text", "=", "''", ",", "title", "=", "''", ",", "buttons", "=", "[", "OK_TEXT", ",", "CANCEL_TEXT", "]", ",", "root", "=", "None", ",", "timeout", "=", "None", ")", ":", "assert", "TKINTER_IMPORT_SUCCEEDED", ",", "'Tkinter is requ...
c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da
train
prompt
Displays a message box with text input, and OK & Cancel buttons. Returns the text entered, or None if Cancel was clicked.
pymsgbox/__init__.py
def prompt(text='', title='' , default='', root=None, timeout=None): """Displays a message box with text input, and OK & Cancel buttons. Returns the text entered, or None if Cancel was clicked.""" assert TKINTER_IMPORT_SUCCEEDED, 'Tkinter is required for pymsgbox' return __fillablebox(text, title, default=d...
def prompt(text='', title='' , default='', root=None, timeout=None): """Displays a message box with text input, and OK & Cancel buttons. Returns the text entered, or None if Cancel was clicked.""" assert TKINTER_IMPORT_SUCCEEDED, 'Tkinter is required for pymsgbox' return __fillablebox(text, title, default=d...
[ "Displays", "a", "message", "box", "with", "text", "input", "and", "OK", "&", "Cancel", "buttons", ".", "Returns", "the", "text", "entered", "or", "None", "if", "Cancel", "was", "clicked", "." ]
asweigart/PyMsgBox
python
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L109-L112
[ "def", "prompt", "(", "text", "=", "''", ",", "title", "=", "''", ",", "default", "=", "''", ",", "root", "=", "None", ",", "timeout", "=", "None", ")", ":", "assert", "TKINTER_IMPORT_SUCCEEDED", ",", "'Tkinter is required for pymsgbox'", "return", "__fillab...
c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da
train
_buttonbox
Display a msg, a title, and a set of buttons. The buttons are defined by the members of the choices list. Return the text of the button that the user selected. @arg msg: the msg to be displayed. @arg title: the window title @arg choices: a list or tuple of the choices to be displayed
pymsgbox/__init__.py
def _buttonbox(msg, title, choices, root=None, timeout=None): """ Display a msg, a title, and a set of buttons. The buttons are defined by the members of the choices list. Return the text of the button that the user selected. @arg msg: the msg to be displayed. @arg title: the window title @...
def _buttonbox(msg, title, choices, root=None, timeout=None): """ Display a msg, a title, and a set of buttons. The buttons are defined by the members of the choices list. Return the text of the button that the user selected. @arg msg: the msg to be displayed. @arg title: the window title @...
[ "Display", "a", "msg", "a", "title", "and", "a", "set", "of", "buttons", ".", "The", "buttons", "are", "defined", "by", "the", "members", "of", "the", "choices", "list", ".", "Return", "the", "text", "of", "the", "button", "that", "the", "user", "selec...
asweigart/PyMsgBox
python
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L134-L194
[ "def", "_buttonbox", "(", "msg", ",", "title", ",", "choices", ",", "root", "=", "None", ",", "timeout", "=", "None", ")", ":", "global", "boxRoot", ",", "__replyButtonText", ",", "__widgetTexts", ",", "buttonsFrame", "# Initialize __replyButtonText to the first c...
c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da
train
__put_buttons_in_buttonframe
Put the buttons in the buttons frame
pymsgbox/__init__.py
def __put_buttons_in_buttonframe(choices): """Put the buttons in the buttons frame""" global __widgetTexts, __firstWidget, buttonsFrame __firstWidget = None __widgetTexts = {} i = 0 for buttonText in choices: tempButton = tk.Button(buttonsFrame, takefocus=1, text=buttonText) _...
def __put_buttons_in_buttonframe(choices): """Put the buttons in the buttons frame""" global __widgetTexts, __firstWidget, buttonsFrame __firstWidget = None __widgetTexts = {} i = 0 for buttonText in choices: tempButton = tk.Button(buttonsFrame, takefocus=1, text=buttonText) _...
[ "Put", "the", "buttons", "in", "the", "buttons", "frame" ]
asweigart/PyMsgBox
python
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L197-L226
[ "def", "__put_buttons_in_buttonframe", "(", "choices", ")", ":", "global", "__widgetTexts", ",", "__firstWidget", ",", "buttonsFrame", "__firstWidget", "=", "None", "__widgetTexts", "=", "{", "}", "i", "=", "0", "for", "buttonText", "in", "choices", ":", "tempBu...
c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da
train
__fillablebox
Show a box in which a user can enter some text. You may optionally specify some default text, which will appear in the enterbox when it is displayed. Returns the text that the user entered, or None if he cancels the operation.
pymsgbox/__init__.py
def __fillablebox(msg, title='', default='', mask=None, root=None, timeout=None): """ Show a box in which a user can enter some text. You may optionally specify some default text, which will appear in the enterbox when it is displayed. Returns the text that the user entered, or None if he cancels th...
def __fillablebox(msg, title='', default='', mask=None, root=None, timeout=None): """ Show a box in which a user can enter some text. You may optionally specify some default text, which will appear in the enterbox when it is displayed. Returns the text that the user entered, or None if he cancels th...
[ "Show", "a", "box", "in", "which", "a", "user", "can", "enter", "some", "text", ".", "You", "may", "optionally", "specify", "some", "default", "text", "which", "will", "appear", "in", "the", "enterbox", "when", "it", "is", "displayed", ".", "Returns", "t...
asweigart/PyMsgBox
python
https://github.com/asweigart/PyMsgBox/blob/c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da/pymsgbox/__init__.py#L259-L365
[ "def", "__fillablebox", "(", "msg", ",", "title", "=", "''", ",", "default", "=", "''", ",", "mask", "=", "None", ",", "root", "=", "None", ",", "timeout", "=", "None", ")", ":", "global", "boxRoot", ",", "__enterboxText", ",", "__enterboxDefaultText", ...
c94325d21c08690dd89ebf9ebf1cf1b6ed54a1da
train
OneXLogin.parse
Parse the login xml response :param response: the login response from the RETS server :return: None
rets/parsers/login.py
def parse(self, response): """ Parse the login xml response :param response: the login response from the RETS server :return: None """ self.headers = response.headers if 'xml' in self.headers.get('Content-Type'): # Got an XML response, likely an error...
def parse(self, response): """ Parse the login xml response :param response: the login response from the RETS server :return: None """ self.headers = response.headers if 'xml' in self.headers.get('Content-Type'): # Got an XML response, likely an error...
[ "Parse", "the", "login", "xml", "response", ":", "param", "response", ":", "the", "login", "response", "from", "the", "RETS", "server", ":", "return", ":", "None" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/login.py#L20-L45
[ "def", "parse", "(", "self", ",", "response", ")", ":", "self", ".", "headers", "=", "response", ".", "headers", "if", "'xml'", "in", "self", ".", "headers", ".", "get", "(", "'Content-Type'", ")", ":", "# Got an XML response, likely an error code.", "xml", ...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
OneXLogin.read_line
Reads lines of XML and delimits, strips, and returns.
rets/parsers/login.py
def read_line(line): """Reads lines of XML and delimits, strips, and returns.""" name, value = '', '' if '=' in line: name, value = line.split('=', 1) return [name.strip(), value.strip()]
def read_line(line): """Reads lines of XML and delimits, strips, and returns.""" name, value = '', '' if '=' in line: name, value = line.split('=', 1) return [name.strip(), value.strip()]
[ "Reads", "lines", "of", "XML", "and", "delimits", "strips", "and", "returns", "." ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/login.py#L48-L55
[ "def", "read_line", "(", "line", ")", ":", "name", ",", "value", "=", "''", ",", "''", "if", "'='", "in", "line", ":", "name", ",", "value", "=", "line", ".", "split", "(", "'='", ",", "1", ")", "return", "[", "name", ".", "strip", "(", ")", ...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
OneXSearchCursor.generator
Takes a response socket connection and iteratively parses and yields the results as python dictionaries. :param response: a Requests response object with stream=True :return:
rets/parsers/search.py
def generator(self, response): """ Takes a response socket connection and iteratively parses and yields the results as python dictionaries. :param response: a Requests response object with stream=True :return: """ delim = '\t' # Default to tab delimited columns ...
def generator(self, response): """ Takes a response socket connection and iteratively parses and yields the results as python dictionaries. :param response: a Requests response object with stream=True :return: """ delim = '\t' # Default to tab delimited columns ...
[ "Takes", "a", "response", "socket", "connection", "and", "iteratively", "parses", "and", "yields", "the", "results", "as", "python", "dictionaries", ".", ":", "param", "response", ":", "a", "Requests", "response", "object", "with", "stream", "=", "True", ":", ...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/search.py#L18-L72
[ "def", "generator", "(", "self", ",", "response", ")", ":", "delim", "=", "'\\t'", "# Default to tab delimited", "columns", "=", "[", "]", "response", ".", "raw", ".", "decode_content", "=", "True", "events", "=", "ET", ".", "iterparse", "(", "BytesIO", "(...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
flatten_urlinfo
Takes a urlinfo object and returns a flat dictionary.
myawis/__init__.py
def flatten_urlinfo(urlinfo, shorter_keys=True): """ Takes a urlinfo object and returns a flat dictionary.""" def flatten(value, prefix=""): if is_string(value): _result[prefix[1:]] = value return try: len(value) except (AttributeError, TypeError): # ...
def flatten_urlinfo(urlinfo, shorter_keys=True): """ Takes a urlinfo object and returns a flat dictionary.""" def flatten(value, prefix=""): if is_string(value): _result[prefix[1:]] = value return try: len(value) except (AttributeError, TypeError): # ...
[ "Takes", "a", "urlinfo", "object", "and", "returns", "a", "flat", "dictionary", "." ]
ashim888/awis
python
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L163-L207
[ "def", "flatten_urlinfo", "(", "urlinfo", ",", "shorter_keys", "=", "True", ")", ":", "def", "flatten", "(", "value", ",", "prefix", "=", "\"\"", ")", ":", "if", "is_string", "(", "value", ")", ":", "_result", "[", "prefix", "[", "1", ":", "]", "]", ...
b8ed3437dedd7a9646c748474bfabcf2d6e2700b
train
CallAwis.create_v4_signature
Create URI and signature headers based on AWS V4 signing process. Refer to https://docs.aws.amazon.com/AlexaWebInfoService/latest/ApiReferenceArticle.html for request params. :param request_params: dictionary of request parameters :return: URL and header to be passed to requests.get
myawis/__init__.py
def create_v4_signature(self, request_params): ''' Create URI and signature headers based on AWS V4 signing process. Refer to https://docs.aws.amazon.com/AlexaWebInfoService/latest/ApiReferenceArticle.html for request params. :param request_params: dictionary of request parameters ...
def create_v4_signature(self, request_params): ''' Create URI and signature headers based on AWS V4 signing process. Refer to https://docs.aws.amazon.com/AlexaWebInfoService/latest/ApiReferenceArticle.html for request params. :param request_params: dictionary of request parameters ...
[ "Create", "URI", "and", "signature", "headers", "based", "on", "AWS", "V4", "signing", "process", ".", "Refer", "to", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "AlexaWebInfoService", "/", "latest", "/", "ApiReferenceArticle", ...
ashim888/awis
python
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L34-L92
[ "def", "create_v4_signature", "(", "self", ",", "request_params", ")", ":", "method", "=", "'GET'", "service", "=", "'awis'", "host", "=", "'awis.us-west-1.amazonaws.com'", "region", "=", "'us-west-1'", "endpoint", "=", "'https://awis.amazonaws.com/api'", "request_param...
b8ed3437dedd7a9646c748474bfabcf2d6e2700b
train
CallAwis.urlinfo
Provide information about supplied domain as specified by the response group :param domain: Any valid URL :param response_group: Any valid urlinfo response group :return: Traffic and/or content data of the domain in XML format
myawis/__init__.py
def urlinfo(self, domain, response_group = URLINFO_RESPONSE_GROUPS): ''' Provide information about supplied domain as specified by the response group :param domain: Any valid URL :param response_group: Any valid urlinfo response group :return: Traffic and/or content data of the d...
def urlinfo(self, domain, response_group = URLINFO_RESPONSE_GROUPS): ''' Provide information about supplied domain as specified by the response group :param domain: Any valid URL :param response_group: Any valid urlinfo response group :return: Traffic and/or content data of the d...
[ "Provide", "information", "about", "supplied", "domain", "as", "specified", "by", "the", "response", "group", ":", "param", "domain", ":", "Any", "valid", "URL", ":", "param", "response_group", ":", "Any", "valid", "urlinfo", "response", "group", ":", "return"...
ashim888/awis
python
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L94-L108
[ "def", "urlinfo", "(", "self", ",", "domain", ",", "response_group", "=", "URLINFO_RESPONSE_GROUPS", ")", ":", "params", "=", "{", "'Action'", ":", "\"UrlInfo\"", ",", "'Url'", ":", "domain", ",", "'ResponseGroup'", ":", "response_group", "}", "url", ",", "h...
b8ed3437dedd7a9646c748474bfabcf2d6e2700b
train
CallAwis.traffichistory
Provide traffic history of supplied domain :param domain: Any valid URL :param response_group: Any valid traffic history response group :return: Traffic and/or content data of the domain in XML format
myawis/__init__.py
def traffichistory(self, domain, response_group=TRAFFICINFO_RESPONSE_GROUPS, myrange=31, start=20070801): ''' Provide traffic history of supplied domain :param domain: Any valid URL :param response_group: Any valid traffic history response group :return: Traffic and/or content da...
def traffichistory(self, domain, response_group=TRAFFICINFO_RESPONSE_GROUPS, myrange=31, start=20070801): ''' Provide traffic history of supplied domain :param domain: Any valid URL :param response_group: Any valid traffic history response group :return: Traffic and/or content da...
[ "Provide", "traffic", "history", "of", "supplied", "domain", ":", "param", "domain", ":", "Any", "valid", "URL", ":", "param", "response_group", ":", "Any", "valid", "traffic", "history", "response", "group", ":", "return", ":", "Traffic", "and", "/", "or", ...
ashim888/awis
python
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L110-L126
[ "def", "traffichistory", "(", "self", ",", "domain", ",", "response_group", "=", "TRAFFICINFO_RESPONSE_GROUPS", ",", "myrange", "=", "31", ",", "start", "=", "20070801", ")", ":", "params", "=", "{", "'Action'", ":", "\"TrafficHistory\"", ",", "'Url'", ":", ...
b8ed3437dedd7a9646c748474bfabcf2d6e2700b
train
CallAwis.cat_browse
Provide category browse information of specified domain :param domain: Any valid URL :param path: Valid category path :param response_group: Any valid traffic history response group :return: Traffic and/or content data of the domain in XML format
myawis/__init__.py
def cat_browse(self, domain, path, response_group=CATEGORYBROWSE_RESPONSE_GROUPS, descriptions='True'): ''' Provide category browse information of specified domain :param domain: Any valid URL :param path: Valid category path :param response_group: Any valid traffic history respo...
def cat_browse(self, domain, path, response_group=CATEGORYBROWSE_RESPONSE_GROUPS, descriptions='True'): ''' Provide category browse information of specified domain :param domain: Any valid URL :param path: Valid category path :param response_group: Any valid traffic history respo...
[ "Provide", "category", "browse", "information", "of", "specified", "domain", ":", "param", "domain", ":", "Any", "valid", "URL", ":", "param", "path", ":", "Valid", "category", "path", ":", "param", "response_group", ":", "Any", "valid", "traffic", "history", ...
ashim888/awis
python
https://github.com/ashim888/awis/blob/b8ed3437dedd7a9646c748474bfabcf2d6e2700b/myawis/__init__.py#L139-L155
[ "def", "cat_browse", "(", "self", ",", "domain", ",", "path", ",", "response_group", "=", "CATEGORYBROWSE_RESPONSE_GROUPS", ",", "descriptions", "=", "'True'", ")", ":", "params", "=", "{", "'Action'", ":", "\"CategoryListings\"", ",", "'ResponseGroup'", ":", "'...
b8ed3437dedd7a9646c748474bfabcf2d6e2700b
train
Session.add_capability
Add a capability of the RETS board :param name: The name of the capability :param uri: The capability URI given by the RETS board :return: None
rets/session.py
def add_capability(self, name, uri): """ Add a capability of the RETS board :param name: The name of the capability :param uri: The capability URI given by the RETS board :return: None """ parse_results = urlparse(uri) if parse_results.hostname is None: ...
def add_capability(self, name, uri): """ Add a capability of the RETS board :param name: The name of the capability :param uri: The capability URI given by the RETS board :return: None """ parse_results = urlparse(uri) if parse_results.hostname is None: ...
[ "Add", "a", "capability", "of", "the", "RETS", "board", ":", "param", "name", ":", "The", "name", "of", "the", "capability", ":", "param", "uri", ":", "The", "capability", "URI", "given", "by", "the", "RETS", "board", ":", "return", ":", "None" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L90-L110
[ "def", "add_capability", "(", "self", ",", "name", ",", "uri", ")", ":", "parse_results", "=", "urlparse", "(", "uri", ")", "if", "parse_results", ".", "hostname", "is", "None", ":", "# relative URL given, so build this into an absolute URL", "login_url", "=", "se...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session.login
Login to the RETS board and return an instance of Bulletin :return: Bulletin instance
rets/session.py
def login(self): """ Login to the RETS board and return an instance of Bulletin :return: Bulletin instance """ response = self._request('Login') parser = OneXLogin() parser.parse(response) self.session_id = response.cookies.get(self.session_id_cookie_name...
def login(self): """ Login to the RETS board and return an instance of Bulletin :return: Bulletin instance """ response = self._request('Login') parser = OneXLogin() parser.parse(response) self.session_id = response.cookies.get(self.session_id_cookie_name...
[ "Login", "to", "the", "RETS", "board", "and", "return", "an", "instance", "of", "Bulletin", ":", "return", ":", "Bulletin", "instance" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L112-L132
[ "def", "login", "(", "self", ")", ":", "response", "=", "self", ".", "_request", "(", "'Login'", ")", "parser", "=", "OneXLogin", "(", ")", "parser", ".", "parse", "(", "response", ")", "self", ".", "session_id", "=", "response", ".", "cookies", ".", ...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session.get_resource_metadata
Get resource metadata :param resource: The name of the resource to get metadata for :return: list
rets/session.py
def get_resource_metadata(self, resource=None): """ Get resource metadata :param resource: The name of the resource to get metadata for :return: list """ result = self._make_metadata_request(meta_id=0, metadata_type='METADATA-RESOURCE') if resource: re...
def get_resource_metadata(self, resource=None): """ Get resource metadata :param resource: The name of the resource to get metadata for :return: list """ result = self._make_metadata_request(meta_id=0, metadata_type='METADATA-RESOURCE') if resource: re...
[ "Get", "resource", "metadata", ":", "param", "resource", ":", "The", "name", "of", "the", "resource", "to", "get", "metadata", "for", ":", "return", ":", "list" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L152-L161
[ "def", "get_resource_metadata", "(", "self", ",", "resource", "=", "None", ")", ":", "result", "=", "self", ".", "_make_metadata_request", "(", "meta_id", "=", "0", ",", "metadata_type", "=", "'METADATA-RESOURCE'", ")", "if", "resource", ":", "result", "=", ...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session.get_table_metadata
Get metadata for a given resource: class :param resource: The name of the resource :param resource_class: The name of the class to get metadata from :return: list
rets/session.py
def get_table_metadata(self, resource, resource_class): """ Get metadata for a given resource: class :param resource: The name of the resource :param resource_class: The name of the class to get metadata from :return: list """ return self._make_metadata_request(me...
def get_table_metadata(self, resource, resource_class): """ Get metadata for a given resource: class :param resource: The name of the resource :param resource_class: The name of the class to get metadata from :return: list """ return self._make_metadata_request(me...
[ "Get", "metadata", "for", "a", "given", "resource", ":", "class", ":", "param", "resource", ":", "The", "name", "of", "the", "resource", ":", "param", "resource_class", ":", "The", "name", "of", "the", "class", "to", "get", "metadata", "from", ":", "retu...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L171-L178
[ "def", "get_table_metadata", "(", "self", ",", "resource", ",", "resource_class", ")", ":", "return", "self", ".", "_make_metadata_request", "(", "meta_id", "=", "resource", "+", "':'", "+", "resource_class", ",", "metadata_type", "=", "'METADATA-TABLE'", ")" ]
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session.get_lookup_values
Get possible lookup values for a given field :param resource: The name of the resource :param lookup_name: The name of the the field to get lookup values for :return: list
rets/session.py
def get_lookup_values(self, resource, lookup_name): """ Get possible lookup values for a given field :param resource: The name of the resource :param lookup_name: The name of the the field to get lookup values for :return: list """ return self._make_metadata_reque...
def get_lookup_values(self, resource, lookup_name): """ Get possible lookup values for a given field :param resource: The name of the resource :param lookup_name: The name of the the field to get lookup values for :return: list """ return self._make_metadata_reque...
[ "Get", "possible", "lookup", "values", "for", "a", "given", "field", ":", "param", "resource", ":", "The", "name", "of", "the", "resource", ":", "param", "lookup_name", ":", "The", "name", "of", "the", "the", "field", "to", "get", "lookup", "values", "fo...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L188-L195
[ "def", "get_lookup_values", "(", "self", ",", "resource", ",", "lookup_name", ")", ":", "return", "self", ".", "_make_metadata_request", "(", "meta_id", "=", "resource", "+", "':'", "+", "lookup_name", ",", "metadata_type", "=", "'METADATA-LOOKUP_TYPE'", ")" ]
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session._make_metadata_request
Get the Metadata. The Session initializes with 'COMPACT-DECODED' as the format type. If that returns a DTD error then we change to the 'STANDARD-XML' format and try again. :param meta_id: The name of the resource, class, or lookup to get metadata for :param metadata_type: The RETS metadata type ...
rets/session.py
def _make_metadata_request(self, meta_id, metadata_type=None): """ Get the Metadata. The Session initializes with 'COMPACT-DECODED' as the format type. If that returns a DTD error then we change to the 'STANDARD-XML' format and try again. :param meta_id: The name of the resource, class, ...
def _make_metadata_request(self, meta_id, metadata_type=None): """ Get the Metadata. The Session initializes with 'COMPACT-DECODED' as the format type. If that returns a DTD error then we change to the 'STANDARD-XML' format and try again. :param meta_id: The name of the resource, class, ...
[ "Get", "the", "Metadata", ".", "The", "Session", "initializes", "with", "COMPACT", "-", "DECODED", "as", "the", "format", "type", ".", "If", "that", "returns", "a", "DTD", "error", "then", "we", "change", "to", "the", "STANDARD", "-", "XML", "format", "a...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L197-L238
[ "def", "_make_metadata_request", "(", "self", ",", "meta_id", ",", "metadata_type", "=", "None", ")", ":", "# If this metadata _request has already happened, returned the saved result.", "key", "=", "'{0!s}:{1!s}'", ".", "format", "(", "metadata_type", ",", "meta_id", ")"...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session.get_preferred_object
Get the first object from a Resource :param resource: The name of the resource :param object_type: The type of object to fetch :param content_id: The unique id of the item to get objects for :param location: The path to get Objects from :return: Object
rets/session.py
def get_preferred_object(self, resource, object_type, content_id, location=0): """ Get the first object from a Resource :param resource: The name of the resource :param object_type: The type of object to fetch :param content_id: The unique id of the item to get objects for ...
def get_preferred_object(self, resource, object_type, content_id, location=0): """ Get the first object from a Resource :param resource: The name of the resource :param object_type: The type of object to fetch :param content_id: The unique id of the item to get objects for ...
[ "Get", "the", "first", "object", "from", "a", "Resource", ":", "param", "resource", ":", "The", "name", "of", "the", "resource", ":", "param", "object_type", ":", "The", "type", "of", "object", "to", "fetch", ":", "param", "content_id", ":", "The", "uniq...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L240-L251
[ "def", "get_preferred_object", "(", "self", ",", "resource", ",", "object_type", ",", "content_id", ",", "location", "=", "0", ")", ":", "collection", "=", "self", ".", "get_object", "(", "resource", "=", "resource", ",", "object_type", "=", "object_type", "...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session.get_object
Get a list of Objects from a resource :param resource: The resource to get objects from :param object_type: The type of object to fetch :param content_ids: The unique id of the item to get objects for :param object_ids: ids of the objects to download :param location: The path to ...
rets/session.py
def get_object(self, resource, object_type, content_ids, object_ids='*', location=0): """ Get a list of Objects from a resource :param resource: The resource to get objects from :param object_type: The type of object to fetch :param content_ids: The unique id of the item to get o...
def get_object(self, resource, object_type, content_ids, object_ids='*', location=0): """ Get a list of Objects from a resource :param resource: The resource to get objects from :param object_type: The type of object to fetch :param content_ids: The unique id of the item to get o...
[ "Get", "a", "list", "of", "Objects", "from", "a", "resource", ":", "param", "resource", ":", "The", "resource", "to", "get", "objects", "from", ":", "param", "object_type", ":", "The", "type", "of", "object", "to", "fetch", ":", "param", "content_ids", "...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L253-L286
[ "def", "get_object", "(", "self", ",", "resource", ",", "object_type", ",", "content_ids", ",", "object_ids", "=", "'*'", ",", "location", "=", "0", ")", ":", "object_helper", "=", "GetObject", "(", ")", "request_ids", "=", "object_helper", ".", "ids", "("...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session.search
Preform a search on the RETS board :param resource: The resource that contains the class to search :param resource_class: The class to search :param search_filter: The query as a dict :param dmql_query: The query in dmql format :param limit: Limit search values count :par...
rets/session.py
def search(self, resource, resource_class, search_filter=None, dmql_query=None, limit=9999999, offset=0, optional_parameters=None, auto_offset=True, query_type='DMQL2', standard_names=0, response_format='COMPACT-DECODED'): """ Preform a search on the RETS board :par...
def search(self, resource, resource_class, search_filter=None, dmql_query=None, limit=9999999, offset=0, optional_parameters=None, auto_offset=True, query_type='DMQL2', standard_names=0, response_format='COMPACT-DECODED'): """ Preform a search on the RETS board :par...
[ "Preform", "a", "search", "on", "the", "RETS", "board", ":", "param", "resource", ":", "The", "resource", "that", "contains", "the", "class", "to", "search", ":", "param", "resource_class", ":", "The", "class", "to", "search", ":", "param", "search_filter", ...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L288-L363
[ "def", "search", "(", "self", ",", "resource", ",", "resource_class", ",", "search_filter", "=", "None", ",", "dmql_query", "=", "None", ",", "limit", "=", "9999999", ",", "offset", "=", "0", ",", "optional_parameters", "=", "None", ",", "auto_offset", "="...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session._request
Make a _request to the RETS server :param capability: The name of the capability to use to get the URI :param options: Options to put into the _request :return: Response
rets/session.py
def _request(self, capability, options=None, stream=False): """ Make a _request to the RETS server :param capability: The name of the capability to use to get the URI :param options: Options to put into the _request :return: Response """ if options is None: ...
def _request(self, capability, options=None, stream=False): """ Make a _request to the RETS server :param capability: The name of the capability to use to get the URI :param options: Options to put into the _request :return: Response """ if options is None: ...
[ "Make", "a", "_request", "to", "the", "RETS", "server", ":", "param", "capability", ":", "The", "name", "of", "the", "capability", "to", "use", "to", "get", "the", "URI", ":", "param", "options", ":", "Options", "to", "put", "into", "the", "_request", ...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L365-L409
[ "def", "_request", "(", "self", ",", "capability", ",", "options", "=", "None", ",", "stream", "=", "False", ")", ":", "if", "options", "is", "None", ":", "options", "=", "{", "}", "options", ".", "update", "(", "{", "'headers'", ":", "self", ".", ...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Session._user_agent_digest_hash
Hash the user agent and user agent password Section 3.10 of https://www.nar.realtor/retsorg.nsf/retsproto1.7d6.pdf :return: md5
rets/session.py
def _user_agent_digest_hash(self): """ Hash the user agent and user agent password Section 3.10 of https://www.nar.realtor/retsorg.nsf/retsproto1.7d6.pdf :return: md5 """ if not self.version: raise MissingVersion("A version is required for user agent auth. The...
def _user_agent_digest_hash(self): """ Hash the user agent and user agent password Section 3.10 of https://www.nar.realtor/retsorg.nsf/retsproto1.7d6.pdf :return: md5 """ if not self.version: raise MissingVersion("A version is required for user agent auth. The...
[ "Hash", "the", "user", "agent", "and", "user", "agent", "password", "Section", "3", ".", "10", "of", "https", ":", "//", "www", ".", "nar", ".", "realtor", "/", "retsorg", ".", "nsf", "/", "retsproto1", ".", "7d6", ".", "pdf", ":", "return", ":", "...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/session.py#L411-L427
[ "def", "_user_agent_digest_hash", "(", "self", ")", ":", "if", "not", "self", ".", "version", ":", "raise", "MissingVersion", "(", "\"A version is required for user agent auth. The RETS server should set this\"", "\"automatically but it has not. Please instantiate the session with a ...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
HTMLMIN.response_minify
minify response html to decrease traffic
flask_htmlmin/__init__.py
def response_minify(self, response): """ minify response html to decrease traffic """ if response.content_type == u'text/html; charset=utf-8': endpoint = request.endpoint or '' view_func = current_app.view_functions.get(endpoint, None) name = ( ...
def response_minify(self, response): """ minify response html to decrease traffic """ if response.content_type == u'text/html; charset=utf-8': endpoint = request.endpoint or '' view_func = current_app.view_functions.get(endpoint, None) name = ( ...
[ "minify", "response", "html", "to", "decrease", "traffic" ]
hamidfzm/Flask-HTMLmin
python
https://github.com/hamidfzm/Flask-HTMLmin/blob/03de23347ac021da4011af36b57903a235268429/flask_htmlmin/__init__.py#L29-L50
[ "def", "response_minify", "(", "self", ",", "response", ")", ":", "if", "response", ".", "content_type", "==", "u'text/html; charset=utf-8'", ":", "endpoint", "=", "request", ".", "endpoint", "or", "''", "view_func", "=", "current_app", ".", "view_functions", "....
03de23347ac021da4011af36b57903a235268429
train
HTMLMIN.exempt
decorator to mark a view as exempt from htmlmin.
flask_htmlmin/__init__.py
def exempt(self, obj): """ decorator to mark a view as exempt from htmlmin. """ name = '%s.%s' % (obj.__module__, obj.__name__) @wraps(obj) def __inner(*a, **k): return obj(*a, **k) self._exempt_routes.add(name) return __inner
def exempt(self, obj): """ decorator to mark a view as exempt from htmlmin. """ name = '%s.%s' % (obj.__module__, obj.__name__) @wraps(obj) def __inner(*a, **k): return obj(*a, **k) self._exempt_routes.add(name) return __inner
[ "decorator", "to", "mark", "a", "view", "as", "exempt", "from", "htmlmin", "." ]
hamidfzm/Flask-HTMLmin
python
https://github.com/hamidfzm/Flask-HTMLmin/blob/03de23347ac021da4011af36b57903a235268429/flask_htmlmin/__init__.py#L52-L63
[ "def", "exempt", "(", "self", ",", "obj", ")", ":", "name", "=", "'%s.%s'", "%", "(", "obj", ".", "__module__", ",", "obj", ".", "__name__", ")", "@", "wraps", "(", "obj", ")", "def", "__inner", "(", "*", "a", ",", "*", "*", "k", ")", ":", "r...
03de23347ac021da4011af36b57903a235268429
train
DMQLHelper.dmql
Client supplied raw DMQL, ensure quote wrap.
rets/utils/search.py
def dmql(query): """Client supplied raw DMQL, ensure quote wrap.""" if isinstance(query, dict): raise ValueError("You supplied a dictionary to the dmql_query parameter, but a string is required." " Did you mean to pass this to the search_filter parameter? ") ...
def dmql(query): """Client supplied raw DMQL, ensure quote wrap.""" if isinstance(query, dict): raise ValueError("You supplied a dictionary to the dmql_query parameter, but a string is required." " Did you mean to pass this to the search_filter parameter? ") ...
[ "Client", "supplied", "raw", "DMQL", "ensure", "quote", "wrap", "." ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/utils/search.py#L14-L23
[ "def", "dmql", "(", "query", ")", ":", "if", "isinstance", "(", "query", ",", "dict", ")", ":", "raise", "ValueError", "(", "\"You supplied a dictionary to the dmql_query parameter, but a string is required.\"", "\" Did you mean to pass this to the search_filter parameter? \"", ...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
DMQLHelper.filter_to_dmql
Converts the filter dictionary into DMQL
rets/utils/search.py
def filter_to_dmql(filter_dict): """Converts the filter dictionary into DMQL""" if not isinstance(filter_dict, (dict, collections.OrderedDict)): raise TypeError('Expected a dictionary type buy got {} instead.'.format(type(filter_dict))) def is_date_time_type(val): """Re...
def filter_to_dmql(filter_dict): """Converts the filter dictionary into DMQL""" if not isinstance(filter_dict, (dict, collections.OrderedDict)): raise TypeError('Expected a dictionary type buy got {} instead.'.format(type(filter_dict))) def is_date_time_type(val): """Re...
[ "Converts", "the", "filter", "dictionary", "into", "DMQL" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/utils/search.py#L26-L161
[ "def", "filter_to_dmql", "(", "filter_dict", ")", ":", "if", "not", "isinstance", "(", "filter_dict", ",", "(", "dict", ",", "collections", ".", "OrderedDict", ")", ")", ":", "raise", "TypeError", "(", "'Expected a dictionary type buy got {} instead.'", ".", "form...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Base.get_attributes
Get attributes of xml tags in input_dict and creates a dictionary with the attribute name as the key and the attribute value as the value :param input_dict: The xml tag with the attributes and values :return: dict
rets/parsers/base.py
def get_attributes(input_dict): """ Get attributes of xml tags in input_dict and creates a dictionary with the attribute name as the key and the attribute value as the value :param input_dict: The xml tag with the attributes and values :return: dict """ return {k....
def get_attributes(input_dict): """ Get attributes of xml tags in input_dict and creates a dictionary with the attribute name as the key and the attribute value as the value :param input_dict: The xml tag with the attributes and values :return: dict """ return {k....
[ "Get", "attributes", "of", "xml", "tags", "in", "input_dict", "and", "creates", "a", "dictionary", "with", "the", "attribute", "name", "as", "the", "key", "and", "the", "attribute", "value", "as", "the", "value", ":", "param", "input_dict", ":", "The", "xm...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/base.py#L12-L19
[ "def", "get_attributes", "(", "input_dict", ")", ":", "return", "{", "k", ".", "lstrip", "(", "\"@\"", ")", ":", "v", "for", "k", ",", "v", "in", "input_dict", ".", "items", "(", ")", "if", "k", "[", "0", "]", "==", "\"@\"", "}" ]
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Base.data_columns_to_dict
Turns column names in a single string into a dictionary with the key being the column name and the value being the value in that column for each row :param columns_string: A string of column names :param dict_string: A string of values :param delimiter: The delimiter to use to split the ...
rets/parsers/base.py
def data_columns_to_dict(columns_string, dict_string, delimiter=None): """ Turns column names in a single string into a dictionary with the key being the column name and the value being the value in that column for each row :param columns_string: A string of column names :param d...
def data_columns_to_dict(columns_string, dict_string, delimiter=None): """ Turns column names in a single string into a dictionary with the key being the column name and the value being the value in that column for each row :param columns_string: A string of column names :param d...
[ "Turns", "column", "names", "in", "a", "single", "string", "into", "a", "dictionary", "with", "the", "key", "being", "the", "column", "name", "and", "the", "value", "being", "the", "value", "in", "that", "column", "for", "each", "row", ":", "param", "col...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/base.py#L22-L34
[ "def", "data_columns_to_dict", "(", "columns_string", ",", "dict_string", ",", "delimiter", "=", "None", ")", ":", "if", "delimiter", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "zip", "(", "columns_string", ".", "split", "(", "delimit...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
Base.analyze_reply_code
Checks the RETS Response Code and handles non-zero answers. :param xml_response_dict: :return: None
rets/parsers/base.py
def analyze_reply_code(self, xml_response_dict): """ Checks the RETS Response Code and handles non-zero answers. :param xml_response_dict: :return: None """ if 'RETS-STATUS' in xml_response_dict: attributes = self.get_attributes(xml_response_dict['RETS-STATUS'...
def analyze_reply_code(self, xml_response_dict): """ Checks the RETS Response Code and handles non-zero answers. :param xml_response_dict: :return: None """ if 'RETS-STATUS' in xml_response_dict: attributes = self.get_attributes(xml_response_dict['RETS-STATUS'...
[ "Checks", "the", "RETS", "Response", "Code", "and", "handles", "non", "-", "zero", "answers", ".", ":", "param", "xml_response_dict", ":", ":", "return", ":", "None" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/base.py#L36-L64
[ "def", "analyze_reply_code", "(", "self", ",", "xml_response_dict", ")", ":", "if", "'RETS-STATUS'", "in", "xml_response_dict", ":", "attributes", "=", "self", ".", "get_attributes", "(", "xml_response_dict", "[", "'RETS-STATUS'", "]", ")", "reply_code", "=", "att...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
GetObject.ids
Appends the content and object ids how RETS expects them
rets/utils/get_object.py
def ids(self, content_ids, object_ids): """Appends the content and object ids how RETS expects them""" result = [] content_ids = self.split(content_ids, False) object_ids = self.split(object_ids) for cid in content_ids: result.append('{}:{}'.format(cid, ':'.join(obj...
def ids(self, content_ids, object_ids): """Appends the content and object ids how RETS expects them""" result = [] content_ids = self.split(content_ids, False) object_ids = self.split(object_ids) for cid in content_ids: result.append('{}:{}'.format(cid, ':'.join(obj...
[ "Appends", "the", "content", "and", "object", "ids", "how", "RETS", "expects", "them" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/utils/get_object.py#L7-L17
[ "def", "ids", "(", "self", ",", "content_ids", ",", "object_ids", ")", ":", "result", "=", "[", "]", "content_ids", "=", "self", ".", "split", "(", "content_ids", ",", "False", ")", "object_ids", "=", "self", ".", "split", "(", "object_ids", ")", "for"...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
GetObject.split
Splits
rets/utils/get_object.py
def split(value, dash_ranges=True): """Splits """ if isinstance(value, list): value = [str(v) for v in value] else: str_value = str(value) dash_matches = re.match(pattern='(\d+)\-(\d+)', string=str_value) if ':' in str_value or ',' in str_value: ...
def split(value, dash_ranges=True): """Splits """ if isinstance(value, list): value = [str(v) for v in value] else: str_value = str(value) dash_matches = re.match(pattern='(\d+)\-(\d+)', string=str_value) if ':' in str_value or ',' in str_value: ...
[ "Splits" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/utils/get_object.py#L20-L38
[ "def", "split", "(", "value", ",", "dash_ranges", "=", "True", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "value", "=", "[", "str", "(", "v", ")", "for", "v", "in", "value", "]", "else", ":", "str_value", "=", "str", "(", ...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
RcaFileStorageHandler.set_value
Set key value to the file. The fuction will be make the key and value to dictinary formate. If its exist then it will update the current new key value to the file. Arg: key : cache key value : cache value
src/pycricket_storagehandler.py
def set_value(self, key, value): """ Set key value to the file. The fuction will be make the key and value to dictinary formate. If its exist then it will update the current new key value to the file. Arg: key : cache key value : cache value """ ...
def set_value(self, key, value): """ Set key value to the file. The fuction will be make the key and value to dictinary formate. If its exist then it will update the current new key value to the file. Arg: key : cache key value : cache value """ ...
[ "Set", "key", "value", "to", "the", "file", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket_storagehandler.py#L56-L73
[ "def", "set_value", "(", "self", ",", "key", ",", "value", ")", ":", "file_cache", "=", "self", ".", "read_file", "(", ")", "if", "file_cache", ":", "file_cache", "[", "key", "]", "=", "value", "else", ":", "file_cache", "=", "{", "}", "file_cache", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaFileStorageHandler.delete_value
Delete the key if the token is expired. Arg: key : cache key
src/pycricket_storagehandler.py
def delete_value(self, key): """ Delete the key if the token is expired. Arg: key : cache key """ response = {} response['status'] = False response['msg'] = "key does not exist" file_cache = self.read_file() if key in file_cache: ...
def delete_value(self, key): """ Delete the key if the token is expired. Arg: key : cache key """ response = {} response['status'] = False response['msg'] = "key does not exist" file_cache = self.read_file() if key in file_cache: ...
[ "Delete", "the", "key", "if", "the", "token", "is", "expired", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket_storagehandler.py#L101-L118
[ "def", "delete_value", "(", "self", ",", "key", ")", ":", "response", "=", "{", "}", "response", "[", "'status'", "]", "=", "False", "response", "[", "'msg'", "]", "=", "\"key does not exist\"", "file_cache", "=", "self", ".", "read_file", "(", ")", "if"...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaFileStorageHandler.read_file
Open the file and assiging the permission to read/write and return the content in json formate. Return : json data
src/pycricket_storagehandler.py
def read_file(self): """ Open the file and assiging the permission to read/write and return the content in json formate. Return : json data """ file_obj = open(self.file, 'r') content = file_obj.read() file_obj.close() if content: cont...
def read_file(self): """ Open the file and assiging the permission to read/write and return the content in json formate. Return : json data """ file_obj = open(self.file, 'r') content = file_obj.read() file_obj.close() if content: cont...
[ "Open", "the", "file", "and", "assiging", "the", "permission", "to", "read", "/", "write", "and", "return", "the", "content", "in", "json", "formate", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket_storagehandler.py#L128-L142
[ "def", "read_file", "(", "self", ")", ":", "file_obj", "=", "open", "(", "self", ".", "file", ",", "'r'", ")", "content", "=", "file_obj", ".", "read", "(", ")", "file_obj", ".", "close", "(", ")", "if", "content", ":", "content", "=", "json", ".",...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaFileStorageHandler.update_file
It will convert json content to json string and update into file. Return: Boolean True/False
src/pycricket_storagehandler.py
def update_file(self, content): """ It will convert json content to json string and update into file. Return: Boolean True/False """ updated_content = json.dumps(content) file_obj = open(self.file, 'r+') file_obj.write(str(updated_content)) file_o...
def update_file(self, content): """ It will convert json content to json string and update into file. Return: Boolean True/False """ updated_content = json.dumps(content) file_obj = open(self.file, 'r+') file_obj.write(str(updated_content)) file_o...
[ "It", "will", "convert", "json", "content", "to", "json", "string", "and", "update", "into", "file", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket_storagehandler.py#L144-L155
[ "def", "update_file", "(", "self", ",", "content", ")", ":", "updated_content", "=", "json", ".", "dumps", "(", "content", ")", "file_obj", "=", "open", "(", "self", ".", "file", ",", "'r+'", ")", "file_obj", ".", "write", "(", "str", "(", "updated_con...
fa47fe2e92915fc58db38898213e974742af55d4
train
CompactMetadata.parse
Parses RETS metadata using the COMPACT-DECODED format :param response: :param metadata_type: :return:
rets/parsers/metadata.py
def parse(self, response, metadata_type): """ Parses RETS metadata using the COMPACT-DECODED format :param response: :param metadata_type: :return: """ xml = xmltodict.parse(response.text) self.analyze_reply_code(xml_response_dict=xml) base = xml.g...
def parse(self, response, metadata_type): """ Parses RETS metadata using the COMPACT-DECODED format :param response: :param metadata_type: :return: """ xml = xmltodict.parse(response.text) self.analyze_reply_code(xml_response_dict=xml) base = xml.g...
[ "Parses", "RETS", "metadata", "using", "the", "COMPACT", "-", "DECODED", "format", ":", "param", "response", ":", ":", "param", "metadata_type", ":", ":", "return", ":" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/metadata.py#L14-L56
[ "def", "parse", "(", "self", ",", "response", ",", "metadata_type", ")", ":", "xml", "=", "xmltodict", ".", "parse", "(", "response", ".", "text", ")", "self", ".", "analyze_reply_code", "(", "xml_response_dict", "=", "xml", ")", "base", "=", "xml", ".",...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
StandardXMLetadata.parse
Parses RETS metadata using the STANDARD-XML format :param response: requests Response object :param metadata_type: string :return parsed: list
rets/parsers/metadata.py
def parse(self, response, metadata_type): """ Parses RETS metadata using the STANDARD-XML format :param response: requests Response object :param metadata_type: string :return parsed: list """ xml = xmltodict.parse(response.text) self.analyze_reply_code(xm...
def parse(self, response, metadata_type): """ Parses RETS metadata using the STANDARD-XML format :param response: requests Response object :param metadata_type: string :return parsed: list """ xml = xmltodict.parse(response.text) self.analyze_reply_code(xm...
[ "Parses", "RETS", "metadata", "using", "the", "STANDARD", "-", "XML", "format", ":", "param", "response", ":", "requests", "Response", "object", ":", "param", "metadata_type", ":", "string", ":", "return", "parsed", ":", "list" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/metadata.py#L62-L116
[ "def", "parse", "(", "self", ",", "response", ",", "metadata_type", ")", ":", "xml", "=", "xmltodict", ".", "parse", "(", "response", ".", "text", ")", "self", ".", "analyze_reply_code", "(", "xml_response_dict", "=", "xml", ")", "base", "=", "xml", ".",...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
MultipleObjectParser._get_multiparts
From this 'multipart/parallel; boundary="874e43d27ec6d83f30f37841bdaf90c7"; charset=utf-8' get this --874e43d27ec6d83f30f37841bdaf90c7
rets/parsers/get_object.py
def _get_multiparts(response): """ From this 'multipart/parallel; boundary="874e43d27ec6d83f30f37841bdaf90c7"; charset=utf-8' get this --874e43d27ec6d83f30f37841bdaf90c7 """ boundary = None for part in response.headers.get('Content-Type', '').split(';'): ...
def _get_multiparts(response): """ From this 'multipart/parallel; boundary="874e43d27ec6d83f30f37841bdaf90c7"; charset=utf-8' get this --874e43d27ec6d83f30f37841bdaf90c7 """ boundary = None for part in response.headers.get('Content-Type', '').split(';'): ...
[ "From", "this", "multipart", "/", "parallel", ";", "boundary", "=", "874e43d27ec6d83f30f37841bdaf90c7", ";", "charset", "=", "utf", "-", "8", "get", "this", "--", "874e43d27ec6d83f30f37841bdaf90c7" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/get_object.py#L39-L73
[ "def", "_get_multiparts", "(", "response", ")", ":", "boundary", "=", "None", "for", "part", "in", "response", ".", "headers", ".", "get", "(", "'Content-Type'", ",", "''", ")", ".", "split", "(", "';'", ")", ":", "if", "'boundary='", "in", "part", ":"...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
MultipleObjectParser.parse_image_response
Parse multiple objects from the RETS feed. A lot of string methods are used to handle the response before encoding it back into bytes for the object. :param response: The response from the feed :return: list of SingleObjectParser
rets/parsers/get_object.py
def parse_image_response(self, response): """ Parse multiple objects from the RETS feed. A lot of string methods are used to handle the response before encoding it back into bytes for the object. :param response: The response from the feed :return: list of SingleObjectParser ...
def parse_image_response(self, response): """ Parse multiple objects from the RETS feed. A lot of string methods are used to handle the response before encoding it back into bytes for the object. :param response: The response from the feed :return: list of SingleObjectParser ...
[ "Parse", "multiple", "objects", "from", "the", "RETS", "feed", ".", "A", "lot", "of", "string", "methods", "are", "used", "to", "handle", "the", "response", "before", "encoding", "it", "back", "into", "bytes", "for", "the", "object", ".", ":", "param", "...
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/get_object.py#L75-L120
[ "def", "parse_image_response", "(", "self", ",", "response", ")", ":", "if", "'xml'", "in", "response", ".", "headers", ".", "get", "(", "'Content-Type'", ")", ":", "# Got an XML response, likely an error code.", "xml", "=", "xmltodict", ".", "parse", "(", "resp...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
SingleObjectParser.parse_image_response
Parse a single object from the RETS feed :param response: The response from the RETS server :return: Object
rets/parsers/get_object.py
def parse_image_response(self, response): """ Parse a single object from the RETS feed :param response: The response from the RETS server :return: Object """ if 'xml' in response.headers.get('Content-Type'): # Got an XML response, likely an error code. ...
def parse_image_response(self, response): """ Parse a single object from the RETS feed :param response: The response from the RETS server :return: Object """ if 'xml' in response.headers.get('Content-Type'): # Got an XML response, likely an error code. ...
[ "Parse", "a", "single", "object", "from", "the", "RETS", "feed", ":", "param", "response", ":", "The", "response", "from", "the", "RETS", "server", ":", "return", ":", "Object" ]
refindlyllc/rets
python
https://github.com/refindlyllc/rets/blob/c615dfc272cff0825fd3b50863c46afc3e33916f/rets/parsers/get_object.py#L125-L139
[ "def", "parse_image_response", "(", "self", ",", "response", ")", ":", "if", "'xml'", "in", "response", ".", "headers", ".", "get", "(", "'Content-Type'", ")", ":", "# Got an XML response, likely an error code.", "xml", "=", "xmltodict", ".", "parse", "(", "resp...
c615dfc272cff0825fd3b50863c46afc3e33916f
train
RcaApp.auth
Auth is used to call the AUTH API of CricketAPI. Access token required for every request call to CricketAPI. Auth functional will post user Cricket API app details to server and return the access token. Return: Access token
src/pycricket.py
def auth(self): """ Auth is used to call the AUTH API of CricketAPI. Access token required for every request call to CricketAPI. Auth functional will post user Cricket API app details to server and return the access token. Return: Access token ...
def auth(self): """ Auth is used to call the AUTH API of CricketAPI. Access token required for every request call to CricketAPI. Auth functional will post user Cricket API app details to server and return the access token. Return: Access token ...
[ "Auth", "is", "used", "to", "call", "the", "AUTH", "API", "of", "CricketAPI", ".", "Access", "token", "required", "for", "every", "request", "call", "to", "CricketAPI", ".", "Auth", "functional", "will", "post", "user", "Cricket", "API", "app", "details", ...
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L89-L117
[ "def", "auth", "(", "self", ")", ":", "if", "not", "self", ".", "store_handler", ".", "has_value", "(", "'access_token'", ")", ":", "params", "=", "{", "}", "params", "[", "\"access_key\"", "]", "=", "self", ".", "access_key", "params", "[", "\"secret_ke...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_response
It will return json response based on given url, params and methods. Arg: params: 'dictionary' url: 'url' format method: default 'get', support method 'post' Return: json data
src/pycricket.py
def get_response(self, url, params={}, method="get"): """ It will return json response based on given url, params and methods. Arg: params: 'dictionary' url: 'url' format method: default 'get', support method 'post' Return: json data ...
def get_response(self, url, params={}, method="get"): """ It will return json response based on given url, params and methods. Arg: params: 'dictionary' url: 'url' format method: default 'get', support method 'post' Return: json data ...
[ "It", "will", "return", "json", "response", "based", "on", "given", "url", "params", "and", "methods", ".", "Arg", ":", "params", ":", "dictionary", "url", ":", "url", "format", "method", ":", "default", "get", "support", "method", "post", "Return", ":", ...
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L119-L144
[ "def", "get_response", "(", "self", ",", "url", ",", "params", "=", "{", "}", ",", "method", "=", "\"get\"", ")", ":", "if", "method", "==", "\"post\"", ":", "response_data", "=", "json", ".", "loads", "(", "requests", ".", "post", "(", "url", ",", ...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_active_token
Getting the valid access token. Access token expires every 24 hours, It will expires then it will generate a new token. Return: active access token
src/pycricket.py
def get_active_token(self): """ Getting the valid access token. Access token expires every 24 hours, It will expires then it will generate a new token. Return: active access token """ expire_time = self.store_handler.has_value("expires") ...
def get_active_token(self): """ Getting the valid access token. Access token expires every 24 hours, It will expires then it will generate a new token. Return: active access token """ expire_time = self.store_handler.has_value("expires") ...
[ "Getting", "the", "valid", "access", "token", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L146-L169
[ "def", "get_active_token", "(", "self", ")", ":", "expire_time", "=", "self", ".", "store_handler", ".", "has_value", "(", "\"expires\"", ")", "access_token", "=", "self", ".", "store_handler", ".", "has_value", "(", "\"access_token\"", ")", "if", "expire_time",...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_match
Calling the Match API. Arg: match_key: key of the match card_type: optional, default to full_card. Accepted values are micro_card, summary_card & full_card. Return: json data
src/pycricket.py
def get_match(self, match_key, card_type="full_card"): """ Calling the Match API. Arg: match_key: key of the match card_type: optional, default to full_card. Accepted values are micro_card, summary_card & full_card. Return: json data ...
def get_match(self, match_key, card_type="full_card"): """ Calling the Match API. Arg: match_key: key of the match card_type: optional, default to full_card. Accepted values are micro_card, summary_card & full_card. Return: json data ...
[ "Calling", "the", "Match", "API", ".", "Arg", ":", "match_key", ":", "key", "of", "the", "match", "card_type", ":", "optional", "default", "to", "full_card", ".", "Accepted", "values", "are", "micro_card", "summary_card", "&", "full_card", ".", "Return", ":"...
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L171-L187
[ "def", "get_match", "(", "self", ",", "match_key", ",", "card_type", "=", "\"full_card\"", ")", ":", "match_url", "=", "self", ".", "api_path", "+", "\"match/\"", "+", "match_key", "+", "\"/\"", "params", "=", "{", "}", "params", "[", "\"card_type\"", "]",...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_recent_matches
Calling the Recent Matches API. Arg: card_type: optional, default to micro_card. Accepted values are micro_card & summary_card. Return: json data
src/pycricket.py
def get_recent_matches(self, card_type="micro_card"): """ Calling the Recent Matches API. Arg: card_type: optional, default to micro_card. Accepted values are micro_card & summary_card. Return: json data """ recent_matches_url = self.api...
def get_recent_matches(self, card_type="micro_card"): """ Calling the Recent Matches API. Arg: card_type: optional, default to micro_card. Accepted values are micro_card & summary_card. Return: json data """ recent_matches_url = self.api...
[ "Calling", "the", "Recent", "Matches", "API", "." ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L189-L204
[ "def", "get_recent_matches", "(", "self", ",", "card_type", "=", "\"micro_card\"", ")", ":", "recent_matches_url", "=", "self", ".", "api_path", "+", "\"recent_matches/\"", "params", "=", "{", "}", "params", "[", "\"card_type\"", "]", "=", "card_type", "response...
fa47fe2e92915fc58db38898213e974742af55d4
train
RcaApp.get_player_stats
Calling the Player Stats API Args: player_key: Key of the player board_key: key of the board Return: json data
src/pycricket.py
def get_player_stats(self, player_key, board_key): """ Calling the Player Stats API Args: player_key: Key of the player board_key: key of the board Return: json data """ player_stats_url = self.api_path + 'player/' + player_key + '/leag...
def get_player_stats(self, player_key, board_key): """ Calling the Player Stats API Args: player_key: Key of the player board_key: key of the board Return: json data """ player_stats_url = self.api_path + 'player/' + player_key + '/leag...
[ "Calling", "the", "Player", "Stats", "API", "Args", ":", "player_key", ":", "Key", "of", "the", "player", "board_key", ":", "key", "of", "the", "board", "Return", ":", "json", "data" ]
roanuz/py-cricket
python
https://github.com/roanuz/py-cricket/blob/fa47fe2e92915fc58db38898213e974742af55d4/src/pycricket.py#L206-L217
[ "def", "get_player_stats", "(", "self", ",", "player_key", ",", "board_key", ")", ":", "player_stats_url", "=", "self", ".", "api_path", "+", "'player/'", "+", "player_key", "+", "'/league/'", "+", "board_key", "+", "'/stats/'", "response", "=", "self", ".", ...
fa47fe2e92915fc58db38898213e974742af55d4