repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
globus/globus-cli
globus_cli/config.py
write_option
def write_option(option, value, section="cli", system=False): """ Write an option to disk -- doesn't handle config reloading """ # deny rwx to Group and World -- don't bother storing the returned old mask # value, since we'll never restore it in the CLI anyway # do this on every call to ensure t...
python
def write_option(option, value, section="cli", system=False): """ Write an option to disk -- doesn't handle config reloading """ # deny rwx to Group and World -- don't bother storing the returned old mask # value, since we'll never restore it in the CLI anyway # do this on every call to ensure t...
Write an option to disk -- doesn't handle config reloading
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/config.py#L124-L141
globus/globus-cli
globus_cli/config.py
internal_auth_client
def internal_auth_client(requires_instance=False, force_new_client=False): """ Looks up the values for this CLI's Instance Client in config If none exists and requires_instance is True or force_new_client is True, registers a new Instance Client with GLobus Auth If none exists and requires_instanc...
python
def internal_auth_client(requires_instance=False, force_new_client=False): """ Looks up the values for this CLI's Instance Client in config If none exists and requires_instance is True or force_new_client is True, registers a new Instance Client with GLobus Auth If none exists and requires_instanc...
Looks up the values for this CLI's Instance Client in config If none exists and requires_instance is True or force_new_client is True, registers a new Instance Client with GLobus Auth If none exists and requires_instance is false, defaults to a Native Client for backwards compatibility Returns ei...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/config.py#L187-L242
globus/globus-cli
globus_cli/parsing/excepthook.py
exit_with_mapped_status
def exit_with_mapped_status(http_status): """ Given an HTTP Status, exit with either an error status of 1 or the status mapped by what we were given. """ # get the mapping by looking up the state and getting the mapping attr mapping = click.get_current_context().ensure_object(CommandState).http_...
python
def exit_with_mapped_status(http_status): """ Given an HTTP Status, exit with either an error status of 1 or the status mapped by what we were given. """ # get the mapping by looking up the state and getting the mapping attr mapping = click.get_current_context().ensure_object(CommandState).http_...
Given an HTTP Status, exit with either an error status of 1 or the status mapped by what we were given.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/excepthook.py#L20-L32
globus/globus-cli
globus_cli/parsing/excepthook.py
session_hook
def session_hook(exception): """ Expects an exception with an authorization_paramaters field in its raw_json """ safeprint( "The resource you are trying to access requires you to " "re-authenticate with specific identities." ) params = exception.raw_json["authorization_parameter...
python
def session_hook(exception): """ Expects an exception with an authorization_paramaters field in its raw_json """ safeprint( "The resource you are trying to access requires you to " "re-authenticate with specific identities." ) params = exception.raw_json["authorization_parameter...
Expects an exception with an authorization_paramaters field in its raw_json
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/excepthook.py#L35-L63
globus/globus-cli
globus_cli/parsing/excepthook.py
custom_except_hook
def custom_except_hook(exc_info): """ A custom excepthook to present python errors produced by the CLI. We don't want to show end users big scary stacktraces if they aren't python programmers, so slim it down to some basic info. We keep a "DEBUGMODE" env variable kicking around to let us turn on sta...
python
def custom_except_hook(exc_info): """ A custom excepthook to present python errors produced by the CLI. We don't want to show end users big scary stacktraces if they aren't python programmers, so slim it down to some basic info. We keep a "DEBUGMODE" env variable kicking around to let us turn on sta...
A custom excepthook to present python errors produced by the CLI. We don't want to show end users big scary stacktraces if they aren't python programmers, so slim it down to some basic info. We keep a "DEBUGMODE" env variable kicking around to let us turn on stacktraces if we ever need them. Additional...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/excepthook.py#L146-L217
globus/globus-cli
globus_cli/commands/task/event_list.py
task_event_list
def task_event_list(task_id, limit, filter_errors, filter_non_errors): """ Executor for `globus task-event-list` """ client = get_client() # cannot filter by both errors and non errors if filter_errors and filter_non_errors: raise click.UsageError("Cannot filter by both errors and non e...
python
def task_event_list(task_id, limit, filter_errors, filter_non_errors): """ Executor for `globus task-event-list` """ client = get_client() # cannot filter by both errors and non errors if filter_errors and filter_non_errors: raise click.UsageError("Cannot filter by both errors and non e...
Executor for `globus task-event-list`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/event_list.py#L16-L61
globus/globus-cli
globus_cli/commands/endpoint/role/delete.py
role_delete
def role_delete(role_id, endpoint_id): """ Executor for `globus endpoint role delete` """ client = get_client() res = client.delete_endpoint_role(endpoint_id, role_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
python
def role_delete(role_id, endpoint_id): """ Executor for `globus endpoint role delete` """ client = get_client() res = client.delete_endpoint_role(endpoint_id, role_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
Executor for `globus endpoint role delete`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/role/delete.py#L12-L18
globus/globus-cli
globus_cli/commands/ls.py
ls_command
def ls_command( endpoint_plus_path, recursive_depth_limit, recursive, long_output, show_hidden, filter_val, ): """ Executor for `globus ls` """ endpoint_id, path = endpoint_plus_path # do autoactivation before the `ls` call so that recursive invocations # won't do this r...
python
def ls_command( endpoint_plus_path, recursive_depth_limit, recursive, long_output, show_hidden, filter_val, ): """ Executor for `globus ls` """ endpoint_id, path = endpoint_plus_path # do autoactivation before the `ls` call so that recursive invocations # won't do this r...
Executor for `globus ls`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/ls.py#L84-L150
globus/globus-cli
globus_cli/commands/task/generate_submission_id.py
generate_submission_id
def generate_submission_id(): """ Executor for `globus task generate-submission-id` """ client = get_client() res = client.get_submission_id() formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="value")
python
def generate_submission_id(): """ Executor for `globus task generate-submission-id` """ client = get_client() res = client.get_submission_id() formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="value")
Executor for `globus task generate-submission-id`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/generate_submission_id.py#L22-L29
globus/globus-cli
globus_cli/commands/endpoint/permission/create.py
create_command
def create_command( principal, permissions, endpoint_plus_path, notify_email, notify_message ): """ Executor for `globus endpoint permission create` """ if not principal: raise click.UsageError("A security principal is required for this command") endpoint_id, path = endpoint_plus_path ...
python
def create_command( principal, permissions, endpoint_plus_path, notify_email, notify_message ): """ Executor for `globus endpoint permission create` """ if not principal: raise click.UsageError("A security principal is required for this command") endpoint_id, path = endpoint_plus_path ...
Executor for `globus endpoint permission create`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/permission/create.py#L42-L85
globus/globus-cli
globus_cli/services/recursive_ls.py
RecursiveLsResponse.iterable_func
def iterable_func(self): """ An internal function which has generator semantics. Defined using the `yield` syntax. Used to grab the first element during class initialization, and subsequently on calls to `next()` to get the remaining elements. We rely on the implicit Stop...
python
def iterable_func(self): """ An internal function which has generator semantics. Defined using the `yield` syntax. Used to grab the first element during class initialization, and subsequently on calls to `next()` to get the remaining elements. We rely on the implicit Stop...
An internal function which has generator semantics. Defined using the `yield` syntax. Used to grab the first element during class initialization, and subsequently on calls to `next()` to get the remaining elements. We rely on the implicit StopIteration built into this type of function ...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/recursive_ls.py#L77-L149
globus/globus-cli
globus_cli/commands/bookmark/show.py
bookmark_show
def bookmark_show(bookmark_id_or_name): """ Executor for `globus bookmark show` """ client = get_client() res = resolve_id_or_name(client, bookmark_id_or_name) formatted_print( res, text_format=FORMAT_TEXT_RECORD, fields=( ("ID", "id"), ("Name", "n...
python
def bookmark_show(bookmark_id_or_name): """ Executor for `globus bookmark show` """ client = get_client() res = resolve_id_or_name(client, bookmark_id_or_name) formatted_print( res, text_format=FORMAT_TEXT_RECORD, fields=( ("ID", "id"), ("Name", "n...
Executor for `globus bookmark show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/bookmark/show.py#L18-L40
globus/globus-cli
globus_cli/commands/endpoint/role/list.py
role_list
def role_list(endpoint_id): """ Executor for `globus access endpoint-role-list` """ client = get_client() roles = client.endpoint_role_list(endpoint_id) resolved_ids = LazyIdentityMap( x["principal"] for x in roles if x["principal_type"] == "identity" ) def principal_str(role):...
python
def role_list(endpoint_id): """ Executor for `globus access endpoint-role-list` """ client = get_client() roles = client.endpoint_role_list(endpoint_id) resolved_ids = LazyIdentityMap( x["principal"] for x in roles if x["principal_type"] == "identity" ) def principal_str(role):...
Executor for `globus access endpoint-role-list`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/role/list.py#L12-L41
globus/globus-cli
globus_cli/helpers/delegate_proxy.py
fill_delegate_proxy_activation_requirements
def fill_delegate_proxy_activation_requirements( requirements_data, cred_file, lifetime_hours=12 ): """ Given the activation requirements for an endpoint and a filename for X.509 credentials, extracts the public key from the activation requirements, uses the key and the credentials to make a proxy c...
python
def fill_delegate_proxy_activation_requirements( requirements_data, cred_file, lifetime_hours=12 ): """ Given the activation requirements for an endpoint and a filename for X.509 credentials, extracts the public key from the activation requirements, uses the key and the credentials to make a proxy c...
Given the activation requirements for an endpoint and a filename for X.509 credentials, extracts the public key from the activation requirements, uses the key and the credentials to make a proxy credential, and returns the requirements data with the proxy chain filled in.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/delegate_proxy.py#L12-L52
globus/globus-cli
globus_cli/helpers/delegate_proxy.py
create_proxy_credentials
def create_proxy_credentials(issuer_cred, public_key, lifetime_hours): """ Given an issuer credentials PEM file in the form of a string, a public_key string from an activation requirements document, and an int for the proxy lifetime, returns credentials as a unicode string in PEM format containing a...
python
def create_proxy_credentials(issuer_cred, public_key, lifetime_hours): """ Given an issuer credentials PEM file in the form of a string, a public_key string from an activation requirements document, and an int for the proxy lifetime, returns credentials as a unicode string in PEM format containing a...
Given an issuer credentials PEM file in the form of a string, a public_key string from an activation requirements document, and an int for the proxy lifetime, returns credentials as a unicode string in PEM format containing a new proxy certificate and an extended proxy chain.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/delegate_proxy.py#L55-L89
globus/globus-cli
globus_cli/helpers/delegate_proxy.py
parse_issuer_cred
def parse_issuer_cred(issuer_cred): """ Given an X509 PEM file in the form of a string, parses it into sections by the PEM delimiters of: -----BEGIN <label>----- and -----END <label>---- Confirms the sections can be decoded in the proxy credential order of: issuer cert, issuer private key, proxy cha...
python
def parse_issuer_cred(issuer_cred): """ Given an X509 PEM file in the form of a string, parses it into sections by the PEM delimiters of: -----BEGIN <label>----- and -----END <label>---- Confirms the sections can be decoded in the proxy credential order of: issuer cert, issuer private key, proxy cha...
Given an X509 PEM file in the form of a string, parses it into sections by the PEM delimiters of: -----BEGIN <label>----- and -----END <label>---- Confirms the sections can be decoded in the proxy credential order of: issuer cert, issuer private key, proxy chain of 0 or more certs . Returns the issuer c...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/delegate_proxy.py#L92-L137
globus/globus-cli
globus_cli/helpers/delegate_proxy.py
create_proxy_cert
def create_proxy_cert( loaded_cert, loaded_private_key, loaded_public_key, lifetime_hours ): """ Given cryptography objects for an issuing certificate, a public_key, a private_key, and an int for lifetime in hours, creates a proxy cert from the issuer and public key signed by the private key. ""...
python
def create_proxy_cert( loaded_cert, loaded_private_key, loaded_public_key, lifetime_hours ): """ Given cryptography objects for an issuing certificate, a public_key, a private_key, and an int for lifetime in hours, creates a proxy cert from the issuer and public key signed by the private key. ""...
Given cryptography objects for an issuing certificate, a public_key, a private_key, and an int for lifetime in hours, creates a proxy cert from the issuer and public key signed by the private key.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/delegate_proxy.py#L140-L201
globus/globus-cli
globus_cli/helpers/delegate_proxy.py
confirm_not_old_proxy
def confirm_not_old_proxy(loaded_cert): """ Given a cryptography object for the issuer cert, checks if the cert is an "old proxy" and raise an error if so. """ # Examine the last CommonName to see if it looks like an old proxy. last_cn = loaded_cert.subject.get_attributes_for_oid(x509.oid.NameOI...
python
def confirm_not_old_proxy(loaded_cert): """ Given a cryptography object for the issuer cert, checks if the cert is an "old proxy" and raise an error if so. """ # Examine the last CommonName to see if it looks like an old proxy. last_cn = loaded_cert.subject.get_attributes_for_oid(x509.oid.NameOI...
Given a cryptography object for the issuer cert, checks if the cert is an "old proxy" and raise an error if so.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/delegate_proxy.py#L204-L217
globus/globus-cli
globus_cli/helpers/delegate_proxy.py
validate_key_usage
def validate_key_usage(loaded_cert): """ Given a cryptography object for the issuer cert, checks that if the keyUsage extension is being used that the digital signature bit has been asserted. (As specified in RFC 3820 section 3.1.) """ try: key_usage = loaded_cert.extensions.get_extensio...
python
def validate_key_usage(loaded_cert): """ Given a cryptography object for the issuer cert, checks that if the keyUsage extension is being used that the digital signature bit has been asserted. (As specified in RFC 3820 section 3.1.) """ try: key_usage = loaded_cert.extensions.get_extensio...
Given a cryptography object for the issuer cert, checks that if the keyUsage extension is being used that the digital signature bit has been asserted. (As specified in RFC 3820 section 3.1.)
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/delegate_proxy.py#L220-L236
globus/globus-cli
globus_cli/commands/task/pause_info.py
task_pause_info
def task_pause_info(task_id): """ Executor for `globus task pause-info` """ client = get_client() res = client.task_pause_info(task_id) def _custom_text_format(res): explicit_pauses = [ field for field in EXPLICIT_PAUSE_MSG_FIELDS # n.b. some keys are...
python
def task_pause_info(task_id): """ Executor for `globus task pause-info` """ client = get_client() res = client.task_pause_info(task_id) def _custom_text_format(res): explicit_pauses = [ field for field in EXPLICIT_PAUSE_MSG_FIELDS # n.b. some keys are...
Executor for `globus task pause-info`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/pause_info.py#L45-L83
instana/python-sensor
instana/recorder.py
InstanaRecorder.run
def run(self): """ Span a background thread to periodically report queued spans """ self.timer = t.Thread(target=self.report_spans) self.timer.daemon = True self.timer.name = "Instana Span Reporting" self.timer.start()
python
def run(self): """ Span a background thread to periodically report queued spans """ self.timer = t.Thread(target=self.report_spans) self.timer.daemon = True self.timer.name = "Instana Span Reporting" self.timer.start()
Span a background thread to periodically report queued spans
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/recorder.py#L45-L50
instana/python-sensor
instana/recorder.py
InstanaRecorder.report_spans
def report_spans(self): """ Periodically report the queued spans """ logger.debug("Span reporting thread is now alive") def span_work(): queue_size = self.queue.qsize() if queue_size > 0 and instana.singletons.agent.can_send(): response = instana.singleto...
python
def report_spans(self): """ Periodically report the queued spans """ logger.debug("Span reporting thread is now alive") def span_work(): queue_size = self.queue.qsize() if queue_size > 0 and instana.singletons.agent.can_send(): response = instana.singleto...
Periodically report the queued spans
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/recorder.py#L52-L64
instana/python-sensor
instana/recorder.py
InstanaRecorder.queued_spans
def queued_spans(self): """ Get all of the spans in the queue """ spans = [] while True: try: s = self.queue.get(False) except queue.Empty: break else: spans.append(s) return spans
python
def queued_spans(self): """ Get all of the spans in the queue """ spans = [] while True: try: s = self.queue.get(False) except queue.Empty: break else: spans.append(s) return spans
Get all of the spans in the queue
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/recorder.py#L70-L80
instana/python-sensor
instana/recorder.py
InstanaRecorder.record_span
def record_span(self, span): """ Convert the passed BasicSpan into an JsonSpan and add it to the span queue """ if instana.singletons.agent.can_send() or "INSTANA_TEST" in os.environ: json_span = None if span.operation_name in self.registered_spans: ...
python
def record_span(self, span): """ Convert the passed BasicSpan into an JsonSpan and add it to the span queue """ if instana.singletons.agent.can_send() or "INSTANA_TEST" in os.environ: json_span = None if span.operation_name in self.registered_spans: ...
Convert the passed BasicSpan into an JsonSpan and add it to the span queue
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/recorder.py#L86-L99
instana/python-sensor
instana/recorder.py
InstanaRecorder.build_registered_span
def build_registered_span(self, span): """ Takes a BasicSpan and converts it into a registered JsonSpan """ data = Data(baggage=span.context.baggage) kind = 1 # entry if span.operation_name in self.exit_spans: kind = 2 # exit # log is a special case as it is not entr...
python
def build_registered_span(self, span): """ Takes a BasicSpan and converts it into a registered JsonSpan """ data = Data(baggage=span.context.baggage) kind = 1 # entry if span.operation_name in self.exit_spans: kind = 2 # exit # log is a special case as it is not entr...
Takes a BasicSpan and converts it into a registered JsonSpan
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/recorder.py#L101-L209
instana/python-sensor
instana/recorder.py
InstanaRecorder.build_sdk_span
def build_sdk_span(self, span): """ Takes a BasicSpan and converts into an SDK type JsonSpan """ custom_data = CustomData(tags=span.tags, logs=self.collect_logs(span)) sdk_data = SDKData(name=span.operation_name, custom=custom_data, ...
python
def build_sdk_span(self, span): """ Takes a BasicSpan and converts into an SDK type JsonSpan """ custom_data = CustomData(tags=span.tags, logs=self.collect_logs(span)) sdk_data = SDKData(name=span.operation_name, custom=custom_data, ...
Takes a BasicSpan and converts into an SDK type JsonSpan
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/recorder.py#L211-L249
instana/python-sensor
instana/recorder.py
InstanaRecorder.get_span_kind_as_string
def get_span_kind_as_string(self, span): """ Will retrieve the `span.kind` tag and return the appropriate string value for the Instana backend or None if the tag is set to something we don't recognize. :param span: The span to search for the `span.kind` tag :return: Stri...
python
def get_span_kind_as_string(self, span): """ Will retrieve the `span.kind` tag and return the appropriate string value for the Instana backend or None if the tag is set to something we don't recognize. :param span: The span to search for the `span.kind` tag :return: Stri...
Will retrieve the `span.kind` tag and return the appropriate string value for the Instana backend or None if the tag is set to something we don't recognize. :param span: The span to search for the `span.kind` tag :return: String
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/recorder.py#L251-L267
instana/python-sensor
instana/recorder.py
InstanaRecorder.get_span_kind_as_int
def get_span_kind_as_int(self, span): """ Will retrieve the `span.kind` tag and return the appropriate integer value for the Instana backend or None if the tag is set to something we don't recognize. :param span: The span to search for the `span.kind` tag :return: Intege...
python
def get_span_kind_as_int(self, span): """ Will retrieve the `span.kind` tag and return the appropriate integer value for the Instana backend or None if the tag is set to something we don't recognize. :param span: The span to search for the `span.kind` tag :return: Intege...
Will retrieve the `span.kind` tag and return the appropriate integer value for the Instana backend or None if the tag is set to something we don't recognize. :param span: The span to search for the `span.kind` tag :return: Integer
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/recorder.py#L269-L285
instana/python-sensor
instana/fsm.py
TheMachine.__get_real_pid
def __get_real_pid(self): """ Attempts to determine the true process ID by querying the /proc/<pid>/sched file. This works on systems with a proc filesystem. Otherwise default to os default. """ pid = None if os.path.exists("/proc/"): sched_file = "/...
python
def __get_real_pid(self): """ Attempts to determine the true process ID by querying the /proc/<pid>/sched file. This works on systems with a proc filesystem. Otherwise default to os default. """ pid = None if os.path.exists("/proc/"): sched_file = "/...
Attempts to determine the true process ID by querying the /proc/<pid>/sched file. This works on systems with a proc filesystem. Otherwise default to os default.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/fsm.py#L168-L193
instana/python-sensor
instana/fsm.py
TheMachine.__get_agent_host_port
def __get_agent_host_port(self): """ Iterates the the various ways the host and port of the Instana host agent may be configured: default, env vars, sensor options... """ host = AGENT_DEFAULT_HOST port = AGENT_DEFAULT_PORT if "INSTANA_AGENT_HOST" in os.environ: ...
python
def __get_agent_host_port(self): """ Iterates the the various ways the host and port of the Instana host agent may be configured: default, env vars, sensor options... """ host = AGENT_DEFAULT_HOST port = AGENT_DEFAULT_PORT if "INSTANA_AGENT_HOST" in os.environ: ...
Iterates the the various ways the host and port of the Instana host agent may be configured: default, env vars, sensor options...
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/fsm.py#L195-L220
instana/python-sensor
instana/meter.py
Meter.run
def run(self): """ Spawns the metric reporting thread """ self.thr = threading.Thread(target=self.collect_and_report) self.thr.daemon = True self.thr.name = "Instana Metric Collection" self.thr.start()
python
def run(self): """ Spawns the metric reporting thread """ self.thr = threading.Thread(target=self.collect_and_report) self.thr.daemon = True self.thr.name = "Instana Metric Collection" self.thr.start()
Spawns the metric reporting thread
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L126-L131
instana/python-sensor
instana/meter.py
Meter.reset
def reset(self): """" Reset the state as new """ self.last_usage = None self.last_collect = None self.last_metrics = None self.snapshot_countdown = 0 self.run()
python
def reset(self): """" Reset the state as new """ self.last_usage = None self.last_collect = None self.last_metrics = None self.snapshot_countdown = 0 self.run()
Reset the state as new
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L133-L139
instana/python-sensor
instana/meter.py
Meter.collect_and_report
def collect_and_report(self): """ Target function for the metric reporting thread. This is a simple loop to collect and report entity data every 1 second. """ logger.debug("Metric reporting thread is now alive") def metric_work(): self.process() ...
python
def collect_and_report(self): """ Target function for the metric reporting thread. This is a simple loop to collect and report entity data every 1 second. """ logger.debug("Metric reporting thread is now alive") def metric_work(): self.process() ...
Target function for the metric reporting thread. This is a simple loop to collect and report entity data every 1 second.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L141-L156
instana/python-sensor
instana/meter.py
Meter.process
def process(self): """ Collects, processes & reports metrics """ if self.agent.machine.fsm.current is "wait4init": # Test the host agent if we're ready to send data if self.agent.is_agent_ready(): self.agent.machine.fsm.ready() else: re...
python
def process(self): """ Collects, processes & reports metrics """ if self.agent.machine.fsm.current is "wait4init": # Test the host agent if we're ready to send data if self.agent.is_agent_ready(): self.agent.machine.fsm.ready() else: re...
Collects, processes & reports metrics
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L158-L189
instana/python-sensor
instana/meter.py
Meter.handle_agent_tasks
def handle_agent_tasks(self, task): """ When request(s) are received by the host agent, it is sent here for handling & processing. """ logger.debug("Received agent request with messageId: %s" % task["messageId"]) if "action" in task: if task["action"] == "pyth...
python
def handle_agent_tasks(self, task): """ When request(s) are received by the host agent, it is sent here for handling & processing. """ logger.debug("Received agent request with messageId: %s" % task["messageId"]) if "action" in task: if task["action"] == "pyth...
When request(s) are received by the host agent, it is sent here for handling & processing.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L191-L207
instana/python-sensor
instana/meter.py
Meter.collect_snapshot
def collect_snapshot(self): """ Collects snapshot related information to this process and environment """ try: if "INSTANA_SERVICE_NAME" in os.environ: appname = os.environ["INSTANA_SERVICE_NAME"] elif "FLASK_APP" in os.environ: appname = os.envir...
python
def collect_snapshot(self): """ Collects snapshot related information to this process and environment """ try: if "INSTANA_SERVICE_NAME" in os.environ: appname = os.environ["INSTANA_SERVICE_NAME"] elif "FLASK_APP" in os.environ: appname = os.envir...
Collects snapshot related information to this process and environment
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L209-L235
instana/python-sensor
instana/meter.py
Meter.collect_modules
def collect_modules(self): """ Collect up the list of modules in use """ try: res = {} m = sys.modules for k in m: # Don't report submodules (e.g. django.x, django.y, django.z) # Skip modules that begin with underscore i...
python
def collect_modules(self): """ Collect up the list of modules in use """ try: res = {} m = sys.modules for k in m: # Don't report submodules (e.g. django.x, django.y, django.z) # Skip modules that begin with underscore i...
Collect up the list of modules in use
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L249-L276
instana/python-sensor
instana/meter.py
Meter.collect_metrics
def collect_metrics(self): """ Collect up and return various metrics """ try: g = None u = resource.getrusage(resource.RUSAGE_SELF) if gc_.isenabled(): c = list(gc_.get_count()) th = list(gc_.get_threshold()) g = GC(coll...
python
def collect_metrics(self): """ Collect up and return various metrics """ try: g = None u = resource.getrusage(resource.RUSAGE_SELF) if gc_.isenabled(): c = list(gc_.get_count()) th = list(gc_.get_threshold()) g = GC(coll...
Collect up and return various metrics
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/meter.py#L278-L327
instana/python-sensor
instana/agent.py
Agent.start
def start(self, e): """ Starts the agent and required threads """ logger.debug("Spawning metric & trace reporting threads") self.sensor.meter.run() instana.singletons.tracer.recorder.run()
python
def start(self, e): """ Starts the agent and required threads """ logger.debug("Spawning metric & trace reporting threads") self.sensor.meter.run() instana.singletons.tracer.recorder.run()
Starts the agent and required threads
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L46-L50
instana/python-sensor
instana/agent.py
Agent.handle_fork
def handle_fork(self): """ Forks happen. Here we handle them. """ self.reset() self.sensor.handle_fork() instana.singletons.tracer.handle_fork()
python
def handle_fork(self): """ Forks happen. Here we handle them. """ self.reset() self.sensor.handle_fork() instana.singletons.tracer.handle_fork()
Forks happen. Here we handle them.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L104-L110
instana/python-sensor
instana/agent.py
Agent.is_agent_listening
def is_agent_listening(self, host, port): """ Check if the Instana Agent is listening on <host> and <port>. """ try: rv = False url = "http://%s:%s/" % (host, port) response = self.client.get(url, timeout=0.8) server_header = response.head...
python
def is_agent_listening(self, host, port): """ Check if the Instana Agent is listening on <host> and <port>. """ try: rv = False url = "http://%s:%s/" % (host, port) response = self.client.get(url, timeout=0.8) server_header = response.head...
Check if the Instana Agent is listening on <host> and <port>.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L112-L132
instana/python-sensor
instana/agent.py
Agent.announce
def announce(self, discovery): """ With the passed in Discovery class, attempt to announce to the host agent. """ try: url = self.__discovery_url() logger.debug("making announce request to %s" % (url)) response = None response = self.client...
python
def announce(self, discovery): """ With the passed in Discovery class, attempt to announce to the host agent. """ try: url = self.__discovery_url() logger.debug("making announce request to %s" % (url)) response = None response = self.client...
With the passed in Discovery class, attempt to announce to the host agent.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L134-L152
instana/python-sensor
instana/agent.py
Agent.is_agent_ready
def is_agent_ready(self): """ Used after making a successful announce to test when the agent is ready to accept data. """ try: response = self.client.head(self.__data_url(), timeout=0.8) if response.status_code is 200: return True retu...
python
def is_agent_ready(self): """ Used after making a successful announce to test when the agent is ready to accept data. """ try: response = self.client.head(self.__data_url(), timeout=0.8) if response.status_code is 200: return True retu...
Used after making a successful announce to test when the agent is ready to accept data.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L154-L165
instana/python-sensor
instana/agent.py
Agent.report_data
def report_data(self, entity_data): """ Used to report entity data (metrics & snapshot) to the host agent. """ try: response = None response = self.client.post(self.__data_url(), data=self.to_json(entity_data), ...
python
def report_data(self, entity_data): """ Used to report entity data (metrics & snapshot) to the host agent. """ try: response = None response = self.client.post(self.__data_url(), data=self.to_json(entity_data), ...
Used to report entity data (metrics & snapshot) to the host agent.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L167-L185
instana/python-sensor
instana/agent.py
Agent.report_traces
def report_traces(self, spans): """ Used to report entity data (metrics & snapshot) to the host agent. """ try: response = None response = self.client.post(self.__traces_url(), data=self.to_json(spans), ...
python
def report_traces(self, spans): """ Used to report entity data (metrics & snapshot) to the host agent. """ try: response = None response = self.client.post(self.__traces_url(), data=self.to_json(spans), ...
Used to report entity data (metrics & snapshot) to the host agent.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L187-L205
instana/python-sensor
instana/agent.py
Agent.task_response
def task_response(self, message_id, data): """ When the host agent passes us a task and we do it, this function is used to respond with the results of the task. """ try: response = None payload = json.dumps(data) logger.debug("Task response is...
python
def task_response(self, message_id, data): """ When the host agent passes us a task and we do it, this function is used to respond with the results of the task. """ try: response = None payload = json.dumps(data) logger.debug("Task response is...
When the host agent passes us a task and we do it, this function is used to respond with the results of the task.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L207-L227
instana/python-sensor
instana/agent.py
Agent.__discovery_url
def __discovery_url(self): """ URL for announcing to the host agent """ port = self.sensor.options.agent_port if port == 0: port = AGENT_DEFAULT_PORT return "http://%s:%s/%s" % (self.host, port, AGENT_DISCOVERY_PATH)
python
def __discovery_url(self): """ URL for announcing to the host agent """ port = self.sensor.options.agent_port if port == 0: port = AGENT_DEFAULT_PORT return "http://%s:%s/%s" % (self.host, port, AGENT_DISCOVERY_PATH)
URL for announcing to the host agent
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L229-L237
instana/python-sensor
instana/agent.py
Agent.__data_url
def __data_url(self): """ URL for posting metrics to the host agent. Only valid when announced. """ path = AGENT_DATA_PATH % self.from_.pid return "http://%s:%s/%s" % (self.host, self.port, path)
python
def __data_url(self): """ URL for posting metrics to the host agent. Only valid when announced. """ path = AGENT_DATA_PATH % self.from_.pid return "http://%s:%s/%s" % (self.host, self.port, path)
URL for posting metrics to the host agent. Only valid when announced.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L239-L244
instana/python-sensor
instana/agent.py
Agent.__traces_url
def __traces_url(self): """ URL for posting traces to the host agent. Only valid when announced. """ path = AGENT_TRACES_PATH % self.from_.pid return "http://%s:%s/%s" % (self.host, self.port, path)
python
def __traces_url(self): """ URL for posting traces to the host agent. Only valid when announced. """ path = AGENT_TRACES_PATH % self.from_.pid return "http://%s:%s/%s" % (self.host, self.port, path)
URL for posting traces to the host agent. Only valid when announced.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L246-L251
instana/python-sensor
instana/agent.py
Agent.__response_url
def __response_url(self, message_id): """ URL for responding to agent requests. """ if self.from_.pid != 0: path = AGENT_RESPONSE_PATH % (self.from_.pid, message_id) return "http://%s:%s/%s" % (self.host, self.port, path)
python
def __response_url(self, message_id): """ URL for responding to agent requests. """ if self.from_.pid != 0: path = AGENT_RESPONSE_PATH % (self.from_.pid, message_id) return "http://%s:%s/%s" % (self.host, self.port, path)
URL for responding to agent requests.
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/agent.py#L253-L260
instana/python-sensor
instana/util.py
generate_id
def generate_id(): """ Generate a 64bit base 16 ID for use as a Span or Trace ID """ global _current_pid pid = os.getpid() if _current_pid != pid: _current_pid = pid _rnd.seed(int(1000000 * time.time()) ^ pid) id = format(_rnd.randint(0, 18446744073709551615), '02x') if len(id)...
python
def generate_id(): """ Generate a 64bit base 16 ID for use as a Span or Trace ID """ global _current_pid pid = os.getpid() if _current_pid != pid: _current_pid = pid _rnd.seed(int(1000000 * time.time()) ^ pid) id = format(_rnd.randint(0, 18446744073709551615), '02x') if len(id)...
Generate a 64bit base 16 ID for use as a Span or Trace ID
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/util.py#L30-L43
instana/python-sensor
instana/util.py
header_to_id
def header_to_id(header): """ We can receive headers in the following formats: 1. unsigned base 16 hex string of variable length 2. [eventual] :param header: the header to analyze, validate and convert (if needed) :return: a valid ID to be used internal to the tracer """ if not isin...
python
def header_to_id(header): """ We can receive headers in the following formats: 1. unsigned base 16 hex string of variable length 2. [eventual] :param header: the header to analyze, validate and convert (if needed) :return: a valid ID to be used internal to the tracer """ if not isin...
We can receive headers in the following formats: 1. unsigned base 16 hex string of variable length 2. [eventual] :param header: the header to analyze, validate and convert (if needed) :return: a valid ID to be used internal to the tracer
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/util.py#L46-L72
instana/python-sensor
instana/util.py
to_json
def to_json(obj): """ Convert obj to json. Used mostly to convert the classes in json_span.py until we switch to nested dicts (or something better) :param obj: the object to serialize to json :return: json string """ try: return json.dumps(obj, default=lambda obj: {k.lower(): v fo...
python
def to_json(obj): """ Convert obj to json. Used mostly to convert the classes in json_span.py until we switch to nested dicts (or something better) :param obj: the object to serialize to json :return: json string """ try: return json.dumps(obj, default=lambda obj: {k.lower(): v fo...
Convert obj to json. Used mostly to convert the classes in json_span.py until we switch to nested dicts (or something better) :param obj: the object to serialize to json :return: json string
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/util.py#L75-L87
instana/python-sensor
instana/util.py
package_version
def package_version(): """ Determine the version of this package. :return: String representing known version """ version = "" try: version = pkg_resources.get_distribution('instana').version except pkg_resources.DistributionNotFound: version = 'unknown' finally: ...
python
def package_version(): """ Determine the version of this package. :return: String representing known version """ version = "" try: version = pkg_resources.get_distribution('instana').version except pkg_resources.DistributionNotFound: version = 'unknown' finally: ...
Determine the version of this package. :return: String representing known version
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/util.py#L90-L102
instana/python-sensor
instana/util.py
strip_secrets
def strip_secrets(qp, matcher, kwlist): """ This function will scrub the secrets from a query param string based on the passed in matcher and kwlist. blah=1&secret=password&valid=true will result in blah=1&secret=<redacted>&valid=true You can even pass in path query combinations: /signup?blah=1&s...
python
def strip_secrets(qp, matcher, kwlist): """ This function will scrub the secrets from a query param string based on the passed in matcher and kwlist. blah=1&secret=password&valid=true will result in blah=1&secret=<redacted>&valid=true You can even pass in path query combinations: /signup?blah=1&s...
This function will scrub the secrets from a query param string based on the passed in matcher and kwlist. blah=1&secret=password&valid=true will result in blah=1&secret=<redacted>&valid=true You can even pass in path query combinations: /signup?blah=1&secret=password&valid=true will result in /signup?bla...
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/util.py#L105-L182
instana/python-sensor
instana/util.py
get_default_gateway
def get_default_gateway(): """ Attempts to read /proc/self/net/route to determine the default gateway in use. :return: String - the ip address of the default gateway or None if not found/possible/non-existant """ try: # The first line is the header line # We look for the line where ...
python
def get_default_gateway(): """ Attempts to read /proc/self/net/route to determine the default gateway in use. :return: String - the ip address of the default gateway or None if not found/possible/non-existant """ try: # The first line is the header line # We look for the line where ...
Attempts to read /proc/self/net/route to determine the default gateway in use. :return: String - the ip address of the default gateway or None if not found/possible/non-existant
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/util.py#L185-L206
instana/python-sensor
instana/util.py
get_py_source
def get_py_source(file): """ Retrieves and returns the source code for any Python files requested by the UI via the host agent @param file [String] The fully qualified path to a file """ try: response = None pysource = "" if regexp_py.search(file) is None: r...
python
def get_py_source(file): """ Retrieves and returns the source code for any Python files requested by the UI via the host agent @param file [String] The fully qualified path to a file """ try: response = None pysource = "" if regexp_py.search(file) is None: r...
Retrieves and returns the source code for any Python files requested by the UI via the host agent @param file [String] The fully qualified path to a file
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/util.py#L209-L231
instana/python-sensor
instana/util.py
every
def every(delay, task, name): """ Executes a task every `delay` seconds :param delay: the delay in seconds :param task: the method to run. The method should return False if you want the loop to stop. :return: None """ next_time = time.time() + delay while True: time.sleep(...
python
def every(delay, task, name): """ Executes a task every `delay` seconds :param delay: the delay in seconds :param task: the method to run. The method should return False if you want the loop to stop. :return: None """ next_time = time.time() + delay while True: time.sleep(...
Executes a task every `delay` seconds :param delay: the delay in seconds :param task: the method to run. The method should return False if you want the loop to stop. :return: None
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/util.py#L234-L253
instana/python-sensor
instana/wsgi.py
make_middleware
def make_middleware(app=None, *args, **kw): """ Given an app, return that app wrapped in iWSGIMiddleware """ app = iWSGIMiddleware(app, *args, **kw) return app
python
def make_middleware(app=None, *args, **kw): """ Given an app, return that app wrapped in iWSGIMiddleware """ app = iWSGIMiddleware(app, *args, **kw) return app
Given an app, return that app wrapped in iWSGIMiddleware
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/wsgi.py#L60-L63
instana/python-sensor
instana/helpers.py
eum_snippet
def eum_snippet(trace_id=None, eum_api_key=None, meta={}): """ Return an EUM snippet for use in views, templates and layouts that reports client side metrics to Instana that will automagically be linked to the current trace. @param trace_id [optional] the trace ID to insert into the EUM string ...
python
def eum_snippet(trace_id=None, eum_api_key=None, meta={}): """ Return an EUM snippet for use in views, templates and layouts that reports client side metrics to Instana that will automagically be linked to the current trace. @param trace_id [optional] the trace ID to insert into the EUM string ...
Return an EUM snippet for use in views, templates and layouts that reports client side metrics to Instana that will automagically be linked to the current trace. @param trace_id [optional] the trace ID to insert into the EUM string @param eum_api_key [optional] the EUM API key from your Instana dashboa...
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/helpers.py#L15-L57
instana/python-sensor
instana/tracer.py
InstanaTracer.start_span
def start_span(self, operation_name=None, child_of=None, references=None, tags=None, start_time=None, ignore_active_span=False): "Taken from BasicTracer so we can override generate_id calls to ours"...
python
def start_span(self, operation_name=None, child_of=None, references=None, tags=None, start_time=None, ignore_active_span=False): "Taken from BasicTracer so we can override generate_id calls to ours"...
Taken from BasicTracer so we can override generate_id calls to ours
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/tracer.py#L49-L103
instana/python-sensor
instana/tracer.py
InstanaTracer.__add_stack
def __add_stack(self, span, limit=None): """ Adds a backtrace to this span """ span.stack = [] frame_count = 0 tb = traceback.extract_stack() tb.reverse() for frame in tb: if limit is not None and frame_count >= limit: break # Exc...
python
def __add_stack(self, span, limit=None): """ Adds a backtrace to this span """ span.stack = [] frame_count = 0 tb = traceback.extract_stack() tb.reverse() for frame in tb: if limit is not None and frame_count >= limit: break # Exc...
Adds a backtrace to this span
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/tracer.py#L120-L146
instana/python-sensor
instana/flaskana.py
hook
def hook(module): """ Hook method to install the Instana middleware into Flask """ if "INSTANA_DEV" in os.environ: print("==============================================================") print("Instana: Running flask hook") print("=========================================================...
python
def hook(module): """ Hook method to install the Instana middleware into Flask """ if "INSTANA_DEV" in os.environ: print("==============================================================") print("Instana: Running flask hook") print("=========================================================...
Hook method to install the Instana middleware into Flask
https://github.com/instana/python-sensor/blob/58aecb90924c48bafcbc4f93bd9b7190980918bc/instana/flaskana.py#L16-L22
recurly/recurly-client-python
recurly/errors.py
error_class_for_http_status
def error_class_for_http_status(status): """Return the appropriate `ResponseError` subclass for the given HTTP status code.""" try: return error_classes[status] except KeyError: def new_status_error(xml_response): if (status > 400 and status < 500): return Une...
python
def error_class_for_http_status(status): """Return the appropriate `ResponseError` subclass for the given HTTP status code.""" try: return error_classes[status] except KeyError: def new_status_error(xml_response): if (status > 400 and status < 500): return Une...
Return the appropriate `ResponseError` subclass for the given HTTP status code.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/errors.py#L359-L371
recurly/recurly-client-python
recurly/errors.py
ResponseError.response_doc
def response_doc(self): """The XML document received from the service.""" try: return self.__dict__['response_doc'] except KeyError: self.__dict__['response_doc'] = ElementTree.fromstring( self.response_xml ) return self.__dict__['r...
python
def response_doc(self): """The XML document received from the service.""" try: return self.__dict__['response_doc'] except KeyError: self.__dict__['response_doc'] = ElementTree.fromstring( self.response_xml ) return self.__dict__['r...
The XML document received from the service.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/errors.py#L13-L21
recurly/recurly-client-python
recurly/errors.py
ValidationError.transaction_error_code
def transaction_error_code(self): """The machine-readable error code for a transaction error.""" error = self.response_doc.find('transaction_error') if error is not None: code = error.find('error_code') if code is not None: return code.text
python
def transaction_error_code(self): """The machine-readable error code for a transaction error.""" error = self.response_doc.find('transaction_error') if error is not None: code = error.find('error_code') if code is not None: return code.text
The machine-readable error code for a transaction error.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/errors.py#L202-L208
recurly/recurly-client-python
recurly/errors.py
ValidationError.errors
def errors(self): """A dictionary of error objects, keyed on the name of the request field that was invalid. Each error value has `field`, `symbol`, and `message` attributes describing the particular invalidity of that field. """ try: return self.__dict__['e...
python
def errors(self): """A dictionary of error objects, keyed on the name of the request field that was invalid. Each error value has `field`, `symbol`, and `message` attributes describing the particular invalidity of that field. """ try: return self.__dict__['e...
A dictionary of error objects, keyed on the name of the request field that was invalid. Each error value has `field`, `symbol`, and `message` attributes describing the particular invalidity of that field.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/errors.py#L227-L257
recurly/recurly-client-python
recurly/__init__.py
objects_for_push_notification
def objects_for_push_notification(notification): """Decode a push notification with the given body XML. Returns a dictionary containing the constituent objects of the push notification. The kind of push notification is given in the ``"type"`` member of the returned dictionary. """ notification...
python
def objects_for_push_notification(notification): """Decode a push notification with the given body XML. Returns a dictionary containing the constituent objects of the push notification. The kind of push notification is given in the ``"type"`` member of the returned dictionary. """ notification...
Decode a push notification with the given body XML. Returns a dictionary containing the constituent objects of the push notification. The kind of push notification is given in the ``"type"`` member of the returned dictionary.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L1510-L1524
recurly/recurly-client-python
recurly/__init__.py
Account.charge
def charge(self, charge): """Charge (or credit) this account with the given `Adjustment`.""" url = urljoin(self._url, '/adjustments') return charge.post(url)
python
def charge(self, charge): """Charge (or credit) this account with the given `Adjustment`.""" url = urljoin(self._url, '/adjustments') return charge.post(url)
Charge (or credit) this account with the given `Adjustment`.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L279-L282
recurly/recurly-client-python
recurly/__init__.py
Account.invoice
def invoice(self, **kwargs): """Create an invoice for any outstanding adjustments this account has.""" url = urljoin(self._url, '/invoices') if kwargs: response = self.http_request(url, 'POST', Invoice(**kwargs), {'Content-Type': 'application/xml; charset=utf-8'}) ...
python
def invoice(self, **kwargs): """Create an invoice for any outstanding adjustments this account has.""" url = urljoin(self._url, '/invoices') if kwargs: response = self.http_request(url, 'POST', Invoice(**kwargs), {'Content-Type': 'application/xml; charset=utf-8'}) ...
Create an invoice for any outstanding adjustments this account has.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L284-L302
recurly/recurly-client-python
recurly/__init__.py
Account.subscribe
def subscribe(self, subscription): """Create the given `Subscription` for this existing account.""" url = urljoin(self._url, '/subscriptions') return subscription.post(url)
python
def subscribe(self, subscription): """Create the given `Subscription` for this existing account.""" url = urljoin(self._url, '/subscriptions') return subscription.post(url)
Create the given `Subscription` for this existing account.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L341-L344
recurly/recurly-client-python
recurly/__init__.py
Account.update_billing_info
def update_billing_info(self, billing_info): """Change this account's billing information to the given `BillingInfo`.""" url = urljoin(self._url, '/billing_info') response = billing_info.http_request(url, 'PUT', billing_info, {'Content-Type': 'application/xml; charset=utf-8'}) ...
python
def update_billing_info(self, billing_info): """Change this account's billing information to the given `BillingInfo`.""" url = urljoin(self._url, '/billing_info') response = billing_info.http_request(url, 'PUT', billing_info, {'Content-Type': 'application/xml; charset=utf-8'}) ...
Change this account's billing information to the given `BillingInfo`.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L346-L360
recurly/recurly-client-python
recurly/__init__.py
Account.create_shipping_address
def create_shipping_address(self, shipping_address): """Creates a shipping address on an existing account. If you are creating an account, you can embed the shipping addresses with the request""" url = urljoin(self._url, '/shipping_addresses') return shipping_address.post(url)
python
def create_shipping_address(self, shipping_address): """Creates a shipping address on an existing account. If you are creating an account, you can embed the shipping addresses with the request""" url = urljoin(self._url, '/shipping_addresses') return shipping_address.post(url)
Creates a shipping address on an existing account. If you are creating an account, you can embed the shipping addresses with the request
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L362-L367
recurly/recurly-client-python
recurly/__init__.py
GiftCard.preview
def preview(self): """Preview the purchase of this gift card""" if hasattr(self, '_url'): url = self._url + '/preview' return self.post(url) else: url = urljoin(recurly.base_uri(), self.collection_path + '/preview') return self.post(url)
python
def preview(self): """Preview the purchase of this gift card""" if hasattr(self, '_url'): url = self._url + '/preview' return self.post(url) else: url = urljoin(recurly.base_uri(), self.collection_path + '/preview') return self.post(url)
Preview the purchase of this gift card
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L488-L496
recurly/recurly-client-python
recurly/__init__.py
GiftCard.redeem
def redeem(self, account_code): """Redeem this gift card on the specified account code""" redemption_path = '%s/redeem' % (self.redemption_code) if hasattr(self, '_url'): url = urljoin(self._url, '/redeem') else: url = urljoin(recurly.base_uri(), self.collection...
python
def redeem(self, account_code): """Redeem this gift card on the specified account code""" redemption_path = '%s/redeem' % (self.redemption_code) if hasattr(self, '_url'): url = urljoin(self._url, '/redeem') else: url = urljoin(recurly.base_uri(), self.collection...
Redeem this gift card on the specified account code
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L498-L509
recurly/recurly-client-python
recurly/__init__.py
Invoice.pdf
def pdf(cls, uuid): """Return a PDF of the invoice identified by the UUID This is a raw string, which can be written to a file with: ` with open('invoice.pdf', 'w') as invoice_file: invoice_file.write(recurly.Invoice.pdf(uuid)) ` """ url = ur...
python
def pdf(cls, uuid): """Return a PDF of the invoice identified by the UUID This is a raw string, which can be written to a file with: ` with open('invoice.pdf', 'w') as invoice_file: invoice_file.write(recurly.Invoice.pdf(uuid)) ` """ url = ur...
Return a PDF of the invoice identified by the UUID This is a raw string, which can be written to a file with: ` with open('invoice.pdf', 'w') as invoice_file: invoice_file.write(recurly.Invoice.pdf(uuid)) `
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L806-L818
recurly/recurly-client-python
recurly/__init__.py
Invoice.enter_offline_payment
def enter_offline_payment(self, transaction): """ Records an offline (external) payment on the invoice. Pass in a Transaction object to set the details of the created transaction. The attributes available to set are (payment_method, collected_at, amount_in_cents, description) ...
python
def enter_offline_payment(self, transaction): """ Records an offline (external) payment on the invoice. Pass in a Transaction object to set the details of the created transaction. The attributes available to set are (payment_method, collected_at, amount_in_cents, description) ...
Records an offline (external) payment on the invoice. Pass in a Transaction object to set the details of the created transaction. The attributes available to set are (payment_method, collected_at, amount_in_cents, description) Returns: Transaction: The created transaction
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L912-L924
recurly/recurly-client-python
recurly/__init__.py
Subscription.update_notes
def update_notes(self, **kwargs): """ Updates the notes on the subscription without generating a change This endpoint also allows you to update custom fields: ` sub.custom_fields[0].value = 'A new value' sub.update_notes() ` """ ...
python
def update_notes(self, **kwargs): """ Updates the notes on the subscription without generating a change This endpoint also allows you to update custom fields: ` sub.custom_fields[0].value = 'A new value' sub.update_notes() ` """ ...
Updates the notes on the subscription without generating a change This endpoint also allows you to update custom fields: ` sub.custom_fields[0].value = 'A new value' sub.update_notes() `
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L1119-L1132
recurly/recurly-client-python
recurly/__init__.py
Subscription.pause
def pause(self, remaining_pause_cycles): """Pause a subscription""" url = urljoin(self._url, '/pause') elem = ElementTreeBuilder.Element(self.nodename) elem.append(Resource.element_for_value('remaining_pause_cycles', remaining_pause_cycles))...
python
def pause(self, remaining_pause_cycles): """Pause a subscription""" url = urljoin(self._url, '/pause') elem = ElementTreeBuilder.Element(self.nodename) elem.append(Resource.element_for_value('remaining_pause_cycles', remaining_pause_cycles))...
Pause a subscription
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L1134-L1148
recurly/recurly-client-python
recurly/__init__.py
Subscription.create_usage
def create_usage(self, sub_add_on, usage): """Record the usage on the given subscription add on and update the usage object with returned xml""" url = urljoin(self._url, '/add_ons/%s/usage' % (sub_add_on.add_on_code,)) return usage.post(url)
python
def create_usage(self, sub_add_on, usage): """Record the usage on the given subscription add on and update the usage object with returned xml""" url = urljoin(self._url, '/add_ons/%s/usage' % (sub_add_on.add_on_code,)) return usage.post(url)
Record the usage on the given subscription add on and update the usage object with returned xml
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L1166-L1170
recurly/recurly-client-python
recurly/__init__.py
Transaction.get_refund_transaction
def get_refund_transaction(self): """Retrieve the refund transaction for this transaction, immediately after refunding. After calling `refund()` to refund a transaction, call this method to retrieve the new transaction representing the refund. """ try: url =...
python
def get_refund_transaction(self): """Retrieve the refund transaction for this transaction, immediately after refunding. After calling `refund()` to refund a transaction, call this method to retrieve the new transaction representing the refund. """ try: url =...
Retrieve the refund transaction for this transaction, immediately after refunding. After calling `refund()` to refund a transaction, call this method to retrieve the new transaction representing the refund.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L1286-L1301
recurly/recurly-client-python
recurly/__init__.py
Transaction.refund
def refund(self, **kwargs): """Refund this transaction. Calling this method returns the refunded transaction (that is, ``self``) if the refund was successful, or raises a `ResponseError` if an error occurred requesting the refund. After a successful call to `refund()`, to retrie...
python
def refund(self, **kwargs): """Refund this transaction. Calling this method returns the refunded transaction (that is, ``self``) if the refund was successful, or raises a `ResponseError` if an error occurred requesting the refund. After a successful call to `refund()`, to retrie...
Refund this transaction. Calling this method returns the refunded transaction (that is, ``self``) if the refund was successful, or raises a `ResponseError` if an error occurred requesting the refund. After a successful call to `refund()`, to retrieve the new transaction representing the...
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L1303-L1327
recurly/recurly-client-python
recurly/__init__.py
Plan.get_add_on
def get_add_on(self, add_on_code): """Return the `AddOn` for this plan with the given add-on code.""" url = urljoin(self._url, '/add_ons/%s' % (add_on_code,)) resp, elem = AddOn.element_for_url(url) return AddOn.from_element(elem)
python
def get_add_on(self, add_on_code): """Return the `AddOn` for this plan with the given add-on code.""" url = urljoin(self._url, '/add_ons/%s' % (add_on_code,)) resp, elem = AddOn.element_for_url(url) return AddOn.from_element(elem)
Return the `AddOn` for this plan with the given add-on code.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L1374-L1378
recurly/recurly-client-python
recurly/__init__.py
Plan.create_add_on
def create_add_on(self, add_on): """Make the given `AddOn` available to subscribers on this plan.""" url = urljoin(self._url, '/add_ons') return add_on.post(url)
python
def create_add_on(self, add_on): """Make the given `AddOn` available to subscribers on this plan.""" url = urljoin(self._url, '/add_ons') return add_on.post(url)
Make the given `AddOn` available to subscribers on this plan.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L1380-L1383
sigsep/sigsep-mus-eval
museval/__init__.py
_load_track_estimates
def _load_track_estimates(track, estimates_dir, output_dir): """load estimates from disk instead of processing""" user_results = {} track_estimate_dir = os.path.join( estimates_dir, track.subset, track.name ) for target in glob.glob( track_estimate_dir + '/*.wav' ...
python
def _load_track_estimates(track, estimates_dir, output_dir): """load estimates from disk instead of processing""" user_results = {} track_estimate_dir = os.path.join( estimates_dir, track.subset, track.name ) for target in glob.glob( track_estimate_dir + '/*.wav' ...
load estimates from disk instead of processing
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L132-L163
sigsep/sigsep-mus-eval
museval/__init__.py
eval_dir
def eval_dir( reference_dir, estimates_dir, output_dir=None, mode='v4', win=1.0, hop=1.0, ): """Compute bss_eval metrics for two given directories assuming file names are identical for both, reference source and estimates. Parameters ---------- reference_dir : str pa...
python
def eval_dir( reference_dir, estimates_dir, output_dir=None, mode='v4', win=1.0, hop=1.0, ): """Compute bss_eval metrics for two given directories assuming file names are identical for both, reference source and estimates. Parameters ---------- reference_dir : str pa...
Compute bss_eval metrics for two given directories assuming file names are identical for both, reference source and estimates. Parameters ---------- reference_dir : str path to reference sources directory. estimates_dir : str path to estimates directory. output_dir : str ...
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L166-L250
sigsep/sigsep-mus-eval
museval/__init__.py
eval_mus_dir
def eval_mus_dir( dataset, estimates_dir, output_dir=None, *args, **kwargs ): """Run musdb.run for the purpose of evaluation of musdb estimate dir Parameters ---------- dataset : DB(object) Musdb Database object. estimates_dir : str Path to estimates folder. outp...
python
def eval_mus_dir( dataset, estimates_dir, output_dir=None, *args, **kwargs ): """Run musdb.run for the purpose of evaluation of musdb estimate dir Parameters ---------- dataset : DB(object) Musdb Database object. estimates_dir : str Path to estimates folder. outp...
Run musdb.run for the purpose of evaluation of musdb estimate dir Parameters ---------- dataset : DB(object) Musdb Database object. estimates_dir : str Path to estimates folder. output_dir : str Output folder where evaluation json files are stored. *args Variable...
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L253-L289
sigsep/sigsep-mus-eval
museval/__init__.py
eval_mus_track
def eval_mus_track( track, user_estimates, output_dir=None, mode='v4', win=1.0, hop=1.0 ): """Compute all bss_eval metrics for the musdb track and estimated signals, given by a `user_estimates` dict. Parameters ---------- track : Track musdb track object loaded using...
python
def eval_mus_track( track, user_estimates, output_dir=None, mode='v4', win=1.0, hop=1.0 ): """Compute all bss_eval metrics for the musdb track and estimated signals, given by a `user_estimates` dict. Parameters ---------- track : Track musdb track object loaded using...
Compute all bss_eval metrics for the musdb track and estimated signals, given by a `user_estimates` dict. Parameters ---------- track : Track musdb track object loaded using musdb estimated_sources : Dict dictionary, containing the user estimates as np.arrays. output_dir : str ...
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L320-L463
sigsep/sigsep-mus-eval
museval/__init__.py
pad_or_truncate
def pad_or_truncate( audio_reference, audio_estimates ): """Pad or truncate estimates by duration of references: - If reference > estimates: add zeros at the and of the estimated signal - If estimates > references: truncate estimates to duration of references Parameters ---------- refer...
python
def pad_or_truncate( audio_reference, audio_estimates ): """Pad or truncate estimates by duration of references: - If reference > estimates: add zeros at the and of the estimated signal - If estimates > references: truncate estimates to duration of references Parameters ---------- refer...
Pad or truncate estimates by duration of references: - If reference > estimates: add zeros at the and of the estimated signal - If estimates > references: truncate estimates to duration of references Parameters ---------- references : np.ndarray, shape=(nsrc, nsampl, nchan) array containing...
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L466-L504
sigsep/sigsep-mus-eval
museval/__init__.py
evaluate
def evaluate( references, estimates, win=1*44100, hop=1*44100, mode='v4', padding=True ): """BSS_EVAL images evaluation using metrics module Parameters ---------- references : np.ndarray, shape=(nsrc, nsampl, nchan) array containing true reference sources estimates :...
python
def evaluate( references, estimates, win=1*44100, hop=1*44100, mode='v4', padding=True ): """BSS_EVAL images evaluation using metrics module Parameters ---------- references : np.ndarray, shape=(nsrc, nsampl, nchan) array containing true reference sources estimates :...
BSS_EVAL images evaluation using metrics module Parameters ---------- references : np.ndarray, shape=(nsrc, nsampl, nchan) array containing true reference sources estimates : np.ndarray, shape=(nsrc, nsampl, nchan) array containing estimated sources window : int, defaults to 44100 ...
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L507-L557
sigsep/sigsep-mus-eval
museval/__init__.py
EvalStore.add_target
def add_target(self, target_name, values): """add target to scores Dictionary Parameters ---------- target_name : str name of target to be added to list of targets values : List(Dict) List of framewise data entries, see `musdb.schema.json` """ ...
python
def add_target(self, target_name, values): """add target to scores Dictionary Parameters ---------- target_name : str name of target to be added to list of targets values : List(Dict) List of framewise data entries, see `musdb.schema.json` """ ...
add target to scores Dictionary Parameters ---------- target_name : str name of target to be added to list of targets values : List(Dict) List of framewise data entries, see `musdb.schema.json`
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L45-L72
sigsep/sigsep-mus-eval
museval/__init__.py
EvalStore.json
def json(self): """add target to scores Dictionary Returns ---------- json_string : str json dump of the scores dictionary """ json_string = json.dumps( self.scores, indent=2, allow_nan=True ) return json_st...
python
def json(self): """add target to scores Dictionary Returns ---------- json_string : str json dump of the scores dictionary """ json_string = json.dumps( self.scores, indent=2, allow_nan=True ) return json_st...
add target to scores Dictionary Returns ---------- json_string : str json dump of the scores dictionary
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L75-L88
sigsep/sigsep-mus-eval
museval/__init__.py
EvalStore._q
def _q(self, number, precision='.00001'): """quantiztion of BSSEval values""" if np.isinf(number): return np.nan else: return D(D(number).quantize(D(precision)))
python
def _q(self, number, precision='.00001'): """quantiztion of BSSEval values""" if np.isinf(number): return np.nan else: return D(D(number).quantize(D(precision)))
quantiztion of BSSEval values
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/__init__.py#L124-L129
sigsep/sigsep-mus-eval
museval/cli.py
bsseval
def bsseval(inargs=None): """ Generic cli app for bsseval results. Expects two folder with """ parser = argparse.ArgumentParser() parser.add_argument( 'reference_dir', type=str ) parser.add_argument( 'estimates_dir', type=str ) parser.add_argument('...
python
def bsseval(inargs=None): """ Generic cli app for bsseval results. Expects two folder with """ parser = argparse.ArgumentParser() parser.add_argument( 'reference_dir', type=str ) parser.add_argument( 'estimates_dir', type=str ) parser.add_argument('...
Generic cli app for bsseval results. Expects two folder with
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/cli.py#L8-L61
sigsep/sigsep-mus-eval
museval/cli.py
museval
def museval(inargs=None): """ Commandline interface for museval evaluation tools """ parser = argparse.ArgumentParser() parser.add_argument( 'estimates_dir', type=str ) parser.add_argument('-o', help='output_dir') parser.add_argument('--cpu', type=int, help='number of ...
python
def museval(inargs=None): """ Commandline interface for museval evaluation tools """ parser = argparse.ArgumentParser() parser.add_argument( 'estimates_dir', type=str ) parser.add_argument('-o', help='output_dir') parser.add_argument('--cpu', type=int, help='number of ...
Commandline interface for museval evaluation tools
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/cli.py#L64-L116
recurly/recurly-client-python
recurly/resource.py
Page.next_page
def next_page(self): """Return the next `Page` after this one in the result sequence it's from. If the current page is the last page in the sequence, calling this method raises a `ValueError`. """ try: next_url = self.next_url except AttributeError: ...
python
def next_page(self): """Return the next `Page` after this one in the result sequence it's from. If the current page is the last page in the sequence, calling this method raises a `ValueError`. """ try: next_url = self.next_url except AttributeError: ...
Return the next `Page` after this one in the result sequence it's from. If the current page is the last page in the sequence, calling this method raises a `ValueError`.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/resource.py#L105-L117
recurly/recurly-client-python
recurly/resource.py
Page.first_page
def first_page(self): """Return the first `Page` in the result sequence this `Page` instance is from. If the current page is already the first page in the sequence, calling this method raises a `ValueError`. """ try: start_url = self.start_url except...
python
def first_page(self): """Return the first `Page` in the result sequence this `Page` instance is from. If the current page is already the first page in the sequence, calling this method raises a `ValueError`. """ try: start_url = self.start_url except...
Return the first `Page` in the result sequence this `Page` instance is from. If the current page is already the first page in the sequence, calling this method raises a `ValueError`.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/resource.py#L119-L131
recurly/recurly-client-python
recurly/resource.py
Page.page_for_url
def page_for_url(cls, url): """Return a new `Page` containing the items at the given endpoint URL.""" resp, elem = Resource.element_for_url(url) value = Resource.value_for_element(elem) return cls.page_for_value(resp, value)
python
def page_for_url(cls, url): """Return a new `Page` containing the items at the given endpoint URL.""" resp, elem = Resource.element_for_url(url) value = Resource.value_for_element(elem) return cls.page_for_value(resp, value)
Return a new `Page` containing the items at the given endpoint URL.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/resource.py#L134-L141
recurly/recurly-client-python
recurly/resource.py
Page.page_for_value
def page_for_value(cls, resp, value): """Return a new `Page` representing the given resource `value` retrieved using the HTTP response `resp`. This method records pagination ``Link`` headers present in `resp`, so that the returned `Page` can return their resources from its `next...
python
def page_for_value(cls, resp, value): """Return a new `Page` representing the given resource `value` retrieved using the HTTP response `resp`. This method records pagination ``Link`` headers present in `resp`, so that the returned `Page` can return their resources from its `next...
Return a new `Page` representing the given resource `value` retrieved using the HTTP response `resp`. This method records pagination ``Link`` headers present in `resp`, so that the returned `Page` can return their resources from its `next_page()` and `first_page()` methods.
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/resource.py#L150-L167
recurly/recurly-client-python
recurly/resource.py
Resource.serializable_attributes
def serializable_attributes(self): """ Attributes to be serialized in a ``POST`` or ``PUT`` request. Returns all attributes unless a blacklist is specified """ if hasattr(self, 'blacklist_attributes'): return [attr for attr in self.attributes if attr not in ...
python
def serializable_attributes(self): """ Attributes to be serialized in a ``POST`` or ``PUT`` request. Returns all attributes unless a blacklist is specified """ if hasattr(self, 'blacklist_attributes'): return [attr for attr in self.attributes if attr not in ...
Attributes to be serialized in a ``POST`` or ``PUT`` request. Returns all attributes unless a blacklist is specified
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/resource.py#L196-L205