repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
croscon/fleaker | fleaker/marshmallow/fields/arrow.py | ArrowField._deserialize | def _deserialize(self, value, attr, data):
"""Deserializes a string into an Arrow object."""
if not self.context.get('convert_dates', True) or not value:
return value
value = super(ArrowField, self)._deserialize(value, attr, data)
timezone = self.get_field_value('timezone')
... | python | def _deserialize(self, value, attr, data):
"""Deserializes a string into an Arrow object."""
if not self.context.get('convert_dates', True) or not value:
return value
value = super(ArrowField, self)._deserialize(value, attr, data)
timezone = self.get_field_value('timezone')
... | [
"def",
"_deserialize",
"(",
"self",
",",
"value",
",",
"attr",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"context",
".",
"get",
"(",
"'convert_dates'",
",",
"True",
")",
"or",
"not",
"value",
":",
"return",
"value",
"value",
"=",
"super",
"(",... | Deserializes a string into an Arrow object. | [
"Deserializes",
"a",
"string",
"into",
"an",
"Arrow",
"object",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/fields/arrow.py#L49-L64 |
croscon/fleaker | fleaker/peewee/fields/pendulum.py | PendulumDateTimeField.python_value | def python_value(self, value):
"""Return the value in the database as an Pendulum object.
Returns:
pendulum.Pendulum:
An instance of Pendulum with the field filled in.
"""
value = super(PendulumDateTimeField, self).python_value(value)
if isinstance(v... | python | def python_value(self, value):
"""Return the value in the database as an Pendulum object.
Returns:
pendulum.Pendulum:
An instance of Pendulum with the field filled in.
"""
value = super(PendulumDateTimeField, self).python_value(value)
if isinstance(v... | [
"def",
"python_value",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"super",
"(",
"PendulumDateTimeField",
",",
"self",
")",
".",
"python_value",
"(",
"value",
")",
"if",
"isinstance",
"(",
"value",
",",
"datetime",
".",
"datetime",
")",
":",
"valu... | Return the value in the database as an Pendulum object.
Returns:
pendulum.Pendulum:
An instance of Pendulum with the field filled in. | [
"Return",
"the",
"value",
"in",
"the",
"database",
"as",
"an",
"Pendulum",
"object",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/fields/pendulum.py#L68-L88 |
croscon/fleaker | fleaker/peewee/fields/pendulum.py | PendulumDateTimeField.db_value | def db_value(self, value):
"""Convert the Pendulum instance to a datetime for saving in the db."""
if isinstance(value, pendulum.Pendulum):
value = datetime.datetime(
value.year, value.month, value.day, value.hour, value.minute,
value.second, value.microsecond... | python | def db_value(self, value):
"""Convert the Pendulum instance to a datetime for saving in the db."""
if isinstance(value, pendulum.Pendulum):
value = datetime.datetime(
value.year, value.month, value.day, value.hour, value.minute,
value.second, value.microsecond... | [
"def",
"db_value",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"pendulum",
".",
"Pendulum",
")",
":",
"value",
"=",
"datetime",
".",
"datetime",
"(",
"value",
".",
"year",
",",
"value",
".",
"month",
",",
"value",
".",... | Convert the Pendulum instance to a datetime for saving in the db. | [
"Convert",
"the",
"Pendulum",
"instance",
"to",
"a",
"datetime",
"for",
"saving",
"in",
"the",
"db",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/fields/pendulum.py#L90-L98 |
mozilla-releng/mozapkpublisher | mozapkpublisher/check_rollout.py | check_rollout | def check_rollout(edits_service, package_name, days):
"""Check if package_name has a release on staged rollout for too long"""
edit = edits_service.insert(body={}, packageName=package_name).execute()
response = edits_service.tracks().get(editId=edit['id'], track='production', packageName=package_name).execu... | python | def check_rollout(edits_service, package_name, days):
"""Check if package_name has a release on staged rollout for too long"""
edit = edits_service.insert(body={}, packageName=package_name).execute()
response = edits_service.tracks().get(editId=edit['id'], track='production', packageName=package_name).execu... | [
"def",
"check_rollout",
"(",
"edits_service",
",",
"package_name",
",",
"days",
")",
":",
"edit",
"=",
"edits_service",
".",
"insert",
"(",
"body",
"=",
"{",
"}",
",",
"packageName",
"=",
"package_name",
")",
".",
"execute",
"(",
")",
"response",
"=",
"e... | Check if package_name has a release on staged rollout for too long | [
"Check",
"if",
"package_name",
"has",
"a",
"release",
"on",
"staged",
"rollout",
"for",
"too",
"long"
] | train | https://github.com/mozilla-releng/mozapkpublisher/blob/df61034220153cbb98da74c8ef6de637f9185e12/mozapkpublisher/check_rollout.py#L19-L34 |
croscon/fleaker | fleaker/marshmallow/json_schema.py | FleakerJSONSchema.generate_json_schema | def generate_json_schema(cls, schema, context=DEFAULT_DICT):
"""Generate a JSON Schema from a Marshmallow schema.
Args:
schema (marshmallow.Schema|str): The Marshmallow schema, or the
Python path to one, to create the JSON schema for.
Keyword Args:
file_... | python | def generate_json_schema(cls, schema, context=DEFAULT_DICT):
"""Generate a JSON Schema from a Marshmallow schema.
Args:
schema (marshmallow.Schema|str): The Marshmallow schema, or the
Python path to one, to create the JSON schema for.
Keyword Args:
file_... | [
"def",
"generate_json_schema",
"(",
"cls",
",",
"schema",
",",
"context",
"=",
"DEFAULT_DICT",
")",
":",
"schema",
"=",
"cls",
".",
"_get_schema",
"(",
"schema",
")",
"# Generate the JSON Schema",
"return",
"cls",
"(",
"context",
"=",
"context",
")",
".",
"d... | Generate a JSON Schema from a Marshmallow schema.
Args:
schema (marshmallow.Schema|str): The Marshmallow schema, or the
Python path to one, to create the JSON schema for.
Keyword Args:
file_pointer (file, optional): The path or pointer to the file
... | [
"Generate",
"a",
"JSON",
"Schema",
"from",
"a",
"Marshmallow",
"schema",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/json_schema.py#L96-L114 |
croscon/fleaker | fleaker/marshmallow/json_schema.py | FleakerJSONSchema.write_schema_to_file | def write_schema_to_file(cls, schema, file_pointer=stdout,
folder=MISSING, context=DEFAULT_DICT):
"""Given a Marshmallow schema, create a JSON Schema for it.
Args:
schema (marshmallow.Schema|str): The Marshmallow schema, or the
Python path to one... | python | def write_schema_to_file(cls, schema, file_pointer=stdout,
folder=MISSING, context=DEFAULT_DICT):
"""Given a Marshmallow schema, create a JSON Schema for it.
Args:
schema (marshmallow.Schema|str): The Marshmallow schema, or the
Python path to one... | [
"def",
"write_schema_to_file",
"(",
"cls",
",",
"schema",
",",
"file_pointer",
"=",
"stdout",
",",
"folder",
"=",
"MISSING",
",",
"context",
"=",
"DEFAULT_DICT",
")",
":",
"schema",
"=",
"cls",
".",
"_get_schema",
"(",
"schema",
")",
"json_schema",
"=",
"c... | Given a Marshmallow schema, create a JSON Schema for it.
Args:
schema (marshmallow.Schema|str): The Marshmallow schema, or the
Python path to one, to create the JSON schema for.
Keyword Args:
file_pointer (file, optional): The pointer to the file to write
... | [
"Given",
"a",
"Marshmallow",
"schema",
"create",
"a",
"JSON",
"Schema",
"for",
"it",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/json_schema.py#L117-L155 |
croscon/fleaker | fleaker/marshmallow/json_schema.py | FleakerJSONSchema._get_schema | def _get_schema(cls, schema):
"""Method that will fetch a Marshmallow schema flexibly.
Args:
schema (marshmallow.Schema|str): Either the schema class, an
instance of a schema, or a Python path to a schema.
Returns:
marshmallow.Schema: The desired schema.... | python | def _get_schema(cls, schema):
"""Method that will fetch a Marshmallow schema flexibly.
Args:
schema (marshmallow.Schema|str): Either the schema class, an
instance of a schema, or a Python path to a schema.
Returns:
marshmallow.Schema: The desired schema.... | [
"def",
"_get_schema",
"(",
"cls",
",",
"schema",
")",
":",
"if",
"isinstance",
"(",
"schema",
",",
"string_types",
")",
":",
"schema",
"=",
"cls",
".",
"_get_object_from_python_path",
"(",
"schema",
")",
"if",
"isclass",
"(",
"schema",
")",
":",
"schema",
... | Method that will fetch a Marshmallow schema flexibly.
Args:
schema (marshmallow.Schema|str): Either the schema class, an
instance of a schema, or a Python path to a schema.
Returns:
marshmallow.Schema: The desired schema.
Raises:
TypeError: ... | [
"Method",
"that",
"will",
"fetch",
"a",
"Marshmallow",
"schema",
"flexibly",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/json_schema.py#L158-L182 |
croscon/fleaker | fleaker/marshmallow/json_schema.py | FleakerJSONSchema._get_object_from_python_path | def _get_object_from_python_path(python_path):
"""Method that will fetch a Marshmallow schema from a path to it.
Args:
python_path (str): The string path to the Marshmallow schema.
Returns:
marshmallow.Schema: The schema matching the provided path.
Raises:
... | python | def _get_object_from_python_path(python_path):
"""Method that will fetch a Marshmallow schema from a path to it.
Args:
python_path (str): The string path to the Marshmallow schema.
Returns:
marshmallow.Schema: The schema matching the provided path.
Raises:
... | [
"def",
"_get_object_from_python_path",
"(",
"python_path",
")",
":",
"# Dissect the path",
"python_path",
"=",
"python_path",
".",
"split",
"(",
"'.'",
")",
"module_path",
"=",
"python_path",
"[",
":",
"-",
"1",
"]",
"object_class",
"=",
"python_path",
"[",
"-",... | Method that will fetch a Marshmallow schema from a path to it.
Args:
python_path (str): The string path to the Marshmallow schema.
Returns:
marshmallow.Schema: The schema matching the provided path.
Raises:
TypeError: This is raised if the specified object ... | [
"Method",
"that",
"will",
"fetch",
"a",
"Marshmallow",
"schema",
"from",
"a",
"path",
"to",
"it",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/json_schema.py#L185-L213 |
croscon/fleaker | fleaker/marshmallow/extension.py | MarshmallowAwareApp.post_create_app | def post_create_app(cls, app, **settings):
"""Automatically register and init the Flask Marshmallow extension.
Args:
app (flask.Flask): The application instance in which to initialize
Flask Marshmallow upon.
Kwargs:
settings (dict): The settings passed t... | python | def post_create_app(cls, app, **settings):
"""Automatically register and init the Flask Marshmallow extension.
Args:
app (flask.Flask): The application instance in which to initialize
Flask Marshmallow upon.
Kwargs:
settings (dict): The settings passed t... | [
"def",
"post_create_app",
"(",
"cls",
",",
"app",
",",
"*",
"*",
"settings",
")",
":",
"super",
"(",
"MarshmallowAwareApp",
",",
"cls",
")",
".",
"post_create_app",
"(",
"app",
",",
"*",
"*",
"settings",
")",
"marsh",
".",
"init_app",
"(",
"app",
")",
... | Automatically register and init the Flask Marshmallow extension.
Args:
app (flask.Flask): The application instance in which to initialize
Flask Marshmallow upon.
Kwargs:
settings (dict): The settings passed to this method from the
parent app.
... | [
"Automatically",
"register",
"and",
"init",
"the",
"Flask",
"Marshmallow",
"extension",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/extension.py#L37-L55 |
croscon/fleaker | fleaker/peewee/mixins/event.py | get_original_before_save | def get_original_before_save(sender, instance, created):
"""Event listener to get the original instance before it's saved."""
if not instance._meta.event_ready or created:
return
instance.get_original() | python | def get_original_before_save(sender, instance, created):
"""Event listener to get the original instance before it's saved."""
if not instance._meta.event_ready or created:
return
instance.get_original() | [
"def",
"get_original_before_save",
"(",
"sender",
",",
"instance",
",",
"created",
")",
":",
"if",
"not",
"instance",
".",
"_meta",
".",
"event_ready",
"or",
"created",
":",
"return",
"instance",
".",
"get_original",
"(",
")"
] | Event listener to get the original instance before it's saved. | [
"Event",
"listener",
"to",
"get",
"the",
"original",
"instance",
"before",
"it",
"s",
"saved",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L623-L628 |
croscon/fleaker | fleaker/peewee/mixins/event.py | post_save_event_listener | def post_save_event_listener(sender, instance, created):
"""Event listener to create creation and update events."""
if not instance._meta.event_ready:
return
if created:
instance.create_creation_event()
else:
instance.create_update_event()
# Reset the original key
insta... | python | def post_save_event_listener(sender, instance, created):
"""Event listener to create creation and update events."""
if not instance._meta.event_ready:
return
if created:
instance.create_creation_event()
else:
instance.create_update_event()
# Reset the original key
insta... | [
"def",
"post_save_event_listener",
"(",
"sender",
",",
"instance",
",",
"created",
")",
":",
"if",
"not",
"instance",
".",
"_meta",
".",
"event_ready",
":",
"return",
"if",
"created",
":",
"instance",
".",
"create_creation_event",
"(",
")",
"else",
":",
"ins... | Event listener to create creation and update events. | [
"Event",
"listener",
"to",
"create",
"creation",
"and",
"update",
"events",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L632-L643 |
croscon/fleaker | fleaker/peewee/mixins/event.py | validate_event_type | def validate_event_type(sender, event, created):
"""Verify that the Event's code is a valid one."""
if event.code not in sender.event_codes():
raise ValueError("The Event.code '{}' is not a valid Event "
"code.".format(event.code)) | python | def validate_event_type(sender, event, created):
"""Verify that the Event's code is a valid one."""
if event.code not in sender.event_codes():
raise ValueError("The Event.code '{}' is not a valid Event "
"code.".format(event.code)) | [
"def",
"validate_event_type",
"(",
"sender",
",",
"event",
",",
"created",
")",
":",
"if",
"event",
".",
"code",
"not",
"in",
"sender",
".",
"event_codes",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"The Event.code '{}' is not a valid Event \"",
"\"code.\"",
"... | Verify that the Event's code is a valid one. | [
"Verify",
"that",
"the",
"Event",
"s",
"code",
"is",
"a",
"valid",
"one",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L732-L736 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.get_original | def get_original(self):
"""Get the original instance of this instance before it's updated.
Returns:
fleaker.peewee.EventMixin:
The original instance of the model.
"""
pk_value = self._get_pk_value()
if isinstance(pk_value, int) and not self._original... | python | def get_original(self):
"""Get the original instance of this instance before it's updated.
Returns:
fleaker.peewee.EventMixin:
The original instance of the model.
"""
pk_value = self._get_pk_value()
if isinstance(pk_value, int) and not self._original... | [
"def",
"get_original",
"(",
"self",
")",
":",
"pk_value",
"=",
"self",
".",
"_get_pk_value",
"(",
")",
"if",
"isinstance",
"(",
"pk_value",
",",
"int",
")",
"and",
"not",
"self",
".",
"_original",
":",
"self",
".",
"_original",
"=",
"(",
"self",
".",
... | Get the original instance of this instance before it's updated.
Returns:
fleaker.peewee.EventMixin:
The original instance of the model. | [
"Get",
"the",
"original",
"instance",
"of",
"this",
"instance",
"before",
"it",
"s",
"updated",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L398-L412 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.create_creation_event | def create_creation_event(self):
"""Parse the create message DSL to insert the data into the Event.
Returns:
fleaker.peewee.EventStorageMixin:
A new Event instance with data put in it
"""
event = self.create_audit_event(code='AUDIT_CREATE')
if self._... | python | def create_creation_event(self):
"""Parse the create message DSL to insert the data into the Event.
Returns:
fleaker.peewee.EventStorageMixin:
A new Event instance with data put in it
"""
event = self.create_audit_event(code='AUDIT_CREATE')
if self._... | [
"def",
"create_creation_event",
"(",
"self",
")",
":",
"event",
"=",
"self",
".",
"create_audit_event",
"(",
"code",
"=",
"'AUDIT_CREATE'",
")",
"if",
"self",
".",
"_meta",
".",
"create_message",
":",
"event",
".",
"body",
"=",
"self",
".",
"_meta",
".",
... | Parse the create message DSL to insert the data into the Event.
Returns:
fleaker.peewee.EventStorageMixin:
A new Event instance with data put in it | [
"Parse",
"the",
"create",
"message",
"DSL",
"to",
"insert",
"the",
"data",
"into",
"the",
"Event",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L414-L432 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.create_update_event | def create_update_event(self):
"""Parse the update messages DSL to insert the data into the Event.
Returns:
list[fleaker.peewee.EventStorageMixin]:
All the events that were created for the update.
"""
events = []
for fields, rules in iteritems(self._... | python | def create_update_event(self):
"""Parse the update messages DSL to insert the data into the Event.
Returns:
list[fleaker.peewee.EventStorageMixin]:
All the events that were created for the update.
"""
events = []
for fields, rules in iteritems(self._... | [
"def",
"create_update_event",
"(",
"self",
")",
":",
"events",
"=",
"[",
"]",
"for",
"fields",
",",
"rules",
"in",
"iteritems",
"(",
"self",
".",
"_meta",
".",
"update_messages",
")",
":",
"if",
"not",
"isinstance",
"(",
"fields",
",",
"(",
"list",
","... | Parse the update messages DSL to insert the data into the Event.
Returns:
list[fleaker.peewee.EventStorageMixin]:
All the events that were created for the update. | [
"Parse",
"the",
"update",
"messages",
"DSL",
"to",
"insert",
"the",
"data",
"into",
"the",
"Event",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L434-L464 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.create_deletion_event | def create_deletion_event(self):
"""Parse the delete message DSL to insert data into the Event.
Return:
Event: The Event with the relevant information put in it.
"""
event = self.create_audit_event(code='AUDIT_DELETE')
if self._meta.delete_message:
event... | python | def create_deletion_event(self):
"""Parse the delete message DSL to insert data into the Event.
Return:
Event: The Event with the relevant information put in it.
"""
event = self.create_audit_event(code='AUDIT_DELETE')
if self._meta.delete_message:
event... | [
"def",
"create_deletion_event",
"(",
"self",
")",
":",
"event",
"=",
"self",
".",
"create_audit_event",
"(",
"code",
"=",
"'AUDIT_DELETE'",
")",
"if",
"self",
".",
"_meta",
".",
"delete_message",
":",
"event",
".",
"code",
"=",
"self",
".",
"_meta",
".",
... | Parse the delete message DSL to insert data into the Event.
Return:
Event: The Event with the relevant information put in it. | [
"Parse",
"the",
"delete",
"message",
"DSL",
"to",
"insert",
"data",
"into",
"the",
"Event",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L466-L483 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.parse_meta | def parse_meta(self, meta):
"""Parses the meta field in the message, copies it's keys into a new
dict and replaces the values, which should be attribute paths relative
to the passed in object, with the current value at the end of that
path. This function will run recursively when it enco... | python | def parse_meta(self, meta):
"""Parses the meta field in the message, copies it's keys into a new
dict and replaces the values, which should be attribute paths relative
to the passed in object, with the current value at the end of that
path. This function will run recursively when it enco... | [
"def",
"parse_meta",
"(",
"self",
",",
"meta",
")",
":",
"res",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"meta",
".",
"items",
"(",
")",
":",
"if",
"not",
"val",
":",
"continue",
"elif",
"isinstance",
"(",
"val",
",",
"dict",
")",
":",
"r... | Parses the meta field in the message, copies it's keys into a new
dict and replaces the values, which should be attribute paths relative
to the passed in object, with the current value at the end of that
path. This function will run recursively when it encounters other dicts
inside the m... | [
"Parses",
"the",
"meta",
"field",
"in",
"the",
"message",
"copies",
"it",
"s",
"keys",
"into",
"a",
"new",
"dict",
"and",
"replaces",
"the",
"values",
"which",
"should",
"be",
"attribute",
"paths",
"relative",
"to",
"the",
"passed",
"in",
"object",
"with",... | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L485-L515 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.get_path_attribute | def get_path_attribute(obj, path):
"""Given a path like `related_record.related_record2.id`, this method
will be able to pull the value of ID from that object, returning None
if it doesn't exist.
Args:
obj (fleaker.db.Model):
The object to attempt to pull the... | python | def get_path_attribute(obj, path):
"""Given a path like `related_record.related_record2.id`, this method
will be able to pull the value of ID from that object, returning None
if it doesn't exist.
Args:
obj (fleaker.db.Model):
The object to attempt to pull the... | [
"def",
"get_path_attribute",
"(",
"obj",
",",
"path",
")",
":",
"# Strip out ignored keys passed in",
"path",
"=",
"path",
".",
"replace",
"(",
"'original.'",
",",
"''",
")",
".",
"replace",
"(",
"'current_user.'",
",",
"''",
")",
"attr_parts",
"=",
"path",
... | Given a path like `related_record.related_record2.id`, this method
will be able to pull the value of ID from that object, returning None
if it doesn't exist.
Args:
obj (fleaker.db.Model):
The object to attempt to pull the value from
path (str):
... | [
"Given",
"a",
"path",
"like",
"related_record",
".",
"related_record2",
".",
"id",
"this",
"method",
"will",
"be",
"able",
"to",
"pull",
"the",
"value",
"of",
"ID",
"from",
"that",
"object",
"returning",
"None",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L518-L550 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.copy_foreign_keys | def copy_foreign_keys(self, event):
"""Copies possible foreign key values from the object into the Event,
skipping common keys like modified and created.
Args:
event (Event): The Event instance to copy the FKs into
obj (fleaker.db.Model): The object to pull the values fr... | python | def copy_foreign_keys(self, event):
"""Copies possible foreign key values from the object into the Event,
skipping common keys like modified and created.
Args:
event (Event): The Event instance to copy the FKs into
obj (fleaker.db.Model): The object to pull the values fr... | [
"def",
"copy_foreign_keys",
"(",
"self",
",",
"event",
")",
":",
"event_keys",
"=",
"set",
"(",
"event",
".",
"_meta",
".",
"fields",
".",
"keys",
"(",
")",
")",
"obj_keys",
"=",
"self",
".",
"_meta",
".",
"fields",
".",
"keys",
"(",
")",
"matching_k... | Copies possible foreign key values from the object into the Event,
skipping common keys like modified and created.
Args:
event (Event): The Event instance to copy the FKs into
obj (fleaker.db.Model): The object to pull the values from | [
"Copies",
"possible",
"foreign",
"key",
"values",
"from",
"the",
"object",
"into",
"the",
"Event",
"skipping",
"common",
"keys",
"like",
"modified",
"and",
"created",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L552-L584 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.create_audit_event | def create_audit_event(self, code='AUDIT'):
"""Creates a generic auditing Event logging the changes between saves
and the initial data in creates.
Kwargs:
code (str): The code to set the new Event to.
Returns:
Event: A new event with relevant info inserted into ... | python | def create_audit_event(self, code='AUDIT'):
"""Creates a generic auditing Event logging the changes between saves
and the initial data in creates.
Kwargs:
code (str): The code to set the new Event to.
Returns:
Event: A new event with relevant info inserted into ... | [
"def",
"create_audit_event",
"(",
"self",
",",
"code",
"=",
"'AUDIT'",
")",
":",
"event",
"=",
"self",
".",
"_meta",
".",
"event_model",
"(",
"code",
"=",
"code",
",",
"model",
"=",
"self",
".",
"__class__",
".",
"__name__",
",",
")",
"# Use the logged i... | Creates a generic auditing Event logging the changes between saves
and the initial data in creates.
Kwargs:
code (str): The code to set the new Event to.
Returns:
Event: A new event with relevant info inserted into it | [
"Creates",
"a",
"generic",
"auditing",
"Event",
"logging",
"the",
"changes",
"between",
"saves",
"and",
"the",
"initial",
"data",
"in",
"creates",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L586-L608 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventMixin.populate_audit_fields | def populate_audit_fields(self, event):
"""Populates the the audit JSON fields with raw data from the model, so
all changes can be tracked and diffed.
Args:
event (Event): The Event instance to attach the data to
instance (fleaker.db.Model): The newly created/updated mod... | python | def populate_audit_fields(self, event):
"""Populates the the audit JSON fields with raw data from the model, so
all changes can be tracked and diffed.
Args:
event (Event): The Event instance to attach the data to
instance (fleaker.db.Model): The newly created/updated mod... | [
"def",
"populate_audit_fields",
"(",
"self",
",",
"event",
")",
":",
"event",
".",
"updated",
"=",
"self",
".",
"_data",
"event",
".",
"original",
"=",
"self",
".",
"get_original",
"(",
")",
".",
"_data"
] | Populates the the audit JSON fields with raw data from the model, so
all changes can be tracked and diffed.
Args:
event (Event): The Event instance to attach the data to
instance (fleaker.db.Model): The newly created/updated model | [
"Populates",
"the",
"the",
"audit",
"JSON",
"fields",
"with",
"raw",
"data",
"from",
"the",
"model",
"so",
"all",
"changes",
"can",
"be",
"tracked",
"and",
"diffed",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L610-L619 |
croscon/fleaker | fleaker/peewee/mixins/event.py | EventStorageMixin.formatted_message | def formatted_message(self):
"""Method that will return the formatted message for the event.
This formatting is done with Jinja and the template text is stored in
the ``body`` attribute. The template is supplied the following
variables, as well as the built in Flask ones:
- ``e... | python | def formatted_message(self):
"""Method that will return the formatted message for the event.
This formatting is done with Jinja and the template text is stored in
the ``body`` attribute. The template is supplied the following
variables, as well as the built in Flask ones:
- ``e... | [
"def",
"formatted_message",
"(",
"self",
")",
":",
"return",
"render_template_string",
"(",
"self",
".",
"body",
",",
"event",
"=",
"self",
",",
"meta",
"=",
"self",
".",
"meta",
",",
"original",
"=",
"self",
".",
"original",
",",
"updated",
"=",
"self",... | Method that will return the formatted message for the event.
This formatting is done with Jinja and the template text is stored in
the ``body`` attribute. The template is supplied the following
variables, as well as the built in Flask ones:
- ``event``: This is the event instance that ... | [
"Method",
"that",
"will",
"return",
"the",
"formatted",
"message",
"for",
"the",
"event",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/event.py#L695-L720 |
croscon/fleaker | fleaker/peewee/mixins/time/base.py | CreatedMixin._get_cached_time | def _get_cached_time(self):
"""Method that will allow for consistent modified and archived
timestamps.
Returns:
self.Meta.datetime: This method will return a datetime that is
compatible with the current class's datetime library.
"""
if not self._cache... | python | def _get_cached_time(self):
"""Method that will allow for consistent modified and archived
timestamps.
Returns:
self.Meta.datetime: This method will return a datetime that is
compatible with the current class's datetime library.
"""
if not self._cache... | [
"def",
"_get_cached_time",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_cached_time",
":",
"self",
".",
"_cached_time",
"=",
"self",
".",
"_meta",
".",
"datetime",
".",
"utcnow",
"(",
")",
"return",
"self",
".",
"_cached_time"
] | Method that will allow for consistent modified and archived
timestamps.
Returns:
self.Meta.datetime: This method will return a datetime that is
compatible with the current class's datetime library. | [
"Method",
"that",
"will",
"allow",
"for",
"consistent",
"modified",
"and",
"archived",
"timestamps",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/mixins/time/base.py#L77-L88 |
mozilla-releng/mozapkpublisher | mozapkpublisher/common/store_l10n.py | _get_list_of_completed_locales | def _get_list_of_completed_locales(product, channel):
""" Get all the translated locales supported by Google play
So, locale unsupported by Google play won't be downloaded
Idem for not translated locale
"""
return utils.load_json_url(_ALL_LOCALES_URL.format(product=product, channel=channel)) | python | def _get_list_of_completed_locales(product, channel):
""" Get all the translated locales supported by Google play
So, locale unsupported by Google play won't be downloaded
Idem for not translated locale
"""
return utils.load_json_url(_ALL_LOCALES_URL.format(product=product, channel=channel)) | [
"def",
"_get_list_of_completed_locales",
"(",
"product",
",",
"channel",
")",
":",
"return",
"utils",
".",
"load_json_url",
"(",
"_ALL_LOCALES_URL",
".",
"format",
"(",
"product",
"=",
"product",
",",
"channel",
"=",
"channel",
")",
")"
] | Get all the translated locales supported by Google play
So, locale unsupported by Google play won't be downloaded
Idem for not translated locale | [
"Get",
"all",
"the",
"translated",
"locales",
"supported",
"by",
"Google",
"play",
"So",
"locale",
"unsupported",
"by",
"Google",
"play",
"won",
"t",
"be",
"downloaded",
"Idem",
"for",
"not",
"translated",
"locale"
] | train | https://github.com/mozilla-releng/mozapkpublisher/blob/df61034220153cbb98da74c8ef6de637f9185e12/mozapkpublisher/common/store_l10n.py#L107-L112 |
croscon/fleaker | fleaker/marshmallow/fields/mixin.py | FleakerFieldMixin.get_field_value | def get_field_value(self, key, default=MISSING):
"""Method to fetch a value from either the fields metadata or the
schemas context, in that order.
Args:
key (str): The name of the key to grab the value for.
Keyword Args:
default (object, optional): If the value ... | python | def get_field_value(self, key, default=MISSING):
"""Method to fetch a value from either the fields metadata or the
schemas context, in that order.
Args:
key (str): The name of the key to grab the value for.
Keyword Args:
default (object, optional): If the value ... | [
"def",
"get_field_value",
"(",
"self",
",",
"key",
",",
"default",
"=",
"MISSING",
")",
":",
"meta_value",
"=",
"self",
".",
"metadata",
".",
"get",
"(",
"key",
")",
"context_value",
"=",
"self",
".",
"context",
".",
"get",
"(",
"key",
")",
"if",
"co... | Method to fetch a value from either the fields metadata or the
schemas context, in that order.
Args:
key (str): The name of the key to grab the value for.
Keyword Args:
default (object, optional): If the value doesn't exist in the
schema's ``context`` or... | [
"Method",
"to",
"fetch",
"a",
"value",
"from",
"either",
"the",
"fields",
"metadata",
"or",
"the",
"schemas",
"context",
"in",
"that",
"order",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/fields/mixin.py#L10-L33 |
croscon/fleaker | fleaker/peewee/model.py | Model.get_by_id | def get_by_id(cls, record_id, execute=True):
"""Return a single instance of the model queried by ID.
Args:
record_id (int): Integer representation of the ID to query on.
Keyword Args:
execute (bool, optional):
Should this method execute the query or retu... | python | def get_by_id(cls, record_id, execute=True):
"""Return a single instance of the model queried by ID.
Args:
record_id (int): Integer representation of the ID to query on.
Keyword Args:
execute (bool, optional):
Should this method execute the query or retu... | [
"def",
"get_by_id",
"(",
"cls",
",",
"record_id",
",",
"execute",
"=",
"True",
")",
":",
"query",
"=",
"cls",
".",
"base_query",
"(",
")",
".",
"where",
"(",
"cls",
".",
"id",
"==",
"record_id",
")",
"if",
"execute",
":",
"return",
"query",
".",
"g... | Return a single instance of the model queried by ID.
Args:
record_id (int): Integer representation of the ID to query on.
Keyword Args:
execute (bool, optional):
Should this method execute the query or return a query object
for further manipulati... | [
"Return",
"a",
"single",
"instance",
"of",
"the",
"model",
"queried",
"by",
"ID",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/model.py#L133-L158 |
croscon/fleaker | fleaker/peewee/model.py | Model.update_instance | def update_instance(self, data):
"""Update a single record by id with the provided data.
Args:
data (dict): The new data to update the record with.
Returns:
self: This is an instance of itself with the updated data.
Raises:
AttributeError: This is r... | python | def update_instance(self, data):
"""Update a single record by id with the provided data.
Args:
data (dict): The new data to update the record with.
Returns:
self: This is an instance of itself with the updated data.
Raises:
AttributeError: This is r... | [
"def",
"update_instance",
"(",
"self",
",",
"data",
")",
":",
"for",
"key",
",",
"val",
"in",
"iteritems",
"(",
"data",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"key",
")",
":",
"raise",
"AttributeError",
"(",
"\"No field named {key} for model {... | Update a single record by id with the provided data.
Args:
data (dict): The new data to update the record with.
Returns:
self: This is an instance of itself with the updated data.
Raises:
AttributeError: This is raised if a key in the ``data`` isn't
... | [
"Update",
"a",
"single",
"record",
"by",
"id",
"with",
"the",
"provided",
"data",
"."
] | train | https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/peewee/model.py#L160-L186 |
mardix/flask-recaptcha | flask_recaptcha.py | ReCaptcha.get_code | def get_code(self):
"""
Returns the new ReCaptcha code
:return:
"""
return "" if not self.is_enabled else ("""
<script src='//www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="{SITE_KEY}" data-theme="{THEME}" data-type="{TYPE}" data... | python | def get_code(self):
"""
Returns the new ReCaptcha code
:return:
"""
return "" if not self.is_enabled else ("""
<script src='//www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="{SITE_KEY}" data-theme="{THEME}" data-type="{TYPE}" data... | [
"def",
"get_code",
"(",
"self",
")",
":",
"return",
"\"\"",
"if",
"not",
"self",
".",
"is_enabled",
"else",
"(",
"\"\"\"\n <script src='//www.google.com/recaptcha/api.js'></script>\n <div class=\"g-recaptcha\" data-sitekey=\"{SITE_KEY}\" data-theme=\"{THEME}\" data-type=\... | Returns the new ReCaptcha code
:return: | [
"Returns",
"the",
"new",
"ReCaptcha",
"code",
":",
"return",
":"
] | train | https://github.com/mardix/flask-recaptcha/blob/bf1dbb326fa1df0c3d290e74faef712011d15623/flask_recaptcha.py#L61-L70 |
pytest-dev/pytest-xprocess | xprocess.py | XProcess.ensure | def ensure(self, name, preparefunc, restart=False):
""" returns (PID, logfile) from a newly started or already
running process.
@param name: name of the external process, used for caching info
across test runs.
@param preparefunc:
A subclass of ... | python | def ensure(self, name, preparefunc, restart=False):
""" returns (PID, logfile) from a newly started or already
running process.
@param name: name of the external process, used for caching info
across test runs.
@param preparefunc:
A subclass of ... | [
"def",
"ensure",
"(",
"self",
",",
"name",
",",
"preparefunc",
",",
"restart",
"=",
"False",
")",
":",
"from",
"subprocess",
"import",
"Popen",
",",
"STDOUT",
"info",
"=",
"self",
".",
"getinfo",
"(",
"name",
")",
"if",
"not",
"restart",
"and",
"not",
... | returns (PID, logfile) from a newly started or already
running process.
@param name: name of the external process, used for caching info
across test runs.
@param preparefunc:
A subclass of ProcessStarter.
@param restart: force restarting the pr... | [
"returns",
"(",
"PID",
"logfile",
")",
"from",
"a",
"newly",
"started",
"or",
"already",
"running",
"process",
"."
] | train | https://github.com/pytest-dev/pytest-xprocess/blob/c3ee760b02dce2d0eed960b3ab0e28379853c3ef/xprocess.py#L78-L135 |
pytest-dev/pytest-xprocess | xprocess.py | ProcessStarter.wait | def wait(self, log_file):
"Wait until the process is ready."
lines = map(self.log_line, self.filter_lines(self.get_lines(log_file)))
return any(
std.re.search(self.pattern, line)
for line in lines
) | python | def wait(self, log_file):
"Wait until the process is ready."
lines = map(self.log_line, self.filter_lines(self.get_lines(log_file)))
return any(
std.re.search(self.pattern, line)
for line in lines
) | [
"def",
"wait",
"(",
"self",
",",
"log_file",
")",
":",
"lines",
"=",
"map",
"(",
"self",
".",
"log_line",
",",
"self",
".",
"filter_lines",
"(",
"self",
".",
"get_lines",
"(",
"log_file",
")",
")",
")",
"return",
"any",
"(",
"std",
".",
"re",
".",
... | Wait until the process is ready. | [
"Wait",
"until",
"the",
"process",
"is",
"ready",
"."
] | train | https://github.com/pytest-dev/pytest-xprocess/blob/c3ee760b02dce2d0eed960b3ab0e28379853c3ef/xprocess.py#L188-L194 |
pytest-dev/pytest-xprocess | xprocess.py | CompatStarter.prep | def prep(self, wait, args, env=None):
"""
Given the return value of a preparefunc, prepare this
CompatStarter.
"""
self.pattern = wait
self.env = env
self.args = args
# wait is a function, supersedes the default behavior
if callable(wait):
... | python | def prep(self, wait, args, env=None):
"""
Given the return value of a preparefunc, prepare this
CompatStarter.
"""
self.pattern = wait
self.env = env
self.args = args
# wait is a function, supersedes the default behavior
if callable(wait):
... | [
"def",
"prep",
"(",
"self",
",",
"wait",
",",
"args",
",",
"env",
"=",
"None",
")",
":",
"self",
".",
"pattern",
"=",
"wait",
"self",
".",
"env",
"=",
"env",
"self",
".",
"args",
"=",
"args",
"# wait is a function, supersedes the default behavior",
"if",
... | Given the return value of a preparefunc, prepare this
CompatStarter. | [
"Given",
"the",
"return",
"value",
"of",
"a",
"preparefunc",
"prepare",
"this",
"CompatStarter",
"."
] | train | https://github.com/pytest-dev/pytest-xprocess/blob/c3ee760b02dce2d0eed960b3ab0e28379853c3ef/xprocess.py#L227-L238 |
pytest-dev/pytest-xprocess | xprocess.py | CompatStarter.wrap | def wrap(self, starter_cls):
"""
If starter_cls is not a ProcessStarter, assume it's the legacy
preparefunc and return it bound to a CompatStarter.
"""
if isinstance(starter_cls, type) and issubclass(starter_cls, ProcessStarter):
return starter_cls
depr_msg = ... | python | def wrap(self, starter_cls):
"""
If starter_cls is not a ProcessStarter, assume it's the legacy
preparefunc and return it bound to a CompatStarter.
"""
if isinstance(starter_cls, type) and issubclass(starter_cls, ProcessStarter):
return starter_cls
depr_msg = ... | [
"def",
"wrap",
"(",
"self",
",",
"starter_cls",
")",
":",
"if",
"isinstance",
"(",
"starter_cls",
",",
"type",
")",
"and",
"issubclass",
"(",
"starter_cls",
",",
"ProcessStarter",
")",
":",
"return",
"starter_cls",
"depr_msg",
"=",
"'Pass a ProcessStarter for pr... | If starter_cls is not a ProcessStarter, assume it's the legacy
preparefunc and return it bound to a CompatStarter. | [
"If",
"starter_cls",
"is",
"not",
"a",
"ProcessStarter",
"assume",
"it",
"s",
"the",
"legacy",
"preparefunc",
"and",
"return",
"it",
"bound",
"to",
"a",
"CompatStarter",
"."
] | train | https://github.com/pytest-dev/pytest-xprocess/blob/c3ee760b02dce2d0eed960b3ab0e28379853c3ef/xprocess.py#L241-L250 |
Salamek/huawei-lte-api | huawei_lte_api/api/Monitoring.py | Monitoring.set_start_date | def set_start_date(self, start_day: int, data_limit: str, month_threshold: int):
"""
Sets network usage alarm for LTE
:param start_day: number of day when monitoring starts
:param data_limit: Maximal data limit as string eg.: 1000MB or 1GB and so on
:param month_threshold: Alarm ... | python | def set_start_date(self, start_day: int, data_limit: str, month_threshold: int):
"""
Sets network usage alarm for LTE
:param start_day: number of day when monitoring starts
:param data_limit: Maximal data limit as string eg.: 1000MB or 1GB and so on
:param month_threshold: Alarm ... | [
"def",
"set_start_date",
"(",
"self",
",",
"start_day",
":",
"int",
",",
"data_limit",
":",
"str",
",",
"month_threshold",
":",
"int",
")",
":",
"return",
"self",
".",
"_connection",
".",
"post",
"(",
"'monitoring/start_date'",
",",
"OrderedDict",
"(",
"(",
... | Sets network usage alarm for LTE
:param start_day: number of day when monitoring starts
:param data_limit: Maximal data limit as string eg.: 1000MB or 1GB and so on
:param month_threshold: Alarm threshold in % as int number eg.: 90
:return: dict | [
"Sets",
"network",
"usage",
"alarm",
"for",
"LTE",
":",
"param",
"start_day",
":",
"number",
"of",
"day",
"when",
"monitoring",
"starts",
":",
"param",
"data_limit",
":",
"Maximal",
"data",
"limit",
"as",
"string",
"eg",
".",
":",
"1000MB",
"or",
"1GB",
... | train | https://github.com/Salamek/huawei-lte-api/blob/005655b9c5ba5853263ae7192db255ce069dff08/huawei_lte_api/api/Monitoring.py#L21-L34 |
kmadac/bitstamp-python-client | bitstamp/client.py | BaseClient._get | def _get(self, *args, **kwargs):
"""
Make a GET request.
"""
return self._request(requests.get, *args, **kwargs) | python | def _get(self, *args, **kwargs):
"""
Make a GET request.
"""
return self._request(requests.get, *args, **kwargs) | [
"def",
"_get",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_request",
"(",
"requests",
".",
"get",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Make a GET request. | [
"Make",
"a",
"GET",
"request",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L35-L39 |
kmadac/bitstamp-python-client | bitstamp/client.py | BaseClient._post | def _post(self, *args, **kwargs):
"""
Make a POST request.
"""
data = self._default_data()
data.update(kwargs.get('data') or {})
kwargs['data'] = data
return self._request(requests.post, *args, **kwargs) | python | def _post(self, *args, **kwargs):
"""
Make a POST request.
"""
data = self._default_data()
data.update(kwargs.get('data') or {})
kwargs['data'] = data
return self._request(requests.post, *args, **kwargs) | [
"def",
"_post",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_default_data",
"(",
")",
"data",
".",
"update",
"(",
"kwargs",
".",
"get",
"(",
"'data'",
")",
"or",
"{",
"}",
")",
"kwargs",
"[",
"'d... | Make a POST request. | [
"Make",
"a",
"POST",
"request",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L41-L48 |
kmadac/bitstamp-python-client | bitstamp/client.py | BaseClient._construct_url | def _construct_url(self, url, base, quote):
"""
Adds the orderbook to the url if base and quote are specified.
"""
if not base and not quote:
return url
else:
url = url + base.lower() + quote.lower() + "/"
return url | python | def _construct_url(self, url, base, quote):
"""
Adds the orderbook to the url if base and quote are specified.
"""
if not base and not quote:
return url
else:
url = url + base.lower() + quote.lower() + "/"
return url | [
"def",
"_construct_url",
"(",
"self",
",",
"url",
",",
"base",
",",
"quote",
")",
":",
"if",
"not",
"base",
"and",
"not",
"quote",
":",
"return",
"url",
"else",
":",
"url",
"=",
"url",
"+",
"base",
".",
"lower",
"(",
")",
"+",
"quote",
".",
"lowe... | Adds the orderbook to the url if base and quote are specified. | [
"Adds",
"the",
"orderbook",
"to",
"the",
"url",
"if",
"base",
"and",
"quote",
"are",
"specified",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L56-L64 |
kmadac/bitstamp-python-client | bitstamp/client.py | BaseClient._request | def _request(self, func, url, version=1, *args, **kwargs):
"""
Make a generic request, adding in any proxy defined by the instance.
Raises a ``requests.HTTPError`` if the response status isn't 200, and
raises a :class:`BitstampError` if the response contains a json encoded
error... | python | def _request(self, func, url, version=1, *args, **kwargs):
"""
Make a generic request, adding in any proxy defined by the instance.
Raises a ``requests.HTTPError`` if the response status isn't 200, and
raises a :class:`BitstampError` if the response contains a json encoded
error... | [
"def",
"_request",
"(",
"self",
",",
"func",
",",
"url",
",",
"version",
"=",
"1",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return_json",
"=",
"kwargs",
".",
"pop",
"(",
"'return_json'",
",",
"False",
")",
"url",
"=",
"self",
".",
"a... | Make a generic request, adding in any proxy defined by the instance.
Raises a ``requests.HTTPError`` if the response status isn't 200, and
raises a :class:`BitstampError` if the response contains a json encoded
error message. | [
"Make",
"a",
"generic",
"request",
"adding",
"in",
"any",
"proxy",
"defined",
"by",
"the",
"instance",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L66-L101 |
kmadac/bitstamp-python-client | bitstamp/client.py | Public.ticker | def ticker(self, base="btc", quote="usd"):
"""
Returns dictionary.
"""
url = self._construct_url("ticker/", base, quote)
return self._get(url, return_json=True, version=2) | python | def ticker(self, base="btc", quote="usd"):
"""
Returns dictionary.
"""
url = self._construct_url("ticker/", base, quote)
return self._get(url, return_json=True, version=2) | [
"def",
"ticker",
"(",
"self",
",",
"base",
"=",
"\"btc\"",
",",
"quote",
"=",
"\"usd\"",
")",
":",
"url",
"=",
"self",
".",
"_construct_url",
"(",
"\"ticker/\"",
",",
"base",
",",
"quote",
")",
"return",
"self",
".",
"_get",
"(",
"url",
",",
"return_... | Returns dictionary. | [
"Returns",
"dictionary",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L106-L111 |
kmadac/bitstamp-python-client | bitstamp/client.py | Public.order_book | def order_book(self, group=True, base="btc", quote="usd"):
"""
Returns dictionary with "bids" and "asks".
Each is a list of open orders and each order is represented as a list
of price and amount.
"""
params = {'group': group}
url = self._construct_url("order_boo... | python | def order_book(self, group=True, base="btc", quote="usd"):
"""
Returns dictionary with "bids" and "asks".
Each is a list of open orders and each order is represented as a list
of price and amount.
"""
params = {'group': group}
url = self._construct_url("order_boo... | [
"def",
"order_book",
"(",
"self",
",",
"group",
"=",
"True",
",",
"base",
"=",
"\"btc\"",
",",
"quote",
"=",
"\"usd\"",
")",
":",
"params",
"=",
"{",
"'group'",
":",
"group",
"}",
"url",
"=",
"self",
".",
"_construct_url",
"(",
"\"order_book/\"",
",",
... | Returns dictionary with "bids" and "asks".
Each is a list of open orders and each order is represented as a list
of price and amount. | [
"Returns",
"dictionary",
"with",
"bids",
"and",
"asks",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L120-L129 |
kmadac/bitstamp-python-client | bitstamp/client.py | Public.transactions | def transactions(self, time=TransRange.HOUR, base="btc", quote="usd"):
"""
Returns transactions for the last 'timedelta' seconds.
Parameter time is specified by one of two values of TransRange class.
"""
params = {'time': time}
url = self._construct_url("transactions/", b... | python | def transactions(self, time=TransRange.HOUR, base="btc", quote="usd"):
"""
Returns transactions for the last 'timedelta' seconds.
Parameter time is specified by one of two values of TransRange class.
"""
params = {'time': time}
url = self._construct_url("transactions/", b... | [
"def",
"transactions",
"(",
"self",
",",
"time",
"=",
"TransRange",
".",
"HOUR",
",",
"base",
"=",
"\"btc\"",
",",
"quote",
"=",
"\"usd\"",
")",
":",
"params",
"=",
"{",
"'time'",
":",
"time",
"}",
"url",
"=",
"self",
".",
"_construct_url",
"(",
"\"t... | Returns transactions for the last 'timedelta' seconds.
Parameter time is specified by one of two values of TransRange class. | [
"Returns",
"transactions",
"for",
"the",
"last",
"timedelta",
"seconds",
".",
"Parameter",
"time",
"is",
"specified",
"by",
"one",
"of",
"two",
"values",
"of",
"TransRange",
"class",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L131-L138 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.get_nonce | def get_nonce(self):
"""
Get a unique nonce for the bitstamp API.
This integer must always be increasing, so use the current unix time.
Every time this variable is requested, it automatically increments to
allow for more than one API request per second.
This isn't a thr... | python | def get_nonce(self):
"""
Get a unique nonce for the bitstamp API.
This integer must always be increasing, so use the current unix time.
Every time this variable is requested, it automatically increments to
allow for more than one API request per second.
This isn't a thr... | [
"def",
"get_nonce",
"(",
"self",
")",
":",
"nonce",
"=",
"getattr",
"(",
"self",
",",
"'_nonce'",
",",
"0",
")",
"if",
"nonce",
":",
"nonce",
"+=",
"1",
"# If the unix time is greater though, use that instead (helps low",
"# concurrency multi-threaded apps always call w... | Get a unique nonce for the bitstamp API.
This integer must always be increasing, so use the current unix time.
Every time this variable is requested, it automatically increments to
allow for more than one API request per second.
This isn't a thread-safe function however, so you should ... | [
"Get",
"a",
"unique",
"nonce",
"for",
"the",
"bitstamp",
"API",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L177-L195 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading._default_data | def _default_data(self, *args, **kwargs):
"""
Generate a one-time signature and other data required to send a secure
POST request to the Bitstamp API.
"""
data = super(Trading, self)._default_data(*args, **kwargs)
data['key'] = self.key
nonce = self.get_nonce()
... | python | def _default_data(self, *args, **kwargs):
"""
Generate a one-time signature and other data required to send a secure
POST request to the Bitstamp API.
"""
data = super(Trading, self)._default_data(*args, **kwargs)
data['key'] = self.key
nonce = self.get_nonce()
... | [
"def",
"_default_data",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"super",
"(",
"Trading",
",",
"self",
")",
".",
"_default_data",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"data",
"[",
"'key'",
"]",
"="... | Generate a one-time signature and other data required to send a secure
POST request to the Bitstamp API. | [
"Generate",
"a",
"one",
"-",
"time",
"signature",
"and",
"other",
"data",
"required",
"to",
"send",
"a",
"secure",
"POST",
"request",
"to",
"the",
"Bitstamp",
"API",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L197-L212 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.account_balance | def account_balance(self, base="btc", quote="usd"):
"""
Returns dictionary::
{u'btc_reserved': u'0',
u'fee': u'0.5000',
u'btc_available': u'2.30856098',
u'usd_reserved': u'0',
u'btc_balance': u'2.30856098',
u'usd_balance': u'1... | python | def account_balance(self, base="btc", quote="usd"):
"""
Returns dictionary::
{u'btc_reserved': u'0',
u'fee': u'0.5000',
u'btc_available': u'2.30856098',
u'usd_reserved': u'0',
u'btc_balance': u'2.30856098',
u'usd_balance': u'1... | [
"def",
"account_balance",
"(",
"self",
",",
"base",
"=",
"\"btc\"",
",",
"quote",
"=",
"\"usd\"",
")",
":",
"url",
"=",
"self",
".",
"_construct_url",
"(",
"\"balance/\"",
",",
"base",
",",
"quote",
")",
"return",
"self",
".",
"_post",
"(",
"url",
",",... | Returns dictionary::
{u'btc_reserved': u'0',
u'fee': u'0.5000',
u'btc_available': u'2.30856098',
u'usd_reserved': u'0',
u'btc_balance': u'2.30856098',
u'usd_balance': u'114.64',
u'usd_available': u'114.64',
---If bas... | [
"Returns",
"dictionary",
"::"
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L223-L246 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.user_transactions | def user_transactions(self, offset=0, limit=100, descending=True,
base=None, quote=None):
"""
Returns descending list of transactions. Every transaction (dictionary)
contains::
{u'usd': u'-39.25',
u'datetime': u'2013-03-26 18:49:13',
... | python | def user_transactions(self, offset=0, limit=100, descending=True,
base=None, quote=None):
"""
Returns descending list of transactions. Every transaction (dictionary)
contains::
{u'usd': u'-39.25',
u'datetime': u'2013-03-26 18:49:13',
... | [
"def",
"user_transactions",
"(",
"self",
",",
"offset",
"=",
"0",
",",
"limit",
"=",
"100",
",",
"descending",
"=",
"True",
",",
"base",
"=",
"None",
",",
"quote",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'offset'",
":",
"offset",
",",
"'limit'",
... | Returns descending list of transactions. Every transaction (dictionary)
contains::
{u'usd': u'-39.25',
u'datetime': u'2013-03-26 18:49:13',
u'fee': u'0.20',
u'btc': u'0.50000000',
u'type': 2,
u'id': 213642}
Instead of the key... | [
"Returns",
"descending",
"list",
"of",
"transactions",
".",
"Every",
"transaction",
"(",
"dictionary",
")",
"contains",
"::"
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L248-L269 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.order_status | def order_status(self, order_id):
"""
Returns dictionary.
- status: 'Finished'
or 'In Queue'
or 'Open'
- transactions: list of transactions
Each transaction is a dictionary with the following keys:
btc, usd, price, type, fee, datetime... | python | def order_status(self, order_id):
"""
Returns dictionary.
- status: 'Finished'
or 'In Queue'
or 'Open'
- transactions: list of transactions
Each transaction is a dictionary with the following keys:
btc, usd, price, type, fee, datetime... | [
"def",
"order_status",
"(",
"self",
",",
"order_id",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"order_id",
"}",
"return",
"self",
".",
"_post",
"(",
"\"order_status/\"",
",",
"data",
"=",
"data",
",",
"return_json",
"=",
"True",
",",
"version",
"=",
"1"... | Returns dictionary.
- status: 'Finished'
or 'In Queue'
or 'Open'
- transactions: list of transactions
Each transaction is a dictionary with the following keys:
btc, usd, price, type, fee, datetime, tid
or btc, eur, ....
or eur, ... | [
"Returns",
"dictionary",
".",
"-",
"status",
":",
"Finished",
"or",
"In",
"Queue",
"or",
"Open",
"-",
"transactions",
":",
"list",
"of",
"transactions",
"Each",
"transaction",
"is",
"a",
"dictionary",
"with",
"the",
"following",
"keys",
":",
"btc",
"usd",
... | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L279-L293 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.cancel_order | def cancel_order(self, order_id, version=1):
"""
Cancel the order specified by order_id.
Version 1 (default for backwards compatibility reasons):
Returns True if order was successfully canceled, otherwise
raise a BitstampError.
Version 2:
Returns dictionary of t... | python | def cancel_order(self, order_id, version=1):
"""
Cancel the order specified by order_id.
Version 1 (default for backwards compatibility reasons):
Returns True if order was successfully canceled, otherwise
raise a BitstampError.
Version 2:
Returns dictionary of t... | [
"def",
"cancel_order",
"(",
"self",
",",
"order_id",
",",
"version",
"=",
"1",
")",
":",
"data",
"=",
"{",
"'id'",
":",
"order_id",
"}",
"return",
"self",
".",
"_post",
"(",
"\"cancel_order/\"",
",",
"data",
"=",
"data",
",",
"return_json",
"=",
"True"... | Cancel the order specified by order_id.
Version 1 (default for backwards compatibility reasons):
Returns True if order was successfully canceled, otherwise
raise a BitstampError.
Version 2:
Returns dictionary of the canceled order, containing the keys:
id, type, price, ... | [
"Cancel",
"the",
"order",
"specified",
"by",
"order_id",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L295-L309 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.buy_limit_order | def buy_limit_order(self, amount, price, base="btc", quote="usd", limit_price=None):
"""
Order to buy amount of bitcoins for specified price.
"""
data = {'amount': amount, 'price': price}
if limit_price is not None:
data['limit_price'] = limit_price
url = self... | python | def buy_limit_order(self, amount, price, base="btc", quote="usd", limit_price=None):
"""
Order to buy amount of bitcoins for specified price.
"""
data = {'amount': amount, 'price': price}
if limit_price is not None:
data['limit_price'] = limit_price
url = self... | [
"def",
"buy_limit_order",
"(",
"self",
",",
"amount",
",",
"price",
",",
"base",
"=",
"\"btc\"",
",",
"quote",
"=",
"\"usd\"",
",",
"limit_price",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'amount'",
":",
"amount",
",",
"'price'",
":",
"price",
"}",
... | Order to buy amount of bitcoins for specified price. | [
"Order",
"to",
"buy",
"amount",
"of",
"bitcoins",
"for",
"specified",
"price",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L320-L328 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.buy_market_order | def buy_market_order(self, amount, base="btc", quote="usd"):
"""
Order to buy amount of bitcoins for market price.
"""
data = {'amount': amount}
url = self._construct_url("buy/market/", base, quote)
return self._post(url, data=data, return_json=True, version=2) | python | def buy_market_order(self, amount, base="btc", quote="usd"):
"""
Order to buy amount of bitcoins for market price.
"""
data = {'amount': amount}
url = self._construct_url("buy/market/", base, quote)
return self._post(url, data=data, return_json=True, version=2) | [
"def",
"buy_market_order",
"(",
"self",
",",
"amount",
",",
"base",
"=",
"\"btc\"",
",",
"quote",
"=",
"\"usd\"",
")",
":",
"data",
"=",
"{",
"'amount'",
":",
"amount",
"}",
"url",
"=",
"self",
".",
"_construct_url",
"(",
"\"buy/market/\"",
",",
"base",
... | Order to buy amount of bitcoins for market price. | [
"Order",
"to",
"buy",
"amount",
"of",
"bitcoins",
"for",
"market",
"price",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L330-L336 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.check_bitstamp_code | def check_bitstamp_code(self, code):
"""
Returns JSON dictionary containing USD and BTC amount included in given
bitstamp code.
"""
data = {'code': code}
return self._post("check_code/", data=data, return_json=True,
version=1) | python | def check_bitstamp_code(self, code):
"""
Returns JSON dictionary containing USD and BTC amount included in given
bitstamp code.
"""
data = {'code': code}
return self._post("check_code/", data=data, return_json=True,
version=1) | [
"def",
"check_bitstamp_code",
"(",
"self",
",",
"code",
")",
":",
"data",
"=",
"{",
"'code'",
":",
"code",
"}",
"return",
"self",
".",
"_post",
"(",
"\"check_code/\"",
",",
"data",
"=",
"data",
",",
"return_json",
"=",
"True",
",",
"version",
"=",
"1",... | Returns JSON dictionary containing USD and BTC amount included in given
bitstamp code. | [
"Returns",
"JSON",
"dictionary",
"containing",
"USD",
"and",
"BTC",
"amount",
"included",
"in",
"given",
"bitstamp",
"code",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L356-L363 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.redeem_bitstamp_code | def redeem_bitstamp_code(self, code):
"""
Returns JSON dictionary containing USD and BTC amount added to user's
account.
"""
data = {'code': code}
return self._post("redeem_code/", data=data, return_json=True,
version=1) | python | def redeem_bitstamp_code(self, code):
"""
Returns JSON dictionary containing USD and BTC amount added to user's
account.
"""
data = {'code': code}
return self._post("redeem_code/", data=data, return_json=True,
version=1) | [
"def",
"redeem_bitstamp_code",
"(",
"self",
",",
"code",
")",
":",
"data",
"=",
"{",
"'code'",
":",
"code",
"}",
"return",
"self",
".",
"_post",
"(",
"\"redeem_code/\"",
",",
"data",
"=",
"data",
",",
"return_json",
"=",
"True",
",",
"version",
"=",
"1... | Returns JSON dictionary containing USD and BTC amount added to user's
account. | [
"Returns",
"JSON",
"dictionary",
"containing",
"USD",
"and",
"BTC",
"amount",
"added",
"to",
"user",
"s",
"account",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L365-L372 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.withdrawal_requests | def withdrawal_requests(self, timedelta = 86400):
"""
Returns list of withdrawal requests.
Each request is represented as a dictionary.
By default, the last 24 hours (86400 seconds) are returned.
"""
data = {'timedelta': timedelta}
return self._post("withdrawal_... | python | def withdrawal_requests(self, timedelta = 86400):
"""
Returns list of withdrawal requests.
Each request is represented as a dictionary.
By default, the last 24 hours (86400 seconds) are returned.
"""
data = {'timedelta': timedelta}
return self._post("withdrawal_... | [
"def",
"withdrawal_requests",
"(",
"self",
",",
"timedelta",
"=",
"86400",
")",
":",
"data",
"=",
"{",
"'timedelta'",
":",
"timedelta",
"}",
"return",
"self",
".",
"_post",
"(",
"\"withdrawal_requests/\"",
",",
"return_json",
"=",
"True",
",",
"version",
"="... | Returns list of withdrawal requests.
Each request is represented as a dictionary.
By default, the last 24 hours (86400 seconds) are returned. | [
"Returns",
"list",
"of",
"withdrawal",
"requests",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L374-L383 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.litecoin_withdrawal | def litecoin_withdrawal(self, amount, address):
"""
Send litecoins to another litecoin wallet specified by address.
"""
data = {'amount': amount, 'address': address}
return self._post("ltc_withdrawal/", data=data, return_json=True,
version=2) | python | def litecoin_withdrawal(self, amount, address):
"""
Send litecoins to another litecoin wallet specified by address.
"""
data = {'amount': amount, 'address': address}
return self._post("ltc_withdrawal/", data=data, return_json=True,
version=2) | [
"def",
"litecoin_withdrawal",
"(",
"self",
",",
"amount",
",",
"address",
")",
":",
"data",
"=",
"{",
"'amount'",
":",
"amount",
",",
"'address'",
":",
"address",
"}",
"return",
"self",
".",
"_post",
"(",
"\"ltc_withdrawal/\"",
",",
"data",
"=",
"data",
... | Send litecoins to another litecoin wallet specified by address. | [
"Send",
"litecoins",
"to",
"another",
"litecoin",
"wallet",
"specified",
"by",
"address",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L415-L421 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.ripple_withdrawal | def ripple_withdrawal(self, amount, address, currency):
"""
Returns true if successful.
"""
data = {'amount': amount, 'address': address, 'currency': currency}
response = self._post("ripple_withdrawal/", data=data,
return_json=True)
return se... | python | def ripple_withdrawal(self, amount, address, currency):
"""
Returns true if successful.
"""
data = {'amount': amount, 'address': address, 'currency': currency}
response = self._post("ripple_withdrawal/", data=data,
return_json=True)
return se... | [
"def",
"ripple_withdrawal",
"(",
"self",
",",
"amount",
",",
"address",
",",
"currency",
")",
":",
"data",
"=",
"{",
"'amount'",
":",
"amount",
",",
"'address'",
":",
"address",
",",
"'currency'",
":",
"currency",
"}",
"response",
"=",
"self",
".",
"_pos... | Returns true if successful. | [
"Returns",
"true",
"if",
"successful",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L445-L452 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.xrp_withdrawal | def xrp_withdrawal(self, amount, address, destination_tag=None):
"""
Sends xrps to another xrp wallet specified by address. Returns withdrawal id.
"""
data = {'amount': amount, 'address': address}
if destination_tag:
data['destination_tag'] = destination_tag
... | python | def xrp_withdrawal(self, amount, address, destination_tag=None):
"""
Sends xrps to another xrp wallet specified by address. Returns withdrawal id.
"""
data = {'amount': amount, 'address': address}
if destination_tag:
data['destination_tag'] = destination_tag
... | [
"def",
"xrp_withdrawal",
"(",
"self",
",",
"amount",
",",
"address",
",",
"destination_tag",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'amount'",
":",
"amount",
",",
"'address'",
":",
"address",
"}",
"if",
"destination_tag",
":",
"data",
"[",
"'destination... | Sends xrps to another xrp wallet specified by address. Returns withdrawal id. | [
"Sends",
"xrps",
"to",
"another",
"xrp",
"wallet",
"specified",
"by",
"address",
".",
"Returns",
"withdrawal",
"id",
"."
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L461-L470 |
kmadac/bitstamp-python-client | bitstamp/client.py | Trading.transfer_to_main | def transfer_to_main(self, amount, currency, subaccount=None):
"""
Returns dictionary with status.
subaccount has to be the numerical id of the subaccount, not the name
"""
data = {'amount': amount,
'currency': currency,}
if subaccount is not None:
... | python | def transfer_to_main(self, amount, currency, subaccount=None):
"""
Returns dictionary with status.
subaccount has to be the numerical id of the subaccount, not the name
"""
data = {'amount': amount,
'currency': currency,}
if subaccount is not None:
... | [
"def",
"transfer_to_main",
"(",
"self",
",",
"amount",
",",
"currency",
",",
"subaccount",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'amount'",
":",
"amount",
",",
"'currency'",
":",
"currency",
",",
"}",
"if",
"subaccount",
"is",
"not",
"None",
":",
"... | Returns dictionary with status.
subaccount has to be the numerical id of the subaccount, not the name | [
"Returns",
"dictionary",
"with",
"status",
".",
"subaccount",
"has",
"to",
"be",
"the",
"numerical",
"id",
"of",
"the",
"subaccount",
"not",
"the",
"name"
] | train | https://github.com/kmadac/bitstamp-python-client/blob/35b9a61f3892cc281de89963d210f7bd5757c717/bitstamp/client.py#L495-L505 |
pierre-rouanet/aupyom | aupyom/sound.py | Sound.resample | def resample(self, target_sr):
""" Returns a new sound with a samplerate of target_sr. """
y_hat = librosa.core.resample(self.y, self.sr, target_sr)
return Sound(y_hat, target_sr) | python | def resample(self, target_sr):
""" Returns a new sound with a samplerate of target_sr. """
y_hat = librosa.core.resample(self.y, self.sr, target_sr)
return Sound(y_hat, target_sr) | [
"def",
"resample",
"(",
"self",
",",
"target_sr",
")",
":",
"y_hat",
"=",
"librosa",
".",
"core",
".",
"resample",
"(",
"self",
".",
"y",
",",
"self",
".",
"sr",
",",
"target_sr",
")",
"return",
"Sound",
"(",
"y_hat",
",",
"target_sr",
")"
] | Returns a new sound with a samplerate of target_sr. | [
"Returns",
"a",
"new",
"sound",
"with",
"a",
"samplerate",
"of",
"target_sr",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sound.py#L36-L39 |
pierre-rouanet/aupyom | aupyom/sound.py | Sound.as_ipywidget | def as_ipywidget(self):
""" Provides an IPywidgets player that can be used in a notebook. """
from IPython.display import Audio
return Audio(data=self.y, rate=self.sr) | python | def as_ipywidget(self):
""" Provides an IPywidgets player that can be used in a notebook. """
from IPython.display import Audio
return Audio(data=self.y, rate=self.sr) | [
"def",
"as_ipywidget",
"(",
"self",
")",
":",
"from",
"IPython",
".",
"display",
"import",
"Audio",
"return",
"Audio",
"(",
"data",
"=",
"self",
".",
"y",
",",
"rate",
"=",
"self",
".",
"sr",
")"
] | Provides an IPywidgets player that can be used in a notebook. | [
"Provides",
"an",
"IPywidgets",
"player",
"that",
"can",
"be",
"used",
"in",
"a",
"notebook",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sound.py#L43-L47 |
pierre-rouanet/aupyom | aupyom/sound.py | Sound.from_file | def from_file(cls, filename, sr=22050):
""" Loads an audiofile, uses sr=22050 by default. """
y, sr = librosa.load(filename, sr=sr)
return cls(y, sr) | python | def from_file(cls, filename, sr=22050):
""" Loads an audiofile, uses sr=22050 by default. """
y, sr = librosa.load(filename, sr=sr)
return cls(y, sr) | [
"def",
"from_file",
"(",
"cls",
",",
"filename",
",",
"sr",
"=",
"22050",
")",
":",
"y",
",",
"sr",
"=",
"librosa",
".",
"load",
"(",
"filename",
",",
"sr",
"=",
"sr",
")",
"return",
"cls",
"(",
"y",
",",
"sr",
")"
] | Loads an audiofile, uses sr=22050 by default. | [
"Loads",
"an",
"audiofile",
"uses",
"sr",
"=",
"22050",
"by",
"default",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sound.py#L50-L53 |
pierre-rouanet/aupyom | aupyom/sound.py | Sound.chunks | def chunks(self):
""" Returns a chunk iterator over the sound. """
if not hasattr(self, '_it'):
class ChunkIterator(object):
def __iter__(iter):
return iter
def __next__(iter):
try:
chunk = self.... | python | def chunks(self):
""" Returns a chunk iterator over the sound. """
if not hasattr(self, '_it'):
class ChunkIterator(object):
def __iter__(iter):
return iter
def __next__(iter):
try:
chunk = self.... | [
"def",
"chunks",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_it'",
")",
":",
"class",
"ChunkIterator",
"(",
"object",
")",
":",
"def",
"__iter__",
"(",
"iter",
")",
":",
"return",
"iter",
"def",
"__next__",
"(",
"iter",
")",
... | Returns a chunk iterator over the sound. | [
"Returns",
"a",
"chunk",
"iterator",
"over",
"the",
"sound",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sound.py#L70-L92 |
pierre-rouanet/aupyom | aupyom/sound.py | Sound.pitch_shifter | def pitch_shifter(self, chunk, shift):
""" Pitch-Shift the given chunk by shift semi-tones. """
freq = numpy.fft.rfft(chunk)
N = len(freq)
shifted_freq = numpy.zeros(N, freq.dtype)
S = numpy.round(shift if shift > 0 else N + shift, 0)
s = N - S
shifted_freq[:S]... | python | def pitch_shifter(self, chunk, shift):
""" Pitch-Shift the given chunk by shift semi-tones. """
freq = numpy.fft.rfft(chunk)
N = len(freq)
shifted_freq = numpy.zeros(N, freq.dtype)
S = numpy.round(shift if shift > 0 else N + shift, 0)
s = N - S
shifted_freq[:S]... | [
"def",
"pitch_shifter",
"(",
"self",
",",
"chunk",
",",
"shift",
")",
":",
"freq",
"=",
"numpy",
".",
"fft",
".",
"rfft",
"(",
"chunk",
")",
"N",
"=",
"len",
"(",
"freq",
")",
"shifted_freq",
"=",
"numpy",
".",
"zeros",
"(",
"N",
",",
"freq",
"."... | Pitch-Shift the given chunk by shift semi-tones. | [
"Pitch",
"-",
"Shift",
"the",
"given",
"chunk",
"by",
"shift",
"semi",
"-",
"tones",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sound.py#L108-L123 |
pierre-rouanet/aupyom | aupyom/sound.py | Sound._time_stretcher | def _time_stretcher(self, stretch_factor):
""" Real time time-scale without pitch modification.
:param int i: index of the beginning of the chunk to stretch
:param float stretch_factor: audio scale factor (if > 1 speed up the sound else slow it down)
.. warning:: This metho... | python | def _time_stretcher(self, stretch_factor):
""" Real time time-scale without pitch modification.
:param int i: index of the beginning of the chunk to stretch
:param float stretch_factor: audio scale factor (if > 1 speed up the sound else slow it down)
.. warning:: This metho... | [
"def",
"_time_stretcher",
"(",
"self",
",",
"stretch_factor",
")",
":",
"start",
"=",
"self",
".",
"_i2",
"end",
"=",
"min",
"(",
"self",
".",
"_i2",
"+",
"self",
".",
"_N",
",",
"len",
"(",
"self",
".",
"_sy",
")",
"-",
"(",
"self",
".",
"_N",
... | Real time time-scale without pitch modification.
:param int i: index of the beginning of the chunk to stretch
:param float stretch_factor: audio scale factor (if > 1 speed up the sound else slow it down)
.. warning:: This method needs to store the phase computed from the previous c... | [
"Real",
"time",
"time",
"-",
"scale",
"without",
"pitch",
"modification",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sound.py#L158-L199 |
vlasovskikh/funcparserlib | funcparserlib/util.py | pretty_tree | def pretty_tree(x, kids, show):
"""(a, (a -> list(a)), (a -> str)) -> str
Returns a pseudographic tree representation of x similar to the tree command
in Unix.
"""
(MID, END, CONT, LAST, ROOT) = (u'|-- ', u'`-- ', u'| ', u' ', u'')
def rec(x, indent, sym):
line = indent + sym + sh... | python | def pretty_tree(x, kids, show):
"""(a, (a -> list(a)), (a -> str)) -> str
Returns a pseudographic tree representation of x similar to the tree command
in Unix.
"""
(MID, END, CONT, LAST, ROOT) = (u'|-- ', u'`-- ', u'| ', u' ', u'')
def rec(x, indent, sym):
line = indent + sym + sh... | [
"def",
"pretty_tree",
"(",
"x",
",",
"kids",
",",
"show",
")",
":",
"(",
"MID",
",",
"END",
",",
"CONT",
",",
"LAST",
",",
"ROOT",
")",
"=",
"(",
"u'|-- '",
",",
"u'`-- '",
",",
"u'| '",
",",
"u' '",
",",
"u''",
")",
"def",
"rec",
"(",
"x"... | (a, (a -> list(a)), (a -> str)) -> str
Returns a pseudographic tree representation of x similar to the tree command
in Unix. | [
"(",
"a",
"(",
"a",
"-",
">",
"list",
"(",
"a",
"))",
"(",
"a",
"-",
">",
"str",
"))",
"-",
">",
"str"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/util.py#L25-L49 |
vlasovskikh/funcparserlib | funcparserlib/lexer.py | make_tokenizer | def make_tokenizer(specs):
"""[(str, (str, int?))] -> (str -> Iterable(Token))"""
def compile_spec(spec):
name, args = spec
return name, re.compile(*args)
compiled = [compile_spec(s) for s in specs]
def match_specs(specs, str, i, position):
line, pos = position
for typ... | python | def make_tokenizer(specs):
"""[(str, (str, int?))] -> (str -> Iterable(Token))"""
def compile_spec(spec):
name, args = spec
return name, re.compile(*args)
compiled = [compile_spec(s) for s in specs]
def match_specs(specs, str, i, position):
line, pos = position
for typ... | [
"def",
"make_tokenizer",
"(",
"specs",
")",
":",
"def",
"compile_spec",
"(",
"spec",
")",
":",
"name",
",",
"args",
"=",
"spec",
"return",
"name",
",",
"re",
".",
"compile",
"(",
"*",
"args",
")",
"compiled",
"=",
"[",
"compile_spec",
"(",
"s",
")",
... | [(str, (str, int?))] -> (str -> Iterable(Token)) | [
"[",
"(",
"str",
"(",
"str",
"int?",
"))",
"]",
"-",
">",
"(",
"str",
"-",
">",
"Iterable",
"(",
"Token",
"))"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/lexer.py#L76-L112 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | finished | def finished(tokens, s):
"""Parser(a, None)
Throws an exception if any tokens are left in the input unparsed.
"""
if s.pos >= len(tokens):
return None, s
else:
raise NoParseError(u'should have reached <EOF>', s) | python | def finished(tokens, s):
"""Parser(a, None)
Throws an exception if any tokens are left in the input unparsed.
"""
if s.pos >= len(tokens):
return None, s
else:
raise NoParseError(u'should have reached <EOF>', s) | [
"def",
"finished",
"(",
"tokens",
",",
"s",
")",
":",
"if",
"s",
".",
"pos",
">=",
"len",
"(",
"tokens",
")",
":",
"return",
"None",
",",
"s",
"else",
":",
"raise",
"NoParseError",
"(",
"u'should have reached <EOF>'",
",",
"s",
")"
] | Parser(a, None)
Throws an exception if any tokens are left in the input unparsed. | [
"Parser",
"(",
"a",
"None",
")"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L264-L272 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | many | def many(p):
"""Parser(a, b) -> Parser(a, [b])
Returns a parser that infinitely applies the parser p to the input sequence
of tokens while it successfully parsers them. The resulting parser returns a
list of parsed values.
"""
@Parser
def _many(tokens, s):
"""Iterative implementati... | python | def many(p):
"""Parser(a, b) -> Parser(a, [b])
Returns a parser that infinitely applies the parser p to the input sequence
of tokens while it successfully parsers them. The resulting parser returns a
list of parsed values.
"""
@Parser
def _many(tokens, s):
"""Iterative implementati... | [
"def",
"many",
"(",
"p",
")",
":",
"@",
"Parser",
"def",
"_many",
"(",
"tokens",
",",
"s",
")",
":",
"\"\"\"Iterative implementation preventing the stack overflow.\"\"\"",
"res",
"=",
"[",
"]",
"try",
":",
"while",
"True",
":",
"(",
"v",
",",
"s",
")",
"... | Parser(a, b) -> Parser(a, [b])
Returns a parser that infinitely applies the parser p to the input sequence
of tokens while it successfully parsers them. The resulting parser returns a
list of parsed values. | [
"Parser",
"(",
"a",
"b",
")",
"-",
">",
"Parser",
"(",
"a",
"[",
"b",
"]",
")"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L278-L298 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | some | def some(pred):
"""(a -> bool) -> Parser(a, a)
Returns a parser that parses a token if it satisfies a predicate pred.
"""
@Parser
def _some(tokens, s):
if s.pos >= len(tokens):
raise NoParseError(u'no tokens left in the stream', s)
else:
t = tokens[s.pos]
... | python | def some(pred):
"""(a -> bool) -> Parser(a, a)
Returns a parser that parses a token if it satisfies a predicate pred.
"""
@Parser
def _some(tokens, s):
if s.pos >= len(tokens):
raise NoParseError(u'no tokens left in the stream', s)
else:
t = tokens[s.pos]
... | [
"def",
"some",
"(",
"pred",
")",
":",
"@",
"Parser",
"def",
"_some",
"(",
"tokens",
",",
"s",
")",
":",
"if",
"s",
".",
"pos",
">=",
"len",
"(",
"tokens",
")",
":",
"raise",
"NoParseError",
"(",
"u'no tokens left in the stream'",
",",
"s",
")",
"else... | (a -> bool) -> Parser(a, a)
Returns a parser that parses a token if it satisfies a predicate pred. | [
"(",
"a",
"-",
">",
"bool",
")",
"-",
">",
"Parser",
"(",
"a",
"a",
")"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L301-L325 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | a | def a(value):
"""Eq(a) -> Parser(a, a)
Returns a parser that parses a token that is equal to the value value.
"""
name = getattr(value, 'name', value)
return some(lambda t: t == value).named(u'(a "%s")' % (name,)) | python | def a(value):
"""Eq(a) -> Parser(a, a)
Returns a parser that parses a token that is equal to the value value.
"""
name = getattr(value, 'name', value)
return some(lambda t: t == value).named(u'(a "%s")' % (name,)) | [
"def",
"a",
"(",
"value",
")",
":",
"name",
"=",
"getattr",
"(",
"value",
",",
"'name'",
",",
"value",
")",
"return",
"some",
"(",
"lambda",
"t",
":",
"t",
"==",
"value",
")",
".",
"named",
"(",
"u'(a \"%s\")'",
"%",
"(",
"name",
",",
")",
")"
] | Eq(a) -> Parser(a, a)
Returns a parser that parses a token that is equal to the value value. | [
"Eq",
"(",
"a",
")",
"-",
">",
"Parser",
"(",
"a",
"a",
")"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L328-L334 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | oneplus | def oneplus(p):
"""Parser(a, b) -> Parser(a, [b])
Returns a parser that applies the parser p one or more times.
"""
@Parser
def _oneplus(tokens, s):
(v1, s2) = p.run(tokens, s)
(v2, s3) = many(p).run(tokens, s2)
return [v1] + v2, s3
_oneplus.name = u'(%s , { %s })' % (p... | python | def oneplus(p):
"""Parser(a, b) -> Parser(a, [b])
Returns a parser that applies the parser p one or more times.
"""
@Parser
def _oneplus(tokens, s):
(v1, s2) = p.run(tokens, s)
(v2, s3) = many(p).run(tokens, s2)
return [v1] + v2, s3
_oneplus.name = u'(%s , { %s })' % (p... | [
"def",
"oneplus",
"(",
"p",
")",
":",
"@",
"Parser",
"def",
"_oneplus",
"(",
"tokens",
",",
"s",
")",
":",
"(",
"v1",
",",
"s2",
")",
"=",
"p",
".",
"run",
"(",
"tokens",
",",
"s",
")",
"(",
"v2",
",",
"s3",
")",
"=",
"many",
"(",
"p",
")... | Parser(a, b) -> Parser(a, [b])
Returns a parser that applies the parser p one or more times. | [
"Parser",
"(",
"a",
"b",
")",
"-",
">",
"Parser",
"(",
"a",
"[",
"b",
"]",
")"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L366-L378 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | with_forward_decls | def with_forward_decls(suspension):
"""(None -> Parser(a, b)) -> Parser(a, b)
Returns a parser that computes itself lazily as a result of the suspension
provided. It is needed when some parsers contain forward references to
parsers defined later and such references are cyclic. See examples for more
... | python | def with_forward_decls(suspension):
"""(None -> Parser(a, b)) -> Parser(a, b)
Returns a parser that computes itself lazily as a result of the suspension
provided. It is needed when some parsers contain forward references to
parsers defined later and such references are cyclic. See examples for more
... | [
"def",
"with_forward_decls",
"(",
"suspension",
")",
":",
"@",
"Parser",
"def",
"f",
"(",
"tokens",
",",
"s",
")",
":",
"return",
"suspension",
"(",
")",
".",
"run",
"(",
"tokens",
",",
"s",
")",
"return",
"f"
] | (None -> Parser(a, b)) -> Parser(a, b)
Returns a parser that computes itself lazily as a result of the suspension
provided. It is needed when some parsers contain forward references to
parsers defined later and such references are cyclic. See examples for more
details. | [
"(",
"None",
"-",
">",
"Parser",
"(",
"a",
"b",
"))",
"-",
">",
"Parser",
"(",
"a",
"b",
")"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L381-L394 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | Parser.define | def define(self, p):
"""Defines a parser wrapped into this object."""
f = getattr(p, 'run', p)
if debug:
setattr(self, '_run', f)
else:
setattr(self, 'run', f)
self.named(getattr(p, 'name', p.__doc__)) | python | def define(self, p):
"""Defines a parser wrapped into this object."""
f = getattr(p, 'run', p)
if debug:
setattr(self, '_run', f)
else:
setattr(self, 'run', f)
self.named(getattr(p, 'name', p.__doc__)) | [
"def",
"define",
"(",
"self",
",",
"p",
")",
":",
"f",
"=",
"getattr",
"(",
"p",
",",
"'run'",
",",
"p",
")",
"if",
"debug",
":",
"setattr",
"(",
"self",
",",
"'_run'",
",",
"f",
")",
"else",
":",
"setattr",
"(",
"self",
",",
"'run'",
",",
"f... | Defines a parser wrapped into this object. | [
"Defines",
"a",
"parser",
"wrapped",
"into",
"this",
"object",
"."
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L90-L97 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | Parser.run | def run(self, tokens, s):
"""Sequence(a), State -> (b, State)
Runs a parser wrapped into this object.
"""
if debug:
log.debug(u'trying %s' % self.name)
return self._run(tokens, s) | python | def run(self, tokens, s):
"""Sequence(a), State -> (b, State)
Runs a parser wrapped into this object.
"""
if debug:
log.debug(u'trying %s' % self.name)
return self._run(tokens, s) | [
"def",
"run",
"(",
"self",
",",
"tokens",
",",
"s",
")",
":",
"if",
"debug",
":",
"log",
".",
"debug",
"(",
"u'trying %s'",
"%",
"self",
".",
"name",
")",
"return",
"self",
".",
"_run",
"(",
"tokens",
",",
"s",
")"
] | Sequence(a), State -> (b, State)
Runs a parser wrapped into this object. | [
"Sequence",
"(",
"a",
")",
"State",
"-",
">",
"(",
"b",
"State",
")"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L99-L106 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | Parser.parse | def parse(self, tokens):
"""Sequence(a) -> b
Applies the parser to a sequence of tokens producing a parsing result.
It provides a way to invoke a parser hiding details related to the
parser state. Also it makes error messages more readable by specifying
the position of the righ... | python | def parse(self, tokens):
"""Sequence(a) -> b
Applies the parser to a sequence of tokens producing a parsing result.
It provides a way to invoke a parser hiding details related to the
parser state. Also it makes error messages more readable by specifying
the position of the righ... | [
"def",
"parse",
"(",
"self",
",",
"tokens",
")",
":",
"try",
":",
"(",
"tree",
",",
"_",
")",
"=",
"self",
".",
"run",
"(",
"tokens",
",",
"State",
"(",
")",
")",
"return",
"tree",
"except",
"NoParseError",
",",
"e",
":",
"max",
"=",
"e",
".",
... | Sequence(a) -> b
Applies the parser to a sequence of tokens producing a parsing result.
It provides a way to invoke a parser hiding details related to the
parser state. Also it makes error messages more readable by specifying
the position of the rightmost token that has been reached. | [
"Sequence",
"(",
"a",
")",
"-",
">",
"b"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L111-L129 |
vlasovskikh/funcparserlib | funcparserlib/parser.py | Parser.bind | def bind(self, f):
"""Parser(a, b), (b -> Parser(a, c)) -> Parser(a, c)
NOTE: A monadic bind function. It is used internally to implement other
combinators. Functions bind and pure make the Parser a Monad.
"""
@Parser
def _bind(tokens, s):
(v, s2) = self.run... | python | def bind(self, f):
"""Parser(a, b), (b -> Parser(a, c)) -> Parser(a, c)
NOTE: A monadic bind function. It is used internally to implement other
combinators. Functions bind and pure make the Parser a Monad.
"""
@Parser
def _bind(tokens, s):
(v, s2) = self.run... | [
"def",
"bind",
"(",
"self",
",",
"f",
")",
":",
"@",
"Parser",
"def",
"_bind",
"(",
"tokens",
",",
"s",
")",
":",
"(",
"v",
",",
"s2",
")",
"=",
"self",
".",
"run",
"(",
"tokens",
",",
"s",
")",
"return",
"f",
"(",
"v",
")",
".",
"run",
"... | Parser(a, b), (b -> Parser(a, c)) -> Parser(a, c)
NOTE: A monadic bind function. It is used internally to implement other
combinators. Functions bind and pure make the Parser a Monad. | [
"Parser",
"(",
"a",
"b",
")",
"(",
"b",
"-",
">",
"Parser",
"(",
"a",
"c",
"))",
"-",
">",
"Parser",
"(",
"a",
"c",
")"
] | train | https://github.com/vlasovskikh/funcparserlib/blob/0b689920babcf6079a4b3e8721cc10bbc089d81c/funcparserlib/parser.py#L207-L220 |
pierre-rouanet/aupyom | aupyom/sampler.py | Sampler.play | def play(self, sound):
""" Adds and plays a new Sound to the Sampler.
:param sound: sound to play
.. note:: If the sound is already playing, it will restart from the beginning.
"""
self.is_done.clear() # hold is_done until the sound is played
if self.sr != sou... | python | def play(self, sound):
""" Adds and plays a new Sound to the Sampler.
:param sound: sound to play
.. note:: If the sound is already playing, it will restart from the beginning.
"""
self.is_done.clear() # hold is_done until the sound is played
if self.sr != sou... | [
"def",
"play",
"(",
"self",
",",
"sound",
")",
":",
"self",
".",
"is_done",
".",
"clear",
"(",
")",
"# hold is_done until the sound is played",
"if",
"self",
".",
"sr",
"!=",
"sound",
".",
"sr",
":",
"raise",
"ValueError",
"(",
"'You can only play sound with a... | Adds and plays a new Sound to the Sampler.
:param sound: sound to play
.. note:: If the sound is already playing, it will restart from the beginning. | [
"Adds",
"and",
"plays",
"a",
"new",
"Sound",
"to",
"the",
"Sampler",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sampler.py#L48-L68 |
pierre-rouanet/aupyom | aupyom/sampler.py | Sampler.remove | def remove(self, sound):
""" Remove a currently played sound. """
with self.chunk_available:
sound.playing = False
self.sounds.remove(sound) | python | def remove(self, sound):
""" Remove a currently played sound. """
with self.chunk_available:
sound.playing = False
self.sounds.remove(sound) | [
"def",
"remove",
"(",
"self",
",",
"sound",
")",
":",
"with",
"self",
".",
"chunk_available",
":",
"sound",
".",
"playing",
"=",
"False",
"self",
".",
"sounds",
".",
"remove",
"(",
"sound",
")"
] | Remove a currently played sound. | [
"Remove",
"a",
"currently",
"played",
"sound",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sampler.py#L70-L74 |
pierre-rouanet/aupyom | aupyom/sampler.py | Sampler.next_chunks | def next_chunks(self):
""" Gets a new chunk from all played sound and mix them together. """
with self.chunk_available:
while True:
playing_sounds = [s for s in self.sounds if s.playing]
chunks = []
for s in playing_sounds:
... | python | def next_chunks(self):
""" Gets a new chunk from all played sound and mix them together. """
with self.chunk_available:
while True:
playing_sounds = [s for s in self.sounds if s.playing]
chunks = []
for s in playing_sounds:
... | [
"def",
"next_chunks",
"(",
"self",
")",
":",
"with",
"self",
".",
"chunk_available",
":",
"while",
"True",
":",
"playing_sounds",
"=",
"[",
"s",
"for",
"s",
"in",
"self",
".",
"sounds",
"if",
"s",
".",
"playing",
"]",
"chunks",
"=",
"[",
"]",
"for",
... | Gets a new chunk from all played sound and mix them together. | [
"Gets",
"a",
"new",
"chunk",
"from",
"all",
"played",
"sound",
"and",
"mix",
"them",
"together",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sampler.py#L78-L98 |
pierre-rouanet/aupyom | aupyom/sampler.py | Sampler.run | def run(self):
""" Play loop, i.e. send all sound chunk by chunk to the soundcard. """
self.running = True
def chunks_producer():
while self.running:
self.chunks.put(self.next_chunks())
t = Thread(target=chunks_producer)
t.start()
with self.... | python | def run(self):
""" Play loop, i.e. send all sound chunk by chunk to the soundcard. """
self.running = True
def chunks_producer():
while self.running:
self.chunks.put(self.next_chunks())
t = Thread(target=chunks_producer)
t.start()
with self.... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"running",
"=",
"True",
"def",
"chunks_producer",
"(",
")",
":",
"while",
"self",
".",
"running",
":",
"self",
".",
"chunks",
".",
"put",
"(",
"self",
".",
"next_chunks",
"(",
")",
")",
"t",
"=",
... | Play loop, i.e. send all sound chunk by chunk to the soundcard. | [
"Play",
"loop",
"i",
".",
"e",
".",
"send",
"all",
"sound",
"chunk",
"by",
"chunk",
"to",
"the",
"soundcard",
"."
] | train | https://github.com/pierre-rouanet/aupyom/blob/90f819b2d0b6cf7467b1945af029317a61e52e56/aupyom/sampler.py#L100-L116 |
suds-community/suds | suds/wsse.py | UsernameToken.xml | def xml(self):
"""
Get xml representation of the object.
@return: The root node.
@rtype: L{Element}
"""
root = Element('UsernameToken', ns=wssens)
u = Element('Username', ns=wssens)
u.setText(self.username)
root.append(u)
p = Element('Passw... | python | def xml(self):
"""
Get xml representation of the object.
@return: The root node.
@rtype: L{Element}
"""
root = Element('UsernameToken', ns=wssens)
u = Element('Username', ns=wssens)
u.setText(self.username)
root.append(u)
p = Element('Passw... | [
"def",
"xml",
"(",
"self",
")",
":",
"root",
"=",
"Element",
"(",
"'UsernameToken'",
",",
"ns",
"=",
"wssens",
")",
"u",
"=",
"Element",
"(",
"'Username'",
",",
"ns",
"=",
"wssens",
")",
"u",
".",
"setText",
"(",
"self",
".",
"username",
")",
"root... | Get xml representation of the object.
@return: The root node.
@rtype: L{Element} | [
"Get",
"xml",
"representation",
"of",
"the",
"object",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsse.py#L177-L203 |
suds-community/suds | suds/umx/attrlist.py | AttrList.skip | def skip(self, attr):
"""
Get whether to skip (filter-out) the specified attribute.
@param attr: An attribute.
@type attr: I{Attribute}
@return: True if should be skipped.
@rtype: bool
"""
ns = attr.namespace()
skip = (
Namespace.xmlns[... | python | def skip(self, attr):
"""
Get whether to skip (filter-out) the specified attribute.
@param attr: An attribute.
@type attr: I{Attribute}
@return: True if should be skipped.
@rtype: bool
"""
ns = attr.namespace()
skip = (
Namespace.xmlns[... | [
"def",
"skip",
"(",
"self",
",",
"attr",
")",
":",
"ns",
"=",
"attr",
".",
"namespace",
"(",
")",
"skip",
"=",
"(",
"Namespace",
".",
"xmlns",
"[",
"1",
"]",
",",
"'http://schemas.xmlsoap.org/soap/encoding/'",
",",
"'http://schemas.xmlsoap.org/soap/envelope/'",
... | Get whether to skip (filter-out) the specified attribute.
@param attr: An attribute.
@type attr: I{Attribute}
@return: True if should be skipped.
@rtype: bool | [
"Get",
"whether",
"to",
"skip",
"(",
"filter",
"-",
"out",
")",
"the",
"specified",
"attribute",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/umx/attrlist.py#L73-L88 |
suds-community/suds | suds/xsd/depsort.py | dependency_sort | def dependency_sort(dependency_tree):
"""
Sorts items 'dependencies first' in a given dependency tree.
A dependency tree is a dictionary mapping an object to a collection its
dependency objects.
Result is a properly sorted list of items, where each item is a 2-tuple
containing an object and it... | python | def dependency_sort(dependency_tree):
"""
Sorts items 'dependencies first' in a given dependency tree.
A dependency tree is a dictionary mapping an object to a collection its
dependency objects.
Result is a properly sorted list of items, where each item is a 2-tuple
containing an object and it... | [
"def",
"dependency_sort",
"(",
"dependency_tree",
")",
":",
"sorted",
"=",
"[",
"]",
"processed",
"=",
"set",
"(",
")",
"for",
"key",
",",
"deps",
"in",
"dependency_tree",
".",
"iteritems",
"(",
")",
":",
"_sort_r",
"(",
"sorted",
",",
"processed",
",",
... | Sorts items 'dependencies first' in a given dependency tree.
A dependency tree is a dictionary mapping an object to a collection its
dependency objects.
Result is a properly sorted list of items, where each item is a 2-tuple
containing an object and its dependency list, as given in the input
depen... | [
"Sorts",
"items",
"dependencies",
"first",
"in",
"a",
"given",
"dependency",
"tree",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/depsort.py#L27-L57 |
suds-community/suds | suds/xsd/depsort.py | _sort_r | def _sort_r(sorted, processed, key, deps, dependency_tree):
"""Recursive topological sort implementation."""
if key in processed:
return
processed.add(key)
for dep_key in deps:
dep_deps = dependency_tree.get(dep_key)
if dep_deps is None:
log.debug('"%s" not found, ski... | python | def _sort_r(sorted, processed, key, deps, dependency_tree):
"""Recursive topological sort implementation."""
if key in processed:
return
processed.add(key)
for dep_key in deps:
dep_deps = dependency_tree.get(dep_key)
if dep_deps is None:
log.debug('"%s" not found, ski... | [
"def",
"_sort_r",
"(",
"sorted",
",",
"processed",
",",
"key",
",",
"deps",
",",
"dependency_tree",
")",
":",
"if",
"key",
"in",
"processed",
":",
"return",
"processed",
".",
"add",
"(",
"key",
")",
"for",
"dep_key",
"in",
"deps",
":",
"dep_deps",
"=",... | Recursive topological sort implementation. | [
"Recursive",
"topological",
"sort",
"implementation",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/depsort.py#L60-L71 |
suds-community/suds | suds/xsd/sxbasic.py | TypedContent.resolve | def resolve(self, nobuiltin=False):
"""
Resolve the node's type reference and return the referenced type node.
Returns self if the type is defined locally, e.g. as a <complexType>
subnode. Otherwise returns the referenced external node.
@param nobuiltin: Flag indicating whether... | python | def resolve(self, nobuiltin=False):
"""
Resolve the node's type reference and return the referenced type node.
Returns self if the type is defined locally, e.g. as a <complexType>
subnode. Otherwise returns the referenced external node.
@param nobuiltin: Flag indicating whether... | [
"def",
"resolve",
"(",
"self",
",",
"nobuiltin",
"=",
"False",
")",
":",
"cached",
"=",
"self",
".",
"resolved_cache",
".",
"get",
"(",
"nobuiltin",
")",
"if",
"cached",
"is",
"not",
"None",
":",
"return",
"cached",
"resolved",
"=",
"self",
".",
"__res... | Resolve the node's type reference and return the referenced type node.
Returns self if the type is defined locally, e.g. as a <complexType>
subnode. Otherwise returns the referenced external node.
@param nobuiltin: Flag indicating whether resolving to XSD built-in
types should not ... | [
"Resolve",
"the",
"node",
"s",
"type",
"reference",
"and",
"return",
"the",
"referenced",
"type",
"node",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L45-L63 |
suds-community/suds | suds/xsd/sxbasic.py | TypedContent.__resolve_type | def __resolve_type(self, nobuiltin=False):
"""
Private resolve() worker without any result caching.
@param nobuiltin: Flag indicating whether resolving to XSD built-in
types should not be allowed.
@return: The resolved (true) type.
@rtype: L{SchemaObject}
""... | python | def __resolve_type(self, nobuiltin=False):
"""
Private resolve() worker without any result caching.
@param nobuiltin: Flag indicating whether resolving to XSD built-in
types should not be allowed.
@return: The resolved (true) type.
@rtype: L{SchemaObject}
""... | [
"def",
"__resolve_type",
"(",
"self",
",",
"nobuiltin",
"=",
"False",
")",
":",
"# There is no need for a recursive implementation here since a node can",
"# reference an external type node but XSD specification explicitly",
"# states that that external node must not be a reference to yet an... | Private resolve() worker without any result caching.
@param nobuiltin: Flag indicating whether resolving to XSD built-in
types should not be allowed.
@return: The resolved (true) type.
@rtype: L{SchemaObject} | [
"Private",
"resolve",
"()",
"worker",
"without",
"any",
"result",
"caching",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L65-L91 |
suds-community/suds | suds/xsd/sxbasic.py | Element.implany | def implany(self):
"""
Set the type to <xsd:any/> when implicit.
An element has an implicit <xsd:any/> type when it has no body and no
explicitly defined type.
@return: self
@rtype: L{Element}
"""
if self.type is None and self.ref is None and self.root.... | python | def implany(self):
"""
Set the type to <xsd:any/> when implicit.
An element has an implicit <xsd:any/> type when it has no body and no
explicitly defined type.
@return: self
@rtype: L{Element}
"""
if self.type is None and self.ref is None and self.root.... | [
"def",
"implany",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"is",
"None",
"and",
"self",
".",
"ref",
"is",
"None",
"and",
"self",
".",
"root",
".",
"isempty",
"(",
")",
":",
"self",
".",
"type",
"=",
"self",
".",
"anytype",
"(",
")"
] | Set the type to <xsd:any/> when implicit.
An element has an implicit <xsd:any/> type when it has no body and no
explicitly defined type.
@return: self
@rtype: L{Element} | [
"Set",
"the",
"type",
"to",
"<xsd",
":",
"any",
"/",
">",
"when",
"implicit",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L389-L401 |
suds-community/suds | suds/xsd/sxbasic.py | Element.namespace | def namespace(self, prefix=None):
"""
Get this schema element's target namespace.
In case of reference elements, the target namespace is defined by the
referenced and not the referencing element node.
@param prefix: The default prefix.
@type prefix: str
@return:... | python | def namespace(self, prefix=None):
"""
Get this schema element's target namespace.
In case of reference elements, the target namespace is defined by the
referenced and not the referencing element node.
@param prefix: The default prefix.
@type prefix: str
@return:... | [
"def",
"namespace",
"(",
"self",
",",
"prefix",
"=",
"None",
")",
":",
"e",
"=",
"self",
".",
"__deref",
"(",
")",
"if",
"e",
"is",
"not",
"None",
":",
"return",
"e",
".",
"namespace",
"(",
"prefix",
")",
"return",
"super",
"(",
"Element",
",",
"... | Get this schema element's target namespace.
In case of reference elements, the target namespace is defined by the
referenced and not the referencing element node.
@param prefix: The default prefix.
@type prefix: str
@return: The schema element's target namespace
@rtype:... | [
"Get",
"this",
"schema",
"element",
"s",
"target",
"namespace",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L443-L459 |
suds-community/suds | suds/xsd/sxbasic.py | Import.open | def open(self, options, loaded_schemata):
"""
Open and import the referenced schema.
@param options: An options dictionary.
@type options: L{options.Options}
@param loaded_schemata: Already loaded schemata cache (URL --> Schema).
@type loaded_schemata: dict
@retu... | python | def open(self, options, loaded_schemata):
"""
Open and import the referenced schema.
@param options: An options dictionary.
@type options: L{options.Options}
@param loaded_schemata: Already loaded schemata cache (URL --> Schema).
@type loaded_schemata: dict
@retu... | [
"def",
"open",
"(",
"self",
",",
"options",
",",
"loaded_schemata",
")",
":",
"if",
"self",
".",
"opened",
":",
"return",
"self",
".",
"opened",
"=",
"True",
"log",
".",
"debug",
"(",
"\"%s, importing ns='%s', location='%s'\"",
",",
"self",
".",
"id",
",",... | Open and import the referenced schema.
@param options: An options dictionary.
@type options: L{options.Options}
@param loaded_schemata: Already loaded schemata cache (URL --> Schema).
@type loaded_schemata: dict
@return: The referenced schema.
@rtype: L{Schema} | [
"Open",
"and",
"import",
"the",
"referenced",
"schema",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L552-L580 |
suds-community/suds | suds/xsd/sxbasic.py | Import.__locate | def __locate(self):
"""Find the schema locally."""
if self.ns[1] != self.schema.tns[1]:
return self.schema.locate(self.ns) | python | def __locate(self):
"""Find the schema locally."""
if self.ns[1] != self.schema.tns[1]:
return self.schema.locate(self.ns) | [
"def",
"__locate",
"(",
"self",
")",
":",
"if",
"self",
".",
"ns",
"[",
"1",
"]",
"!=",
"self",
".",
"schema",
".",
"tns",
"[",
"1",
"]",
":",
"return",
"self",
".",
"schema",
".",
"locate",
"(",
"self",
".",
"ns",
")"
] | Find the schema locally. | [
"Find",
"the",
"schema",
"locally",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L582-L585 |
suds-community/suds | suds/xsd/sxbasic.py | Import.__download | def __download(self, url, loaded_schemata, options):
"""Download the schema."""
try:
reader = DocumentReader(options)
d = reader.open(url)
root = d.root()
root.set("url", url)
return self.schema.instance(root, url, loaded_schemata, options)
... | python | def __download(self, url, loaded_schemata, options):
"""Download the schema."""
try:
reader = DocumentReader(options)
d = reader.open(url)
root = d.root()
root.set("url", url)
return self.schema.instance(root, url, loaded_schemata, options)
... | [
"def",
"__download",
"(",
"self",
",",
"url",
",",
"loaded_schemata",
",",
"options",
")",
":",
"try",
":",
"reader",
"=",
"DocumentReader",
"(",
"options",
")",
"d",
"=",
"reader",
".",
"open",
"(",
"url",
")",
"root",
"=",
"d",
".",
"root",
"(",
... | Download the schema. | [
"Download",
"the",
"schema",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L587-L598 |
suds-community/suds | suds/xsd/sxbasic.py | Include.__applytns | def __applytns(self, root):
"""Make sure included schema has the same target namespace."""
TNS = "targetNamespace"
tns = root.get(TNS)
if tns is None:
tns = self.schema.tns[1]
root.set(TNS, tns)
else:
if self.schema.tns[1] != tns:
... | python | def __applytns(self, root):
"""Make sure included schema has the same target namespace."""
TNS = "targetNamespace"
tns = root.get(TNS)
if tns is None:
tns = self.schema.tns[1]
root.set(TNS, tns)
else:
if self.schema.tns[1] != tns:
... | [
"def",
"__applytns",
"(",
"self",
",",
"root",
")",
":",
"TNS",
"=",
"\"targetNamespace\"",
"tns",
"=",
"root",
".",
"get",
"(",
"TNS",
")",
"if",
"tns",
"is",
"None",
":",
"tns",
"=",
"self",
".",
"schema",
".",
"tns",
"[",
"1",
"]",
"root",
"."... | Make sure included schema has the same target namespace. | [
"Make",
"sure",
"included",
"schema",
"has",
"the",
"same",
"target",
"namespace",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L662-L671 |
suds-community/suds | suds/wsdl.py | WObject.resolve | def resolve(self, definitions):
"""
Resolve named references to other WSDL objects.
Can be safely called multiple times.
@param definitions: A definitions object.
@type definitions: L{Definitions}
"""
if not self.__resolved:
self.do_resolve(definiti... | python | def resolve(self, definitions):
"""
Resolve named references to other WSDL objects.
Can be safely called multiple times.
@param definitions: A definitions object.
@type definitions: L{Definitions}
"""
if not self.__resolved:
self.do_resolve(definiti... | [
"def",
"resolve",
"(",
"self",
",",
"definitions",
")",
":",
"if",
"not",
"self",
".",
"__resolved",
":",
"self",
".",
"do_resolve",
"(",
"definitions",
")",
"self",
".",
"__resolved",
"=",
"True"
] | Resolve named references to other WSDL objects.
Can be safely called multiple times.
@param definitions: A definitions object.
@type definitions: L{Definitions} | [
"Resolve",
"named",
"references",
"to",
"other",
"WSDL",
"objects",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L70-L82 |
suds-community/suds | suds/wsdl.py | Definitions.mktns | def mktns(self, root):
"""Get/create the target namespace."""
tns = root.get("targetNamespace")
prefix = root.findPrefix(tns)
if prefix is None:
log.debug("warning: tns (%s), not mapped to prefix", tns)
prefix = "tns"
return (prefix, tns) | python | def mktns(self, root):
"""Get/create the target namespace."""
tns = root.get("targetNamespace")
prefix = root.findPrefix(tns)
if prefix is None:
log.debug("warning: tns (%s), not mapped to prefix", tns)
prefix = "tns"
return (prefix, tns) | [
"def",
"mktns",
"(",
"self",
",",
"root",
")",
":",
"tns",
"=",
"root",
".",
"get",
"(",
"\"targetNamespace\"",
")",
"prefix",
"=",
"root",
".",
"findPrefix",
"(",
"tns",
")",
"if",
"prefix",
"is",
"None",
":",
"log",
".",
"debug",
"(",
"\"warning: t... | Get/create the target namespace. | [
"Get",
"/",
"create",
"the",
"target",
"namespace",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L196-L203 |
suds-community/suds | suds/wsdl.py | Definitions.open_imports | def open_imports(self, imported_definitions):
"""Import the I{imported} WSDLs."""
for imp in self.imports:
imp.load(self, imported_definitions) | python | def open_imports(self, imported_definitions):
"""Import the I{imported} WSDLs."""
for imp in self.imports:
imp.load(self, imported_definitions) | [
"def",
"open_imports",
"(",
"self",
",",
"imported_definitions",
")",
":",
"for",
"imp",
"in",
"self",
".",
"imports",
":",
"imp",
".",
"load",
"(",
"self",
",",
"imported_definitions",
")"
] | Import the I{imported} WSDLs. | [
"Import",
"the",
"I",
"{",
"imported",
"}",
"WSDLs",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L230-L233 |
suds-community/suds | suds/wsdl.py | Definitions.add_methods | def add_methods(self, service):
"""Build method view for service."""
bindings = {
"document/literal": Document(self),
"rpc/literal": RPC(self),
"rpc/encoded": Encoded(self)}
for p in service.ports:
binding = p.binding
ptype = p.binding.... | python | def add_methods(self, service):
"""Build method view for service."""
bindings = {
"document/literal": Document(self),
"rpc/literal": RPC(self),
"rpc/encoded": Encoded(self)}
for p in service.ports:
binding = p.binding
ptype = p.binding.... | [
"def",
"add_methods",
"(",
"self",
",",
"service",
")",
":",
"bindings",
"=",
"{",
"\"document/literal\"",
":",
"Document",
"(",
"self",
")",
",",
"\"rpc/literal\"",
":",
"RPC",
"(",
"self",
")",
",",
"\"rpc/encoded\"",
":",
"Encoded",
"(",
"self",
")",
... | Build method view for service. | [
"Build",
"method",
"view",
"for",
"service",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L261-L282 |
suds-community/suds | suds/wsdl.py | Import.import_definitions | def import_definitions(self, definitions, d):
"""Import/merge WSDL definitions."""
definitions.types += d.types
definitions.messages.update(d.messages)
definitions.port_types.update(d.port_types)
definitions.bindings.update(d.bindings)
self.imported = d
log.debug(... | python | def import_definitions(self, definitions, d):
"""Import/merge WSDL definitions."""
definitions.types += d.types
definitions.messages.update(d.messages)
definitions.port_types.update(d.port_types)
definitions.bindings.update(d.bindings)
self.imported = d
log.debug(... | [
"def",
"import_definitions",
"(",
"self",
",",
"definitions",
",",
"d",
")",
":",
"definitions",
".",
"types",
"+=",
"d",
".",
"types",
"definitions",
".",
"messages",
".",
"update",
"(",
"d",
".",
"messages",
")",
"definitions",
".",
"port_types",
".",
... | Import/merge WSDL definitions. | [
"Import",
"/",
"merge",
"WSDL",
"definitions",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L363-L370 |
suds-community/suds | suds/wsdl.py | Import.import_schema | def import_schema(self, definitions, d):
"""Import schema as <types/> content."""
if not definitions.types:
root = Element("types", ns=wsdlns)
definitions.root.insert(root)
types = Types(root, definitions)
definitions.types.append(types)
else:
... | python | def import_schema(self, definitions, d):
"""Import schema as <types/> content."""
if not definitions.types:
root = Element("types", ns=wsdlns)
definitions.root.insert(root)
types = Types(root, definitions)
definitions.types.append(types)
else:
... | [
"def",
"import_schema",
"(",
"self",
",",
"definitions",
",",
"d",
")",
":",
"if",
"not",
"definitions",
".",
"types",
":",
"root",
"=",
"Element",
"(",
"\"types\"",
",",
"ns",
"=",
"wsdlns",
")",
"definitions",
".",
"root",
".",
"insert",
"(",
"root",... | Import schema as <types/> content. | [
"Import",
"schema",
"as",
"<types",
"/",
">",
"content",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L372-L382 |
suds-community/suds | suds/wsdl.py | PortType.operation | def operation(self, name):
"""
Shortcut used to get a contained operation by name.
@param name: An operation name.
@type name: str
@return: The named operation.
@rtype: Operation
@raise L{MethodNotFound}: When not found.
"""
try:
retu... | python | def operation(self, name):
"""
Shortcut used to get a contained operation by name.
@param name: An operation name.
@type name: str
@return: The named operation.
@rtype: Operation
@raise L{MethodNotFound}: When not found.
"""
try:
retu... | [
"def",
"operation",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"return",
"self",
".",
"operations",
"[",
"name",
"]",
"except",
"Exception",
",",
"e",
":",
"raise",
"MethodNotFound",
"(",
"name",
")"
] | Shortcut used to get a contained operation by name.
@param name: An operation name.
@type name: str
@return: The named operation.
@rtype: Operation
@raise L{MethodNotFound}: When not found. | [
"Shortcut",
"used",
"to",
"get",
"a",
"contained",
"operation",
"by",
"name",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L555-L569 |
suds-community/suds | suds/wsdl.py | Binding.soaproot | def soaproot(self):
"""Get the soap:binding."""
for ns in (soapns, soap12ns):
sr = self.root.getChild("binding", ns=ns)
if sr is not None:
return sr | python | def soaproot(self):
"""Get the soap:binding."""
for ns in (soapns, soap12ns):
sr = self.root.getChild("binding", ns=ns)
if sr is not None:
return sr | [
"def",
"soaproot",
"(",
"self",
")",
":",
"for",
"ns",
"in",
"(",
"soapns",
",",
"soap12ns",
")",
":",
"sr",
"=",
"self",
".",
"root",
".",
"getChild",
"(",
"\"binding\"",
",",
"ns",
"=",
"ns",
")",
"if",
"sr",
"is",
"not",
"None",
":",
"return",... | Get the soap:binding. | [
"Get",
"the",
"soap",
":",
"binding",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L605-L610 |
suds-community/suds | suds/wsdl.py | Binding.do_resolve | def do_resolve(self, definitions):
"""
Resolve named references to other WSDL objects. This includes
cross-linking information (from) the portType (to) the I{SOAP} protocol
information on the binding for each operation.
@param definitions: A definitions object.
@type def... | python | def do_resolve(self, definitions):
"""
Resolve named references to other WSDL objects. This includes
cross-linking information (from) the portType (to) the I{SOAP} protocol
information on the binding for each operation.
@param definitions: A definitions object.
@type def... | [
"def",
"do_resolve",
"(",
"self",
",",
"definitions",
")",
":",
"self",
".",
"__resolveport",
"(",
"definitions",
")",
"for",
"op",
"in",
"self",
".",
"operations",
".",
"values",
"(",
")",
":",
"self",
".",
"__resolvesoapbody",
"(",
"definitions",
",",
... | Resolve named references to other WSDL objects. This includes
cross-linking information (from) the portType (to) the I{SOAP} protocol
information on the binding for each operation.
@param definitions: A definitions object.
@type definitions: L{Definitions} | [
"Resolve",
"named",
"references",
"to",
"other",
"WSDL",
"objects",
".",
"This",
"includes",
"cross",
"-",
"linking",
"information",
"(",
"from",
")",
"the",
"portType",
"(",
"to",
")",
"the",
"I",
"{",
"SOAP",
"}",
"protocol",
"information",
"on",
"the",
... | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L696-L710 |
suds-community/suds | suds/wsdl.py | Binding.__resolveport | def __resolveport(self, definitions):
"""
Resolve port_type reference.
@param definitions: A definitions object.
@type definitions: L{Definitions}
"""
ref = qualify(self.type, self.root, definitions.tns)
port_type = definitions.port_types.get(ref)
if por... | python | def __resolveport(self, definitions):
"""
Resolve port_type reference.
@param definitions: A definitions object.
@type definitions: L{Definitions}
"""
ref = qualify(self.type, self.root, definitions.tns)
port_type = definitions.port_types.get(ref)
if por... | [
"def",
"__resolveport",
"(",
"self",
",",
"definitions",
")",
":",
"ref",
"=",
"qualify",
"(",
"self",
".",
"type",
",",
"self",
".",
"root",
",",
"definitions",
".",
"tns",
")",
"port_type",
"=",
"definitions",
".",
"port_types",
".",
"get",
"(",
"ref... | Resolve port_type reference.
@param definitions: A definitions object.
@type definitions: L{Definitions} | [
"Resolve",
"port_type",
"reference",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L712-L732 |
suds-community/suds | suds/wsdl.py | Service.port | def port(self, name):
"""
Locate a port by name.
@param name: A port name.
@type name: str
@return: The port object.
@rtype: L{Port}
"""
for p in self.ports:
if p.name == name:
return p | python | def port(self, name):
"""
Locate a port by name.
@param name: A port name.
@type name: str
@return: The port object.
@rtype: L{Port}
"""
for p in self.ports:
if p.name == name:
return p | [
"def",
"port",
"(",
"self",
",",
"name",
")",
":",
"for",
"p",
"in",
"self",
".",
"ports",
":",
"if",
"p",
".",
"name",
"==",
"name",
":",
"return",
"p"
] | Locate a port by name.
@param name: A port name.
@type name: str
@return: The port object.
@rtype: L{Port} | [
"Locate",
"a",
"port",
"by",
"name",
"."
] | train | https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/wsdl.py#L910-L922 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.