repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
mosesschwartz/scrypture
scrypture/webapi.py
password_input
def password_input(*args, **kwargs): ''' Get a password ''' password_input = wtforms.PasswordField(*args, **kwargs) password_input.input_type = 'password' return password_input
python
def password_input(*args, **kwargs): ''' Get a password ''' password_input = wtforms.PasswordField(*args, **kwargs) password_input.input_type = 'password' return password_input
[ "def", "password_input", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "password_input", "=", "wtforms", ".", "PasswordField", "(", "*", "args", ",", "*", "*", "kwargs", ")", "password_input", ".", "input_type", "=", "'password'", "return", "passwor...
Get a password
[ "Get", "a", "password" ]
train
https://github.com/mosesschwartz/scrypture/blob/d51eb0c9835a5122a655078268185ce8ab9ec86a/scrypture/webapi.py#L32-L38
mosesschwartz/scrypture
scrypture/webapi.py
radio_field
def radio_field(*args, **kwargs): ''' Get a password ''' radio_field = wtforms.RadioField(*args, **kwargs) radio_field.input_type = 'radio_field' return radio_field
python
def radio_field(*args, **kwargs): ''' Get a password ''' radio_field = wtforms.RadioField(*args, **kwargs) radio_field.input_type = 'radio_field' return radio_field
[ "def", "radio_field", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "radio_field", "=", "wtforms", ".", "RadioField", "(", "*", "args", ",", "*", "*", "kwargs", ")", "radio_field", ".", "input_type", "=", "'radio_field'", "return", "radio_field" ]
Get a password
[ "Get", "a", "password" ]
train
https://github.com/mosesschwartz/scrypture/blob/d51eb0c9835a5122a655078268185ce8ab9ec86a/scrypture/webapi.py#L40-L46
mosesschwartz/scrypture
scrypture/webapi.py
submit_button
def submit_button(*args, **kwargs): ''' Create a submit button ''' submit_button = wtforms.SubmitField(*args, **kwargs) submit_button.input_type = 'submit_button' return submit_button
python
def submit_button(*args, **kwargs): ''' Create a submit button ''' submit_button = wtforms.SubmitField(*args, **kwargs) submit_button.input_type = 'submit_button' return submit_button
[ "def", "submit_button", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "submit_button", "=", "wtforms", ".", "SubmitField", "(", "*", "args", ",", "*", "*", "kwargs", ")", "submit_button", ".", "input_type", "=", "'submit_button'", "return", "submit_...
Create a submit button
[ "Create", "a", "submit", "button" ]
train
https://github.com/mosesschwartz/scrypture/blob/d51eb0c9835a5122a655078268185ce8ab9ec86a/scrypture/webapi.py#L48-L54
mosesschwartz/scrypture
scrypture/webapi.py
multiple_input
def multiple_input(*args, **kwargs): ''' Multiline input ''' multiline_input = wtforms.SelectMultipleField(*args, **kwargs) multiline_input.input_type = 'multiline' return multiline_input
python
def multiple_input(*args, **kwargs): ''' Multiline input ''' multiline_input = wtforms.SelectMultipleField(*args, **kwargs) multiline_input.input_type = 'multiline' return multiline_input
[ "def", "multiple_input", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "multiline_input", "=", "wtforms", ".", "SelectMultipleField", "(", "*", "args", ",", "*", "*", "kwargs", ")", "multiline_input", ".", "input_type", "=", "'multiline'", "return", ...
Multiline input
[ "Multiline", "input" ]
train
https://github.com/mosesschwartz/scrypture/blob/d51eb0c9835a5122a655078268185ce8ab9ec86a/scrypture/webapi.py#L56-L62
mosesschwartz/scrypture
scrypture/webapi.py
checkbox_field
def checkbox_field(*args, **kwargs): ''' Checkbox field ''' checkbox_field = wtforms.BooleanField(*args, **kwargs) checkbox_field.input_type = 'checkbox_field' return checkbox_field
python
def checkbox_field(*args, **kwargs): ''' Checkbox field ''' checkbox_field = wtforms.BooleanField(*args, **kwargs) checkbox_field.input_type = 'checkbox_field' return checkbox_field
[ "def", "checkbox_field", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "checkbox_field", "=", "wtforms", ".", "BooleanField", "(", "*", "args", ",", "*", "*", "kwargs", ")", "checkbox_field", ".", "input_type", "=", "'checkbox_field'", "return", "ch...
Checkbox field
[ "Checkbox", "field" ]
train
https://github.com/mosesschwartz/scrypture/blob/d51eb0c9835a5122a655078268185ce8ab9ec86a/scrypture/webapi.py#L64-L70
mosesschwartz/scrypture
scrypture/webapi.py
file_field
def file_field(*args, **kwargs): ''' File field ''' file_field = wtforms.FileField(*args, **kwargs) file_field.input_type = 'file_field' return file_field
python
def file_field(*args, **kwargs): ''' File field ''' file_field = wtforms.FileField(*args, **kwargs) file_field.input_type = 'file_field' return file_field
[ "def", "file_field", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "file_field", "=", "wtforms", ".", "FileField", "(", "*", "args", ",", "*", "*", "kwargs", ")", "file_field", ".", "input_type", "=", "'file_field'", "return", "file_field" ]
File field
[ "File", "field" ]
train
https://github.com/mosesschwartz/scrypture/blob/d51eb0c9835a5122a655078268185ce8ab9ec86a/scrypture/webapi.py#L72-L78
pyrapt/rapt
rapt/treebrd/grammars/extended_grammar.py
ExtendedGrammar.theta_join
def theta_join(self): """ select_expr ::= select param_start conditions param_stop expression """ long = self.parametrize(self.syntax.theta_join_op, self.conditions) short = self.parametrize(self.syntax.join_op, self.conditions).\ setParseAction(self.theta_parse_actio...
python
def theta_join(self): """ select_expr ::= select param_start conditions param_stop expression """ long = self.parametrize(self.syntax.theta_join_op, self.conditions) short = self.parametrize(self.syntax.join_op, self.conditions).\ setParseAction(self.theta_parse_actio...
[ "def", "theta_join", "(", "self", ")", ":", "long", "=", "self", ".", "parametrize", "(", "self", ".", "syntax", ".", "theta_join_op", ",", "self", ".", "conditions", ")", "short", "=", "self", ".", "parametrize", "(", "self", ".", "syntax", ".", "join...
select_expr ::= select param_start conditions param_stop expression
[ "select_expr", "::", "=", "select", "param_start", "conditions", "param_stop", "expression" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/treebrd/grammars/extended_grammar.py#L22-L29
bninja/pwho
pwho/__init__.py
parse_line
def parse_line(line): """ Parses a byte string like: PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n to a `ProxyInfo`. """ if not line.startswith(b'PROXY'): raise exc.InvalidLine('Missing "PROXY" prefix', line) if not line.endswith(CRLF): raise exc.InvalidLine('Missing...
python
def parse_line(line): """ Parses a byte string like: PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n to a `ProxyInfo`. """ if not line.startswith(b'PROXY'): raise exc.InvalidLine('Missing "PROXY" prefix', line) if not line.endswith(CRLF): raise exc.InvalidLine('Missing...
[ "def", "parse_line", "(", "line", ")", ":", "if", "not", "line", ".", "startswith", "(", "b'PROXY'", ")", ":", "raise", "exc", ".", "InvalidLine", "(", "'Missing \"PROXY\" prefix'", ",", "line", ")", "if", "not", "line", ".", "endswith", "(", "CRLF", ")"...
Parses a byte string like: PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n to a `ProxyInfo`.
[ "Parses", "a", "byte", "string", "like", ":" ]
train
https://github.com/bninja/pwho/blob/7ade559087e5fb687fa5af19fd0b48352525aeb2/pwho/__init__.py#L222-L264
bninja/pwho
pwho/__init__.py
StreamRequestMixin.proxy_protocol
def proxy_protocol(self, error='raise', default=None, limit=None, authenticate=False): """ Parses, and optionally authenticates, proxy protocol information from request. Note that ``self.request`` is wrapped by ``SocketBuffer``. :param error: How read (``exc.ReadError``) and...
python
def proxy_protocol(self, error='raise', default=None, limit=None, authenticate=False): """ Parses, and optionally authenticates, proxy protocol information from request. Note that ``self.request`` is wrapped by ``SocketBuffer``. :param error: How read (``exc.ReadError``) and...
[ "def", "proxy_protocol", "(", "self", ",", "error", "=", "'raise'", ",", "default", "=", "None", ",", "limit", "=", "None", ",", "authenticate", "=", "False", ")", ":", "if", "error", "not", "in", "(", "'raise'", ",", "'unread'", ")", ":", "raise", "...
Parses, and optionally authenticates, proxy protocol information from request. Note that ``self.request`` is wrapped by ``SocketBuffer``. :param error: How read (``exc.ReadError``) and parse (``exc.ParseError``) errors are handled. One of: - "raise" to propagate. ...
[ "Parses", "and", "optionally", "authenticates", "proxy", "protocol", "information", "from", "request", ".", "Note", "that", "self", ".", "request", "is", "wrapped", "by", "SocketBuffer", "." ]
train
https://github.com/bninja/pwho/blob/7ade559087e5fb687fa5af19fd0b48352525aeb2/pwho/__init__.py#L96-L144
teddychoi/BynamoDB
bynamodb/model.py
Model.create_table
def create_table(cls, read_throughput=5, write_throughput=5): """Create the table as the schema definition.""" table_name = cls.get_table_name() raw_throughput = { 'ReadCapacityUnits': read_throughput, 'WriteCapacityUnits': write_throughput } table_schem...
python
def create_table(cls, read_throughput=5, write_throughput=5): """Create the table as the schema definition.""" table_name = cls.get_table_name() raw_throughput = { 'ReadCapacityUnits': read_throughput, 'WriteCapacityUnits': write_throughput } table_schem...
[ "def", "create_table", "(", "cls", ",", "read_throughput", "=", "5", ",", "write_throughput", "=", "5", ")", ":", "table_name", "=", "cls", ".", "get_table_name", "(", ")", "raw_throughput", "=", "{", "'ReadCapacityUnits'", ":", "read_throughput", ",", "'Write...
Create the table as the schema definition.
[ "Create", "the", "table", "as", "the", "schema", "definition", "." ]
train
https://github.com/teddychoi/BynamoDB/blob/9b143d0554c89fb8edbfb99db5542e48bd126b39/bynamodb/model.py#L103-L139
teddychoi/BynamoDB
bynamodb/model.py
Model.get_item
def get_item(cls, hash_key, range_key=None): """ Get item from the table.""" key = cls._encode_key(hash_key, range_key) raw_data = cls._get_connection().get_item(cls.get_table_name(), key) if 'Item' not in raw_data: raise ItemNotFoundException return cls.from_raw_data...
python
def get_item(cls, hash_key, range_key=None): """ Get item from the table.""" key = cls._encode_key(hash_key, range_key) raw_data = cls._get_connection().get_item(cls.get_table_name(), key) if 'Item' not in raw_data: raise ItemNotFoundException return cls.from_raw_data...
[ "def", "get_item", "(", "cls", ",", "hash_key", ",", "range_key", "=", "None", ")", ":", "key", "=", "cls", ".", "_encode_key", "(", "hash_key", ",", "range_key", ")", "raw_data", "=", "cls", ".", "_get_connection", "(", ")", ".", "get_item", "(", "cls...
Get item from the table.
[ "Get", "item", "from", "the", "table", "." ]
train
https://github.com/teddychoi/BynamoDB/blob/9b143d0554c89fb8edbfb99db5542e48bd126b39/bynamodb/model.py#L158-L164
teddychoi/BynamoDB
bynamodb/model.py
Model.update_item
def update_item(cls, hash_key, range_key=None, attributes_to_set=None, attributes_to_add=None): """Update item attributes. Currently SET and ADD actions are supported.""" primary_key = cls._encode_key(hash_key, range_key) value_names = {} encoded_values = {} dynamizer = Dynamize...
python
def update_item(cls, hash_key, range_key=None, attributes_to_set=None, attributes_to_add=None): """Update item attributes. Currently SET and ADD actions are supported.""" primary_key = cls._encode_key(hash_key, range_key) value_names = {} encoded_values = {} dynamizer = Dynamize...
[ "def", "update_item", "(", "cls", ",", "hash_key", ",", "range_key", "=", "None", ",", "attributes_to_set", "=", "None", ",", "attributes_to_add", "=", "None", ")", ":", "primary_key", "=", "cls", ".", "_encode_key", "(", "hash_key", ",", "range_key", ")", ...
Update item attributes. Currently SET and ADD actions are supported.
[ "Update", "item", "attributes", ".", "Currently", "SET", "and", "ADD", "actions", "are", "supported", "." ]
train
https://github.com/teddychoi/BynamoDB/blob/9b143d0554c89fb8edbfb99db5542e48bd126b39/bynamodb/model.py#L167-L205
teddychoi/BynamoDB
bynamodb/model.py
Model.query
def query(cls, index_name=None, filter_builder=None, scan_index_forward=None, limit=None, **key_conditions): """High level query API. :param key_filter: key conditions of the query. :type key_filter: :class:`collections.Mapping` :param filter_builder: filter expression bui...
python
def query(cls, index_name=None, filter_builder=None, scan_index_forward=None, limit=None, **key_conditions): """High level query API. :param key_filter: key conditions of the query. :type key_filter: :class:`collections.Mapping` :param filter_builder: filter expression bui...
[ "def", "query", "(", "cls", ",", "index_name", "=", "None", ",", "filter_builder", "=", "None", ",", "scan_index_forward", "=", "None", ",", "limit", "=", "None", ",", "*", "*", "key_conditions", ")", ":", "query_kwargs", "=", "{", "'key_conditions'", ":",...
High level query API. :param key_filter: key conditions of the query. :type key_filter: :class:`collections.Mapping` :param filter_builder: filter expression builder. :type filter_builder: :class:`~bynamodb.filterexps.Operator`
[ "High", "level", "query", "API", "." ]
train
https://github.com/teddychoi/BynamoDB/blob/9b143d0554c89fb8edbfb99db5542e48bd126b39/bynamodb/model.py#L208-L225
teddychoi/BynamoDB
bynamodb/model.py
Model.scan
def scan(cls, filter_builder=None, **scan_filter): """High level scan API. :param filter_builder: filter expression builder. :type filter_builder: :class:`~bynamodb.filterexps.Operator` """ scan_kwargs = {'scan_filter': build_condition(scan_filter)} if filter_builder: ...
python
def scan(cls, filter_builder=None, **scan_filter): """High level scan API. :param filter_builder: filter expression builder. :type filter_builder: :class:`~bynamodb.filterexps.Operator` """ scan_kwargs = {'scan_filter': build_condition(scan_filter)} if filter_builder: ...
[ "def", "scan", "(", "cls", ",", "filter_builder", "=", "None", ",", "*", "*", "scan_filter", ")", ":", "scan_kwargs", "=", "{", "'scan_filter'", ":", "build_condition", "(", "scan_filter", ")", "}", "if", "filter_builder", ":", "cls", ".", "_build_filter_exp...
High level scan API. :param filter_builder: filter expression builder. :type filter_builder: :class:`~bynamodb.filterexps.Operator`
[ "High", "level", "scan", "API", "." ]
train
https://github.com/teddychoi/BynamoDB/blob/9b143d0554c89fb8edbfb99db5542e48bd126b39/bynamodb/model.py#L228-L238
teddychoi/BynamoDB
bynamodb/model.py
Model.from_raw_data
def from_raw_data(cls, item_raw): """Translate the raw item data from the DynamoDBConnection to the item object. """ deserialized = {} for name, value in item_raw.items(): attr = getattr(cls, name, None) if attr is None: continue ...
python
def from_raw_data(cls, item_raw): """Translate the raw item data from the DynamoDBConnection to the item object. """ deserialized = {} for name, value in item_raw.items(): attr = getattr(cls, name, None) if attr is None: continue ...
[ "def", "from_raw_data", "(", "cls", ",", "item_raw", ")", ":", "deserialized", "=", "{", "}", "for", "name", ",", "value", "in", "item_raw", ".", "items", "(", ")", ":", "attr", "=", "getattr", "(", "cls", ",", "name", ",", "None", ")", "if", "attr...
Translate the raw item data from the DynamoDBConnection to the item object.
[ "Translate", "the", "raw", "item", "data", "from", "the", "DynamoDBConnection", "to", "the", "item", "object", "." ]
train
https://github.com/teddychoi/BynamoDB/blob/9b143d0554c89fb8edbfb99db5542e48bd126b39/bynamodb/model.py#L265-L276
childsish/sofia
sofia/step/step.py
Step.consume_input
def consume_input(self, input): """ Make a copy of the input for the run function and consume the input to free up the queue for more input. If all input is consumed, there is no need to overload this function. Input is provided as lists. To copy and consume input the following commands ...
python
def consume_input(self, input): """ Make a copy of the input for the run function and consume the input to free up the queue for more input. If all input is consumed, there is no need to overload this function. Input is provided as lists. To copy and consume input the following commands ...
[ "def", "consume_input", "(", "self", ",", "input", ")", ":", "copy", "=", "{", "}", "for", "key", "in", "input", ":", "copy", "[", "key", "]", "=", "input", "[", "key", "]", "[", ":", "]", "del", "input", "[", "key", "]", "[", ":", "]", "retu...
Make a copy of the input for the run function and consume the input to free up the queue for more input. If all input is consumed, there is no need to overload this function. Input is provided as lists. To copy and consume input the following commands can be run: 1. To consume all the input ...
[ "Make", "a", "copy", "of", "the", "input", "for", "the", "run", "function", "and", "consume", "the", "input", "to", "free", "up", "the", "queue", "for", "more", "input", ".", "If", "all", "input", "is", "consumed", "there", "is", "no", "need", "to", ...
train
https://github.com/childsish/sofia/blob/39b992f143e2610a62ad751568caa5ca9aaf0224/sofia/step/step.py#L11-L34
uw-it-aca/uw-restclients
restclients/bridge/custom_field.py
new_regid_custom_field
def new_regid_custom_field(uwregid): """ Return a BridgeCustomField object for REGID to be used in a POST, PATCH request """ return BridgeCustomField( field_id=get_regid_field_id(), name=BridgeCustomField.REGID_NAME, value=uwregid )
python
def new_regid_custom_field(uwregid): """ Return a BridgeCustomField object for REGID to be used in a POST, PATCH request """ return BridgeCustomField( field_id=get_regid_field_id(), name=BridgeCustomField.REGID_NAME, value=uwregid )
[ "def", "new_regid_custom_field", "(", "uwregid", ")", ":", "return", "BridgeCustomField", "(", "field_id", "=", "get_regid_field_id", "(", ")", ",", "name", "=", "BridgeCustomField", ".", "REGID_NAME", ",", "value", "=", "uwregid", ")" ]
Return a BridgeCustomField object for REGID to be used in a POST, PATCH request
[ "Return", "a", "BridgeCustomField", "object", "for", "REGID", "to", "be", "used", "in", "a", "POST", "PATCH", "request" ]
train
https://github.com/uw-it-aca/uw-restclients/blob/e12dcd32bf5296b6ebdf71798031594afb7852cb/restclients/bridge/custom_field.py#L42-L51
andycasey/sick
sick/specutils/spectrum1d.py
Spectrum1D.copy
def copy(self): """ Creates a copy of the object """ variance = self.variance.copy() if self.variance is not None else None headers = self.headers.copy() if self.headers is not None else None return self.__class__(self.disp.copy(), self.flux.copy(), variance=variance, headers...
python
def copy(self): """ Creates a copy of the object """ variance = self.variance.copy() if self.variance is not None else None headers = self.headers.copy() if self.headers is not None else None return self.__class__(self.disp.copy(), self.flux.copy(), variance=variance, headers...
[ "def", "copy", "(", "self", ")", ":", "variance", "=", "self", ".", "variance", ".", "copy", "(", ")", "if", "self", ".", "variance", "is", "not", "None", "else", "None", "headers", "=", "self", ".", "headers", ".", "copy", "(", ")", "if", "self", ...
Creates a copy of the object
[ "Creates", "a", "copy", "of", "the", "object" ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/specutils/spectrum1d.py#L79-L84
andycasey/sick
sick/specutils/spectrum1d.py
Spectrum1D.load
def load(cls, filename, **kwargs): """Load a Spectrum1D from a given filename. :param filename: The path of the filename to load. Can be either simple 1D FITS files or an ASCII filename. :type filename: str """ if not os.path...
python
def load(cls, filename, **kwargs): """Load a Spectrum1D from a given filename. :param filename: The path of the filename to load. Can be either simple 1D FITS files or an ASCII filename. :type filename: str """ if not os.path...
[ "def", "load", "(", "cls", ",", "filename", ",", "*", "*", "kwargs", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "raise", "IOError", "(", "\"filename {0} does not exist\"", ".", "format", "(", "filename", ")", ")...
Load a Spectrum1D from a given filename. :param filename: The path of the filename to load. Can be either simple 1D FITS files or an ASCII filename. :type filename: str
[ "Load", "a", "Spectrum1D", "from", "a", "given", "filename", ".", ":", "param", "filename", ":", "The", "path", "of", "the", "filename", "to", "load", ".", "Can", "be", "either", "simple", "1D", "FITS", "files", "or", "an", "ASCII", "filename", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/specutils/spectrum1d.py#L88-L184
andycasey/sick
sick/specutils/spectrum1d.py
Spectrum1D.save
def save(self, filename, clobber=True, **kwargs): """ Save the `Spectrum1D` object to the specified filename. :param filename: The filename to save the Spectrum1D object to. :type filename: str :param clobber: [optional] Whether to o...
python
def save(self, filename, clobber=True, **kwargs): """ Save the `Spectrum1D` object to the specified filename. :param filename: The filename to save the Spectrum1D object to. :type filename: str :param clobber: [optional] Whether to o...
[ "def", "save", "(", "self", ",", "filename", ",", "clobber", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", "and", "not", "clobber", ":", "raise", "IOError", "(", "\"filename '{0}' exists a...
Save the `Spectrum1D` object to the specified filename. :param filename: The filename to save the Spectrum1D object to. :type filename: str :param clobber: [optional] Whether to overwrite the `filename` if it already exists. :type clobber: ...
[ "Save", "the", "Spectrum1D", "object", "to", "the", "specified", "filename", ".", ":", "param", "filename", ":", "The", "filename", "to", "save", "the", "Spectrum1D", "object", "to", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/specutils/spectrum1d.py#L187-L243
andycasey/sick
sick/specutils/spectrum1d.py
Spectrum1D.cross_correlate
def cross_correlate(self, templates, **kwargs): """ Cross correlate the spectrum against a set of templates. """ # templates can be: # - a single Spectrum1D object # - (template_dispersion, template_fluxes) # templates can be a single spectrum or a tuple of (dis...
python
def cross_correlate(self, templates, **kwargs): """ Cross correlate the spectrum against a set of templates. """ # templates can be: # - a single Spectrum1D object # - (template_dispersion, template_fluxes) # templates can be a single spectrum or a tuple of (dis...
[ "def", "cross_correlate", "(", "self", ",", "templates", ",", "*", "*", "kwargs", ")", ":", "# templates can be:", "# - a single Spectrum1D object", "# - (template_dispersion, template_fluxes)", "# templates can be a single spectrum or a tuple of (dispersion, fluxes)", "if", "isins...
Cross correlate the spectrum against a set of templates.
[ "Cross", "correlate", "the", "spectrum", "against", "a", "set", "of", "templates", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/specutils/spectrum1d.py#L246-L266
uw-it-aca/uw-restclients
restclients/r25/reservations.py
get_reservations
def get_reservations(**kwargs): """ Return a list of reservations matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/reservations.xml """ kwargs["scope"] = "extended" url = "/r25ws/servlet/wrd/run/reservations.xml" if len(kwargs): ...
python
def get_reservations(**kwargs): """ Return a list of reservations matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/reservations.xml """ kwargs["scope"] = "extended" url = "/r25ws/servlet/wrd/run/reservations.xml" if len(kwargs): ...
[ "def", "get_reservations", "(", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"scope\"", "]", "=", "\"extended\"", "url", "=", "\"/r25ws/servlet/wrd/run/reservations.xml\"", "if", "len", "(", "kwargs", ")", ":", "url", "+=", "\"?%s\"", "%", "urlencode", "(", ...
Return a list of reservations matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/reservations.xml
[ "Return", "a", "list", "of", "reservations", "matching", "the", "passed", "filter", ".", "Supported", "kwargs", "are", "listed", "at", "http", ":", "//", "knowledge25", ".", "collegenet", ".", "com", "/", "display", "/", "WSW", "/", "reservations", ".", "x...
train
https://github.com/uw-it-aca/uw-restclients/blob/e12dcd32bf5296b6ebdf71798031594afb7852cb/restclients/r25/reservations.py#L12-L23
chop-dbhi/varify-data-warehouse
vdw/raw/utils/stream.py
StreamEditor.process_column
def process_column(self, idx, value): "Process a single column." if value is not None: value = str(value).decode(self.encoding) return value
python
def process_column(self, idx, value): "Process a single column." if value is not None: value = str(value).decode(self.encoding) return value
[ "def", "process_column", "(", "self", ",", "idx", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "value", "=", "str", "(", "value", ")", ".", "decode", "(", "self", ".", "encoding", ")", "return", "value" ]
Process a single column.
[ "Process", "a", "single", "column", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/utils/stream.py#L29-L33
chop-dbhi/varify-data-warehouse
vdw/raw/utils/stream.py
StreamEditor.process_line
def process_line(self, line): "Process a single complete line." cleaned = [] columns = line.split(self.indel) # Populate indices if not defined if not self.indices: self.indices = range(len(columns)) for i in self.indices: # Support turning an in c...
python
def process_line(self, line): "Process a single complete line." cleaned = [] columns = line.split(self.indel) # Populate indices if not defined if not self.indices: self.indices = range(len(columns)) for i in self.indices: # Support turning an in c...
[ "def", "process_line", "(", "self", ",", "line", ")", ":", "cleaned", "=", "[", "]", "columns", "=", "line", ".", "split", "(", "self", ".", "indel", ")", "# Populate indices if not defined", "if", "not", "self", ".", "indices", ":", "self", ".", "indice...
Process a single complete line.
[ "Process", "a", "single", "complete", "line", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/utils/stream.py#L35-L49
chop-dbhi/varify-data-warehouse
vdw/raw/utils/stream.py
StreamEditor.read
def read(self, size=-1): "Reads up to size bytes, but always completes the last line." buf = self.fin.read(size) if not buf: return '' lines = buf.splitlines() # Read the rest of the last line if necessary if not buf.endswith('\n'): last = lines.po...
python
def read(self, size=-1): "Reads up to size bytes, but always completes the last line." buf = self.fin.read(size) if not buf: return '' lines = buf.splitlines() # Read the rest of the last line if necessary if not buf.endswith('\n'): last = lines.po...
[ "def", "read", "(", "self", ",", "size", "=", "-", "1", ")", ":", "buf", "=", "self", ".", "fin", ".", "read", "(", "size", ")", "if", "not", "buf", ":", "return", "''", "lines", "=", "buf", ".", "splitlines", "(", ")", "# Read the rest of the last...
Reads up to size bytes, but always completes the last line.
[ "Reads", "up", "to", "size", "bytes", "but", "always", "completes", "the", "last", "line", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/utils/stream.py#L51-L64
chop-dbhi/varify-data-warehouse
vdw/raw/utils/stream.py
StreamEditor.readline
def readline(self, size=-1): "The size is ignored since a complete line must be read." line = self.fin.readline() if not line: return '' return self.process_line(line.rstrip('\n'))
python
def readline(self, size=-1): "The size is ignored since a complete line must be read." line = self.fin.readline() if not line: return '' return self.process_line(line.rstrip('\n'))
[ "def", "readline", "(", "self", ",", "size", "=", "-", "1", ")", ":", "line", "=", "self", ".", "fin", ".", "readline", "(", ")", "if", "not", "line", ":", "return", "''", "return", "self", ".", "process_line", "(", "line", ".", "rstrip", "(", "'...
The size is ignored since a complete line must be read.
[ "The", "size", "is", "ignored", "since", "a", "complete", "line", "must", "be", "read", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/utils/stream.py#L66-L71
chop-dbhi/varify-data-warehouse
vdw/raw/utils/stream.py
VCFStreamEditor.process_line
def process_line(self, record): "Process a single record. This assumes only a single sample output." cleaned = [] for key in self.vcf_fields: out = self.process_column(key, getattr(record, key)) if isinstance(out, (list, tuple)): cleaned.extend(out) ...
python
def process_line(self, record): "Process a single record. This assumes only a single sample output." cleaned = [] for key in self.vcf_fields: out = self.process_column(key, getattr(record, key)) if isinstance(out, (list, tuple)): cleaned.extend(out) ...
[ "def", "process_line", "(", "self", ",", "record", ")", ":", "cleaned", "=", "[", "]", "for", "key", "in", "self", ".", "vcf_fields", ":", "out", "=", "self", ".", "process_column", "(", "key", ",", "getattr", "(", "record", ",", "key", ")", ")", "...
Process a single record. This assumes only a single sample output.
[ "Process", "a", "single", "record", ".", "This", "assumes", "only", "a", "single", "sample", "output", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/utils/stream.py#L99-L117
chop-dbhi/varify-data-warehouse
vdw/raw/utils/stream.py
VCFStreamEditor.read
def read(self, size=-1): """Read `size` bytes from the reader relative to the parsed output. This is generally acceptable in practice since VCF lines are condensed, but if the output line <<< record, this means the actual memory used will be much greater than `size`. """ ...
python
def read(self, size=-1): """Read `size` bytes from the reader relative to the parsed output. This is generally acceptable in practice since VCF lines are condensed, but if the output line <<< record, this means the actual memory used will be much greater than `size`. """ ...
[ "def", "read", "(", "self", ",", "size", "=", "-", "1", ")", ":", "lines", "=", "[", "]", "parsed_size", "=", "0", "while", "True", ":", "line", "=", "self", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "lines", ".", "append", ...
Read `size` bytes from the reader relative to the parsed output. This is generally acceptable in practice since VCF lines are condensed, but if the output line <<< record, this means the actual memory used will be much greater than `size`.
[ "Read", "size", "bytes", "from", "the", "reader", "relative", "to", "the", "parsed", "output", ".", "This", "is", "generally", "acceptable", "in", "practice", "since", "VCF", "lines", "are", "condensed", "but", "if", "the", "output", "line", "<<<", "record",...
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/utils/stream.py#L119-L137
chop-dbhi/varify-data-warehouse
vdw/raw/utils/stream.py
VCFStreamEditor.readline
def readline(self, size=-1): "Ignore the `size` since a complete line must be processed." try: record = next(self.reader) return self.outdel.join(self.process_line(record)) + '\n' except StopIteration: return ''
python
def readline(self, size=-1): "Ignore the `size` since a complete line must be processed." try: record = next(self.reader) return self.outdel.join(self.process_line(record)) + '\n' except StopIteration: return ''
[ "def", "readline", "(", "self", ",", "size", "=", "-", "1", ")", ":", "try", ":", "record", "=", "next", "(", "self", ".", "reader", ")", "return", "self", ".", "outdel", ".", "join", "(", "self", ".", "process_line", "(", "record", ")", ")", "+"...
Ignore the `size` since a complete line must be processed.
[ "Ignore", "the", "size", "since", "a", "complete", "line", "must", "be", "processed", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/utils/stream.py#L139-L145
draperunner/fjlc
fjlc/classifier/sentence/lexical_parser.py
lexically_parse_tweet
def lexically_parse_tweet(tweet, phrase_tree): """ Returns list of LexicalTokens found in tweet. The list contains all the words in original tweet, but are optimally grouped up to form largest matching n-grams from lexicon. If no match is found, token is added as singleton. @param tweet Tweet ...
python
def lexically_parse_tweet(tweet, phrase_tree): """ Returns list of LexicalTokens found in tweet. The list contains all the words in original tweet, but are optimally grouped up to form largest matching n-grams from lexicon. If no match is found, token is added as singleton. @param tweet Tweet ...
[ "def", "lexically_parse_tweet", "(", "tweet", ",", "phrase_tree", ")", ":", "lexical_tokens", "=", "[", "]", "prev", "=", "0", "while", "True", ":", "match", "=", "RegexFilters", ".", "SENTENCE_END_PUNCTUATION", ".", "search", "(", "tweet", "[", "prev", ":",...
Returns list of LexicalTokens found in tweet. The list contains all the words in original tweet, but are optimally grouped up to form largest matching n-grams from lexicon. If no match is found, token is added as singleton. @param tweet Tweet to lexically parse @param phrase_tree Token tree that c...
[ "Returns", "list", "of", "LexicalTokens", "found", "in", "tweet", ".", "The", "list", "contains", "all", "the", "words", "in", "original", "tweet", "but", "are", "optimally", "grouped", "up", "to", "form", "largest", "matching", "n", "-", "grams", "from", ...
train
https://github.com/draperunner/fjlc/blob/d2cc8cf1244984e7caf0bf95b11ed1677a94c994/fjlc/classifier/sentence/lexical_parser.py#L10-L36
dinoboff/schemabuilder
src/schemabuilder/schema.py
Schema.to_dict
def to_dict(self): """Return the schema as a dict ready to be serialized. """ schema = super(Schema, self).to_dict() schema['$schema'] = "http://json-schema.org/draft-04/schema#" if self._id: schema['id'] = self._id if self._desc: schema['descript...
python
def to_dict(self): """Return the schema as a dict ready to be serialized. """ schema = super(Schema, self).to_dict() schema['$schema'] = "http://json-schema.org/draft-04/schema#" if self._id: schema['id'] = self._id if self._desc: schema['descript...
[ "def", "to_dict", "(", "self", ")", ":", "schema", "=", "super", "(", "Schema", ",", "self", ")", ".", "to_dict", "(", ")", "schema", "[", "'$schema'", "]", "=", "\"http://json-schema.org/draft-04/schema#\"", "if", "self", ".", "_id", ":", "schema", "[", ...
Return the schema as a dict ready to be serialized.
[ "Return", "the", "schema", "as", "a", "dict", "ready", "to", "be", "serialized", "." ]
train
https://github.com/dinoboff/schemabuilder/blob/9b9f3de2528836ad069f458d3d68b1b5f4efbe94/src/schemabuilder/schema.py#L23-L33
dinoboff/schemabuilder
src/schemabuilder/schema.py
Schema.define
def define(self, id, schema): """Add a schema to the list of definition :param id: id of the schema. :param schema: the schema as a dict or a :class:schemabuilder.primitives.Generic :return: reference to schema. :rtype: :class:`schemabuilder.schema.Ref` ...
python
def define(self, id, schema): """Add a schema to the list of definition :param id: id of the schema. :param schema: the schema as a dict or a :class:schemabuilder.primitives.Generic :return: reference to schema. :rtype: :class:`schemabuilder.schema.Ref` ...
[ "def", "define", "(", "self", ",", "id", ",", "schema", ")", ":", "self", ".", "definitions", "[", "id", "]", "=", "schema", "self", ".", "_schema", "=", "None", "return", "self", ".", "ref", "(", "id", ")" ]
Add a schema to the list of definition :param id: id of the schema. :param schema: the schema as a dict or a :class:schemabuilder.primitives.Generic :return: reference to schema. :rtype: :class:`schemabuilder.schema.Ref`
[ "Add", "a", "schema", "to", "the", "list", "of", "definition" ]
train
https://github.com/dinoboff/schemabuilder/blob/9b9f3de2528836ad069f458d3d68b1b5f4efbe94/src/schemabuilder/schema.py#L35-L47
dinoboff/schemabuilder
src/schemabuilder/schema.py
Ref.validate
def validate(self, data): """Validate the data against the schema. """ validator = self._schema.validator(self._id) validator.validate(data)
python
def validate(self, data): """Validate the data against the schema. """ validator = self._schema.validator(self._id) validator.validate(data)
[ "def", "validate", "(", "self", ",", "data", ")", ":", "validator", "=", "self", ".", "_schema", ".", "validator", "(", "self", ".", "_id", ")", "validator", ".", "validate", "(", "data", ")" ]
Validate the data against the schema.
[ "Validate", "the", "data", "against", "the", "schema", "." ]
train
https://github.com/dinoboff/schemabuilder/blob/9b9f3de2528836ad069f458d3d68b1b5f4efbe94/src/schemabuilder/schema.py#L93-L98
conchoecia/gloTK
gloTK/scripts/glotk_sweep.py
MerRunner.meraculous_runner
def meraculous_runner(self): """ Check to make sure that the allAssembliesDir has been created, if not, make it. This will only execute for the first time an assembly has been run in this directory. Run the directory from allAssembliesDir. The self.callString instance at...
python
def meraculous_runner(self): """ Check to make sure that the allAssembliesDir has been created, if not, make it. This will only execute for the first time an assembly has been run in this directory. Run the directory from allAssembliesDir. The self.callString instance at...
[ "def", "meraculous_runner", "(", "self", ")", ":", "#set the dir to temp assembly dir", "os", ".", "chdir", "(", "self", ".", "allAssembliesDir", ")", "print", "(", "self", ".", "callString", ")", "p", "=", "subprocess", ".", "run", "(", "self", ".", "callSt...
Check to make sure that the allAssembliesDir has been created, if not, make it. This will only execute for the first time an assembly has been run in this directory. Run the directory from allAssembliesDir. The self.callString instance attribute tells Meraculous to name the assembly dir...
[ "Check", "to", "make", "sure", "that", "the", "allAssembliesDir", "has", "been", "created", "if", "not", "make", "it", ".", "This", "will", "only", "execute", "for", "the", "first", "time", "an", "assembly", "has", "been", "run", "in", "this", "directory",...
train
https://github.com/conchoecia/gloTK/blob/58abee663fcfbbd09f4863c3ca3ae054e33184a8/gloTK/scripts/glotk_sweep.py#L165-L191
klen/adrest
adrest/mixin/throttle.py
ThrottleMixin.throttle_check
def throttle_check(self): """ Check for throttling. """ throttle = self._meta.throttle() wait = throttle.should_be_throttled(self) if wait: raise HttpError( "Throttled, wait {0} seconds.".format(wait), status=status.HTTP_503_SERVICE_UNAVAILABLE...
python
def throttle_check(self): """ Check for throttling. """ throttle = self._meta.throttle() wait = throttle.should_be_throttled(self) if wait: raise HttpError( "Throttled, wait {0} seconds.".format(wait), status=status.HTTP_503_SERVICE_UNAVAILABLE...
[ "def", "throttle_check", "(", "self", ")", ":", "throttle", "=", "self", ".", "_meta", ".", "throttle", "(", ")", "wait", "=", "throttle", ".", "should_be_throttled", "(", "self", ")", "if", "wait", ":", "raise", "HttpError", "(", "\"Throttled, wait {0} seco...
Check for throttling.
[ "Check", "for", "throttling", "." ]
train
https://github.com/klen/adrest/blob/8b75c67123cffabe5ed98c222bb7ab43c904d89c/adrest/mixin/throttle.py#L34-L41
chop-dbhi/varify-data-warehouse
vdw/variants/pipeline/handlers.py
load_variants
def load_variants(manifest_path, database, **kwargs): "Variant loading requires only a VCF file and will never load a duplicate." manifest = ManifestReader(manifest_path) vcf_info = manifest.section('vcf') # No data regarding VCF if 'file' not in vcf_info: return cursor = connections[...
python
def load_variants(manifest_path, database, **kwargs): "Variant loading requires only a VCF file and will never load a duplicate." manifest = ManifestReader(manifest_path) vcf_info = manifest.section('vcf') # No data regarding VCF if 'file' not in vcf_info: return cursor = connections[...
[ "def", "load_variants", "(", "manifest_path", ",", "database", ",", "*", "*", "kwargs", ")", ":", "manifest", "=", "ManifestReader", "(", "manifest_path", ")", "vcf_info", "=", "manifest", ".", "section", "(", "'vcf'", ")", "# No data regarding VCF", "if", "'f...
Variant loading requires only a VCF file and will never load a duplicate.
[ "Variant", "loading", "requires", "only", "a", "VCF", "file", "and", "will", "never", "load", "a", "duplicate", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/variants/pipeline/handlers.py#L20-L41
chop-dbhi/varify-data-warehouse
vdw/raw/management/subcommands/load.py
LoadCommand.drop_table
def drop_table(self, cursor, target, options): "Drops the target table." sql = 'DROP TABLE IF EXISTS {0}' cursor.execute(sql.format(self.qualified_names[target]))
python
def drop_table(self, cursor, target, options): "Drops the target table." sql = 'DROP TABLE IF EXISTS {0}' cursor.execute(sql.format(self.qualified_names[target]))
[ "def", "drop_table", "(", "self", ",", "cursor", ",", "target", ",", "options", ")", ":", "sql", "=", "'DROP TABLE IF EXISTS {0}'", "cursor", ".", "execute", "(", "sql", ".", "format", "(", "self", ".", "qualified_names", "[", "target", "]", ")", ")" ]
Drops the target table.
[ "Drops", "the", "target", "table", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/management/subcommands/load.py#L90-L93
chop-dbhi/varify-data-warehouse
vdw/raw/management/subcommands/load.py
LoadCommand.create_table
def create_table(self, cursor, target, options): "Creates the target table." cursor.execute( self.create_sql[target].format(self.qualified_names[target]))
python
def create_table(self, cursor, target, options): "Creates the target table." cursor.execute( self.create_sql[target].format(self.qualified_names[target]))
[ "def", "create_table", "(", "self", ",", "cursor", ",", "target", ",", "options", ")", ":", "cursor", ".", "execute", "(", "self", ".", "create_sql", "[", "target", "]", ".", "format", "(", "self", ".", "qualified_names", "[", "target", "]", ")", ")" ]
Creates the target table.
[ "Creates", "the", "target", "table", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/management/subcommands/load.py#L95-L98
chop-dbhi/varify-data-warehouse
vdw/raw/management/subcommands/load.py
LoadCommand.load_files
def load_files(self, cursor, target, files, options): "Loads multiple files into the target table." for fname in files: self.load_file(cursor, target, fname, options)
python
def load_files(self, cursor, target, files, options): "Loads multiple files into the target table." for fname in files: self.load_file(cursor, target, fname, options)
[ "def", "load_files", "(", "self", ",", "cursor", ",", "target", ",", "files", ",", "options", ")", ":", "for", "fname", "in", "files", ":", "self", ".", "load_file", "(", "cursor", ",", "target", ",", "fname", ",", "options", ")" ]
Loads multiple files into the target table.
[ "Loads", "multiple", "files", "into", "the", "target", "table", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/management/subcommands/load.py#L100-L103
chop-dbhi/varify-data-warehouse
vdw/raw/management/subcommands/load.py
LoadCommand.load_file
def load_file(self, cursor, target, fname, options): "Parses and loads a single file into the target table." with open(fname) as fin: log.debug("opening {0} in {1} load_file".format(fname, __name__)) encoding = options.get('encoding', 'utf-8') if target in self.proces...
python
def load_file(self, cursor, target, fname, options): "Parses and loads a single file into the target table." with open(fname) as fin: log.debug("opening {0} in {1} load_file".format(fname, __name__)) encoding = options.get('encoding', 'utf-8') if target in self.proces...
[ "def", "load_file", "(", "self", ",", "cursor", ",", "target", ",", "fname", ",", "options", ")", ":", "with", "open", "(", "fname", ")", "as", "fin", ":", "log", ".", "debug", "(", "\"opening {0} in {1} load_file\"", ".", "format", "(", "fname", ",", ...
Parses and loads a single file into the target table.
[ "Parses", "and", "loads", "a", "single", "file", "into", "the", "target", "table", "." ]
train
https://github.com/chop-dbhi/varify-data-warehouse/blob/1600ee1bc5fae6c68fd03b23624467298570cca8/vdw/raw/management/subcommands/load.py#L105-L118
JNRowe/upoints
upoints/cellid.py
Cells.import_locations
def import_locations(self, cells_file): """Parse OpenCellID.org data files. ``import_locations()`` returns a dictionary with keys containing the OpenCellID.org_ database identifier, and values consisting of a ``Cell`` objects. It expects cell files in the following format:: ...
python
def import_locations(self, cells_file): """Parse OpenCellID.org data files. ``import_locations()`` returns a dictionary with keys containing the OpenCellID.org_ database identifier, and values consisting of a ``Cell`` objects. It expects cell files in the following format:: ...
[ "def", "import_locations", "(", "self", ",", "cells_file", ")", ":", "self", ".", "_cells_file", "=", "cells_file", "field_names", "=", "(", "'ident'", ",", "'latitude'", ",", "'longitude'", ",", "'mcc'", ",", "'mnc'", ",", "'lac'", ",", "'cellid'", ",", "...
Parse OpenCellID.org data files. ``import_locations()`` returns a dictionary with keys containing the OpenCellID.org_ database identifier, and values consisting of a ``Cell`` objects. It expects cell files in the following format:: 22747,52.0438995361328,-0.2246370017529,2...
[ "Parse", "OpenCellID", ".", "org", "data", "files", "." ]
train
https://github.com/JNRowe/upoints/blob/1e4b7a53ed2a06cd854523d54c36aabdccea3830/upoints/cellid.py#L105-L165
nicholasbishop/shaderdef
shaderdef/py_to_glsl.py
op_symbol
def op_symbol(op_node): """Get the GLSL symbol for a Python operator.""" ops = { # TODO(nicholasbishop): other unary ops ast.UAdd: '+', ast.USub: '-', # TODO(nicholasbishop): FloorDiv, Pow, LShift, RShift, # BitOr, BitXor, BitAnd ast.Add: '+', ast.Sub: '-...
python
def op_symbol(op_node): """Get the GLSL symbol for a Python operator.""" ops = { # TODO(nicholasbishop): other unary ops ast.UAdd: '+', ast.USub: '-', # TODO(nicholasbishop): FloorDiv, Pow, LShift, RShift, # BitOr, BitXor, BitAnd ast.Add: '+', ast.Sub: '-...
[ "def", "op_symbol", "(", "op_node", ")", ":", "ops", "=", "{", "# TODO(nicholasbishop): other unary ops", "ast", ".", "UAdd", ":", "'+'", ",", "ast", ".", "USub", ":", "'-'", ",", "# TODO(nicholasbishop): FloorDiv, Pow, LShift, RShift,", "# BitOr, BitXor, BitAnd", "as...
Get the GLSL symbol for a Python operator.
[ "Get", "the", "GLSL", "symbol", "for", "a", "Python", "operator", "." ]
train
https://github.com/nicholasbishop/shaderdef/blob/b68a9faf4c7cfa61e32a2e49eb2cae2f2e2b1f78/shaderdef/py_to_glsl.py#L27-L53
nicholasbishop/shaderdef
shaderdef/py_to_glsl.py
py_to_glsl
def py_to_glsl(root): """Translate Python AST into GLSL code. root: an ast.FunctionDef object Return a list of strings, where each string is a line of GLSL code. """ atg = AstToGlsl() code = atg.visit(root) return code.lines
python
def py_to_glsl(root): """Translate Python AST into GLSL code. root: an ast.FunctionDef object Return a list of strings, where each string is a line of GLSL code. """ atg = AstToGlsl() code = atg.visit(root) return code.lines
[ "def", "py_to_glsl", "(", "root", ")", ":", "atg", "=", "AstToGlsl", "(", ")", "code", "=", "atg", ".", "visit", "(", "root", ")", "return", "code", ".", "lines" ]
Translate Python AST into GLSL code. root: an ast.FunctionDef object Return a list of strings, where each string is a line of GLSL code.
[ "Translate", "Python", "AST", "into", "GLSL", "code", "." ]
train
https://github.com/nicholasbishop/shaderdef/blob/b68a9faf4c7cfa61e32a2e49eb2cae2f2e2b1f78/shaderdef/py_to_glsl.py#L234-L244
yufeiminds/toolkit
toolkit/filetype.py
filedet
def filedet(name, fobj=None, suffix=None): """ Detect file type by filename. :param name: file name :param fobj: file object :param suffix: file suffix like ``py``, ``.py`` :return: file type full name, such as ``python``, ``bash`` """ name = name or (fobj and fobj.name) or suffix s...
python
def filedet(name, fobj=None, suffix=None): """ Detect file type by filename. :param name: file name :param fobj: file object :param suffix: file suffix like ``py``, ``.py`` :return: file type full name, such as ``python``, ``bash`` """ name = name or (fobj and fobj.name) or suffix s...
[ "def", "filedet", "(", "name", ",", "fobj", "=", "None", ",", "suffix", "=", "None", ")", ":", "name", "=", "name", "or", "(", "fobj", "and", "fobj", ".", "name", ")", "or", "suffix", "separated", "=", "name", ".", "split", "(", "'.'", ")", "if",...
Detect file type by filename. :param name: file name :param fobj: file object :param suffix: file suffix like ``py``, ``.py`` :return: file type full name, such as ``python``, ``bash``
[ "Detect", "file", "type", "by", "filename", "." ]
train
https://github.com/yufeiminds/toolkit/blob/2d3986f2711f0ee9ee9cd75c25752ef4d0f42ff7/toolkit/filetype.py#L23-L38
andycasey/sick
sick/models/utils.py
update_recursively
def update_recursively(original, new): """ Recursively update a nested dictionary. :param original: The original nested dictionary to update. :type original: dict :param new: The nested dictionary to use to update the original. :type new: dict :return...
python
def update_recursively(original, new): """ Recursively update a nested dictionary. :param original: The original nested dictionary to update. :type original: dict :param new: The nested dictionary to use to update the original. :type new: dict :return...
[ "def", "update_recursively", "(", "original", ",", "new", ")", ":", "for", "k", ",", "v", "in", "new", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "v", ",", "collections", ".", "Mapping", ")", "and", "isinstance", "(", "original", ".", ...
Recursively update a nested dictionary. :param original: The original nested dictionary to update. :type original: dict :param new: The nested dictionary to use to update the original. :type new: dict :returns: The updated original dictionary. :r...
[ "Recursively", "update", "a", "nested", "dictionary", ".", ":", "param", "original", ":", "The", "original", "nested", "dictionary", "to", "update", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/utils.py#L19-L49
andycasey/sick
sick/models/utils.py
unique_preserved_list
def unique_preserved_list(original_list): """ Return the unique items of a list in their original order. :param original_list: A list of items that may have duplicate entries. :type original_list: list :returns: A list with unique entries with the original order preserved....
python
def unique_preserved_list(original_list): """ Return the unique items of a list in their original order. :param original_list: A list of items that may have duplicate entries. :type original_list: list :returns: A list with unique entries with the original order preserved....
[ "def", "unique_preserved_list", "(", "original_list", ")", ":", "seen", "=", "set", "(", ")", "seen_add", "=", "seen", ".", "add", "return", "[", "x", "for", "x", "in", "original_list", "if", "x", "not", "in", "seen", "and", "not", "seen_add", "(", "x"...
Return the unique items of a list in their original order. :param original_list: A list of items that may have duplicate entries. :type original_list: list :returns: A list with unique entries with the original order preserved. :rtype: list
[ "Return", "the", "unique", "items", "of", "a", "list", "in", "their", "original", "order", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/utils.py#L52-L71
andycasey/sick
sick/models/utils.py
human_readable_digit
def human_readable_digit(number): """ Return a digit in a human-readable string form. :param number: The obfuscated number. :type number: float :returns: A more human-readable version of the input number. :rtype: str """ if 0 >= number: return...
python
def human_readable_digit(number): """ Return a digit in a human-readable string form. :param number: The obfuscated number. :type number: float :returns: A more human-readable version of the input number. :rtype: str """ if 0 >= number: return...
[ "def", "human_readable_digit", "(", "number", ")", ":", "if", "0", ">=", "number", ":", "return", "\"{0:.1f} \"", ".", "format", "(", "number", ")", "word", "=", "[", "\"\"", ",", "\"thousand\"", ",", "\"million\"", ",", "\"billion\"", ",", "\"trillion\"", ...
Return a digit in a human-readable string form. :param number: The obfuscated number. :type number: float :returns: A more human-readable version of the input number. :rtype: str
[ "Return", "a", "digit", "in", "a", "human", "-", "readable", "string", "form", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/utils.py#L74-L96
andycasey/sick
sick/models/utils.py
estimate_tau_exp
def estimate_tau_exp(chains, **kwargs): """ Estimate the exponential auto-correlation time for all parameters in a chain. """ # Calculate the normalised autocorrelation function in each parameter. rho = np.nan * np.ones(chains.shape[1:]) for i in range(chains.shape[2]): try: ...
python
def estimate_tau_exp(chains, **kwargs): """ Estimate the exponential auto-correlation time for all parameters in a chain. """ # Calculate the normalised autocorrelation function in each parameter. rho = np.nan * np.ones(chains.shape[1:]) for i in range(chains.shape[2]): try: ...
[ "def", "estimate_tau_exp", "(", "chains", ",", "*", "*", "kwargs", ")", ":", "# Calculate the normalised autocorrelation function in each parameter.", "rho", "=", "np", ".", "nan", "*", "np", ".", "ones", "(", "chains", ".", "shape", "[", "1", ":", "]", ")", ...
Estimate the exponential auto-correlation time for all parameters in a chain.
[ "Estimate", "the", "exponential", "auto", "-", "correlation", "time", "for", "all", "parameters", "in", "a", "chain", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/utils.py#L101-L125
andycasey/sick
sick/models/utils.py
estimate_tau_int
def estimate_tau_int(chains, **kwargs): """ Estimate the integrated auto-correlation time for all parameters in a chain. """ return autocorr.integrated_time(np.mean(chains, axis=0), **kwargs)
python
def estimate_tau_int(chains, **kwargs): """ Estimate the integrated auto-correlation time for all parameters in a chain. """ return autocorr.integrated_time(np.mean(chains, axis=0), **kwargs)
[ "def", "estimate_tau_int", "(", "chains", ",", "*", "*", "kwargs", ")", ":", "return", "autocorr", ".", "integrated_time", "(", "np", ".", "mean", "(", "chains", ",", "axis", "=", "0", ")", ",", "*", "*", "kwargs", ")" ]
Estimate the integrated auto-correlation time for all parameters in a chain.
[ "Estimate", "the", "integrated", "auto", "-", "correlation", "time", "for", "all", "parameters", "in", "a", "chain", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/utils.py#L128-L132
andycasey/sick
sick/models/model.py
Model.estimate
def estimate(self, data, full_output=False, **kwargs): """ Estimate the model parameters, given the data. """ # Number of model comparisons can be specified in the configuration. num_model_comparisons = self._configuration.get("estimate", {}).get( "num_model_comparis...
python
def estimate(self, data, full_output=False, **kwargs): """ Estimate the model parameters, given the data. """ # Number of model comparisons can be specified in the configuration. num_model_comparisons = self._configuration.get("estimate", {}).get( "num_model_comparis...
[ "def", "estimate", "(", "self", ",", "data", ",", "full_output", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Number of model comparisons can be specified in the configuration.", "num_model_comparisons", "=", "self", ".", "_configuration", ".", "get", "(", "\...
Estimate the model parameters, given the data.
[ "Estimate", "the", "model", "parameters", "given", "the", "data", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/model.py#L32-L257
andycasey/sick
sick/models/model.py
Model.infer
def infer(self, data, initial_proposal=None, full_output=False,**kwargs): """ Infer the model parameters, given the data. auto_convergence=True, walkers=100, burn=2000, sample=2000, minimum_sample=2000, convergence_check_frequency=1000, a=2.0, threads=1, """ # ...
python
def infer(self, data, initial_proposal=None, full_output=False,**kwargs): """ Infer the model parameters, given the data. auto_convergence=True, walkers=100, burn=2000, sample=2000, minimum_sample=2000, convergence_check_frequency=1000, a=2.0, threads=1, """ # ...
[ "def", "infer", "(", "self", ",", "data", ",", "initial_proposal", "=", "None", ",", "full_output", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Apply data masks now so we don't have to do it on the fly.", "data", ",", "pixels_affected", "=", "self", ".", ...
Infer the model parameters, given the data. auto_convergence=True, walkers=100, burn=2000, sample=2000, minimum_sample=2000, convergence_check_frequency=1000, a=2.0, threads=1,
[ "Infer", "the", "model", "parameters", "given", "the", "data", ".", "auto_convergence", "=", "True", "walkers", "=", "100", "burn", "=", "2000", "sample", "=", "2000", "minimum_sample", "=", "2000", "convergence_check_frequency", "=", "1000", "a", "=", "2", ...
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/model.py#L261-L578
andycasey/sick
sick/models/model.py
Model._create_convolution_functions
def _create_convolution_functions(self, matched_channels, data, free_parameters, fixed_parameters=None): """ Pre-create binning matrix factories. The following options need to be followed on a per-matched channel basis. Options here are: 1) If we have no redshift or re...
python
def _create_convolution_functions(self, matched_channels, data, free_parameters, fixed_parameters=None): """ Pre-create binning matrix factories. The following options need to be followed on a per-matched channel basis. Options here are: 1) If we have no redshift or re...
[ "def", "_create_convolution_functions", "(", "self", ",", "matched_channels", ",", "data", ",", "free_parameters", ",", "fixed_parameters", "=", "None", ")", ":", "fast_binning", "=", "self", ".", "_configuration", ".", "get", "(", "\"settings\"", ",", "{", "}",...
Pre-create binning matrix factories. The following options need to be followed on a per-matched channel basis. Options here are: 1) If we have no redshift or resolution parameters to solve for, then we can just produce a matrix that will be multiplied in. Inputs: none ...
[ "Pre", "-", "create", "binning", "matrix", "factories", ".", "The", "following", "options", "need", "to", "be", "followed", "on", "a", "per", "-", "matched", "channel", "basis", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/model.py#L652-L824
andycasey/sick
sick/models/model.py
Model.optimise
def optimise(self, data, initial_theta=None, full_output=False, **kwargs): """ Optimise the model parameters, given the data. """ data = self._format_data(data) if initial_theta is None: initial_theta = self.estimate(data) # Which parameters will be optimis...
python
def optimise(self, data, initial_theta=None, full_output=False, **kwargs): """ Optimise the model parameters, given the data. """ data = self._format_data(data) if initial_theta is None: initial_theta = self.estimate(data) # Which parameters will be optimis...
[ "def", "optimise", "(", "self", ",", "data", ",", "initial_theta", "=", "None", ",", "full_output", "=", "False", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "_format_data", "(", "data", ")", "if", "initial_theta", "is", "None", ":", ...
Optimise the model parameters, given the data.
[ "Optimise", "the", "model", "parameters", "given", "the", "data", "." ]
train
https://github.com/andycasey/sick/blob/6c37686182794c4cafea45abf7062b30b789b1a2/sick/models/model.py#L833-L937
Nic30/ipCorePackager
ipCorePackager/component.py
tcl_add_fileset_file
def tcl_add_fileset_file(filename: str): """ :param filename: relative filename with .vhdl or .v :return: add_fileset_file command string """ if filename.endswith(".vhd"): t = "VHDL" elif filename.endswith(".v") or filename.endswith(".sv"): t = "VERILOG" else: raise ...
python
def tcl_add_fileset_file(filename: str): """ :param filename: relative filename with .vhdl or .v :return: add_fileset_file command string """ if filename.endswith(".vhd"): t = "VHDL" elif filename.endswith(".v") or filename.endswith(".sv"): t = "VERILOG" else: raise ...
[ "def", "tcl_add_fileset_file", "(", "filename", ":", "str", ")", ":", "if", "filename", ".", "endswith", "(", "\".vhd\"", ")", ":", "t", "=", "\"VHDL\"", "elif", "filename", ".", "endswith", "(", "\".v\"", ")", "or", "filename", ".", "endswith", "(", "\"...
:param filename: relative filename with .vhdl or .v :return: add_fileset_file command string
[ ":", "param", "filename", ":", "relative", "filename", "with", ".", "vhdl", "or", ".", "v" ]
train
https://github.com/Nic30/ipCorePackager/blob/0af4e56ebfdc3749fffa40d50d9ccbf8b5445881/ipCorePackager/component.py#L37-L52
Nic30/ipCorePackager
ipCorePackager/component.py
Component.asignTopUnit
def asignTopUnit(self, top, topName): """ Set hwt unit as template for component """ self._top = top self.name = topName pack = self._packager self.model.addDefaultViews(topName, pack.iterParams(top)) for intf in pack.iterInterfaces(self._top): ...
python
def asignTopUnit(self, top, topName): """ Set hwt unit as template for component """ self._top = top self.name = topName pack = self._packager self.model.addDefaultViews(topName, pack.iterParams(top)) for intf in pack.iterInterfaces(self._top): ...
[ "def", "asignTopUnit", "(", "self", ",", "top", ",", "topName", ")", ":", "self", ".", "_top", "=", "top", "self", ".", "name", "=", "topName", "pack", "=", "self", ".", "_packager", "self", ".", "model", ".", "addDefaultViews", "(", "topName", ",", ...
Set hwt unit as template for component
[ "Set", "hwt", "unit", "as", "template", "for", "component" ]
train
https://github.com/Nic30/ipCorePackager/blob/0af4e56ebfdc3749fffa40d50d9ccbf8b5445881/ipCorePackager/component.py#L168-L209
bapakode/OmMongo
ommongo/document.py
DictDoc.setdefault
def setdefault(self, name, value): ''' if the ``name`` is set, return its value. Otherwse set ``name`` to ``value`` and return ``value``''' if name in self: return self[name] self[name] = value return self[name]
python
def setdefault(self, name, value): ''' if the ``name`` is set, return its value. Otherwse set ``name`` to ``value`` and return ``value``''' if name in self: return self[name] self[name] = value return self[name]
[ "def", "setdefault", "(", "self", ",", "name", ",", "value", ")", ":", "if", "name", "in", "self", ":", "return", "self", "[", "name", "]", "self", "[", "name", "]", "=", "value", "return", "self", "[", "name", "]" ]
if the ``name`` is set, return its value. Otherwse set ``name`` to ``value`` and return ``value``
[ "if", "the", "name", "is", "set", "return", "its", "value", ".", "Otherwse", "set", "name", "to", "value", "and", "return", "value" ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/document.py#L552-L558
bapakode/OmMongo
ommongo/document.py
Index.ascending
def ascending(self, name): ''' Add a descending index for ``name`` to this index. :param name: Name to be used in the index ''' self.components.append((name, Index.ASCENDING)) return self
python
def ascending(self, name): ''' Add a descending index for ``name`` to this index. :param name: Name to be used in the index ''' self.components.append((name, Index.ASCENDING)) return self
[ "def", "ascending", "(", "self", ",", "name", ")", ":", "self", ".", "components", ".", "append", "(", "(", "name", ",", "Index", ".", "ASCENDING", ")", ")", "return", "self" ]
Add a descending index for ``name`` to this index. :param name: Name to be used in the index
[ "Add", "a", "descending", "index", "for", "name", "to", "this", "index", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/document.py#L617-L623
bapakode/OmMongo
ommongo/document.py
Index.descending
def descending(self, name): ''' Add a descending index for ``name`` to this index. :param name: Name to be used in the index ''' self.components.append((name, Index.DESCENDING)) return self
python
def descending(self, name): ''' Add a descending index for ``name`` to this index. :param name: Name to be used in the index ''' self.components.append((name, Index.DESCENDING)) return self
[ "def", "descending", "(", "self", ",", "name", ")", ":", "self", ".", "components", ".", "append", "(", "(", "name", ",", "Index", ".", "DESCENDING", ")", ")", "return", "self" ]
Add a descending index for ``name`` to this index. :param name: Name to be used in the index
[ "Add", "a", "descending", "index", "for", "name", "to", "this", "index", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/document.py#L625-L631
bapakode/OmMongo
ommongo/document.py
Index.geo2d
def geo2d(self, name, min=None, max=None): """ Create a 2d index. See: http://www.mongodb.org/display/DOCS/Geospatial+Indexing :param name: Name of the indexed column :param min: minimum value for the index :param max: minimum value for the index """ ...
python
def geo2d(self, name, min=None, max=None): """ Create a 2d index. See: http://www.mongodb.org/display/DOCS/Geospatial+Indexing :param name: Name of the indexed column :param min: minimum value for the index :param max: minimum value for the index """ ...
[ "def", "geo2d", "(", "self", ",", "name", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "self", ".", "components", ".", "append", "(", "(", "name", ",", "GEO2D", ")", ")", "self", ".", "__min", "=", "min", "self", ".", "__max", "=...
Create a 2d index. See: http://www.mongodb.org/display/DOCS/Geospatial+Indexing :param name: Name of the indexed column :param min: minimum value for the index :param max: minimum value for the index
[ "Create", "a", "2d", "index", ".", "See", ":", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Geospatial", "+", "Indexing" ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/document.py#L633-L644
bapakode/OmMongo
ommongo/document.py
Index.geo_haystack
def geo_haystack(self, name, bucket_size): """ Create a Haystack index. See: http://www.mongodb.org/display/DOCS/Geospatial+Haystack+Indexing :param name: Name of the indexed column :param bucket_size: Size of the haystack buckets (see mongo docs) """ self.c...
python
def geo_haystack(self, name, bucket_size): """ Create a Haystack index. See: http://www.mongodb.org/display/DOCS/Geospatial+Haystack+Indexing :param name: Name of the indexed column :param bucket_size: Size of the haystack buckets (see mongo docs) """ self.c...
[ "def", "geo_haystack", "(", "self", ",", "name", ",", "bucket_size", ")", ":", "self", ".", "components", ".", "append", "(", "(", "name", ",", "'geoHaystack'", ")", ")", "self", ".", "__bucket_size", "=", "bucket_size", "return", "self" ]
Create a Haystack index. See: http://www.mongodb.org/display/DOCS/Geospatial+Haystack+Indexing :param name: Name of the indexed column :param bucket_size: Size of the haystack buckets (see mongo docs)
[ "Create", "a", "Haystack", "index", ".", "See", ":", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Geospatial", "+", "Haystack", "+", "Indexing" ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/document.py#L646-L655
bapakode/OmMongo
ommongo/document.py
Index.unique
def unique(self, drop_dups=False): ''' Make this index unique, optionally dropping duplicate entries. :param drop_dups: Drop duplicate objects while creating the unique \ index? Default to ``False`` ''' self.__unique = True if drop_dups and pymongo.version_t...
python
def unique(self, drop_dups=False): ''' Make this index unique, optionally dropping duplicate entries. :param drop_dups: Drop duplicate objects while creating the unique \ index? Default to ``False`` ''' self.__unique = True if drop_dups and pymongo.version_t...
[ "def", "unique", "(", "self", ",", "drop_dups", "=", "False", ")", ":", "self", ".", "__unique", "=", "True", "if", "drop_dups", "and", "pymongo", ".", "version_tuple", ">=", "(", "2", ",", "7", ",", "5", ")", ":", "# pragma: nocover", "raise", "BadInd...
Make this index unique, optionally dropping duplicate entries. :param drop_dups: Drop duplicate objects while creating the unique \ index? Default to ``False``
[ "Make", "this", "index", "unique", "optionally", "dropping", "duplicate", "entries", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/document.py#L657-L667
bapakode/OmMongo
ommongo/document.py
Index.ensure
def ensure(self, collection): ''' Call the pymongo method ``ensure_index`` on the passed collection. :param collection: the ``pymongo`` collection to ensure this index \ is on ''' components = [] for c in self.components: if isinstance(c[0], F...
python
def ensure(self, collection): ''' Call the pymongo method ``ensure_index`` on the passed collection. :param collection: the ``pymongo`` collection to ensure this index \ is on ''' components = [] for c in self.components: if isinstance(c[0], F...
[ "def", "ensure", "(", "self", ",", "collection", ")", ":", "components", "=", "[", "]", "for", "c", "in", "self", ".", "components", ":", "if", "isinstance", "(", "c", "[", "0", "]", ",", "Field", ")", ":", "c", "=", "(", "c", "[", "0", "]", ...
Call the pymongo method ``ensure_index`` on the passed collection. :param collection: the ``pymongo`` collection to ensure this index \ is on
[ "Call", "the", "pymongo", "method", "ensure_index", "on", "the", "passed", "collection", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/document.py#L669-L693
j3ffhubb/pymarshal
pymarshal/api_docs/docstring.py
DocStringArg.factory
def factory( name, desc, type, subtypes=None, required=True, default=None, ctor=None, hide=False, ): """ desc: > Creates a DocStringArg and recursively includes child docstrings if they are not JSON types. ...
python
def factory( name, desc, type, subtypes=None, required=True, default=None, ctor=None, hide=False, ): """ desc: > Creates a DocStringArg and recursively includes child docstrings if they are not JSON types. ...
[ "def", "factory", "(", "name", ",", "desc", ",", "type", ",", "subtypes", "=", "None", ",", "required", "=", "True", ",", "default", "=", "None", ",", "ctor", "=", "None", ",", "hide", "=", "False", ",", ")", ":", "if", "ctor", ":", "type_assert", ...
desc: > Creates a DocStringArg and recursively includes child docstrings if they are not JSON types. args: - name: name desc: The name of the argument type: str - name: desc desc: A description of the argument ...
[ "desc", ":", ">", "Creates", "a", "DocStringArg", "and", "recursively", "includes", "child", "docstrings", "if", "they", "are", "not", "JSON", "types", ".", "args", ":", "-", "name", ":", "name", "desc", ":", "The", "name", "of", "the", "argument", "type...
train
https://github.com/j3ffhubb/pymarshal/blob/42cd1cccfabfdce5af633358a641fcd5183ee192/pymarshal/api_docs/docstring.py#L113-L203
j3ffhubb/pymarshal
pymarshal/api_docs/docstring.py
DocString.from_ctor
def from_ctor( ctor, ): """ desc: > Turns a class constructor into an instance of DocString. Pass in either Class.__init__, a factory function, or factory static method. args: - name: ctor desc: The constructor method ...
python
def from_ctor( ctor, ): """ desc: > Turns a class constructor into an instance of DocString. Pass in either Class.__init__, a factory function, or factory static method. args: - name: ctor desc: The constructor method ...
[ "def", "from_ctor", "(", "ctor", ",", ")", ":", "_docstring", "=", "inspect", ".", "getdoc", "(", "ctor", ")", "assert", "_docstring", "is", "not", "None", ",", "\"No docstring for {}\"", ".", "format", "(", "ctor", ")", "obj", "=", "yaml", ".", "load", ...
desc: > Turns a class constructor into an instance of DocString. Pass in either Class.__init__, a factory function, or factory static method. args: - name: ctor desc: The constructor method or function to use for generating a DocS...
[ "desc", ":", ">", "Turns", "a", "class", "constructor", "into", "an", "instance", "of", "DocString", ".", "Pass", "in", "either", "Class", ".", "__init__", "a", "factory", "function", "or", "factory", "static", "method", ".", "args", ":", "-", "name", ":...
train
https://github.com/j3ffhubb/pymarshal/blob/42cd1cccfabfdce5af633358a641fcd5183ee192/pymarshal/api_docs/docstring.py#L326-L393
coldmind/django-postgres-pgpfields
django_postgres_pgpfields/proxy.py
EncryptedProxyField._bypass_non_decrypted_field_exception
def _bypass_non_decrypted_field_exception(self): """Bypass exception if some field was not decrypted.""" if getattr(settings, 'PGPFIELDS_BYPASS_NON_DECRYPTED_FIELD_EXCEPTION', False): return True if getattr(settings, 'PGPFIELDS_BYPASS_FIELD_EXCEPTION_IN_MIGRATIONS', False): ...
python
def _bypass_non_decrypted_field_exception(self): """Bypass exception if some field was not decrypted.""" if getattr(settings, 'PGPFIELDS_BYPASS_NON_DECRYPTED_FIELD_EXCEPTION', False): return True if getattr(settings, 'PGPFIELDS_BYPASS_FIELD_EXCEPTION_IN_MIGRATIONS', False): ...
[ "def", "_bypass_non_decrypted_field_exception", "(", "self", ")", ":", "if", "getattr", "(", "settings", ",", "'PGPFIELDS_BYPASS_NON_DECRYPTED_FIELD_EXCEPTION'", ",", "False", ")", ":", "return", "True", "if", "getattr", "(", "settings", ",", "'PGPFIELDS_BYPASS_FIELD_EX...
Bypass exception if some field was not decrypted.
[ "Bypass", "exception", "if", "some", "field", "was", "not", "decrypted", "." ]
train
https://github.com/coldmind/django-postgres-pgpfields/blob/8ad7ab6254f06104012696fa7f99d0f6727fb667/django_postgres_pgpfields/proxy.py#L54-L64
uw-it-aca/uw-restclients
restclients/r25/events.py
get_events
def get_events(**kwargs): """ Return a list of events matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/events.xml """ url = "/r25ws/servlet/wrd/run/events.xml" if len(kwargs): url += "?%s" % urlencode(kwargs) return events_...
python
def get_events(**kwargs): """ Return a list of events matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/events.xml """ url = "/r25ws/servlet/wrd/run/events.xml" if len(kwargs): url += "?%s" % urlencode(kwargs) return events_...
[ "def", "get_events", "(", "*", "*", "kwargs", ")", ":", "url", "=", "\"/r25ws/servlet/wrd/run/events.xml\"", "if", "len", "(", "kwargs", ")", ":", "url", "+=", "\"?%s\"", "%", "urlencode", "(", "kwargs", ")", "return", "events_from_xml", "(", "get_resource", ...
Return a list of events matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/events.xml
[ "Return", "a", "list", "of", "events", "matching", "the", "passed", "filter", ".", "Supported", "kwargs", "are", "listed", "at", "http", ":", "//", "knowledge25", ".", "collegenet", ".", "com", "/", "display", "/", "WSW", "/", "events", ".", "xml" ]
train
https://github.com/uw-it-aca/uw-restclients/blob/e12dcd32bf5296b6ebdf71798031594afb7852cb/restclients/r25/events.py#L18-L28
inspirehep/inspire-crawler
inspire_crawler/models.py
CrawlerJob.create
def create(cls, job_id, spider, workflow, results=None, logs=None, status=JobStatus.PENDING): """Create a new entry for a scheduled crawler job.""" obj = cls( job_id=job_id, spider=spider, workflow=workflow, results=results, logs...
python
def create(cls, job_id, spider, workflow, results=None, logs=None, status=JobStatus.PENDING): """Create a new entry for a scheduled crawler job.""" obj = cls( job_id=job_id, spider=spider, workflow=workflow, results=results, logs...
[ "def", "create", "(", "cls", ",", "job_id", ",", "spider", ",", "workflow", ",", "results", "=", "None", ",", "logs", "=", "None", ",", "status", "=", "JobStatus", ".", "PENDING", ")", ":", "obj", "=", "cls", "(", "job_id", "=", "job_id", ",", "spi...
Create a new entry for a scheduled crawler job.
[ "Create", "a", "new", "entry", "for", "a", "scheduled", "crawler", "job", "." ]
train
https://github.com/inspirehep/inspire-crawler/blob/36d5cc0cd87cc597ba80e680b7de7254b120173a/inspire_crawler/models.py#L84-L96
inspirehep/inspire-crawler
inspire_crawler/models.py
CrawlerJob.get_by_job
def get_by_job(cls, job_id): """Get a row by Job UUID.""" try: return cls.query.filter_by( job_id=job_id ).one() except NoResultFound: raise CrawlerJobNotExistError(job_id)
python
def get_by_job(cls, job_id): """Get a row by Job UUID.""" try: return cls.query.filter_by( job_id=job_id ).one() except NoResultFound: raise CrawlerJobNotExistError(job_id)
[ "def", "get_by_job", "(", "cls", ",", "job_id", ")", ":", "try", ":", "return", "cls", ".", "query", ".", "filter_by", "(", "job_id", "=", "job_id", ")", ".", "one", "(", ")", "except", "NoResultFound", ":", "raise", "CrawlerJobNotExistError", "(", "job_...
Get a row by Job UUID.
[ "Get", "a", "row", "by", "Job", "UUID", "." ]
train
https://github.com/inspirehep/inspire-crawler/blob/36d5cc0cd87cc597ba80e680b7de7254b120173a/inspire_crawler/models.py#L99-L106
operasoftware/twisted-apns
apns/feedback.py
Feedback.from_binary_string
def from_binary_string(cls, stream): """ Read feedback information from the stream and unpack it. :param stream: A stream of feedback data from APN. Can contain multiple feedback tuples, as defined in the feedback service protocol. :return A list containing all unpacked feedbacks...
python
def from_binary_string(cls, stream): """ Read feedback information from the stream and unpack it. :param stream: A stream of feedback data from APN. Can contain multiple feedback tuples, as defined in the feedback service protocol. :return A list containing all unpacked feedbacks...
[ "def", "from_binary_string", "(", "cls", ",", "stream", ")", ":", "offset", "=", "0", "length", "=", "len", "(", "stream", ")", "feedbacks", "=", "[", "]", "while", "offset", "<", "length", ":", "timestamp", ",", "token_length", "=", "struct", ".", "un...
Read feedback information from the stream and unpack it. :param stream: A stream of feedback data from APN. Can contain multiple feedback tuples, as defined in the feedback service protocol. :return A list containing all unpacked feedbacks.
[ "Read", "feedback", "information", "from", "the", "stream", "and", "unpack", "it", ".", ":", "param", "stream", ":", "A", "stream", "of", "feedback", "data", "from", "APN", ".", "Can", "contain", "multiple", "feedback", "tuples", "as", "defined", "in", "th...
train
https://github.com/operasoftware/twisted-apns/blob/c7bd460100067e0c96c440ac0f5516485ac7313f/apns/feedback.py#L24-L46
operasoftware/twisted-apns
apns/feedback.py
Feedback.to_binary_string
def to_binary_string(self): """Pack the feedback to binary form and return it as string.""" timestamp = datetime_to_timestamp(self.when) token = binascii.unhexlify(self.token) return struct.pack(self.FORMAT_PREFIX + '{0}s'.format(len(token)), timestamp, len(tok...
python
def to_binary_string(self): """Pack the feedback to binary form and return it as string.""" timestamp = datetime_to_timestamp(self.when) token = binascii.unhexlify(self.token) return struct.pack(self.FORMAT_PREFIX + '{0}s'.format(len(token)), timestamp, len(tok...
[ "def", "to_binary_string", "(", "self", ")", ":", "timestamp", "=", "datetime_to_timestamp", "(", "self", ".", "when", ")", "token", "=", "binascii", ".", "unhexlify", "(", "self", ".", "token", ")", "return", "struct", ".", "pack", "(", "self", ".", "FO...
Pack the feedback to binary form and return it as string.
[ "Pack", "the", "feedback", "to", "binary", "form", "and", "return", "it", "as", "string", "." ]
train
https://github.com/operasoftware/twisted-apns/blob/c7bd460100067e0c96c440ac0f5516485ac7313f/apns/feedback.py#L48-L53
uw-it-aca/uw-restclients
restclients/r25/spaces.py
get_spaces
def get_spaces(**kwargs): """ Return a list of reservations matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/spaces.xml """ url = "/r25ws/servlet/wrd/run/spaces.xml" if len(kwargs): url += "?%s" % urlencode(kwargs) return s...
python
def get_spaces(**kwargs): """ Return a list of reservations matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/spaces.xml """ url = "/r25ws/servlet/wrd/run/spaces.xml" if len(kwargs): url += "?%s" % urlencode(kwargs) return s...
[ "def", "get_spaces", "(", "*", "*", "kwargs", ")", ":", "url", "=", "\"/r25ws/servlet/wrd/run/spaces.xml\"", "if", "len", "(", "kwargs", ")", ":", "url", "+=", "\"?%s\"", "%", "urlencode", "(", "kwargs", ")", "return", "spaces_from_xml", "(", "get_resource", ...
Return a list of reservations matching the passed filter. Supported kwargs are listed at http://knowledge25.collegenet.com/display/WSW/spaces.xml
[ "Return", "a", "list", "of", "reservations", "matching", "the", "passed", "filter", ".", "Supported", "kwargs", "are", "listed", "at", "http", ":", "//", "knowledge25", ".", "collegenet", ".", "com", "/", "display", "/", "WSW", "/", "spaces", ".", "xml" ]
train
https://github.com/uw-it-aca/uw-restclients/blob/e12dcd32bf5296b6ebdf71798031594afb7852cb/restclients/r25/spaces.py#L11-L21
JNRowe/upoints
upoints/point.py
_manage_location
def _manage_location(attr): """Build managed property interface. Args: attr (str): Property's name Returns: property: Managed property interface """ return property(lambda self: getattr(self, '_%s' % attr), lambda self, value: self._set_location(attr, value))
python
def _manage_location(attr): """Build managed property interface. Args: attr (str): Property's name Returns: property: Managed property interface """ return property(lambda self: getattr(self, '_%s' % attr), lambda self, value: self._set_location(attr, value))
[ "def", "_manage_location", "(", "attr", ")", ":", "return", "property", "(", "lambda", "self", ":", "getattr", "(", "self", ",", "'_%s'", "%", "attr", ")", ",", "lambda", "self", ",", "value", ":", "self", ".", "_set_location", "(", "attr", ",", "value...
Build managed property interface. Args: attr (str): Property's name Returns: property: Managed property interface
[ "Build", "managed", "property", "interface", "." ]
train
https://github.com/JNRowe/upoints/blob/1e4b7a53ed2a06cd854523d54c36aabdccea3830/upoints/point.py#L28-L38
JNRowe/upoints
upoints/point.py
_dms_formatter
def _dms_formatter(latitude, longitude, mode, unistr=False): """Generate a human readable DM/DMS location string. Args: latitude (float): Location's latitude longitude (float): Location's longitude mode (str): Coordinate formatting system to use unistr (bool): Whether to use ext...
python
def _dms_formatter(latitude, longitude, mode, unistr=False): """Generate a human readable DM/DMS location string. Args: latitude (float): Location's latitude longitude (float): Location's longitude mode (str): Coordinate formatting system to use unistr (bool): Whether to use ext...
[ "def", "_dms_formatter", "(", "latitude", ",", "longitude", ",", "mode", ",", "unistr", "=", "False", ")", ":", "if", "unistr", ":", "chars", "=", "(", "'°',", " ", "′', '", "″", ")", "", "else", ":", "chars", "=", "(", "'°',", " ", "'\",", " ", ...
Generate a human readable DM/DMS location string. Args: latitude (float): Location's latitude longitude (float): Location's longitude mode (str): Coordinate formatting system to use unistr (bool): Whether to use extended character set
[ "Generate", "a", "human", "readable", "DM", "/", "DMS", "location", "string", "." ]
train
https://github.com/JNRowe/upoints/blob/1e4b7a53ed2a06cd854523d54c36aabdccea3830/upoints/point.py#L41-L68
JNRowe/upoints
upoints/point.py
TimedPoints.speed
def speed(self): """Calculate speed between :class:`Points`. Returns: list of float: Speed between :class:`Point` elements in km/h """ if not len(self) > 1: raise RuntimeError('More than one location is required') try: times = [i.time for i in...
python
def speed(self): """Calculate speed between :class:`Points`. Returns: list of float: Speed between :class:`Point` elements in km/h """ if not len(self) > 1: raise RuntimeError('More than one location is required') try: times = [i.time for i in...
[ "def", "speed", "(", "self", ")", ":", "if", "not", "len", "(", "self", ")", ">", "1", ":", "raise", "RuntimeError", "(", "'More than one location is required'", ")", "try", ":", "times", "=", "[", "i", ".", "time", "for", "i", "in", "self", "]", "ex...
Calculate speed between :class:`Points`. Returns: list of float: Speed between :class:`Point` elements in km/h
[ "Calculate", "speed", "between", ":", "class", ":", "Points", "." ]
train
https://github.com/JNRowe/upoints/blob/1e4b7a53ed2a06cd854523d54c36aabdccea3830/upoints/point.py#L708-L723
draperunner/fjlc
fjlc/lexicon/container/token_trie.py
TokenTrie.has_tokens
def has_tokens(self, phrase): """ Checks if phrase or sub-phrase exists in the tree. If set of phrases contains phrases such as: "state", "of the" and "state of the art", look up on: "state" returns true, "of" returns null, "of the art" returns false. :param phrase: Phrase or s...
python
def has_tokens(self, phrase): """ Checks if phrase or sub-phrase exists in the tree. If set of phrases contains phrases such as: "state", "of the" and "state of the art", look up on: "state" returns true, "of" returns null, "of the art" returns false. :param phrase: Phrase or s...
[ "def", "has_tokens", "(", "self", ",", "phrase", ")", ":", "if", "len", "(", "phrase", ")", "==", "1", "and", "classifier_options", ".", "is_special_class_word", "(", "phrase", "[", "0", "]", ")", ":", "return", "True", "tree", "=", "self", ".", "root"...
Checks if phrase or sub-phrase exists in the tree. If set of phrases contains phrases such as: "state", "of the" and "state of the art", look up on: "state" returns true, "of" returns null, "of the art" returns false. :param phrase: Phrase or sub-phrase to look up. :type: phrase: list ...
[ "Checks", "if", "phrase", "or", "sub", "-", "phrase", "exists", "in", "the", "tree", "." ]
train
https://github.com/draperunner/fjlc/blob/d2cc8cf1244984e7caf0bf95b11ed1677a94c994/fjlc/lexicon/container/token_trie.py#L27-L50
draperunner/fjlc
fjlc/lexicon/container/token_trie.py
TokenTrie.find_tracked_words
def find_tracked_words(self, tokens): """ Finds word-ranges all of phrases in tokens stored in TokenTrie :param tokens: Sequence of tokens to find phrases in :type tokens: list of str :return: List of Tokens found in tokens """ tracked_words = [] for i i...
python
def find_tracked_words(self, tokens): """ Finds word-ranges all of phrases in tokens stored in TokenTrie :param tokens: Sequence of tokens to find phrases in :type tokens: list of str :return: List of Tokens found in tokens """ tracked_words = [] for i i...
[ "def", "find_tracked_words", "(", "self", ",", "tokens", ")", ":", "tracked_words", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "tokens", ")", ")", ":", "for", "j", "in", "range", "(", "i", "+", "1", ",", "len", "(", "tokens", ")",...
Finds word-ranges all of phrases in tokens stored in TokenTrie :param tokens: Sequence of tokens to find phrases in :type tokens: list of str :return: List of Tokens found in tokens
[ "Finds", "word", "-", "ranges", "all", "of", "phrases", "in", "tokens", "stored", "in", "TokenTrie" ]
train
https://github.com/draperunner/fjlc/blob/d2cc8cf1244984e7caf0bf95b11ed1677a94c994/fjlc/lexicon/container/token_trie.py#L52-L73
draperunner/fjlc
fjlc/lexicon/container/token_trie.py
TokenTrie.find_optimal_allocation
def find_optimal_allocation(self, tokens): """ Finds longest, non-overlapping word-ranges of phrases in tokens stored in TokenTrie :param tokens: tokens tokenize :type tokens: list of str :return: Optimal allocation of tokens to phrases :rtype: list of TokenTrie.Token ...
python
def find_optimal_allocation(self, tokens): """ Finds longest, non-overlapping word-ranges of phrases in tokens stored in TokenTrie :param tokens: tokens tokenize :type tokens: list of str :return: Optimal allocation of tokens to phrases :rtype: list of TokenTrie.Token ...
[ "def", "find_optimal_allocation", "(", "self", ",", "tokens", ")", ":", "token_ranges", "=", "self", ".", "find_tracked_words", "(", "tokens", ")", "token_ranges", ".", "sort", "(", ")", "for", "offset", "in", "range", "(", "1", ",", "len", "(", "token_ran...
Finds longest, non-overlapping word-ranges of phrases in tokens stored in TokenTrie :param tokens: tokens tokenize :type tokens: list of str :return: Optimal allocation of tokens to phrases :rtype: list of TokenTrie.Token
[ "Finds", "longest", "non", "-", "overlapping", "word", "-", "ranges", "of", "phrases", "in", "tokens", "stored", "in", "TokenTrie" ]
train
https://github.com/draperunner/fjlc/blob/d2cc8cf1244984e7caf0bf95b11ed1677a94c994/fjlc/lexicon/container/token_trie.py#L75-L98
draperunner/fjlc
fjlc/lexicon/container/token_trie.py
TokenTrie.find_optimal_tokenization
def find_optimal_tokenization(self, tokens): """ Similar to {@link #findOptimalAllocation(String[])}, but also includes the words not matching any longer n-gram in TokenTrie as singletons. :param tokens: tokens to tokenize :return: Optimal allocation of tokens to phrases, with n...
python
def find_optimal_tokenization(self, tokens): """ Similar to {@link #findOptimalAllocation(String[])}, but also includes the words not matching any longer n-gram in TokenTrie as singletons. :param tokens: tokens to tokenize :return: Optimal allocation of tokens to phrases, with n...
[ "def", "find_optimal_tokenization", "(", "self", ",", "tokens", ")", ":", "token_ranges", "=", "self", ".", "find_optimal_allocation", "(", "tokens", ")", "tokenized_sentence", "=", "[", "]", "set_index", "=", "0", "for", "token", "in", "token_ranges", ":", "w...
Similar to {@link #findOptimalAllocation(String[])}, but also includes the words not matching any longer n-gram in TokenTrie as singletons. :param tokens: tokens to tokenize :return: Optimal allocation of tokens to phrases, with non matching tokens as singletons.
[ "Similar", "to", "{", "@link", "#findOptimalAllocation", "(", "String", "[]", ")", "}", "but", "also", "includes", "the", "words", "not", "matching", "any", "longer", "n", "-", "gram", "in", "TokenTrie", "as", "singletons", "." ]
train
https://github.com/draperunner/fjlc/blob/d2cc8cf1244984e7caf0bf95b11ed1677a94c994/fjlc/lexicon/container/token_trie.py#L100-L123
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
translate
def translate(root_list, use_bag_semantics=False): """ Translate a list of relational algebra trees into SQL statements. :param root_list: a list of tree roots :param use_bag_semantics: flag for using relational algebra bag semantics :return: a list of SQL statements """ translator = (Trans...
python
def translate(root_list, use_bag_semantics=False): """ Translate a list of relational algebra trees into SQL statements. :param root_list: a list of tree roots :param use_bag_semantics: flag for using relational algebra bag semantics :return: a list of SQL statements """ translator = (Trans...
[ "def", "translate", "(", "root_list", ",", "use_bag_semantics", "=", "False", ")", ":", "translator", "=", "(", "Translator", "(", ")", "if", "use_bag_semantics", "else", "SetTranslator", "(", ")", ")", "return", "[", "translator", ".", "translate", "(", "ro...
Translate a list of relational algebra trees into SQL statements. :param root_list: a list of tree roots :param use_bag_semantics: flag for using relational algebra bag semantics :return: a list of SQL statements
[ "Translate", "a", "list", "of", "relational", "algebra", "trees", "into", "SQL", "statements", "." ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L247-L256
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
SQLQuery.to_sql
def to_sql(self): """ Construct a SQL query based on the stored blocks. :return: a SQL query """ return self._sql_query_skeleton.format( prefix=self.prefix, select=self.select_block, relation=self.from_block, conditions=self.where_block)
python
def to_sql(self): """ Construct a SQL query based on the stored blocks. :return: a SQL query """ return self._sql_query_skeleton.format( prefix=self.prefix, select=self.select_block, relation=self.from_block, conditions=self.where_block)
[ "def", "to_sql", "(", "self", ")", ":", "return", "self", ".", "_sql_query_skeleton", ".", "format", "(", "prefix", "=", "self", ".", "prefix", ",", "select", "=", "self", ".", "select_block", ",", "relation", "=", "self", ".", "from_block", ",", "condit...
Construct a SQL query based on the stored blocks. :return: a SQL query
[ "Construct", "a", "SQL", "query", "based", "on", "the", "stored", "blocks", ".", ":", "return", ":", "a", "SQL", "query" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L31-L38
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
Translator.relation
def relation(self, node): """ Translate a relation node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ return self.query(select_block=str(node.attributes), from_block=node.name)
python
def relation(self, node): """ Translate a relation node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ return self.query(select_block=str(node.attributes), from_block=node.name)
[ "def", "relation", "(", "self", ",", "node", ")", ":", "return", "self", ".", "query", "(", "select_block", "=", "str", "(", "node", ".", "attributes", ")", ",", "from_block", "=", "node", ".", "name", ")" ]
Translate a relation node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node
[ "Translate", "a", "relation", "node", "into", "SQLQuery", ".", ":", "param", "node", ":", "a", "treebrd", "node", ":", "return", ":", "a", "SQLQuery", "object", "for", "the", "tree", "rooted", "at", "node" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L75-L82
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
Translator.select
def select(self, node): """ Translate a select node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ child_object = self.translate(node.child) where_block = node.conditions if child_object.where_block: ...
python
def select(self, node): """ Translate a select node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ child_object = self.translate(node.child) where_block = node.conditions if child_object.where_block: ...
[ "def", "select", "(", "self", ",", "node", ")", ":", "child_object", "=", "self", ".", "translate", "(", "node", ".", "child", ")", "where_block", "=", "node", ".", "conditions", "if", "child_object", ".", "where_block", ":", "where_block", "=", "'({0}) AN...
Translate a select node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node
[ "Translate", "a", "select", "node", "into", "SQLQuery", ".", ":", "param", "node", ":", "a", "treebrd", "node", ":", "return", ":", "a", "SQLQuery", "object", "for", "the", "tree", "rooted", "at", "node" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L84-L99
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
Translator.project
def project(self, node): """ Translate a project node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ child_object = self.translate(node.child) child_object.select_block = str(node.attributes) return ch...
python
def project(self, node): """ Translate a project node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ child_object = self.translate(node.child) child_object.select_block = str(node.attributes) return ch...
[ "def", "project", "(", "self", ",", "node", ")", ":", "child_object", "=", "self", ".", "translate", "(", "node", ".", "child", ")", "child_object", ".", "select_block", "=", "str", "(", "node", ".", "attributes", ")", "return", "child_object" ]
Translate a project node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node
[ "Translate", "a", "project", "node", "into", "SQLQuery", ".", ":", "param", "node", ":", "a", "treebrd", "node", ":", "return", ":", "a", "SQLQuery", "object", "for", "the", "tree", "rooted", "at", "node" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L101-L109
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
Translator.rename
def rename(self, node): """ Translate a rename node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ child_object = self.translate(node.child) from_block = '({child}) AS {name}({attributes})'.format( ...
python
def rename(self, node): """ Translate a rename node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ child_object = self.translate(node.child) from_block = '({child}) AS {name}({attributes})'.format( ...
[ "def", "rename", "(", "self", ",", "node", ")", ":", "child_object", "=", "self", ".", "translate", "(", "node", ".", "child", ")", "from_block", "=", "'({child}) AS {name}({attributes})'", ".", "format", "(", "child", "=", "child_object", ".", "to_sql", "("...
Translate a rename node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node
[ "Translate", "a", "rename", "node", "into", "SQLQuery", ".", ":", "param", "node", ":", "a", "treebrd", "node", ":", "return", ":", "a", "SQLQuery", "object", "for", "the", "tree", "rooted", "at", "node" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L111-L121
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
Translator.assign
def assign(self, node): """ Translate an assign node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ child_object = self.translate(node.child) child_object.prefix = 'CREATE TEMPORARY TABLE {name}({attributes}) ...
python
def assign(self, node): """ Translate an assign node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ child_object = self.translate(node.child) child_object.prefix = 'CREATE TEMPORARY TABLE {name}({attributes}) ...
[ "def", "assign", "(", "self", ",", "node", ")", ":", "child_object", "=", "self", ".", "translate", "(", "node", ".", "child", ")", "child_object", ".", "prefix", "=", "'CREATE TEMPORARY TABLE {name}({attributes}) AS '", ".", "format", "(", "name", "=", "node"...
Translate an assign node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node
[ "Translate", "an", "assign", "node", "into", "SQLQuery", ".", ":", "param", "node", ":", "a", "treebrd", "node", ":", "return", ":", "a", "SQLQuery", "object", "for", "the", "tree", "rooted", "at", "node" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L123-L132
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
Translator._join
def _join(self, node): """ Translate a join node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ select_block = str(node.attributes) from_block = '{left} {operator} {right}'.format( left=self._join...
python
def _join(self, node): """ Translate a join node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ select_block = str(node.attributes) from_block = '{left} {operator} {right}'.format( left=self._join...
[ "def", "_join", "(", "self", ",", "node", ")", ":", "select_block", "=", "str", "(", "node", ".", "attributes", ")", "from_block", "=", "'{left} {operator} {right}'", ".", "format", "(", "left", "=", "self", ".", "_join_helper", "(", "node", ".", "left", ...
Translate a join node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node
[ "Translate", "a", "join", "node", "into", "SQLQuery", ".", ":", "param", "node", ":", "a", "treebrd", "node", ":", "return", ":", "a", "SQLQuery", "object", "for", "the", "tree", "rooted", "at", "node" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L192-L210
pyrapt/rapt
rapt/transformers/sql/sql_translator.py
Translator._set_op
def _set_op(self, node): """ Translate a set operator node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ select_block = str(node.attributes) from_block = '({left} {operator} ALL {right}) AS {name}'.format( ...
python
def _set_op(self, node): """ Translate a set operator node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node """ select_block = str(node.attributes) from_block = '({left} {operator} ALL {right}) AS {name}'.format( ...
[ "def", "_set_op", "(", "self", ",", "node", ")", ":", "select_block", "=", "str", "(", "node", ".", "attributes", ")", "from_block", "=", "'({left} {operator} ALL {right}) AS {name}'", ".", "format", "(", "left", "=", "self", ".", "translate", "(", "node", "...
Translate a set operator node into SQLQuery. :param node: a treebrd node :return: a SQLQuery object for the tree rooted at node
[ "Translate", "a", "set", "operator", "node", "into", "SQLQuery", ".", ":", "param", "node", ":", "a", "treebrd", "node", ":", "return", ":", "a", "SQLQuery", "object", "for", "the", "tree", "rooted", "at", "node" ]
train
https://github.com/pyrapt/rapt/blob/0193a07aafff83a887fdc9e5e0f25eafa5b1b205/rapt/transformers/sql/sql_translator.py#L212-L223
childsish/sofia
sofia/execution_engines/parallel_engine.py
ParallelExecutionEngine.can_finalise
def can_finalise(self, step, exhausted, status): """ The step is running and the inputs are exhausted :param step: :param exhausted: :return: """ return step in status and step in exhausted and status[step] == 'running' and all(in_ in exhausted[step] for in_ in st...
python
def can_finalise(self, step, exhausted, status): """ The step is running and the inputs are exhausted :param step: :param exhausted: :return: """ return step in status and step in exhausted and status[step] == 'running' and all(in_ in exhausted[step] for in_ in st...
[ "def", "can_finalise", "(", "self", ",", "step", ",", "exhausted", ",", "status", ")", ":", "return", "step", "in", "status", "and", "step", "in", "exhausted", "and", "status", "[", "step", "]", "==", "'running'", "and", "all", "(", "in_", "in", "exhau...
The step is running and the inputs are exhausted :param step: :param exhausted: :return:
[ "The", "step", "is", "running", "and", "the", "inputs", "are", "exhausted", ":", "param", "step", ":", ":", "param", "exhausted", ":", ":", "return", ":" ]
train
https://github.com/childsish/sofia/blob/39b992f143e2610a62ad751568caa5ca9aaf0224/sofia/execution_engines/parallel_engine.py#L122-L129
childsish/sofia
sofia/execution_engines/parallel_engine.py
ParallelExecutionEngine.can_next
def can_next(self, step, inputs, workflow, status): """ All the outputs are empty and status is running or finalising :param step: :param inputs: :param workflow: :param status: :return: """ if not (step in status and status[step] in {'running', 'f...
python
def can_next(self, step, inputs, workflow, status): """ All the outputs are empty and status is running or finalising :param step: :param inputs: :param workflow: :param status: :return: """ if not (step in status and status[step] in {'running', 'f...
[ "def", "can_next", "(", "self", ",", "step", ",", "inputs", ",", "workflow", ",", "status", ")", ":", "if", "not", "(", "step", "in", "status", "and", "status", "[", "step", "]", "in", "{", "'running'", ",", "'finalising'", "}", ")", ":", "return", ...
All the outputs are empty and status is running or finalising :param step: :param inputs: :param workflow: :param status: :return:
[ "All", "the", "outputs", "are", "empty", "and", "status", "is", "running", "or", "finalising", ":", "param", "step", ":", ":", "param", "inputs", ":", ":", "param", "workflow", ":", ":", "param", "status", ":", ":", "return", ":" ]
train
https://github.com/childsish/sofia/blob/39b992f143e2610a62ad751568caa5ca9aaf0224/sofia/execution_engines/parallel_engine.py#L131-L145
inspirehep/inspire-matcher
inspire_matcher/api.py
match
def match(record, config=None): """Given a record, yield the records in INSPIRE most similar to it. This method can be used to detect if a record that we are ingesting as a submission or as an harvest is already present in the system, or to find out which record a reference should be pointing to. "...
python
def match(record, config=None): """Given a record, yield the records in INSPIRE most similar to it. This method can be used to detect if a record that we are ingesting as a submission or as an harvest is already present in the system, or to find out which record a reference should be pointing to. "...
[ "def", "match", "(", "record", ",", "config", "=", "None", ")", ":", "if", "config", "is", "None", ":", "current_app", ".", "logger", ".", "debug", "(", "'No configuration provided. Falling back to the default configuration.'", ")", "config", "=", "current_app", "...
Given a record, yield the records in INSPIRE most similar to it. This method can be used to detect if a record that we are ingesting as a submission or as an harvest is already present in the system, or to find out which record a reference should be pointing to.
[ "Given", "a", "record", "yield", "the", "records", "in", "INSPIRE", "most", "similar", "to", "it", "." ]
train
https://github.com/inspirehep/inspire-matcher/blob/1814e26c4d5faf205da2d5aa1638947c63db2d57/inspire_matcher/api.py#L49-L100
saxix/django-sysinfo
src/django_sysinfo/conf.py
merge
def merge(a, b, path=None): """merges b into a >>> a={1:{"a":"A"},2:{"b":"B"}, 8:[]} >>> b={2:{"c":"C"},3:{"d":"D"}} >>> c = merge(a, b) >>> c == a == {8: [], 1: {"a": "A"}, 2: {"c": "C", "b": "B"}, 3: {"d": "D"}} True >>> c = merge(a, {1: "a"}) >>> print(c[1]) a """ if pa...
python
def merge(a, b, path=None): """merges b into a >>> a={1:{"a":"A"},2:{"b":"B"}, 8:[]} >>> b={2:{"c":"C"},3:{"d":"D"}} >>> c = merge(a, b) >>> c == a == {8: [], 1: {"a": "A"}, 2: {"c": "C", "b": "B"}, 3: {"d": "D"}} True >>> c = merge(a, {1: "a"}) >>> print(c[1]) a """ if pa...
[ "def", "merge", "(", "a", ",", "b", ",", "path", "=", "None", ")", ":", "if", "path", "is", "None", ":", "path", "=", "[", "]", "for", "key", "in", "b", ":", "if", "key", "in", "a", ":", "if", "isinstance", "(", "a", "[", "key", "]", ",", ...
merges b into a >>> a={1:{"a":"A"},2:{"b":"B"}, 8:[]} >>> b={2:{"c":"C"},3:{"d":"D"}} >>> c = merge(a, b) >>> c == a == {8: [], 1: {"a": "A"}, 2: {"c": "C", "b": "B"}, 3: {"d": "D"}} True >>> c = merge(a, {1: "a"}) >>> print(c[1]) a
[ "merges", "b", "into", "a" ]
train
https://github.com/saxix/django-sysinfo/blob/c743e0f18a95dc9a92e7309abe871d72b97fcdb4/src/django_sysinfo/conf.py#L7-L35
bapakode/OmMongo
ommongo/session.py
Session.connect
def connect(self, database, timezone=None, cache_size=0, auto_ensure=True, replica_set=None, *args, **kwds): ''' `connect` is a thin wrapper around __init__ which creates the database connection that the session will use. :param database: the database name to use. Should be an instance of \ :class:`bases...
python
def connect(self, database, timezone=None, cache_size=0, auto_ensure=True, replica_set=None, *args, **kwds): ''' `connect` is a thin wrapper around __init__ which creates the database connection that the session will use. :param database: the database name to use. Should be an instance of \ :class:`bases...
[ "def", "connect", "(", "self", ",", "database", ",", "timezone", "=", "None", ",", "cache_size", "=", "0", ",", "auto_ensure", "=", "True", ",", "replica_set", "=", "None", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "safe", "=", "kwds", "."...
`connect` is a thin wrapper around __init__ which creates the database connection that the session will use. :param database: the database name to use. Should be an instance of \ :class:`basestring` :param safe: The value for the "safe" parameter of the Session \ init function :param auto_ensure:...
[ "connect", "is", "a", "thin", "wrapper", "around", "__init__", "which", "creates", "the", "database", "connection", "that", "the", "session", "will", "use", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L103-L134
bapakode/OmMongo
ommongo/session.py
Session.end
def end(self): ''' End the session. Flush all pending operations and ending the *pymongo* request''' self.cache = {} if self.transactions: raise TransactionException('Tried to end session with an open ' 'transaction') if not PYMONGO_3: self.db.connection.end_request()
python
def end(self): ''' End the session. Flush all pending operations and ending the *pymongo* request''' self.cache = {} if self.transactions: raise TransactionException('Tried to end session with an open ' 'transaction') if not PYMONGO_3: self.db.connection.end_request()
[ "def", "end", "(", "self", ")", ":", "self", ".", "cache", "=", "{", "}", "if", "self", ".", "transactions", ":", "raise", "TransactionException", "(", "'Tried to end session with an open '", "'transaction'", ")", "if", "not", "PYMONGO_3", ":", "self", ".", ...
End the session. Flush all pending operations and ending the *pymongo* request
[ "End", "the", "session", ".", "Flush", "all", "pending", "operations", "and", "ending", "the", "*", "pymongo", "*", "request" ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L161-L169
bapakode/OmMongo
ommongo/session.py
Session.insert
def insert(self, item, safe=None): # pragma: nocover ''' [DEPRECATED] Please use save() instead. This actually calls the underlying save function, so the name is confusing. Insert an item into the work queue and flushes.''' warnings.warn('Insert will be deprecated soon and removed in 1.0. Please use insert',...
python
def insert(self, item, safe=None): # pragma: nocover ''' [DEPRECATED] Please use save() instead. This actually calls the underlying save function, so the name is confusing. Insert an item into the work queue and flushes.''' warnings.warn('Insert will be deprecated soon and removed in 1.0. Please use insert',...
[ "def", "insert", "(", "self", ",", "item", ",", "safe", "=", "None", ")", ":", "# pragma: nocover", "warnings", ".", "warn", "(", "'Insert will be deprecated soon and removed in 1.0. Please use insert'", ",", "PendingDeprecationWarning", ")", "self", ".", "add", "(", ...
[DEPRECATED] Please use save() instead. This actually calls the underlying save function, so the name is confusing. Insert an item into the work queue and flushes.
[ "[", "DEPRECATED", "]", "Please", "use", "save", "()", "instead", ".", "This", "actually", "calls", "the", "underlying", "save", "function", "so", "the", "name", "is", "confusing", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L171-L178
bapakode/OmMongo
ommongo/session.py
Session.add
def add(self, item, safe=None): ''' Add an item into the queue of things to be inserted. Does not flush.''' item._set_session(self) if safe is None: safe = self.safe self.queue.append(SaveOp(self.transaction_id, self, item, safe)) # after the save op is recorded, the document has an _id and can be # cac...
python
def add(self, item, safe=None): ''' Add an item into the queue of things to be inserted. Does not flush.''' item._set_session(self) if safe is None: safe = self.safe self.queue.append(SaveOp(self.transaction_id, self, item, safe)) # after the save op is recorded, the document has an _id and can be # cac...
[ "def", "add", "(", "self", ",", "item", ",", "safe", "=", "None", ")", ":", "item", ".", "_set_session", "(", "self", ")", "if", "safe", "is", "None", ":", "safe", "=", "self", ".", "safe", "self", ".", "queue", ".", "append", "(", "SaveOp", "(",...
Add an item into the queue of things to be inserted. Does not flush.
[ "Add", "an", "item", "into", "the", "queue", "of", "things", "to", "be", "inserted", ".", "Does", "not", "flush", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L184-L194
bapakode/OmMongo
ommongo/session.py
Session.update
def update(self, item, id_expression=None, upsert=False, update_ops={}, safe=None, **kwargs): ''' Update an item in the database. Uses the on_update keyword to each field to decide which operations to do, or. :param item: An instance of a :class:`~ommongo.document.Document` \ subclass :param id_express...
python
def update(self, item, id_expression=None, upsert=False, update_ops={}, safe=None, **kwargs): ''' Update an item in the database. Uses the on_update keyword to each field to decide which operations to do, or. :param item: An instance of a :class:`~ommongo.document.Document` \ subclass :param id_express...
[ "def", "update", "(", "self", ",", "item", ",", "id_expression", "=", "None", ",", "upsert", "=", "False", ",", "update_ops", "=", "{", "}", ",", "safe", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "safe", "is", "None", ":", "safe", "="...
Update an item in the database. Uses the on_update keyword to each field to decide which operations to do, or. :param item: An instance of a :class:`~ommongo.document.Document` \ subclass :param id_expression: A query expression that uniquely picks out \ the item which should be updated. If id_expre...
[ "Update", "an", "item", "in", "the", "database", ".", "Uses", "the", "on_update", "keyword", "to", "each", "field", "to", "decide", "which", "operations", "to", "do", "or", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L196-L227
bapakode/OmMongo
ommongo/session.py
Session.query
def query(self, type, exclude_subclasses=False): ''' Begin a query on the database's collection for `type`. If `type` is an instance of basesting, the query will be in raw query mode which will not check field values or transform returned results into python objects. .. seealso:: :class:`~ommongo.query....
python
def query(self, type, exclude_subclasses=False): ''' Begin a query on the database's collection for `type`. If `type` is an instance of basesting, the query will be in raw query mode which will not check field values or transform returned results into python objects. .. seealso:: :class:`~ommongo.query....
[ "def", "query", "(", "self", ",", "type", ",", "exclude_subclasses", "=", "False", ")", ":", "# This really should be adding a query operation to the", "# queue which is then forced to execute when the results are being", "# read", "if", "isinstance", "(", "type", ",", "bases...
Begin a query on the database's collection for `type`. If `type` is an instance of basesting, the query will be in raw query mode which will not check field values or transform returned results into python objects. .. seealso:: :class:`~ommongo.query.Query` class
[ "Begin", "a", "query", "on", "the", "database", "s", "collection", "for", "type", ".", "If", "type", "is", "an", "instance", "of", "basesting", "the", "query", "will", "be", "in", "raw", "query", "mode", "which", "will", "not", "check", "field", "values"...
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L229-L241
bapakode/OmMongo
ommongo/session.py
Session.execute_query
def execute_query(self, query, session): ''' Get the results of ``query``. This method does flush in a transaction, so any objects retrieved which are not in the cache which would be updated when the transaction finishes will be stale ''' self.auto_ensure_indexes(query.type) kwargs = dict() if query....
python
def execute_query(self, query, session): ''' Get the results of ``query``. This method does flush in a transaction, so any objects retrieved which are not in the cache which would be updated when the transaction finishes will be stale ''' self.auto_ensure_indexes(query.type) kwargs = dict() if query....
[ "def", "execute_query", "(", "self", ",", "query", ",", "session", ")", ":", "self", ".", "auto_ensure_indexes", "(", "query", ".", "type", ")", "kwargs", "=", "dict", "(", ")", "if", "query", ".", "_get_fields", "(", ")", ":", "if", "PYMONGO_3", ":", ...
Get the results of ``query``. This method does flush in a transaction, so any objects retrieved which are not in the cache which would be updated when the transaction finishes will be stale
[ "Get", "the", "results", "of", "query", ".", "This", "method", "does", "flush", "in", "a", "transaction", "so", "any", "objects", "retrieved", "which", "are", "not", "in", "the", "cache", "which", "would", "be", "updated", "when", "the", "transaction", "fi...
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L259-L306
bapakode/OmMongo
ommongo/session.py
Session.remove
def remove(self, obj, safe=None): ''' Remove a particular object from the database. If the object has no mongo ID set, the method just returns. If this is a partial document without the mongo ID field retrieved a ``FieldNotRetrieved`` will be raised :param obj: the object to save :param safe: whe...
python
def remove(self, obj, safe=None): ''' Remove a particular object from the database. If the object has no mongo ID set, the method just returns. If this is a partial document without the mongo ID field retrieved a ``FieldNotRetrieved`` will be raised :param obj: the object to save :param safe: whe...
[ "def", "remove", "(", "self", ",", "obj", ",", "safe", "=", "None", ")", ":", "if", "safe", "is", "None", ":", "safe", "=", "self", ".", "safe", "remove", "=", "RemoveDocumentOp", "(", "self", ".", "transaction_id", ",", "self", ",", "obj", ",", "s...
Remove a particular object from the database. If the object has no mongo ID set, the method just returns. If this is a partial document without the mongo ID field retrieved a ``FieldNotRetrieved`` will be raised :param obj: the object to save :param safe: whether to wait for the operation to complete....
[ "Remove", "a", "particular", "object", "from", "the", "database", ".", "If", "the", "object", "has", "no", "mongo", "ID", "set", "the", "method", "just", "returns", ".", "If", "this", "is", "a", "partial", "document", "without", "the", "mongo", "ID", "fi...
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L314-L330
bapakode/OmMongo
ommongo/session.py
Session.execute_remove
def execute_remove(self, remove): ''' Execute a remove expression. Should generally only be called implicitly. ''' safe = self.safe if remove.safe is not None: safe = remove.safe self.queue.append(RemoveOp(self.transaction_id, self, remove.type, safe, remove)) if self.autoflush: return self.flush()
python
def execute_remove(self, remove): ''' Execute a remove expression. Should generally only be called implicitly. ''' safe = self.safe if remove.safe is not None: safe = remove.safe self.queue.append(RemoveOp(self.transaction_id, self, remove.type, safe, remove)) if self.autoflush: return self.flush()
[ "def", "execute_remove", "(", "self", ",", "remove", ")", ":", "safe", "=", "self", ".", "safe", "if", "remove", ".", "safe", "is", "not", "None", ":", "safe", "=", "remove", ".", "safe", "self", ".", "queue", ".", "append", "(", "RemoveOp", "(", "...
Execute a remove expression. Should generally only be called implicitly.
[ "Execute", "a", "remove", "expression", ".", "Should", "generally", "only", "be", "called", "implicitly", "." ]
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/session.py#L332-L342