repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
yunojuno-archive/django-inbound-email
inbound_email/backends/sendgrid.py
_decode_POST_value
def _decode_POST_value(request, field_name, default=None): """Helper to decode a request field into unicode based on charsets encoding. Args: request: the HttpRequest object. field_name: the field expected in the request.POST Kwargs: default: if passed in then field is optional and...
python
def _decode_POST_value(request, field_name, default=None): """Helper to decode a request field into unicode based on charsets encoding. Args: request: the HttpRequest object. field_name: the field expected in the request.POST Kwargs: default: if passed in then field is optional and...
[ "def", "_decode_POST_value", "(", "request", ",", "field_name", ",", "default", "=", "None", ")", ":", "if", "default", "is", "None", ":", "value", "=", "request", ".", "POST", "[", "field_name", "]", "else", ":", "value", "=", "request", ".", "POST", ...
Helper to decode a request field into unicode based on charsets encoding. Args: request: the HttpRequest object. field_name: the field expected in the request.POST Kwargs: default: if passed in then field is optional and default is used if not found; if None, then assume fi...
[ "Helper", "to", "decode", "a", "request", "field", "into", "unicode", "based", "on", "charsets", "encoding", "." ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/sendgrid.py#L17-L45
train
yunojuno-archive/django-inbound-email
inbound_email/backends/sendgrid.py
SendGridRequestParser._get_addresses
def _get_addresses(self, address_data, retain_name=False): """ Takes RFC-compliant email addresses in both terse (email only) and verbose (name + email) forms and returns a list of email address strings (TODO: breaking change that returns a tuple of (name, email) per string) ...
python
def _get_addresses(self, address_data, retain_name=False): """ Takes RFC-compliant email addresses in both terse (email only) and verbose (name + email) forms and returns a list of email address strings (TODO: breaking change that returns a tuple of (name, email) per string) ...
[ "def", "_get_addresses", "(", "self", ",", "address_data", ",", "retain_name", "=", "False", ")", ":", "if", "retain_name", ":", "raise", "NotImplementedError", "(", "\"Not yet implemented, but will need client-code changes too\"", ")", "# We trust than an email address conta...
Takes RFC-compliant email addresses in both terse (email only) and verbose (name + email) forms and returns a list of email address strings (TODO: breaking change that returns a tuple of (name, email) per string)
[ "Takes", "RFC", "-", "compliant", "email", "addresses", "in", "both", "terse", "(", "email", "only", ")", "and", "verbose", "(", "name", "+", "email", ")", "forms", "and", "returns", "a", "list", "of", "email", "address", "strings" ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/sendgrid.py#L51-L76
train
yunojuno-archive/django-inbound-email
inbound_email/backends/sendgrid.py
SendGridRequestParser.parse
def parse(self, request): """Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing the forwarded email, as per the SendGrid specification for inbound emails. Returns: an EmailMultiAlternatives instance, con...
python
def parse(self, request): """Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing the forwarded email, as per the SendGrid specification for inbound emails. Returns: an EmailMultiAlternatives instance, con...
[ "def", "parse", "(", "self", ",", "request", ")", ":", "assert", "isinstance", "(", "request", ",", "HttpRequest", ")", ",", "\"Invalid request type: %s\"", "%", "type", "(", "request", ")", "try", ":", "# from_email should never be a list (unless we change our API)",...
Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing the forwarded email, as per the SendGrid specification for inbound emails. Returns: an EmailMultiAlternatives instance, containing the parsed contents ...
[ "Parse", "incoming", "request", "and", "return", "an", "email", "instance", "." ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/sendgrid.py#L78-L146
train
yunojuno-archive/django-inbound-email
inbound_email/backends/mailgun.py
MailgunRequestParser.parse
def parse(self, request): """Parse incoming request and return an email instance. Mailgun does a lot of the heavy lifting at their end - requests come in from them UTF-8 encoded, and with the message reply and signature stripped out for you. Args: request: an HttpRe...
python
def parse(self, request): """Parse incoming request and return an email instance. Mailgun does a lot of the heavy lifting at their end - requests come in from them UTF-8 encoded, and with the message reply and signature stripped out for you. Args: request: an HttpRe...
[ "def", "parse", "(", "self", ",", "request", ")", ":", "assert", "isinstance", "(", "request", ",", "HttpRequest", ")", ",", "\"Invalid request type: %s\"", "%", "type", "(", "request", ")", "try", ":", "subject", "=", "request", ".", "POST", ".", "get", ...
Parse incoming request and return an email instance. Mailgun does a lot of the heavy lifting at their end - requests come in from them UTF-8 encoded, and with the message reply and signature stripped out for you. Args: request: an HttpRequest object, containing the forwarde...
[ "Parse", "incoming", "request", "and", "return", "an", "email", "instance", "." ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/mailgun.py#L16-L82
train
yunojuno-archive/django-inbound-email
inbound_email/backends/mandrill.py
MandrillRequestParser._get_recipients
def _get_recipients(self, array): """Returns an iterator of objects in the form ["Name <address@example.com", ...] from the array [["address@example.com", "Name"]] """ for address, name in array: if not name: yield address else: ...
python
def _get_recipients(self, array): """Returns an iterator of objects in the form ["Name <address@example.com", ...] from the array [["address@example.com", "Name"]] """ for address, name in array: if not name: yield address else: ...
[ "def", "_get_recipients", "(", "self", ",", "array", ")", ":", "for", "address", ",", "name", "in", "array", ":", "if", "not", "name", ":", "yield", "address", "else", ":", "yield", "\"\\\"%s\\\" <%s>\"", "%", "(", "name", ",", "address", ")" ]
Returns an iterator of objects in the form ["Name <address@example.com", ...] from the array [["address@example.com", "Name"]]
[ "Returns", "an", "iterator", "of", "objects", "in", "the", "form", "[", "Name", "<address" ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/mandrill.py#L90-L99
train
yunojuno-archive/django-inbound-email
inbound_email/backends/mandrill.py
MandrillRequestParser.parse
def parse(self, request): """Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing a list of forwarded emails, as per Mandrill specification for inbound emails. Returns: a list of EmailMultiAlternatives ins...
python
def parse(self, request): """Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing a list of forwarded emails, as per Mandrill specification for inbound emails. Returns: a list of EmailMultiAlternatives ins...
[ "def", "parse", "(", "self", ",", "request", ")", ":", "assert", "isinstance", "(", "request", ",", "HttpRequest", ")", ",", "\"Invalid request type: %s\"", "%", "type", "(", "request", ")", "if", "settings", ".", "INBOUND_MANDRILL_AUTHENTICATION_KEY", ":", "_ch...
Parse incoming request and return an email instance. Args: request: an HttpRequest object, containing a list of forwarded emails, as per Mandrill specification for inbound emails. Returns: a list of EmailMultiAlternatives instances
[ "Parse", "incoming", "request", "and", "return", "an", "email", "instance", "." ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/mandrill.py#L107-L176
train
yunojuno-archive/django-inbound-email
inbound_email/views.py
_log_request
def _log_request(request): """Helper function to dump out debug info.""" logger.debug("Inbound email received") for k, v in list(request.POST.items()): logger.debug("- POST['%s']='%s'" % (k, v)) for n, f in list(request.FILES.items()): logger.debug("- FILES['%s']: '%s', %sB", n, f.cont...
python
def _log_request(request): """Helper function to dump out debug info.""" logger.debug("Inbound email received") for k, v in list(request.POST.items()): logger.debug("- POST['%s']='%s'" % (k, v)) for n, f in list(request.FILES.items()): logger.debug("- FILES['%s']: '%s', %sB", n, f.cont...
[ "def", "_log_request", "(", "request", ")", ":", "logger", ".", "debug", "(", "\"Inbound email received\"", ")", "for", "k", ",", "v", "in", "list", "(", "request", ".", "POST", ".", "items", "(", ")", ")", ":", "logger", ".", "debug", "(", "\"- POST['...
Helper function to dump out debug info.
[ "Helper", "function", "to", "dump", "out", "debug", "info", "." ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/views.py#L23-L31
train
yunojuno-archive/django-inbound-email
inbound_email/views.py
receive_inbound_email
def receive_inbound_email(request): """Receives inbound email from SendGrid. This view receives the email from SendGrid, parses the contents, logs the message and the fires the inbound_email signal. """ # log the request.POST and request.FILES contents if log_requests is True: _log_req...
python
def receive_inbound_email(request): """Receives inbound email from SendGrid. This view receives the email from SendGrid, parses the contents, logs the message and the fires the inbound_email signal. """ # log the request.POST and request.FILES contents if log_requests is True: _log_req...
[ "def", "receive_inbound_email", "(", "request", ")", ":", "# log the request.POST and request.FILES contents", "if", "log_requests", "is", "True", ":", "_log_request", "(", "request", ")", "# HEAD requests are used by some backends to validate the route", "if", "request", ".", ...
Receives inbound email from SendGrid. This view receives the email from SendGrid, parses the contents, logs the message and the fires the inbound_email signal.
[ "Receives", "inbound", "email", "from", "SendGrid", "." ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/views.py#L36-L97
train
yunojuno-archive/django-inbound-email
inbound_email/backends/__init__.py
get_backend_class
def get_backend_class(): """Return reference to the configured backed class.""" # this will (intentionally) blow up if the setting does not exist assert hasattr(settings, 'INBOUND_EMAIL_PARSER') assert getattr(settings, 'INBOUND_EMAIL_PARSER') is not None package, klass = settings.INBOUND_EMAIL_PAR...
python
def get_backend_class(): """Return reference to the configured backed class.""" # this will (intentionally) blow up if the setting does not exist assert hasattr(settings, 'INBOUND_EMAIL_PARSER') assert getattr(settings, 'INBOUND_EMAIL_PARSER') is not None package, klass = settings.INBOUND_EMAIL_PAR...
[ "def", "get_backend_class", "(", ")", ":", "# this will (intentionally) blow up if the setting does not exist", "assert", "hasattr", "(", "settings", ",", "'INBOUND_EMAIL_PARSER'", ")", "assert", "getattr", "(", "settings", ",", "'INBOUND_EMAIL_PARSER'", ")", "is", "not", ...
Return reference to the configured backed class.
[ "Return", "reference", "to", "the", "configured", "backed", "class", "." ]
c0c1186fc2ced56b43d6b223e73cd5e8700dfc48
https://github.com/yunojuno-archive/django-inbound-email/blob/c0c1186fc2ced56b43d6b223e73cd5e8700dfc48/inbound_email/backends/__init__.py#L6-L14
train
rsheftel/raccoon
raccoon/sort_utils.py
sorted_exists
def sorted_exists(values, x): """ For list, values, returns the insert position for item x and whether the item already exists in the list. This allows one function call to return either the index to overwrite an existing value in the list, or the index to insert a new item in the list and keep the list...
python
def sorted_exists(values, x): """ For list, values, returns the insert position for item x and whether the item already exists in the list. This allows one function call to return either the index to overwrite an existing value in the list, or the index to insert a new item in the list and keep the list...
[ "def", "sorted_exists", "(", "values", ",", "x", ")", ":", "i", "=", "bisect_left", "(", "values", ",", "x", ")", "j", "=", "bisect_right", "(", "values", ",", "x", ")", "exists", "=", "x", "in", "values", "[", "i", ":", "j", "]", "return", "exis...
For list, values, returns the insert position for item x and whether the item already exists in the list. This allows one function call to return either the index to overwrite an existing value in the list, or the index to insert a new item in the list and keep the list in sorted order. :param values: list...
[ "For", "list", "values", "returns", "the", "insert", "position", "for", "item", "x", "and", "whether", "the", "item", "already", "exists", "in", "the", "list", ".", "This", "allows", "one", "function", "call", "to", "return", "either", "the", "index", "to"...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/sort_utils.py#L8-L21
train
rsheftel/raccoon
raccoon/sort_utils.py
sorted_index
def sorted_index(values, x): """ For list, values, returns the index location of element x. If x does not exist will raise an error. :param values: list :param x: item :return: integer index """ i = bisect_left(values, x) j = bisect_right(values, x) return values[i:j].index(x) + i
python
def sorted_index(values, x): """ For list, values, returns the index location of element x. If x does not exist will raise an error. :param values: list :param x: item :return: integer index """ i = bisect_left(values, x) j = bisect_right(values, x) return values[i:j].index(x) + i
[ "def", "sorted_index", "(", "values", ",", "x", ")", ":", "i", "=", "bisect_left", "(", "values", ",", "x", ")", "j", "=", "bisect_right", "(", "values", ",", "x", ")", "return", "values", "[", "i", ":", "j", "]", ".", "index", "(", "x", ")", "...
For list, values, returns the index location of element x. If x does not exist will raise an error. :param values: list :param x: item :return: integer index
[ "For", "list", "values", "returns", "the", "index", "location", "of", "element", "x", ".", "If", "x", "does", "not", "exist", "will", "raise", "an", "error", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/sort_utils.py#L24-L34
train
rsheftel/raccoon
raccoon/sort_utils.py
sorted_list_indexes
def sorted_list_indexes(list_to_sort, key=None, reverse=False): """ Sorts a list but returns the order of the index values of the list for the sort and not the values themselves. For example is the list provided is ['b', 'a', 'c'] then the result will be [2, 1, 3] :param list_to_sort: list to sort ...
python
def sorted_list_indexes(list_to_sort, key=None, reverse=False): """ Sorts a list but returns the order of the index values of the list for the sort and not the values themselves. For example is the list provided is ['b', 'a', 'c'] then the result will be [2, 1, 3] :param list_to_sort: list to sort ...
[ "def", "sorted_list_indexes", "(", "list_to_sort", ",", "key", "=", "None", ",", "reverse", "=", "False", ")", ":", "if", "key", "is", "not", "None", ":", "def", "key_func", "(", "i", ")", ":", "return", "key", "(", "list_to_sort", ".", "__getitem__", ...
Sorts a list but returns the order of the index values of the list for the sort and not the values themselves. For example is the list provided is ['b', 'a', 'c'] then the result will be [2, 1, 3] :param list_to_sort: list to sort :param key: if not None then a function of one argument that is used to extr...
[ "Sorts", "a", "list", "but", "returns", "the", "order", "of", "the", "index", "values", "of", "the", "list", "for", "the", "sort", "and", "not", "the", "values", "themselves", ".", "For", "example", "is", "the", "list", "provided", "is", "[", "b", "a",...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/sort_utils.py#L37-L53
train
vmlaker/mpipe
doc/create.py
runDia
def runDia(diagram): """Generate the diagrams using Dia.""" ifname = '{}.dia'.format(diagram) ofname = '{}.png'.format(diagram) cmd = 'dia -t png-libart -e {} {}'.format(ofname, ifname) print(' {}'.format(cmd)) subprocess.call(cmd, shell=True) return True
python
def runDia(diagram): """Generate the diagrams using Dia.""" ifname = '{}.dia'.format(diagram) ofname = '{}.png'.format(diagram) cmd = 'dia -t png-libart -e {} {}'.format(ofname, ifname) print(' {}'.format(cmd)) subprocess.call(cmd, shell=True) return True
[ "def", "runDia", "(", "diagram", ")", ":", "ifname", "=", "'{}.dia'", ".", "format", "(", "diagram", ")", "ofname", "=", "'{}.png'", ".", "format", "(", "diagram", ")", "cmd", "=", "'dia -t png-libart -e {} {}'", ".", "format", "(", "ofname", ",", "ifname"...
Generate the diagrams using Dia.
[ "Generate", "the", "diagrams", "using", "Dia", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/doc/create.py#L37-L44
train
vmlaker/mpipe
src/OrderedWorker.py
OrderedWorker.init2
def init2( self, input_tube, # Read task from the input tube. output_tubes, # Send result on all the output tubes. num_workers, # Total number of workers in the stage. disable_result, # Whether to override any result with None. do_stop_task, # Whether to ...
python
def init2( self, input_tube, # Read task from the input tube. output_tubes, # Send result on all the output tubes. num_workers, # Total number of workers in the stage. disable_result, # Whether to override any result with None. do_stop_task, # Whether to ...
[ "def", "init2", "(", "self", ",", "input_tube", ",", "# Read task from the input tube.", "output_tubes", ",", "# Send result on all the output tubes.", "num_workers", ",", "# Total number of workers in the stage.", "disable_result", ",", "# Whether to override any result with None.",...
Create *num_workers* worker objects with *input_tube* and an iterable of *output_tubes*. The worker reads a task from *input_tube* and writes the result to *output_tubes*.
[ "Create", "*", "num_workers", "*", "worker", "objects", "with", "*", "input_tube", "*", "and", "an", "iterable", "of", "*", "output_tubes", "*", ".", "The", "worker", "reads", "a", "task", "from", "*", "input_tube", "*", "and", "writes", "the", "result", ...
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/OrderedWorker.py#L19-L45
train
vmlaker/mpipe
src/OrderedWorker.py
OrderedWorker.assemble
def assemble( cls, args, input_tube, output_tubes, size, disable_result=False, do_stop_task=False, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result com...
python
def assemble( cls, args, input_tube, output_tubes, size, disable_result=False, do_stop_task=False, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result com...
[ "def", "assemble", "(", "cls", ",", "args", ",", "input_tube", ",", "output_tubes", ",", "size", ",", "disable_result", "=", "False", ",", "do_stop_task", "=", "False", ",", ")", ":", "# Create the workers.", "workers", "=", "[", "]", "for", "ii", "in", ...
Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication channels *input_tube* and *output_tubes*. The number of workers created is according to *size* parameter. *do_stop_task* indicates whether doTask() will be...
[ "Create", "assemble", "and", "start", "workers", ".", "Workers", "are", "created", "of", "class", "*", "cls", "*", "initialized", "with", "*", "args", "*", "and", "given", "task", "/", "result", "communication", "channels", "*", "input_tube", "*", "and", "...
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/OrderedWorker.py#L53-L93
train
vmlaker/mpipe
src/OrderedWorker.py
OrderedWorker._link
def _link(self, next_worker, next_is_first=False): """Link the worker to the given next worker object, connecting the two workers with communication tubes.""" lock = multiprocessing.Lock() next_worker._lock_prev_input = lock self._lock_next_input = lock lock.acquire() ...
python
def _link(self, next_worker, next_is_first=False): """Link the worker to the given next worker object, connecting the two workers with communication tubes.""" lock = multiprocessing.Lock() next_worker._lock_prev_input = lock self._lock_next_input = lock lock.acquire() ...
[ "def", "_link", "(", "self", ",", "next_worker", ",", "next_is_first", "=", "False", ")", ":", "lock", "=", "multiprocessing", ".", "Lock", "(", ")", "next_worker", ".", "_lock_prev_input", "=", "lock", "self", ".", "_lock_next_input", "=", "lock", "lock", ...
Link the worker to the given next worker object, connecting the two workers with communication tubes.
[ "Link", "the", "worker", "to", "the", "given", "next", "worker", "object", "connecting", "the", "two", "workers", "with", "communication", "tubes", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/OrderedWorker.py#L95-L112
train
vmlaker/mpipe
src/OrderedWorker.py
OrderedWorker.putResult
def putResult(self, result): """Register the *result* by putting it on all the output tubes.""" self._lock_prev_output.acquire() for tube in self._tubes_result_output: tube.put((result, 0)) self._lock_next_output.release()
python
def putResult(self, result): """Register the *result* by putting it on all the output tubes.""" self._lock_prev_output.acquire() for tube in self._tubes_result_output: tube.put((result, 0)) self._lock_next_output.release()
[ "def", "putResult", "(", "self", ",", "result", ")", ":", "self", ".", "_lock_prev_output", ".", "acquire", "(", ")", "for", "tube", "in", "self", ".", "_tubes_result_output", ":", "tube", ".", "put", "(", "(", "result", ",", "0", ")", ")", "self", "...
Register the *result* by putting it on all the output tubes.
[ "Register", "the", "*", "result", "*", "by", "putting", "it", "on", "all", "the", "output", "tubes", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/OrderedWorker.py#L114-L119
train
vmlaker/mpipe
src/UnorderedWorker.py
UnorderedWorker.init2
def init2( self, input_tube, # Read task from the input tube. output_tubes, # Send result on all the output tubes. num_workers, # Total number of workers in the stage. disable_result, # Whether to override any result with None. do_stop_task, # Whether to ...
python
def init2( self, input_tube, # Read task from the input tube. output_tubes, # Send result on all the output tubes. num_workers, # Total number of workers in the stage. disable_result, # Whether to override any result with None. do_stop_task, # Whether to ...
[ "def", "init2", "(", "self", ",", "input_tube", ",", "# Read task from the input tube.", "output_tubes", ",", "# Send result on all the output tubes.", "num_workers", ",", "# Total number of workers in the stage.", "disable_result", ",", "# Whether to override any result with None.",...
Create *num_workers* worker objects with *input_tube* and an iterable of *output_tubes*. The worker reads a task from *input_tube* and writes the result to *output_tubes*.
[ "Create", "*", "num_workers", "*", "worker", "objects", "with", "*", "input_tube", "*", "and", "an", "iterable", "of", "*", "output_tubes", "*", ".", "The", "worker", "reads", "a", "task", "from", "*", "input_tube", "*", "and", "writes", "the", "result", ...
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/UnorderedWorker.py#L17-L34
train
vmlaker/mpipe
src/UnorderedWorker.py
UnorderedWorker.assemble
def assemble( cls, args, input_tube, output_tubes, size, disable_result, do_stop_task, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication c...
python
def assemble( cls, args, input_tube, output_tubes, size, disable_result, do_stop_task, ): """Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication c...
[ "def", "assemble", "(", "cls", ",", "args", ",", "input_tube", ",", "output_tubes", ",", "size", ",", "disable_result", ",", "do_stop_task", ",", ")", ":", "# Create the workers.", "workers", "=", "[", "]", "for", "ii", "in", "range", "(", "size", ")", "...
Create, assemble and start workers. Workers are created of class *cls*, initialized with *args*, and given task/result communication channels *input_tube* and *output_tubes*. The number of workers created is according to *size* parameter. *do_stop_task* indicates whether doTask() will be...
[ "Create", "assemble", "and", "start", "workers", ".", "Workers", "are", "created", "of", "class", "*", "cls", "*", "initialized", "with", "*", "args", "*", "and", "given", "task", "/", "result", "communication", "channels", "*", "input_tube", "*", "and", "...
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/UnorderedWorker.py#L42-L73
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.show
def show(self, index=True, **kwargs): """ Print the contents of the Series. This method uses the tabulate function from the tabulate package. Use the kwargs to pass along any arguments to the tabulate function. :param index: If True then include the indexes as a column in the output, if...
python
def show(self, index=True, **kwargs): """ Print the contents of the Series. This method uses the tabulate function from the tabulate package. Use the kwargs to pass along any arguments to the tabulate function. :param index: If True then include the indexes as a column in the output, if...
[ "def", "show", "(", "self", ",", "index", "=", "True", ",", "*", "*", "kwargs", ")", ":", "print", "(", "self", ".", "_make_table", "(", "index", "=", "index", ",", "*", "*", "kwargs", ")", ")" ]
Print the contents of the Series. This method uses the tabulate function from the tabulate package. Use the kwargs to pass along any arguments to the tabulate function. :param index: If True then include the indexes as a column in the output, if False ignore the index :param kwargs: Parameters ...
[ "Print", "the", "contents", "of", "the", "Series", ".", "This", "method", "uses", "the", "tabulate", "function", "from", "the", "tabulate", "package", ".", "Use", "the", "kwargs", "to", "pass", "along", "any", "arguments", "to", "the", "tabulate", "function"...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L50-L59
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.get
def get(self, indexes, as_list=False): """ Given indexes will return a sub-set of the Series. This method will direct to the specific methods based on what types are passed in for the indexes. The type of the return is determined by the types of the parameters. :param indexes: i...
python
def get(self, indexes, as_list=False): """ Given indexes will return a sub-set of the Series. This method will direct to the specific methods based on what types are passed in for the indexes. The type of the return is determined by the types of the parameters. :param indexes: i...
[ "def", "get", "(", "self", ",", "indexes", ",", "as_list", "=", "False", ")", ":", "if", "isinstance", "(", "indexes", ",", "(", "list", ",", "blist", ")", ")", ":", "return", "self", ".", "get_rows", "(", "indexes", ",", "as_list", ")", "else", ":...
Given indexes will return a sub-set of the Series. This method will direct to the specific methods based on what types are passed in for the indexes. The type of the return is determined by the types of the parameters. :param indexes: index value, list of index values, or a list of booleans. ...
[ "Given", "indexes", "will", "return", "a", "sub", "-", "set", "of", "the", "Series", ".", "This", "method", "will", "direct", "to", "the", "specific", "methods", "based", "on", "what", "types", "are", "passed", "in", "for", "the", "indexes", ".", "The", ...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L97-L110
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_cell
def get_cell(self, index): """ For a single index and return the value :param index: index value :return: value """ i = sorted_index(self._index, index) if self._sort else self._index.index(index) return self._data[i]
python
def get_cell(self, index): """ For a single index and return the value :param index: index value :return: value """ i = sorted_index(self._index, index) if self._sort else self._index.index(index) return self._data[i]
[ "def", "get_cell", "(", "self", ",", "index", ")", ":", "i", "=", "sorted_index", "(", "self", ".", "_index", ",", "index", ")", "if", "self", ".", "_sort", "else", "self", ".", "_index", ".", "index", "(", "index", ")", "return", "self", ".", "_da...
For a single index and return the value :param index: index value :return: value
[ "For", "a", "single", "index", "and", "return", "the", "value" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L112-L120
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_rows
def get_rows(self, indexes, as_list=False): """ For a list of indexes return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param as_list: if True return a list, if False return Series ...
python
def get_rows(self, indexes, as_list=False): """ For a list of indexes return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param as_list: if True return a list, if False return Series ...
[ "def", "get_rows", "(", "self", ",", "indexes", ",", "as_list", "=", "False", ")", ":", "if", "all", "(", "[", "isinstance", "(", "i", ",", "bool", ")", "for", "i", "in", "indexes", "]", ")", ":", "# boolean list", "if", "len", "(", "indexes", ")",...
For a list of indexes return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param as_list: if True return a list, if False return Series :return: Series if as_list if False, a list if as_list is True
[ "For", "a", "list", "of", "indexes", "return", "the", "values", "of", "the", "indexes", "in", "that", "column", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L122-L145
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_location
def get_location(self, location): """ For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in standard python notation [-3,...
python
def get_location(self, location): """ For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in standard python notation [-3,...
[ "def", "get_location", "(", "self", ",", "location", ")", ":", "return", "{", "self", ".", "index_name", ":", "self", ".", "_index", "[", "location", "]", ",", "self", ".", "data_name", ":", "self", ".", "_data", "[", "location", "]", "}" ]
For an index location return a dict of the index and value. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end of the SEries in standard python notation [-3, -2, -1] :param location: index location in s...
[ "For", "an", "index", "location", "return", "a", "dict", "of", "the", "index", "and", "value", ".", "This", "is", "optimized", "for", "speed", "because", "it", "does", "not", "need", "to", "lookup", "the", "index", "location", "with", "a", "search", ".",...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L147-L156
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_locations
def get_locations(self, locations, as_list=False): """ For list of locations return a Series or list of the values. :param locations: list of index locations :param as_list: True to return a list of values :return: Series or list """ indexes = [self._index[x] fo...
python
def get_locations(self, locations, as_list=False): """ For list of locations return a Series or list of the values. :param locations: list of index locations :param as_list: True to return a list of values :return: Series or list """ indexes = [self._index[x] fo...
[ "def", "get_locations", "(", "self", ",", "locations", ",", "as_list", "=", "False", ")", ":", "indexes", "=", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "locations", "]", "return", "self", ".", "get", "(", "indexes", ",", "as_list"...
For list of locations return a Series or list of the values. :param locations: list of index locations :param as_list: True to return a list of values :return: Series or list
[ "For", "list", "of", "locations", "return", "a", "Series", "or", "list", "of", "the", "values", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L158-L168
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.get_slice
def get_slice(self, start_index=None, stop_index=None, as_list=False): """ For sorted Series will return either a Series or list of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. If either the ...
python
def get_slice(self, start_index=None, stop_index=None, as_list=False): """ For sorted Series will return either a Series or list of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. If either the ...
[ "def", "get_slice", "(", "self", ",", "start_index", "=", "None", ",", "stop_index", "=", "None", ",", "as_list", "=", "False", ")", ":", "if", "not", "self", ".", "_sort", ":", "raise", "RuntimeError", "(", "'Can only use get_slice on sorted Series'", ")", ...
For sorted Series will return either a Series or list of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. If either the start or stop index is None then will include from the first or last element, similar to st...
[ "For", "sorted", "Series", "will", "return", "either", "a", "Series", "or", "list", "of", "all", "of", "the", "rows", "where", "the", "index", "is", "greater", "than", "or", "equal", "to", "the", "start_index", "if", "provided", "and", "less", "than", "o...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L170-L195
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.to_dict
def to_dict(self, index=True, ordered=False): """ Returns a dict where the keys are the data and index names and the values are list of the data and index. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an Orde...
python
def to_dict(self, index=True, ordered=False): """ Returns a dict where the keys are the data and index names and the values are list of the data and index. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an Orde...
[ "def", "to_dict", "(", "self", ",", "index", "=", "True", ",", "ordered", "=", "False", ")", ":", "result", "=", "OrderedDict", "(", ")", "if", "ordered", "else", "dict", "(", ")", "if", "index", ":", "result", ".", "update", "(", "{", "self", ".",...
Returns a dict where the keys are the data and index names and the values are list of the data and index. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an OrderedDict() to preserve the order of the columns in the Series ...
[ "Returns", "a", "dict", "where", "the", "keys", "are", "the", "data", "and", "index", "names", "and", "the", "values", "are", "list", "of", "the", "data", "and", "index", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L235-L251
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.head
def head(self, rows): """ Return a Series of the first N rows :param rows: number of rows :return: Series """ rows_bool = [True] * min(rows, len(self._index)) rows_bool.extend([False] * max(0, len(self._index) - rows)) return self.get(indexes=rows_bool)
python
def head(self, rows): """ Return a Series of the first N rows :param rows: number of rows :return: Series """ rows_bool = [True] * min(rows, len(self._index)) rows_bool.extend([False] * max(0, len(self._index) - rows)) return self.get(indexes=rows_bool)
[ "def", "head", "(", "self", ",", "rows", ")", ":", "rows_bool", "=", "[", "True", "]", "*", "min", "(", "rows", ",", "len", "(", "self", ".", "_index", ")", ")", "rows_bool", ".", "extend", "(", "[", "False", "]", "*", "max", "(", "0", ",", "...
Return a Series of the first N rows :param rows: number of rows :return: Series
[ "Return", "a", "Series", "of", "the", "first", "N", "rows" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L253-L262
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.select_index
def select_index(self, compare, result='boolean'): """ Finds the elements in the index that match the compare parameter and returns either a list of the values that match, of a boolean list the length of the index with True to each index that matches. If the indexes are tuples then the c...
python
def select_index(self, compare, result='boolean'): """ Finds the elements in the index that match the compare parameter and returns either a list of the values that match, of a boolean list the length of the index with True to each index that matches. If the indexes are tuples then the c...
[ "def", "select_index", "(", "self", ",", "compare", ",", "result", "=", "'boolean'", ")", ":", "if", "isinstance", "(", "compare", ",", "tuple", ")", ":", "# this crazy list comprehension will match all the tuples in the list with None being an * wildcard", "booleans", "=...
Finds the elements in the index that match the compare parameter and returns either a list of the values that match, of a boolean list the length of the index with True to each index that matches. If the indexes are tuples then the compare is a tuple where None in any field of the tuple will be treated ...
[ "Finds", "the", "elements", "in", "the", "index", "that", "match", "the", "compare", "parameter", "and", "returns", "either", "a", "list", "of", "the", "values", "that", "match", "of", "a", "boolean", "list", "the", "length", "of", "the", "index", "with", ...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L275-L301
train
rsheftel/raccoon
raccoon/series.py
SeriesBase.equality
def equality(self, indexes=None, value=None): """ Math helper method. Given a column and optional indexes will return a list of booleans on the equality of the value for that index in the DataFrame to the value parameter. :param indexes: list of index values or list of booleans. If a li...
python
def equality(self, indexes=None, value=None): """ Math helper method. Given a column and optional indexes will return a list of booleans on the equality of the value for that index in the DataFrame to the value parameter. :param indexes: list of index values or list of booleans. If a li...
[ "def", "equality", "(", "self", ",", "indexes", "=", "None", ",", "value", "=", "None", ")", ":", "indexes", "=", "[", "True", "]", "*", "len", "(", "self", ".", "_index", ")", "if", "indexes", "is", "None", "else", "indexes", "compare_list", "=", ...
Math helper method. Given a column and optional indexes will return a list of booleans on the equality of the value for that index in the DataFrame to the value parameter. :param indexes: list of index values or list of booleans. If a list of booleans then the list must be the same\ length as t...
[ "Math", "helper", "method", ".", "Given", "a", "column", "and", "optional", "indexes", "will", "return", "a", "list", "of", "booleans", "on", "the", "equality", "of", "the", "value", "for", "that", "index", "in", "the", "DataFrame", "to", "the", "value", ...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L312-L324
train
rsheftel/raccoon
raccoon/series.py
Series._pad_data
def _pad_data(self, index_len): """ Pad the data in Series with [None] to ensure that data is the same length as index :param index_len: length of index to extend data to :return: nothing """ self._data.extend([None] * (index_len - len(self._data)))
python
def _pad_data(self, index_len): """ Pad the data in Series with [None] to ensure that data is the same length as index :param index_len: length of index to extend data to :return: nothing """ self._data.extend([None] * (index_len - len(self._data)))
[ "def", "_pad_data", "(", "self", ",", "index_len", ")", ":", "self", ".", "_data", ".", "extend", "(", "[", "None", "]", "*", "(", "index_len", "-", "len", "(", "self", ".", "_data", ")", ")", ")" ]
Pad the data in Series with [None] to ensure that data is the same length as index :param index_len: length of index to extend data to :return: nothing
[ "Pad", "the", "data", "in", "Series", "with", "[", "None", "]", "to", "ensure", "that", "data", "is", "the", "same", "length", "as", "index" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L382-L389
train
rsheftel/raccoon
raccoon/series.py
Series.sort_index
def sort_index(self): """ Sort the Series by the index. The sort modifies the Series inplace :return: nothing """ sort = sorted_list_indexes(self._index) # sort index self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] for x in...
python
def sort_index(self): """ Sort the Series by the index. The sort modifies the Series inplace :return: nothing """ sort = sorted_list_indexes(self._index) # sort index self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] for x in...
[ "def", "sort_index", "(", "self", ")", ":", "sort", "=", "sorted_list_indexes", "(", "self", ".", "_index", ")", "# sort index", "self", ".", "_index", "=", "blist", "(", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "sort", "]", ")", ...
Sort the Series by the index. The sort modifies the Series inplace :return: nothing
[ "Sort", "the", "Series", "by", "the", "index", ".", "The", "sort", "modifies", "the", "Series", "inplace" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L418-L428
train
rsheftel/raccoon
raccoon/series.py
Series.set
def set(self, indexes, values=None): """ Given indexes will set a sub-set of the Series to the values provided. This method will direct to the below methods based on what types are passed in for the indexes. If the indexes contains values not in the Series then new rows or columns will...
python
def set(self, indexes, values=None): """ Given indexes will set a sub-set of the Series to the values provided. This method will direct to the below methods based on what types are passed in for the indexes. If the indexes contains values not in the Series then new rows or columns will...
[ "def", "set", "(", "self", ",", "indexes", ",", "values", "=", "None", ")", ":", "if", "isinstance", "(", "indexes", ",", "(", "list", ",", "blist", ")", ")", ":", "self", ".", "set_rows", "(", "indexes", ",", "values", ")", "else", ":", "self", ...
Given indexes will set a sub-set of the Series to the values provided. This method will direct to the below methods based on what types are passed in for the indexes. If the indexes contains values not in the Series then new rows or columns will be added. :param indexes: indexes value, list o...
[ "Given", "indexes", "will", "set", "a", "sub", "-", "set", "of", "the", "Series", "to", "the", "values", "provided", ".", "This", "method", "will", "direct", "to", "the", "below", "methods", "based", "on", "what", "types", "are", "passed", "in", "for", ...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L430-L443
train
rsheftel/raccoon
raccoon/series.py
Series._add_row
def _add_row(self, index): """ Add a new row to the Series :param index: index of the new row :return: nothing """ self._index.append(index) self._data.append(None)
python
def _add_row(self, index): """ Add a new row to the Series :param index: index of the new row :return: nothing """ self._index.append(index) self._data.append(None)
[ "def", "_add_row", "(", "self", ",", "index", ")", ":", "self", ".", "_index", ".", "append", "(", "index", ")", "self", ".", "_data", ".", "append", "(", "None", ")" ]
Add a new row to the Series :param index: index of the new row :return: nothing
[ "Add", "a", "new", "row", "to", "the", "Series" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L445-L453
train
rsheftel/raccoon
raccoon/series.py
Series._insert_row
def _insert_row(self, i, index): """ Insert a new row in the Series. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
python
def _insert_row(self, i, index): """ Insert a new row in the Series. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
[ "def", "_insert_row", "(", "self", ",", "i", ",", "index", ")", ":", "if", "i", "==", "len", "(", "self", ".", "_index", ")", ":", "self", ".", "_add_row", "(", "index", ")", "else", ":", "self", ".", "_index", ".", "insert", "(", "i", ",", "in...
Insert a new row in the Series. :param i: index location to insert :param index: index value to insert into the index list :return: nothing
[ "Insert", "a", "new", "row", "in", "the", "Series", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L455-L467
train
rsheftel/raccoon
raccoon/series.py
Series._add_missing_rows
def _add_missing_rows(self, indexes): """ Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index by appending to the Series. This does not maintain sorted order for the index. :param indexes: list of indexes :return: ...
python
def _add_missing_rows(self, indexes): """ Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index by appending to the Series. This does not maintain sorted order for the index. :param indexes: list of indexes :return: ...
[ "def", "_add_missing_rows", "(", "self", ",", "indexes", ")", ":", "new_indexes", "=", "[", "x", "for", "x", "in", "indexes", "if", "x", "not", "in", "self", ".", "_index", "]", "for", "x", "in", "new_indexes", ":", "self", ".", "_add_row", "(", "x",...
Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index by appending to the Series. This does not maintain sorted order for the index. :param indexes: list of indexes :return: nothing
[ "Given", "a", "list", "of", "indexes", "find", "all", "the", "indexes", "that", "are", "not", "currently", "in", "the", "Series", "and", "make", "a", "new", "row", "for", "that", "index", "by", "appending", "to", "the", "Series", ".", "This", "does", "...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L469-L479
train
rsheftel/raccoon
raccoon/series.py
Series._insert_missing_rows
def _insert_missing_rows(self, indexes): """ Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index, inserting into the index. This requires the Series to be sorted=True :param indexes: list of indexes :return: nothin...
python
def _insert_missing_rows(self, indexes): """ Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index, inserting into the index. This requires the Series to be sorted=True :param indexes: list of indexes :return: nothin...
[ "def", "_insert_missing_rows", "(", "self", ",", "indexes", ")", ":", "new_indexes", "=", "[", "x", "for", "x", "in", "indexes", "if", "x", "not", "in", "self", ".", "_index", "]", "for", "x", "in", "new_indexes", ":", "self", ".", "_insert_row", "(", ...
Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for that index, inserting into the index. This requires the Series to be sorted=True :param indexes: list of indexes :return: nothing
[ "Given", "a", "list", "of", "indexes", "find", "all", "the", "indexes", "that", "are", "not", "currently", "in", "the", "Series", "and", "make", "a", "new", "row", "for", "that", "index", "inserting", "into", "the", "index", ".", "This", "requires", "the...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L481-L491
train
rsheftel/raccoon
raccoon/series.py
Series.set_cell
def set_cell(self, index, value): """ Sets the value of a single cell. If the index is not in the current index then a new index will be created. :param index: index value :param value: value to set :return: nothing """ if self._sort: exists, i = sort...
python
def set_cell(self, index, value): """ Sets the value of a single cell. If the index is not in the current index then a new index will be created. :param index: index value :param value: value to set :return: nothing """ if self._sort: exists, i = sort...
[ "def", "set_cell", "(", "self", ",", "index", ",", "value", ")", ":", "if", "self", ".", "_sort", ":", "exists", ",", "i", "=", "sorted_exists", "(", "self", ".", "_index", ",", "index", ")", "if", "not", "exists", ":", "self", ".", "_insert_row", ...
Sets the value of a single cell. If the index is not in the current index then a new index will be created. :param index: index value :param value: value to set :return: nothing
[ "Sets", "the", "value", "of", "a", "single", "cell", ".", "If", "the", "index", "is", "not", "in", "the", "current", "index", "then", "a", "new", "index", "will", "be", "created", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L493-L511
train
rsheftel/raccoon
raccoon/series.py
Series.set_rows
def set_rows(self, index, values=None): """ Set rows to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then the list must be the sam...
python
def set_rows(self, index, values=None): """ Set rows to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then the list must be the sam...
[ "def", "set_rows", "(", "self", ",", "index", ",", "values", "=", "None", ")", ":", "if", "all", "(", "[", "isinstance", "(", "i", ",", "bool", ")", "for", "i", "in", "index", "]", ")", ":", "# boolean list", "if", "not", "isinstance", "(", "values...
Set rows to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then the list must be the same\ length as the Series :param values: eithe...
[ "Set", "rows", "to", "a", "single", "value", "or", "list", "of", "values", ".", "If", "any", "of", "the", "index", "values", "are", "not", "in", "the", "current", "indexes", "then", "a", "new", "row", "will", "be", "created", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L513-L554
train
rsheftel/raccoon
raccoon/series.py
Series.set_locations
def set_locations(self, locations, values): """ For a list of locations set the values. :param locations: list of index locations :param values: list of values or a single value :return: nothing """ indexes = [self._index[x] for x in locations] self.set(...
python
def set_locations(self, locations, values): """ For a list of locations set the values. :param locations: list of index locations :param values: list of values or a single value :return: nothing """ indexes = [self._index[x] for x in locations] self.set(...
[ "def", "set_locations", "(", "self", ",", "locations", ",", "values", ")", ":", "indexes", "=", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "locations", "]", "self", ".", "set", "(", "indexes", ",", "values", ")" ]
For a list of locations set the values. :param locations: list of index locations :param values: list of values or a single value :return: nothing
[ "For", "a", "list", "of", "locations", "set", "the", "values", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L566-L576
train
rsheftel/raccoon
raccoon/series.py
Series.append_row
def append_row(self, index, value): """ Appends a row of value to the end of the data. Be very careful with this function as for sorted Series it will not enforce sort order. Use this only for speed when needed, be careful. :param index: index :param value: value :retur...
python
def append_row(self, index, value): """ Appends a row of value to the end of the data. Be very careful with this function as for sorted Series it will not enforce sort order. Use this only for speed when needed, be careful. :param index: index :param value: value :retur...
[ "def", "append_row", "(", "self", ",", "index", ",", "value", ")", ":", "if", "index", "in", "self", ".", "_index", ":", "raise", "IndexError", "(", "'index already in Series'", ")", "self", ".", "_index", ".", "append", "(", "index", ")", "self", ".", ...
Appends a row of value to the end of the data. Be very careful with this function as for sorted Series it will not enforce sort order. Use this only for speed when needed, be careful. :param index: index :param value: value :return: nothing
[ "Appends", "a", "row", "of", "value", "to", "the", "end", "of", "the", "data", ".", "Be", "very", "careful", "with", "this", "function", "as", "for", "sorted", "Series", "it", "will", "not", "enforce", "sort", "order", ".", "Use", "this", "only", "for"...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L614-L627
train
rsheftel/raccoon
raccoon/series.py
Series.append_rows
def append_rows(self, indexes, values): """ Appends values to the end of the data. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param indexes: list of indexes to append :param values:...
python
def append_rows(self, indexes, values): """ Appends values to the end of the data. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param indexes: list of indexes to append :param values:...
[ "def", "append_rows", "(", "self", ",", "indexes", ",", "values", ")", ":", "# check that the values data is less than or equal to the length of the indexes", "if", "len", "(", "values", ")", "!=", "len", "(", "indexes", ")", ":", "raise", "ValueError", "(", "'lengt...
Appends values to the end of the data. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param indexes: list of indexes to append :param values: list of values to append :return: nothing
[ "Appends", "values", "to", "the", "end", "of", "the", "data", ".", "Be", "very", "careful", "with", "this", "function", "as", "for", "sort", "DataFrames", "it", "will", "not", "enforce", "sort", "order", ".", "Use", "this", "only", "for", "speed", "when"...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L629-L650
train
rsheftel/raccoon
raccoon/series.py
Series.delete
def delete(self, indexes): """ Delete rows from the DataFrame :param indexes: either a list of values or list of booleans for the rows to delete :return: nothing """ indexes = [indexes] if not isinstance(indexes, (list, blist)) else indexes if all([isinstance(i, ...
python
def delete(self, indexes): """ Delete rows from the DataFrame :param indexes: either a list of values or list of booleans for the rows to delete :return: nothing """ indexes = [indexes] if not isinstance(indexes, (list, blist)) else indexes if all([isinstance(i, ...
[ "def", "delete", "(", "self", ",", "indexes", ")", ":", "indexes", "=", "[", "indexes", "]", "if", "not", "isinstance", "(", "indexes", ",", "(", "list", ",", "blist", ")", ")", "else", "indexes", "if", "all", "(", "[", "isinstance", "(", "i", ",",...
Delete rows from the DataFrame :param indexes: either a list of values or list of booleans for the rows to delete :return: nothing
[ "Delete", "rows", "from", "the", "DataFrame" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L652-L672
train
rsheftel/raccoon
raccoon/series.py
Series.reset_index
def reset_index(self): """ Resets the index of the Series to simple integer list and the index name to 'index'. :return: nothing """ self.index = list(range(self.__len__())) self.index_name = 'index'
python
def reset_index(self): """ Resets the index of the Series to simple integer list and the index name to 'index'. :return: nothing """ self.index = list(range(self.__len__())) self.index_name = 'index'
[ "def", "reset_index", "(", "self", ")", ":", "self", ".", "index", "=", "list", "(", "range", "(", "self", ".", "__len__", "(", ")", ")", ")", "self", ".", "index_name", "=", "'index'" ]
Resets the index of the Series to simple integer list and the index name to 'index'. :return: nothing
[ "Resets", "the", "index", "of", "the", "Series", "to", "simple", "integer", "list", "and", "the", "index", "name", "to", "index", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L674-L681
train
rsheftel/raccoon
raccoon/series.py
ViewSeries.value
def value(self, indexes, int_as_index=False): """ Wrapper function for get. It will return a list, no index. If the indexes are integers it will be assumed that they are locations unless int_as_index = True. If the indexes are locations then they will be rotated to the left by offset nu...
python
def value(self, indexes, int_as_index=False): """ Wrapper function for get. It will return a list, no index. If the indexes are integers it will be assumed that they are locations unless int_as_index = True. If the indexes are locations then they will be rotated to the left by offset nu...
[ "def", "value", "(", "self", ",", "indexes", ",", "int_as_index", "=", "False", ")", ":", "# single integer value", "if", "isinstance", "(", "indexes", ",", "int", ")", ":", "if", "int_as_index", ":", "return", "self", ".", "get", "(", "indexes", ",", "a...
Wrapper function for get. It will return a list, no index. If the indexes are integers it will be assumed that they are locations unless int_as_index = True. If the indexes are locations then they will be rotated to the left by offset number of locations. :param indexes: integer location, sing...
[ "Wrapper", "function", "for", "get", ".", "It", "will", "return", "a", "list", "no", "index", ".", "If", "the", "indexes", "are", "integers", "it", "will", "be", "assumed", "that", "they", "are", "locations", "unless", "int_as_index", "=", "True", ".", "...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L738-L788
train
rsheftel/raccoon
raccoon/series.py
ViewSeries.from_dataframe
def from_dataframe(cls, dataframe, column, offset=0): """ Creates and return a Series from a DataFrame and specific column :param dataframe: raccoon DataFrame :param column: column name :param offset: offset value must be provided as there is no equivalent for a DataFrame ...
python
def from_dataframe(cls, dataframe, column, offset=0): """ Creates and return a Series from a DataFrame and specific column :param dataframe: raccoon DataFrame :param column: column name :param offset: offset value must be provided as there is no equivalent for a DataFrame ...
[ "def", "from_dataframe", "(", "cls", ",", "dataframe", ",", "column", ",", "offset", "=", "0", ")", ":", "return", "cls", "(", "data", "=", "dataframe", ".", "get_entire_column", "(", "column", ",", "as_list", "=", "True", ")", ",", "index", "=", "data...
Creates and return a Series from a DataFrame and specific column :param dataframe: raccoon DataFrame :param column: column name :param offset: offset value must be provided as there is no equivalent for a DataFrame :return: Series
[ "Creates", "and", "return", "a", "Series", "from", "a", "DataFrame", "and", "specific", "column" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L807-L817
train
rsheftel/raccoon
raccoon/series.py
ViewSeries.from_series
def from_series(cls, series, offset=0): """ Creates and return a Series from a Series :param series: raccoon Series :param offset: offset value must be provided as there is no equivalent for a DataFrame :return: Series """ return cls(data=series.data, index=serie...
python
def from_series(cls, series, offset=0): """ Creates and return a Series from a Series :param series: raccoon Series :param offset: offset value must be provided as there is no equivalent for a DataFrame :return: Series """ return cls(data=series.data, index=serie...
[ "def", "from_series", "(", "cls", ",", "series", ",", "offset", "=", "0", ")", ":", "return", "cls", "(", "data", "=", "series", ".", "data", ",", "index", "=", "series", ".", "index", ",", "data_name", "=", "series", ".", "data_name", ",", "index_na...
Creates and return a Series from a Series :param series: raccoon Series :param offset: offset value must be provided as there is no equivalent for a DataFrame :return: Series
[ "Creates", "and", "return", "a", "Series", "from", "a", "Series" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/series.py#L820-L829
train
vmlaker/mpipe
src/TubeQ.py
TubeQ.get
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: try: result = self._queue.get(True, timeout) except multiprocessing.Queue.Empty: ...
python
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: try: result = self._queue.get(True, timeout) except multiprocessing.Queue.Empty: ...
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", ":", "try", ":", "result", "=", "self", ".", "_queue", ".", "get", "(", "True", ",", "timeout", ")", "except", "multiprocessing", ".", "Queue", ".", "Empty", ":", "r...
Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.
[ "Return", "the", "next", "available", "item", "from", "the", "tube", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/TubeQ.py#L16-L26
train
vmlaker/mpipe
src/Stage.py
Stage.get
def get(self, timeout=None): """Retrieve results from all the output tubes.""" valid = False result = None for tube in self._output_tubes: if timeout: valid, result = tube.get(timeout) if valid: result = result[0] ...
python
def get(self, timeout=None): """Retrieve results from all the output tubes.""" valid = False result = None for tube in self._output_tubes: if timeout: valid, result = tube.get(timeout) if valid: result = result[0] ...
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "valid", "=", "False", "result", "=", "None", "for", "tube", "in", "self", ".", "_output_tubes", ":", "if", "timeout", ":", "valid", ",", "result", "=", "tube", ".", "get", "(", "tim...
Retrieve results from all the output tubes.
[ "Retrieve", "results", "from", "all", "the", "output", "tubes", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Stage.py#L42-L55
train
vmlaker/mpipe
src/Stage.py
Stage.link
def link(self, next_stage): """Link to the given downstream stage *next_stage* by adding its input tube to the list of this stage's output tubes. Return this stage.""" if next_stage is self: raise ValueError('cannot link stage to itself') self._output_tubes.append(next_stage._inp...
python
def link(self, next_stage): """Link to the given downstream stage *next_stage* by adding its input tube to the list of this stage's output tubes. Return this stage.""" if next_stage is self: raise ValueError('cannot link stage to itself') self._output_tubes.append(next_stage._inp...
[ "def", "link", "(", "self", ",", "next_stage", ")", ":", "if", "next_stage", "is", "self", ":", "raise", "ValueError", "(", "'cannot link stage to itself'", ")", "self", ".", "_output_tubes", ".", "append", "(", "next_stage", ".", "_input_tube", ")", "self", ...
Link to the given downstream stage *next_stage* by adding its input tube to the list of this stage's output tubes. Return this stage.
[ "Link", "to", "the", "given", "downstream", "stage", "*", "next_stage", "*", "by", "adding", "its", "input", "tube", "to", "the", "list", "of", "this", "stage", "s", "output", "tubes", ".", "Return", "this", "stage", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Stage.py#L64-L71
train
vmlaker/mpipe
src/Stage.py
Stage.getLeaves
def getLeaves(self): """Return the downstream leaf stages of this stage.""" result = list() if not self._next_stages: result.append(self) else: for stage in self._next_stages: leaves = stage.getLeaves() result += leaves retu...
python
def getLeaves(self): """Return the downstream leaf stages of this stage.""" result = list() if not self._next_stages: result.append(self) else: for stage in self._next_stages: leaves = stage.getLeaves() result += leaves retu...
[ "def", "getLeaves", "(", "self", ")", ":", "result", "=", "list", "(", ")", "if", "not", "self", ".", "_next_stages", ":", "result", ".", "append", "(", "self", ")", "else", ":", "for", "stage", "in", "self", ".", "_next_stages", ":", "leaves", "=", ...
Return the downstream leaf stages of this stage.
[ "Return", "the", "downstream", "leaf", "stages", "of", "this", "stage", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Stage.py#L73-L82
train
vmlaker/mpipe
src/Stage.py
Stage.build
def build(self): """Create and start up the internal workers.""" # If there's no output tube, it means that this stage # is at the end of a fork (hasn't been linked to any stage downstream). # Therefore, create one output tube. if not self._output_tubes: self._output...
python
def build(self): """Create and start up the internal workers.""" # If there's no output tube, it means that this stage # is at the end of a fork (hasn't been linked to any stage downstream). # Therefore, create one output tube. if not self._output_tubes: self._output...
[ "def", "build", "(", "self", ")", ":", "# If there's no output tube, it means that this stage", "# is at the end of a fork (hasn't been linked to any stage downstream).", "# Therefore, create one output tube.", "if", "not", "self", ".", "_output_tubes", ":", "self", ".", "_output_t...
Create and start up the internal workers.
[ "Create", "and", "start", "up", "the", "internal", "workers", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Stage.py#L84-L104
train
vmlaker/mpipe
src/TubeP.py
TubeP.get
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: # Todo: Consider locking the poll/recv block. # Otherwise, this method is not thread safe. ...
python
def get(self, timeout=None): """Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.""" if timeout: # Todo: Consider locking the poll/recv block. # Otherwise, this method is not thread safe. ...
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", ":", "# Todo: Consider locking the poll/recv block.", "# Otherwise, this method is not thread safe.", "if", "self", ".", "_conn1", ".", "poll", "(", "timeout", ")", ":", "return", "...
Return the next available item from the tube. Blocks if tube is empty, until a producer for the tube puts an item on it.
[ "Return", "the", "next", "available", "item", "from", "the", "tube", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/TubeP.py#L17-L28
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._sort_columns
def _sort_columns(self, columns_list): """ Given a list of column names will sort the DataFrame columns to match the given order :param columns_list: list of column names. Must include all column names :return: nothing """ if not (all([x in columns_list for x in self._co...
python
def _sort_columns(self, columns_list): """ Given a list of column names will sort the DataFrame columns to match the given order :param columns_list: list of column names. Must include all column names :return: nothing """ if not (all([x in columns_list for x in self._co...
[ "def", "_sort_columns", "(", "self", ",", "columns_list", ")", ":", "if", "not", "(", "all", "(", "[", "x", "in", "columns_list", "for", "x", "in", "self", ".", "_columns", "]", ")", "and", "all", "(", "[", "x", "in", "self", ".", "_columns", "for"...
Given a list of column names will sort the DataFrame columns to match the given order :param columns_list: list of column names. Must include all column names :return: nothing
[ "Given", "a", "list", "of", "column", "names", "will", "sort", "the", "DataFrame", "columns", "to", "match", "the", "given", "order" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L126-L139
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._pad_data
def _pad_data(self, max_len=None): """ Pad the data in DataFrame with [None} to ensure that all columns have the same length. :param max_len: If provided will extend all columns to this length, if not then will use the longest column :return: nothing """ if not max_len: ...
python
def _pad_data(self, max_len=None): """ Pad the data in DataFrame with [None} to ensure that all columns have the same length. :param max_len: If provided will extend all columns to this length, if not then will use the longest column :return: nothing """ if not max_len: ...
[ "def", "_pad_data", "(", "self", ",", "max_len", "=", "None", ")", ":", "if", "not", "max_len", ":", "max_len", "=", "max", "(", "[", "len", "(", "x", ")", "for", "x", "in", "self", ".", "_data", "]", ")", "for", "_", ",", "col", "in", "enumera...
Pad the data in DataFrame with [None} to ensure that all columns have the same length. :param max_len: If provided will extend all columns to this length, if not then will use the longest column :return: nothing
[ "Pad", "the", "data", "in", "DataFrame", "with", "[", "None", "}", "to", "ensure", "that", "all", "columns", "have", "the", "same", "length", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L141-L151
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get
def get(self, indexes=None, columns=None, as_list=False, as_dict=False): """ Given indexes and columns will return a sub-set of the DataFrame. This method will direct to the below methods based on what types are passed in for the indexes and columns. The type of the return is determined by the ...
python
def get(self, indexes=None, columns=None, as_list=False, as_dict=False): """ Given indexes and columns will return a sub-set of the DataFrame. This method will direct to the below methods based on what types are passed in for the indexes and columns. The type of the return is determined by the ...
[ "def", "get", "(", "self", ",", "indexes", "=", "None", ",", "columns", "=", "None", ",", "as_list", "=", "False", ",", "as_dict", "=", "False", ")", ":", "if", "(", "indexes", "is", "None", ")", "and", "(", "columns", "is", "not", "None", ")", "...
Given indexes and columns will return a sub-set of the DataFrame. This method will direct to the below methods based on what types are passed in for the indexes and columns. The type of the return is determined by the types of the parameters. :param indexes: index value, list of index values, o...
[ "Given", "indexes", "and", "columns", "will", "return", "a", "sub", "-", "set", "of", "the", "DataFrame", ".", "This", "method", "will", "direct", "to", "the", "below", "methods", "based", "on", "what", "types", "are", "passed", "in", "for", "the", "inde...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L240-L269
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_cell
def get_cell(self, index, column): """ For a single index and column value return the value of the cell :param index: index value :param column: column name :return: value """ i = sorted_index(self._index, index) if self._sort else self._index.index(index) ...
python
def get_cell(self, index, column): """ For a single index and column value return the value of the cell :param index: index value :param column: column name :return: value """ i = sorted_index(self._index, index) if self._sort else self._index.index(index) ...
[ "def", "get_cell", "(", "self", ",", "index", ",", "column", ")", ":", "i", "=", "sorted_index", "(", "self", ".", "_index", ",", "index", ")", "if", "self", ".", "_sort", "else", "self", ".", "_index", ".", "index", "(", "index", ")", "c", "=", ...
For a single index and column value return the value of the cell :param index: index value :param column: column name :return: value
[ "For", "a", "single", "index", "and", "column", "value", "return", "the", "value", "of", "the", "cell" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L271-L281
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_rows
def get_rows(self, indexes, column, as_list=False): """ For a list of indexes and a single column name return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param column: single column name ...
python
def get_rows(self, indexes, column, as_list=False): """ For a list of indexes and a single column name return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param column: single column name ...
[ "def", "get_rows", "(", "self", ",", "indexes", ",", "column", ",", "as_list", "=", "False", ")", ":", "c", "=", "self", ".", "_columns", ".", "index", "(", "column", ")", "if", "all", "(", "[", "isinstance", "(", "i", ",", "bool", ")", "for", "i...
For a list of indexes and a single column name return the values of the indexes in that column. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param column: single column name :param as_list: if True return a list, if False return DataFrame ...
[ "For", "a", "list", "of", "indexes", "and", "a", "single", "column", "name", "return", "the", "values", "of", "the", "indexes", "in", "that", "column", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L283-L308
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_columns
def get_columns(self, index, columns=None, as_dict=False): """ For a single index and list of column names return a DataFrame of the values in that index as either a dict or a DataFrame :param index: single index value :param columns: list of column names :param as_dict:...
python
def get_columns(self, index, columns=None, as_dict=False): """ For a single index and list of column names return a DataFrame of the values in that index as either a dict or a DataFrame :param index: single index value :param columns: list of column names :param as_dict:...
[ "def", "get_columns", "(", "self", ",", "index", ",", "columns", "=", "None", ",", "as_dict", "=", "False", ")", ":", "i", "=", "sorted_index", "(", "self", ".", "_index", ",", "index", ")", "if", "self", ".", "_sort", "else", "self", ".", "_index", ...
For a single index and list of column names return a DataFrame of the values in that index as either a dict or a DataFrame :param index: single index value :param columns: list of column names :param as_dict: if True then return the result as a dictionary :return: DataFrame or d...
[ "For", "a", "single", "index", "and", "list", "of", "column", "names", "return", "a", "DataFrame", "of", "the", "values", "in", "that", "index", "as", "either", "a", "dict", "or", "a", "DataFrame" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L310-L321
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_entire_column
def get_entire_column(self, column, as_list=False): """ Shortcut method to retrieve a single column all rows. Since this is a common use case this method will be faster than the more general method. :param column: single column name :param as_list: if True return a list, if Fals...
python
def get_entire_column(self, column, as_list=False): """ Shortcut method to retrieve a single column all rows. Since this is a common use case this method will be faster than the more general method. :param column: single column name :param as_list: if True return a list, if Fals...
[ "def", "get_entire_column", "(", "self", ",", "column", ",", "as_list", "=", "False", ")", ":", "c", "=", "self", ".", "_columns", ".", "index", "(", "column", ")", "data", "=", "self", ".", "_data", "[", "c", "]", "return", "data", "if", "as_list", ...
Shortcut method to retrieve a single column all rows. Since this is a common use case this method will be faster than the more general method. :param column: single column name :param as_list: if True return a list, if False return DataFrame :return: DataFrame is as_list if False, a lis...
[ "Shortcut", "method", "to", "retrieve", "a", "single", "column", "all", "rows", ".", "Since", "this", "is", "a", "common", "use", "case", "this", "method", "will", "be", "faster", "than", "the", "more", "general", "method", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L323-L335
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_matrix
def get_matrix(self, indexes, columns): """ For a list of indexes and list of columns return a DataFrame of the values. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param columns: list of column names :return: DataFrame ...
python
def get_matrix(self, indexes, columns): """ For a list of indexes and list of columns return a DataFrame of the values. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param columns: list of column names :return: DataFrame ...
[ "def", "get_matrix", "(", "self", ",", "indexes", ",", "columns", ")", ":", "if", "all", "(", "[", "isinstance", "(", "i", ",", "bool", ")", "for", "i", "in", "indexes", "]", ")", ":", "# boolean list", "is_bool_indexes", "=", "True", "if", "len", "(...
For a list of indexes and list of columns return a DataFrame of the values. :param indexes: either a list of index values or a list of booleans with same length as all indexes :param columns: list of column names :return: DataFrame
[ "For", "a", "list", "of", "indexes", "and", "list", "of", "columns", "return", "a", "DataFrame", "of", "the", "values", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L337-L369
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_location
def get_location(self, location, columns=None, as_dict=False, index=True): """ For an index location and either (1) list of columns return a DataFrame or dictionary of the values or (2) single column name and return the value of that cell. This is optimized for speed because it does not need ...
python
def get_location(self, location, columns=None, as_dict=False, index=True): """ For an index location and either (1) list of columns return a DataFrame or dictionary of the values or (2) single column name and return the value of that cell. This is optimized for speed because it does not need ...
[ "def", "get_location", "(", "self", ",", "location", ",", "columns", "=", "None", ",", "as_dict", "=", "False", ",", "index", "=", "True", ")", ":", "if", "columns", "is", "None", ":", "columns", "=", "self", ".", "_columns", "elif", "not", "isinstance...
For an index location and either (1) list of columns return a DataFrame or dictionary of the values or (2) single column name and return the value of that cell. This is optimized for speed because it does not need to lookup the index location with a search. Also can accept relative indexing from the end...
[ "For", "an", "index", "location", "and", "either", "(", "1", ")", "list", "of", "columns", "return", "a", "DataFrame", "or", "dictionary", "of", "the", "values", "or", "(", "2", ")", "single", "column", "name", "and", "return", "the", "value", "of", "t...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L371-L405
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_locations
def get_locations(self, locations, columns=None, **kwargs): """ For list of locations and list of columns return a DataFrame of the values. :param locations: list of index locations :param columns: list of column names :param kwargs: will pass along these parameters to the get()...
python
def get_locations(self, locations, columns=None, **kwargs): """ For list of locations and list of columns return a DataFrame of the values. :param locations: list of index locations :param columns: list of column names :param kwargs: will pass along these parameters to the get()...
[ "def", "get_locations", "(", "self", ",", "locations", ",", "columns", "=", "None", ",", "*", "*", "kwargs", ")", ":", "indexes", "=", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "locations", "]", "return", "self", ".", "get", "(",...
For list of locations and list of columns return a DataFrame of the values. :param locations: list of index locations :param columns: list of column names :param kwargs: will pass along these parameters to the get() method :return: DataFrame
[ "For", "list", "of", "locations", "and", "list", "of", "columns", "return", "a", "DataFrame", "of", "the", "values", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L407-L418
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.get_slice
def get_slice(self, start_index=None, stop_index=None, columns=None, as_dict=False): """ For sorted DataFrames will return either a DataFrame or dict of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. I...
python
def get_slice(self, start_index=None, stop_index=None, columns=None, as_dict=False): """ For sorted DataFrames will return either a DataFrame or dict of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. I...
[ "def", "get_slice", "(", "self", ",", "start_index", "=", "None", ",", "stop_index", "=", "None", ",", "columns", "=", "None", ",", "as_dict", "=", "False", ")", ":", "if", "not", "self", ".", "_sort", ":", "raise", "RuntimeError", "(", "'Can only use ge...
For sorted DataFrames will return either a DataFrame or dict of all of the rows where the index is greater than or equal to the start_index if provided and less than or equal to the stop_index if provided. If either the start or stop index is None then will include from the first or last element, simila...
[ "For", "sorted", "DataFrames", "will", "return", "either", "a", "DataFrame", "or", "dict", "of", "all", "of", "the", "rows", "where", "the", "index", "is", "greater", "than", "or", "equal", "to", "the", "start_index", "if", "provided", "and", "less", "than...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L420-L457
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._insert_row
def _insert_row(self, i, index): """ Insert a new row in the DataFrame. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
python
def _insert_row(self, i, index): """ Insert a new row in the DataFrame. :param i: index location to insert :param index: index value to insert into the index list :return: nothing """ if i == len(self._index): self._add_row(index) else: ...
[ "def", "_insert_row", "(", "self", ",", "i", ",", "index", ")", ":", "if", "i", "==", "len", "(", "self", ".", "_index", ")", ":", "self", ".", "_add_row", "(", "index", ")", "else", ":", "self", ".", "_index", ".", "insert", "(", "i", ",", "in...
Insert a new row in the DataFrame. :param i: index location to insert :param index: index value to insert into the index list :return: nothing
[ "Insert", "a", "new", "row", "in", "the", "DataFrame", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L459-L472
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._add_row
def _add_row(self, index): """ Add a new row to the DataFrame :param index: index of the new row :return: nothing """ self._index.append(index) for c, _ in enumerate(self._columns): self._data[c].append(None)
python
def _add_row(self, index): """ Add a new row to the DataFrame :param index: index of the new row :return: nothing """ self._index.append(index) for c, _ in enumerate(self._columns): self._data[c].append(None)
[ "def", "_add_row", "(", "self", ",", "index", ")", ":", "self", ".", "_index", ".", "append", "(", "index", ")", "for", "c", ",", "_", "in", "enumerate", "(", "self", ".", "_columns", ")", ":", "self", ".", "_data", "[", "c", "]", ".", "append", ...
Add a new row to the DataFrame :param index: index of the new row :return: nothing
[ "Add", "a", "new", "row", "to", "the", "DataFrame" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L486-L495
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame._add_column
def _add_column(self, column): """ Add a new column to the DataFrame :param column: column name :return: nothing """ self._columns.append(column) if self._blist: self._data.append(blist([None] * len(self._index))) else: self._data....
python
def _add_column(self, column): """ Add a new column to the DataFrame :param column: column name :return: nothing """ self._columns.append(column) if self._blist: self._data.append(blist([None] * len(self._index))) else: self._data....
[ "def", "_add_column", "(", "self", ",", "column", ")", ":", "self", ".", "_columns", ".", "append", "(", "column", ")", "if", "self", ".", "_blist", ":", "self", ".", "_data", ".", "append", "(", "blist", "(", "[", "None", "]", "*", "len", "(", "...
Add a new column to the DataFrame :param column: column name :return: nothing
[ "Add", "a", "new", "column", "to", "the", "DataFrame" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L509-L520
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set
def set(self, indexes=None, columns=None, values=None): """ Given indexes and columns will set a sub-set of the DataFrame to the values provided. This method will direct to the below methods based on what types are passed in for the indexes and columns. If the indexes or columns contains...
python
def set(self, indexes=None, columns=None, values=None): """ Given indexes and columns will set a sub-set of the DataFrame to the values provided. This method will direct to the below methods based on what types are passed in for the indexes and columns. If the indexes or columns contains...
[ "def", "set", "(", "self", ",", "indexes", "=", "None", ",", "columns", "=", "None", ",", "values", "=", "None", ")", ":", "if", "(", "indexes", "is", "not", "None", ")", "and", "(", "columns", "is", "not", "None", ")", ":", "if", "isinstance", "...
Given indexes and columns will set a sub-set of the DataFrame to the values provided. This method will direct to the below methods based on what types are passed in for the indexes and columns. If the indexes or columns contains values not in the DataFrame then new rows or columns will be added. ...
[ "Given", "indexes", "and", "columns", "will", "set", "a", "sub", "-", "set", "of", "the", "DataFrame", "to", "the", "values", "provided", ".", "This", "method", "will", "direct", "to", "the", "below", "methods", "based", "on", "what", "types", "are", "pa...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L522-L546
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set_cell
def set_cell(self, index, column, value): """ Sets the value of a single cell. If the index and/or column is not in the current index/columns then a new index and/or column will be created. :param index: index value :param column: column name :param value: value to set ...
python
def set_cell(self, index, column, value): """ Sets the value of a single cell. If the index and/or column is not in the current index/columns then a new index and/or column will be created. :param index: index value :param column: column name :param value: value to set ...
[ "def", "set_cell", "(", "self", ",", "index", ",", "column", ",", "value", ")", ":", "if", "self", ".", "_sort", ":", "exists", ",", "i", "=", "sorted_exists", "(", "self", ".", "_index", ",", "index", ")", "if", "not", "exists", ":", "self", ".", ...
Sets the value of a single cell. If the index and/or column is not in the current index/columns then a new index and/or column will be created. :param index: index value :param column: column name :param value: value to set :return: nothing
[ "Sets", "the", "value", "of", "a", "single", "cell", ".", "If", "the", "index", "and", "/", "or", "column", "is", "not", "in", "the", "current", "index", "/", "columns", "then", "a", "new", "index", "and", "/", "or", "column", "will", "be", "created"...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L548-L573
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set_row
def set_row(self, index, values): """ Sets the values of the columns in a single row. :param index: index value :param values: dict with the keys as the column names and the values what to set that column to :return: nothing """ if self._sort: exists,...
python
def set_row(self, index, values): """ Sets the values of the columns in a single row. :param index: index value :param values: dict with the keys as the column names and the values what to set that column to :return: nothing """ if self._sort: exists,...
[ "def", "set_row", "(", "self", ",", "index", ",", "values", ")", ":", "if", "self", ".", "_sort", ":", "exists", ",", "i", "=", "sorted_exists", "(", "self", ".", "_index", ",", "index", ")", "if", "not", "exists", ":", "self", ".", "_insert_row", ...
Sets the values of the columns in a single row. :param index: index value :param values: dict with the keys as the column names and the values what to set that column to :return: nothing
[ "Sets", "the", "values", "of", "the", "columns", "in", "a", "single", "row", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L575-L599
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set_column
def set_column(self, index=None, column=None, values=None): """ Set a column to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then ...
python
def set_column(self, index=None, column=None, values=None): """ Set a column to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then ...
[ "def", "set_column", "(", "self", ",", "index", "=", "None", ",", "column", "=", "None", ",", "values", "=", "None", ")", ":", "try", ":", "c", "=", "self", ".", "_columns", ".", "index", "(", "column", ")", "except", "ValueError", ":", "# new column...
Set a column to a single value or list of values. If any of the index values are not in the current indexes then a new row will be created. :param index: list of index values or list of booleans. If a list of booleans then the list must be the same\ length as the DataFrame :param column...
[ "Set", "a", "column", "to", "a", "single", "value", "or", "list", "of", "values", ".", "If", "any", "of", "the", "index", "values", "are", "not", "in", "the", "current", "indexes", "then", "a", "new", "row", "will", "be", "created", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L601-L656
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.set_location
def set_location(self, location, values, missing_to_none=False): """ Sets the column values, as given by the keys of the values dict, for the row at location to the values of the values dict. If missing_to_none is False then columns not in the values dict will be left unchanged, if it is ...
python
def set_location(self, location, values, missing_to_none=False): """ Sets the column values, as given by the keys of the values dict, for the row at location to the values of the values dict. If missing_to_none is False then columns not in the values dict will be left unchanged, if it is ...
[ "def", "set_location", "(", "self", ",", "location", ",", "values", ",", "missing_to_none", "=", "False", ")", ":", "if", "missing_to_none", ":", "# populate the dict with None in any column missing", "for", "column", "in", "self", ".", "_columns", ":", "if", "col...
Sets the column values, as given by the keys of the values dict, for the row at location to the values of the values dict. If missing_to_none is False then columns not in the values dict will be left unchanged, if it is True then they are set to None. This method does not add new columns and raises an e...
[ "Sets", "the", "column", "values", "as", "given", "by", "the", "keys", "of", "the", "values", "dict", "for", "the", "row", "at", "location", "to", "the", "values", "of", "the", "values", "dict", ".", "If", "missing_to_none", "is", "False", "then", "colum...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L658-L677
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.append_row
def append_row(self, index, values, new_cols=True): """ Appends a row of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only...
python
def append_row(self, index, values, new_cols=True): """ Appends a row of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only...
[ "def", "append_row", "(", "self", ",", "index", ",", "values", ",", "new_cols", "=", "True", ")", ":", "if", "index", "in", "self", ".", "_index", ":", "raise", "IndexError", "(", "'index already in DataFrame'", ")", "if", "new_cols", ":", "for", "col", ...
Appends a row of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param index: value of the ...
[ "Appends", "a", "row", "of", "values", "to", "the", "end", "of", "the", "data", ".", "If", "there", "are", "new", "columns", "in", "the", "values", "and", "new_cols", "is", "True", "they", "will", "be", "added", ".", "Be", "very", "careful", "with", ...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L691-L716
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.append_rows
def append_rows(self, indexes, values, new_cols=True): """ Appends rows of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this on...
python
def append_rows(self, indexes, values, new_cols=True): """ Appends rows of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this on...
[ "def", "append_rows", "(", "self", ",", "indexes", ",", "values", ",", "new_cols", "=", "True", ")", ":", "# check that the values data is less than or equal to the length of the indexes", "for", "column", "in", "values", ":", "if", "len", "(", "values", "[", "colum...
Appends rows of values to the end of the data. If there are new columns in the values and new_cols is True they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order. Use this only for speed when needed, be careful. :param indexes: list of inde...
[ "Appends", "rows", "of", "values", "to", "the", "end", "of", "the", "data", ".", "If", "there", "are", "new", "columns", "in", "the", "values", "and", "new_cols", "is", "True", "they", "will", "be", "added", ".", "Be", "very", "careful", "with", "this"...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L718-L751
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.to_dict
def to_dict(self, index=True, ordered=False): """ Returns a dict where the keys are the column names and the values are lists of the values for that column. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an Ord...
python
def to_dict(self, index=True, ordered=False): """ Returns a dict where the keys are the column names and the values are lists of the values for that column. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an Ord...
[ "def", "to_dict", "(", "self", ",", "index", "=", "True", ",", "ordered", "=", "False", ")", ":", "result", "=", "OrderedDict", "(", ")", "if", "ordered", "else", "dict", "(", ")", "if", "index", ":", "result", ".", "update", "(", "{", "self", ".",...
Returns a dict where the keys are the column names and the values are lists of the values for that column. :param index: If True then include the index in the dict with the index_name as the key :param ordered: If True then return an OrderedDict() to preserve the order of the columns in the DataFrame ...
[ "Returns", "a", "dict", "where", "the", "keys", "are", "the", "column", "names", "and", "the", "values", "are", "lists", "of", "the", "values", "for", "that", "column", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L833-L849
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.to_json
def to_json(self): """ Returns a JSON of the entire DataFrame that can be reconstructed back with raccoon.from_json(input). Any object that cannot be serialized will be replaced with the representation of the object using repr(). In that instance the DataFrame will have a string represen...
python
def to_json(self): """ Returns a JSON of the entire DataFrame that can be reconstructed back with raccoon.from_json(input). Any object that cannot be serialized will be replaced with the representation of the object using repr(). In that instance the DataFrame will have a string represen...
[ "def", "to_json", "(", "self", ")", ":", "input_dict", "=", "{", "'data'", ":", "self", ".", "to_dict", "(", "index", "=", "False", ")", ",", "'index'", ":", "list", "(", "self", ".", "_index", ")", "}", "# if blist, turn into lists", "if", "self", "."...
Returns a JSON of the entire DataFrame that can be reconstructed back with raccoon.from_json(input). Any object that cannot be serialized will be replaced with the representation of the object using repr(). In that instance the DataFrame will have a string representation in place of the object and will ...
[ "Returns", "a", "JSON", "of", "the", "entire", "DataFrame", "that", "can", "be", "reconstructed", "back", "with", "raccoon", ".", "from_json", "(", "input", ")", ".", "Any", "object", "that", "cannot", "be", "serialized", "will", "be", "replaced", "with", ...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L851-L874
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.rename_columns
def rename_columns(self, rename_dict): """ Renames the columns :param rename_dict: dict where the keys are the current column names and the values are the new names :return: nothing """ if not all([x in self._columns for x in rename_dict.keys()]): raise Value...
python
def rename_columns(self, rename_dict): """ Renames the columns :param rename_dict: dict where the keys are the current column names and the values are the new names :return: nothing """ if not all([x in self._columns for x in rename_dict.keys()]): raise Value...
[ "def", "rename_columns", "(", "self", ",", "rename_dict", ")", ":", "if", "not", "all", "(", "[", "x", "in", "self", ".", "_columns", "for", "x", "in", "rename_dict", ".", "keys", "(", ")", "]", ")", ":", "raise", "ValueError", "(", "'all dictionary ke...
Renames the columns :param rename_dict: dict where the keys are the current column names and the values are the new names :return: nothing
[ "Renames", "the", "columns" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L876-L886
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.delete_all_rows
def delete_all_rows(self): """ Deletes the contents of all rows in the DataFrame. This function is faster than delete_rows() to remove all information, and at the same time it keeps the container lists for the columns and index so if there is another object that references this DataFrame...
python
def delete_all_rows(self): """ Deletes the contents of all rows in the DataFrame. This function is faster than delete_rows() to remove all information, and at the same time it keeps the container lists for the columns and index so if there is another object that references this DataFrame...
[ "def", "delete_all_rows", "(", "self", ")", ":", "del", "self", ".", "_index", "[", ":", "]", "for", "c", "in", "range", "(", "len", "(", "self", ".", "_columns", ")", ")", ":", "del", "self", ".", "_data", "[", "c", "]", "[", ":", "]" ]
Deletes the contents of all rows in the DataFrame. This function is faster than delete_rows() to remove all information, and at the same time it keeps the container lists for the columns and index so if there is another object that references this DataFrame, like a ViewSeries, the reference remains in t...
[ "Deletes", "the", "contents", "of", "all", "rows", "in", "the", "DataFrame", ".", "This", "function", "is", "faster", "than", "delete_rows", "()", "to", "remove", "all", "information", "and", "at", "the", "same", "time", "it", "keeps", "the", "container", ...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L933-L943
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.delete_columns
def delete_columns(self, columns): """ Delete columns from the DataFrame :param columns: list of columns to delete :return: nothing """ columns = [columns] if not isinstance(columns, (list, blist)) else columns if not all([x in self._columns for x in columns]): ...
python
def delete_columns(self, columns): """ Delete columns from the DataFrame :param columns: list of columns to delete :return: nothing """ columns = [columns] if not isinstance(columns, (list, blist)) else columns if not all([x in self._columns for x in columns]): ...
[ "def", "delete_columns", "(", "self", ",", "columns", ")", ":", "columns", "=", "[", "columns", "]", "if", "not", "isinstance", "(", "columns", ",", "(", "list", ",", "blist", ")", ")", "else", "columns", "if", "not", "all", "(", "[", "x", "in", "s...
Delete columns from the DataFrame :param columns: list of columns to delete :return: nothing
[ "Delete", "columns", "from", "the", "DataFrame" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L945-L960
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.sort_index
def sort_index(self): """ Sort the DataFrame by the index. The sort modifies the DataFrame inplace :return: nothing """ sort = sorted_list_indexes(self._index) # sort index self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] fo...
python
def sort_index(self): """ Sort the DataFrame by the index. The sort modifies the DataFrame inplace :return: nothing """ sort = sorted_list_indexes(self._index) # sort index self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] fo...
[ "def", "sort_index", "(", "self", ")", ":", "sort", "=", "sorted_list_indexes", "(", "self", ".", "_index", ")", "# sort index", "self", ".", "_index", "=", "blist", "(", "[", "self", ".", "_index", "[", "x", "]", "for", "x", "in", "sort", "]", ")", ...
Sort the DataFrame by the index. The sort modifies the DataFrame inplace :return: nothing
[ "Sort", "the", "DataFrame", "by", "the", "index", ".", "The", "sort", "modifies", "the", "DataFrame", "inplace" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L962-L973
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.sort_columns
def sort_columns(self, column, key=None, reverse=False): """ Sort the DataFrame by one of the columns. The sort modifies the DataFrame inplace. The key and reverse parameters have the same meaning as for the built-in sort() function. :param column: column name to use for the sort ...
python
def sort_columns(self, column, key=None, reverse=False): """ Sort the DataFrame by one of the columns. The sort modifies the DataFrame inplace. The key and reverse parameters have the same meaning as for the built-in sort() function. :param column: column name to use for the sort ...
[ "def", "sort_columns", "(", "self", ",", "column", ",", "key", "=", "None", ",", "reverse", "=", "False", ")", ":", "if", "isinstance", "(", "column", ",", "(", "list", ",", "blist", ")", ")", ":", "raise", "TypeError", "(", "'Can only sort by a single c...
Sort the DataFrame by one of the columns. The sort modifies the DataFrame inplace. The key and reverse parameters have the same meaning as for the built-in sort() function. :param column: column name to use for the sort :param key: if not None then a function of one argument that is used to ext...
[ "Sort", "the", "DataFrame", "by", "one", "of", "the", "columns", ".", "The", "sort", "modifies", "the", "DataFrame", "inplace", ".", "The", "key", "and", "reverse", "parameters", "have", "the", "same", "meaning", "as", "for", "the", "built", "-", "in", "...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L975-L993
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.validate_integrity
def validate_integrity(self): """ Validate the integrity of the DataFrame. This checks that the indexes, column names and internal data are not corrupted. Will raise an error if there is a problem. :return: nothing """ self._validate_columns(self._columns) self._...
python
def validate_integrity(self): """ Validate the integrity of the DataFrame. This checks that the indexes, column names and internal data are not corrupted. Will raise an error if there is a problem. :return: nothing """ self._validate_columns(self._columns) self._...
[ "def", "validate_integrity", "(", "self", ")", ":", "self", ".", "_validate_columns", "(", "self", ".", "_columns", ")", "self", ".", "_validate_index", "(", "self", ".", "_index", ")", "self", ".", "_validate_data", "(", ")" ]
Validate the integrity of the DataFrame. This checks that the indexes, column names and internal data are not corrupted. Will raise an error if there is a problem. :return: nothing
[ "Validate", "the", "integrity", "of", "the", "DataFrame", ".", "This", "checks", "that", "the", "indexes", "column", "names", "and", "internal", "data", "are", "not", "corrupted", ".", "Will", "raise", "an", "error", "if", "there", "is", "a", "problem", "....
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L1016-L1025
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.append
def append(self, data_frame): """ Append another DataFrame to this DataFrame. If the new data_frame has columns that are not in the current DataFrame then new columns will be created. All of the indexes in the data_frame must be different from the current indexes or will raise an error. ...
python
def append(self, data_frame): """ Append another DataFrame to this DataFrame. If the new data_frame has columns that are not in the current DataFrame then new columns will be created. All of the indexes in the data_frame must be different from the current indexes or will raise an error. ...
[ "def", "append", "(", "self", ",", "data_frame", ")", ":", "if", "len", "(", "data_frame", ")", "==", "0", ":", "# empty DataFrame, do nothing", "return", "data_frame_index", "=", "data_frame", ".", "index", "combined_index", "=", "self", ".", "_index", "+", ...
Append another DataFrame to this DataFrame. If the new data_frame has columns that are not in the current DataFrame then new columns will be created. All of the indexes in the data_frame must be different from the current indexes or will raise an error. :param data_frame: DataFrame to append ...
[ "Append", "another", "DataFrame", "to", "this", "DataFrame", ".", "If", "the", "new", "data_frame", "has", "columns", "that", "are", "not", "in", "the", "current", "DataFrame", "then", "new", "columns", "will", "be", "created", ".", "All", "of", "the", "in...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L1027-L1047
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.add
def add(self, left_column, right_column, indexes=None): """ Math helper method that adds element-wise two columns. If indexes are not None then will only perform the math on that sub-set of the columns. :param left_column: first column name :param right_column: second column nam...
python
def add(self, left_column, right_column, indexes=None): """ Math helper method that adds element-wise two columns. If indexes are not None then will only perform the math on that sub-set of the columns. :param left_column: first column name :param right_column: second column nam...
[ "def", "add", "(", "self", ",", "left_column", ",", "right_column", ",", "indexes", "=", "None", ")", ":", "left_list", ",", "right_list", "=", "self", ".", "_get_lists", "(", "left_column", ",", "right_column", ",", "indexes", ")", "return", "[", "l", "...
Math helper method that adds element-wise two columns. If indexes are not None then will only perform the math on that sub-set of the columns. :param left_column: first column name :param right_column: second column name :param indexes: list of index values or list of booleans. If a lis...
[ "Math", "helper", "method", "that", "adds", "element", "-", "wise", "two", "columns", ".", "If", "indexes", "are", "not", "None", "then", "will", "only", "perform", "the", "math", "on", "that", "sub", "-", "set", "of", "the", "columns", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L1070-L1082
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.isin
def isin(self, column, compare_list): """ Returns a boolean list where each elements is whether that element in the column is in the compare_list. :param column: single column name, does not work for multiple columns :param compare_list: list of items to compare to :return: list...
python
def isin(self, column, compare_list): """ Returns a boolean list where each elements is whether that element in the column is in the compare_list. :param column: single column name, does not work for multiple columns :param compare_list: list of items to compare to :return: list...
[ "def", "isin", "(", "self", ",", "column", ",", "compare_list", ")", ":", "return", "[", "x", "in", "compare_list", "for", "x", "in", "self", ".", "_data", "[", "self", ".", "_columns", ".", "index", "(", "column", ")", "]", "]" ]
Returns a boolean list where each elements is whether that element in the column is in the compare_list. :param column: single column name, does not work for multiple columns :param compare_list: list of items to compare to :return: list of booleans
[ "Returns", "a", "boolean", "list", "where", "each", "elements", "is", "whether", "that", "element", "in", "the", "column", "is", "in", "the", "compare_list", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L1126-L1134
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.iterrows
def iterrows(self, index=True): """ Iterates over DataFrame rows as dictionary of the values. The index will be included. :param index: if True include the index in the results :return: dictionary """ for i in range(len(self._index)): row = {self._index_name:...
python
def iterrows(self, index=True): """ Iterates over DataFrame rows as dictionary of the values. The index will be included. :param index: if True include the index in the results :return: dictionary """ for i in range(len(self._index)): row = {self._index_name:...
[ "def", "iterrows", "(", "self", ",", "index", "=", "True", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_index", ")", ")", ":", "row", "=", "{", "self", ".", "_index_name", ":", "self", ".", "_index", "[", "i", "]", "}", ...
Iterates over DataFrame rows as dictionary of the values. The index will be included. :param index: if True include the index in the results :return: dictionary
[ "Iterates", "over", "DataFrame", "rows", "as", "dictionary", "of", "the", "values", ".", "The", "index", "will", "be", "included", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L1136-L1147
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.itertuples
def itertuples(self, index=True, name='Raccoon'): """ Iterates over DataFrame rows as tuple of the values. :param index: if True then include the index :param name: name of the namedtuple :return: namedtuple """ fields = [self._index_name] if index else list() ...
python
def itertuples(self, index=True, name='Raccoon'): """ Iterates over DataFrame rows as tuple of the values. :param index: if True then include the index :param name: name of the namedtuple :return: namedtuple """ fields = [self._index_name] if index else list() ...
[ "def", "itertuples", "(", "self", ",", "index", "=", "True", ",", "name", "=", "'Raccoon'", ")", ":", "fields", "=", "[", "self", ".", "_index_name", "]", "if", "index", "else", "list", "(", ")", "fields", ".", "extend", "(", "self", ".", "_columns",...
Iterates over DataFrame rows as tuple of the values. :param index: if True then include the index :param name: name of the namedtuple :return: namedtuple
[ "Iterates", "over", "DataFrame", "rows", "as", "tuple", "of", "the", "values", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L1149-L1164
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.reset_index
def reset_index(self, drop=False): """ Resets the index of the DataFrame to simple integer list and the index name to 'index'. If drop is True then the existing index is dropped, if drop is False then the current index is made a column in the DataFrame with the index name the name of the...
python
def reset_index(self, drop=False): """ Resets the index of the DataFrame to simple integer list and the index name to 'index'. If drop is True then the existing index is dropped, if drop is False then the current index is made a column in the DataFrame with the index name the name of the...
[ "def", "reset_index", "(", "self", ",", "drop", "=", "False", ")", ":", "if", "not", "drop", ":", "if", "isinstance", "(", "self", ".", "index_name", ",", "tuple", ")", ":", "index_data", "=", "list", "(", "map", "(", "list", ",", "zip", "(", "*", ...
Resets the index of the DataFrame to simple integer list and the index name to 'index'. If drop is True then the existing index is dropped, if drop is False then the current index is made a column in the DataFrame with the index name the name of the column. If the index is a tuple multi-index then each ...
[ "Resets", "the", "index", "of", "the", "DataFrame", "to", "simple", "integer", "list", "and", "the", "index", "name", "to", "index", ".", "If", "drop", "is", "True", "then", "the", "existing", "index", "is", "dropped", "if", "drop", "is", "False", "then"...
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L1166-L1186
train
rsheftel/raccoon
raccoon/dataframe.py
DataFrame.from_json
def from_json(cls, json_string): """ Creates and return a DataFrame from a JSON of the type created by to_json :param json_string: JSON :return: DataFrame """ input_dict = json.loads(json_string) # convert index to tuple if required if input_dict['index']...
python
def from_json(cls, json_string): """ Creates and return a DataFrame from a JSON of the type created by to_json :param json_string: JSON :return: DataFrame """ input_dict = json.loads(json_string) # convert index to tuple if required if input_dict['index']...
[ "def", "from_json", "(", "cls", ",", "json_string", ")", ":", "input_dict", "=", "json", ".", "loads", "(", "json_string", ")", "# convert index to tuple if required", "if", "input_dict", "[", "'index'", "]", "and", "isinstance", "(", "input_dict", "[", "'index'...
Creates and return a DataFrame from a JSON of the type created by to_json :param json_string: JSON :return: DataFrame
[ "Creates", "and", "return", "a", "DataFrame", "from", "a", "JSON", "of", "the", "type", "created", "by", "to_json" ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/dataframe.py#L1190-L1205
train
vmlaker/mpipe
src/FilterWorker.py
FilterWorker.doTask
def doTask(self, task): """Filter input *task* to pipelines -- make sure each one has no more than *max_tasks* tasks in it. Return a tuple (*task*, *results*) where *task* is the given task, and *results* is a list of latest retrieved results from pipelines.""" # If w...
python
def doTask(self, task): """Filter input *task* to pipelines -- make sure each one has no more than *max_tasks* tasks in it. Return a tuple (*task*, *results*) where *task* is the given task, and *results* is a list of latest retrieved results from pipelines.""" # If w...
[ "def", "doTask", "(", "self", ",", "task", ")", ":", "# If we're not caching, then clear the table of last results.", "if", "not", "self", ".", "_cache_results", ":", "self", ".", "_last_results", "=", "dict", "(", ")", "# Iterate the list of pipelines, draining each one ...
Filter input *task* to pipelines -- make sure each one has no more than *max_tasks* tasks in it. Return a tuple (*task*, *results*) where *task* is the given task, and *results* is a list of latest retrieved results from pipelines.
[ "Filter", "input", "*", "task", "*", "to", "pipelines", "--", "make", "sure", "each", "one", "has", "no", "more", "than", "*", "max_tasks", "*", "tasks", "in", "it", ".", "Return", "a", "tuple", "(", "*", "task", "*", "*", "results", "*", ")", "whe...
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/FilterWorker.py#L47-L94
train
rsheftel/raccoon
raccoon/utils.py
assert_frame_equal
def assert_frame_equal(left, right, data_function=None, data_args=None): """ For unit testing equality of two DataFrames. :param left: first DataFrame :param right: second DataFrame :param data_function: if provided will use this function to assert compare the df.data :param data_args: argument...
python
def assert_frame_equal(left, right, data_function=None, data_args=None): """ For unit testing equality of two DataFrames. :param left: first DataFrame :param right: second DataFrame :param data_function: if provided will use this function to assert compare the df.data :param data_args: argument...
[ "def", "assert_frame_equal", "(", "left", ",", "right", ",", "data_function", "=", "None", ",", "data_args", "=", "None", ")", ":", "if", "data_function", ":", "data_args", "=", "{", "}", "if", "not", "data_args", "else", "data_args", "data_function", "(", ...
For unit testing equality of two DataFrames. :param left: first DataFrame :param right: second DataFrame :param data_function: if provided will use this function to assert compare the df.data :param data_args: arguments to pass to the data_function :return: nothing
[ "For", "unit", "testing", "equality", "of", "two", "DataFrames", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/utils.py#L8-L27
train
rsheftel/raccoon
raccoon/utils.py
assert_series_equal
def assert_series_equal(left, right, data_function=None, data_args=None): """ For unit testing equality of two Series. :param left: first Series :param right: second Series :param data_function: if provided will use this function to assert compare the df.data :param data_args: arguments to pass...
python
def assert_series_equal(left, right, data_function=None, data_args=None): """ For unit testing equality of two Series. :param left: first Series :param right: second Series :param data_function: if provided will use this function to assert compare the df.data :param data_args: arguments to pass...
[ "def", "assert_series_equal", "(", "left", ",", "right", ",", "data_function", "=", "None", ",", "data_args", "=", "None", ")", ":", "assert", "type", "(", "left", ")", "==", "type", "(", "right", ")", "if", "data_function", ":", "data_args", "=", "{", ...
For unit testing equality of two Series. :param left: first Series :param right: second Series :param data_function: if provided will use this function to assert compare the df.data :param data_args: arguments to pass to the data_function :return: nothing
[ "For", "unit", "testing", "equality", "of", "two", "Series", "." ]
e5c4b5fb933b51f33aff11e8168c39790e9a7c75
https://github.com/rsheftel/raccoon/blob/e5c4b5fb933b51f33aff11e8168c39790e9a7c75/raccoon/utils.py#L30-L53
train
vmlaker/mpipe
src/Pipeline.py
Pipeline.get
def get(self, timeout=None): """Return result from the pipeline.""" result = None for stage in self._output_stages: result = stage.get(timeout) return result
python
def get(self, timeout=None): """Return result from the pipeline.""" result = None for stage in self._output_stages: result = stage.get(timeout) return result
[ "def", "get", "(", "self", ",", "timeout", "=", "None", ")", ":", "result", "=", "None", "for", "stage", "in", "self", ".", "_output_stages", ":", "result", "=", "stage", ".", "get", "(", "timeout", ")", "return", "result" ]
Return result from the pipeline.
[ "Return", "result", "from", "the", "pipeline", "." ]
5a1804cf64271931f0cd3e4fff3e2b38291212dd
https://github.com/vmlaker/mpipe/blob/5a1804cf64271931f0cd3e4fff3e2b38291212dd/src/Pipeline.py#L15-L20
train
brenns10/tswift
tswift.py
main
def main(): """ Run the CLI. """ parser = argparse.ArgumentParser( description='Search artists, lyrics, and songs!' ) parser.add_argument( 'artist', help='Specify an artist name (Default: Taylor Swift)', default='Taylor Swift', nargs='?', ) parser....
python
def main(): """ Run the CLI. """ parser = argparse.ArgumentParser( description='Search artists, lyrics, and songs!' ) parser.add_argument( 'artist', help='Specify an artist name (Default: Taylor Swift)', default='Taylor Swift', nargs='?', ) parser....
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Search artists, lyrics, and songs!'", ")", "parser", ".", "add_argument", "(", "'artist'", ",", "help", "=", "'Specify an artist name (Default: Taylor Swift)'", ...
Run the CLI.
[ "Run", "the", "CLI", "." ]
f4a8f3127e088d6b3a9669496f107c2704f4d1a3
https://github.com/brenns10/tswift/blob/f4a8f3127e088d6b3a9669496f107c2704f4d1a3/tswift.py#L156-L198
train
brenns10/tswift
tswift.py
Song.load
def load(self): """Load the lyrics from MetroLyrics.""" page = requests.get(self._url) # Forces utf-8 to prevent character mangling page.encoding = 'utf-8' tree = html.fromstring(page.text) lyric_div = tree.get_element_by_id('lyrics-body-text') verses = [c.text_c...
python
def load(self): """Load the lyrics from MetroLyrics.""" page = requests.get(self._url) # Forces utf-8 to prevent character mangling page.encoding = 'utf-8' tree = html.fromstring(page.text) lyric_div = tree.get_element_by_id('lyrics-body-text') verses = [c.text_c...
[ "def", "load", "(", "self", ")", ":", "page", "=", "requests", ".", "get", "(", "self", ".", "_url", ")", "# Forces utf-8 to prevent character mangling", "page", ".", "encoding", "=", "'utf-8'", "tree", "=", "html", ".", "fromstring", "(", "page", ".", "te...
Load the lyrics from MetroLyrics.
[ "Load", "the", "lyrics", "from", "MetroLyrics", "." ]
f4a8f3127e088d6b3a9669496f107c2704f4d1a3
https://github.com/brenns10/tswift/blob/f4a8f3127e088d6b3a9669496f107c2704f4d1a3/tswift.py#L61-L71
train
brenns10/tswift
tswift.py
Artist.load
def load(self, verbose=False): """ Load the list of songs. Note that this only loads a list of songs that this artist was the main artist of. If they were only featured in the song, that song won't be listed here. There is a list on the artist page for that, I just hav...
python
def load(self, verbose=False): """ Load the list of songs. Note that this only loads a list of songs that this artist was the main artist of. If they were only featured in the song, that song won't be listed here. There is a list on the artist page for that, I just hav...
[ "def", "load", "(", "self", ",", "verbose", "=", "False", ")", ":", "self", ".", "_songs", "=", "[", "]", "page_num", "=", "1", "total_pages", "=", "1", "while", "page_num", "<=", "total_pages", ":", "if", "verbose", ":", "print", "(", "'retrieving pag...
Load the list of songs. Note that this only loads a list of songs that this artist was the main artist of. If they were only featured in the song, that song won't be listed here. There is a list on the artist page for that, I just haven't added any parsing code for that, since I don't...
[ "Load", "the", "list", "of", "songs", "." ]
f4a8f3127e088d6b3a9669496f107c2704f4d1a3
https://github.com/brenns10/tswift/blob/f4a8f3127e088d6b3a9669496f107c2704f4d1a3/tswift.py#L113-L144
train
jwass/geog
geog/geog.py
distance
def distance(p0, p1, deg=True, r=r_earth_mean): """ Return the distance between two points on the surface of the Earth. Parameters ---------- p0 : point-like (or array of point-like) [longitude, latitude] objects p1 : point-like (or array of point-like) [longitude, latitude] objects deg : b...
python
def distance(p0, p1, deg=True, r=r_earth_mean): """ Return the distance between two points on the surface of the Earth. Parameters ---------- p0 : point-like (or array of point-like) [longitude, latitude] objects p1 : point-like (or array of point-like) [longitude, latitude] objects deg : b...
[ "def", "distance", "(", "p0", ",", "p1", ",", "deg", "=", "True", ",", "r", "=", "r_earth_mean", ")", ":", "single", ",", "(", "p0", ",", "p1", ")", "=", "_to_arrays", "(", "(", "p0", ",", "2", ")", ",", "(", "p1", ",", "2", ")", ")", "if",...
Return the distance between two points on the surface of the Earth. Parameters ---------- p0 : point-like (or array of point-like) [longitude, latitude] objects p1 : point-like (or array of point-like) [longitude, latitude] objects deg : bool, optional (default True) indicates if p0 and p1 ...
[ "Return", "the", "distance", "between", "two", "points", "on", "the", "surface", "of", "the", "Earth", "." ]
52ceb9b543454b31c63694ee459aad9cd52f011a
https://github.com/jwass/geog/blob/52ceb9b543454b31c63694ee459aad9cd52f011a/geog/geog.py#L32-L74
train
jwass/geog
geog/geog.py
course
def course(p0, p1, deg=True, bearing=False): """ Compute the initial bearing along the great circle from p0 to p1 NB: The angle returned by course() is not the traditional definition of bearing. It is definted such that 0 degrees to due East increasing counter-clockwise such that 90 degrees is due ...
python
def course(p0, p1, deg=True, bearing=False): """ Compute the initial bearing along the great circle from p0 to p1 NB: The angle returned by course() is not the traditional definition of bearing. It is definted such that 0 degrees to due East increasing counter-clockwise such that 90 degrees is due ...
[ "def", "course", "(", "p0", ",", "p1", ",", "deg", "=", "True", ",", "bearing", "=", "False", ")", ":", "single", ",", "(", "p0", ",", "p1", ")", "=", "_to_arrays", "(", "(", "p0", ",", "2", ")", ",", "(", "p1", ",", "2", ")", ")", "if", ...
Compute the initial bearing along the great circle from p0 to p1 NB: The angle returned by course() is not the traditional definition of bearing. It is definted such that 0 degrees to due East increasing counter-clockwise such that 90 degrees is due North. To obtain the bearing (0 degrees is due North ...
[ "Compute", "the", "initial", "bearing", "along", "the", "great", "circle", "from", "p0", "to", "p1" ]
52ceb9b543454b31c63694ee459aad9cd52f011a
https://github.com/jwass/geog/blob/52ceb9b543454b31c63694ee459aad9cd52f011a/geog/geog.py#L77-L126
train
jwass/geog
geog/geog.py
propagate
def propagate(p0, angle, d, deg=True, bearing=False, r=r_earth_mean): """ Given an initial point and angle, move distance d along the surface Parameters ---------- p0 : point-like (or array of point-like) [lon, lat] objects angle : float (or array of float) bearing. Note that by default...
python
def propagate(p0, angle, d, deg=True, bearing=False, r=r_earth_mean): """ Given an initial point and angle, move distance d along the surface Parameters ---------- p0 : point-like (or array of point-like) [lon, lat] objects angle : float (or array of float) bearing. Note that by default...
[ "def", "propagate", "(", "p0", ",", "angle", ",", "d", ",", "deg", "=", "True", ",", "bearing", "=", "False", ",", "r", "=", "r_earth_mean", ")", ":", "single", ",", "(", "p0", ",", "angle", ",", "d", ")", "=", "_to_arrays", "(", "(", "p0", ","...
Given an initial point and angle, move distance d along the surface Parameters ---------- p0 : point-like (or array of point-like) [lon, lat] objects angle : float (or array of float) bearing. Note that by default, 0 degrees is due East increasing clockwise so that 90 degrees is due No...
[ "Given", "an", "initial", "point", "and", "angle", "move", "distance", "d", "along", "the", "surface" ]
52ceb9b543454b31c63694ee459aad9cd52f011a
https://github.com/jwass/geog/blob/52ceb9b543454b31c63694ee459aad9cd52f011a/geog/geog.py#L129-L184
train
lepture/flask-weixin
flask_weixin.py
Weixin.validate
def validate(self, signature, timestamp, nonce): """Validate request signature. :param signature: A string signature parameter sent by weixin. :param timestamp: A int timestamp parameter sent by weixin. :param nonce: A int nonce parameter sent by weixin. """ if not self....
python
def validate(self, signature, timestamp, nonce): """Validate request signature. :param signature: A string signature parameter sent by weixin. :param timestamp: A int timestamp parameter sent by weixin. :param nonce: A int nonce parameter sent by weixin. """ if not self....
[ "def", "validate", "(", "self", ",", "signature", ",", "timestamp", ",", "nonce", ")", ":", "if", "not", "self", ".", "token", ":", "raise", "RuntimeError", "(", "'WEIXIN_TOKEN is missing'", ")", "if", "self", ".", "expires_in", ":", "try", ":", "timestamp...
Validate request signature. :param signature: A string signature parameter sent by weixin. :param timestamp: A int timestamp parameter sent by weixin. :param nonce: A int nonce parameter sent by weixin.
[ "Validate", "request", "signature", "." ]
abf0b507d41b9780257507aa78fc0817fdc75719
https://github.com/lepture/flask-weixin/blob/abf0b507d41b9780257507aa78fc0817fdc75719/flask_weixin.py#L77-L106
train