partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | send_registration_mail | send_registration_mail(email, *, request, **kwargs)
Sends the registration mail
* ``email``: The email address where the registration link should be
sent to.
* ``request``: A HTTP request instance, used to construct the complete
URL (including protocol and domain) for the registration link.
... | authlib/email.py | def send_registration_mail(email, *, request, **kwargs):
"""send_registration_mail(email, *, request, **kwargs)
Sends the registration mail
* ``email``: The email address where the registration link should be
sent to.
* ``request``: A HTTP request instance, used to construct the complete
UR... | def send_registration_mail(email, *, request, **kwargs):
"""send_registration_mail(email, *, request, **kwargs)
Sends the registration mail
* ``email``: The email address where the registration link should be
sent to.
* ``request``: A HTTP request instance, used to construct the complete
UR... | [
"send_registration_mail",
"(",
"email",
"*",
"request",
"**",
"kwargs",
")",
"Sends",
"the",
"registration",
"mail"
] | matthiask/django-authlib | python | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/email.py#L90-L115 | [
"def",
"send_registration_mail",
"(",
"email",
",",
"*",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"render_to_mail",
"(",
"\"registration/email_registration_email\"",
",",
"{",
"\"url\"",
":",
"get_confirmation_url",
"(",
"email",
",",
"request",
",",
"... | a142da7e27fe9d30f34a84b12f24f686f9d2c8e1 |
train | decode | decode(code, *, max_age)
Decodes the code from the registration link and returns a tuple consisting
of the verified email address and the payload which was passed through to
``get_confirmation_code``.
The maximum age in seconds of the link has to be specified as ``max_age``.
This method raises ``V... | authlib/email.py | def decode(code, *, max_age):
"""decode(code, *, max_age)
Decodes the code from the registration link and returns a tuple consisting
of the verified email address and the payload which was passed through to
``get_confirmation_code``.
The maximum age in seconds of the link has to be specified as ``m... | def decode(code, *, max_age):
"""decode(code, *, max_age)
Decodes the code from the registration link and returns a tuple consisting
of the verified email address and the payload which was passed through to
``get_confirmation_code``.
The maximum age in seconds of the link has to be specified as ``m... | [
"decode",
"(",
"code",
"*",
"max_age",
")",
"Decodes",
"the",
"code",
"from",
"the",
"registration",
"link",
"and",
"returns",
"a",
"tuple",
"consisting",
"of",
"the",
"verified",
"email",
"address",
"and",
"the",
"payload",
"which",
"was",
"passed",
"throug... | matthiask/django-authlib | python | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/email.py#L118-L146 | [
"def",
"decode",
"(",
"code",
",",
"*",
",",
"max_age",
")",
":",
"try",
":",
"data",
"=",
"get_signer",
"(",
")",
".",
"unsign",
"(",
"code",
",",
"max_age",
"=",
"max_age",
")",
"except",
"signing",
".",
"SignatureExpired",
":",
"raise",
"ValidationE... | a142da7e27fe9d30f34a84b12f24f686f9d2c8e1 |
train | do_some_work | do_some_work
:param work_dict: dictionary for key/values | celery_loaders/work_tasks/tasks.py | def do_some_work(
self,
work_dict):
"""do_some_work
:param work_dict: dictionary for key/values
"""
label = "do_some_work"
log.info(("task - {} - start "
"work_dict={}")
.format(label,
work_dict))
ret_data = {
"job_resul... | def do_some_work(
self,
work_dict):
"""do_some_work
:param work_dict: dictionary for key/values
"""
label = "do_some_work"
log.info(("task - {} - start "
"work_dict={}")
.format(label,
work_dict))
ret_data = {
"job_resul... | [
"do_some_work"
] | jay-johnson/celery-loaders | python | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/tasks.py#L15-L40 | [
"def",
"do_some_work",
"(",
"self",
",",
"work_dict",
")",
":",
"label",
"=",
"\"do_some_work\"",
"log",
".",
"info",
"(",
"(",
"\"task - {} - start \"",
"\"work_dict={}\"",
")",
".",
"format",
"(",
"label",
",",
"work_dict",
")",
")",
"ret_data",
"=",
"{",
... | aca8169c774582af42a377c27cb3980020080814 |
train | create_record | Builds route53 record entries enabling DNS names for services
Note: gcdt.route53 create_record(awsclient, ...)
is used in dataplatform cloudformation.py templates!
:param name_prefix: The sub domain prefix to use
:param instance_reference: The EC2 troposphere reference which's private IP should be link... | gcdt/route53.py | def create_record(awsclient, name_prefix, instance_reference, type="A", host_zone_name=None):
"""
Builds route53 record entries enabling DNS names for services
Note: gcdt.route53 create_record(awsclient, ...)
is used in dataplatform cloudformation.py templates!
:param name_prefix: The sub domain pr... | def create_record(awsclient, name_prefix, instance_reference, type="A", host_zone_name=None):
"""
Builds route53 record entries enabling DNS names for services
Note: gcdt.route53 create_record(awsclient, ...)
is used in dataplatform cloudformation.py templates!
:param name_prefix: The sub domain pr... | [
"Builds",
"route53",
"record",
"entries",
"enabling",
"DNS",
"names",
"for",
"services",
"Note",
":",
"gcdt",
".",
"route53",
"create_record",
"(",
"awsclient",
"...",
")",
"is",
"used",
"in",
"dataplatform",
"cloudformation",
".",
"py",
"templates!"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/route53.py#L24-L70 | [
"def",
"create_record",
"(",
"awsclient",
",",
"name_prefix",
",",
"instance_reference",
",",
"type",
"=",
"\"A\"",
",",
"host_zone_name",
"=",
"None",
")",
":",
"# Only fetch the host zone from the COPS stack if nessary",
"if",
"host_zone_name",
"is",
"None",
":",
"h... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _retrieve_stack_host_zone_name | Use service discovery to get the host zone name from the default stack
:return: Host zone name as string | gcdt/route53.py | def _retrieve_stack_host_zone_name(awsclient, default_stack_name=None):
"""
Use service discovery to get the host zone name from the default stack
:return: Host zone name as string
"""
global _host_zone_name
if _host_zone_name is not None:
return _host_zone_name
env = get_env()
... | def _retrieve_stack_host_zone_name(awsclient, default_stack_name=None):
"""
Use service discovery to get the host zone name from the default stack
:return: Host zone name as string
"""
global _host_zone_name
if _host_zone_name is not None:
return _host_zone_name
env = get_env()
... | [
"Use",
"service",
"discovery",
"to",
"get",
"the",
"host",
"zone",
"name",
"from",
"the",
"default",
"stack"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/route53.py#L73-L105 | [
"def",
"_retrieve_stack_host_zone_name",
"(",
"awsclient",
",",
"default_stack_name",
"=",
"None",
")",
":",
"global",
"_host_zone_name",
"if",
"_host_zone_name",
"is",
"not",
"None",
":",
"return",
"_host_zone_name",
"env",
"=",
"get_env",
"(",
")",
"if",
"env",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | load_plugins | Load and register installed gcdt plugins. | gcdt/gcdt_plugins.py | def load_plugins(group='gcdt10'):
"""Load and register installed gcdt plugins.
"""
# on using entrypoints:
# http://stackoverflow.com/questions/774824/explain-python-entry-points
# TODO: make sure we do not have conflicting generators installed!
for ep in pkg_resources.iter_entry_points(group, n... | def load_plugins(group='gcdt10'):
"""Load and register installed gcdt plugins.
"""
# on using entrypoints:
# http://stackoverflow.com/questions/774824/explain-python-entry-points
# TODO: make sure we do not have conflicting generators installed!
for ep in pkg_resources.iter_entry_points(group, n... | [
"Load",
"and",
"register",
"installed",
"gcdt",
"plugins",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_plugins.py#L18-L30 | [
"def",
"load_plugins",
"(",
"group",
"=",
"'gcdt10'",
")",
":",
"# on using entrypoints:",
"# http://stackoverflow.com/questions/774824/explain-python-entry-points",
"# TODO: make sure we do not have conflicting generators installed!",
"for",
"ep",
"in",
"pkg_resources",
".",
"iter_e... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_plugin_versions | Load and register installed gcdt plugins. | gcdt/gcdt_plugins.py | def get_plugin_versions(group='gcdt10'):
"""Load and register installed gcdt plugins.
"""
versions = {}
for ep in pkg_resources.iter_entry_points(group, name=None):
versions[ep.dist.project_name] = ep.dist.version
return versions | def get_plugin_versions(group='gcdt10'):
"""Load and register installed gcdt plugins.
"""
versions = {}
for ep in pkg_resources.iter_entry_points(group, name=None):
versions[ep.dist.project_name] = ep.dist.version
return versions | [
"Load",
"and",
"register",
"installed",
"gcdt",
"plugins",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_plugins.py#L33-L40 | [
"def",
"get_plugin_versions",
"(",
"group",
"=",
"'gcdt10'",
")",
":",
"versions",
"=",
"{",
"}",
"for",
"ep",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"group",
",",
"name",
"=",
"None",
")",
":",
"versions",
"[",
"ep",
".",
"dist",
".",
"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | delete_log_group | Delete the specified log group
:param log_group_name: log group name
:return: | gcdt/cloudwatch_logs.py | def delete_log_group(awsclient, log_group_name):
"""Delete the specified log group
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.delete_log_group(
logGroupName=log_group_name
) | def delete_log_group(awsclient, log_group_name):
"""Delete the specified log group
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.delete_log_group(
logGroupName=log_group_name
) | [
"Delete",
"the",
"specified",
"log",
"group"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L18-L28 | [
"def",
"delete_log_group",
"(",
"awsclient",
",",
"log_group_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"response",
"=",
"client_logs",
".",
"delete_log_group",
"(",
"logGroupName",
"=",
"log_group_name",
")"
] | cd67cf416371337b83cb9ca3f696277125703339 |
train | put_retention_policy | Sets the retention of the specified log group
if the log group does not yet exist than it will be created first.
:param log_group_name: log group name
:param retention_in_days: log group name
:return: | gcdt/cloudwatch_logs.py | def put_retention_policy(awsclient, log_group_name, retention_in_days):
"""Sets the retention of the specified log group
if the log group does not yet exist than it will be created first.
:param log_group_name: log group name
:param retention_in_days: log group name
:return:
"""
try:
... | def put_retention_policy(awsclient, log_group_name, retention_in_days):
"""Sets the retention of the specified log group
if the log group does not yet exist than it will be created first.
:param log_group_name: log group name
:param retention_in_days: log group name
:return:
"""
try:
... | [
"Sets",
"the",
"retention",
"of",
"the",
"specified",
"log",
"group",
"if",
"the",
"log",
"group",
"does",
"not",
"yet",
"exist",
"than",
"it",
"will",
"be",
"created",
"first",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L31-L53 | [
"def",
"put_retention_policy",
"(",
"awsclient",
",",
"log_group_name",
",",
"retention_in_days",
")",
":",
"try",
":",
"# Note: for AWS Lambda the log_group is created once the first",
"# log event occurs. So if the log_group does not exist we create it",
"create_log_group",
"(",
"a... | cd67cf416371337b83cb9ca3f696277125703339 |
train | filter_log_events | Note: this is used to retrieve logs in ramuda.
:param log_group_name: log group name
:param start_ts: timestamp
:param end_ts: timestamp
:return: list of log entries | gcdt/cloudwatch_logs.py | def filter_log_events(awsclient, log_group_name, start_ts, end_ts=None):
"""
Note: this is used to retrieve logs in ramuda.
:param log_group_name: log group name
:param start_ts: timestamp
:param end_ts: timestamp
:return: list of log entries
"""
client_logs = awsclient.get_client('logs... | def filter_log_events(awsclient, log_group_name, start_ts, end_ts=None):
"""
Note: this is used to retrieve logs in ramuda.
:param log_group_name: log group name
:param start_ts: timestamp
:param end_ts: timestamp
:return: list of log entries
"""
client_logs = awsclient.get_client('logs... | [
"Note",
":",
"this",
"is",
"used",
"to",
"retrieve",
"logs",
"in",
"ramuda",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L56-L86 | [
"def",
"filter_log_events",
"(",
"awsclient",
",",
"log_group_name",
",",
"start_ts",
",",
"end_ts",
"=",
"None",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"# TODO use all_pages instead!",
"logs",
"=",
"[",
"]",
"next_toke... | cd67cf416371337b83cb9ca3f696277125703339 |
train | describe_log_group | Get info on the specified log group
:param log_group_name: log group name
:return: | gcdt/cloudwatch_logs.py | def describe_log_group(awsclient, log_group_name):
"""Get info on the specified log group
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
request = {
'logGroupNamePrefix': log_group_name,
'limit': 1
}
response = client_logs.... | def describe_log_group(awsclient, log_group_name):
"""Get info on the specified log group
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
request = {
'logGroupNamePrefix': log_group_name,
'limit': 1
}
response = client_logs.... | [
"Get",
"info",
"on",
"the",
"specified",
"log",
"group"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L90-L106 | [
"def",
"describe_log_group",
"(",
"awsclient",
",",
"log_group_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"request",
"=",
"{",
"'logGroupNamePrefix'",
":",
"log_group_name",
",",
"'limit'",
":",
"1",
"}",
"response",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | describe_log_stream | Get info on the specified log stream
:param log_group_name: log group name
:param log_stream_name: log stream
:return: | gcdt/cloudwatch_logs.py | def describe_log_stream(awsclient, log_group_name, log_stream_name):
"""Get info on the specified log stream
:param log_group_name: log group name
:param log_stream_name: log stream
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.describe_log_streams(
... | def describe_log_stream(awsclient, log_group_name, log_stream_name):
"""Get info on the specified log stream
:param log_group_name: log group name
:param log_stream_name: log stream
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.describe_log_streams(
... | [
"Get",
"info",
"on",
"the",
"specified",
"log",
"stream"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L109-L126 | [
"def",
"describe_log_stream",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"response",
"=",
"client_logs",
".",
"describe_log_streams",
"(",
"logGroupName",
"=",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | create_log_group | Creates a log group with the specified name.
:param log_group_name: log group name
:return: | gcdt/cloudwatch_logs.py | def create_log_group(awsclient, log_group_name):
"""Creates a log group with the specified name.
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.create_log_group(
logGroupName=log_group_name,
) | def create_log_group(awsclient, log_group_name):
"""Creates a log group with the specified name.
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.create_log_group(
logGroupName=log_group_name,
) | [
"Creates",
"a",
"log",
"group",
"with",
"the",
"specified",
"name",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L140-L150 | [
"def",
"create_log_group",
"(",
"awsclient",
",",
"log_group_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"response",
"=",
"client_logs",
".",
"create_log_group",
"(",
"logGroupName",
"=",
"log_group_name",
",",
")"
] | cd67cf416371337b83cb9ca3f696277125703339 |
train | create_log_stream | Creates a log stream for the specified log group.
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: | gcdt/cloudwatch_logs.py | def create_log_stream(awsclient, log_group_name, log_stream_name):
"""Creates a log stream for the specified log group.
:param log_group_name: log group name
:param log_stream_name: log stream name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.create_log_st... | def create_log_stream(awsclient, log_group_name, log_stream_name):
"""Creates a log stream for the specified log group.
:param log_group_name: log group name
:param log_stream_name: log stream name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.create_log_st... | [
"Creates",
"a",
"log",
"stream",
"for",
"the",
"specified",
"log",
"group",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L153-L165 | [
"def",
"create_log_stream",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"response",
"=",
"client_logs",
".",
"create_log_stream",
"(",
"logGroupName",
"=",
"log_... | cd67cf416371337b83cb9ca3f696277125703339 |
train | put_log_events | Put log events for the specified log group and stream.
:param log_group_name: log group name
:param log_stream_name: log stream name
:param log_events: [{'timestamp': 123, 'message': 'string'}, ...]
:param sequence_token: the sequence token
:return: next_token | gcdt/cloudwatch_logs.py | def put_log_events(awsclient, log_group_name, log_stream_name, log_events,
sequence_token=None):
"""Put log events for the specified log group and stream.
:param log_group_name: log group name
:param log_stream_name: log stream name
:param log_events: [{'timestamp': 123, 'message': '... | def put_log_events(awsclient, log_group_name, log_stream_name, log_events,
sequence_token=None):
"""Put log events for the specified log group and stream.
:param log_group_name: log group name
:param log_stream_name: log stream name
:param log_events: [{'timestamp': 123, 'message': '... | [
"Put",
"log",
"events",
"for",
"the",
"specified",
"log",
"group",
"and",
"stream",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L168-L191 | [
"def",
"put_log_events",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
",",
"log_events",
",",
"sequence_token",
"=",
"None",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"request",
"=",
"{",
"'logGroupName... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_log_events | Get log events for the specified log group and stream.
this is used in tenkai output instance diagnostics
:param log_group_name: log group name
:param log_stream_name: log stream name
:param start_ts: timestamp
:return: | gcdt/cloudwatch_logs.py | def get_log_events(awsclient, log_group_name, log_stream_name, start_ts=None):
"""Get log events for the specified log group and stream.
this is used in tenkai output instance diagnostics
:param log_group_name: log group name
:param log_stream_name: log stream name
:param start_ts: timestamp
:r... | def get_log_events(awsclient, log_group_name, log_stream_name, start_ts=None):
"""Get log events for the specified log group and stream.
this is used in tenkai output instance diagnostics
:param log_group_name: log group name
:param log_stream_name: log stream name
:param start_ts: timestamp
:r... | [
"Get",
"log",
"events",
"for",
"the",
"specified",
"log",
"group",
"and",
"stream",
".",
"this",
"is",
"used",
"in",
"tenkai",
"output",
"instance",
"diagnostics"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L194-L218 | [
"def",
"get_log_events",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
",",
"start_ts",
"=",
"None",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"request",
"=",
"{",
"'logGroupName'",
":",
"log_group_name"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | check_log_stream_exists | Check
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: True / False | gcdt/cloudwatch_logs.py | def check_log_stream_exists(awsclient, log_group_name, log_stream_name):
"""Check
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: True / False
"""
lg = describe_log_group(awsclient, log_group_name)
if lg and lg['logGroupName'] == log_group_name:
... | def check_log_stream_exists(awsclient, log_group_name, log_stream_name):
"""Check
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: True / False
"""
lg = describe_log_group(awsclient, log_group_name)
if lg and lg['logGroupName'] == log_group_name:
... | [
"Check"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L221-L233 | [
"def",
"check_log_stream_exists",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
")",
":",
"lg",
"=",
"describe_log_group",
"(",
"awsclient",
",",
"log_group_name",
")",
"if",
"lg",
"and",
"lg",
"[",
"'logGroupName'",
"]",
"==",
"log_group_name",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | decode_format_timestamp | Convert unix timestamp (millis) into date & time we use in logs output.
:param timestamp: unix timestamp in millis
:return: date, time in UTC | gcdt/cloudwatch_logs.py | def decode_format_timestamp(timestamp):
"""Convert unix timestamp (millis) into date & time we use in logs output.
:param timestamp: unix timestamp in millis
:return: date, time in UTC
"""
dt = maya.MayaDT(timestamp / 1000).datetime(naive=True)
return dt.strftime('%Y-%m-%d'), dt.strftime('%H:%M... | def decode_format_timestamp(timestamp):
"""Convert unix timestamp (millis) into date & time we use in logs output.
:param timestamp: unix timestamp in millis
:return: date, time in UTC
"""
dt = maya.MayaDT(timestamp / 1000).datetime(naive=True)
return dt.strftime('%Y-%m-%d'), dt.strftime('%H:%M... | [
"Convert",
"unix",
"timestamp",
"(",
"millis",
")",
"into",
"date",
"&",
"time",
"we",
"use",
"in",
"logs",
"output",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L236-L243 | [
"def",
"decode_format_timestamp",
"(",
"timestamp",
")",
":",
"dt",
"=",
"maya",
".",
"MayaDT",
"(",
"timestamp",
"/",
"1000",
")",
".",
"datetime",
"(",
"naive",
"=",
"True",
")",
"return",
"dt",
".",
"strftime",
"(",
"'%Y-%m-%d'",
")",
",",
"dt",
"."... | cd67cf416371337b83cb9ca3f696277125703339 |
train | Config.reload | Reload the configuration from disk returning True if the
configuration has changed from the previous values. | helper/config.py | def reload(self):
"""Reload the configuration from disk returning True if the
configuration has changed from the previous values.
"""
config = self._default_configuration()
if self._file_path:
config.update(self._load_config_file())
if config != self._values:... | def reload(self):
"""Reload the configuration from disk returning True if the
configuration has changed from the previous values.
"""
config = self._default_configuration()
if self._file_path:
config.update(self._load_config_file())
if config != self._values:... | [
"Reload",
"the",
"configuration",
"from",
"disk",
"returning",
"True",
"if",
"the",
"configuration",
"has",
"changed",
"from",
"the",
"previous",
"values",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L102-L113 | [
"def",
"reload",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"_default_configuration",
"(",
")",
"if",
"self",
".",
"_file_path",
":",
"config",
".",
"update",
"(",
"self",
".",
"_load_config_file",
"(",
")",
")",
"if",
"config",
"!=",
"self",
"... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Config._load_config_file | Load the configuration file into memory, returning the content. | helper/config.py | def _load_config_file(self):
"""Load the configuration file into memory, returning the content.
"""
LOGGER.info('Loading configuration from %s', self._file_path)
if self._file_path.endswith('json'):
config = self._load_json_config()
else:
config = self._l... | def _load_config_file(self):
"""Load the configuration file into memory, returning the content.
"""
LOGGER.info('Loading configuration from %s', self._file_path)
if self._file_path.endswith('json'):
config = self._load_json_config()
else:
config = self._l... | [
"Load",
"the",
"configuration",
"file",
"into",
"memory",
"returning",
"the",
"content",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L128-L141 | [
"def",
"_load_config_file",
"(",
"self",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Loading configuration from %s'",
",",
"self",
".",
"_file_path",
")",
"if",
"self",
".",
"_file_path",
".",
"endswith",
"(",
"'json'",
")",
":",
"config",
"=",
"self",
".",
"_... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Config._load_json_config | Load the configuration file in JSON format
:rtype: dict | helper/config.py | def _load_json_config(self):
"""Load the configuration file in JSON format
:rtype: dict
"""
try:
return json.loads(self._read_config())
except ValueError as error:
raise ValueError(
'Could not read configuration file: {}'.format(error)) | def _load_json_config(self):
"""Load the configuration file in JSON format
:rtype: dict
"""
try:
return json.loads(self._read_config())
except ValueError as error:
raise ValueError(
'Could not read configuration file: {}'.format(error)) | [
"Load",
"the",
"configuration",
"file",
"in",
"JSON",
"format"
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L143-L153 | [
"def",
"_load_json_config",
"(",
"self",
")",
":",
"try",
":",
"return",
"json",
".",
"loads",
"(",
"self",
".",
"_read_config",
"(",
")",
")",
"except",
"ValueError",
"as",
"error",
":",
"raise",
"ValueError",
"(",
"'Could not read configuration file: {}'",
"... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Config._load_yaml_config | Loads the configuration file from a .yaml or .yml file
:type: dict | helper/config.py | def _load_yaml_config(self):
"""Loads the configuration file from a .yaml or .yml file
:type: dict
"""
try:
config = self._read_config()
except OSError as error:
raise ValueError('Could not read configuration file: %s' % error)
try:
r... | def _load_yaml_config(self):
"""Loads the configuration file from a .yaml or .yml file
:type: dict
"""
try:
config = self._read_config()
except OSError as error:
raise ValueError('Could not read configuration file: %s' % error)
try:
r... | [
"Loads",
"the",
"configuration",
"file",
"from",
"a",
".",
"yaml",
"or",
".",
"yml",
"file"
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L155-L175 | [
"def",
"_load_yaml_config",
"(",
"self",
")",
":",
"try",
":",
"config",
"=",
"self",
".",
"_read_config",
"(",
")",
"except",
"OSError",
"as",
"error",
":",
"raise",
"ValueError",
"(",
"'Could not read configuration file: %s'",
"%",
"error",
")",
"try",
":",
... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Config._normalize_file_path | Normalize the file path value.
:param str file_path: The file path as passed in
:rtype: str | helper/config.py | def _normalize_file_path(file_path):
"""Normalize the file path value.
:param str file_path: The file path as passed in
:rtype: str
"""
if not file_path:
return None
elif file_path.startswith('s3://') or \
file_path.startswith('http://') or \... | def _normalize_file_path(file_path):
"""Normalize the file path value.
:param str file_path: The file path as passed in
:rtype: str
"""
if not file_path:
return None
elif file_path.startswith('s3://') or \
file_path.startswith('http://') or \... | [
"Normalize",
"the",
"file",
"path",
"value",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L178-L191 | [
"def",
"_normalize_file_path",
"(",
"file_path",
")",
":",
"if",
"not",
"file_path",
":",
"return",
"None",
"elif",
"file_path",
".",
"startswith",
"(",
"'s3://'",
")",
"or",
"file_path",
".",
"startswith",
"(",
"'http://'",
")",
"or",
"file_path",
".",
"sta... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Config._read_config | Read the configuration from the various places it may be read from.
:rtype: str
:raises: ValueError | helper/config.py | def _read_config(self):
"""Read the configuration from the various places it may be read from.
:rtype: str
:raises: ValueError
"""
if not self._file_path:
return None
elif self._file_path.startswith('s3://'):
return self._read_s3_config()
... | def _read_config(self):
"""Read the configuration from the various places it may be read from.
:rtype: str
:raises: ValueError
"""
if not self._file_path:
return None
elif self._file_path.startswith('s3://'):
return self._read_s3_config()
... | [
"Read",
"the",
"configuration",
"from",
"the",
"various",
"places",
"it",
"may",
"be",
"read",
"from",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L193-L212 | [
"def",
"_read_config",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_file_path",
":",
"return",
"None",
"elif",
"self",
".",
"_file_path",
".",
"startswith",
"(",
"'s3://'",
")",
":",
"return",
"self",
".",
"_read_s3_config",
"(",
")",
"elif",
"self... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Config._read_remote_config | Read a remote config via URL.
:rtype: str
:raises: ValueError | helper/config.py | def _read_remote_config(self):
"""Read a remote config via URL.
:rtype: str
:raises: ValueError
"""
try:
import requests
except ImportError:
requests = None
if not requests:
raise ValueError(
'Remote config URL... | def _read_remote_config(self):
"""Read a remote config via URL.
:rtype: str
:raises: ValueError
"""
try:
import requests
except ImportError:
requests = None
if not requests:
raise ValueError(
'Remote config URL... | [
"Read",
"a",
"remote",
"config",
"via",
"URL",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L214-L233 | [
"def",
"_read_remote_config",
"(",
"self",
")",
":",
"try",
":",
"import",
"requests",
"except",
"ImportError",
":",
"requests",
"=",
"None",
"if",
"not",
"requests",
":",
"raise",
"ValueError",
"(",
"'Remote config URL specified but requests not installed'",
")",
"... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Config._read_s3_config | Read in the value of the configuration file in Amazon S3.
:rtype: str
:raises: ValueError | helper/config.py | def _read_s3_config(self):
"""Read in the value of the configuration file in Amazon S3.
:rtype: str
:raises: ValueError
"""
try:
import boto3
import botocore.exceptions
except ImportError:
boto3, botocore = None, None
if not ... | def _read_s3_config(self):
"""Read in the value of the configuration file in Amazon S3.
:rtype: str
:raises: ValueError
"""
try:
import boto3
import botocore.exceptions
except ImportError:
boto3, botocore = None, None
if not ... | [
"Read",
"in",
"the",
"value",
"of",
"the",
"configuration",
"file",
"in",
"Amazon",
"S3",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L235-L259 | [
"def",
"_read_s3_config",
"(",
"self",
")",
":",
"try",
":",
"import",
"boto3",
"import",
"botocore",
".",
"exceptions",
"except",
"ImportError",
":",
"boto3",
",",
"botocore",
"=",
"None",
",",
"None",
"if",
"not",
"boto3",
":",
"raise",
"ValueError",
"("... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | LoggingConfig.update | Update the internal configuration values, removing debug_only
handlers if debug is False. Returns True if the configuration has
changed from previous configuration values.
:param dict configuration: The logging configuration
:param bool debug: Toggles use of debug_only loggers
:... | helper/config.py | def update(self, configuration, debug=None):
"""Update the internal configuration values, removing debug_only
handlers if debug is False. Returns True if the configuration has
changed from previous configuration values.
:param dict configuration: The logging configuration
:param... | def update(self, configuration, debug=None):
"""Update the internal configuration values, removing debug_only
handlers if debug is False. Returns True if the configuration has
changed from previous configuration values.
:param dict configuration: The logging configuration
:param... | [
"Update",
"the",
"internal",
"configuration",
"values",
"removing",
"debug_only",
"handlers",
"if",
"debug",
"is",
"False",
".",
"Returns",
"True",
"if",
"the",
"configuration",
"has",
"changed",
"from",
"previous",
"configuration",
"values",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L288-L303 | [
"def",
"update",
"(",
"self",
",",
"configuration",
",",
"debug",
"=",
"None",
")",
":",
"if",
"self",
".",
"config",
"!=",
"dict",
"(",
"configuration",
")",
"and",
"debug",
"!=",
"self",
".",
"debug",
":",
"self",
".",
"config",
"=",
"dict",
"(",
... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | LoggingConfig.configure | Configure the Python stdlib logger | helper/config.py | def configure(self):
"""Configure the Python stdlib logger"""
if self.debug is not None and not self.debug:
self._remove_debug_handlers()
self._remove_debug_only()
logging.config.dictConfig(self.config)
try:
logging.captureWarnings(True)
except Att... | def configure(self):
"""Configure the Python stdlib logger"""
if self.debug is not None and not self.debug:
self._remove_debug_handlers()
self._remove_debug_only()
logging.config.dictConfig(self.config)
try:
logging.captureWarnings(True)
except Att... | [
"Configure",
"the",
"Python",
"stdlib",
"logger"
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L305-L314 | [
"def",
"configure",
"(",
"self",
")",
":",
"if",
"self",
".",
"debug",
"is",
"not",
"None",
"and",
"not",
"self",
".",
"debug",
":",
"self",
".",
"_remove_debug_handlers",
"(",
")",
"self",
".",
"_remove_debug_only",
"(",
")",
"logging",
".",
"config",
... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | LoggingConfig._remove_debug_handlers | Remove any handlers with an attribute of debug_only that is True and
remove the references to said handlers from any loggers that are
referencing them. | helper/config.py | def _remove_debug_handlers(self):
"""Remove any handlers with an attribute of debug_only that is True and
remove the references to said handlers from any loggers that are
referencing them.
"""
remove = list()
for handler in self.config[self.HANDLERS]:
if self... | def _remove_debug_handlers(self):
"""Remove any handlers with an attribute of debug_only that is True and
remove the references to said handlers from any loggers that are
referencing them.
"""
remove = list()
for handler in self.config[self.HANDLERS]:
if self... | [
"Remove",
"any",
"handlers",
"with",
"an",
"attribute",
"of",
"debug_only",
"that",
"is",
"True",
"and",
"remove",
"the",
"references",
"to",
"said",
"handlers",
"from",
"any",
"loggers",
"that",
"are",
"referencing",
"them",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L316-L332 | [
"def",
"_remove_debug_handlers",
"(",
"self",
")",
":",
"remove",
"=",
"list",
"(",
")",
"for",
"handler",
"in",
"self",
".",
"config",
"[",
"self",
".",
"HANDLERS",
"]",
":",
"if",
"self",
".",
"config",
"[",
"self",
".",
"HANDLERS",
"]",
"[",
"hand... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | LoggingConfig._remove_debug_only | Iterate through each handler removing the invalid dictConfig key of
debug_only. | helper/config.py | def _remove_debug_only(self):
"""Iterate through each handler removing the invalid dictConfig key of
debug_only.
"""
LOGGER.debug('Removing debug only from handlers')
for handler in self.config[self.HANDLERS]:
if self.DEBUG_ONLY in self.config[self.HANDLERS][handler]... | def _remove_debug_only(self):
"""Iterate through each handler removing the invalid dictConfig key of
debug_only.
"""
LOGGER.debug('Removing debug only from handlers')
for handler in self.config[self.HANDLERS]:
if self.DEBUG_ONLY in self.config[self.HANDLERS][handler]... | [
"Iterate",
"through",
"each",
"handler",
"removing",
"the",
"invalid",
"dictConfig",
"key",
"of",
"debug_only",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L334-L342 | [
"def",
"_remove_debug_only",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"'Removing debug only from handlers'",
")",
"for",
"handler",
"in",
"self",
".",
"config",
"[",
"self",
".",
"HANDLERS",
"]",
":",
"if",
"self",
".",
"DEBUG_ONLY",
"in",
"self",... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Serializable.as_dictionary | Convert this object to a dictionary with formatting appropriate for a PIF.
:returns: Dictionary with the content of this object formatted for a PIF. | pypif/util/serializable.py | def as_dictionary(self):
"""
Convert this object to a dictionary with formatting appropriate for a PIF.
:returns: Dictionary with the content of this object formatted for a PIF.
"""
return {to_camel_case(i): Serializable._convert_to_dictionary(self.__dict__[i])
f... | def as_dictionary(self):
"""
Convert this object to a dictionary with formatting appropriate for a PIF.
:returns: Dictionary with the content of this object formatted for a PIF.
"""
return {to_camel_case(i): Serializable._convert_to_dictionary(self.__dict__[i])
f... | [
"Convert",
"this",
"object",
"to",
"a",
"dictionary",
"with",
"formatting",
"appropriate",
"for",
"a",
"PIF",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/serializable.py#L10-L17 | [
"def",
"as_dictionary",
"(",
"self",
")",
":",
"return",
"{",
"to_camel_case",
"(",
"i",
")",
":",
"Serializable",
".",
"_convert_to_dictionary",
"(",
"self",
".",
"__dict__",
"[",
"i",
"]",
")",
"for",
"i",
"in",
"self",
".",
"__dict__",
"if",
"self",
... | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | Serializable._convert_to_dictionary | Convert obj to a dictionary with formatting appropriate for a PIF. This function attempts to treat obj as
a Pio object and otherwise returns obj.
:param obj: Object to convert to a dictionary.
:returns: Input object as a dictionary or the original object. | pypif/util/serializable.py | def _convert_to_dictionary(obj):
"""
Convert obj to a dictionary with formatting appropriate for a PIF. This function attempts to treat obj as
a Pio object and otherwise returns obj.
:param obj: Object to convert to a dictionary.
:returns: Input object as a dictionary or the ori... | def _convert_to_dictionary(obj):
"""
Convert obj to a dictionary with formatting appropriate for a PIF. This function attempts to treat obj as
a Pio object and otherwise returns obj.
:param obj: Object to convert to a dictionary.
:returns: Input object as a dictionary or the ori... | [
"Convert",
"obj",
"to",
"a",
"dictionary",
"with",
"formatting",
"appropriate",
"for",
"a",
"PIF",
".",
"This",
"function",
"attempts",
"to",
"treat",
"obj",
"as",
"a",
"Pio",
"object",
"and",
"otherwise",
"returns",
"obj",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/serializable.py#L20-L33 | [
"def",
"_convert_to_dictionary",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"[",
"Serializable",
".",
"_convert_to_dictionary",
"(",
"i",
")",
"for",
"i",
"in",
"obj",
"]",
"elif",
"hasattr",
"(",
"obj",
",",
... | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | Serializable._get_object | Helper function that returns an object, or if it is a dictionary, initializes it from class_.
:param class_: Class to use to instantiate object.
:param obj: Object to process.
:return: One or more objects. | pypif/util/serializable.py | def _get_object(class_, obj):
"""
Helper function that returns an object, or if it is a dictionary, initializes it from class_.
:param class_: Class to use to instantiate object.
:param obj: Object to process.
:return: One or more objects.
"""
if isinstance(obj, ... | def _get_object(class_, obj):
"""
Helper function that returns an object, or if it is a dictionary, initializes it from class_.
:param class_: Class to use to instantiate object.
:param obj: Object to process.
:return: One or more objects.
"""
if isinstance(obj, ... | [
"Helper",
"function",
"that",
"returns",
"an",
"object",
"or",
"if",
"it",
"is",
"a",
"dictionary",
"initializes",
"it",
"from",
"class_",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/serializable.py#L36-L49 | [
"def",
"_get_object",
"(",
"class_",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"[",
"Serializable",
".",
"_get_object",
"(",
"class_",
",",
"i",
")",
"for",
"i",
"in",
"obj",
"]",
"elif",
"isinstance",
"("... | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | damping | Calculates the damping factor for sound in dB/m
depending on temperature, humidity and sound frequency.
Source: http://www.sengpielaudio.com/LuftdaempfungFormel.htm
temp: Temperature in degrees celsius
relhum: Relative humidity as percentage, e.g. 50
freq: Sound frequency in herz
pres: Atmosphe... | audiocalc/py_audiocalc.py | def damping(temp, relhum, freq, pres=101325):
"""
Calculates the damping factor for sound in dB/m
depending on temperature, humidity and sound frequency.
Source: http://www.sengpielaudio.com/LuftdaempfungFormel.htm
temp: Temperature in degrees celsius
relhum: Relative humidity as percentage, e.... | def damping(temp, relhum, freq, pres=101325):
"""
Calculates the damping factor for sound in dB/m
depending on temperature, humidity and sound frequency.
Source: http://www.sengpielaudio.com/LuftdaempfungFormel.htm
temp: Temperature in degrees celsius
relhum: Relative humidity as percentage, e.... | [
"Calculates",
"the",
"damping",
"factor",
"for",
"sound",
"in",
"dB",
"/",
"m",
"depending",
"on",
"temperature",
"humidity",
"and",
"sound",
"frequency",
".",
"Source",
":",
"http",
":",
"//",
"www",
".",
"sengpielaudio",
".",
"com",
"/",
"LuftdaempfungForm... | marians/audiocalc | python | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L19-L51 | [
"def",
"damping",
"(",
"temp",
",",
"relhum",
",",
"freq",
",",
"pres",
"=",
"101325",
")",
":",
"temp",
"+=",
"273.15",
"# convert to kelvin",
"pres",
"=",
"pres",
"/",
"101325.0",
"# convert to relative pressure",
"c_humid",
"=",
"4.6151",
"-",
"6.8346",
"... | ef917b05d9dddc5a3a44165112835669ef4808d3 |
train | total_level | Calculates the total sound pressure level based on multiple source levels | audiocalc/py_audiocalc.py | def total_level(source_levels):
"""
Calculates the total sound pressure level based on multiple source levels
"""
sums = 0.0
for l in source_levels:
if l is None:
continue
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
level = 10.0 * math.l... | def total_level(source_levels):
"""
Calculates the total sound pressure level based on multiple source levels
"""
sums = 0.0
for l in source_levels:
if l is None:
continue
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
level = 10.0 * math.l... | [
"Calculates",
"the",
"total",
"sound",
"pressure",
"level",
"based",
"on",
"multiple",
"source",
"levels"
] | marians/audiocalc | python | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L54-L66 | [
"def",
"total_level",
"(",
"source_levels",
")",
":",
"sums",
"=",
"0.0",
"for",
"l",
"in",
"source_levels",
":",
"if",
"l",
"is",
"None",
":",
"continue",
"if",
"l",
"==",
"0",
":",
"continue",
"sums",
"+=",
"pow",
"(",
"10.0",
",",
"float",
"(",
... | ef917b05d9dddc5a3a44165112835669ef4808d3 |
train | total_rated_level | Calculates the A-rated total sound pressure level
based on octave band frequencies | audiocalc/py_audiocalc.py | def total_rated_level(octave_frequencies):
"""
Calculates the A-rated total sound pressure level
based on octave band frequencies
"""
sums = 0.0
for band in OCTAVE_BANDS.keys():
if band not in octave_frequencies:
continue
if octave_frequencies[band] is None:
... | def total_rated_level(octave_frequencies):
"""
Calculates the A-rated total sound pressure level
based on octave band frequencies
"""
sums = 0.0
for band in OCTAVE_BANDS.keys():
if band not in octave_frequencies:
continue
if octave_frequencies[band] is None:
... | [
"Calculates",
"the",
"A",
"-",
"rated",
"total",
"sound",
"pressure",
"level",
"based",
"on",
"octave",
"band",
"frequencies"
] | marians/audiocalc | python | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L69-L84 | [
"def",
"total_rated_level",
"(",
"octave_frequencies",
")",
":",
"sums",
"=",
"0.0",
"for",
"band",
"in",
"OCTAVE_BANDS",
".",
"keys",
"(",
")",
":",
"if",
"band",
"not",
"in",
"octave_frequencies",
":",
"continue",
"if",
"octave_frequencies",
"[",
"band",
"... | ef917b05d9dddc5a3a44165112835669ef4808d3 |
train | leq3 | Calculates the energy-equivalent (Leq3) value
given a regular measurement interval. | audiocalc/py_audiocalc.py | def leq3(levels):
"""
Calculates the energy-equivalent (Leq3) value
given a regular measurement interval.
"""
n = float(len(levels))
sums = 0.0
if sum(levels) == 0.0:
return 0.0
for l in levels:
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
... | def leq3(levels):
"""
Calculates the energy-equivalent (Leq3) value
given a regular measurement interval.
"""
n = float(len(levels))
sums = 0.0
if sum(levels) == 0.0:
return 0.0
for l in levels:
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
... | [
"Calculates",
"the",
"energy",
"-",
"equivalent",
"(",
"Leq3",
")",
"value",
"given",
"a",
"regular",
"measurement",
"interval",
"."
] | marians/audiocalc | python | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L87-L102 | [
"def",
"leq3",
"(",
"levels",
")",
":",
"n",
"=",
"float",
"(",
"len",
"(",
"levels",
")",
")",
"sums",
"=",
"0.0",
"if",
"sum",
"(",
"levels",
")",
"==",
"0.0",
":",
"return",
"0.0",
"for",
"l",
"in",
"levels",
":",
"if",
"l",
"==",
"0",
":"... | ef917b05d9dddc5a3a44165112835669ef4808d3 |
train | distant_level | Calculates the sound pressure level
in dependence of a distance
where a perfect ball-shaped source and spread is assumed.
reference_level: Sound pressure level in reference distance in dB
distance: Distance to calculate sound pressure level for, in meters
reference_distance: reference distance in m... | audiocalc/py_audiocalc.py | def distant_level(reference_level, distance, reference_distance=1.0):
"""
Calculates the sound pressure level
in dependence of a distance
where a perfect ball-shaped source and spread is assumed.
reference_level: Sound pressure level in reference distance in dB
distance: Distance to calculate s... | def distant_level(reference_level, distance, reference_distance=1.0):
"""
Calculates the sound pressure level
in dependence of a distance
where a perfect ball-shaped source and spread is assumed.
reference_level: Sound pressure level in reference distance in dB
distance: Distance to calculate s... | [
"Calculates",
"the",
"sound",
"pressure",
"level",
"in",
"dependence",
"of",
"a",
"distance",
"where",
"a",
"perfect",
"ball",
"-",
"shaped",
"source",
"and",
"spread",
"is",
"assumed",
"."
] | marians/audiocalc | python | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L105-L117 | [
"def",
"distant_level",
"(",
"reference_level",
",",
"distance",
",",
"reference_distance",
"=",
"1.0",
")",
":",
"rel_dist",
"=",
"float",
"(",
"reference_distance",
")",
"/",
"float",
"(",
"distance",
")",
"level",
"=",
"float",
"(",
"reference_level",
")",
... | ef917b05d9dddc5a3a44165112835669ef4808d3 |
train | distant_total_damped_rated_level | Calculates the damped, A-rated total sound pressure level
in a given distance, temperature and relative humidity
from octave frequency sound pressure levels in a reference distance | audiocalc/py_audiocalc.py | def distant_total_damped_rated_level(
octave_frequencies,
distance,
temp,
relhum,
reference_distance=1.0):
"""
Calculates the damped, A-rated total sound pressure level
in a given distance, temperature and relative humidity
from octave frequenc... | def distant_total_damped_rated_level(
octave_frequencies,
distance,
temp,
relhum,
reference_distance=1.0):
"""
Calculates the damped, A-rated total sound pressure level
in a given distance, temperature and relative humidity
from octave frequenc... | [
"Calculates",
"the",
"damped",
"A",
"-",
"rated",
"total",
"sound",
"pressure",
"level",
"in",
"a",
"given",
"distance",
"temperature",
"and",
"relative",
"humidity",
"from",
"octave",
"frequency",
"sound",
"pressure",
"levels",
"in",
"a",
"reference",
"distance... | marians/audiocalc | python | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L120-L154 | [
"def",
"distant_total_damped_rated_level",
"(",
"octave_frequencies",
",",
"distance",
",",
"temp",
",",
"relhum",
",",
"reference_distance",
"=",
"1.0",
")",
":",
"damping_distance",
"=",
"distance",
"-",
"reference_distance",
"sums",
"=",
"0.0",
"for",
"band",
"... | ef917b05d9dddc5a3a44165112835669ef4808d3 |
train | Shift.ASRS | ASRS [Ra,] Ra, Rc
ASRS [Ra,] Rb, #imm5_counting
Arithmetic shift right Rb by Rc or imm5_counting and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
If Ra is omit... | iarm/arm_instructions/shift.py | def ASRS(self, params):
"""
ASRS [Ra,] Ra, Rc
ASRS [Ra,] Rb, #imm5_counting
Arithmetic shift right Rb by Rc or imm5_counting and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc... | def ASRS(self, params):
"""
ASRS [Ra,] Ra, Rc
ASRS [Ra,] Rb, #imm5_counting
Arithmetic shift right Rb by Rc or imm5_counting and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc... | [
"ASRS",
"[",
"Ra",
"]",
"Ra",
"Rc",
"ASRS",
"[",
"Ra",
"]",
"Rb",
"#imm5_counting"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/shift.py#L6-L63 | [
"def",
"ASRS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Shift.LSLS | LSLS [Ra,] Ra, Rc
LSLS [Ra,] Rb, #imm5
Logical shift left Rb by Rc or imm5 and store the result in Ra
imm5 is [0, 31]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it is assumed to be R... | iarm/arm_instructions/shift.py | def LSLS(self, params):
"""
LSLS [Ra,] Ra, Rc
LSLS [Ra,] Rb, #imm5
Logical shift left Rb by Rc or imm5 and store the result in Ra
imm5 is [0, 31]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
... | def LSLS(self, params):
"""
LSLS [Ra,] Ra, Rc
LSLS [Ra,] Rb, #imm5
Logical shift left Rb by Rc or imm5 and store the result in Ra
imm5 is [0, 31]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
... | [
"LSLS",
"[",
"Ra",
"]",
"Ra",
"Rc",
"LSLS",
"[",
"Ra",
"]",
"Rb",
"#imm5"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/shift.py#L65-L114 | [
"def",
"LSLS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Shift.LSRS | LSRS [Ra,] Ra, Rc
LSRS [Ra,] Rb, #imm5_counting
Logical shift right Rb by Rc or imm5 and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it... | iarm/arm_instructions/shift.py | def LSRS(self, params):
"""
LSRS [Ra,] Ra, Rc
LSRS [Ra,] Rb, #imm5_counting
Logical shift right Rb by Rc or imm5 and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low... | def LSRS(self, params):
"""
LSRS [Ra,] Ra, Rc
LSRS [Ra,] Rb, #imm5_counting
Logical shift right Rb by Rc or imm5 and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low... | [
"LSRS",
"[",
"Ra",
"]",
"Ra",
"Rc",
"LSRS",
"[",
"Ra",
"]",
"Rb",
"#imm5_counting"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/shift.py#L116-L165 | [
"def",
"LSRS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Shift.RORS | RORS [Ra,] Ra, Rc
Rotate shift right Rb by Rc or imm5 and store the result in Ra
The first two operands must be the same register
Ra and Rc must be low registers
The first register is optional | iarm/arm_instructions/shift.py | def RORS(self, params):
"""
RORS [Ra,] Ra, Rc
Rotate shift right Rb by Rc or imm5 and store the result in Ra
The first two operands must be the same register
Ra and Rc must be low registers
The first register is optional
"""
# This instruction allows for ... | def RORS(self, params):
"""
RORS [Ra,] Ra, Rc
Rotate shift right Rb by Rc or imm5 and store the result in Ra
The first two operands must be the same register
Ra and Rc must be low registers
The first register is optional
"""
# This instruction allows for ... | [
"RORS",
"[",
"Ra",
"]",
"Ra",
"Rc"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/shift.py#L167-L197 | [
"def",
"RORS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Group._parse_topic_table | 解析话题列表
:internal
:param xml: 页面XML
:param tds: 每列的含义,可以是title, created, comment, group, updated, author, time, rec
:param selector: 表在页面中的位置
:return: | dbapi/Group.py | def _parse_topic_table(self, xml, tds='title,created,comment,group', selector='//table[@class="olt"]//tr'):
"""
解析话题列表
:internal
:param xml: 页面XML
:param tds: 每列的含义,可以是title, created, comment, group, updated, author, time, rec
:param selector: 表在页面中的位置
:... | def _parse_topic_table(self, xml, tds='title,created,comment,group', selector='//table[@class="olt"]//tr'):
"""
解析话题列表
:internal
:param xml: 页面XML
:param tds: 每列的含义,可以是title, created, comment, group, updated, author, time, rec
:param selector: 表在页面中的位置
:... | [
"解析话题列表",
":",
"internal",
":",
"param",
"xml",
":",
"页面XML",
":",
"param",
"tds",
":",
"每列的含义,可以是title",
"created",
"comment",
"group",
"updated",
"author",
"time",
"rec",
":",
"param",
"selector",
":",
"表在页面中的位置",
":",
"return",
":"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L29-L90 | [
"def",
"_parse_topic_table",
"(",
"self",
",",
"xml",
",",
"tds",
"=",
"'title,created,comment,group'",
",",
"selector",
"=",
"'//table[@class=\"olt\"]//tr'",
")",
":",
"xml_results",
"=",
"xml",
".",
"xpath",
"(",
"selector",
")",
"results",
"=",
"[",
"]",
"t... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.search_groups | 搜索小组
:param keyword: 搜索的关键字
:param start: 翻页
:return: 含总数的列表 | dbapi/Group.py | def search_groups(self, keyword, start=0):
"""
搜索小组
:param keyword: 搜索的关键字
:param start: 翻页
:return: 含总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_GROUPS % (start, keyword))
xml_results = xml.xpath('//div[@class="groups"]/div[@class="result"]')
... | def search_groups(self, keyword, start=0):
"""
搜索小组
:param keyword: 搜索的关键字
:param start: 翻页
:return: 含总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_GROUPS % (start, keyword))
xml_results = xml.xpath('//div[@class="groups"]/div[@class="result"]')
... | [
"搜索小组",
":",
"param",
"keyword",
":",
"搜索的关键字",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"含总数的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L101-L129 | [
"def",
"search_groups",
"(",
"self",
",",
"keyword",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_SEARCH_GROUPS",
"%",
"(",
"start",
",",
"keyword",
")",
")",
"xml_results",
"=",
"xml",
".",
"xpath",
"... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_joined_groups | 已加入的小组列表
:param user_alias: 用户名,默认为当前用户名
:return: 单页列表 | dbapi/Group.py | def list_joined_groups(self, user_alias=None):
"""
已加入的小组列表
:param user_alias: 用户名,默认为当前用户名
:return: 单页列表
"""
xml = self.api.xml(API_GROUP_LIST_JOINED_GROUPS % (user_alias or self.api.user_alias))
xml_results = xml.xpath('//div[@class="group-list group-ca... | def list_joined_groups(self, user_alias=None):
"""
已加入的小组列表
:param user_alias: 用户名,默认为当前用户名
:return: 单页列表
"""
xml = self.api.xml(API_GROUP_LIST_JOINED_GROUPS % (user_alias or self.api.user_alias))
xml_results = xml.xpath('//div[@class="group-list group-ca... | [
"已加入的小组列表",
":",
"param",
"user_alias",
":",
"用户名,默认为当前用户名",
":",
"return",
":",
"单页列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L131-L158 | [
"def",
"list_joined_groups",
"(",
"self",
",",
"user_alias",
"=",
"None",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_JOINED_GROUPS",
"%",
"(",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
")",
")",
"xml_results... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.join_group | 加入小组
:param group_alias: 小组ID
:param message: 如果要验证,留言信息
:return: 枚举
- joined: 加入成功
- waiting: 等待审核
- initial: 加入失败 | dbapi/Group.py | def join_group(self, group_alias, message=None):
"""
加入小组
:param group_alias: 小组ID
:param message: 如果要验证,留言信息
:return: 枚举
- joined: 加入成功
- waiting: 等待审核
- initial: 加入失败
"""
xml = self.api.xml(API_GROUP_GROUP... | def join_group(self, group_alias, message=None):
"""
加入小组
:param group_alias: 小组ID
:param message: 如果要验证,留言信息
:return: 枚举
- joined: 加入成功
- waiting: 等待审核
- initial: 加入失败
"""
xml = self.api.xml(API_GROUP_GROUP... | [
"加入小组",
":",
"param",
"group_alias",
":",
"小组ID",
":",
"param",
"message",
":",
"如果要验证,留言信息",
":",
"return",
":",
"枚举",
"-",
"joined",
":",
"加入成功",
"-",
"waiting",
":",
"等待审核",
"-",
"initial",
":",
"加入失败"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L169-L204 | [
"def",
"join_group",
"(",
"self",
",",
"group_alias",
",",
"message",
"=",
"None",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_GROUP_HOME",
"%",
"group_alias",
",",
"params",
"=",
"{",
"'action'",
":",
"'join'",
",",
"'ck'",
"... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.leave_group | 退出小组
:param group_alias: 小组ID
:return: | dbapi/Group.py | def leave_group(self, group_alias):
"""
退出小组
:param group_alias: 小组ID
:return:
"""
return self.api.req(API_GROUP_GROUP_HOME % group_alias, params={
'action': 'quit',
'ck': self.api.ck(),
}) | def leave_group(self, group_alias):
"""
退出小组
:param group_alias: 小组ID
:return:
"""
return self.api.req(API_GROUP_GROUP_HOME % group_alias, params={
'action': 'quit',
'ck': self.api.ck(),
}) | [
"退出小组",
":",
"param",
"group_alias",
":",
"小组ID",
":",
"return",
":"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L206-L216 | [
"def",
"leave_group",
"(",
"self",
",",
"group_alias",
")",
":",
"return",
"self",
".",
"api",
".",
"req",
"(",
"API_GROUP_GROUP_HOME",
"%",
"group_alias",
",",
"params",
"=",
"{",
"'action'",
":",
"'quit'",
",",
"'ck'",
":",
"self",
".",
"api",
".",
"... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.search_topics | 搜索话题
:param keyword: 关键字
:param sort: 排序方式 relevance/newest
:param start: 翻页
:return: 带总数的列表 | dbapi/Group.py | def search_topics(self, keyword, sort='relevance', start=0):
"""
搜索话题
:param keyword: 关键字
:param sort: 排序方式 relevance/newest
:param start: 翻页
:return: 带总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_TOPICS % (start, sort, keyword))
return b... | def search_topics(self, keyword, sort='relevance', start=0):
"""
搜索话题
:param keyword: 关键字
:param sort: 排序方式 relevance/newest
:param start: 翻页
:return: 带总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_TOPICS % (start, sort, keyword))
return b... | [
"搜索话题",
":",
"param",
"keyword",
":",
"关键字",
":",
"param",
"sort",
":",
"排序方式",
"relevance",
"/",
"newest",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带总数的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L218-L228 | [
"def",
"search_topics",
"(",
"self",
",",
"keyword",
",",
"sort",
"=",
"'relevance'",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_SEARCH_TOPICS",
"%",
"(",
"start",
",",
"sort",
",",
"keyword",
")",
"... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_topics | 小组内话题列表
:param group_alias: 小组ID
:param _type: 类型 默认最新,hot:最热
:param start: 翻页
:return: 带下一页的列表 | dbapi/Group.py | def list_topics(self, group_alias, _type='', start=0):
"""
小组内话题列表
:param group_alias: 小组ID
:param _type: 类型 默认最新,hot:最热
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_GROUP_TOPICS % group_alias, params={
'star... | def list_topics(self, group_alias, _type='', start=0):
"""
小组内话题列表
:param group_alias: 小组ID
:param _type: 类型 默认最新,hot:最热
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_GROUP_TOPICS % group_alias, params={
'star... | [
"小组内话题列表",
":",
"param",
"group_alias",
":",
"小组ID",
":",
"param",
"_type",
":",
"类型",
"默认最新,hot",
":",
"最热",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L230-L243 | [
"def",
"list_topics",
"(",
"self",
",",
"group_alias",
",",
"_type",
"=",
"''",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_GROUP_TOPICS",
"%",
"group_alias",
",",
"params",
"=",
"{",
"'start'",
":... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_joined_topics | 已加入的所有小组的话题列表
:param start: 翻页
:return: 带下一页的列表 | dbapi/Group.py | def list_joined_topics(self, start=0):
"""
已加入的所有小组的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_HOME, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comment,created,group'), xml) | def list_joined_topics(self, start=0):
"""
已加入的所有小组的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_HOME, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comment,created,group'), xml) | [
"已加入的所有小组的话题列表",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L245-L253 | [
"def",
"list_joined_topics",
"(",
"self",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_HOME",
",",
"params",
"=",
"{",
"'start'",
":",
"start",
"}",
")",
"return",
"build_list_result",
"(",
"self",
".",
... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_user_topics | 发表的话题
:param start: 翻页
:return: 带下一页的列表 | dbapi/Group.py | def list_user_topics(self, start=0):
"""
发表的话题
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comme... | def list_user_topics(self, start=0):
"""
发表的话题
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comme... | [
"发表的话题",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L255-L263 | [
"def",
"list_user_topics",
"(",
"self",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_USER_PUBLISHED_TOPICS",
"%",
"self",
".",
"api",
".",
"user_alias",
",",
"params",
"=",
"{",
"'start'",
":",
"start... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_commented_topics | 回复过的话题列表
:param start: 翻页
:return: 带下一页的列表 | dbapi/Group.py | def list_commented_topics(self, start=0):
"""
回复过的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_COMMENTED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'tit... | def list_commented_topics(self, start=0):
"""
回复过的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_COMMENTED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'tit... | [
"回复过的话题列表",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L265-L273 | [
"def",
"list_commented_topics",
"(",
"self",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_USER_COMMENTED_TOPICS",
"%",
"self",
".",
"api",
".",
"user_alias",
",",
"params",
"=",
"{",
"'start'",
":",
"... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_liked_topics | 喜欢过的话题
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表 | dbapi/Group.py | def list_liked_topics(self, user_alias=None, start=0):
"""
喜欢过的话题
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_alias or self.api.user_alias
xml = self.api.xml(API_GROUP_LIST_USER_LIKED_TOPICS % user_alias, p... | def list_liked_topics(self, user_alias=None, start=0):
"""
喜欢过的话题
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_alias or self.api.user_alias
xml = self.api.xml(API_GROUP_LIST_USER_LIKED_TOPICS % user_alias, p... | [
"喜欢过的话题",
":",
"param",
"user_alias",
":",
"指定用户,默认当前",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L275-L285 | [
"def",
"list_liked_topics",
"(",
"self",
",",
"user_alias",
"=",
"None",
",",
"start",
"=",
"0",
")",
":",
"user_alias",
"=",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_USER... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_reced_topics | 推荐的话题列表
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表 | dbapi/Group.py | def list_reced_topics(self, user_alias=None, start=0):
"""
推荐的话题列表
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_alias or self.api.user_alias
xml = self.api.xml(API_GROUP_LIST_USER_RECED_TOPICS % user_alias, ... | def list_reced_topics(self, user_alias=None, start=0):
"""
推荐的话题列表
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_alias or self.api.user_alias
xml = self.api.xml(API_GROUP_LIST_USER_RECED_TOPICS % user_alias, ... | [
"推荐的话题列表",
":",
"param",
"user_alias",
":",
"指定用户,默认当前",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L287-L297 | [
"def",
"list_reced_topics",
"(",
"self",
",",
"user_alias",
"=",
"None",
",",
"start",
"=",
"0",
")",
":",
"user_alias",
"=",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_USER... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.add_topic | 创建话题(小心验证码~)
:param group_alias: 小组ID
:param title: 标题
:param content: 内容
:return: bool | dbapi/Group.py | def add_topic(self, group_alias, title, content):
"""
创建话题(小心验证码~)
:param group_alias: 小组ID
:param title: 标题
:param content: 内容
:return: bool
"""
xml = self.api.req(API_GROUP_ADD_TOPIC % group_alias, 'post', data={
'ck': self.api.ck(),... | def add_topic(self, group_alias, title, content):
"""
创建话题(小心验证码~)
:param group_alias: 小组ID
:param title: 标题
:param content: 内容
:return: bool
"""
xml = self.api.req(API_GROUP_ADD_TOPIC % group_alias, 'post', data={
'ck': self.api.ck(),... | [
"创建话题(小心验证码~)",
":",
"param",
"group_alias",
":",
"小组ID",
":",
"param",
"title",
":",
"标题",
":",
"param",
"content",
":",
"内容",
":",
"return",
":",
"bool"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L299-L314 | [
"def",
"add_topic",
"(",
"self",
",",
"group_alias",
",",
"title",
",",
"content",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"req",
"(",
"API_GROUP_ADD_TOPIC",
"%",
"group_alias",
",",
"'post'",
",",
"data",
"=",
"{",
"'ck'",
":",
"self",
".",
"... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.remove_topic | 删除话题(需要先删除所有评论,使用默认参数)
:param topic_id: 话题ID
:return: None | dbapi/Group.py | def remove_topic(self, topic_id):
"""
删除话题(需要先删除所有评论,使用默认参数)
:param topic_id: 话题ID
:return: None
"""
comment_start = 0
while comment_start is not None:
comments = self.list_comments(topic_id, comment_start)
for comment in comments[... | def remove_topic(self, topic_id):
"""
删除话题(需要先删除所有评论,使用默认参数)
:param topic_id: 话题ID
:return: None
"""
comment_start = 0
while comment_start is not None:
comments = self.list_comments(topic_id, comment_start)
for comment in comments[... | [
"删除话题(需要先删除所有评论,使用默认参数)",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"return",
":",
"None"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L343-L356 | [
"def",
"remove_topic",
"(",
"self",
",",
"topic_id",
")",
":",
"comment_start",
"=",
"0",
"while",
"comment_start",
"is",
"not",
"None",
":",
"comments",
"=",
"self",
".",
"list_comments",
"(",
"topic_id",
",",
"comment_start",
")",
"for",
"comment",
"in",
... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.update_topic | 更新话题
:param topic_id: 话题ID
:param title: 标题
:param content: 内容
:return: bool | dbapi/Group.py | def update_topic(self, topic_id, title, content):
"""
更新话题
:param topic_id: 话题ID
:param title: 标题
:param content: 内容
:return: bool
"""
xml = self.api.req(API_GROUP_UPDATE_TOPIC % topic_id, 'post', data={
'ck': self.api.ck(),
... | def update_topic(self, topic_id, title, content):
"""
更新话题
:param topic_id: 话题ID
:param title: 标题
:param content: 内容
:return: bool
"""
xml = self.api.req(API_GROUP_UPDATE_TOPIC % topic_id, 'post', data={
'ck': self.api.ck(),
... | [
"更新话题",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"title",
":",
"标题",
":",
"param",
"content",
":",
"内容",
":",
"return",
":",
"bool"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L358-L373 | [
"def",
"update_topic",
"(",
"self",
",",
"topic_id",
",",
"title",
",",
"content",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"req",
"(",
"API_GROUP_UPDATE_TOPIC",
"%",
"topic_id",
",",
"'post'",
",",
"data",
"=",
"{",
"'ck'",
":",
"self",
".",
"... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_comments | 回复列表
:param topic_id: 话题ID
:param start: 翻页
:return: 带下一页的列表 | dbapi/Group.py | def list_comments(self, topic_id, start=0):
"""
回复列表
:param topic_id: 话题ID
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_GET_TOPIC % topic_id, params={'start': start})
xml_results = xml.xpath('//ul[@id="comments"]/li')
... | def list_comments(self, topic_id, start=0):
"""
回复列表
:param topic_id: 话题ID
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_GET_TOPIC % topic_id, params={'start': start})
xml_results = xml.xpath('//ul[@id="comments"]/li')
... | [
"回复列表",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L411-L444 | [
"def",
"list_comments",
"(",
"self",
",",
"topic_id",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_GET_TOPIC",
"%",
"topic_id",
",",
"params",
"=",
"{",
"'start'",
":",
"start",
"}",
")",
"xml_results",
... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.add_comment | 添加评论
:param topic_id: 话题ID
:param content: 内容
:param reply_id: 回复ID
:return: None | dbapi/Group.py | def add_comment(self, topic_id, content, reply_id=None):
"""
添加评论
:param topic_id: 话题ID
:param content: 内容
:param reply_id: 回复ID
:return: None
"""
return self.api.req(API_GROUP_ADD_COMMENT % topic_id, 'post', data={
'ck': self.api.ck()... | def add_comment(self, topic_id, content, reply_id=None):
"""
添加评论
:param topic_id: 话题ID
:param content: 内容
:param reply_id: 回复ID
:return: None
"""
return self.api.req(API_GROUP_ADD_COMMENT % topic_id, 'post', data={
'ck': self.api.ck()... | [
"添加评论",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"content",
":",
"内容",
":",
"param",
"reply_id",
":",
"回复ID",
":",
"return",
":",
"None"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L446-L461 | [
"def",
"add_comment",
"(",
"self",
",",
"topic_id",
",",
"content",
",",
"reply_id",
"=",
"None",
")",
":",
"return",
"self",
".",
"api",
".",
"req",
"(",
"API_GROUP_ADD_COMMENT",
"%",
"topic_id",
",",
"'post'",
",",
"data",
"=",
"{",
"'ck'",
":",
"sel... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.remove_comment | 删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)
:param topic_id: 话题ID
:param comment_id: 评论ID
:param reason: 原因 0/1/2 (内容不符/反动/其它)
:param other: 其它原因的具体(2)
:return: None | dbapi/Group.py | def remove_comment(self, topic_id, comment_id, reason='0', other=None):
"""
删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)
:param topic_id: 话题ID
:param comment_id: 评论ID
:param reason: 原因 0/1/2 (内容不符/反动/其它)
:param other: 其它原因的具体(2)
:return: None
"""
params... | def remove_comment(self, topic_id, comment_id, reason='0', other=None):
"""
删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)
:param topic_id: 话题ID
:param comment_id: 评论ID
:param reason: 原因 0/1/2 (内容不符/反动/其它)
:param other: 其它原因的具体(2)
:return: None
"""
params... | [
"删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"comment_id",
":",
"评论ID",
":",
"param",
"reason",
":",
"原因",
"0",
"/",
"1",
"/",
"2",
"(内容不符",
"/",
"反动",
"/",
"其它)",
":",
"param",
"other",
":",
"其它原因的具体",
"(",
"2... | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L463-L479 | [
"def",
"remove_comment",
"(",
"self",
",",
"topic_id",
",",
"comment_id",
",",
"reason",
"=",
"'0'",
",",
"other",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'cid'",
":",
"comment_id",
"}",
"data",
"=",
"{",
"'cid'",
":",
"comment_id",
",",
"'ck'",
... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.list_user_comments | 列出用户在话题下的所有回复
:param topic_id: 话题ID
:param user_alias: 用户ID,默认当前
:return: 纯列表 | dbapi/Group.py | def list_user_comments(self, topic_id, user_alias=None):
"""
列出用户在话题下的所有回复
:param topic_id: 话题ID
:param user_alias: 用户ID,默认当前
:return: 纯列表
"""
user_alias = user_alias or self.api.user_alias
comment_start = 0
results = []
while comm... | def list_user_comments(self, topic_id, user_alias=None):
"""
列出用户在话题下的所有回复
:param topic_id: 话题ID
:param user_alias: 用户ID,默认当前
:return: 纯列表
"""
user_alias = user_alias or self.api.user_alias
comment_start = 0
results = []
while comm... | [
"列出用户在话题下的所有回复",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"user_alias",
":",
"用户ID,默认当前",
":",
"return",
":",
"纯列表"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L481-L496 | [
"def",
"list_user_comments",
"(",
"self",
",",
"topic_id",
",",
"user_alias",
"=",
"None",
")",
":",
"user_alias",
"=",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
"comment_start",
"=",
"0",
"results",
"=",
"[",
"]",
"while",
"comment_start",
... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Group.remove_commented_topic | 删除回复的话题(删除所有自己发布的评论)
:param topic_id: 话题ID
:return: None | dbapi/Group.py | def remove_commented_topic(self, topic_id):
"""
删除回复的话题(删除所有自己发布的评论)
:param topic_id: 话题ID
:return: None
"""
return [self.remove_comment(topic_id, item['id']) for item in self.list_user_comments(topic_id)] | def remove_commented_topic(self, topic_id):
"""
删除回复的话题(删除所有自己发布的评论)
:param topic_id: 话题ID
:return: None
"""
return [self.remove_comment(topic_id, item['id']) for item in self.list_user_comments(topic_id)] | [
"删除回复的话题(删除所有自己发布的评论)",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"return",
":",
"None"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L498-L505 | [
"def",
"remove_commented_topic",
"(",
"self",
",",
"topic_id",
")",
":",
"return",
"[",
"self",
".",
"remove_comment",
"(",
"topic_id",
",",
"item",
"[",
"'id'",
"]",
")",
"for",
"item",
"in",
"self",
".",
"list_user_comments",
"(",
"topic_id",
")",
"]"
] | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | shell | Creates a new :class:`Shell` with a function as callback. This
works otherwise the same as :func:`command` just that the `cls`
parameter is set to :class:`Shell`. | click_shell/decorators.py | def shell(name=None, **attrs):
"""Creates a new :class:`Shell` with a function as callback. This
works otherwise the same as :func:`command` just that the `cls`
parameter is set to :class:`Shell`.
"""
attrs.setdefault('cls', Shell)
return click.command(name, **attrs) | def shell(name=None, **attrs):
"""Creates a new :class:`Shell` with a function as callback. This
works otherwise the same as :func:`command` just that the `cls`
parameter is set to :class:`Shell`.
"""
attrs.setdefault('cls', Shell)
return click.command(name, **attrs) | [
"Creates",
"a",
"new",
":",
"class",
":",
"Shell",
"with",
"a",
"function",
"as",
"callback",
".",
"This",
"works",
"otherwise",
"the",
"same",
"as",
":",
"func",
":",
"command",
"just",
"that",
"the",
"cls",
"parameter",
"is",
"set",
"to",
":",
"class... | clarkperkins/click-shell | python | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/decorators.py#L12-L18 | [
"def",
"shell",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"attrs",
")",
":",
"attrs",
".",
"setdefault",
"(",
"'cls'",
",",
"Shell",
")",
"return",
"click",
".",
"command",
"(",
"name",
",",
"*",
"*",
"attrs",
")"
] | 8d6e1a492176bc79e029d714f19d3156409656ea |
train | getLogger | This is used by gcdt plugins to get a logger with the right level. | gcdt/gcdt_logging.py | def getLogger(name):
"""This is used by gcdt plugins to get a logger with the right level."""
logger = logging.getLogger(name)
# note: the level might be adjusted via '-v' option
logger.setLevel(logging_config['loggers']['gcdt']['level'])
return logger | def getLogger(name):
"""This is used by gcdt plugins to get a logger with the right level."""
logger = logging.getLogger(name)
# note: the level might be adjusted via '-v' option
logger.setLevel(logging_config['loggers']['gcdt']['level'])
return logger | [
"This",
"is",
"used",
"by",
"gcdt",
"plugins",
"to",
"get",
"a",
"logger",
"with",
"the",
"right",
"level",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_logging.py#L70-L75 | [
"def",
"getLogger",
"(",
"name",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
")",
"# note: the level might be adjusted via '-v' option",
"logger",
".",
"setLevel",
"(",
"logging_config",
"[",
"'loggers'",
"]",
"[",
"'gcdt'",
"]",
"[",
"'le... | cd67cf416371337b83cb9ca3f696277125703339 |
train | MagentoAPI._discover | Discovers methods in the XML-RPC API and creates attributes for them
on this object. Enables stuff like "magento.cart.create(...)" to work
without having to define Python methods for each XML-RPC equivalent. | magento/magento_api.py | def _discover(self):
"""Discovers methods in the XML-RPC API and creates attributes for them
on this object. Enables stuff like "magento.cart.create(...)" to work
without having to define Python methods for each XML-RPC equivalent.
"""
self._resources = {}
resources = se... | def _discover(self):
"""Discovers methods in the XML-RPC API and creates attributes for them
on this object. Enables stuff like "magento.cart.create(...)" to work
without having to define Python methods for each XML-RPC equivalent.
"""
self._resources = {}
resources = se... | [
"Discovers",
"methods",
"in",
"the",
"XML",
"-",
"RPC",
"API",
"and",
"creates",
"attributes",
"for",
"them",
"on",
"this",
"object",
".",
"Enables",
"stuff",
"like",
"magento",
".",
"cart",
".",
"create",
"(",
"...",
")",
"to",
"work",
"without",
"havin... | bernieke/python-magento | python | https://github.com/bernieke/python-magento/blob/bfd23e233905b1b1491a7c07b9d833dfebd70456/magento/magento_api.py#L73-L84 | [
"def",
"_discover",
"(",
"self",
")",
":",
"self",
".",
"_resources",
"=",
"{",
"}",
"resources",
"=",
"self",
".",
"_client",
".",
"resources",
"(",
"self",
".",
"_session_id",
")",
"for",
"resource",
"in",
"resources",
":",
"self",
".",
"_resources",
... | bfd23e233905b1b1491a7c07b9d833dfebd70456 |
train | MagentoAPI.keep_session_alive | If the session expired, logs back in. | magento/magento_api.py | def keep_session_alive(self):
"""If the session expired, logs back in."""
try:
self.resources()
except xmlrpclib.Fault as fault:
if fault.faultCode == 5:
self.login()
else:
raise | def keep_session_alive(self):
"""If the session expired, logs back in."""
try:
self.resources()
except xmlrpclib.Fault as fault:
if fault.faultCode == 5:
self.login()
else:
raise | [
"If",
"the",
"session",
"expired",
"logs",
"back",
"in",
"."
] | bernieke/python-magento | python | https://github.com/bernieke/python-magento/blob/bfd23e233905b1b1491a7c07b9d833dfebd70456/magento/magento_api.py#L118-L127 | [
"def",
"keep_session_alive",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"resources",
"(",
")",
"except",
"xmlrpclib",
".",
"Fault",
"as",
"fault",
":",
"if",
"fault",
".",
"faultCode",
"==",
"5",
":",
"self",
".",
"login",
"(",
")",
"else",
":",... | bfd23e233905b1b1491a7c07b9d833dfebd70456 |
train | MagentoAPI.help | Prints discovered resources and their associated methods. Nice when
noodling in the terminal to wrap your head around Magento's insanity. | magento/magento_api.py | def help(self):
"""Prints discovered resources and their associated methods. Nice when
noodling in the terminal to wrap your head around Magento's insanity.
"""
print('Resources:')
print('')
for name in sorted(self._resources.keys()):
methods = sorted(self._r... | def help(self):
"""Prints discovered resources and their associated methods. Nice when
noodling in the terminal to wrap your head around Magento's insanity.
"""
print('Resources:')
print('')
for name in sorted(self._resources.keys()):
methods = sorted(self._r... | [
"Prints",
"discovered",
"resources",
"and",
"their",
"associated",
"methods",
".",
"Nice",
"when",
"noodling",
"in",
"the",
"terminal",
"to",
"wrap",
"your",
"head",
"around",
"Magento",
"s",
"insanity",
"."
] | bernieke/python-magento | python | https://github.com/bernieke/python-magento/blob/bfd23e233905b1b1491a7c07b9d833dfebd70456/magento/magento_api.py#L156-L165 | [
"def",
"help",
"(",
"self",
")",
":",
"print",
"(",
"'Resources:'",
")",
"print",
"(",
"''",
")",
"for",
"name",
"in",
"sorted",
"(",
"self",
".",
"_resources",
".",
"keys",
"(",
")",
")",
":",
"methods",
"=",
"sorted",
"(",
"self",
".",
"_resource... | bfd23e233905b1b1491a7c07b9d833dfebd70456 |
train | RunCommand.run | Import the controller and run it.
This mimics the processing done by :func:`helper.start`
when a controller is run in the foreground. A new instance
of ``self.controller`` is created and run until a keyboard
interrupt occurs or the controller stops on its own accord. | helper/setupext.py | def run(self):
"""Import the controller and run it.
This mimics the processing done by :func:`helper.start`
when a controller is run in the foreground. A new instance
of ``self.controller`` is created and run until a keyboard
interrupt occurs or the controller stops on its own ... | def run(self):
"""Import the controller and run it.
This mimics the processing done by :func:`helper.start`
when a controller is run in the foreground. A new instance
of ``self.controller`` is created and run until a keyboard
interrupt occurs or the controller stops on its own ... | [
"Import",
"the",
"controller",
"and",
"run",
"it",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/setupext.py#L50-L70 | [
"def",
"run",
"(",
"self",
")",
":",
"segments",
"=",
"self",
".",
"controller",
".",
"split",
"(",
"'.'",
")",
"controller_class",
"=",
"reduce",
"(",
"getattr",
",",
"segments",
"[",
"1",
":",
"]",
",",
"__import__",
"(",
"'.'",
".",
"join",
"(",
... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Torrent.get_info | Scans the input path and automatically determines the optimal
piece size based on ~1500 pieces (up to MAX_PIECE_SIZE) along
with other basic info, including total size (in bytes), the
total number of files, piece size (in bytes), and resulting
number of pieces. If ``piece_size`` has alre... | dottorrent/__init__.py | def get_info(self):
"""
Scans the input path and automatically determines the optimal
piece size based on ~1500 pieces (up to MAX_PIECE_SIZE) along
with other basic info, including total size (in bytes), the
total number of files, piece size (in bytes), and resulting
numb... | def get_info(self):
"""
Scans the input path and automatically determines the optimal
piece size based on ~1500 pieces (up to MAX_PIECE_SIZE) along
with other basic info, including total size (in bytes), the
total number of files, piece size (in bytes), and resulting
numb... | [
"Scans",
"the",
"input",
"path",
"and",
"automatically",
"determines",
"the",
"optimal",
"piece",
"size",
"based",
"on",
"~1500",
"pieces",
"(",
"up",
"to",
"MAX_PIECE_SIZE",
")",
"along",
"with",
"other",
"basic",
"info",
"including",
"total",
"size",
"(",
... | kz26/dottorrent | python | https://github.com/kz26/dottorrent/blob/fea5714efe0cde2a55eabfb387295781a78d84bb/dottorrent/__init__.py#L154-L192 | [
"def",
"get_info",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"path",
")",
":",
"total_size",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"self",
".",
"path",
")",
"total_files",
"=",
"1",
"elif",
"os",
".",... | fea5714efe0cde2a55eabfb387295781a78d84bb |
train | Torrent.generate | Computes and stores piece data. Returns ``True`` on success, ``False``
otherwise.
:param callback: progress/cancellation callable with method
signature ``(filename, pieces_completed, pieces_total)``.
Useful for reporting progress if dottorrent is used in a
GUI/thread... | dottorrent/__init__.py | def generate(self, callback=None):
"""
Computes and stores piece data. Returns ``True`` on success, ``False``
otherwise.
:param callback: progress/cancellation callable with method
signature ``(filename, pieces_completed, pieces_total)``.
Useful for reporting pro... | def generate(self, callback=None):
"""
Computes and stores piece data. Returns ``True`` on success, ``False``
otherwise.
:param callback: progress/cancellation callable with method
signature ``(filename, pieces_completed, pieces_total)``.
Useful for reporting pro... | [
"Computes",
"and",
"stores",
"piece",
"data",
".",
"Returns",
"True",
"on",
"success",
"False",
"otherwise",
"."
] | kz26/dottorrent | python | https://github.com/kz26/dottorrent/blob/fea5714efe0cde2a55eabfb387295781a78d84bb/dottorrent/__init__.py#L194-L311 | [
"def",
"generate",
"(",
"self",
",",
"callback",
"=",
"None",
")",
":",
"files",
"=",
"[",
"]",
"single_file",
"=",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"path",
")",
"if",
"single_file",
":",
"files",
".",
"append",
"(",
"(",
"self",... | fea5714efe0cde2a55eabfb387295781a78d84bb |
train | Torrent.info_hash_base32 | Returns the base32 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first. | dottorrent/__init__.py | def info_hash_base32(self):
"""
Returns the base32 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
"""
if getattr(self, '_data', None):
return b32encode(sha1(bencode(self._data['info'])).digest())
... | def info_hash_base32(self):
"""
Returns the base32 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
"""
if getattr(self, '_data', None):
return b32encode(sha1(bencode(self._data['info'])).digest())
... | [
"Returns",
"the",
"base32",
"info",
"hash",
"of",
"the",
"torrent",
".",
"Useful",
"for",
"generating",
"magnet",
"links",
"."
] | kz26/dottorrent | python | https://github.com/kz26/dottorrent/blob/fea5714efe0cde2a55eabfb387295781a78d84bb/dottorrent/__init__.py#L327-L337 | [
"def",
"info_hash_base32",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_data'",
",",
"None",
")",
":",
"return",
"b32encode",
"(",
"sha1",
"(",
"bencode",
"(",
"self",
".",
"_data",
"[",
"'info'",
"]",
")",
")",
".",
"digest",
"(",
... | fea5714efe0cde2a55eabfb387295781a78d84bb |
train | Torrent.info_hash | :return: The SHA-1 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first. | dottorrent/__init__.py | def info_hash(self):
"""
:return: The SHA-1 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
"""
if getattr(self, '_data', None):
return sha1(bencode(self._data['info'])).hexdigest()
else... | def info_hash(self):
"""
:return: The SHA-1 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
"""
if getattr(self, '_data', None):
return sha1(bencode(self._data['info'])).hexdigest()
else... | [
":",
"return",
":",
"The",
"SHA",
"-",
"1",
"info",
"hash",
"of",
"the",
"torrent",
".",
"Useful",
"for",
"generating",
"magnet",
"links",
"."
] | kz26/dottorrent | python | https://github.com/kz26/dottorrent/blob/fea5714efe0cde2a55eabfb387295781a78d84bb/dottorrent/__init__.py#L340-L350 | [
"def",
"info_hash",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_data'",
",",
"None",
")",
":",
"return",
"sha1",
"(",
"bencode",
"(",
"self",
".",
"_data",
"[",
"'info'",
"]",
")",
")",
".",
"hexdigest",
"(",
")",
"else",
":",
"r... | fea5714efe0cde2a55eabfb387295781a78d84bb |
train | BaseAPI.req | 请求API
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:type auth: bool
:param auth: if True and sess... | dbapi/base.py | def req(self, url, method='get', params=None, data=None, auth=False):
"""
请求API
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
... | def req(self, url, method='get', params=None, data=None, auth=False):
"""
请求API
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
... | [
"请求API"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L71-L104 | [
"def",
"req",
"(",
"self",
",",
"url",
",",
"method",
"=",
"'get'",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"auth",
"=",
"False",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'fetch api<%s:%s>'",
"%",
"(",
"method",
",",
... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | BaseAPI.json | 请求并返回json
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:rtype: dict
:return: | dbapi/base.py | def json(self, url, method='get', params=None, data=None):
"""
请求并返回json
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: di... | def json(self, url, method='get', params=None, data=None):
"""
请求并返回json
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: di... | [
"请求并返回json",
":",
"type",
"url",
":",
"str",
":",
"param",
"url",
":",
"API",
":",
"type",
"method",
":",
"str",
":",
"param",
"method",
":",
"HTTP",
"METHOD",
":",
"type",
"params",
":",
"dict",
":",
"param",
"params",
":",
"query",
":",
"type",
"... | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L106-L127 | [
"def",
"json",
"(",
"self",
",",
"url",
",",
"method",
"=",
"'get'",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"r",
"=",
"self",
".",
"req",
"(",
"url",
",",
"method",
",",
"params",
",",
"data",
")",
"return",
"r",
".",
... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | BaseAPI.xml | 请求并返回xml
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:rtype: html.HtmlElement
:return: | dbapi/base.py | def xml(self, url, method='get', params=None, data=None):
"""
请求并返回xml
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
... | def xml(self, url, method='get', params=None, data=None):
"""
请求并返回xml
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
... | [
"请求并返回xml",
":",
"type",
"url",
":",
"str",
":",
"param",
"url",
":",
"API",
":",
"type",
"method",
":",
"str",
":",
"param",
"method",
":",
"HTTP",
"METHOD",
":",
"type",
"params",
":",
"dict",
":",
"param",
"params",
":",
"query",
":",
"type",
"d... | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L133-L154 | [
"def",
"xml",
"(",
"self",
",",
"url",
",",
"method",
"=",
"'get'",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"r",
"=",
"self",
".",
"req",
"(",
"url",
",",
"method",
",",
"params",
",",
"data",
")",
"# this is required for av... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | BaseAPI.persist | 持久化会话信息 | dbapi/base.py | def persist(self):
"""
持久化会话信息
"""
with open(self.persist_file, 'w+') as f:
json.dump({
'cookies': self.cookies,
'user_alias': self.user_alias,
}, f, indent=2)
self.logger.debug('persist session to <%s>' % self.persist_f... | def persist(self):
"""
持久化会话信息
"""
with open(self.persist_file, 'w+') as f:
json.dump({
'cookies': self.cookies,
'user_alias': self.user_alias,
}, f, indent=2)
self.logger.debug('persist session to <%s>' % self.persist_f... | [
"持久化会话信息"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L156-L165 | [
"def",
"persist",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"persist_file",
",",
"'w+'",
")",
"as",
"f",
":",
"json",
".",
"dump",
"(",
"{",
"'cookies'",
":",
"self",
".",
"cookies",
",",
"'user_alias'",
":",
"self",
".",
"user_alias",... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | BaseAPI.load | 加载会话信息 | dbapi/base.py | def load(self):
"""
加载会话信息
"""
if not os.path.isfile(self.persist_file):
return
with open(self.persist_file, 'r') as f:
cfg = json.load(f) or {}
self.cookies = cfg.get('cookies', {})
self.user_alias = cfg.get('user_alias') or None
... | def load(self):
"""
加载会话信息
"""
if not os.path.isfile(self.persist_file):
return
with open(self.persist_file, 'r') as f:
cfg = json.load(f) or {}
self.cookies = cfg.get('cookies', {})
self.user_alias = cfg.get('user_alias') or None
... | [
"加载会话信息"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L167-L177 | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"persist_file",
")",
":",
"return",
"with",
"open",
"(",
"self",
".",
"persist_file",
",",
"'r'",
")",
"as",
"f",
":",
"cfg",
"=",
"json",
".",... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | BaseAPI.flush | 更新会话信息,主要是ck, user_alias | dbapi/base.py | def flush(self):
"""
更新会话信息,主要是ck, user_alias
"""
if 'dbcl2' not in self.cookies:
return
r = self.req(API_ACCOUNT_HOME)
if RE_SESSION_EXPIRE.search(r.url):
return self.expire()
self.cookies.update(dict(r.cookies))
self.user_alias = ... | def flush(self):
"""
更新会话信息,主要是ck, user_alias
"""
if 'dbcl2' not in self.cookies:
return
r = self.req(API_ACCOUNT_HOME)
if RE_SESSION_EXPIRE.search(r.url):
return self.expire()
self.cookies.update(dict(r.cookies))
self.user_alias = ... | [
"更新会话信息,主要是ck",
"user_alias"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L187-L199 | [
"def",
"flush",
"(",
"self",
")",
":",
"if",
"'dbcl2'",
"not",
"in",
"self",
".",
"cookies",
":",
"return",
"r",
"=",
"self",
".",
"req",
"(",
"API_ACCOUNT_HOME",
")",
"if",
"RE_SESSION_EXPIRE",
".",
"search",
"(",
"r",
".",
"url",
")",
":",
"return"... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | BaseAPI.login | 登录
:type username: str
:param username: 用户名(手机号或者邮箱)
:type password: str
:param password: 密码 | dbapi/base.py | def login(self, username, password):
"""
登录
:type username: str
:param username: 用户名(手机号或者邮箱)
:type password: str
:param password: 密码
"""
r0 = self.req(API_HOME)
time.sleep(1)
cookies = dict(r0.cookies)
data = {
... | def login(self, username, password):
"""
登录
:type username: str
:param username: 用户名(手机号或者邮箱)
:type password: str
:param password: 密码
"""
r0 = self.req(API_HOME)
time.sleep(1)
cookies = dict(r0.cookies)
data = {
... | [
"登录",
":",
"type",
"username",
":",
"str",
":",
"param",
"username",
":",
"用户名(手机号或者邮箱)",
":",
"type",
"password",
":",
"str",
":",
"param",
"password",
":",
"密码"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L201-L228 | [
"def",
"login",
"(",
"self",
",",
"username",
",",
"password",
")",
":",
"r0",
"=",
"self",
".",
"req",
"(",
"API_HOME",
")",
"time",
".",
"sleep",
"(",
"1",
")",
"cookies",
"=",
"dict",
"(",
"r0",
".",
"cookies",
")",
"data",
"=",
"{",
"'source'... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | BaseAPI.use | 如果遭遇验证码,用这个接口
:type cookies: str|dict
:param cookies: cookie字符串或者字典
:return: self | dbapi/base.py | def use(self, cookies):
"""
如果遭遇验证码,用这个接口
:type cookies: str|dict
:param cookies: cookie字符串或者字典
:return: self
"""
self.cookies = dict([item.split('=', 1) for item in re.split(r'; *', cookies)]) \
if isinstance(cookies, str) else cookies
... | def use(self, cookies):
"""
如果遭遇验证码,用这个接口
:type cookies: str|dict
:param cookies: cookie字符串或者字典
:return: self
"""
self.cookies = dict([item.split('=', 1) for item in re.split(r'; *', cookies)]) \
if isinstance(cookies, str) else cookies
... | [
"如果遭遇验证码,用这个接口",
":",
"type",
"cookies",
":",
"str|dict",
":",
"param",
"cookies",
":",
"cookie字符串或者字典",
":",
"return",
":",
"self"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L230-L242 | [
"def",
"use",
"(",
"self",
",",
"cookies",
")",
":",
"self",
".",
"cookies",
"=",
"dict",
"(",
"[",
"item",
".",
"split",
"(",
"'='",
",",
"1",
")",
"for",
"item",
"in",
"re",
".",
"split",
"(",
"r'; *'",
",",
"cookies",
")",
"]",
")",
"if",
... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | BaseAPI.logout | 登出会话
:return: self | dbapi/base.py | def logout(self):
"""
登出会话
:return: self
"""
self.req(API_ACCOUNT_LOGOUT % self.ck())
self.cookies = {}
self.user_alias = None
self.persist() | def logout(self):
"""
登出会话
:return: self
"""
self.req(API_ACCOUNT_LOGOUT % self.ck())
self.cookies = {}
self.user_alias = None
self.persist() | [
"登出会话",
":",
"return",
":",
"self"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L244-L253 | [
"def",
"logout",
"(",
"self",
")",
":",
"self",
".",
"req",
"(",
"API_ACCOUNT_LOGOUT",
"%",
"self",
".",
"ck",
"(",
")",
")",
"self",
".",
"cookies",
"=",
"{",
"}",
"self",
".",
"user_alias",
"=",
"None",
"self",
".",
"persist",
"(",
")"
] | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | deploy | Upload bundle and deploy to deployment group.
This includes the bundle-action.
:param applicationName:
:param deploymentGroupName:
:param deploymentConfigName:
:param bucket:
:param bundlefile:
:return: deploymentId from create_deployment | gcdt/tenkai_core.py | def deploy(awsclient, applicationName, deploymentGroupName,
deploymentConfigName, bucket, bundlefile):
"""Upload bundle and deploy to deployment group.
This includes the bundle-action.
:param applicationName:
:param deploymentGroupName:
:param deploymentConfigName:
:param bucket:
... | def deploy(awsclient, applicationName, deploymentGroupName,
deploymentConfigName, bucket, bundlefile):
"""Upload bundle and deploy to deployment group.
This includes the bundle-action.
:param applicationName:
:param deploymentGroupName:
:param deploymentConfigName:
:param bucket:
... | [
"Upload",
"bundle",
"and",
"deploy",
"to",
"deployment",
"group",
".",
"This",
"includes",
"the",
"bundle",
"-",
"action",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L18-L61 | [
"def",
"deploy",
"(",
"awsclient",
",",
"applicationName",
",",
"deploymentGroupName",
",",
"deploymentConfigName",
",",
"bucket",
",",
"bundlefile",
")",
":",
"etag",
",",
"version",
"=",
"upload_file_to_s3",
"(",
"awsclient",
",",
"bucket",
",",
"_build_bundle_k... | cd67cf416371337b83cb9ca3f696277125703339 |
train | output_deployment_status | Wait until an deployment is in an steady state and output information.
:param deployment_id:
:param iterations:
:return: exit_code | gcdt/tenkai_core.py | def output_deployment_status(awsclient, deployment_id, iterations=100):
"""Wait until an deployment is in an steady state and output information.
:param deployment_id:
:param iterations:
:return: exit_code
"""
counter = 0
steady_states = ['Succeeded', 'Failed', 'Stopped']
client_codedep... | def output_deployment_status(awsclient, deployment_id, iterations=100):
"""Wait until an deployment is in an steady state and output information.
:param deployment_id:
:param iterations:
:return: exit_code
"""
counter = 0
steady_states = ['Succeeded', 'Failed', 'Stopped']
client_codedep... | [
"Wait",
"until",
"an",
"deployment",
"is",
"in",
"an",
"steady",
"state",
"and",
"output",
"information",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L69-L100 | [
"def",
"output_deployment_status",
"(",
"awsclient",
",",
"deployment_id",
",",
"iterations",
"=",
"100",
")",
":",
"counter",
"=",
"0",
"steady_states",
"=",
"[",
"'Succeeded'",
",",
"'Failed'",
",",
"'Stopped'",
"]",
"client_codedeploy",
"=",
"awsclient",
".",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | stop_deployment | stop tenkai deployment.
:param awsclient:
:param deployment_id: | gcdt/tenkai_core.py | def stop_deployment(awsclient, deployment_id):
"""stop tenkai deployment.
:param awsclient:
:param deployment_id:
"""
log.info('Deployment: %s - stopping active deployment.', deployment_id)
client_codedeploy = awsclient.get_client('codedeploy')
response = client_codedeploy.stop_deployment(... | def stop_deployment(awsclient, deployment_id):
"""stop tenkai deployment.
:param awsclient:
:param deployment_id:
"""
log.info('Deployment: %s - stopping active deployment.', deployment_id)
client_codedeploy = awsclient.get_client('codedeploy')
response = client_codedeploy.stop_deployment(... | [
"stop",
"tenkai",
"deployment",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L103-L115 | [
"def",
"stop_deployment",
"(",
"awsclient",
",",
"deployment_id",
")",
":",
"log",
".",
"info",
"(",
"'Deployment: %s - stopping active deployment.'",
",",
"deployment_id",
")",
"client_codedeploy",
"=",
"awsclient",
".",
"get_client",
"(",
"'codedeploy'",
")",
"respo... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _list_deployment_instances | list deployment instances.
:param awsclient:
:param deployment_id: | gcdt/tenkai_core.py | def _list_deployment_instances(awsclient, deployment_id):
"""list deployment instances.
:param awsclient:
:param deployment_id:
"""
client_codedeploy = awsclient.get_client('codedeploy')
instances = []
next_token = None
# TODO refactor generic exhaust_function from this
while True... | def _list_deployment_instances(awsclient, deployment_id):
"""list deployment instances.
:param awsclient:
:param deployment_id:
"""
client_codedeploy = awsclient.get_client('codedeploy')
instances = []
next_token = None
# TODO refactor generic exhaust_function from this
while True... | [
"list",
"deployment",
"instances",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L118-L141 | [
"def",
"_list_deployment_instances",
"(",
"awsclient",
",",
"deployment_id",
")",
":",
"client_codedeploy",
"=",
"awsclient",
".",
"get_client",
"(",
"'codedeploy'",
")",
"instances",
"=",
"[",
"]",
"next_token",
"=",
"None",
"# TODO refactor generic exhaust_function fr... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _get_deployment_instance_summary | instance summary.
:param awsclient:
:param deployment_id:
:param instance_id:
return: status, last_event | gcdt/tenkai_core.py | def _get_deployment_instance_summary(awsclient, deployment_id, instance_id):
"""instance summary.
:param awsclient:
:param deployment_id:
:param instance_id:
return: status, last_event
"""
client_codedeploy = awsclient.get_client('codedeploy')
request = {
'deploymentId': deploym... | def _get_deployment_instance_summary(awsclient, deployment_id, instance_id):
"""instance summary.
:param awsclient:
:param deployment_id:
:param instance_id:
return: status, last_event
"""
client_codedeploy = awsclient.get_client('codedeploy')
request = {
'deploymentId': deploym... | [
"instance",
"summary",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L144-L159 | [
"def",
"_get_deployment_instance_summary",
"(",
"awsclient",
",",
"deployment_id",
",",
"instance_id",
")",
":",
"client_codedeploy",
"=",
"awsclient",
".",
"get_client",
"(",
"'codedeploy'",
")",
"request",
"=",
"{",
"'deploymentId'",
":",
"deployment_id",
",",
"'i... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _get_deployment_instance_diagnostics | Gets you the diagnostics details for the first 'Failed' event.
:param awsclient:
:param deployment_id:
:param instance_id:
return: None or (error_code, script_name, message, log_tail) | gcdt/tenkai_core.py | def _get_deployment_instance_diagnostics(awsclient, deployment_id, instance_id):
"""Gets you the diagnostics details for the first 'Failed' event.
:param awsclient:
:param deployment_id:
:param instance_id:
return: None or (error_code, script_name, message, log_tail)
"""
client_codedeploy =... | def _get_deployment_instance_diagnostics(awsclient, deployment_id, instance_id):
"""Gets you the diagnostics details for the first 'Failed' event.
:param awsclient:
:param deployment_id:
:param instance_id:
return: None or (error_code, script_name, message, log_tail)
"""
client_codedeploy =... | [
"Gets",
"you",
"the",
"diagnostics",
"details",
"for",
"the",
"first",
"Failed",
"event",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L162-L183 | [
"def",
"_get_deployment_instance_diagnostics",
"(",
"awsclient",
",",
"deployment_id",
",",
"instance_id",
")",
":",
"client_codedeploy",
"=",
"awsclient",
".",
"get_client",
"(",
"'codedeploy'",
")",
"request",
"=",
"{",
"'deploymentId'",
":",
"deployment_id",
",",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | output_deployment_summary | summary
:param awsclient:
:param deployment_id: | gcdt/tenkai_core.py | def output_deployment_summary(awsclient, deployment_id):
"""summary
:param awsclient:
:param deployment_id:
"""
log.info('\ndeployment summary:')
log.info('%-22s %-12s %s', 'Instance ID', 'Status', 'Most recent event')
for instance_id in _list_deployment_instances(awsclient, deployment_id):... | def output_deployment_summary(awsclient, deployment_id):
"""summary
:param awsclient:
:param deployment_id:
"""
log.info('\ndeployment summary:')
log.info('%-22s %-12s %s', 'Instance ID', 'Status', 'Most recent event')
for instance_id in _list_deployment_instances(awsclient, deployment_id):... | [
"summary"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L186-L198 | [
"def",
"output_deployment_summary",
"(",
"awsclient",
",",
"deployment_id",
")",
":",
"log",
".",
"info",
"(",
"'\\ndeployment summary:'",
")",
"log",
".",
"info",
"(",
"'%-22s %-12s %s'",
",",
"'Instance ID'",
",",
"'Status'",
",",
"'Most recent event'",
")",
"fo... | cd67cf416371337b83cb9ca3f696277125703339 |
train | output_deployment_diagnostics | diagnostics
:param awsclient:
:param deployment_id: | gcdt/tenkai_core.py | def output_deployment_diagnostics(awsclient, deployment_id, log_group, start_time=None):
"""diagnostics
:param awsclient:
:param deployment_id:
"""
headline = False
for instance_id in _list_deployment_instances(awsclient, deployment_id):
diagnostics = _get_deployment_instance_diagnostic... | def output_deployment_diagnostics(awsclient, deployment_id, log_group, start_time=None):
"""diagnostics
:param awsclient:
:param deployment_id:
"""
headline = False
for instance_id in _list_deployment_instances(awsclient, deployment_id):
diagnostics = _get_deployment_instance_diagnostic... | [
"diagnostics"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L201-L232 | [
"def",
"output_deployment_diagnostics",
"(",
"awsclient",
",",
"deployment_id",
",",
"log_group",
",",
"start_time",
"=",
"None",
")",
":",
"headline",
"=",
"False",
"for",
"instance_id",
"in",
"_list_deployment_instances",
"(",
"awsclient",
",",
"deployment_id",
")... | cd67cf416371337b83cb9ca3f696277125703339 |
train | AbstractType.is_type | :return:
:rtype: bool | typepy/type/_base.py | def is_type(self):
"""
:return:
:rtype: bool
"""
if self.__is_type_result is not None:
return self.__is_type_result
self.__is_type_result = self.__is_type()
return self.__is_type_result | def is_type(self):
"""
:return:
:rtype: bool
"""
if self.__is_type_result is not None:
return self.__is_type_result
self.__is_type_result = self.__is_type()
return self.__is_type_result | [
":",
"return",
":",
":",
"rtype",
":",
"bool"
] | thombashi/typepy | python | https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/type/_base.py#L63-L74 | [
"def",
"is_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"__is_type_result",
"is",
"not",
"None",
":",
"return",
"self",
".",
"__is_type_result",
"self",
".",
"__is_type_result",
"=",
"self",
".",
"__is_type",
"(",
")",
"return",
"self",
".",
"__is_type... | 8209d1df4f2a7f196a9fa4bfb0708c5ff648461f |
train | AbstractType.validate | :raises TypeError:
If the value is not matched the type that the class represented. | typepy/type/_base.py | def validate(self, error_message=None):
"""
:raises TypeError:
If the value is not matched the type that the class represented.
"""
if self.is_type():
return
if not error_message:
error_message = "invalid value type"
raise TypeError(... | def validate(self, error_message=None):
"""
:raises TypeError:
If the value is not matched the type that the class represented.
"""
if self.is_type():
return
if not error_message:
error_message = "invalid value type"
raise TypeError(... | [
":",
"raises",
"TypeError",
":",
"If",
"the",
"value",
"is",
"not",
"matched",
"the",
"type",
"that",
"the",
"class",
"represented",
"."
] | thombashi/typepy | python | https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/type/_base.py#L93-L107 | [
"def",
"validate",
"(",
"self",
",",
"error_message",
"=",
"None",
")",
":",
"if",
"self",
".",
"is_type",
"(",
")",
":",
"return",
"if",
"not",
"error_message",
":",
"error_message",
"=",
"\"invalid value type\"",
"raise",
"TypeError",
"(",
"\"{}: expected={}... | 8209d1df4f2a7f196a9fa4bfb0708c5ff648461f |
train | AbstractType.convert | :return: Converted value.
:raises typepy.TypeConversionError:
If the value cannot convert. | typepy/type/_base.py | def convert(self):
"""
:return: Converted value.
:raises typepy.TypeConversionError:
If the value cannot convert.
"""
if self.is_type():
return self.force_convert()
raise TypeConversionError(
"failed to convert from {} to {}".format(t... | def convert(self):
"""
:return: Converted value.
:raises typepy.TypeConversionError:
If the value cannot convert.
"""
if self.is_type():
return self.force_convert()
raise TypeConversionError(
"failed to convert from {} to {}".format(t... | [
":",
"return",
":",
"Converted",
"value",
".",
":",
"raises",
"typepy",
".",
"TypeConversionError",
":",
"If",
"the",
"value",
"cannot",
"convert",
"."
] | thombashi/typepy | python | https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/type/_base.py#L109-L121 | [
"def",
"convert",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_type",
"(",
")",
":",
"return",
"self",
".",
"force_convert",
"(",
")",
"raise",
"TypeConversionError",
"(",
"\"failed to convert from {} to {}\"",
".",
"format",
"(",
"type",
"(",
"self",
".",
... | 8209d1df4f2a7f196a9fa4bfb0708c5ff648461f |
train | always_fails | always_fails
:param work_dict: dictionary for key/values | celery_loaders/work_tasks/always_fails_tasks.py | def always_fails(
self,
work_dict):
"""always_fails
:param work_dict: dictionary for key/values
"""
label = "always_fails"
log.info(("task - {} - start "
"work_dict={}")
.format(label,
work_dict))
raise Exception(
wo... | def always_fails(
self,
work_dict):
"""always_fails
:param work_dict: dictionary for key/values
"""
label = "always_fails"
log.info(("task - {} - start "
"work_dict={}")
.format(label,
work_dict))
raise Exception(
wo... | [
"always_fails"
] | jay-johnson/celery-loaders | python | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/always_fails_tasks.py#L14-L37 | [
"def",
"always_fails",
"(",
"self",
",",
"work_dict",
")",
":",
"label",
"=",
"\"always_fails\"",
"log",
".",
"info",
"(",
"(",
"\"task - {} - start \"",
"\"work_dict={}\"",
")",
".",
"format",
"(",
"label",
",",
"work_dict",
")",
")",
"raise",
"Exception",
... | aca8169c774582af42a377c27cb3980020080814 |
train | IAMRoleAndPolicies.name_build | Build name from prefix and name + type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:return: Joined name | gcdt/iam.py | def name_build(self, name, is_policy=False, prefix=True):
"""
Build name from prefix and name + type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:return: Joined name
... | def name_build(self, name, is_policy=False, prefix=True):
"""
Build name from prefix and name + type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:return: Joined name
... | [
"Build",
"name",
"from",
"prefix",
"and",
"name",
"+",
"type",
":",
"param",
"name",
":",
"Name",
"of",
"the",
"role",
"/",
"policy",
":",
"param",
"is_policy",
":",
"True",
"if",
"policy",
"should",
"be",
"added",
"as",
"suffix",
":",
"param",
"prefix... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L47-L65 | [
"def",
"name_build",
"(",
"self",
",",
"name",
",",
"is_policy",
"=",
"False",
",",
"prefix",
"=",
"True",
")",
":",
"str",
"=",
"name",
"# Add prefix",
"if",
"prefix",
":",
"str",
"=",
"self",
".",
"__role_name_prefix",
"+",
"str",
"# Add policy suffix",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | IAMRoleAndPolicies.name_strip | Transforms name to AWS valid characters and adds prefix and type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:return: Transformed and joined name | gcdt/iam.py | def name_strip(self, name, is_policy=False, prefix=True):
"""
Transforms name to AWS valid characters and adds prefix and type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:re... | def name_strip(self, name, is_policy=False, prefix=True):
"""
Transforms name to AWS valid characters and adds prefix and type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:re... | [
"Transforms",
"name",
"to",
"AWS",
"valid",
"characters",
"and",
"adds",
"prefix",
"and",
"type",
":",
"param",
"name",
":",
"Name",
"of",
"the",
"role",
"/",
"policy",
":",
"param",
"is_policy",
":",
"True",
"if",
"policy",
"should",
"be",
"added",
"as"... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L67-L78 | [
"def",
"name_strip",
"(",
"self",
",",
"name",
",",
"is_policy",
"=",
"False",
",",
"prefix",
"=",
"True",
")",
":",
"str",
"=",
"self",
".",
"name_build",
"(",
"name",
",",
"is_policy",
",",
"prefix",
")",
"str",
"=",
"str",
".",
"title",
"(",
")"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | IAMRoleAndPolicies.build_policy | Generate policy for IAM cloudformation template
:param name: Name of the policy
:param statements: The "rules" the policy should have
:param roles: The roles associated with this policy
:param is_managed_policy: True if managed policy
:return: Ref to new policy | gcdt/iam.py | def build_policy(self, name, statements, roles, is_managed_policy=False):
"""
Generate policy for IAM cloudformation template
:param name: Name of the policy
:param statements: The "rules" the policy should have
:param roles: The roles associated with this policy
:param i... | def build_policy(self, name, statements, roles, is_managed_policy=False):
"""
Generate policy for IAM cloudformation template
:param name: Name of the policy
:param statements: The "rules" the policy should have
:param roles: The roles associated with this policy
:param i... | [
"Generate",
"policy",
"for",
"IAM",
"cloudformation",
"template",
":",
"param",
"name",
":",
"Name",
"of",
"the",
"policy",
":",
"param",
"statements",
":",
"The",
"rules",
"the",
"policy",
"should",
"have",
":",
"param",
"roles",
":",
"The",
"roles",
"ass... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L80-L111 | [
"def",
"build_policy",
"(",
"self",
",",
"name",
",",
"statements",
",",
"roles",
",",
"is_managed_policy",
"=",
"False",
")",
":",
"if",
"is_managed_policy",
":",
"policy",
"=",
"ManagedPolicy",
"(",
"self",
".",
"name_strip",
"(",
"name",
",",
"True",
")... | cd67cf416371337b83cb9ca3f696277125703339 |
train | IAMRoleAndPolicies.build_policy_bucket | Generate bucket policy for S3 bucket
:param bucket: The bucket to attach policy to
:param name: The name of the bucket (to generate policy name from it)
:param statements: The "rules" the policy should have
:return: Ref to new policy | gcdt/iam.py | def build_policy_bucket(self, bucket, name, statements):
"""
Generate bucket policy for S3 bucket
:param bucket: The bucket to attach policy to
:param name: The name of the bucket (to generate policy name from it)
:param statements: The "rules" the policy should have
:ret... | def build_policy_bucket(self, bucket, name, statements):
"""
Generate bucket policy for S3 bucket
:param bucket: The bucket to attach policy to
:param name: The name of the bucket (to generate policy name from it)
:param statements: The "rules" the policy should have
:ret... | [
"Generate",
"bucket",
"policy",
"for",
"S3",
"bucket",
":",
"param",
"bucket",
":",
"The",
"bucket",
"to",
"attach",
"policy",
"to",
":",
"param",
"name",
":",
"The",
"name",
"of",
"the",
"bucket",
"(",
"to",
"generate",
"policy",
"name",
"from",
"it",
... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L113-L136 | [
"def",
"build_policy_bucket",
"(",
"self",
",",
"bucket",
",",
"name",
",",
"statements",
")",
":",
"policy",
"=",
"self",
".",
"__template",
".",
"add_resource",
"(",
"BucketPolicy",
"(",
"self",
".",
"name_strip",
"(",
"name",
",",
"True",
",",
"False",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | IAMRoleAndPolicies.build_role | Generate role for IAM cloudformation template
:param name: Name of role
:param policies: List of policies to attach to this role (False = none)
:return: Ref to new role | gcdt/iam.py | def build_role(self, name, policies=False):
"""
Generate role for IAM cloudformation template
:param name: Name of role
:param policies: List of policies to attach to this role (False = none)
:return: Ref to new role
"""
# Build role template
if policies:
... | def build_role(self, name, policies=False):
"""
Generate role for IAM cloudformation template
:param name: Name of role
:param policies: List of policies to attach to this role (False = none)
:return: Ref to new role
"""
# Build role template
if policies:
... | [
"Generate",
"role",
"for",
"IAM",
"cloudformation",
"template",
":",
"param",
"name",
":",
"Name",
"of",
"role",
":",
"param",
"policies",
":",
"List",
"of",
"policies",
"to",
"attach",
"to",
"this",
"role",
"(",
"False",
"=",
"none",
")",
":",
"return",... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L138-L188 | [
"def",
"build_role",
"(",
"self",
",",
"name",
",",
"policies",
"=",
"False",
")",
":",
"# Build role template",
"if",
"policies",
":",
"role",
"=",
"self",
".",
"__template",
".",
"add_resource",
"(",
"Role",
"(",
"self",
".",
"name_strip",
"(",
"name",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | IAMRoleAndPolicies.build_bucket | Generate S3 bucket statement
:param name: Name of the bucket
:param lifecycle_configuration: Additional lifecycle configuration (default=False)
:param use_plain_name: Just use the given name and do not add prefix
:return: Ref to new bucket | gcdt/iam.py | def build_bucket(self, name, lifecycle_configuration=False,
use_plain_name=False):
"""
Generate S3 bucket statement
:param name: Name of the bucket
:param lifecycle_configuration: Additional lifecycle configuration (default=False)
:param use_plain_name: Just ... | def build_bucket(self, name, lifecycle_configuration=False,
use_plain_name=False):
"""
Generate S3 bucket statement
:param name: Name of the bucket
:param lifecycle_configuration: Additional lifecycle configuration (default=False)
:param use_plain_name: Just ... | [
"Generate",
"S3",
"bucket",
"statement",
":",
"param",
"name",
":",
"Name",
"of",
"the",
"bucket",
":",
"param",
"lifecycle_configuration",
":",
"Additional",
"lifecycle",
"configuration",
"(",
"default",
"=",
"False",
")",
":",
"param",
"use_plain_name",
":",
... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L190-L221 | [
"def",
"build_bucket",
"(",
"self",
",",
"name",
",",
"lifecycle_configuration",
"=",
"False",
",",
"use_plain_name",
"=",
"False",
")",
":",
"if",
"use_plain_name",
":",
"name_aws",
"=",
"name_bucket",
"=",
"name",
"name_aws",
"=",
"name_aws",
".",
"title",
... | cd67cf416371337b83cb9ca3f696277125703339 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.