repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.i2c_master_write_read
def i2c_master_write_read(self, i2c_address, data, length): """Make an I2C write/read access. First an I2C write access is issued. No stop condition will be generated. Instead the read access begins with a repeated start. This method is useful for accessing most addressable I2C devices...
python
def i2c_master_write_read(self, i2c_address, data, length): """Make an I2C write/read access. First an I2C write access is issued. No stop condition will be generated. Instead the read access begins with a repeated start. This method is useful for accessing most addressable I2C devices...
[ "def", "i2c_master_write_read", "(", "self", ",", "i2c_address", ",", "data", ",", "length", ")", ":", "self", ".", "i2c_master_write", "(", "i2c_address", ",", "data", ",", "I2C_NO_STOP", ")", "return", "self", ".", "i2c_master_read", "(", "i2c_address", ",",...
Make an I2C write/read access. First an I2C write access is issued. No stop condition will be generated. Instead the read access begins with a repeated start. This method is useful for accessing most addressable I2C devices like EEPROMs, port expander, etc. Basically, this is ...
[ "Make", "an", "I2C", "write", "/", "read", "access", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L437-L451
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.poll
def poll(self, timeout=None): """Wait for an event to occur. If `timeout` is given, if specifies the length of time in milliseconds which the function will wait for events before returing. If `timeout` is omitted, negative or None, the call will block until there is an event. ...
python
def poll(self, timeout=None): """Wait for an event to occur. If `timeout` is given, if specifies the length of time in milliseconds which the function will wait for events before returing. If `timeout` is omitted, negative or None, the call will block until there is an event. ...
[ "def", "poll", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "-", "1", "ret", "=", "api", ".", "py_aa_async_poll", "(", "self", ".", "handle", ",", "timeout", ")", "_raise_error_if_negative", "(...
Wait for an event to occur. If `timeout` is given, if specifies the length of time in milliseconds which the function will wait for events before returing. If `timeout` is omitted, negative or None, the call will block until there is an event. Returns a list of events. In case ...
[ "Wait", "for", "an", "event", "to", "occur", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L453-L475
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.enable_i2c_slave
def enable_i2c_slave(self, slave_address): """Enable I2C slave mode. The device will respond to the specified slave_address if it is addressed. You can wait for the data with :func:`poll` and get it with `i2c_slave_read`. """ ret = api.py_aa_i2c_slave_enable(sel...
python
def enable_i2c_slave(self, slave_address): """Enable I2C slave mode. The device will respond to the specified slave_address if it is addressed. You can wait for the data with :func:`poll` and get it with `i2c_slave_read`. """ ret = api.py_aa_i2c_slave_enable(sel...
[ "def", "enable_i2c_slave", "(", "self", ",", "slave_address", ")", ":", "ret", "=", "api", ".", "py_aa_i2c_slave_enable", "(", "self", ".", "handle", ",", "slave_address", ",", "self", ".", "BUFFER_SIZE", ",", "self", ".", "BUFFER_SIZE", ")", "_raise_error_if_...
Enable I2C slave mode. The device will respond to the specified slave_address if it is addressed. You can wait for the data with :func:`poll` and get it with `i2c_slave_read`.
[ "Enable", "I2C", "slave", "mode", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L477-L488
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.i2c_slave_read
def i2c_slave_read(self): """Read the bytes from an I2C slave reception. The bytes are returned as a string object. """ data = array.array('B', (0,) * self.BUFFER_SIZE) status, addr, rx_len = api.py_aa_i2c_slave_read_ext(self.handle, self.BUFFER_SIZE, data) ...
python
def i2c_slave_read(self): """Read the bytes from an I2C slave reception. The bytes are returned as a string object. """ data = array.array('B', (0,) * self.BUFFER_SIZE) status, addr, rx_len = api.py_aa_i2c_slave_read_ext(self.handle, self.BUFFER_SIZE, data) ...
[ "def", "i2c_slave_read", "(", "self", ")", ":", "data", "=", "array", ".", "array", "(", "'B'", ",", "(", "0", ",", ")", "*", "self", ".", "BUFFER_SIZE", ")", "status", ",", "addr", ",", "rx_len", "=", "api", ".", "py_aa_i2c_slave_read_ext", "(", "se...
Read the bytes from an I2C slave reception. The bytes are returned as a string object.
[ "Read", "the", "bytes", "from", "an", "I2C", "slave", "reception", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L495-L509
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.i2c_slave_last_transmit_size
def i2c_slave_last_transmit_size(self): """Returns the number of bytes transmitted by the slave.""" ret = api.py_aa_i2c_slave_write_stats(self.handle) _raise_error_if_negative(ret) return ret
python
def i2c_slave_last_transmit_size(self): """Returns the number of bytes transmitted by the slave.""" ret = api.py_aa_i2c_slave_write_stats(self.handle) _raise_error_if_negative(ret) return ret
[ "def", "i2c_slave_last_transmit_size", "(", "self", ")", ":", "ret", "=", "api", ".", "py_aa_i2c_slave_write_stats", "(", "self", ".", "handle", ")", "_raise_error_if_negative", "(", "ret", ")", "return", "ret" ]
Returns the number of bytes transmitted by the slave.
[ "Returns", "the", "number", "of", "bytes", "transmitted", "by", "the", "slave", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L533-L537
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.i2c_monitor_read
def i2c_monitor_read(self): """Retrieved any data fetched by the monitor. This function has an integrated timeout mechanism. You should use :func:`poll` to determine if there is any data available. Returns a list of data bytes and special symbols. There are three special symbol...
python
def i2c_monitor_read(self): """Retrieved any data fetched by the monitor. This function has an integrated timeout mechanism. You should use :func:`poll` to determine if there is any data available. Returns a list of data bytes and special symbols. There are three special symbol...
[ "def", "i2c_monitor_read", "(", "self", ")", ":", "data", "=", "array", ".", "array", "(", "'H'", ",", "(", "0", ",", ")", "*", "self", ".", "BUFFER_SIZE", ")", "ret", "=", "api", ".", "py_aa_i2c_monitor_read", "(", "self", ".", "handle", ",", "self"...
Retrieved any data fetched by the monitor. This function has an integrated timeout mechanism. You should use :func:`poll` to determine if there is any data available. Returns a list of data bytes and special symbols. There are three special symbols: `I2C_MONITOR_NACK`, I2C_MONITOR_STAR...
[ "Retrieved", "any", "data", "fetched", "by", "the", "monitor", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L559-L575
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.spi_bitrate
def spi_bitrate(self): """SPI bitrate in kHz. Not every bitrate is supported by the host adapter. Therefore, the actual bitrate may be less than the value which is set. The slowest bitrate supported is 125kHz. Any smaller value will be rounded up to 125kHz. The power-on default ...
python
def spi_bitrate(self): """SPI bitrate in kHz. Not every bitrate is supported by the host adapter. Therefore, the actual bitrate may be less than the value which is set. The slowest bitrate supported is 125kHz. Any smaller value will be rounded up to 125kHz. The power-on default ...
[ "def", "spi_bitrate", "(", "self", ")", ":", "ret", "=", "api", ".", "py_aa_spi_bitrate", "(", "self", ".", "handle", ",", "0", ")", "_raise_error_if_negative", "(", "ret", ")", "return", "ret" ]
SPI bitrate in kHz. Not every bitrate is supported by the host adapter. Therefore, the actual bitrate may be less than the value which is set. The slowest bitrate supported is 125kHz. Any smaller value will be rounded up to 125kHz. The power-on default value is 1000 kHz.
[ "SPI", "bitrate", "in", "kHz", ".", "Not", "every", "bitrate", "is", "supported", "by", "the", "host", "adapter", ".", "Therefore", "the", "actual", "bitrate", "may", "be", "less", "than", "the", "value", "which", "is", "set", ".", "The", "slowest", "bit...
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L578-L588
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.spi_configure
def spi_configure(self, polarity, phase, bitorder): """Configure the SPI interface.""" ret = api.py_aa_spi_configure(self.handle, polarity, phase, bitorder) _raise_error_if_negative(ret)
python
def spi_configure(self, polarity, phase, bitorder): """Configure the SPI interface.""" ret = api.py_aa_spi_configure(self.handle, polarity, phase, bitorder) _raise_error_if_negative(ret)
[ "def", "spi_configure", "(", "self", ",", "polarity", ",", "phase", ",", "bitorder", ")", ":", "ret", "=", "api", ".", "py_aa_spi_configure", "(", "self", ".", "handle", ",", "polarity", ",", "phase", ",", "bitorder", ")", "_raise_error_if_negative", "(", ...
Configure the SPI interface.
[ "Configure", "the", "SPI", "interface", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L595-L598
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.spi_configure_mode
def spi_configure_mode(self, spi_mode): """Configure the SPI interface by the well known SPI modes.""" if spi_mode == SPI_MODE_0: self.spi_configure(SPI_POL_RISING_FALLING, SPI_PHASE_SAMPLE_SETUP, SPI_BITORDER_MSB) elif spi_mode == SPI_MODE_3: self.spi...
python
def spi_configure_mode(self, spi_mode): """Configure the SPI interface by the well known SPI modes.""" if spi_mode == SPI_MODE_0: self.spi_configure(SPI_POL_RISING_FALLING, SPI_PHASE_SAMPLE_SETUP, SPI_BITORDER_MSB) elif spi_mode == SPI_MODE_3: self.spi...
[ "def", "spi_configure_mode", "(", "self", ",", "spi_mode", ")", ":", "if", "spi_mode", "==", "SPI_MODE_0", ":", "self", ".", "spi_configure", "(", "SPI_POL_RISING_FALLING", ",", "SPI_PHASE_SAMPLE_SETUP", ",", "SPI_BITORDER_MSB", ")", "elif", "spi_mode", "==", "SPI...
Configure the SPI interface by the well known SPI modes.
[ "Configure", "the", "SPI", "interface", "by", "the", "well", "known", "SPI", "modes", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L600-L609
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.spi_write
def spi_write(self, data): """Write a stream of bytes to a SPI device.""" data_out = array.array('B', data) data_in = array.array('B', (0,) * len(data_out)) ret = api.py_aa_spi_write(self.handle, len(data_out), data_out, len(data_in), data_in) _raise_error_if_nega...
python
def spi_write(self, data): """Write a stream of bytes to a SPI device.""" data_out = array.array('B', data) data_in = array.array('B', (0,) * len(data_out)) ret = api.py_aa_spi_write(self.handle, len(data_out), data_out, len(data_in), data_in) _raise_error_if_nega...
[ "def", "spi_write", "(", "self", ",", "data", ")", ":", "data_out", "=", "array", ".", "array", "(", "'B'", ",", "data", ")", "data_in", "=", "array", ".", "array", "(", "'B'", ",", "(", "0", ",", ")", "*", "len", "(", "data_out", ")", ")", "re...
Write a stream of bytes to a SPI device.
[ "Write", "a", "stream", "of", "bytes", "to", "a", "SPI", "device", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L611-L618
kontron/python-aardvark
pyaardvark/aardvark.py
Aardvark.spi_ss_polarity
def spi_ss_polarity(self, polarity): """Change the ouput polarity on the SS line. Please note, that this only affects the master functions. """ ret = api.py_aa_spi_master_ss_polarity(self.handle, polarity) _raise_error_if_negative(ret)
python
def spi_ss_polarity(self, polarity): """Change the ouput polarity on the SS line. Please note, that this only affects the master functions. """ ret = api.py_aa_spi_master_ss_polarity(self.handle, polarity) _raise_error_if_negative(ret)
[ "def", "spi_ss_polarity", "(", "self", ",", "polarity", ")", ":", "ret", "=", "api", ".", "py_aa_spi_master_ss_polarity", "(", "self", ".", "handle", ",", "polarity", ")", "_raise_error_if_negative", "(", "ret", ")" ]
Change the ouput polarity on the SS line. Please note, that this only affects the master functions.
[ "Change", "the", "ouput", "polarity", "on", "the", "SS", "line", "." ]
train
https://github.com/kontron/python-aardvark/blob/9827f669fbdc5bceb98e7d08a294b4e4e455d0d5/pyaardvark/aardvark.py#L620-L626
inveniosoftware/invenio-oaiserver
invenio_oaiserver/admin.py
OAISetModelView.edit_form
def edit_form(self, obj): """Customize edit form.""" form = super(OAISetModelView, self).edit_form(obj) del form.spec return form
python
def edit_form(self, obj): """Customize edit form.""" form = super(OAISetModelView, self).edit_form(obj) del form.spec return form
[ "def", "edit_form", "(", "self", ",", "obj", ")", ":", "form", "=", "super", "(", "OAISetModelView", ",", "self", ")", ".", "edit_form", "(", "obj", ")", "del", "form", ".", "spec", "return", "form" ]
Customize edit form.
[ "Customize", "edit", "form", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/admin.py#L36-L40
sailthru/sailthru-python-client
sailthru/sailthru_http.py
flatten_nested_hash
def flatten_nested_hash(hash_table): """ Flatten nested dictionary for GET / POST / DELETE API request """ def flatten(hash_table, brackets=True): f = {} for key, value in hash_table.items(): _key = '[' + str(key) + ']' if brackets else str(key) if isinstance(valu...
python
def flatten_nested_hash(hash_table): """ Flatten nested dictionary for GET / POST / DELETE API request """ def flatten(hash_table, brackets=True): f = {} for key, value in hash_table.items(): _key = '[' + str(key) + ']' if brackets else str(key) if isinstance(valu...
[ "def", "flatten_nested_hash", "(", "hash_table", ")", ":", "def", "flatten", "(", "hash_table", ",", "brackets", "=", "True", ")", ":", "f", "=", "{", "}", "for", "key", ",", "value", "in", "hash_table", ".", "items", "(", ")", ":", "_key", "=", "'['...
Flatten nested dictionary for GET / POST / DELETE API request
[ "Flatten", "nested", "dictionary", "for", "GET", "/", "POST", "/", "DELETE", "API", "request" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_http.py#L8-L28
sailthru/sailthru-python-client
sailthru/sailthru_http.py
sailthru_http_request
def sailthru_http_request(url, data, method, file_data=None, headers=None, request_timeout=10): """ Perform an HTTP GET / POST / DELETE request """ data = flatten_nested_hash(data) method = method.upper() params, data = (None, data) if method == 'POST' else (data, None) sailthru_headers = {'...
python
def sailthru_http_request(url, data, method, file_data=None, headers=None, request_timeout=10): """ Perform an HTTP GET / POST / DELETE request """ data = flatten_nested_hash(data) method = method.upper() params, data = (None, data) if method == 'POST' else (data, None) sailthru_headers = {'...
[ "def", "sailthru_http_request", "(", "url", ",", "data", ",", "method", ",", "file_data", "=", "None", ",", "headers", "=", "None", ",", "request_timeout", "=", "10", ")", ":", "data", "=", "flatten_nested_hash", "(", "data", ")", "method", "=", "method", ...
Perform an HTTP GET / POST / DELETE request
[ "Perform", "an", "HTTP", "GET", "/", "POST", "/", "DELETE", "request" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_http.py#L30-L49
inveniosoftware/invenio-oaiserver
invenio_oaiserver/resumption_token.py
_schema_from_verb
def _schema_from_verb(verb, partial=False): """Return an instance of schema for given verb.""" from .verbs import Verbs return getattr(Verbs, verb)(partial=partial)
python
def _schema_from_verb(verb, partial=False): """Return an instance of schema for given verb.""" from .verbs import Verbs return getattr(Verbs, verb)(partial=partial)
[ "def", "_schema_from_verb", "(", "verb", ",", "partial", "=", "False", ")", ":", "from", ".", "verbs", "import", "Verbs", "return", "getattr", "(", "Verbs", ",", "verb", ")", "(", "partial", "=", "partial", ")" ]
Return an instance of schema for given verb.
[ "Return", "an", "instance", "of", "schema", "for", "given", "verb", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/resumption_token.py#L18-L21
inveniosoftware/invenio-oaiserver
invenio_oaiserver/resumption_token.py
serialize
def serialize(pagination, **kwargs): """Return resumption token serializer.""" if not pagination.has_next: return token_builder = URLSafeTimedSerializer( current_app.config['SECRET_KEY'], salt=kwargs['verb'], ) schema = _schema_from_verb(kwargs['verb'], partial=False) da...
python
def serialize(pagination, **kwargs): """Return resumption token serializer.""" if not pagination.has_next: return token_builder = URLSafeTimedSerializer( current_app.config['SECRET_KEY'], salt=kwargs['verb'], ) schema = _schema_from_verb(kwargs['verb'], partial=False) da...
[ "def", "serialize", "(", "pagination", ",", "*", "*", "kwargs", ")", ":", "if", "not", "pagination", ".", "has_next", ":", "return", "token_builder", "=", "URLSafeTimedSerializer", "(", "current_app", ".", "config", "[", "'SECRET_KEY'", "]", ",", "salt", "="...
Return resumption token serializer.
[ "Return", "resumption", "token", "serializer", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/resumption_token.py#L24-L40
inveniosoftware/invenio-oaiserver
invenio_oaiserver/resumption_token.py
ResumptionToken._deserialize
def _deserialize(self, value, attr, data): """Serialize resumption token.""" token_builder = URLSafeTimedSerializer( current_app.config['SECRET_KEY'], salt=data['verb'], ) result = token_builder.loads(value, max_age=current_app.config[ 'OAISERVER_RESUM...
python
def _deserialize(self, value, attr, data): """Serialize resumption token.""" token_builder = URLSafeTimedSerializer( current_app.config['SECRET_KEY'], salt=data['verb'], ) result = token_builder.loads(value, max_age=current_app.config[ 'OAISERVER_RESUM...
[ "def", "_deserialize", "(", "self", ",", "value", ",", "attr", ",", "data", ")", ":", "token_builder", "=", "URLSafeTimedSerializer", "(", "current_app", ".", "config", "[", "'SECRET_KEY'", "]", ",", "salt", "=", "data", "[", "'verb'", "]", ",", ")", "re...
Serialize resumption token.
[ "Serialize", "resumption", "token", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/resumption_token.py#L46-L56
inveniosoftware/invenio-oaiserver
invenio_oaiserver/resumption_token.py
ResumptionTokenSchema.load
def load(self, data, many=None, partial=None): """Deserialize a data structure to an object.""" result = super(ResumptionTokenSchema, self).load( data, many=many, partial=partial ) result.data.update( result.data.get('resumptionToken', {}).get('kwargs', {}) ...
python
def load(self, data, many=None, partial=None): """Deserialize a data structure to an object.""" result = super(ResumptionTokenSchema, self).load( data, many=many, partial=partial ) result.data.update( result.data.get('resumptionToken', {}).get('kwargs', {}) ...
[ "def", "load", "(", "self", ",", "data", ",", "many", "=", "None", ",", "partial", "=", "None", ")", ":", "result", "=", "super", "(", "ResumptionTokenSchema", ",", "self", ")", ".", "load", "(", "data", ",", "many", "=", "many", ",", "partial", "=...
Deserialize a data structure to an object.
[ "Deserialize", "a", "data", "structure", "to", "an", "object", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/resumption_token.py#L64-L72
inveniosoftware/invenio-oaiserver
invenio_oaiserver/verbs.py
make_request_validator
def make_request_validator(request): """Validate arguments in incomming request.""" verb = request.values.get('verb', '', type=str) resumption_token = request.values.get('resumptionToken', None) schema = Verbs if resumption_token is None else ResumptionVerbs return getattr(schema, verb, OAISchema)(...
python
def make_request_validator(request): """Validate arguments in incomming request.""" verb = request.values.get('verb', '', type=str) resumption_token = request.values.get('resumptionToken', None) schema = Verbs if resumption_token is None else ResumptionVerbs return getattr(schema, verb, OAISchema)(...
[ "def", "make_request_validator", "(", "request", ")", ":", "verb", "=", "request", ".", "values", ".", "get", "(", "'verb'", ",", "''", ",", "type", "=", "str", ")", "resumption_token", "=", "request", ".", "values", ".", "get", "(", "'resumptionToken'", ...
Validate arguments in incomming request.
[ "Validate", "arguments", "in", "incomming", "request", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/verbs.py#L152-L158
inveniosoftware/invenio-oaiserver
invenio_oaiserver/verbs.py
DateTime.from_iso_permissive
def from_iso_permissive(datestring, use_dateutil=True): """Parse an ISO8601-formatted datetime and return a datetime object. Inspired by the marshmallow.utils.from_iso function, but also accepts datestrings that don't contain the time. """ dateutil_available = False try:...
python
def from_iso_permissive(datestring, use_dateutil=True): """Parse an ISO8601-formatted datetime and return a datetime object. Inspired by the marshmallow.utils.from_iso function, but also accepts datestrings that don't contain the time. """ dateutil_available = False try:...
[ "def", "from_iso_permissive", "(", "datestring", ",", "use_dateutil", "=", "True", ")", ":", "dateutil_available", "=", "False", "try", ":", "from", "dateutil", "import", "parser", "dateutil_available", "=", "True", "except", "ImportError", ":", "dateutil_available"...
Parse an ISO8601-formatted datetime and return a datetime object. Inspired by the marshmallow.utils.from_iso function, but also accepts datestrings that don't contain the time.
[ "Parse", "an", "ISO8601", "-", "formatted", "datetime", "and", "return", "a", "datetime", "object", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/verbs.py#L36-L56
inveniosoftware/invenio-oaiserver
invenio_oaiserver/verbs.py
OAISchema.validate
def validate(self, data): """Check range between dates under keys ``from_`` and ``until``.""" if 'verb' in data and data['verb'] != self.__class__.__name__: raise ValidationError( # FIXME encode data 'This is not a valid OAI-PMH verb:{0}'.format(data['verb']),...
python
def validate(self, data): """Check range between dates under keys ``from_`` and ``until``.""" if 'verb' in data and data['verb'] != self.__class__.__name__: raise ValidationError( # FIXME encode data 'This is not a valid OAI-PMH verb:{0}'.format(data['verb']),...
[ "def", "validate", "(", "self", ",", "data", ")", ":", "if", "'verb'", "in", "data", "and", "data", "[", "'verb'", "]", "!=", "self", ".", "__class__", ".", "__name__", ":", "raise", "ValidationError", "(", "# FIXME encode data", "'This is not a valid OAI-PMH ...
Check range between dates under keys ``from_`` and ``until``.
[ "Check", "range", "between", "dates", "under", "keys", "from_", "and", "until", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/verbs.py#L75-L92
inveniosoftware/invenio-oaiserver
invenio_oaiserver/alembic/e655021de0de_create_oiaserver_tables.py
upgrade
def upgrade(): """Upgrade database.""" op.create_table( 'oaiserver_set', sa.Column('created', sa.DateTime(), nullable=False), sa.Column('updated', sa.DateTime(), nullable=False), sa.Column('id', sa.Integer(), nullable=False), sa.Column('spec', sa.String(length=255), nulla...
python
def upgrade(): """Upgrade database.""" op.create_table( 'oaiserver_set', sa.Column('created', sa.DateTime(), nullable=False), sa.Column('updated', sa.DateTime(), nullable=False), sa.Column('id', sa.Integer(), nullable=False), sa.Column('spec', sa.String(length=255), nulla...
[ "def", "upgrade", "(", ")", ":", "op", ".", "create_table", "(", "'oaiserver_set'", ",", "sa", ".", "Column", "(", "'created'", ",", "sa", ".", "DateTime", "(", ")", ",", "nullable", "=", "False", ")", ",", "sa", ".", "Column", "(", "'updated'", ",",...
Upgrade database.
[ "Upgrade", "database", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/alembic/e655021de0de_create_oiaserver_tables.py#L21-L40
inveniosoftware/invenio-oaiserver
invenio_oaiserver/ext.py
_AppState.sets
def sets(self): """Get list of sets.""" if self.cache: return self.cache.get( self.app.config['OAISERVER_CACHE_KEY'])
python
def sets(self): """Get list of sets.""" if self.cache: return self.cache.get( self.app.config['OAISERVER_CACHE_KEY'])
[ "def", "sets", "(", "self", ")", ":", "if", "self", ".", "cache", ":", "return", "self", ".", "cache", ".", "get", "(", "self", ".", "app", ".", "config", "[", "'OAISERVER_CACHE_KEY'", "]", ")" ]
Get list of sets.
[ "Get", "list", "of", "sets", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/ext.py#L33-L37
inveniosoftware/invenio-oaiserver
invenio_oaiserver/ext.py
_AppState.sets
def sets(self, values): """Set list of sets.""" # if cache server is configured, save sets list if self.cache: self.cache.set(self.app.config['OAISERVER_CACHE_KEY'], values)
python
def sets(self, values): """Set list of sets.""" # if cache server is configured, save sets list if self.cache: self.cache.set(self.app.config['OAISERVER_CACHE_KEY'], values)
[ "def", "sets", "(", "self", ",", "values", ")", ":", "# if cache server is configured, save sets list", "if", "self", ".", "cache", ":", "self", ".", "cache", ".", "set", "(", "self", ".", "app", ".", "config", "[", "'OAISERVER_CACHE_KEY'", "]", ",", "values...
Set list of sets.
[ "Set", "list", "of", "sets", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/ext.py#L40-L44
inveniosoftware/invenio-oaiserver
invenio_oaiserver/ext.py
_AppState.register_signals
def register_signals(self): """Register signals.""" from .receivers import OAIServerUpdater # Register Record signals to update OAI informations self.update_function = OAIServerUpdater() records_signals.before_record_insert.connect(self.update_function, ...
python
def register_signals(self): """Register signals.""" from .receivers import OAIServerUpdater # Register Record signals to update OAI informations self.update_function = OAIServerUpdater() records_signals.before_record_insert.connect(self.update_function, ...
[ "def", "register_signals", "(", "self", ")", ":", "from", ".", "receivers", "import", "OAIServerUpdater", "# Register Record signals to update OAI informations", "self", ".", "update_function", "=", "OAIServerUpdater", "(", ")", "records_signals", ".", "before_record_insert...
Register signals.
[ "Register", "signals", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/ext.py#L46-L56
inveniosoftware/invenio-oaiserver
invenio_oaiserver/ext.py
_AppState.register_signals_oaiset
def register_signals_oaiset(self): """Register OAISet signals to update records.""" from .models import OAISet from .receivers import after_insert_oai_set, \ after_update_oai_set, after_delete_oai_set listen(OAISet, 'after_insert', after_insert_oai_set) listen(OAISet,...
python
def register_signals_oaiset(self): """Register OAISet signals to update records.""" from .models import OAISet from .receivers import after_insert_oai_set, \ after_update_oai_set, after_delete_oai_set listen(OAISet, 'after_insert', after_insert_oai_set) listen(OAISet,...
[ "def", "register_signals_oaiset", "(", "self", ")", ":", "from", ".", "models", "import", "OAISet", "from", ".", "receivers", "import", "after_insert_oai_set", ",", "after_update_oai_set", ",", "after_delete_oai_set", "listen", "(", "OAISet", ",", "'after_insert'", ...
Register OAISet signals to update records.
[ "Register", "OAISet", "signals", "to", "update", "records", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/ext.py#L58-L65
inveniosoftware/invenio-oaiserver
invenio_oaiserver/ext.py
_AppState.unregister_signals
def unregister_signals(self): """Unregister signals.""" # Unregister Record signals if hasattr(self, 'update_function'): records_signals.before_record_insert.disconnect( self.update_function) records_signals.before_record_update.disconnect( ...
python
def unregister_signals(self): """Unregister signals.""" # Unregister Record signals if hasattr(self, 'update_function'): records_signals.before_record_insert.disconnect( self.update_function) records_signals.before_record_update.disconnect( ...
[ "def", "unregister_signals", "(", "self", ")", ":", "# Unregister Record signals", "if", "hasattr", "(", "self", ",", "'update_function'", ")", ":", "records_signals", ".", "before_record_insert", ".", "disconnect", "(", "self", ".", "update_function", ")", "records...
Unregister signals.
[ "Unregister", "signals", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/ext.py#L67-L75
inveniosoftware/invenio-oaiserver
invenio_oaiserver/ext.py
_AppState.unregister_signals_oaiset
def unregister_signals_oaiset(self): """Unregister signals oaiset.""" from .models import OAISet from .receivers import after_insert_oai_set, \ after_update_oai_set, after_delete_oai_set if contains(OAISet, 'after_insert', after_insert_oai_set): remove(OAISet, 'af...
python
def unregister_signals_oaiset(self): """Unregister signals oaiset.""" from .models import OAISet from .receivers import after_insert_oai_set, \ after_update_oai_set, after_delete_oai_set if contains(OAISet, 'after_insert', after_insert_oai_set): remove(OAISet, 'af...
[ "def", "unregister_signals_oaiset", "(", "self", ")", ":", "from", ".", "models", "import", "OAISet", "from", ".", "receivers", "import", "after_insert_oai_set", ",", "after_update_oai_set", ",", "after_delete_oai_set", "if", "contains", "(", "OAISet", ",", "'after_...
Unregister signals oaiset.
[ "Unregister", "signals", "oaiset", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/ext.py#L77-L85
inveniosoftware/invenio-oaiserver
invenio_oaiserver/ext.py
InvenioOAIServer.init_config
def init_config(self, app): """Initialize configuration. :param app: An instance of :class:`flask.Flask`. """ app.config.setdefault( 'OAISERVER_BASE_TEMPLATE', app.config.get('BASE_TEMPLATE', 'invenio_oaiserver/base.html')) app...
python
def init_config(self, app): """Initialize configuration. :param app: An instance of :class:`flask.Flask`. """ app.config.setdefault( 'OAISERVER_BASE_TEMPLATE', app.config.get('BASE_TEMPLATE', 'invenio_oaiserver/base.html')) app...
[ "def", "init_config", "(", "self", ",", "app", ")", ":", "app", ".", "config", ".", "setdefault", "(", "'OAISERVER_BASE_TEMPLATE'", ",", "app", ".", "config", ".", "get", "(", "'BASE_TEMPLATE'", ",", "'invenio_oaiserver/base.html'", ")", ")", "app", ".", "co...
Initialize configuration. :param app: An instance of :class:`flask.Flask`.
[ "Initialize", "configuration", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/ext.py#L108-L138
sailthru/sailthru-python-client
sailthru/sailthru_client.py
extract_params
def extract_params(params): """ Extracts the values of a set of parameters, recursing into nested dictionaries. """ values = [] if isinstance(params, dict): for key, value in params.items(): values.extend(extract_params(value)) elif isinstance(params, list): for value...
python
def extract_params(params): """ Extracts the values of a set of parameters, recursing into nested dictionaries. """ values = [] if isinstance(params, dict): for key, value in params.items(): values.extend(extract_params(value)) elif isinstance(params, list): for value...
[ "def", "extract_params", "(", "params", ")", ":", "values", "=", "[", "]", "if", "isinstance", "(", "params", ",", "dict", ")", ":", "for", "key", ",", "value", "in", "params", ".", "items", "(", ")", ":", "values", ".", "extend", "(", "extract_param...
Extracts the values of a set of parameters, recursing into nested dictionaries.
[ "Extracts", "the", "values", "of", "a", "set", "of", "parameters", "recursing", "into", "nested", "dictionaries", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L11-L24
sailthru/sailthru-python-client
sailthru/sailthru_client.py
get_signature_string
def get_signature_string(params, secret): """ Returns the unhashed signature string (secret + sorted list of param values) for an API call. @param params: dictionary values to generate signature string @param secret: secret string """ str_list = [str(item) for item in extract_params(params)] ...
python
def get_signature_string(params, secret): """ Returns the unhashed signature string (secret + sorted list of param values) for an API call. @param params: dictionary values to generate signature string @param secret: secret string """ str_list = [str(item) for item in extract_params(params)] ...
[ "def", "get_signature_string", "(", "params", ",", "secret", ")", ":", "str_list", "=", "[", "str", "(", "item", ")", "for", "item", "in", "extract_params", "(", "params", ")", "]", "str_list", ".", "sort", "(", ")", "return", "(", "secret", "+", "''",...
Returns the unhashed signature string (secret + sorted list of param values) for an API call. @param params: dictionary values to generate signature string @param secret: secret string
[ "Returns", "the", "unhashed", "signature", "string", "(", "secret", "+", "sorted", "list", "of", "param", "values", ")", "for", "an", "API", "call", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L26-L34
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.send
def send(self, template, email, _vars=None, options=None, schedule_time=None, limit=None): """ Remotely send an email template to a single email address. http://docs.sailthru.com/api/send @param template: template string @param email: Email value @param _vars: a key/value...
python
def send(self, template, email, _vars=None, options=None, schedule_time=None, limit=None): """ Remotely send an email template to a single email address. http://docs.sailthru.com/api/send @param template: template string @param email: Email value @param _vars: a key/value...
[ "def", "send", "(", "self", ",", "template", ",", "email", ",", "_vars", "=", "None", ",", "options", "=", "None", ",", "schedule_time", "=", "None", ",", "limit", "=", "None", ")", ":", "_vars", "=", "_vars", "or", "{", "}", "options", "=", "optio...
Remotely send an email template to a single email address. http://docs.sailthru.com/api/send @param template: template string @param email: Email value @param _vars: a key/value hash of the replacement vars to use in the send. Each var may be referenced as {varname} within the template i...
[ "Remotely", "send", "an", "email", "template", "to", "a", "single", "email", "address", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "send" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L65-L86
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.multi_send
def multi_send(self, template, emails, _vars=None, evars=None, schedule_time=None, options=None): """ Remotely send an email template to multiple email addresses. http://docs.sailthru.com/api/send @param template: template string @param emails: List with email values or comma sep...
python
def multi_send(self, template, emails, _vars=None, evars=None, schedule_time=None, options=None): """ Remotely send an email template to multiple email addresses. http://docs.sailthru.com/api/send @param template: template string @param emails: List with email values or comma sep...
[ "def", "multi_send", "(", "self", ",", "template", ",", "emails", ",", "_vars", "=", "None", ",", "evars", "=", "None", ",", "schedule_time", "=", "None", ",", "options", "=", "None", ")", ":", "_vars", "=", "_vars", "or", "{", "}", "evars", "=", "...
Remotely send an email template to multiple email addresses. http://docs.sailthru.com/api/send @param template: template string @param emails: List with email values or comma separated email string @param _vars: a key/value hash of the replacement vars to use in the send. Each var may be...
[ "Remotely", "send", "an", "email", "template", "to", "multiple", "email", "addresses", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "send" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L88-L108
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.set_email
def set_email(self, email, _vars=None, lists=None, templates=None, verified=0, optout=None, send=None, send_vars=None): """ DEPRECATED! Update information about one of your users, including adding and removing the user from lists. http://docs.sailthru.com/api/email """ _v...
python
def set_email(self, email, _vars=None, lists=None, templates=None, verified=0, optout=None, send=None, send_vars=None): """ DEPRECATED! Update information about one of your users, including adding and removing the user from lists. http://docs.sailthru.com/api/email """ _v...
[ "def", "set_email", "(", "self", ",", "email", ",", "_vars", "=", "None", ",", "lists", "=", "None", ",", "templates", "=", "None", ",", "verified", "=", "0", ",", "optout", "=", "None", ",", "send", "=", "None", ",", "send_vars", "=", "None", ")",...
DEPRECATED! Update information about one of your users, including adding and removing the user from lists. http://docs.sailthru.com/api/email
[ "DEPRECATED!", "Update", "information", "about", "one", "of", "your", "users", "including", "adding", "and", "removing", "the", "user", "from", "lists", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "email" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L131-L152
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.get_user
def get_user(self, idvalue, options=None): """ get user by a given id http://getstarted.sailthru.com/api/user """ options = options or {} data = options.copy() data['id'] = idvalue return self.api_get('user', data)
python
def get_user(self, idvalue, options=None): """ get user by a given id http://getstarted.sailthru.com/api/user """ options = options or {} data = options.copy() data['id'] = idvalue return self.api_get('user', data)
[ "def", "get_user", "(", "self", ",", "idvalue", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "options", ".", "copy", "(", ")", "data", "[", "'id'", "]", "=", "idvalue", "return", "self", ".", "api_g...
get user by a given id http://getstarted.sailthru.com/api/user
[ "get", "user", "by", "a", "given", "id", "http", ":", "//", "getstarted", ".", "sailthru", ".", "com", "/", "api", "/", "user" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L154-L162
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.save_user
def save_user(self, idvalue, options=None): """ save user by a given id http://getstarted.sailthru.com/api/user """ options = options or {} data = options.copy() data['id'] = idvalue return self.api_post('user', data)
python
def save_user(self, idvalue, options=None): """ save user by a given id http://getstarted.sailthru.com/api/user """ options = options or {} data = options.copy() data['id'] = idvalue return self.api_post('user', data)
[ "def", "save_user", "(", "self", ",", "idvalue", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "options", ".", "copy", "(", ")", "data", "[", "'id'", "]", "=", "idvalue", "return", "self", ".", "api_...
save user by a given id http://getstarted.sailthru.com/api/user
[ "save", "user", "by", "a", "given", "id", "http", ":", "//", "getstarted", ".", "sailthru", ".", "com", "/", "api", "/", "user" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L164-L172
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.schedule_blast
def schedule_blast(self, name, list, schedule_time, from_name, from_email, subject, content_html, content_text, options=None): """ Schedule a mass mail blast http://docs.sailthru.com/api/blast @param name: name to give to this new blast @param list: mailing list name to send to ...
python
def schedule_blast(self, name, list, schedule_time, from_name, from_email, subject, content_html, content_text, options=None): """ Schedule a mass mail blast http://docs.sailthru.com/api/blast @param name: name to give to this new blast @param list: mailing list name to send to ...
[ "def", "schedule_blast", "(", "self", ",", "name", ",", "list", ",", "schedule_time", ",", "from_name", ",", "from_email", ",", "subject", ",", "content_html", ",", "content_text", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{"...
Schedule a mass mail blast http://docs.sailthru.com/api/blast @param name: name to give to this new blast @param list: mailing list name to send to @param schedule_time: when the blast should send. Dates in the past will be scheduled for immediate delivery. Any English textual datetime ...
[ "Schedule", "a", "mass", "mail", "blast", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "blast" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L174-L212
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.schedule_blast_from_template
def schedule_blast_from_template(self, template, list_name, schedule_time, options=None): """ Schedule a mass mail blast from template http://docs.sailthru.com/api/blast @param template: template to copy from @param list_name: list to send to @param schedule_time ...
python
def schedule_blast_from_template(self, template, list_name, schedule_time, options=None): """ Schedule a mass mail blast from template http://docs.sailthru.com/api/blast @param template: template to copy from @param list_name: list to send to @param schedule_time ...
[ "def", "schedule_blast_from_template", "(", "self", ",", "template", ",", "list_name", ",", "schedule_time", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "options", ".", "copy", "(", ")", "data", "[", "'c...
Schedule a mass mail blast from template http://docs.sailthru.com/api/blast @param template: template to copy from @param list_name: list to send to @param schedule_time @param options: additional optional params
[ "Schedule", "a", "mass", "mail", "blast", "from", "template", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "blast" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L214-L228
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.schedule_blast_from_blast
def schedule_blast_from_blast(self, blast_id, schedule_time, options=None): """ Schedule a mass mail blast from previous blast http://docs.sailthru.com/api/blast @param blast_id: blast_id to copy from @param schedule_time @param options: additional optional params ...
python
def schedule_blast_from_blast(self, blast_id, schedule_time, options=None): """ Schedule a mass mail blast from previous blast http://docs.sailthru.com/api/blast @param blast_id: blast_id to copy from @param schedule_time @param options: additional optional params ...
[ "def", "schedule_blast_from_blast", "(", "self", ",", "blast_id", ",", "schedule_time", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "options", ".", "copy", "(", ")", "data", "[", "'copy_blast'", "]", "="...
Schedule a mass mail blast from previous blast http://docs.sailthru.com/api/blast @param blast_id: blast_id to copy from @param schedule_time @param options: additional optional params
[ "Schedule", "a", "mass", "mail", "blast", "from", "previous", "blast", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "blast" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L230-L242
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.get_list
def get_list(self, list_name, options=None): """ Get detailed metadata information about a list. """ options = options or {} data = {'list': list_name} data.update(options) return self.api_get('list', data)
python
def get_list(self, list_name, options=None): """ Get detailed metadata information about a list. """ options = options or {} data = {'list': list_name} data.update(options) return self.api_get('list', data)
[ "def", "get_list", "(", "self", ",", "list_name", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "{", "'list'", ":", "list_name", "}", "data", ".", "update", "(", "options", ")", "return", "self", ".", ...
Get detailed metadata information about a list.
[ "Get", "detailed", "metadata", "information", "about", "a", "list", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L341-L348
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.save_list
def save_list(self, list_name, emails): """ Upload a list. The list import job is queued and will happen shortly after the API request. http://docs.sailthru.com/api/list @param list: list name @param emails: List of email values or comma separated string """ data ...
python
def save_list(self, list_name, emails): """ Upload a list. The list import job is queued and will happen shortly after the API request. http://docs.sailthru.com/api/list @param list: list name @param emails: List of email values or comma separated string """ data ...
[ "def", "save_list", "(", "self", ",", "list_name", ",", "emails", ")", ":", "data", "=", "{", "'list'", ":", "list_name", ",", "'emails'", ":", "','", ".", "join", "(", "emails", ")", "if", "isinstance", "(", "emails", ",", "list", ")", "else", "emai...
Upload a list. The list import job is queued and will happen shortly after the API request. http://docs.sailthru.com/api/list @param list: list name @param emails: List of email values or comma separated string
[ "Upload", "a", "list", ".", "The", "list", "import", "job", "is", "queued", "and", "will", "happen", "shortly", "after", "the", "API", "request", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "list" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L356-L365
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.import_contacts
def import_contacts(self, email, password, include_name=False): """ Fetch email contacts from a user's address book on one of the major email websites. Currently supports AOL, Gmail, Hotmail, and Yahoo! Mail. """ data = {'email': email, 'password': password} if in...
python
def import_contacts(self, email, password, include_name=False): """ Fetch email contacts from a user's address book on one of the major email websites. Currently supports AOL, Gmail, Hotmail, and Yahoo! Mail. """ data = {'email': email, 'password': password} if in...
[ "def", "import_contacts", "(", "self", ",", "email", ",", "password", ",", "include_name", "=", "False", ")", ":", "data", "=", "{", "'email'", ":", "email", ",", "'password'", ":", "password", "}", "if", "include_name", ":", "data", "[", "'names'", "]",...
Fetch email contacts from a user's address book on one of the major email websites. Currently supports AOL, Gmail, Hotmail, and Yahoo! Mail.
[ "Fetch", "email", "contacts", "from", "a", "user", "s", "address", "book", "on", "one", "of", "the", "major", "email", "websites", ".", "Currently", "supports", "AOL", "Gmail", "Hotmail", "and", "Yahoo!", "Mail", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L374-L382
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.push_content
def push_content(self, title, url, images=None, date=None, expire_date=None, description=None, location=None, price=None, tags=None, author=None, site_name=None, spider=None, vars=None): """ Push a ...
python
def push_content(self, title, url, images=None, date=None, expire_date=None, description=None, location=None, price=None, tags=None, author=None, site_name=None, spider=None, vars=None): """ Push a ...
[ "def", "push_content", "(", "self", ",", "title", ",", "url", ",", "images", "=", "None", ",", "date", "=", "None", ",", "expire_date", "=", "None", ",", "description", "=", "None", ",", "location", "=", "None", ",", "price", "=", "None", ",", "tags"...
Push a new piece of content to Sailthru. Expected names for the `images` argument's map are "full" and "thumb" Expected format for `location` should be [longitude,latitude] @param title: title string for the content @param url: URL string for the content @param images: map of i...
[ "Push", "a", "new", "piece", "of", "content", "to", "Sailthru", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L384-L437
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.save_alert
def save_alert(self, email, type, template, when=None, options=None): """ Add a new alert to a user. You can add either a realtime or a summary alert (daily/weekly). http://docs.sailthru.com/api/alert Usage: email = 'praj@sailthru.com' type = 'weekly' ...
python
def save_alert(self, email, type, template, when=None, options=None): """ Add a new alert to a user. You can add either a realtime or a summary alert (daily/weekly). http://docs.sailthru.com/api/alert Usage: email = 'praj@sailthru.com' type = 'weekly' ...
[ "def", "save_alert", "(", "self", ",", "email", ",", "type", ",", "template", ",", "when", "=", "None", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "options", ".", "copy", "(", ")", "data", "[", ...
Add a new alert to a user. You can add either a realtime or a summary alert (daily/weekly). http://docs.sailthru.com/api/alert Usage: email = 'praj@sailthru.com' type = 'weekly' template = 'default' when = '+5 hours' alert_options = {'match': ...
[ "Add", "a", "new", "alert", "to", "a", "user", ".", "You", "can", "add", "either", "a", "realtime", "or", "a", "summary", "alert", "(", "daily", "/", "weekly", ")", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "al...
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L445-L474
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.delete_alert
def delete_alert(self, email, alert_id): """ delete user alert """ data = {'email': email, 'alert_id': alert_id} return self.api_delete('alert', data)
python
def delete_alert(self, email, alert_id): """ delete user alert """ data = {'email': email, 'alert_id': alert_id} return self.api_delete('alert', data)
[ "def", "delete_alert", "(", "self", ",", "email", ",", "alert_id", ")", ":", "data", "=", "{", "'email'", ":", "email", ",", "'alert_id'", ":", "alert_id", "}", "return", "self", ".", "api_delete", "(", "'alert'", ",", "data", ")" ]
delete user alert
[ "delete", "user", "alert" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L476-L482
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.purchase
def purchase(self, email, items=None, incomplete=None, message_id=None, options=None, extid=None): """ Record that a user has made a purchase, or has added items to their purchase total. http://docs.sailthru.com/api/purchase @param email: Email string @param items: list of item d...
python
def purchase(self, email, items=None, incomplete=None, message_id=None, options=None, extid=None): """ Record that a user has made a purchase, or has added items to their purchase total. http://docs.sailthru.com/api/purchase @param email: Email string @param items: list of item d...
[ "def", "purchase", "(", "self", ",", "email", ",", "items", "=", "None", ",", "incomplete", "=", "None", ",", "message_id", "=", "None", ",", "options", "=", "None", ",", "extid", "=", "None", ")", ":", "items", "=", "items", "or", "{", "}", "optio...
Record that a user has made a purchase, or has added items to their purchase total. http://docs.sailthru.com/api/purchase @param email: Email string @param items: list of item dictionary with keys: id, title, price, qty, and url @param message_id: message_id string @param extid: ...
[ "Record", "that", "a", "user", "has", "made", "a", "purchase", "or", "has", "added", "items", "to", "their", "purchase", "total", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "purchase" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L484-L505
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.get_purchase
def get_purchase(self, purchase_id, purchase_key='sid'): """ Retrieve information about a purchase using the system's unique ID or a client's ID @param id_: a string that represents a unique_id or an extid. @param key: a string that is either 'sid' or 'extid'. """ data = ...
python
def get_purchase(self, purchase_id, purchase_key='sid'): """ Retrieve information about a purchase using the system's unique ID or a client's ID @param id_: a string that represents a unique_id or an extid. @param key: a string that is either 'sid' or 'extid'. """ data = ...
[ "def", "get_purchase", "(", "self", ",", "purchase_id", ",", "purchase_key", "=", "'sid'", ")", ":", "data", "=", "{", "'purchase_id'", ":", "purchase_id", ",", "'purchase_key'", ":", "purchase_key", "}", "return", "self", ".", "api_get", "(", "'purchase'", ...
Retrieve information about a purchase using the system's unique ID or a client's ID @param id_: a string that represents a unique_id or an extid. @param key: a string that is either 'sid' or 'extid'.
[ "Retrieve", "information", "about", "a", "purchase", "using", "the", "system", "s", "unique", "ID", "or", "a", "client", "s", "ID" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L507-L515
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.stats_list
def stats_list(self, list=None, date=None, headers=None): """ Retrieve information about your subscriber counts on a particular list, on a particular day. http://docs.sailthru.com/api/stat """ data = {'stat': 'list'} if list is not None: data['list'] = list ...
python
def stats_list(self, list=None, date=None, headers=None): """ Retrieve information about your subscriber counts on a particular list, on a particular day. http://docs.sailthru.com/api/stat """ data = {'stat': 'list'} if list is not None: data['list'] = list ...
[ "def", "stats_list", "(", "self", ",", "list", "=", "None", ",", "date", "=", "None", ",", "headers", "=", "None", ")", ":", "data", "=", "{", "'stat'", ":", "'list'", "}", "if", "list", "is", "not", "None", ":", "data", "[", "'list'", "]", "=", ...
Retrieve information about your subscriber counts on a particular list, on a particular day. http://docs.sailthru.com/api/stat
[ "Retrieve", "information", "about", "your", "subscriber", "counts", "on", "a", "particular", "list", "on", "a", "particular", "day", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "stat" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L517-L527
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.stats_blast
def stats_blast(self, blast_id=None, start_date=None, end_date=None, options=None): """ Retrieve information about a particular blast or aggregated information from all of blasts over a specified date range. http://docs.sailthru.com/api/stat """ options = options or {} da...
python
def stats_blast(self, blast_id=None, start_date=None, end_date=None, options=None): """ Retrieve information about a particular blast or aggregated information from all of blasts over a specified date range. http://docs.sailthru.com/api/stat """ options = options or {} da...
[ "def", "stats_blast", "(", "self", ",", "blast_id", "=", "None", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "options", ".", "copy", "(",...
Retrieve information about a particular blast or aggregated information from all of blasts over a specified date range. http://docs.sailthru.com/api/stat
[ "Retrieve", "information", "about", "a", "particular", "blast", "or", "aggregated", "information", "from", "all", "of", "blasts", "over", "a", "specified", "date", "range", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com", "/", "api", "/", "stat...
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L529-L543
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.stats_send
def stats_send(self, template, start_date, end_date, options=None): """ Retrieve information about a particular transactional or aggregated information from transactionals from that template over a specified date range. http://docs.sailthru.com/api/stat """ options = opti...
python
def stats_send(self, template, start_date, end_date, options=None): """ Retrieve information about a particular transactional or aggregated information from transactionals from that template over a specified date range. http://docs.sailthru.com/api/stat """ options = opti...
[ "def", "stats_send", "(", "self", ",", "template", ",", "start_date", ",", "end_date", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "options", ".", "copy", "(", ")", "data", "=", "{", "'template'", ":...
Retrieve information about a particular transactional or aggregated information from transactionals from that template over a specified date range. http://docs.sailthru.com/api/stat
[ "Retrieve", "information", "about", "a", "particular", "transactional", "or", "aggregated", "information", "from", "transactionals", "from", "that", "template", "over", "a", "specified", "date", "range", ".", "http", ":", "//", "docs", ".", "sailthru", ".", "com...
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L545-L558
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.receive_verify_post
def receive_verify_post(self, post_params): """ Returns true if the incoming request is an authenticated verify post. """ if isinstance(post_params, dict): required_params = ['action', 'email', 'send_id', 'sig'] if not self.check_for_valid_postback_actions(requir...
python
def receive_verify_post(self, post_params): """ Returns true if the incoming request is an authenticated verify post. """ if isinstance(post_params, dict): required_params = ['action', 'email', 'send_id', 'sig'] if not self.check_for_valid_postback_actions(requir...
[ "def", "receive_verify_post", "(", "self", ",", "post_params", ")", ":", "if", "isinstance", "(", "post_params", ",", "dict", ")", ":", "required_params", "=", "[", "'action'", ",", "'email'", ",", "'send_id'", ",", "'sig'", "]", "if", "not", "self", ".", ...
Returns true if the incoming request is an authenticated verify post.
[ "Returns", "true", "if", "the", "incoming", "request", "is", "an", "authenticated", "verify", "post", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L566-L599
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.receive_update_post
def receive_update_post(self, post_params): """ Update postbacks """ if isinstance(post_params, dict): required_params = ['action', 'email', 'sig'] if not self.check_for_valid_postback_actions(required_params, post_params): return False el...
python
def receive_update_post(self, post_params): """ Update postbacks """ if isinstance(post_params, dict): required_params = ['action', 'email', 'sig'] if not self.check_for_valid_postback_actions(required_params, post_params): return False el...
[ "def", "receive_update_post", "(", "self", ",", "post_params", ")", ":", "if", "isinstance", "(", "post_params", ",", "dict", ")", ":", "required_params", "=", "[", "'action'", ",", "'email'", ",", "'sig'", "]", "if", "not", "self", ".", "check_for_valid_pos...
Update postbacks
[ "Update", "postbacks" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L601-L623
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.receive_hardbounce_post
def receive_hardbounce_post(self, post_params): """ Hard bounce postbacks """ if isinstance(post_params, dict): required_params = ['action', 'email', 'sig'] if not self.check_for_valid_postback_actions(required_params, post_params): return False ...
python
def receive_hardbounce_post(self, post_params): """ Hard bounce postbacks """ if isinstance(post_params, dict): required_params = ['action', 'email', 'sig'] if not self.check_for_valid_postback_actions(required_params, post_params): return False ...
[ "def", "receive_hardbounce_post", "(", "self", ",", "post_params", ")", ":", "if", "isinstance", "(", "post_params", ",", "dict", ")", ":", "required_params", "=", "[", "'action'", ",", "'email'", ",", "'sig'", "]", "if", "not", "self", ".", "check_for_valid...
Hard bounce postbacks
[ "Hard", "bounce", "postbacks" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L648-L689
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.check_for_valid_postback_actions
def check_for_valid_postback_actions(self, required_keys, post_params): """ checks if post_params contain required keys """ for key in required_keys: if key not in post_params: return False return True
python
def check_for_valid_postback_actions(self, required_keys, post_params): """ checks if post_params contain required keys """ for key in required_keys: if key not in post_params: return False return True
[ "def", "check_for_valid_postback_actions", "(", "self", ",", "required_keys", ",", "post_params", ")", ":", "for", "key", "in", "required_keys", ":", "if", "key", "not", "in", "post_params", ":", "return", "False", "return", "True" ]
checks if post_params contain required keys
[ "checks", "if", "post_params", "contain", "required", "keys" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L691-L698
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.api_get
def api_get(self, action, data, headers=None): """ Perform an HTTP GET request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values """ return self._api_request(action, data, 'GET', headers)
python
def api_get(self, action, data, headers=None): """ Perform an HTTP GET request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values """ return self._api_request(action, data, 'GET', headers)
[ "def", "api_get", "(", "self", ",", "action", ",", "data", ",", "headers", "=", "None", ")", ":", "return", "self", ".", "_api_request", "(", "action", ",", "data", ",", "'GET'", ",", "headers", ")" ]
Perform an HTTP GET request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values
[ "Perform", "an", "HTTP", "GET", "request", "using", "the", "shared", "-", "secret", "auth", "hash", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L700-L706
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.api_post
def api_post(self, action, data, binary_data_param=None): """ Perform an HTTP POST request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values """ binary_data_param = binary_data_param or [] if binary_data_param: ...
python
def api_post(self, action, data, binary_data_param=None): """ Perform an HTTP POST request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values """ binary_data_param = binary_data_param or [] if binary_data_param: ...
[ "def", "api_post", "(", "self", ",", "action", ",", "data", ",", "binary_data_param", "=", "None", ")", ":", "binary_data_param", "=", "binary_data_param", "or", "[", "]", "if", "binary_data_param", ":", "return", "self", ".", "api_post_multipart", "(", "actio...
Perform an HTTP POST request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values
[ "Perform", "an", "HTTP", "POST", "request", "using", "the", "shared", "-", "secret", "auth", "hash", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L708-L718
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.api_post_multipart
def api_post_multipart(self, action, data, binary_data_param): """ Perform an HTTP Multipart POST request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values @param: binary_data_params: array of multipart keys """ bina...
python
def api_post_multipart(self, action, data, binary_data_param): """ Perform an HTTP Multipart POST request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values @param: binary_data_params: array of multipart keys """ bina...
[ "def", "api_post_multipart", "(", "self", ",", "action", ",", "data", ",", "binary_data_param", ")", ":", "binary_data", "=", "{", "}", "data", "=", "data", ".", "copy", "(", ")", "try", ":", "file_handles", "=", "[", "]", "for", "param", "in", "binary...
Perform an HTTP Multipart POST request, using the shared-secret auth hash. @param action: API action call @param data: dictionary values @param: binary_data_params: array of multipart keys
[ "Perform", "an", "HTTP", "Multipart", "POST", "request", "using", "the", "shared", "-", "secret", "auth", "hash", "." ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L720-L742
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient._api_request
def _api_request(self, action, data, request_type, headers=None): """ Make Request to Sailthru API with given data and api key, format and signature hash """ if 'file' in data: file_data = {'file': open(data['file'], 'rb')} else: file_data = None ...
python
def _api_request(self, action, data, request_type, headers=None): """ Make Request to Sailthru API with given data and api key, format and signature hash """ if 'file' in data: file_data = {'file': open(data['file'], 'rb')} else: file_data = None ...
[ "def", "_api_request", "(", "self", ",", "action", ",", "data", ",", "request_type", ",", "headers", "=", "None", ")", ":", "if", "'file'", "in", "data", ":", "file_data", "=", "{", "'file'", ":", "open", "(", "data", "[", "'file'", "]", ",", "'rb'",...
Make Request to Sailthru API with given data and api key, format and signature hash
[ "Make", "Request", "to", "Sailthru", "API", "with", "given", "data", "and", "api", "key", "format", "and", "signature", "hash" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L752-L761
sailthru/sailthru-python-client
sailthru/sailthru_client.py
SailthruClient.get_last_rate_limit_info
def get_last_rate_limit_info(self, action, method): """ Get rate limit information for last API call :param action: API endpoint :param method: Http method, GET, POST or DELETE :return: dict|None """ method = method.upper() if (action in self.last_rate_lim...
python
def get_last_rate_limit_info(self, action, method): """ Get rate limit information for last API call :param action: API endpoint :param method: Http method, GET, POST or DELETE :return: dict|None """ method = method.upper() if (action in self.last_rate_lim...
[ "def", "get_last_rate_limit_info", "(", "self", ",", "action", ",", "method", ")", ":", "method", "=", "method", ".", "upper", "(", ")", "if", "(", "action", "in", "self", ".", "last_rate_limit_info", "and", "method", "in", "self", ".", "last_rate_limit_info...
Get rate limit information for last API call :param action: API endpoint :param method: Http method, GET, POST or DELETE :return: dict|None
[ "Get", "rate", "limit", "information", "for", "last", "API", "call", ":", "param", "action", ":", "API", "endpoint", ":", "param", "method", ":", "Http", "method", "GET", "POST", "or", "DELETE", ":", "return", ":", "dict|None" ]
train
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L781-L792
mesemus/django-angular-dynamic-forms
angular_dynamic_forms/linked_form.py
linked_form
def linked_form(viewset, form_id=None, link=None, link_id=None, method=None): """ When having foreign key or m2m relationships between models A and B (B has foreign key to A named parent), we want to have a form that sits on A's viewset but creates/edits B and sets it relationship to A automatically. ...
python
def linked_form(viewset, form_id=None, link=None, link_id=None, method=None): """ When having foreign key or m2m relationships between models A and B (B has foreign key to A named parent), we want to have a form that sits on A's viewset but creates/edits B and sets it relationship to A automatically. ...
[ "def", "linked_form", "(", "viewset", ",", "form_id", "=", "None", ",", "link", "=", "None", ",", "link_id", "=", "None", ",", "method", "=", "None", ")", ":", "return", "{", "'viewset'", ":", "viewset", ",", "'form_id'", ":", "form_id", ",", "'link'",...
When having foreign key or m2m relationships between models A and B (B has foreign key to A named parent), we want to have a form that sits on A's viewset but creates/edits B and sets it relationship to A automatically. In order to do so, define linked_forms on A's viewset containing a call to linked_form ...
[ "When", "having", "foreign", "key", "or", "m2m", "relationships", "between", "models", "A", "and", "B", "(", "B", "has", "foreign", "key", "to", "A", "named", "parent", ")", "we", "want", "to", "have", "a", "form", "that", "sits", "on", "A", "s", "vi...
train
https://github.com/mesemus/django-angular-dynamic-forms/blob/8d4839a26a22c1cda0d317cbd80457bacc13365a/angular_dynamic_forms/linked_form.py#L7-L35
inveniosoftware/invenio-oaiserver
invenio_oaiserver/minters.py
oaiid_minter
def oaiid_minter(record_uuid, data): """Mint record identifiers. :param record_uuid: The record UUID. :param data: The record data. :returns: A :class:`invenio_pidstore.models.PersistentIdentifier` instance. """ pid_value = data.get('_oai', {}).get('id') if pid_value is None: fetche...
python
def oaiid_minter(record_uuid, data): """Mint record identifiers. :param record_uuid: The record UUID. :param data: The record data. :returns: A :class:`invenio_pidstore.models.PersistentIdentifier` instance. """ pid_value = data.get('_oai', {}).get('id') if pid_value is None: fetche...
[ "def", "oaiid_minter", "(", "record_uuid", ",", "data", ")", ":", "pid_value", "=", "data", ".", "get", "(", "'_oai'", ",", "{", "}", ")", ".", "get", "(", "'id'", ")", "if", "pid_value", "is", "None", ":", "fetcher_name", "=", "current_app", ".", "c...
Mint record identifiers. :param record_uuid: The record UUID. :param data: The record data. :returns: A :class:`invenio_pidstore.models.PersistentIdentifier` instance.
[ "Mint", "record", "identifiers", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/minters.py#L22-L43
inveniosoftware/invenio-oaiserver
invenio_oaiserver/views/server.py
validation_error
def validation_error(exception): """Return formatter validation error.""" messages = getattr(exception, 'messages', None) if messages is None: messages = getattr(exception, 'data', {'messages': None})['messages'] def extract_errors(): """Extract errors from exception.""" if isin...
python
def validation_error(exception): """Return formatter validation error.""" messages = getattr(exception, 'messages', None) if messages is None: messages = getattr(exception, 'data', {'messages': None})['messages'] def extract_errors(): """Extract errors from exception.""" if isin...
[ "def", "validation_error", "(", "exception", ")", ":", "messages", "=", "getattr", "(", "exception", ",", "'messages'", ",", "None", ")", "if", "messages", "is", "None", ":", "messages", "=", "getattr", "(", "exception", ",", "'data'", ",", "{", "'messages...
Return formatter validation error.
[ "Return", "formatter", "validation", "error", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/views/server.py#L33-L59
inveniosoftware/invenio-oaiserver
invenio_oaiserver/views/server.py
response
def response(args): """Response endpoint.""" e_tree = getattr(xml, args['verb'].lower())(**args) response = make_response(etree.tostring( e_tree, pretty_print=True, xml_declaration=True, encoding='UTF-8', )) response.headers['Content-Type'] = 'text/xml' return re...
python
def response(args): """Response endpoint.""" e_tree = getattr(xml, args['verb'].lower())(**args) response = make_response(etree.tostring( e_tree, pretty_print=True, xml_declaration=True, encoding='UTF-8', )) response.headers['Content-Type'] = 'text/xml' return re...
[ "def", "response", "(", "args", ")", ":", "e_tree", "=", "getattr", "(", "xml", ",", "args", "[", "'verb'", "]", ".", "lower", "(", ")", ")", "(", "*", "*", "args", ")", "response", "=", "make_response", "(", "etree", ".", "tostring", "(", "e_tree"...
Response endpoint.
[ "Response", "endpoint", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/views/server.py#L82-L93
inveniosoftware/invenio-oaiserver
invenio_oaiserver/provider.py
OAIIDProvider.create
def create(cls, object_type=None, object_uuid=None, **kwargs): """Create a new record identifier. :param object_type: The object type. (Default: ``None``) :param object_uuid: The object UUID. (Default: ``None``) """ assert 'pid_value' in kwargs kwargs.setdefault('status...
python
def create(cls, object_type=None, object_uuid=None, **kwargs): """Create a new record identifier. :param object_type: The object type. (Default: ``None``) :param object_uuid: The object UUID. (Default: ``None``) """ assert 'pid_value' in kwargs kwargs.setdefault('status...
[ "def", "create", "(", "cls", ",", "object_type", "=", "None", ",", "object_uuid", "=", "None", ",", "*", "*", "kwargs", ")", ":", "assert", "'pid_value'", "in", "kwargs", "kwargs", ".", "setdefault", "(", "'status'", ",", "cls", ".", "default_status", ")...
Create a new record identifier. :param object_type: The object type. (Default: ``None``) :param object_uuid: The object UUID. (Default: ``None``)
[ "Create", "a", "new", "record", "identifier", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/provider.py#L30-L43
inveniosoftware/invenio-oaiserver
invenio_oaiserver/percolator.py
_create_percolator_mapping
def _create_percolator_mapping(index, doc_type): """Update mappings with the percolator field. .. note:: This is only needed from ElasticSearch v5 onwards, because percolators are now just a special type of field inside mappings. """ if ES_VERSION[0] >= 5: current_search_client...
python
def _create_percolator_mapping(index, doc_type): """Update mappings with the percolator field. .. note:: This is only needed from ElasticSearch v5 onwards, because percolators are now just a special type of field inside mappings. """ if ES_VERSION[0] >= 5: current_search_client...
[ "def", "_create_percolator_mapping", "(", "index", ",", "doc_type", ")", ":", "if", "ES_VERSION", "[", "0", "]", ">=", "5", ":", "current_search_client", ".", "indices", ".", "put_mapping", "(", "index", "=", "index", ",", "doc_type", "=", "doc_type", ",", ...
Update mappings with the percolator field. .. note:: This is only needed from ElasticSearch v5 onwards, because percolators are now just a special type of field inside mappings.
[ "Update", "mappings", "with", "the", "percolator", "field", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/percolator.py#L23-L34
inveniosoftware/invenio-oaiserver
invenio_oaiserver/percolator.py
_percolate_query
def _percolate_query(index, doc_type, percolator_doc_type, document): """Get results for a percolate query.""" if ES_VERSION[0] in (2, 5): results = current_search_client.percolate( index=index, doc_type=doc_type, allow_no_indices=True, ignore_unavailable=True, body={'doc': docum...
python
def _percolate_query(index, doc_type, percolator_doc_type, document): """Get results for a percolate query.""" if ES_VERSION[0] in (2, 5): results = current_search_client.percolate( index=index, doc_type=doc_type, allow_no_indices=True, ignore_unavailable=True, body={'doc': docum...
[ "def", "_percolate_query", "(", "index", ",", "doc_type", ",", "percolator_doc_type", ",", "document", ")", ":", "if", "ES_VERSION", "[", "0", "]", "in", "(", "2", ",", "5", ")", ":", "results", "=", "current_search_client", ".", "percolate", "(", "index",...
Get results for a percolate query.
[ "Get", "results", "for", "a", "percolate", "query", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/percolator.py#L37-L58
inveniosoftware/invenio-oaiserver
invenio_oaiserver/percolator.py
_new_percolator
def _new_percolator(spec, search_pattern): """Create new percolator associated with the new set.""" if spec and search_pattern: query = query_string_parser(search_pattern=search_pattern).to_dict() for index in current_search.mappings.keys(): # Create the percolator doc_type in the ex...
python
def _new_percolator(spec, search_pattern): """Create new percolator associated with the new set.""" if spec and search_pattern: query = query_string_parser(search_pattern=search_pattern).to_dict() for index in current_search.mappings.keys(): # Create the percolator doc_type in the ex...
[ "def", "_new_percolator", "(", "spec", ",", "search_pattern", ")", ":", "if", "spec", "and", "search_pattern", ":", "query", "=", "query_string_parser", "(", "search_pattern", "=", "search_pattern", ")", ".", "to_dict", "(", ")", "for", "index", "in", "current...
Create new percolator associated with the new set.
[ "Create", "new", "percolator", "associated", "with", "the", "new", "set", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/percolator.py#L78-L91
inveniosoftware/invenio-oaiserver
invenio_oaiserver/percolator.py
_delete_percolator
def _delete_percolator(spec, search_pattern): """Delete percolator associated with the new oaiset.""" if spec: for index in current_search.mappings.keys(): # Create the percolator doc_type in the existing index for >= ES5 percolator_doc_type = _get_percolator_doc_type(index) ...
python
def _delete_percolator(spec, search_pattern): """Delete percolator associated with the new oaiset.""" if spec: for index in current_search.mappings.keys(): # Create the percolator doc_type in the existing index for >= ES5 percolator_doc_type = _get_percolator_doc_type(index) ...
[ "def", "_delete_percolator", "(", "spec", ",", "search_pattern", ")", ":", "if", "spec", ":", "for", "index", "in", "current_search", ".", "mappings", ".", "keys", "(", ")", ":", "# Create the percolator doc_type in the existing index for >= ES5", "percolator_doc_type",...
Delete percolator associated with the new oaiset.
[ "Delete", "percolator", "associated", "with", "the", "new", "oaiset", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/percolator.py#L94-L104
inveniosoftware/invenio-oaiserver
invenio_oaiserver/percolator.py
_build_cache
def _build_cache(): """Build sets cache.""" sets = current_oaiserver.sets if sets is None: # build sets cache sets = current_oaiserver.sets = [ oaiset.spec for oaiset in OAISet.query.filter( OAISet.search_pattern.is_(None)).all()] return sets
python
def _build_cache(): """Build sets cache.""" sets = current_oaiserver.sets if sets is None: # build sets cache sets = current_oaiserver.sets = [ oaiset.spec for oaiset in OAISet.query.filter( OAISet.search_pattern.is_(None)).all()] return sets
[ "def", "_build_cache", "(", ")", ":", "sets", "=", "current_oaiserver", ".", "sets", "if", "sets", "is", "None", ":", "# build sets cache", "sets", "=", "current_oaiserver", ".", "sets", "=", "[", "oaiset", ".", "spec", "for", "oaiset", "in", "OAISet", "."...
Build sets cache.
[ "Build", "sets", "cache", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/percolator.py#L107-L115
inveniosoftware/invenio-oaiserver
invenio_oaiserver/percolator.py
get_record_sets
def get_record_sets(record): """Find matching sets.""" # get lists of sets with search_pattern equals to None but already in the # set list inside the record record_sets = set(record.get('_oai', {}).get('sets', [])) for spec in _build_cache(): if spec in record_sets: yield spec ...
python
def get_record_sets(record): """Find matching sets.""" # get lists of sets with search_pattern equals to None but already in the # set list inside the record record_sets = set(record.get('_oai', {}).get('sets', [])) for spec in _build_cache(): if spec in record_sets: yield spec ...
[ "def", "get_record_sets", "(", "record", ")", ":", "# get lists of sets with search_pattern equals to None but already in the", "# set list inside the record", "record_sets", "=", "set", "(", "record", ".", "get", "(", "'_oai'", ",", "{", "}", ")", ".", "get", "(", "'...
Find matching sets.
[ "Find", "matching", "sets", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/percolator.py#L118-L142
inveniosoftware/invenio-oaiserver
invenio_oaiserver/tasks.py
_records_commit
def _records_commit(record_ids): """Commit all records.""" for record_id in record_ids: record = Record.get_record(record_id) record.commit()
python
def _records_commit(record_ids): """Commit all records.""" for record_id in record_ids: record = Record.get_record(record_id) record.commit()
[ "def", "_records_commit", "(", "record_ids", ")", ":", "for", "record_id", "in", "record_ids", ":", "record", "=", "Record", ".", "get_record", "(", "record_id", ")", "record", ".", "commit", "(", ")" ]
Commit all records.
[ "Commit", "all", "records", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/tasks.py#L25-L29
inveniosoftware/invenio-oaiserver
invenio_oaiserver/tasks.py
update_affected_records
def update_affected_records(spec=None, search_pattern=None): """Update all affected records by OAISet change. :param spec: The record spec. :param search_pattern: The search pattern. """ chunk_size = current_app.config['OAISERVER_CELERY_TASK_CHUNK_SIZE'] record_ids = get_affected_records(spec=s...
python
def update_affected_records(spec=None, search_pattern=None): """Update all affected records by OAISet change. :param spec: The record spec. :param search_pattern: The search pattern. """ chunk_size = current_app.config['OAISERVER_CELERY_TASK_CHUNK_SIZE'] record_ids = get_affected_records(spec=s...
[ "def", "update_affected_records", "(", "spec", "=", "None", ",", "search_pattern", "=", "None", ")", ":", "chunk_size", "=", "current_app", ".", "config", "[", "'OAISERVER_CELERY_TASK_CHUNK_SIZE'", "]", "record_ids", "=", "get_affected_records", "(", "spec", "=", ...
Update all affected records by OAISet change. :param spec: The record spec. :param search_pattern: The search pattern.
[ "Update", "all", "affected", "records", "by", "OAISet", "change", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/tasks.py#L43-L55
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
envelope
def envelope(**kwargs): """Create OAI-PMH envelope for response.""" e_oaipmh = Element(etree.QName(NS_OAIPMH, 'OAI-PMH'), nsmap=NSMAP) e_oaipmh.set(etree.QName(NS_XSI, 'schemaLocation'), '{0} {1}'.format(NS_OAIPMH, NS_OAIPMH_XSD)) e_tree = ElementTree(element=e_oaipmh) if current_a...
python
def envelope(**kwargs): """Create OAI-PMH envelope for response.""" e_oaipmh = Element(etree.QName(NS_OAIPMH, 'OAI-PMH'), nsmap=NSMAP) e_oaipmh.set(etree.QName(NS_XSI, 'schemaLocation'), '{0} {1}'.format(NS_OAIPMH, NS_OAIPMH_XSD)) e_tree = ElementTree(element=e_oaipmh) if current_a...
[ "def", "envelope", "(", "*", "*", "kwargs", ")", ":", "e_oaipmh", "=", "Element", "(", "etree", ".", "QName", "(", "NS_OAIPMH", ",", "'OAI-PMH'", ")", ",", "nsmap", "=", "NSMAP", ")", "e_oaipmh", ".", "set", "(", "etree", ".", "QName", "(", "NS_XSI",...
Create OAI-PMH envelope for response.
[ "Create", "OAI", "-", "PMH", "envelope", "for", "response", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L50-L75
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
error
def error(errors): """Create error element.""" e_tree, e_oaipmh = envelope() for code, message in errors: e_error = SubElement(e_oaipmh, etree.QName(NS_OAIPMH, 'error')) e_error.set('code', code) e_error.text = message return e_tree
python
def error(errors): """Create error element.""" e_tree, e_oaipmh = envelope() for code, message in errors: e_error = SubElement(e_oaipmh, etree.QName(NS_OAIPMH, 'error')) e_error.set('code', code) e_error.text = message return e_tree
[ "def", "error", "(", "errors", ")", ":", "e_tree", ",", "e_oaipmh", "=", "envelope", "(", ")", "for", "code", ",", "message", "in", "errors", ":", "e_error", "=", "SubElement", "(", "e_oaipmh", ",", "etree", ".", "QName", "(", "NS_OAIPMH", ",", "'error...
Create error element.
[ "Create", "error", "element", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L78-L85
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
verb
def verb(**kwargs): """Create OAI-PMH envelope for response with verb.""" e_tree, e_oaipmh = envelope(**kwargs) e_element = SubElement(e_oaipmh, etree.QName(NS_OAIPMH, kwargs['verb'])) return e_tree, e_element
python
def verb(**kwargs): """Create OAI-PMH envelope for response with verb.""" e_tree, e_oaipmh = envelope(**kwargs) e_element = SubElement(e_oaipmh, etree.QName(NS_OAIPMH, kwargs['verb'])) return e_tree, e_element
[ "def", "verb", "(", "*", "*", "kwargs", ")", ":", "e_tree", ",", "e_oaipmh", "=", "envelope", "(", "*", "*", "kwargs", ")", "e_element", "=", "SubElement", "(", "e_oaipmh", ",", "etree", ".", "QName", "(", "NS_OAIPMH", ",", "kwargs", "[", "'verb'", "...
Create OAI-PMH envelope for response with verb.
[ "Create", "OAI", "-", "PMH", "envelope", "for", "response", "with", "verb", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L88-L92
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
identify
def identify(**kwargs): """Create OAI-PMH response for verb Identify.""" cfg = current_app.config e_tree, e_identify = verb(**kwargs) e_repositoryName = SubElement( e_identify, etree.QName(NS_OAIPMH, 'repositoryName')) e_repositoryName.text = cfg['OAISERVER_REPOSITORY_NAME'] e_baseURL...
python
def identify(**kwargs): """Create OAI-PMH response for verb Identify.""" cfg = current_app.config e_tree, e_identify = verb(**kwargs) e_repositoryName = SubElement( e_identify, etree.QName(NS_OAIPMH, 'repositoryName')) e_repositoryName.text = cfg['OAISERVER_REPOSITORY_NAME'] e_baseURL...
[ "def", "identify", "(", "*", "*", "kwargs", ")", ":", "cfg", "=", "current_app", ".", "config", "e_tree", ",", "e_identify", "=", "verb", "(", "*", "*", "kwargs", ")", "e_repositoryName", "=", "SubElement", "(", "e_identify", ",", "etree", ".", "QName", ...
Create OAI-PMH response for verb Identify.
[ "Create", "OAI", "-", "PMH", "response", "for", "verb", "Identify", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L95-L153
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
resumption_token
def resumption_token(parent, pagination, **kwargs): """Attach resumption token element to a parent.""" # Do not add resumptionToken if all results fit to the first page. if pagination.page == 1 and not pagination.has_next: return token = serialize(pagination, **kwargs) e_resumptionToken = S...
python
def resumption_token(parent, pagination, **kwargs): """Attach resumption token element to a parent.""" # Do not add resumptionToken if all results fit to the first page. if pagination.page == 1 and not pagination.has_next: return token = serialize(pagination, **kwargs) e_resumptionToken = S...
[ "def", "resumption_token", "(", "parent", ",", "pagination", ",", "*", "*", "kwargs", ")", ":", "# Do not add resumptionToken if all results fit to the first page.", "if", "pagination", ".", "page", "==", "1", "and", "not", "pagination", ".", "has_next", ":", "retur...
Attach resumption token element to a parent.
[ "Attach", "resumption", "token", "element", "to", "a", "parent", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L156-L180
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
listsets
def listsets(**kwargs): """Create OAI-PMH response for ListSets verb.""" e_tree, e_listsets = verb(**kwargs) page = kwargs.get('resumptionToken', {}).get('page', 1) size = current_app.config['OAISERVER_PAGE_SIZE'] oai_sets = OAISet.query.paginate(page=page, per_page=size, error_out=False) for ...
python
def listsets(**kwargs): """Create OAI-PMH response for ListSets verb.""" e_tree, e_listsets = verb(**kwargs) page = kwargs.get('resumptionToken', {}).get('page', 1) size = current_app.config['OAISERVER_PAGE_SIZE'] oai_sets = OAISet.query.paginate(page=page, per_page=size, error_out=False) for ...
[ "def", "listsets", "(", "*", "*", "kwargs", ")", ":", "e_tree", ",", "e_listsets", "=", "verb", "(", "*", "*", "kwargs", ")", "page", "=", "kwargs", ".", "get", "(", "'resumptionToken'", ",", "{", "}", ")", ".", "get", "(", "'page'", ",", "1", ")...
Create OAI-PMH response for ListSets verb.
[ "Create", "OAI", "-", "PMH", "response", "for", "ListSets", "verb", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L183-L209
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
listmetadataformats
def listmetadataformats(**kwargs): """Create OAI-PMH response for ListMetadataFormats verb.""" cfg = current_app.config e_tree, e_listmetadataformats = verb(**kwargs) if 'identifier' in kwargs: # test if record exists OAIIDProvider.get(pid_value=kwargs['identifier']) for prefix, me...
python
def listmetadataformats(**kwargs): """Create OAI-PMH response for ListMetadataFormats verb.""" cfg = current_app.config e_tree, e_listmetadataformats = verb(**kwargs) if 'identifier' in kwargs: # test if record exists OAIIDProvider.get(pid_value=kwargs['identifier']) for prefix, me...
[ "def", "listmetadataformats", "(", "*", "*", "kwargs", ")", ":", "cfg", "=", "current_app", ".", "config", "e_tree", ",", "e_listmetadataformats", "=", "verb", "(", "*", "*", "kwargs", ")", "if", "'identifier'", "in", "kwargs", ":", "# test if record exists", ...
Create OAI-PMH response for ListMetadataFormats verb.
[ "Create", "OAI", "-", "PMH", "response", "for", "ListMetadataFormats", "verb", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L212-L238
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
header
def header(parent, identifier, datestamp, sets=None, deleted=False): """Attach ``<header/>`` element to a parent.""" e_header = SubElement(parent, etree.QName(NS_OAIPMH, 'header')) if deleted: e_header.set('status', 'deleted') e_identifier = SubElement(e_header, etree.QName(NS_OAIPMH, 'identifie...
python
def header(parent, identifier, datestamp, sets=None, deleted=False): """Attach ``<header/>`` element to a parent.""" e_header = SubElement(parent, etree.QName(NS_OAIPMH, 'header')) if deleted: e_header.set('status', 'deleted') e_identifier = SubElement(e_header, etree.QName(NS_OAIPMH, 'identifie...
[ "def", "header", "(", "parent", ",", "identifier", ",", "datestamp", ",", "sets", "=", "None", ",", "deleted", "=", "False", ")", ":", "e_header", "=", "SubElement", "(", "parent", ",", "etree", ".", "QName", "(", "NS_OAIPMH", ",", "'header'", ")", ")"...
Attach ``<header/>`` element to a parent.
[ "Attach", "<header", "/", ">", "element", "to", "a", "parent", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L241-L253
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
getrecord
def getrecord(**kwargs): """Create OAI-PMH response for verb Identify.""" record_dumper = serializer(kwargs['metadataPrefix']) pid = OAIIDProvider.get(pid_value=kwargs['identifier']).pid record = Record.get_record(pid.object_uuid) e_tree, e_getrecord = verb(**kwargs) e_record = SubElement(e_get...
python
def getrecord(**kwargs): """Create OAI-PMH response for verb Identify.""" record_dumper = serializer(kwargs['metadataPrefix']) pid = OAIIDProvider.get(pid_value=kwargs['identifier']).pid record = Record.get_record(pid.object_uuid) e_tree, e_getrecord = verb(**kwargs) e_record = SubElement(e_get...
[ "def", "getrecord", "(", "*", "*", "kwargs", ")", ":", "record_dumper", "=", "serializer", "(", "kwargs", "[", "'metadataPrefix'", "]", ")", "pid", "=", "OAIIDProvider", ".", "get", "(", "pid_value", "=", "kwargs", "[", "'identifier'", "]", ")", ".", "pi...
Create OAI-PMH response for verb Identify.
[ "Create", "OAI", "-", "PMH", "response", "for", "verb", "Identify", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L256-L275
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
listidentifiers
def listidentifiers(**kwargs): """Create OAI-PMH response for verb ListIdentifiers.""" e_tree, e_listidentifiers = verb(**kwargs) result = get_records(**kwargs) for record in result.items: pid = oaiid_fetcher(record['id'], record['json']['_source']) header( e_listidentifiers...
python
def listidentifiers(**kwargs): """Create OAI-PMH response for verb ListIdentifiers.""" e_tree, e_listidentifiers = verb(**kwargs) result = get_records(**kwargs) for record in result.items: pid = oaiid_fetcher(record['id'], record['json']['_source']) header( e_listidentifiers...
[ "def", "listidentifiers", "(", "*", "*", "kwargs", ")", ":", "e_tree", ",", "e_listidentifiers", "=", "verb", "(", "*", "*", "kwargs", ")", "result", "=", "get_records", "(", "*", "*", "kwargs", ")", "for", "record", "in", "result", ".", "items", ":", ...
Create OAI-PMH response for verb ListIdentifiers.
[ "Create", "OAI", "-", "PMH", "response", "for", "verb", "ListIdentifiers", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L278-L293
inveniosoftware/invenio-oaiserver
invenio_oaiserver/response.py
listrecords
def listrecords(**kwargs): """Create OAI-PMH response for verb ListRecords.""" record_dumper = serializer(kwargs['metadataPrefix']) e_tree, e_listrecords = verb(**kwargs) result = get_records(**kwargs) for record in result.items: pid = oaiid_fetcher(record['id'], record['json']['_source'])...
python
def listrecords(**kwargs): """Create OAI-PMH response for verb ListRecords.""" record_dumper = serializer(kwargs['metadataPrefix']) e_tree, e_listrecords = verb(**kwargs) result = get_records(**kwargs) for record in result.items: pid = oaiid_fetcher(record['id'], record['json']['_source'])...
[ "def", "listrecords", "(", "*", "*", "kwargs", ")", ":", "record_dumper", "=", "serializer", "(", "kwargs", "[", "'metadataPrefix'", "]", ")", "e_tree", ",", "e_listrecords", "=", "verb", "(", "*", "*", "kwargs", ")", "result", "=", "get_records", "(", "...
Create OAI-PMH response for verb ListRecords.
[ "Create", "OAI", "-", "PMH", "response", "for", "verb", "ListRecords", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/response.py#L296-L317
inveniosoftware/invenio-oaiserver
invenio_oaiserver/fetchers.py
oaiid_fetcher
def oaiid_fetcher(record_uuid, data): """Fetch a record's identifier. :param record_uuid: The record UUID. :param data: The record data. :returns: A :class:`invenio_pidstore.fetchers.FetchedPID` instance. """ pid_value = data.get('_oai', {}).get('id') if pid_value is None: raise Per...
python
def oaiid_fetcher(record_uuid, data): """Fetch a record's identifier. :param record_uuid: The record UUID. :param data: The record data. :returns: A :class:`invenio_pidstore.fetchers.FetchedPID` instance. """ pid_value = data.get('_oai', {}).get('id') if pid_value is None: raise Per...
[ "def", "oaiid_fetcher", "(", "record_uuid", ",", "data", ")", ":", "pid_value", "=", "data", ".", "get", "(", "'_oai'", ",", "{", "}", ")", ".", "get", "(", "'id'", ")", "if", "pid_value", "is", "None", ":", "raise", "PersistentIdentifierError", "(", "...
Fetch a record's identifier. :param record_uuid: The record UUID. :param data: The record data. :returns: A :class:`invenio_pidstore.fetchers.FetchedPID` instance.
[ "Fetch", "a", "record", "s", "identifier", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/fetchers.py#L19-L33
inveniosoftware/invenio-oaiserver
invenio_oaiserver/models.py
OAISet.validate_spec
def validate_spec(self, key, value): """Forbit updates of set identifier.""" if self.spec and self.spec != value: raise OAISetSpecUpdateError("Updating spec is not allowed.") return value
python
def validate_spec(self, key, value): """Forbit updates of set identifier.""" if self.spec and self.spec != value: raise OAISetSpecUpdateError("Updating spec is not allowed.") return value
[ "def", "validate_spec", "(", "self", ",", "key", ",", "value", ")", ":", "if", "self", ".", "spec", "and", "self", ".", "spec", "!=", "value", ":", "raise", "OAISetSpecUpdateError", "(", "\"Updating spec is not allowed.\"", ")", "return", "value" ]
Forbit updates of set identifier.
[ "Forbit", "updates", "of", "set", "identifier", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/models.py#L73-L77
inveniosoftware/invenio-oaiserver
invenio_oaiserver/models.py
OAISet.add_record
def add_record(self, record): """Add a record to the OAISet. :param record: Record to be added. :type record: `invenio_records.api.Record` or derivative. """ record.setdefault('_oai', {}).setdefault('sets', []) assert not self.has_record(record) record['_oai'][...
python
def add_record(self, record): """Add a record to the OAISet. :param record: Record to be added. :type record: `invenio_records.api.Record` or derivative. """ record.setdefault('_oai', {}).setdefault('sets', []) assert not self.has_record(record) record['_oai'][...
[ "def", "add_record", "(", "self", ",", "record", ")", ":", "record", ".", "setdefault", "(", "'_oai'", ",", "{", "}", ")", ".", "setdefault", "(", "'sets'", ",", "[", "]", ")", "assert", "not", "self", ".", "has_record", "(", "record", ")", "record",...
Add a record to the OAISet. :param record: Record to be added. :type record: `invenio_records.api.Record` or derivative.
[ "Add", "a", "record", "to", "the", "OAISet", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/models.py#L79-L89
inveniosoftware/invenio-oaiserver
invenio_oaiserver/models.py
OAISet.remove_record
def remove_record(self, record): """Remove a record from the OAISet. :param record: Record to be removed. :type record: `invenio_records.api.Record` or derivative. """ assert self.has_record(record) record['_oai']['sets'] = [ s for s in record['_oai']['sets'...
python
def remove_record(self, record): """Remove a record from the OAISet. :param record: Record to be removed. :type record: `invenio_records.api.Record` or derivative. """ assert self.has_record(record) record['_oai']['sets'] = [ s for s in record['_oai']['sets'...
[ "def", "remove_record", "(", "self", ",", "record", ")", ":", "assert", "self", ".", "has_record", "(", "record", ")", "record", "[", "'_oai'", "]", "[", "'sets'", "]", "=", "[", "s", "for", "s", "in", "record", "[", "'_oai'", "]", "[", "'sets'", "...
Remove a record from the OAISet. :param record: Record to be removed. :type record: `invenio_records.api.Record` or derivative.
[ "Remove", "a", "record", "from", "the", "OAISet", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/models.py#L91-L100
inveniosoftware/invenio-oaiserver
examples/app.py
oaiserver
def oaiserver(sets, records): """Initialize OAI-PMH server.""" from invenio_db import db from invenio_oaiserver.models import OAISet from invenio_records.api import Record # create a OAI Set with db.session.begin_nested(): for i in range(sets): db.session.add(OAISet( ...
python
def oaiserver(sets, records): """Initialize OAI-PMH server.""" from invenio_db import db from invenio_oaiserver.models import OAISet from invenio_records.api import Record # create a OAI Set with db.session.begin_nested(): for i in range(sets): db.session.add(OAISet( ...
[ "def", "oaiserver", "(", "sets", ",", "records", ")", ":", "from", "invenio_db", "import", "db", "from", "invenio_oaiserver", ".", "models", "import", "OAISet", "from", "invenio_records", ".", "api", "import", "Record", "# create a OAI Set", "with", "db", ".", ...
Initialize OAI-PMH server.
[ "Initialize", "OAI", "-", "PMH", "server", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/examples/app.py#L92-L138
inveniosoftware/invenio-oaiserver
invenio_oaiserver/utils.py
serializer
def serializer(metadata_prefix): """Return etree_dumper instances. :param metadata_prefix: One of the metadata identifiers configured in ``OAISERVER_METADATA_FORMATS``. """ metadataFormats = current_app.config['OAISERVER_METADATA_FORMATS'] serializer_ = metadataFormats[metadata_prefix]['ser...
python
def serializer(metadata_prefix): """Return etree_dumper instances. :param metadata_prefix: One of the metadata identifiers configured in ``OAISERVER_METADATA_FORMATS``. """ metadataFormats = current_app.config['OAISERVER_METADATA_FORMATS'] serializer_ = metadataFormats[metadata_prefix]['ser...
[ "def", "serializer", "(", "metadata_prefix", ")", ":", "metadataFormats", "=", "current_app", ".", "config", "[", "'OAISERVER_METADATA_FORMATS'", "]", "serializer_", "=", "metadataFormats", "[", "metadata_prefix", "]", "[", "'serializer'", "]", "if", "isinstance", "...
Return etree_dumper instances. :param metadata_prefix: One of the metadata identifiers configured in ``OAISERVER_METADATA_FORMATS``.
[ "Return", "etree_dumper", "instances", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/utils.py#L53-L63
inveniosoftware/invenio-oaiserver
invenio_oaiserver/utils.py
dumps_etree
def dumps_etree(pid, record, **kwargs): """Dump MARC21 compatible record. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :returns: A LXML Element instance. """ from dojson.contrib.to_marc21...
python
def dumps_etree(pid, record, **kwargs): """Dump MARC21 compatible record. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :returns: A LXML Element instance. """ from dojson.contrib.to_marc21...
[ "def", "dumps_etree", "(", "pid", ",", "record", ",", "*", "*", "kwargs", ")", ":", "from", "dojson", ".", "contrib", ".", "to_marc21", "import", "to_marc21", "from", "dojson", ".", "contrib", ".", "to_marc21", ".", "utils", "import", "dumps_etree", "retur...
Dump MARC21 compatible record. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :returns: A LXML Element instance.
[ "Dump", "MARC21", "compatible", "record", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/utils.py#L66-L77
inveniosoftware/invenio-oaiserver
invenio_oaiserver/utils.py
eprints_description
def eprints_description(metadataPolicy, dataPolicy, submissionPolicy=None, content=None): """Generate the eprints element for the identify response. The eprints container is used by the e-print community to describe the content and policies of repositories. For the full specific...
python
def eprints_description(metadataPolicy, dataPolicy, submissionPolicy=None, content=None): """Generate the eprints element for the identify response. The eprints container is used by the e-print community to describe the content and policies of repositories. For the full specific...
[ "def", "eprints_description", "(", "metadataPolicy", ",", "dataPolicy", ",", "submissionPolicy", "=", "None", ",", "content", "=", "None", ")", ":", "eprints", "=", "Element", "(", "etree", ".", "QName", "(", "NS_EPRINTS", "[", "None", "]", ",", "'eprints'",...
Generate the eprints element for the identify response. The eprints container is used by the e-print community to describe the content and policies of repositories. For the full specification and schema definition visit: http://www.openarchives.org/OAI/2.0/guidelines-eprints.htm
[ "Generate", "the", "eprints", "element", "for", "the", "identify", "response", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/utils.py#L96-L131
inveniosoftware/invenio-oaiserver
invenio_oaiserver/utils.py
oai_identifier_description
def oai_identifier_description(scheme, repositoryIdentifier, delimiter, sampleIdentifier): """Generate the oai-identifier element for the identify response. The OAI identifier format is intended to provide persistent resource identifiers for items in repositories that impleme...
python
def oai_identifier_description(scheme, repositoryIdentifier, delimiter, sampleIdentifier): """Generate the oai-identifier element for the identify response. The OAI identifier format is intended to provide persistent resource identifiers for items in repositories that impleme...
[ "def", "oai_identifier_description", "(", "scheme", ",", "repositoryIdentifier", ",", "delimiter", ",", "sampleIdentifier", ")", ":", "oai_identifier", "=", "Element", "(", "etree", ".", "QName", "(", "NS_OAI_IDENTIFIER", "[", "None", "]", ",", "'oai_identifier'", ...
Generate the oai-identifier element for the identify response. The OAI identifier format is intended to provide persistent resource identifiers for items in repositories that implement OAI-PMH. For the full specification and schema definition visit: http://www.openarchives.org/OAI/2.0/guidelines-oai-id...
[ "Generate", "the", "oai", "-", "identifier", "element", "for", "the", "identify", "response", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/utils.py#L134-L153
inveniosoftware/invenio-oaiserver
invenio_oaiserver/utils.py
friends_description
def friends_description(baseURLs): """Generate the friends element for the identify response. The friends container is recommended for use by repositories to list confederate repositories. For the schema definition visit: http://www.openarchives.org/OAI/2.0/guidelines-friends.htm """ friend...
python
def friends_description(baseURLs): """Generate the friends element for the identify response. The friends container is recommended for use by repositories to list confederate repositories. For the schema definition visit: http://www.openarchives.org/OAI/2.0/guidelines-friends.htm """ friend...
[ "def", "friends_description", "(", "baseURLs", ")", ":", "friends", "=", "Element", "(", "etree", ".", "QName", "(", "NS_FRIENDS", "[", "None", "]", ",", "'friends'", ")", ",", "nsmap", "=", "NS_FRIENDS", ")", "friends", ".", "set", "(", "etree", ".", ...
Generate the friends element for the identify response. The friends container is recommended for use by repositories to list confederate repositories. For the schema definition visit: http://www.openarchives.org/OAI/2.0/guidelines-friends.htm
[ "Generate", "the", "friends", "element", "for", "the", "identify", "response", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/utils.py#L156-L171
inveniosoftware/invenio-oaiserver
invenio_oaiserver/receivers.py
after_insert_oai_set
def after_insert_oai_set(mapper, connection, target): """Update records on OAISet insertion.""" _new_percolator(spec=target.spec, search_pattern=target.search_pattern) sleep(2) update_affected_records.delay( search_pattern=target.search_pattern )
python
def after_insert_oai_set(mapper, connection, target): """Update records on OAISet insertion.""" _new_percolator(spec=target.spec, search_pattern=target.search_pattern) sleep(2) update_affected_records.delay( search_pattern=target.search_pattern )
[ "def", "after_insert_oai_set", "(", "mapper", ",", "connection", ",", "target", ")", ":", "_new_percolator", "(", "spec", "=", "target", ".", "spec", ",", "search_pattern", "=", "target", ".", "search_pattern", ")", "sleep", "(", "2", ")", "update_affected_rec...
Update records on OAISet insertion.
[ "Update", "records", "on", "OAISet", "insertion", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/receivers.py#L36-L42
inveniosoftware/invenio-oaiserver
invenio_oaiserver/receivers.py
after_update_oai_set
def after_update_oai_set(mapper, connection, target): """Update records on OAISet update.""" _delete_percolator(spec=target.spec, search_pattern=target.search_pattern) _new_percolator(spec=target.spec, search_pattern=target.search_pattern) sleep(2) update_affected_records.delay( spec=target....
python
def after_update_oai_set(mapper, connection, target): """Update records on OAISet update.""" _delete_percolator(spec=target.spec, search_pattern=target.search_pattern) _new_percolator(spec=target.spec, search_pattern=target.search_pattern) sleep(2) update_affected_records.delay( spec=target....
[ "def", "after_update_oai_set", "(", "mapper", ",", "connection", ",", "target", ")", ":", "_delete_percolator", "(", "spec", "=", "target", ".", "spec", ",", "search_pattern", "=", "target", ".", "search_pattern", ")", "_new_percolator", "(", "spec", "=", "tar...
Update records on OAISet update.
[ "Update", "records", "on", "OAISet", "update", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/receivers.py#L45-L52
inveniosoftware/invenio-oaiserver
invenio_oaiserver/receivers.py
after_delete_oai_set
def after_delete_oai_set(mapper, connection, target): """Update records on OAISet deletion.""" _delete_percolator(spec=target.spec, search_pattern=target.search_pattern) sleep(2) update_affected_records.delay( spec=target.spec )
python
def after_delete_oai_set(mapper, connection, target): """Update records on OAISet deletion.""" _delete_percolator(spec=target.spec, search_pattern=target.search_pattern) sleep(2) update_affected_records.delay( spec=target.spec )
[ "def", "after_delete_oai_set", "(", "mapper", ",", "connection", ",", "target", ")", ":", "_delete_percolator", "(", "spec", "=", "target", ".", "spec", ",", "search_pattern", "=", "target", ".", "search_pattern", ")", "sleep", "(", "2", ")", "update_affected_...
Update records on OAISet deletion.
[ "Update", "records", "on", "OAISet", "deletion", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/receivers.py#L55-L61
inveniosoftware/invenio-oaiserver
invenio_oaiserver/query.py
query_string_parser
def query_string_parser(search_pattern): """Elasticsearch query string parser.""" if not hasattr(current_oaiserver, 'query_parser'): query_parser = current_app.config['OAISERVER_QUERY_PARSER'] if isinstance(query_parser, six.string_types): query_parser = import_string(query_parser) ...
python
def query_string_parser(search_pattern): """Elasticsearch query string parser.""" if not hasattr(current_oaiserver, 'query_parser'): query_parser = current_app.config['OAISERVER_QUERY_PARSER'] if isinstance(query_parser, six.string_types): query_parser = import_string(query_parser) ...
[ "def", "query_string_parser", "(", "search_pattern", ")", ":", "if", "not", "hasattr", "(", "current_oaiserver", ",", "'query_parser'", ")", ":", "query_parser", "=", "current_app", ".", "config", "[", "'OAISERVER_QUERY_PARSER'", "]", "if", "isinstance", "(", "que...
Elasticsearch query string parser.
[ "Elasticsearch", "query", "string", "parser", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/query.py#L20-L27
inveniosoftware/invenio-oaiserver
invenio_oaiserver/query.py
get_affected_records
def get_affected_records(spec=None, search_pattern=None): """Get list of affected records. :param spec: The record spec. :param search_pattern: The search pattern. :returns: An iterator to lazily find results. """ # spec pattern query # ---------- ---------- ------- # None ...
python
def get_affected_records(spec=None, search_pattern=None): """Get list of affected records. :param spec: The record spec. :param search_pattern: The search pattern. :returns: An iterator to lazily find results. """ # spec pattern query # ---------- ---------- ------- # None ...
[ "def", "get_affected_records", "(", "spec", "=", "None", ",", "search_pattern", "=", "None", ")", ":", "# spec pattern query", "# ---------- ---------- -------", "# None None None", "# None Y Y", "# X None X", "# X '' ...
Get list of affected records. :param spec: The record spec. :param search_pattern: The search pattern. :returns: An iterator to lazily find results.
[ "Get", "list", "of", "affected", "records", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/query.py#L39-L70
inveniosoftware/invenio-oaiserver
invenio_oaiserver/query.py
get_records
def get_records(**kwargs): """Get records paginated.""" page_ = kwargs.get('resumptionToken', {}).get('page', 1) size_ = current_app.config['OAISERVER_PAGE_SIZE'] scroll = current_app.config['OAISERVER_RESUMPTION_TOKEN_EXPIRE_TIME'] scroll_id = kwargs.get('resumptionToken', {}).get('scroll_id') ...
python
def get_records(**kwargs): """Get records paginated.""" page_ = kwargs.get('resumptionToken', {}).get('page', 1) size_ = current_app.config['OAISERVER_PAGE_SIZE'] scroll = current_app.config['OAISERVER_RESUMPTION_TOKEN_EXPIRE_TIME'] scroll_id = kwargs.get('resumptionToken', {}).get('scroll_id') ...
[ "def", "get_records", "(", "*", "*", "kwargs", ")", ":", "page_", "=", "kwargs", ".", "get", "(", "'resumptionToken'", ",", "{", "}", ")", ".", "get", "(", "'page'", ",", "1", ")", "size_", "=", "current_app", ".", "config", "[", "'OAISERVER_PAGE_SIZE'...
Get records paginated.
[ "Get", "records", "paginated", "." ]
train
https://github.com/inveniosoftware/invenio-oaiserver/blob/eae765e32bd816ddc5612d4b281caf205518b512/invenio_oaiserver/query.py#L73-L151
AaronWatters/jp_proxy_widget
jp_proxy_widget/js_context.py
get_file_path
def get_file_path(filename, local=True, relative_to_module=None, my_dir=my_dir): """ Look for an existing path matching filename. Try to resolve relative to the module location if the path cannot by found using "normal" resolution. """ # override my_dir if module is provided if relative_to_m...
python
def get_file_path(filename, local=True, relative_to_module=None, my_dir=my_dir): """ Look for an existing path matching filename. Try to resolve relative to the module location if the path cannot by found using "normal" resolution. """ # override my_dir if module is provided if relative_to_m...
[ "def", "get_file_path", "(", "filename", ",", "local", "=", "True", ",", "relative_to_module", "=", "None", ",", "my_dir", "=", "my_dir", ")", ":", "# override my_dir if module is provided", "if", "relative_to_module", "is", "not", "None", ":", "my_dir", "=", "o...
Look for an existing path matching filename. Try to resolve relative to the module location if the path cannot by found using "normal" resolution.
[ "Look", "for", "an", "existing", "path", "matching", "filename", ".", "Try", "to", "resolve", "relative", "to", "the", "module", "location", "if", "the", "path", "cannot", "by", "found", "using", "normal", "resolution", "." ]
train
https://github.com/AaronWatters/jp_proxy_widget/blob/e53789c9b8a587e2f6e768d16b68e0ae5b3790d9/jp_proxy_widget/js_context.py#L19-L37