id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
242,900 | AliGhahraei/verarandom | verarandom/_build_utils.py | _set_module_names_for_sphinx | def _set_module_names_for_sphinx(modules: List, new_name: str):
""" Trick sphinx into displaying the desired module in these objects' documentation. """
for obj in modules:
obj.__module__ = new_name | python | def _set_module_names_for_sphinx(modules: List, new_name: str):
""" Trick sphinx into displaying the desired module in these objects' documentation. """
for obj in modules:
obj.__module__ = new_name | [
"def",
"_set_module_names_for_sphinx",
"(",
"modules",
":",
"List",
",",
"new_name",
":",
"str",
")",
":",
"for",
"obj",
"in",
"modules",
":",
"obj",
".",
"__module__",
"=",
"new_name"
] | Trick sphinx into displaying the desired module in these objects' documentation. | [
"Trick",
"sphinx",
"into",
"displaying",
"the",
"desired",
"module",
"in",
"these",
"objects",
"documentation",
"."
] | 63d9a5bd2776e40368933f54e58c3f4b4f333f03 | https://github.com/AliGhahraei/verarandom/blob/63d9a5bd2776e40368933f54e58c3f4b4f333f03/verarandom/_build_utils.py#L4-L7 |
242,901 | Archived-Object/ligament | ligament/ligament.py | run_skeleton | def run_skeleton(skeleton_path, tasks, watch=True):
"""loads and executes tasks from a given skeleton file
skeleton_path:
path to the skeleton file
tasks:
a list of string identifiers of tasks to be executed
watch:
boolean flag of if the skeleton should... | python | def run_skeleton(skeleton_path, tasks, watch=True):
"""loads and executes tasks from a given skeleton file
skeleton_path:
path to the skeleton file
tasks:
a list of string identifiers of tasks to be executed
watch:
boolean flag of if the skeleton should... | [
"def",
"run_skeleton",
"(",
"skeleton_path",
",",
"tasks",
",",
"watch",
"=",
"True",
")",
":",
"build_context",
"=",
"load_context_from_skeleton",
"(",
"skeleton_path",
")",
"# for t in build_context.tasks:",
"# print t, str(build_context.tasks[t])",
"for",
"task",
"... | loads and executes tasks from a given skeleton file
skeleton_path:
path to the skeleton file
tasks:
a list of string identifiers of tasks to be executed
watch:
boolean flag of if the skeleton should be watched for changes and
automatically updat... | [
"loads",
"and",
"executes",
"tasks",
"from",
"a",
"given",
"skeleton",
"file"
] | ff3d78130522676a20dc64086dc8a27b197cc20f | https://github.com/Archived-Object/ligament/blob/ff3d78130522676a20dc64086dc8a27b197cc20f/ligament/ligament.py#L50-L118 |
242,902 | tBaxter/tango-shared-core | build/lib/tango_shared/templatetags/tango_site_tags.py | get_fresh_content | def get_fresh_content(top=4, additional=10, featured=False):
"""
Requires articles, photos and video packages to be installed.
Returns published *Featured* content (articles, galleries, video, etc)
and an additional batch of fresh regular (featured or not) content.
The number of objects returned i... | python | def get_fresh_content(top=4, additional=10, featured=False):
"""
Requires articles, photos and video packages to be installed.
Returns published *Featured* content (articles, galleries, video, etc)
and an additional batch of fresh regular (featured or not) content.
The number of objects returned i... | [
"def",
"get_fresh_content",
"(",
"top",
"=",
"4",
",",
"additional",
"=",
"10",
",",
"featured",
"=",
"False",
")",
":",
"from",
"articles",
".",
"models",
"import",
"Article",
"from",
"photos",
".",
"models",
"import",
"Gallery",
"from",
"video",
".",
"... | Requires articles, photos and video packages to be installed.
Returns published *Featured* content (articles, galleries, video, etc)
and an additional batch of fresh regular (featured or not) content.
The number of objects returned is defined when the tag is called.
The top item type is defined in th... | [
"Requires",
"articles",
"photos",
"and",
"video",
"packages",
"to",
"be",
"installed",
"."
] | 35fc10aef1ceedcdb4d6d866d44a22efff718812 | https://github.com/tBaxter/tango-shared-core/blob/35fc10aef1ceedcdb4d6d866d44a22efff718812/build/lib/tango_shared/templatetags/tango_site_tags.py#L28-L101 |
242,903 | tBaxter/tango-shared-core | build/lib/tango_shared/templatetags/tango_site_tags.py | markdown | def markdown(value, arg=''):
"""
Runs Markdown over a given value, optionally using various
extensions python-markdown supports.
Derived from django.contrib.markdown, which was deprecated from django.
ALWAYS CLEAN INPUT BEFORE TRUSTING IT.
Syntax::
{{ value|markdown:"extension1_name,... | python | def markdown(value, arg=''):
"""
Runs Markdown over a given value, optionally using various
extensions python-markdown supports.
Derived from django.contrib.markdown, which was deprecated from django.
ALWAYS CLEAN INPUT BEFORE TRUSTING IT.
Syntax::
{{ value|markdown:"extension1_name,... | [
"def",
"markdown",
"(",
"value",
",",
"arg",
"=",
"''",
")",
":",
"import",
"warnings",
"warnings",
".",
"warn",
"(",
"'The markdown filter has been deprecated'",
",",
"category",
"=",
"DeprecationWarning",
")",
"try",
":",
"import",
"markdown",
"except",
"Impor... | Runs Markdown over a given value, optionally using various
extensions python-markdown supports.
Derived from django.contrib.markdown, which was deprecated from django.
ALWAYS CLEAN INPUT BEFORE TRUSTING IT.
Syntax::
{{ value|markdown:"extension1_name,extension2_name..." }}
To enable saf... | [
"Runs",
"Markdown",
"over",
"a",
"given",
"value",
"optionally",
"using",
"various",
"extensions",
"python",
"-",
"markdown",
"supports",
"."
] | 35fc10aef1ceedcdb4d6d866d44a22efff718812 | https://github.com/tBaxter/tango-shared-core/blob/35fc10aef1ceedcdb4d6d866d44a22efff718812/build/lib/tango_shared/templatetags/tango_site_tags.py#L105-L156 |
242,904 | bretth/djset | djset/backends.py | UnencryptedKeyring.file_path | def file_path(self):
"""
The path to the file where passwords are stored. This property
may be overridden by the subclass or at the instance level.
"""
return os.path.join(keyring.util.platform.data_root(), self.filename) | python | def file_path(self):
"""
The path to the file where passwords are stored. This property
may be overridden by the subclass or at the instance level.
"""
return os.path.join(keyring.util.platform.data_root(), self.filename) | [
"def",
"file_path",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"keyring",
".",
"util",
".",
"platform",
".",
"data_root",
"(",
")",
",",
"self",
".",
"filename",
")"
] | The path to the file where passwords are stored. This property
may be overridden by the subclass or at the instance level. | [
"The",
"path",
"to",
"the",
"file",
"where",
"passwords",
"are",
"stored",
".",
"This",
"property",
"may",
"be",
"overridden",
"by",
"the",
"subclass",
"or",
"at",
"the",
"instance",
"level",
"."
] | e04cbcadc311f6edec50a718415d0004aa304034 | https://github.com/bretth/djset/blob/e04cbcadc311f6edec50a718415d0004aa304034/djset/backends.py#L20-L25 |
242,905 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.account | def account(self, account=None):
''' Fetches account information and stores the
result in a class variable. Returns that variable
if the account has not changed.
'''
for num_of_retries in range(default.max_retry):
if account is None:
account = self.mai... | python | def account(self, account=None):
''' Fetches account information and stores the
result in a class variable. Returns that variable
if the account has not changed.
'''
for num_of_retries in range(default.max_retry):
if account is None:
account = self.mai... | [
"def",
"account",
"(",
"self",
",",
"account",
"=",
"None",
")",
":",
"for",
"num_of_retries",
"in",
"range",
"(",
"default",
".",
"max_retry",
")",
":",
"if",
"account",
"is",
"None",
":",
"account",
"=",
"self",
".",
"mainaccount",
"if",
"account",
"... | Fetches account information and stores the
result in a class variable. Returns that variable
if the account has not changed. | [
"Fetches",
"account",
"information",
"and",
"stores",
"the",
"result",
"in",
"a",
"class",
"variable",
".",
"Returns",
"that",
"variable",
"if",
"the",
"account",
"has",
"not",
"changed",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L92-L114 |
242,906 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.steem_instance | def steem_instance(self):
''' Returns the steem instance if it already exists
otherwise uses the goodnode method to fetch a node
and instantiate the Steem class.
'''
if self.s:
return self.s
for num_of_retries in range(default.max_retry):
node = se... | python | def steem_instance(self):
''' Returns the steem instance if it already exists
otherwise uses the goodnode method to fetch a node
and instantiate the Steem class.
'''
if self.s:
return self.s
for num_of_retries in range(default.max_retry):
node = se... | [
"def",
"steem_instance",
"(",
"self",
")",
":",
"if",
"self",
".",
"s",
":",
"return",
"self",
".",
"s",
"for",
"num_of_retries",
"in",
"range",
"(",
"default",
".",
"max_retry",
")",
":",
"node",
"=",
"self",
".",
"util",
".",
"goodnode",
"(",
"self... | Returns the steem instance if it already exists
otherwise uses the goodnode method to fetch a node
and instantiate the Steem class. | [
"Returns",
"the",
"steem",
"instance",
"if",
"it",
"already",
"exists",
"otherwise",
"uses",
"the",
"goodnode",
"method",
"to",
"fetch",
"a",
"node",
"and",
"instantiate",
"the",
"Steem",
"class",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L117-L135 |
242,907 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.verify_key | def verify_key (self, acctname=None, tokenkey=None):
''' This can be used to verify either a private
posting key or to verify a steemconnect refresh
token and retreive the access token.
'''
if (re.match( r'^[A-Za-z0-9]+$', tokenkey)
and tokenkey is not Non... | python | def verify_key (self, acctname=None, tokenkey=None):
''' This can be used to verify either a private
posting key or to verify a steemconnect refresh
token and retreive the access token.
'''
if (re.match( r'^[A-Za-z0-9]+$', tokenkey)
and tokenkey is not Non... | [
"def",
"verify_key",
"(",
"self",
",",
"acctname",
"=",
"None",
",",
"tokenkey",
"=",
"None",
")",
":",
"if",
"(",
"re",
".",
"match",
"(",
"r'^[A-Za-z0-9]+$'",
",",
"tokenkey",
")",
"and",
"tokenkey",
"is",
"not",
"None",
"and",
"len",
"(",
"tokenkey"... | This can be used to verify either a private
posting key or to verify a steemconnect refresh
token and retreive the access token. | [
"This",
"can",
"be",
"used",
"to",
"verify",
"either",
"a",
"private",
"posting",
"key",
"or",
"to",
"verify",
"a",
"steemconnect",
"refresh",
"token",
"and",
"retreive",
"the",
"access",
"token",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L147-L178 |
242,908 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.reward_pool_balances | def reward_pool_balances(self):
''' Fetches and returns the 3 values
needed to calculate the reward pool
and other associated values such as rshares.
Returns the reward balance, all recent claims
and the current price of steem.
'''
if self.reward_balance > 0:
... | python | def reward_pool_balances(self):
''' Fetches and returns the 3 values
needed to calculate the reward pool
and other associated values such as rshares.
Returns the reward balance, all recent claims
and the current price of steem.
'''
if self.reward_balance > 0:
... | [
"def",
"reward_pool_balances",
"(",
"self",
")",
":",
"if",
"self",
".",
"reward_balance",
">",
"0",
":",
"return",
"self",
".",
"reward_balance",
"else",
":",
"reward_fund",
"=",
"self",
".",
"steem_instance",
"(",
")",
".",
"get_reward_fund",
"(",
")",
"... | Fetches and returns the 3 values
needed to calculate the reward pool
and other associated values such as rshares.
Returns the reward balance, all recent claims
and the current price of steem. | [
"Fetches",
"and",
"returns",
"the",
"3",
"values",
"needed",
"to",
"calculate",
"the",
"reward",
"pool",
"and",
"other",
"associated",
"values",
"such",
"as",
"rshares",
".",
"Returns",
"the",
"reward",
"balance",
"all",
"recent",
"claims",
"and",
"the",
"cu... | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L181-L199 |
242,909 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.rshares_to_steem | def rshares_to_steem (self, rshares):
''' Gets the reward pool balances
then calculates rshares to steem
'''
self.reward_pool_balances()
return round(
rshares
* self.reward_balance
/ self.recent_claims
* self.base, 4) | python | def rshares_to_steem (self, rshares):
''' Gets the reward pool balances
then calculates rshares to steem
'''
self.reward_pool_balances()
return round(
rshares
* self.reward_balance
/ self.recent_claims
* self.base, 4) | [
"def",
"rshares_to_steem",
"(",
"self",
",",
"rshares",
")",
":",
"self",
".",
"reward_pool_balances",
"(",
")",
"return",
"round",
"(",
"rshares",
"*",
"self",
".",
"reward_balance",
"/",
"self",
".",
"recent_claims",
"*",
"self",
".",
"base",
",",
"4",
... | Gets the reward pool balances
then calculates rshares to steem | [
"Gets",
"the",
"reward",
"pool",
"balances",
"then",
"calculates",
"rshares",
"to",
"steem"
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L202-L211 |
242,910 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.global_props | def global_props(self):
''' Retrieves the global properties
used to determine rates used for calculations
in converting steempower to vests etc.
Stores these in the Utilities class as that
is where the conversions take place, however
SimpleSteem is the class that contains... | python | def global_props(self):
''' Retrieves the global properties
used to determine rates used for calculations
in converting steempower to vests etc.
Stores these in the Utilities class as that
is where the conversions take place, however
SimpleSteem is the class that contains... | [
"def",
"global_props",
"(",
"self",
")",
":",
"if",
"self",
".",
"util",
".",
"info",
"is",
"None",
":",
"self",
".",
"util",
".",
"info",
"=",
"self",
".",
"steem_instance",
"(",
")",
".",
"get_dynamic_global_properties",
"(",
")",
"self",
".",
"util"... | Retrieves the global properties
used to determine rates used for calculations
in converting steempower to vests etc.
Stores these in the Utilities class as that
is where the conversions take place, however
SimpleSteem is the class that contains
steem_instance, so to to pr... | [
"Retrieves",
"the",
"global",
"properties",
"used",
"to",
"determine",
"rates",
"used",
"for",
"calculations",
"in",
"converting",
"steempower",
"to",
"vests",
"etc",
".",
"Stores",
"these",
"in",
"the",
"Utilities",
"class",
"as",
"that",
"is",
"where",
"the"... | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L214-L230 |
242,911 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.current_vote_value | def current_vote_value(self, **kwargs):
''' Ensures the needed variables are
created and set to defaults although
a variable number of variables are given.
'''
try:
kwargs.items()
except:
pass
else:
for key, value in kwargs.item... | python | def current_vote_value(self, **kwargs):
''' Ensures the needed variables are
created and set to defaults although
a variable number of variables are given.
'''
try:
kwargs.items()
except:
pass
else:
for key, value in kwargs.item... | [
"def",
"current_vote_value",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"kwargs",
".",
"items",
"(",
")",
"except",
":",
"pass",
"else",
":",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"setattr",
"(",
... | Ensures the needed variables are
created and set to defaults although
a variable number of variables are given. | [
"Ensures",
"the",
"needed",
"variables",
"are",
"created",
"and",
"set",
"to",
"defaults",
"although",
"a",
"variable",
"number",
"of",
"variables",
"are",
"given",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L233-L283 |
242,912 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.check_balances | def check_balances(self, account=None):
''' Fetches an account balance and makes
necessary conversions
'''
a = self.account(account)
if a is not False and a is not None:
self.sbdbal = Amount(a['sbd_balance']).amount
self.steembal = Amount(a['balance']).amo... | python | def check_balances(self, account=None):
''' Fetches an account balance and makes
necessary conversions
'''
a = self.account(account)
if a is not False and a is not None:
self.sbdbal = Amount(a['sbd_balance']).amount
self.steembal = Amount(a['balance']).amo... | [
"def",
"check_balances",
"(",
"self",
",",
"account",
"=",
"None",
")",
":",
"a",
"=",
"self",
".",
"account",
"(",
"account",
")",
"if",
"a",
"is",
"not",
"False",
"and",
"a",
"is",
"not",
"None",
":",
"self",
".",
"sbdbal",
"=",
"Amount",
"(",
... | Fetches an account balance and makes
necessary conversions | [
"Fetches",
"an",
"account",
"balance",
"and",
"makes",
"necessary",
"conversions"
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L286-L310 |
242,913 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.transfer_funds | def transfer_funds(self, to, amount, denom, msg):
''' Transfer SBD or STEEM to the given account
'''
try:
self.steem_instance().commit.transfer(to,
float(amount), denom, msg, self.mainaccount)
except Exception as e:
self.msg.error_message(e)
... | python | def transfer_funds(self, to, amount, denom, msg):
''' Transfer SBD or STEEM to the given account
'''
try:
self.steem_instance().commit.transfer(to,
float(amount), denom, msg, self.mainaccount)
except Exception as e:
self.msg.error_message(e)
... | [
"def",
"transfer_funds",
"(",
"self",
",",
"to",
",",
"amount",
",",
"denom",
",",
"msg",
")",
":",
"try",
":",
"self",
".",
"steem_instance",
"(",
")",
".",
"commit",
".",
"transfer",
"(",
"to",
",",
"float",
"(",
"amount",
")",
",",
"denom",
",",... | Transfer SBD or STEEM to the given account | [
"Transfer",
"SBD",
"or",
"STEEM",
"to",
"the",
"given",
"account"
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L313-L323 |
242,914 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.get_my_history | def get_my_history(self, account=None, limit=10000):
''' Fetches the account history from
most recent back
'''
if not account:
account = self.mainaccount
try:
h = self.steem_instance().get_account_history(
account, -1, limit)
except... | python | def get_my_history(self, account=None, limit=10000):
''' Fetches the account history from
most recent back
'''
if not account:
account = self.mainaccount
try:
h = self.steem_instance().get_account_history(
account, -1, limit)
except... | [
"def",
"get_my_history",
"(",
"self",
",",
"account",
"=",
"None",
",",
"limit",
"=",
"10000",
")",
":",
"if",
"not",
"account",
":",
"account",
"=",
"self",
".",
"mainaccount",
"try",
":",
"h",
"=",
"self",
".",
"steem_instance",
"(",
")",
".",
"get... | Fetches the account history from
most recent back | [
"Fetches",
"the",
"account",
"history",
"from",
"most",
"recent",
"back"
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L326-L339 |
242,915 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.reply | def reply(self, permlink, msgbody):
''' Used for creating a reply to a
post. Waits 20 seconds
after posting as that is the required
amount of time between posting.
'''
for num_of_retries in range(default.max_retry):
try:
self.steem_instance(... | python | def reply(self, permlink, msgbody):
''' Used for creating a reply to a
post. Waits 20 seconds
after posting as that is the required
amount of time between posting.
'''
for num_of_retries in range(default.max_retry):
try:
self.steem_instance(... | [
"def",
"reply",
"(",
"self",
",",
"permlink",
",",
"msgbody",
")",
":",
"for",
"num_of_retries",
"in",
"range",
"(",
"default",
".",
"max_retry",
")",
":",
"try",
":",
"self",
".",
"steem_instance",
"(",
")",
".",
"post",
"(",
"\"message\"",
",",
"msgb... | Used for creating a reply to a
post. Waits 20 seconds
after posting as that is the required
amount of time between posting. | [
"Used",
"for",
"creating",
"a",
"reply",
"to",
"a",
"post",
".",
"Waits",
"20",
"seconds",
"after",
"posting",
"as",
"that",
"is",
"the",
"required",
"amount",
"of",
"time",
"between",
"posting",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L377-L399 |
242,916 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.follow | def follow(self, author):
''' Follows the given account
'''
try:
self.steem_instance().commit.follow(author,
['blog'], self.mainaccount)
except Exception as e:
self.msg.error_message(e)
return False
else:
return Tru... | python | def follow(self, author):
''' Follows the given account
'''
try:
self.steem_instance().commit.follow(author,
['blog'], self.mainaccount)
except Exception as e:
self.msg.error_message(e)
return False
else:
return Tru... | [
"def",
"follow",
"(",
"self",
",",
"author",
")",
":",
"try",
":",
"self",
".",
"steem_instance",
"(",
")",
".",
"commit",
".",
"follow",
"(",
"author",
",",
"[",
"'blog'",
"]",
",",
"self",
".",
"mainaccount",
")",
"except",
"Exception",
"as",
"e",
... | Follows the given account | [
"Follows",
"the",
"given",
"account"
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L402-L412 |
242,917 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.following | def following(self, account=None, limit=100):
''' Gets a list of all the followers
of a given account. If no account is given
the followers of the mainaccount are
returned.
'''
if not account:
account = self.mainaccount
followingnames = []
try:... | python | def following(self, account=None, limit=100):
''' Gets a list of all the followers
of a given account. If no account is given
the followers of the mainaccount are
returned.
'''
if not account:
account = self.mainaccount
followingnames = []
try:... | [
"def",
"following",
"(",
"self",
",",
"account",
"=",
"None",
",",
"limit",
"=",
"100",
")",
":",
"if",
"not",
"account",
":",
"account",
"=",
"self",
".",
"mainaccount",
"followingnames",
"=",
"[",
"]",
"try",
":",
"self",
".",
"followed",
"=",
"sel... | Gets a list of all the followers
of a given account. If no account is given
the followers of the mainaccount are
returned. | [
"Gets",
"a",
"list",
"of",
"all",
"the",
"followers",
"of",
"a",
"given",
"account",
".",
"If",
"no",
"account",
"is",
"given",
"the",
"followers",
"of",
"the",
"mainaccount",
"are",
"returned",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L428-L446 |
242,918 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.vote_history | def vote_history(self, permlink, author=None):
''' Returns the raw vote history of a
given post from a given account
'''
if author is None:
author = self.mainaccount
return self.steem_instance().get_active_votes(author, permlink) | python | def vote_history(self, permlink, author=None):
''' Returns the raw vote history of a
given post from a given account
'''
if author is None:
author = self.mainaccount
return self.steem_instance().get_active_votes(author, permlink) | [
"def",
"vote_history",
"(",
"self",
",",
"permlink",
",",
"author",
"=",
"None",
")",
":",
"if",
"author",
"is",
"None",
":",
"author",
"=",
"self",
".",
"mainaccount",
"return",
"self",
".",
"steem_instance",
"(",
")",
".",
"get_active_votes",
"(",
"aut... | Returns the raw vote history of a
given post from a given account | [
"Returns",
"the",
"raw",
"vote",
"history",
"of",
"a",
"given",
"post",
"from",
"a",
"given",
"account"
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L487-L493 |
242,919 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.dex_ticker | def dex_ticker(self):
''' Simply grabs the ticker using the
steem_instance method and adds it
to a class variable.
'''
self.dex = Dex(self.steem_instance())
self.ticker = self.dex.get_ticker();
return self.ticker | python | def dex_ticker(self):
''' Simply grabs the ticker using the
steem_instance method and adds it
to a class variable.
'''
self.dex = Dex(self.steem_instance())
self.ticker = self.dex.get_ticker();
return self.ticker | [
"def",
"dex_ticker",
"(",
"self",
")",
":",
"self",
".",
"dex",
"=",
"Dex",
"(",
"self",
".",
"steem_instance",
"(",
")",
")",
"self",
".",
"ticker",
"=",
"self",
".",
"dex",
".",
"get_ticker",
"(",
")",
"return",
"self",
".",
"ticker"
] | Simply grabs the ticker using the
steem_instance method and adds it
to a class variable. | [
"Simply",
"grabs",
"the",
"ticker",
"using",
"the",
"steem_instance",
"method",
"and",
"adds",
"it",
"to",
"a",
"class",
"variable",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L539-L546 |
242,920 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.steem_to_sbd | def steem_to_sbd(self, steemamt=0, price=0, account=None):
''' Uses the ticker to get the highest bid
and moves the steem at that price.
'''
if not account:
account = self.mainaccount
if self.check_balances(account):
if steemamt == 0:
steem... | python | def steem_to_sbd(self, steemamt=0, price=0, account=None):
''' Uses the ticker to get the highest bid
and moves the steem at that price.
'''
if not account:
account = self.mainaccount
if self.check_balances(account):
if steemamt == 0:
steem... | [
"def",
"steem_to_sbd",
"(",
"self",
",",
"steemamt",
"=",
"0",
",",
"price",
"=",
"0",
",",
"account",
"=",
"None",
")",
":",
"if",
"not",
"account",
":",
"account",
"=",
"self",
".",
"mainaccount",
"if",
"self",
".",
"check_balances",
"(",
"account",
... | Uses the ticker to get the highest bid
and moves the steem at that price. | [
"Uses",
"the",
"ticker",
"to",
"get",
"the",
"highest",
"bid",
"and",
"moves",
"the",
"steem",
"at",
"that",
"price",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L549-L576 |
242,921 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.sbd_to_steem | def sbd_to_steem(self, sbd=0, price=0, account=None):
''' Uses the ticker to get the lowest ask
and moves the sbd at that price.
'''
if not account:
account = self.mainaccount
if self.check_balances(account):
if sbd == 0:
sbd = self.sbdbal
... | python | def sbd_to_steem(self, sbd=0, price=0, account=None):
''' Uses the ticker to get the lowest ask
and moves the sbd at that price.
'''
if not account:
account = self.mainaccount
if self.check_balances(account):
if sbd == 0:
sbd = self.sbdbal
... | [
"def",
"sbd_to_steem",
"(",
"self",
",",
"sbd",
"=",
"0",
",",
"price",
"=",
"0",
",",
"account",
"=",
"None",
")",
":",
"if",
"not",
"account",
":",
"account",
"=",
"self",
".",
"mainaccount",
"if",
"self",
".",
"check_balances",
"(",
"account",
")"... | Uses the ticker to get the lowest ask
and moves the sbd at that price. | [
"Uses",
"the",
"ticker",
"to",
"get",
"the",
"lowest",
"ask",
"and",
"moves",
"the",
"sbd",
"at",
"that",
"price",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L579-L606 |
242,922 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.vote_witness | def vote_witness(self, witness, account=None):
''' Uses the steem_instance method to
vote on a witness.
'''
if not account:
account = self.mainaccount
try:
self.steem_instance().approve_witness(witness, account=account)
except Exception as e:
... | python | def vote_witness(self, witness, account=None):
''' Uses the steem_instance method to
vote on a witness.
'''
if not account:
account = self.mainaccount
try:
self.steem_instance().approve_witness(witness, account=account)
except Exception as e:
... | [
"def",
"vote_witness",
"(",
"self",
",",
"witness",
",",
"account",
"=",
"None",
")",
":",
"if",
"not",
"account",
":",
"account",
"=",
"self",
".",
"mainaccount",
"try",
":",
"self",
".",
"steem_instance",
"(",
")",
".",
"approve_witness",
"(",
"witness... | Uses the steem_instance method to
vote on a witness. | [
"Uses",
"the",
"steem_instance",
"method",
"to",
"vote",
"on",
"a",
"witness",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L609-L622 |
242,923 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.unvote_witness | def unvote_witness(self, witness, account=None):
''' Uses the steem_instance method to
unvote a witness.
'''
if not account:
account = self.mainaccount
try:
self.steem_instance().disapprove_witness(witness, account=account)
except Exception as e:
... | python | def unvote_witness(self, witness, account=None):
''' Uses the steem_instance method to
unvote a witness.
'''
if not account:
account = self.mainaccount
try:
self.steem_instance().disapprove_witness(witness, account=account)
except Exception as e:
... | [
"def",
"unvote_witness",
"(",
"self",
",",
"witness",
",",
"account",
"=",
"None",
")",
":",
"if",
"not",
"account",
":",
"account",
"=",
"self",
".",
"mainaccount",
"try",
":",
"self",
".",
"steem_instance",
"(",
")",
".",
"disapprove_witness",
"(",
"wi... | Uses the steem_instance method to
unvote a witness. | [
"Uses",
"the",
"steem_instance",
"method",
"to",
"unvote",
"a",
"witness",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L625-L638 |
242,924 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.voted_me_witness | def voted_me_witness(self, account=None, limit=100):
''' Fetches all those a given account is
following and sees if they have voted that
account as witness.
'''
if not account:
account = self.mainaccount
self.has_voted = []
self.has_not_voted = []
... | python | def voted_me_witness(self, account=None, limit=100):
''' Fetches all those a given account is
following and sees if they have voted that
account as witness.
'''
if not account:
account = self.mainaccount
self.has_voted = []
self.has_not_voted = []
... | [
"def",
"voted_me_witness",
"(",
"self",
",",
"account",
"=",
"None",
",",
"limit",
"=",
"100",
")",
":",
"if",
"not",
"account",
":",
"account",
"=",
"self",
".",
"mainaccount",
"self",
".",
"has_voted",
"=",
"[",
"]",
"self",
".",
"has_not_voted",
"="... | Fetches all those a given account is
following and sees if they have voted that
account as witness. | [
"Fetches",
"all",
"those",
"a",
"given",
"account",
"is",
"following",
"and",
"sees",
"if",
"they",
"have",
"voted",
"that",
"account",
"as",
"witness",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L641-L660 |
242,925 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.muted_me | def muted_me(self, account=None, limit=100):
''' Fetches all those a given account is
following and sees if they have muted that
account.
'''
self.has_muted = []
if account is None:
account = self.mainaccount
following = self.following(account, limit)
... | python | def muted_me(self, account=None, limit=100):
''' Fetches all those a given account is
following and sees if they have muted that
account.
'''
self.has_muted = []
if account is None:
account = self.mainaccount
following = self.following(account, limit)
... | [
"def",
"muted_me",
"(",
"self",
",",
"account",
"=",
"None",
",",
"limit",
"=",
"100",
")",
":",
"self",
".",
"has_muted",
"=",
"[",
"]",
"if",
"account",
"is",
"None",
":",
"account",
"=",
"self",
".",
"mainaccount",
"following",
"=",
"self",
".",
... | Fetches all those a given account is
following and sees if they have muted that
account. | [
"Fetches",
"all",
"those",
"a",
"given",
"account",
"is",
"following",
"and",
"sees",
"if",
"they",
"have",
"muted",
"that",
"account",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L663-L693 |
242,926 | ArtoLabs/SimpleSteem | simplesteem/simplesteem.py | SimpleSteem.delegate | def delegate(self, to, steempower):
''' Delegates based on Steem Power rather
than by vests.
'''
self.global_props()
vests = self.util.sp_to_vests(steempower)
strvests = str(vests)
strvests = strvests + " VESTS"
try:
self.steem_instance().commi... | python | def delegate(self, to, steempower):
''' Delegates based on Steem Power rather
than by vests.
'''
self.global_props()
vests = self.util.sp_to_vests(steempower)
strvests = str(vests)
strvests = strvests + " VESTS"
try:
self.steem_instance().commi... | [
"def",
"delegate",
"(",
"self",
",",
"to",
",",
"steempower",
")",
":",
"self",
".",
"global_props",
"(",
")",
"vests",
"=",
"self",
".",
"util",
".",
"sp_to_vests",
"(",
"steempower",
")",
"strvests",
"=",
"str",
"(",
"vests",
")",
"strvests",
"=",
... | Delegates based on Steem Power rather
than by vests. | [
"Delegates",
"based",
"on",
"Steem",
"Power",
"rather",
"than",
"by",
"vests",
"."
] | ce8be0ae81f8878b460bc156693f1957f7dd34a3 | https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L696-L715 |
242,927 | diffeo/rejester | rejester/run_multi_worker.py | start_logging | def start_logging(gconfig, logpath):
'''Turn on logging and set up the global config.
This expects the :mod:`yakonfig` global configuration to be unset,
and establishes it. It starts the log system via the :mod:`dblogger`
setup. In addition to :mod:`dblogger`'s defaults, if `logpath` is
provided,... | python | def start_logging(gconfig, logpath):
'''Turn on logging and set up the global config.
This expects the :mod:`yakonfig` global configuration to be unset,
and establishes it. It starts the log system via the :mod:`dblogger`
setup. In addition to :mod:`dblogger`'s defaults, if `logpath` is
provided,... | [
"def",
"start_logging",
"(",
"gconfig",
",",
"logpath",
")",
":",
"yakonfig",
".",
"set_default_config",
"(",
"[",
"rejester",
",",
"dblogger",
"]",
",",
"config",
"=",
"gconfig",
")",
"if",
"logpath",
":",
"formatter",
"=",
"dblogger",
".",
"FixedWidthForma... | Turn on logging and set up the global config.
This expects the :mod:`yakonfig` global configuration to be unset,
and establishes it. It starts the log system via the :mod:`dblogger`
setup. In addition to :mod:`dblogger`'s defaults, if `logpath` is
provided, a :class:`logging.handlers.RotatingFileHand... | [
"Turn",
"on",
"logging",
"and",
"set",
"up",
"the",
"global",
"config",
"."
] | 5438a4a18be2801d7826c46e2079ba9639d2ecb4 | https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run_multi_worker.py#L53-L77 |
242,928 | diffeo/rejester | rejester/run_multi_worker.py | start_worker | def start_worker(which_worker, config={}):
'''Start some worker class.
:param str which_worker: name of the worker
:param dict config: ``rejester`` config block
'''
if which_worker == 'multi_worker':
cls = MultiWorker
elif which_worker == 'fork_worker':
cls = ForkWorker
els... | python | def start_worker(which_worker, config={}):
'''Start some worker class.
:param str which_worker: name of the worker
:param dict config: ``rejester`` config block
'''
if which_worker == 'multi_worker':
cls = MultiWorker
elif which_worker == 'fork_worker':
cls = ForkWorker
els... | [
"def",
"start_worker",
"(",
"which_worker",
",",
"config",
"=",
"{",
"}",
")",
":",
"if",
"which_worker",
"==",
"'multi_worker'",
":",
"cls",
"=",
"MultiWorker",
"elif",
"which_worker",
"==",
"'fork_worker'",
":",
"cls",
"=",
"ForkWorker",
"else",
":",
"# Do... | Start some worker class.
:param str which_worker: name of the worker
:param dict config: ``rejester`` config block | [
"Start",
"some",
"worker",
"class",
"."
] | 5438a4a18be2801d7826c46e2079ba9639d2ecb4 | https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run_multi_worker.py#L79-L93 |
242,929 | diffeo/rejester | rejester/run_multi_worker.py | go | def go(gconfig, args):
'''Actually run the worker.
This does some required housekeeping, like setting up logging for
:class:`~rejester.workers.MultiWorker` and establishing the global
:mod:`yakonfig` configuration. This expects to be called with the
:mod:`yakonfig` configuration unset.
:param... | python | def go(gconfig, args):
'''Actually run the worker.
This does some required housekeeping, like setting up logging for
:class:`~rejester.workers.MultiWorker` and establishing the global
:mod:`yakonfig` configuration. This expects to be called with the
:mod:`yakonfig` configuration unset.
:param... | [
"def",
"go",
"(",
"gconfig",
",",
"args",
")",
":",
"rconfig",
"=",
"gconfig",
"[",
"'rejester'",
"]",
"which_worker",
"=",
"rconfig",
".",
"get",
"(",
"'worker'",
",",
"'fork_worker'",
")",
"if",
"which_worker",
"==",
"'fork_worker'",
":",
"yakonfig",
"."... | Actually run the worker.
This does some required housekeeping, like setting up logging for
:class:`~rejester.workers.MultiWorker` and establishing the global
:mod:`yakonfig` configuration. This expects to be called with the
:mod:`yakonfig` configuration unset.
:param dict gconfig: the :mod:`yakon... | [
"Actually",
"run",
"the",
"worker",
"."
] | 5438a4a18be2801d7826c46e2079ba9639d2ecb4 | https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run_multi_worker.py#L95-L113 |
242,930 | diffeo/rejester | rejester/run_multi_worker.py | fork_worker | def fork_worker(gconfig, args):
'''Run the worker as a daemon process.
This uses :mod:`daemon` to run the standard double-fork, so it can
return immediately and successfully in the parent process having forked.
:param dict gconfig: the :mod:`yakonfig` global configuration
:param args: command-line... | python | def fork_worker(gconfig, args):
'''Run the worker as a daemon process.
This uses :mod:`daemon` to run the standard double-fork, so it can
return immediately and successfully in the parent process having forked.
:param dict gconfig: the :mod:`yakonfig` global configuration
:param args: command-line... | [
"def",
"fork_worker",
"(",
"gconfig",
",",
"args",
")",
":",
"if",
"args",
".",
"pidfile",
":",
"pidfile_lock",
"=",
"lockfile",
".",
"FileLock",
"(",
"args",
".",
"pidfile",
")",
"else",
":",
"pidfile_lock",
"=",
"None",
"with",
"daemon",
".",
"DaemonCo... | Run the worker as a daemon process.
This uses :mod:`daemon` to run the standard double-fork, so it can
return immediately and successfully in the parent process having forked.
:param dict gconfig: the :mod:`yakonfig` global configuration
:param args: command-line arguments | [
"Run",
"the",
"worker",
"as",
"a",
"daemon",
"process",
"."
] | 5438a4a18be2801d7826c46e2079ba9639d2ecb4 | https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/run_multi_worker.py#L115-L138 |
242,931 | pyros-dev/pyros-common | pyros_interfaces_common/transient_if_pool.py | TransientIfPool.transient_change_detect | def transient_change_detect(self, *class_build_args, **class_build_kwargs):
"""
This should be called when we want to detect a change in the status of the system regarding the transient list
This function also applies changes due to regex_set updates if needed
_transient_change_detect ->... | python | def transient_change_detect(self, *class_build_args, **class_build_kwargs):
"""
This should be called when we want to detect a change in the status of the system regarding the transient list
This function also applies changes due to regex_set updates if needed
_transient_change_detect ->... | [
"def",
"transient_change_detect",
"(",
"self",
",",
"*",
"class_build_args",
",",
"*",
"*",
"class_build_kwargs",
")",
":",
"transient_detected",
"=",
"set",
"(",
"self",
".",
"get_transients_available",
"(",
")",
")",
"#TODO : unify that last_got_set with the *_availab... | This should be called when we want to detect a change in the status of the system regarding the transient list
This function also applies changes due to regex_set updates if needed
_transient_change_detect -> _transient_change_diff -> _update_transients | [
"This",
"should",
"be",
"called",
"when",
"we",
"want",
"to",
"detect",
"a",
"change",
"in",
"the",
"status",
"of",
"the",
"system",
"regarding",
"the",
"transient",
"list",
"This",
"function",
"also",
"applies",
"changes",
"due",
"to",
"regex_set",
"updates... | 0709538b8777ec055ea31f59cdca5bebaaabb04e | https://github.com/pyros-dev/pyros-common/blob/0709538b8777ec055ea31f59cdca5bebaaabb04e/pyros_interfaces_common/transient_if_pool.py#L126-L153 |
242,932 | pawamoy/python-getdoc | src/getdoc/__init__.py | get_function_doc | def get_function_doc(function, config=default_config):
"""Return doc for a function."""
if config.exclude_function:
for ex in config.exclude_function:
if ex.match(function.__name__):
return None
return _doc_object(function, 'function', config=config) | python | def get_function_doc(function, config=default_config):
"""Return doc for a function."""
if config.exclude_function:
for ex in config.exclude_function:
if ex.match(function.__name__):
return None
return _doc_object(function, 'function', config=config) | [
"def",
"get_function_doc",
"(",
"function",
",",
"config",
"=",
"default_config",
")",
":",
"if",
"config",
".",
"exclude_function",
":",
"for",
"ex",
"in",
"config",
".",
"exclude_function",
":",
"if",
"ex",
".",
"match",
"(",
"function",
".",
"__name__",
... | Return doc for a function. | [
"Return",
"doc",
"for",
"a",
"function",
"."
] | 7589605be746ecde54f3fb68a46c88242d9b6405 | https://github.com/pawamoy/python-getdoc/blob/7589605be746ecde54f3fb68a46c88242d9b6405/src/getdoc/__init__.py#L144-L151 |
242,933 | pawamoy/python-getdoc | src/getdoc/__init__.py | get_class_doc | def get_class_doc(klass, config=default_config):
"""Return doc for a class."""
if config.exclude_class:
for ex in config.exclude_class:
if ex.match(klass.__name__):
return None
nested_doc = []
class_dict = klass.__dict__
for item in dir(klass):
if item i... | python | def get_class_doc(klass, config=default_config):
"""Return doc for a class."""
if config.exclude_class:
for ex in config.exclude_class:
if ex.match(klass.__name__):
return None
nested_doc = []
class_dict = klass.__dict__
for item in dir(klass):
if item i... | [
"def",
"get_class_doc",
"(",
"klass",
",",
"config",
"=",
"default_config",
")",
":",
"if",
"config",
".",
"exclude_class",
":",
"for",
"ex",
"in",
"config",
".",
"exclude_class",
":",
"if",
"ex",
".",
"match",
"(",
"klass",
".",
"__name__",
")",
":",
... | Return doc for a class. | [
"Return",
"doc",
"for",
"a",
"class",
"."
] | 7589605be746ecde54f3fb68a46c88242d9b6405 | https://github.com/pawamoy/python-getdoc/blob/7589605be746ecde54f3fb68a46c88242d9b6405/src/getdoc/__init__.py#L154-L174 |
242,934 | pawamoy/python-getdoc | src/getdoc/__init__.py | get_module_doc | def get_module_doc(module, config=default_config, already_met=None):
"""Return doc for a module."""
# Avoid recursion loops (init)
if already_met is None:
already_met = set()
if config.exclude_module:
for ex in config.exclude_module:
if ex.match(module.__name__):
... | python | def get_module_doc(module, config=default_config, already_met=None):
"""Return doc for a module."""
# Avoid recursion loops (init)
if already_met is None:
already_met = set()
if config.exclude_module:
for ex in config.exclude_module:
if ex.match(module.__name__):
... | [
"def",
"get_module_doc",
"(",
"module",
",",
"config",
"=",
"default_config",
",",
"already_met",
"=",
"None",
")",
":",
"# Avoid recursion loops (init)",
"if",
"already_met",
"is",
"None",
":",
"already_met",
"=",
"set",
"(",
")",
"if",
"config",
".",
"exclud... | Return doc for a module. | [
"Return",
"doc",
"for",
"a",
"module",
"."
] | 7589605be746ecde54f3fb68a46c88242d9b6405 | https://github.com/pawamoy/python-getdoc/blob/7589605be746ecde54f3fb68a46c88242d9b6405/src/getdoc/__init__.py#L177-L240 |
242,935 | pawamoy/python-getdoc | src/getdoc/__init__.py | Ex.match | def match(self, name):
"""
Check if given name matches.
Args:
name (str): name to check.
Returns:
bool: matches name.
"""
if self.method == Ex.Method.PREFIX:
return name.startswith(self.value)
elif self.method == Ex.Method.SUF... | python | def match(self, name):
"""
Check if given name matches.
Args:
name (str): name to check.
Returns:
bool: matches name.
"""
if self.method == Ex.Method.PREFIX:
return name.startswith(self.value)
elif self.method == Ex.Method.SUF... | [
"def",
"match",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"method",
"==",
"Ex",
".",
"Method",
".",
"PREFIX",
":",
"return",
"name",
".",
"startswith",
"(",
"self",
".",
"value",
")",
"elif",
"self",
".",
"method",
"==",
"Ex",
".",
"... | Check if given name matches.
Args:
name (str): name to check.
Returns:
bool: matches name. | [
"Check",
"if",
"given",
"name",
"matches",
"."
] | 7589605be746ecde54f3fb68a46c88242d9b6405 | https://github.com/pawamoy/python-getdoc/blob/7589605be746ecde54f3fb68a46c88242d9b6405/src/getdoc/__init__.py#L57-L77 |
242,936 | mayfield/shellish | shellish/command/autocommand.py | autocommand | def autocommand(func):
""" A simplified decorator for making a single function a Command
instance. In the future this will leverage PEP0484 to do really smart
function parsing and conversion to argparse actions. """
name = func.__name__
title, desc = command.parse_docstring(func)
if not title:
... | python | def autocommand(func):
""" A simplified decorator for making a single function a Command
instance. In the future this will leverage PEP0484 to do really smart
function parsing and conversion to argparse actions. """
name = func.__name__
title, desc = command.parse_docstring(func)
if not title:
... | [
"def",
"autocommand",
"(",
"func",
")",
":",
"name",
"=",
"func",
".",
"__name__",
"title",
",",
"desc",
"=",
"command",
".",
"parse_docstring",
"(",
"func",
")",
"if",
"not",
"title",
":",
"title",
"=",
"'Auto command for: %s'",
"%",
"name",
"if",
"not"... | A simplified decorator for making a single function a Command
instance. In the future this will leverage PEP0484 to do really smart
function parsing and conversion to argparse actions. | [
"A",
"simplified",
"decorator",
"for",
"making",
"a",
"single",
"function",
"a",
"Command",
"instance",
".",
"In",
"the",
"future",
"this",
"will",
"leverage",
"PEP0484",
"to",
"do",
"really",
"smart",
"function",
"parsing",
"and",
"conversion",
"to",
"argpars... | df0f0e4612d138c34d8cb99b66ab5b8e47f1414a | https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/command/autocommand.py#L114-L125 |
242,937 | mayfield/shellish | shellish/command/autocommand.py | AutoCommand.run | def run(self, args):
""" Convert the unordered args into function arguments. """
args = vars(args)
positionals = []
keywords = {}
for action in self.argparser._actions:
if not hasattr(action, 'label'):
continue
if action.label == 'positiona... | python | def run(self, args):
""" Convert the unordered args into function arguments. """
args = vars(args)
positionals = []
keywords = {}
for action in self.argparser._actions:
if not hasattr(action, 'label'):
continue
if action.label == 'positiona... | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"args",
"=",
"vars",
"(",
"args",
")",
"positionals",
"=",
"[",
"]",
"keywords",
"=",
"{",
"}",
"for",
"action",
"in",
"self",
".",
"argparser",
".",
"_actions",
":",
"if",
"not",
"hasattr",
"(",
... | Convert the unordered args into function arguments. | [
"Convert",
"the",
"unordered",
"args",
"into",
"function",
"arguments",
"."
] | df0f0e4612d138c34d8cb99b66ab5b8e47f1414a | https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/command/autocommand.py#L29-L52 |
242,938 | jpscaletti/moar | moar/engines/wand_engine.py | WandEngine._save_to | def _save_to(self, im, path, format=None):
"""Save the image for testing.
"""
format = format or im.format
if not format:
_, format = splitext(path)
format = format[1:]
im.format = format.lower()
im.save(filename=path) | python | def _save_to(self, im, path, format=None):
"""Save the image for testing.
"""
format = format or im.format
if not format:
_, format = splitext(path)
format = format[1:]
im.format = format.lower()
im.save(filename=path) | [
"def",
"_save_to",
"(",
"self",
",",
"im",
",",
"path",
",",
"format",
"=",
"None",
")",
":",
"format",
"=",
"format",
"or",
"im",
".",
"format",
"if",
"not",
"format",
":",
"_",
",",
"format",
"=",
"splitext",
"(",
"path",
")",
"format",
"=",
"f... | Save the image for testing. | [
"Save",
"the",
"image",
"for",
"testing",
"."
] | 22694e5671b6adaccc4c9c87db7bdd701d20e734 | https://github.com/jpscaletti/moar/blob/22694e5671b6adaccc4c9c87db7bdd701d20e734/moar/engines/wand_engine.py#L33-L41 |
242,939 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger._log | def _log(self, priority, message, *args, **kwargs):
"""Generic log functions
"""
for arg in args:
message = message + "\n" + self.pretty_printer.pformat(arg)
self.logger.log(priority, message) | python | def _log(self, priority, message, *args, **kwargs):
"""Generic log functions
"""
for arg in args:
message = message + "\n" + self.pretty_printer.pformat(arg)
self.logger.log(priority, message) | [
"def",
"_log",
"(",
"self",
",",
"priority",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"arg",
"in",
"args",
":",
"message",
"=",
"message",
"+",
"\"\\n\"",
"+",
"self",
".",
"pretty_printer",
".",
"pformat",
"(",
"... | Generic log functions | [
"Generic",
"log",
"functions"
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L70-L76 |
242,940 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.debug | def debug(self, message, *args, **kwargs):
"""Debug level to use and abuse when coding
"""
self._log(logging.DEBUG, message, *args, **kwargs) | python | def debug(self, message, *args, **kwargs):
"""Debug level to use and abuse when coding
"""
self._log(logging.DEBUG, message, *args, **kwargs) | [
"def",
"debug",
"(",
"self",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_log",
"(",
"logging",
".",
"DEBUG",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Debug level to use and abuse when coding | [
"Debug",
"level",
"to",
"use",
"and",
"abuse",
"when",
"coding"
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L78-L81 |
242,941 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.warn | def warn(self, message, *args, **kwargs):
"""Send email and syslog by default ...
"""
self._log(logging.WARNING, message, *args, **kwargs) | python | def warn(self, message, *args, **kwargs):
"""Send email and syslog by default ...
"""
self._log(logging.WARNING, message, *args, **kwargs) | [
"def",
"warn",
"(",
"self",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_log",
"(",
"logging",
".",
"WARNING",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Send email and syslog by default ... | [
"Send",
"email",
"and",
"syslog",
"by",
"default",
"..."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L88-L91 |
242,942 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.warning | def warning(self, message, *args, **kwargs):
"""Alias to warn
"""
self._log(logging.WARNING, message, *args, **kwargs) | python | def warning(self, message, *args, **kwargs):
"""Alias to warn
"""
self._log(logging.WARNING, message, *args, **kwargs) | [
"def",
"warning",
"(",
"self",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_log",
"(",
"logging",
".",
"WARNING",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Alias to warn | [
"Alias",
"to",
"warn"
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L93-L96 |
242,943 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.error | def error(self, message, *args, **kwargs):
"""Should not happen ...
"""
self._log(logging.ERROR, message, *args, **kwargs) | python | def error(self, message, *args, **kwargs):
"""Should not happen ...
"""
self._log(logging.ERROR, message, *args, **kwargs) | [
"def",
"error",
"(",
"self",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_log",
"(",
"logging",
".",
"ERROR",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Should not happen ... | [
"Should",
"not",
"happen",
"..."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L98-L101 |
242,944 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.init_logger | def init_logger(self):
"""Create configuration for the root logger."""
# All logs are comming to this logger
self.logger.setLevel(logging.DEBUG)
self.logger.propagate = False
# Logging to console
if self.min_log_level_to_print:
level = self.min_log_level_to_p... | python | def init_logger(self):
"""Create configuration for the root logger."""
# All logs are comming to this logger
self.logger.setLevel(logging.DEBUG)
self.logger.propagate = False
# Logging to console
if self.min_log_level_to_print:
level = self.min_log_level_to_p... | [
"def",
"init_logger",
"(",
"self",
")",
":",
"# All logs are comming to this logger",
"self",
".",
"logger",
".",
"setLevel",
"(",
"logging",
".",
"DEBUG",
")",
"self",
".",
"logger",
".",
"propagate",
"=",
"False",
"# Logging to console",
"if",
"self",
".",
"... | Create configuration for the root logger. | [
"Create",
"configuration",
"for",
"the",
"root",
"logger",
"."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L113-L143 |
242,945 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.new_iteration | def new_iteration(self, prefix):
"""When inside a loop logger, created a new iteration
"""
# Flush data for the current iteration
self.flush()
# Fix prefix
self.prefix[-1] = prefix
self.reset_formatter() | python | def new_iteration(self, prefix):
"""When inside a loop logger, created a new iteration
"""
# Flush data for the current iteration
self.flush()
# Fix prefix
self.prefix[-1] = prefix
self.reset_formatter() | [
"def",
"new_iteration",
"(",
"self",
",",
"prefix",
")",
":",
"# Flush data for the current iteration",
"self",
".",
"flush",
"(",
")",
"# Fix prefix",
"self",
".",
"prefix",
"[",
"-",
"1",
"]",
"=",
"prefix",
"self",
".",
"reset_formatter",
"(",
")"
] | When inside a loop logger, created a new iteration | [
"When",
"inside",
"a",
"loop",
"logger",
"created",
"a",
"new",
"iteration"
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L168-L176 |
242,946 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.reset_formatter | def reset_formatter(self):
"""Rebuild formatter for all handlers."""
for handler in self.handlers:
formatter = self.get_formatter(handler)
handler.setFormatter(formatter) | python | def reset_formatter(self):
"""Rebuild formatter for all handlers."""
for handler in self.handlers:
formatter = self.get_formatter(handler)
handler.setFormatter(formatter) | [
"def",
"reset_formatter",
"(",
"self",
")",
":",
"for",
"handler",
"in",
"self",
".",
"handlers",
":",
"formatter",
"=",
"self",
".",
"get_formatter",
"(",
"handler",
")",
"handler",
".",
"setFormatter",
"(",
"formatter",
")"
] | Rebuild formatter for all handlers. | [
"Rebuild",
"formatter",
"for",
"all",
"handlers",
"."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L178-L182 |
242,947 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger._set_min_level | def _set_min_level(self, handler_class, level):
"""Generic method to setLevel for handlers."""
if self._exist_handler(handler_class):
if not level:
self._delete_handler(handler_class)
else:
self._update_handler(handler_class, level=level)
e... | python | def _set_min_level(self, handler_class, level):
"""Generic method to setLevel for handlers."""
if self._exist_handler(handler_class):
if not level:
self._delete_handler(handler_class)
else:
self._update_handler(handler_class, level=level)
e... | [
"def",
"_set_min_level",
"(",
"self",
",",
"handler_class",
",",
"level",
")",
":",
"if",
"self",
".",
"_exist_handler",
"(",
"handler_class",
")",
":",
"if",
"not",
"level",
":",
"self",
".",
"_delete_handler",
"(",
"handler_class",
")",
"else",
":",
"sel... | Generic method to setLevel for handlers. | [
"Generic",
"method",
"to",
"setLevel",
"for",
"handlers",
"."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L189-L197 |
242,948 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.set_min_level_to_print | def set_min_level_to_print(self, level):
"""Allow to change print level after creation
"""
self.min_log_level_to_print = level
handler_class = logging.StreamHandler
self._set_min_level(handler_class, level) | python | def set_min_level_to_print(self, level):
"""Allow to change print level after creation
"""
self.min_log_level_to_print = level
handler_class = logging.StreamHandler
self._set_min_level(handler_class, level) | [
"def",
"set_min_level_to_print",
"(",
"self",
",",
"level",
")",
":",
"self",
".",
"min_log_level_to_print",
"=",
"level",
"handler_class",
"=",
"logging",
".",
"StreamHandler",
"self",
".",
"_set_min_level",
"(",
"handler_class",
",",
"level",
")"
] | Allow to change print level after creation | [
"Allow",
"to",
"change",
"print",
"level",
"after",
"creation"
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L199-L204 |
242,949 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.set_min_level_to_save | def set_min_level_to_save(self, level):
"""Allow to change save level after creation
"""
self.min_log_level_to_save = level
handler_class = logging.handlers.TimedRotatingFileHandler
self._set_min_level(handler_class, level) | python | def set_min_level_to_save(self, level):
"""Allow to change save level after creation
"""
self.min_log_level_to_save = level
handler_class = logging.handlers.TimedRotatingFileHandler
self._set_min_level(handler_class, level) | [
"def",
"set_min_level_to_save",
"(",
"self",
",",
"level",
")",
":",
"self",
".",
"min_log_level_to_save",
"=",
"level",
"handler_class",
"=",
"logging",
".",
"handlers",
".",
"TimedRotatingFileHandler",
"self",
".",
"_set_min_level",
"(",
"handler_class",
",",
"l... | Allow to change save level after creation | [
"Allow",
"to",
"change",
"save",
"level",
"after",
"creation"
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L206-L211 |
242,950 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.set_min_level_to_mail | def set_min_level_to_mail(self, level):
"""Allow to change mail level after creation
"""
self.min_log_level_to_mail = level
handler_class = AlkiviEmailHandler
self._set_min_level(handler_class, level) | python | def set_min_level_to_mail(self, level):
"""Allow to change mail level after creation
"""
self.min_log_level_to_mail = level
handler_class = AlkiviEmailHandler
self._set_min_level(handler_class, level) | [
"def",
"set_min_level_to_mail",
"(",
"self",
",",
"level",
")",
":",
"self",
".",
"min_log_level_to_mail",
"=",
"level",
"handler_class",
"=",
"AlkiviEmailHandler",
"self",
".",
"_set_min_level",
"(",
"handler_class",
",",
"level",
")"
] | Allow to change mail level after creation | [
"Allow",
"to",
"change",
"mail",
"level",
"after",
"creation"
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L213-L218 |
242,951 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.set_min_level_to_syslog | def set_min_level_to_syslog(self, level):
"""Allow to change syslog level after creation
"""
self.min_log_level_to_syslog = level
handler_class = logging.handlers.SysLogHandler
self._set_min_level(handler_class, level) | python | def set_min_level_to_syslog(self, level):
"""Allow to change syslog level after creation
"""
self.min_log_level_to_syslog = level
handler_class = logging.handlers.SysLogHandler
self._set_min_level(handler_class, level) | [
"def",
"set_min_level_to_syslog",
"(",
"self",
",",
"level",
")",
":",
"self",
".",
"min_log_level_to_syslog",
"=",
"level",
"handler_class",
"=",
"logging",
".",
"handlers",
".",
"SysLogHandler",
"self",
".",
"_set_min_level",
"(",
"handler_class",
",",
"level",
... | Allow to change syslog level after creation | [
"Allow",
"to",
"change",
"syslog",
"level",
"after",
"creation"
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L220-L225 |
242,952 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger._get_handler | def _get_handler(self, handler_class):
"""Return an existing class of handler."""
element = None
for handler in self.handlers:
if isinstance(handler, handler_class):
element = handler
break
return element | python | def _get_handler(self, handler_class):
"""Return an existing class of handler."""
element = None
for handler in self.handlers:
if isinstance(handler, handler_class):
element = handler
break
return element | [
"def",
"_get_handler",
"(",
"self",
",",
"handler_class",
")",
":",
"element",
"=",
"None",
"for",
"handler",
"in",
"self",
".",
"handlers",
":",
"if",
"isinstance",
"(",
"handler",
",",
"handler_class",
")",
":",
"element",
"=",
"handler",
"break",
"retur... | Return an existing class of handler. | [
"Return",
"an",
"existing",
"class",
"of",
"handler",
"."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L227-L234 |
242,953 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger._delete_handler | def _delete_handler(self, handler_class):
"""Delete a specific handler from our logger."""
to_remove = self._get_handler(handler_class)
if not to_remove:
logging.warning('Error we should have an element to remove')
else:
self.handlers.remove(to_remove)
... | python | def _delete_handler(self, handler_class):
"""Delete a specific handler from our logger."""
to_remove = self._get_handler(handler_class)
if not to_remove:
logging.warning('Error we should have an element to remove')
else:
self.handlers.remove(to_remove)
... | [
"def",
"_delete_handler",
"(",
"self",
",",
"handler_class",
")",
":",
"to_remove",
"=",
"self",
".",
"_get_handler",
"(",
"handler_class",
")",
"if",
"not",
"to_remove",
":",
"logging",
".",
"warning",
"(",
"'Error we should have an element to remove'",
")",
"els... | Delete a specific handler from our logger. | [
"Delete",
"a",
"specific",
"handler",
"from",
"our",
"logger",
"."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L240-L247 |
242,954 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger._update_handler | def _update_handler(self, handler_class, level):
"""Update the level of an handler."""
handler = self._get_handler(handler_class)
handler.setLevel(level) | python | def _update_handler(self, handler_class, level):
"""Update the level of an handler."""
handler = self._get_handler(handler_class)
handler.setLevel(level) | [
"def",
"_update_handler",
"(",
"self",
",",
"handler_class",
",",
"level",
")",
":",
"handler",
"=",
"self",
".",
"_get_handler",
"(",
"handler_class",
")",
"handler",
".",
"setLevel",
"(",
"level",
")"
] | Update the level of an handler. | [
"Update",
"the",
"level",
"of",
"an",
"handler",
"."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L249-L252 |
242,955 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger._create_handler | def _create_handler(self, handler_class, level):
"""Create an handler for at specific level."""
if handler_class == logging.StreamHandler:
handler = handler_class()
handler.setLevel(level)
elif handler_class == logging.handlers.SysLogHandler:
handler = handler... | python | def _create_handler(self, handler_class, level):
"""Create an handler for at specific level."""
if handler_class == logging.StreamHandler:
handler = handler_class()
handler.setLevel(level)
elif handler_class == logging.handlers.SysLogHandler:
handler = handler... | [
"def",
"_create_handler",
"(",
"self",
",",
"handler_class",
",",
"level",
")",
":",
"if",
"handler_class",
"==",
"logging",
".",
"StreamHandler",
":",
"handler",
"=",
"handler_class",
"(",
")",
"handler",
".",
"setLevel",
"(",
"level",
")",
"elif",
"handler... | Create an handler for at specific level. | [
"Create",
"an",
"handler",
"for",
"at",
"specific",
"level",
"."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L254-L276 |
242,956 | alkivi-sas/python-alkivi-logger | alkivi/logger/logger.py | Logger.get_formatter | def get_formatter(self, handler):
"""
Return formatters according to handler.
All handlers are the same format, except syslog.
We omit time when syslogging.
"""
if isinstance(handler, logging.handlers.SysLogHandler):
formatter = '[%(levelname)-9s]'
el... | python | def get_formatter(self, handler):
"""
Return formatters according to handler.
All handlers are the same format, except syslog.
We omit time when syslogging.
"""
if isinstance(handler, logging.handlers.SysLogHandler):
formatter = '[%(levelname)-9s]'
el... | [
"def",
"get_formatter",
"(",
"self",
",",
"handler",
")",
":",
"if",
"isinstance",
"(",
"handler",
",",
"logging",
".",
"handlers",
".",
"SysLogHandler",
")",
":",
"formatter",
"=",
"'[%(levelname)-9s]'",
"else",
":",
"formatter",
"=",
"'[%(asctime)s] [%(levelna... | Return formatters according to handler.
All handlers are the same format, except syslog.
We omit time when syslogging. | [
"Return",
"formatters",
"according",
"to",
"handler",
"."
] | e96d5a987a5c8789c51d4fa7541709e05b1f51e1 | https://github.com/alkivi-sas/python-alkivi-logger/blob/e96d5a987a5c8789c51d4fa7541709e05b1f51e1/alkivi/logger/logger.py#L278-L293 |
242,957 | jlesquembre/jlle | jlle/releaser/release.py | version_control | def version_control():
"""Return an object that provides the version control interface based
on the detected version control system."""
curdir_contents = os.listdir('.')
if '.hg' in curdir_contents:
return hg.Hg()
elif '.git' in curdir_contents:
return git.Git()
else:
log... | python | def version_control():
"""Return an object that provides the version control interface based
on the detected version control system."""
curdir_contents = os.listdir('.')
if '.hg' in curdir_contents:
return hg.Hg()
elif '.git' in curdir_contents:
return git.Git()
else:
log... | [
"def",
"version_control",
"(",
")",
":",
"curdir_contents",
"=",
"os",
".",
"listdir",
"(",
"'.'",
")",
"if",
"'.hg'",
"in",
"curdir_contents",
":",
"return",
"hg",
".",
"Hg",
"(",
")",
"elif",
"'.git'",
"in",
"curdir_contents",
":",
"return",
"git",
"."... | Return an object that provides the version control interface based
on the detected version control system. | [
"Return",
"an",
"object",
"that",
"provides",
"the",
"version",
"control",
"interface",
"based",
"on",
"the",
"detected",
"version",
"control",
"system",
"."
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L24-L34 |
242,958 | jlesquembre/jlle | jlle/releaser/release.py | package_in_pypi | def package_in_pypi(package):
"""Check whether the package is registered on pypi"""
url = 'http://pypi.python.org/simple/%s' % package
try:
urllib.request.urlopen(url)
return True
except urllib.error.HTTPError as e:
logger.debug("Package not found on pypi: %s", e)
return ... | python | def package_in_pypi(package):
"""Check whether the package is registered on pypi"""
url = 'http://pypi.python.org/simple/%s' % package
try:
urllib.request.urlopen(url)
return True
except urllib.error.HTTPError as e:
logger.debug("Package not found on pypi: %s", e)
return ... | [
"def",
"package_in_pypi",
"(",
"package",
")",
":",
"url",
"=",
"'http://pypi.python.org/simple/%s'",
"%",
"package",
"try",
":",
"urllib",
".",
"request",
".",
"urlopen",
"(",
"url",
")",
"return",
"True",
"except",
"urllib",
".",
"error",
".",
"HTTPError",
... | Check whether the package is registered on pypi | [
"Check",
"whether",
"the",
"package",
"is",
"registered",
"on",
"pypi"
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L37-L45 |
242,959 | jlesquembre/jlle | jlle/releaser/release.py | Releaser._grab_version | def _grab_version(self):
"""Set the version to a non-development version."""
original_version = self.vcs.version
logger.debug("Extracted version: %s", original_version)
if original_version is None:
logger.critical('No version found.')
sys.exit(1)
suggestio... | python | def _grab_version(self):
"""Set the version to a non-development version."""
original_version = self.vcs.version
logger.debug("Extracted version: %s", original_version)
if original_version is None:
logger.critical('No version found.')
sys.exit(1)
suggestio... | [
"def",
"_grab_version",
"(",
"self",
")",
":",
"original_version",
"=",
"self",
".",
"vcs",
".",
"version",
"logger",
".",
"debug",
"(",
"\"Extracted version: %s\"",
",",
"original_version",
")",
"if",
"original_version",
"is",
"None",
":",
"logger",
".",
"cri... | Set the version to a non-development version. | [
"Set",
"the",
"version",
"to",
"a",
"non",
"-",
"development",
"version",
"."
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L65-L77 |
242,960 | jlesquembre/jlle | jlle/releaser/release.py | Releaser._write_history | def _write_history(self):
"""Write previously-calculated history lines back to the file"""
if self.data['history_file'] is None:
return
contents = '\n'.join(self.data['history_lines'])
history = self.data['history_file']
open(history, 'w').write(contents)
logg... | python | def _write_history(self):
"""Write previously-calculated history lines back to the file"""
if self.data['history_file'] is None:
return
contents = '\n'.join(self.data['history_lines'])
history = self.data['history_file']
open(history, 'w').write(contents)
logg... | [
"def",
"_write_history",
"(",
"self",
")",
":",
"if",
"self",
".",
"data",
"[",
"'history_file'",
"]",
"is",
"None",
":",
"return",
"contents",
"=",
"'\\n'",
".",
"join",
"(",
"self",
".",
"data",
"[",
"'history_lines'",
"]",
")",
"history",
"=",
"self... | Write previously-calculated history lines back to the file | [
"Write",
"previously",
"-",
"calculated",
"history",
"lines",
"back",
"to",
"the",
"file"
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L128-L135 |
242,961 | jlesquembre/jlle | jlle/releaser/release.py | Releaser._check_if_tag_already_exists | def _check_if_tag_already_exists(self):
"""Check if tag already exists and show the difference if so"""
version = self.data['new_version']
if self.vcs.tag_exists(version):
return True
else:
return False | python | def _check_if_tag_already_exists(self):
"""Check if tag already exists and show the difference if so"""
version = self.data['new_version']
if self.vcs.tag_exists(version):
return True
else:
return False | [
"def",
"_check_if_tag_already_exists",
"(",
"self",
")",
":",
"version",
"=",
"self",
".",
"data",
"[",
"'new_version'",
"]",
"if",
"self",
".",
"vcs",
".",
"tag_exists",
"(",
"version",
")",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | Check if tag already exists and show the difference if so | [
"Check",
"if",
"tag",
"already",
"exists",
"and",
"show",
"the",
"difference",
"if",
"so"
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L147-L153 |
242,962 | jlesquembre/jlle | jlle/releaser/release.py | Releaser._release | def _release(self):
"""Upload the release, when desired"""
pypiconfig = pypi.PypiConfig()
# Does the user normally want a real release? We are
# interested in getting a sane default answer here, so you can
# override it in the exceptional case but just hit Enter in
# t... | python | def _release(self):
"""Upload the release, when desired"""
pypiconfig = pypi.PypiConfig()
# Does the user normally want a real release? We are
# interested in getting a sane default answer here, so you can
# override it in the exceptional case but just hit Enter in
# t... | [
"def",
"_release",
"(",
"self",
")",
":",
"pypiconfig",
"=",
"pypi",
".",
"PypiConfig",
"(",
")",
"# Does the user normally want a real release? We are",
"# interested in getting a sane default answer here, so you can",
"# override it in the exceptional case but just hit Enter in",
... | Upload the release, when desired | [
"Upload",
"the",
"release",
"when",
"desired"
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L250-L294 |
242,963 | jlesquembre/jlle | jlle/releaser/release.py | Releaser._update_version | def _update_version(self):
"""Ask for and store a new dev version string."""
#current = self.vcs.version
current = self.data['new_version']
# Clean it up to a non-development version.
current = utils.cleanup_version(current)
# Try to make sure that the suggestion for nex... | python | def _update_version(self):
"""Ask for and store a new dev version string."""
#current = self.vcs.version
current = self.data['new_version']
# Clean it up to a non-development version.
current = utils.cleanup_version(current)
# Try to make sure that the suggestion for nex... | [
"def",
"_update_version",
"(",
"self",
")",
":",
"#current = self.vcs.version",
"current",
"=",
"self",
".",
"data",
"[",
"'new_version'",
"]",
"# Clean it up to a non-development version.",
"current",
"=",
"utils",
".",
"cleanup_version",
"(",
"current",
")",
"# Try ... | Ask for and store a new dev version string. | [
"Ask",
"for",
"and",
"store",
"a",
"new",
"dev",
"version",
"string",
"."
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L296-L336 |
242,964 | jlesquembre/jlle | jlle/releaser/release.py | Releaser._update_history | def _update_history(self):
"""Update the history file"""
version = self.data['new_version']
history = self.vcs.history_file()
if not history:
logger.warn("No history file found")
return
history_lines = open(history).read().split('\n')
headings = ut... | python | def _update_history(self):
"""Update the history file"""
version = self.data['new_version']
history = self.vcs.history_file()
if not history:
logger.warn("No history file found")
return
history_lines = open(history).read().split('\n')
headings = ut... | [
"def",
"_update_history",
"(",
"self",
")",
":",
"version",
"=",
"self",
".",
"data",
"[",
"'new_version'",
"]",
"history",
"=",
"self",
".",
"vcs",
".",
"history_file",
"(",
")",
"if",
"not",
"history",
":",
"logger",
".",
"warn",
"(",
"\"No history fil... | Update the history file | [
"Update",
"the",
"history",
"file"
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L338-L371 |
242,965 | jlesquembre/jlle | jlle/releaser/release.py | Releaser._push | def _push(self):
"""Offer to push changes, if needed."""
push_cmds = self.vcs.push_commands()
if not push_cmds:
return
if utils.ask("OK to push commits to the server?"):
for push_cmd in push_cmds:
output = utils.system(push_cmd)
lo... | python | def _push(self):
"""Offer to push changes, if needed."""
push_cmds = self.vcs.push_commands()
if not push_cmds:
return
if utils.ask("OK to push commits to the server?"):
for push_cmd in push_cmds:
output = utils.system(push_cmd)
lo... | [
"def",
"_push",
"(",
"self",
")",
":",
"push_cmds",
"=",
"self",
".",
"vcs",
".",
"push_commands",
"(",
")",
"if",
"not",
"push_cmds",
":",
"return",
"if",
"utils",
".",
"ask",
"(",
"\"OK to push commits to the server?\"",
")",
":",
"for",
"push_cmd",
"in"... | Offer to push changes, if needed. | [
"Offer",
"to",
"push",
"changes",
"if",
"needed",
"."
] | 3645d8f203708355853ef911f4b887ae4d794826 | https://github.com/jlesquembre/jlle/blob/3645d8f203708355853ef911f4b887ae4d794826/jlle/releaser/release.py#L373-L382 |
242,966 | Apitax/Apitax | apitax/api/controllers/apitax_controller.py | get_user | def get_user(user, driver): # noqa: E501
"""Retrieve a user
Retrieve a user # noqa: E501
:param user: Get user with this name
:type user: str
:param driver: The driver to use for the request. ie. github
:type driver: str
:rtype: Response
"""
response = ApitaxResponse()
driv... | python | def get_user(user, driver): # noqa: E501
"""Retrieve a user
Retrieve a user # noqa: E501
:param user: Get user with this name
:type user: str
:param driver: The driver to use for the request. ie. github
:type driver: str
:rtype: Response
"""
response = ApitaxResponse()
driv... | [
"def",
"get_user",
"(",
"user",
",",
"driver",
")",
":",
"# noqa: E501",
"response",
"=",
"ApitaxResponse",
"(",
")",
"driver",
":",
"Driver",
"=",
"LoadedDrivers",
".",
"getDriver",
"(",
"driver",
")",
"user",
":",
"User",
"=",
"driver",
".",
"getApitaxUs... | Retrieve a user
Retrieve a user # noqa: E501
:param user: Get user with this name
:type user: str
:param driver: The driver to use for the request. ie. github
:type driver: str
:rtype: Response | [
"Retrieve",
"a",
"user"
] | 3883e45f17e01eba4edac9d1bba42f0e7a748682 | https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/apitax_controller.py#L146-L165 |
242,967 | joaopcanario/imports | imports/cli.py | main | def main(path_dir, requirements_name):
"""Console script for imports."""
click.echo("\nWARNING: Uninstall libs it's at your own risk!")
click.echo('\nREMINDER: After uninstall libs, update your requirements '
'file.\nUse the `pip freeze > requirements.txt` command.')
click.echo('\n\nList... | python | def main(path_dir, requirements_name):
"""Console script for imports."""
click.echo("\nWARNING: Uninstall libs it's at your own risk!")
click.echo('\nREMINDER: After uninstall libs, update your requirements '
'file.\nUse the `pip freeze > requirements.txt` command.')
click.echo('\n\nList... | [
"def",
"main",
"(",
"path_dir",
",",
"requirements_name",
")",
":",
"click",
".",
"echo",
"(",
"\"\\nWARNING: Uninstall libs it's at your own risk!\"",
")",
"click",
".",
"echo",
"(",
"'\\nREMINDER: After uninstall libs, update your requirements '",
"'file.\\nUse the `pip freez... | Console script for imports. | [
"Console",
"script",
"for",
"imports",
"."
] | 46db0d3d2aa55427027bf0e91d61a24d52730337 | https://github.com/joaopcanario/imports/blob/46db0d3d2aa55427027bf0e91d61a24d52730337/imports/cli.py#L13-L22 |
242,968 | smartmob-project/strawboss | strawboss/__init__.py | now | def now(utc=False):
"""Returns the current time.
:param utc: If ``True``, returns a timezone-aware ``datetime`` object in
UTC. When ``False`` (the default), returns a naive ``datetime`` object
in local time.
:return: A ``datetime`` object representing the current time at the time of
t... | python | def now(utc=False):
"""Returns the current time.
:param utc: If ``True``, returns a timezone-aware ``datetime`` object in
UTC. When ``False`` (the default), returns a naive ``datetime`` object
in local time.
:return: A ``datetime`` object representing the current time at the time of
t... | [
"def",
"now",
"(",
"utc",
"=",
"False",
")",
":",
"if",
"utc",
":",
"return",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
".",
"replace",
"(",
"tzinfo",
"=",
"dateutil",
".",
"tz",
".",
"tzutc",
"(",
")",
")",
"else",
":",
"return",
"da... | Returns the current time.
:param utc: If ``True``, returns a timezone-aware ``datetime`` object in
UTC. When ``False`` (the default), returns a naive ``datetime`` object
in local time.
:return: A ``datetime`` object representing the current time at the time of
the call. | [
"Returns",
"the",
"current",
"time",
"."
] | b295a7d0e3c1d95c4bb687f7f1bcae9605b3bbdc | https://github.com/smartmob-project/strawboss/blob/b295a7d0e3c1d95c4bb687f7f1bcae9605b3bbdc/strawboss/__init__.py#L22-L34 |
242,969 | smartmob-project/strawboss | strawboss/__init__.py | merge_envs | def merge_envs(*args):
"""Union of one or more dictionaries.
In case of duplicate keys, the values in the right-most arguments will
squash (overwrite) the value provided by any dict preceding it.
:param args: Sequence of ``dict`` objects that should be merged.
:return: A ``dict`` containing the un... | python | def merge_envs(*args):
"""Union of one or more dictionaries.
In case of duplicate keys, the values in the right-most arguments will
squash (overwrite) the value provided by any dict preceding it.
:param args: Sequence of ``dict`` objects that should be merged.
:return: A ``dict`` containing the un... | [
"def",
"merge_envs",
"(",
"*",
"args",
")",
":",
"env",
"=",
"{",
"}",
"for",
"arg",
"in",
"args",
":",
"if",
"not",
"arg",
":",
"continue",
"env",
".",
"update",
"(",
"arg",
")",
"return",
"env"
] | Union of one or more dictionaries.
In case of duplicate keys, the values in the right-most arguments will
squash (overwrite) the value provided by any dict preceding it.
:param args: Sequence of ``dict`` objects that should be merged.
:return: A ``dict`` containing the union of keys in all input dicts... | [
"Union",
"of",
"one",
"or",
"more",
"dictionaries",
"."
] | b295a7d0e3c1d95c4bb687f7f1bcae9605b3bbdc | https://github.com/smartmob-project/strawboss/blob/b295a7d0e3c1d95c4bb687f7f1bcae9605b3bbdc/strawboss/__init__.py#L66-L81 |
242,970 | smartmob-project/strawboss | strawboss/__init__.py | run_once | def run_once(name, cmd, env, shutdown, loop=None, utc=False):
"""Starts a child process and waits for its completion.
.. note:: This function is a coroutine.
Standard output and error streams are captured and forwarded to the parent
process' standard output. Each line is prefixed with the current tim... | python | def run_once(name, cmd, env, shutdown, loop=None, utc=False):
"""Starts a child process and waits for its completion.
.. note:: This function is a coroutine.
Standard output and error streams are captured and forwarded to the parent
process' standard output. Each line is prefixed with the current tim... | [
"def",
"run_once",
"(",
"name",
",",
"cmd",
",",
"env",
",",
"shutdown",
",",
"loop",
"=",
"None",
",",
"utc",
"=",
"False",
")",
":",
"# Get the default event loop if necessary.",
"loop",
"=",
"loop",
"or",
"asyncio",
".",
"get_event_loop",
"(",
")",
"# L... | Starts a child process and waits for its completion.
.. note:: This function is a coroutine.
Standard output and error streams are captured and forwarded to the parent
process' standard output. Each line is prefixed with the current time (as
measured by the parent process) and the child process ``nam... | [
"Starts",
"a",
"child",
"process",
"and",
"waits",
"for",
"its",
"completion",
"."
] | b295a7d0e3c1d95c4bb687f7f1bcae9605b3bbdc | https://github.com/smartmob-project/strawboss/blob/b295a7d0e3c1d95c4bb687f7f1bcae9605b3bbdc/strawboss/__init__.py#L85-L192 |
242,971 | smartmob-project/strawboss | strawboss/__init__.py | run_and_respawn | def run_and_respawn(shutdown, loop=None, **kwds):
"""Starts a child process and re-spawns it every time it completes.
.. note:: This function is a coroutine.
:param shutdown: Future that the caller will fulfill to indicate that the
process should not be re-spawned. It is also passed to ``run_once(... | python | def run_and_respawn(shutdown, loop=None, **kwds):
"""Starts a child process and re-spawns it every time it completes.
.. note:: This function is a coroutine.
:param shutdown: Future that the caller will fulfill to indicate that the
process should not be re-spawned. It is also passed to ``run_once(... | [
"def",
"run_and_respawn",
"(",
"shutdown",
",",
"loop",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"# Get the default event loop if necessary.",
"loop",
"=",
"loop",
"or",
"asyncio",
".",
"get_event_loop",
"(",
")",
"while",
"not",
"shutdown",
".",
"done",
... | Starts a child process and re-spawns it every time it completes.
.. note:: This function is a coroutine.
:param shutdown: Future that the caller will fulfill to indicate that the
process should not be re-spawned. It is also passed to ``run_once()``
to indicate that the currently running process... | [
"Starts",
"a",
"child",
"process",
"and",
"re",
"-",
"spawns",
"it",
"every",
"time",
"it",
"completes",
"."
] | b295a7d0e3c1d95c4bb687f7f1bcae9605b3bbdc | https://github.com/smartmob-project/strawboss/blob/b295a7d0e3c1d95c4bb687f7f1bcae9605b3bbdc/strawboss/__init__.py#L196-L217 |
242,972 | timeyyy/apptools | peasoup/uploadlogs.py | add_date | def add_date(log):
'''Userful for randomizing the name of a log'''
return '{base} - {time}.log'.format(
base=os.path.splitext(log)[0],
time=strftime("%a, %d %b %Y %H-%M-%S", gmtime())) | python | def add_date(log):
'''Userful for randomizing the name of a log'''
return '{base} - {time}.log'.format(
base=os.path.splitext(log)[0],
time=strftime("%a, %d %b %Y %H-%M-%S", gmtime())) | [
"def",
"add_date",
"(",
"log",
")",
":",
"return",
"'{base} - {time}.log'",
".",
"format",
"(",
"base",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"log",
")",
"[",
"0",
"]",
",",
"time",
"=",
"strftime",
"(",
"\"%a, %d %b %Y %H-%M-%S\"",
",",
"gmtime"... | Userful for randomizing the name of a log | [
"Userful",
"for",
"randomizing",
"the",
"name",
"of",
"a",
"log"
] | d3c0f324b0c2689c35f5601348276f4efd6cb240 | https://github.com/timeyyy/apptools/blob/d3c0f324b0c2689c35f5601348276f4efd6cb240/peasoup/uploadlogs.py#L133-L137 |
242,973 | timeyyy/apptools | peasoup/uploadlogs.py | LogUploader.delete_log | def delete_log(self, log):
'''check we don't delte anythin unintended'''
if os.path.splitext(log)[-1] != '.log':
raise Exception('File without .log was passed in for deletoin')
with suppress(Exception):
os.remove(log) | python | def delete_log(self, log):
'''check we don't delte anythin unintended'''
if os.path.splitext(log)[-1] != '.log':
raise Exception('File without .log was passed in for deletoin')
with suppress(Exception):
os.remove(log) | [
"def",
"delete_log",
"(",
"self",
",",
"log",
")",
":",
"if",
"os",
".",
"path",
".",
"splitext",
"(",
"log",
")",
"[",
"-",
"1",
"]",
"!=",
"'.log'",
":",
"raise",
"Exception",
"(",
"'File without .log was passed in for deletoin'",
")",
"with",
"suppress"... | check we don't delte anythin unintended | [
"check",
"we",
"don",
"t",
"delte",
"anythin",
"unintended"
] | d3c0f324b0c2689c35f5601348276f4efd6cb240 | https://github.com/timeyyy/apptools/blob/d3c0f324b0c2689c35f5601348276f4efd6cb240/peasoup/uploadlogs.py#L72-L77 |
242,974 | timeyyy/apptools | peasoup/uploadlogs.py | LogUploader.get_logs | def get_logs(self):
'''returns logs from disk, requires .log extenstion'''
folder = os.path.dirname(self.pcfg['log_file'])
for path, dir, files in os.walk(folder):
for file in files:
if os.path.splitext(file)[-1] == '.log':
yield os.path.join(path,... | python | def get_logs(self):
'''returns logs from disk, requires .log extenstion'''
folder = os.path.dirname(self.pcfg['log_file'])
for path, dir, files in os.walk(folder):
for file in files:
if os.path.splitext(file)[-1] == '.log':
yield os.path.join(path,... | [
"def",
"get_logs",
"(",
"self",
")",
":",
"folder",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"self",
".",
"pcfg",
"[",
"'log_file'",
"]",
")",
"for",
"path",
",",
"dir",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"folder",
")",
":",
"for",
... | returns logs from disk, requires .log extenstion | [
"returns",
"logs",
"from",
"disk",
"requires",
".",
"log",
"extenstion"
] | d3c0f324b0c2689c35f5601348276f4efd6cb240 | https://github.com/timeyyy/apptools/blob/d3c0f324b0c2689c35f5601348276f4efd6cb240/peasoup/uploadlogs.py#L80-L86 |
242,975 | timeyyy/apptools | peasoup/uploadlogs.py | LogUploader._uniquename | def _uniquename(self, log):
'''
renames the log to ensure we get no clashes on the server
subclass this to change the path etc'''
return '{hostname} - {time}.log'.format(
hostname=os.getenv('USERNAME'),
time=strftime("%a, %d... | python | def _uniquename(self, log):
'''
renames the log to ensure we get no clashes on the server
subclass this to change the path etc'''
return '{hostname} - {time}.log'.format(
hostname=os.getenv('USERNAME'),
time=strftime("%a, %d... | [
"def",
"_uniquename",
"(",
"self",
",",
"log",
")",
":",
"return",
"'{hostname} - {time}.log'",
".",
"format",
"(",
"hostname",
"=",
"os",
".",
"getenv",
"(",
"'USERNAME'",
")",
",",
"time",
"=",
"strftime",
"(",
"\"%a, %d %b %Y %H-%M-%S\"",
",",
"gmtime",
"... | renames the log to ensure we get no clashes on the server
subclass this to change the path etc | [
"renames",
"the",
"log",
"to",
"ensure",
"we",
"get",
"no",
"clashes",
"on",
"the",
"server",
"subclass",
"this",
"to",
"change",
"the",
"path",
"etc"
] | d3c0f324b0c2689c35f5601348276f4efd6cb240 | https://github.com/timeyyy/apptools/blob/d3c0f324b0c2689c35f5601348276f4efd6cb240/peasoup/uploadlogs.py#L89-L95 |
242,976 | jalanb/pysyte | pysyte/args.py | arg_strings | def arg_strings(parsed_args, name=None):
"""A list of all strings for the named arg"""
name = name or 'arg_strings'
value = getattr(parsed_args, name, [])
if isinstance(value, str):
return [value]
try:
return [v for v in value if isinstance(v, str)]
except TypeError:
retu... | python | def arg_strings(parsed_args, name=None):
"""A list of all strings for the named arg"""
name = name or 'arg_strings'
value = getattr(parsed_args, name, [])
if isinstance(value, str):
return [value]
try:
return [v for v in value if isinstance(v, str)]
except TypeError:
retu... | [
"def",
"arg_strings",
"(",
"parsed_args",
",",
"name",
"=",
"None",
")",
":",
"name",
"=",
"name",
"or",
"'arg_strings'",
"value",
"=",
"getattr",
"(",
"parsed_args",
",",
"name",
",",
"[",
"]",
")",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
... | A list of all strings for the named arg | [
"A",
"list",
"of",
"all",
"strings",
"for",
"the",
"named",
"arg"
] | 4e278101943d1ceb1a6bcaf6ddc72052ecf13114 | https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/args.py#L87-L96 |
242,977 | brycepg/mand | mand/util.py | create_module_file | def create_module_file(txt, directory):
"""Create a file in the given directory with
a valid module name populated with the given txt.
Returns:
A path to the file"""
name = nonpresent_module_filename()
path = os.path.join(directory, name)
with open(path, 'w') as fh:
fh.write(txt... | python | def create_module_file(txt, directory):
"""Create a file in the given directory with
a valid module name populated with the given txt.
Returns:
A path to the file"""
name = nonpresent_module_filename()
path = os.path.join(directory, name)
with open(path, 'w') as fh:
fh.write(txt... | [
"def",
"create_module_file",
"(",
"txt",
",",
"directory",
")",
":",
"name",
"=",
"nonpresent_module_filename",
"(",
")",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"name",
")",
"with",
"open",
"(",
"path",
",",
"'w'",
")",
"as... | Create a file in the given directory with
a valid module name populated with the given txt.
Returns:
A path to the file | [
"Create",
"a",
"file",
"in",
"the",
"given",
"directory",
"with",
"a",
"valid",
"module",
"name",
"populated",
"with",
"the",
"given",
"txt",
"."
] | 3a8f9c1cc1bbe217aaca8c805113285ab02ecb7c | https://github.com/brycepg/mand/blob/3a8f9c1cc1bbe217aaca8c805113285ab02ecb7c/mand/util.py#L14-L24 |
242,978 | brycepg/mand | mand/util.py | nonpresent_module_filename | def nonpresent_module_filename():
"""Return module name that doesn't already exist"""
while True:
module_name = get_random_name()
loader = pkgutil.find_loader(module_name)
if loader is not None:
continue
importlib.invalidate_caches()
return "{}.py".format(modu... | python | def nonpresent_module_filename():
"""Return module name that doesn't already exist"""
while True:
module_name = get_random_name()
loader = pkgutil.find_loader(module_name)
if loader is not None:
continue
importlib.invalidate_caches()
return "{}.py".format(modu... | [
"def",
"nonpresent_module_filename",
"(",
")",
":",
"while",
"True",
":",
"module_name",
"=",
"get_random_name",
"(",
")",
"loader",
"=",
"pkgutil",
".",
"find_loader",
"(",
"module_name",
")",
"if",
"loader",
"is",
"not",
"None",
":",
"continue",
"importlib",... | Return module name that doesn't already exist | [
"Return",
"module",
"name",
"that",
"doesn",
"t",
"already",
"exist"
] | 3a8f9c1cc1bbe217aaca8c805113285ab02ecb7c | https://github.com/brycepg/mand/blob/3a8f9c1cc1bbe217aaca8c805113285ab02ecb7c/mand/util.py#L42-L50 |
242,979 | brycepg/mand | mand/util.py | get_random_name | def get_random_name():
"""Return random lowercase name"""
char_seq = []
name_source = random.randint(1, 2**8-1)
current_value = name_source
while current_value > 0:
char_offset = current_value % 26
current_value = current_value - random.randint(1, 26)
char_seq.append(chr(char... | python | def get_random_name():
"""Return random lowercase name"""
char_seq = []
name_source = random.randint(1, 2**8-1)
current_value = name_source
while current_value > 0:
char_offset = current_value % 26
current_value = current_value - random.randint(1, 26)
char_seq.append(chr(char... | [
"def",
"get_random_name",
"(",
")",
":",
"char_seq",
"=",
"[",
"]",
"name_source",
"=",
"random",
".",
"randint",
"(",
"1",
",",
"2",
"**",
"8",
"-",
"1",
")",
"current_value",
"=",
"name_source",
"while",
"current_value",
">",
"0",
":",
"char_offset",
... | Return random lowercase name | [
"Return",
"random",
"lowercase",
"name"
] | 3a8f9c1cc1bbe217aaca8c805113285ab02ecb7c | https://github.com/brycepg/mand/blob/3a8f9c1cc1bbe217aaca8c805113285ab02ecb7c/mand/util.py#L53-L64 |
242,980 | ironfroggy/django-better-cache | bettercache/utils.py | get_header_dict | def get_header_dict(response, header):
""" returns a dictionary of the cache control headers
the same as is used by django.utils.cache.patch_cache_control
if there are no Cache-Control headers returns and empty dict
"""
def dictitem(s):
t = s.split('=', 1)
if len(t) > 1:
... | python | def get_header_dict(response, header):
""" returns a dictionary of the cache control headers
the same as is used by django.utils.cache.patch_cache_control
if there are no Cache-Control headers returns and empty dict
"""
def dictitem(s):
t = s.split('=', 1)
if len(t) > 1:
... | [
"def",
"get_header_dict",
"(",
"response",
",",
"header",
")",
":",
"def",
"dictitem",
"(",
"s",
")",
":",
"t",
"=",
"s",
".",
"split",
"(",
"'='",
",",
"1",
")",
"if",
"len",
"(",
"t",
")",
">",
"1",
":",
"return",
"(",
"t",
"[",
"0",
"]",
... | returns a dictionary of the cache control headers
the same as is used by django.utils.cache.patch_cache_control
if there are no Cache-Control headers returns and empty dict | [
"returns",
"a",
"dictionary",
"of",
"the",
"cache",
"control",
"headers",
"the",
"same",
"as",
"is",
"used",
"by",
"django",
".",
"utils",
".",
"cache",
".",
"patch_cache_control",
"if",
"there",
"are",
"no",
"Cache",
"-",
"Control",
"headers",
"returns",
... | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L161-L177 |
242,981 | ironfroggy/django-better-cache | bettercache/utils.py | set_header_dict | def set_header_dict(response, header, header_dict):
"""Formats and sets a header dict in a response, inververs of get_header_dict."""
def dictvalue(t):
if t[1] is True:
return t[0]
return t[0] + '=' + smart_str(t[1])
response[header] = ', '.join([dictvalue(el) for el in header_d... | python | def set_header_dict(response, header, header_dict):
"""Formats and sets a header dict in a response, inververs of get_header_dict."""
def dictvalue(t):
if t[1] is True:
return t[0]
return t[0] + '=' + smart_str(t[1])
response[header] = ', '.join([dictvalue(el) for el in header_d... | [
"def",
"set_header_dict",
"(",
"response",
",",
"header",
",",
"header_dict",
")",
":",
"def",
"dictvalue",
"(",
"t",
")",
":",
"if",
"t",
"[",
"1",
"]",
"is",
"True",
":",
"return",
"t",
"[",
"0",
"]",
"return",
"t",
"[",
"0",
"]",
"+",
"'='",
... | Formats and sets a header dict in a response, inververs of get_header_dict. | [
"Formats",
"and",
"sets",
"a",
"header",
"dict",
"in",
"a",
"response",
"inververs",
"of",
"get_header_dict",
"."
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L179-L186 |
242,982 | ironfroggy/django-better-cache | bettercache/utils.py | smart_import | def smart_import(mpath):
"""Given a path smart_import will import the module and return the attr reffered to."""
try:
rest = __import__(mpath)
except ImportError:
split = mpath.split('.')
rest = smart_import('.'.join(split[:-1]))
rest = getattr(rest, split[-1])
return res... | python | def smart_import(mpath):
"""Given a path smart_import will import the module and return the attr reffered to."""
try:
rest = __import__(mpath)
except ImportError:
split = mpath.split('.')
rest = smart_import('.'.join(split[:-1]))
rest = getattr(rest, split[-1])
return res... | [
"def",
"smart_import",
"(",
"mpath",
")",
":",
"try",
":",
"rest",
"=",
"__import__",
"(",
"mpath",
")",
"except",
"ImportError",
":",
"split",
"=",
"mpath",
".",
"split",
"(",
"'.'",
")",
"rest",
"=",
"smart_import",
"(",
"'.'",
".",
"join",
"(",
"s... | Given a path smart_import will import the module and return the attr reffered to. | [
"Given",
"a",
"path",
"smart_import",
"will",
"import",
"the",
"module",
"and",
"return",
"the",
"attr",
"reffered",
"to",
"."
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L188-L196 |
242,983 | ironfroggy/django-better-cache | bettercache/utils.py | strip_wsgi | def strip_wsgi(request):
"""Strip WSGI data out of the request META data."""
meta = copy(request.META)
for key in meta:
if key[:4] == 'wsgi':
meta[key] = None
return meta | python | def strip_wsgi(request):
"""Strip WSGI data out of the request META data."""
meta = copy(request.META)
for key in meta:
if key[:4] == 'wsgi':
meta[key] = None
return meta | [
"def",
"strip_wsgi",
"(",
"request",
")",
":",
"meta",
"=",
"copy",
"(",
"request",
".",
"META",
")",
"for",
"key",
"in",
"meta",
":",
"if",
"key",
"[",
":",
"4",
"]",
"==",
"'wsgi'",
":",
"meta",
"[",
"key",
"]",
"=",
"None",
"return",
"meta"
] | Strip WSGI data out of the request META data. | [
"Strip",
"WSGI",
"data",
"out",
"of",
"the",
"request",
"META",
"data",
"."
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L198-L205 |
242,984 | ironfroggy/django-better-cache | bettercache/utils.py | CachingMixin.patch_headers | def patch_headers(self, response):
"""Set the headers we want for caching."""
# Remove Vary:Cookie if we want to cache non-anonymous
if not getattr(settings, 'BETTERCACHE_ANONYMOUS_ONLY', False):
vdict = get_header_dict(response, 'Vary')
try:
vdict.pop('c... | python | def patch_headers(self, response):
"""Set the headers we want for caching."""
# Remove Vary:Cookie if we want to cache non-anonymous
if not getattr(settings, 'BETTERCACHE_ANONYMOUS_ONLY', False):
vdict = get_header_dict(response, 'Vary')
try:
vdict.pop('c... | [
"def",
"patch_headers",
"(",
"self",
",",
"response",
")",
":",
"# Remove Vary:Cookie if we want to cache non-anonymous",
"if",
"not",
"getattr",
"(",
"settings",
",",
"'BETTERCACHE_ANONYMOUS_ONLY'",
",",
"False",
")",
":",
"vdict",
"=",
"get_header_dict",
"(",
"respo... | Set the headers we want for caching. | [
"Set",
"the",
"headers",
"we",
"want",
"for",
"caching",
"."
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L18-L50 |
242,985 | ironfroggy/django-better-cache | bettercache/utils.py | CachingMixin.should_cache | def should_cache(self, request, response):
""" Given the request and response should it be cached """
if not getattr(request, '_cache_update_cache', False):
return False
if not response.status_code in getattr(settings, 'BETTERCACHE_CACHEABLE_STATUS', CACHEABLE_STATUS):
r... | python | def should_cache(self, request, response):
""" Given the request and response should it be cached """
if not getattr(request, '_cache_update_cache', False):
return False
if not response.status_code in getattr(settings, 'BETTERCACHE_CACHEABLE_STATUS', CACHEABLE_STATUS):
r... | [
"def",
"should_cache",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"if",
"not",
"getattr",
"(",
"request",
",",
"'_cache_update_cache'",
",",
"False",
")",
":",
"return",
"False",
"if",
"not",
"response",
".",
"status_code",
"in",
"getattr",
"(... | Given the request and response should it be cached | [
"Given",
"the",
"request",
"and",
"response",
"should",
"it",
"be",
"cached"
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L61-L72 |
242,986 | ironfroggy/django-better-cache | bettercache/utils.py | CachingMixin.should_regenerate | def should_regenerate(self, response):
""" Check if this page was originally generated less than LOCAL_POSTCHECK seconds ago """
if response.has_header('Last-Modified'):
last_modified = parse_http_date(response['Last-Modified'])
next_regen = last_modified + settings.BETTERCACHE_... | python | def should_regenerate(self, response):
""" Check if this page was originally generated less than LOCAL_POSTCHECK seconds ago """
if response.has_header('Last-Modified'):
last_modified = parse_http_date(response['Last-Modified'])
next_regen = last_modified + settings.BETTERCACHE_... | [
"def",
"should_regenerate",
"(",
"self",
",",
"response",
")",
":",
"if",
"response",
".",
"has_header",
"(",
"'Last-Modified'",
")",
":",
"last_modified",
"=",
"parse_http_date",
"(",
"response",
"[",
"'Last-Modified'",
"]",
")",
"next_regen",
"=",
"last_modifi... | Check if this page was originally generated less than LOCAL_POSTCHECK seconds ago | [
"Check",
"if",
"this",
"page",
"was",
"originally",
"generated",
"less",
"than",
"LOCAL_POSTCHECK",
"seconds",
"ago"
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L85-L91 |
242,987 | ironfroggy/django-better-cache | bettercache/utils.py | CachingMixin.has_uncacheable_headers | def has_uncacheable_headers(self, response):
""" Should this response be cached based on it's headers
broken out from should_cache for flexibility
"""
cc_dict = get_header_dict(response, 'Cache-Control')
if cc_dict:
if 'max-age' in cc_dict and cc_dict['max-age'] ... | python | def has_uncacheable_headers(self, response):
""" Should this response be cached based on it's headers
broken out from should_cache for flexibility
"""
cc_dict = get_header_dict(response, 'Cache-Control')
if cc_dict:
if 'max-age' in cc_dict and cc_dict['max-age'] ... | [
"def",
"has_uncacheable_headers",
"(",
"self",
",",
"response",
")",
":",
"cc_dict",
"=",
"get_header_dict",
"(",
"response",
",",
"'Cache-Control'",
")",
"if",
"cc_dict",
":",
"if",
"'max-age'",
"in",
"cc_dict",
"and",
"cc_dict",
"[",
"'max-age'",
"]",
"==",
... | Should this response be cached based on it's headers
broken out from should_cache for flexibility | [
"Should",
"this",
"response",
"be",
"cached",
"based",
"on",
"it",
"s",
"headers",
"broken",
"out",
"from",
"should_cache",
"for",
"flexibility"
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L93-L109 |
242,988 | ironfroggy/django-better-cache | bettercache/utils.py | CachingMixin.set_cache | def set_cache(self, request, response):
""" caches the response supresses and logs exceptions"""
try:
cache_key = self.cache_key(request)
#presumably this is to deal with requests with attr functions that won't pickle
if hasattr(response, 'render') and callable(respo... | python | def set_cache(self, request, response):
""" caches the response supresses and logs exceptions"""
try:
cache_key = self.cache_key(request)
#presumably this is to deal with requests with attr functions that won't pickle
if hasattr(response, 'render') and callable(respo... | [
"def",
"set_cache",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"try",
":",
"cache_key",
"=",
"self",
".",
"cache_key",
"(",
"request",
")",
"#presumably this is to deal with requests with attr functions that won't pickle",
"if",
"hasattr",
"(",
"response"... | caches the response supresses and logs exceptions | [
"caches",
"the",
"response",
"supresses",
"and",
"logs",
"exceptions"
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L111-L122 |
242,989 | ironfroggy/django-better-cache | bettercache/utils.py | CachingMixin.cache_key | def cache_key(self, request, method=None):
""" the cache key is the absolute uri and the request method """
if method is None:
method = request.method
return "bettercache_page:%s:%s" %(request.build_absolute_uri(), method) | python | def cache_key(self, request, method=None):
""" the cache key is the absolute uri and the request method """
if method is None:
method = request.method
return "bettercache_page:%s:%s" %(request.build_absolute_uri(), method) | [
"def",
"cache_key",
"(",
"self",
",",
"request",
",",
"method",
"=",
"None",
")",
":",
"if",
"method",
"is",
"None",
":",
"method",
"=",
"request",
".",
"method",
"return",
"\"bettercache_page:%s:%s\"",
"%",
"(",
"request",
".",
"build_absolute_uri",
"(",
... | the cache key is the absolute uri and the request method | [
"the",
"cache",
"key",
"is",
"the",
"absolute",
"uri",
"and",
"the",
"request",
"method"
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L142-L147 |
242,990 | ironfroggy/django-better-cache | bettercache/utils.py | CachingMixin.send_task | def send_task(self, request, response):
"""send off a celery task for the current page and recache"""
# TODO is this too messy?
from bettercache.tasks import GeneratePage
try:
GeneratePage.apply_async((strip_wsgi(request),))
except:
logger.error("failed t... | python | def send_task(self, request, response):
"""send off a celery task for the current page and recache"""
# TODO is this too messy?
from bettercache.tasks import GeneratePage
try:
GeneratePage.apply_async((strip_wsgi(request),))
except:
logger.error("failed t... | [
"def",
"send_task",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"# TODO is this too messy?",
"from",
"bettercache",
".",
"tasks",
"import",
"GeneratePage",
"try",
":",
"GeneratePage",
".",
"apply_async",
"(",
"(",
"strip_wsgi",
"(",
"request",
")",
... | send off a celery task for the current page and recache | [
"send",
"off",
"a",
"celery",
"task",
"for",
"the",
"current",
"page",
"and",
"recache"
] | 5350e8c646cef1c1ca74eab176f856ddd9eaf5c3 | https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L149-L158 |
242,991 | elifesciences/elife-article | elifearticle/utils.py | entity_to_unicode | def entity_to_unicode(string):
"""
Quick convert unicode HTML entities to unicode characters
using a regular expression replacement
"""
# Selected character replacements that have been seen
replacements = []
replacements.append((r"α", u"\u03b1"))
replacements.append((r"β", u"\... | python | def entity_to_unicode(string):
"""
Quick convert unicode HTML entities to unicode characters
using a regular expression replacement
"""
# Selected character replacements that have been seen
replacements = []
replacements.append((r"α", u"\u03b1"))
replacements.append((r"β", u"\... | [
"def",
"entity_to_unicode",
"(",
"string",
")",
":",
"# Selected character replacements that have been seen",
"replacements",
"=",
"[",
"]",
"replacements",
".",
"append",
"(",
"(",
"r\"α\"",
",",
"u\"\\u03b1\"",
")",
")",
"replacements",
".",
"append",
"(",
"... | Quick convert unicode HTML entities to unicode characters
using a regular expression replacement | [
"Quick",
"convert",
"unicode",
"HTML",
"entities",
"to",
"unicode",
"characters",
"using",
"a",
"regular",
"expression",
"replacement"
] | 99710c213cd81fe6fd1e5c150d6e20efe2d1e33b | https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/utils.py#L37-L59 |
242,992 | elifesciences/elife-article | elifearticle/utils.py | remove_tag | def remove_tag(tag_name, string):
"""
Remove open and close tags - the tags themselves only - using
a non-greedy angle bracket pattern match
"""
if not string:
return string
pattern = re.compile('</?' + tag_name + '.*?>')
string = pattern.sub('', string)
return string | python | def remove_tag(tag_name, string):
"""
Remove open and close tags - the tags themselves only - using
a non-greedy angle bracket pattern match
"""
if not string:
return string
pattern = re.compile('</?' + tag_name + '.*?>')
string = pattern.sub('', string)
return string | [
"def",
"remove_tag",
"(",
"tag_name",
",",
"string",
")",
":",
"if",
"not",
"string",
":",
"return",
"string",
"pattern",
"=",
"re",
".",
"compile",
"(",
"'</?'",
"+",
"tag_name",
"+",
"'.*?>'",
")",
"string",
"=",
"pattern",
".",
"sub",
"(",
"''",
"... | Remove open and close tags - the tags themselves only - using
a non-greedy angle bracket pattern match | [
"Remove",
"open",
"and",
"close",
"tags",
"-",
"the",
"tags",
"themselves",
"only",
"-",
"using",
"a",
"non",
"-",
"greedy",
"angle",
"bracket",
"pattern",
"match"
] | 99710c213cd81fe6fd1e5c150d6e20efe2d1e33b | https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/utils.py#L61-L70 |
242,993 | elifesciences/elife-article | elifearticle/utils.py | version_from_xml_filename | def version_from_xml_filename(filename):
"extract the numeric version from the xml filename"
try:
filename_parts = filename.split(os.sep)[-1].split('-')
except AttributeError:
return None
if len(filename_parts) == 3:
try:
return int(filename_parts[-1].lstrip('v').rstr... | python | def version_from_xml_filename(filename):
"extract the numeric version from the xml filename"
try:
filename_parts = filename.split(os.sep)[-1].split('-')
except AttributeError:
return None
if len(filename_parts) == 3:
try:
return int(filename_parts[-1].lstrip('v').rstr... | [
"def",
"version_from_xml_filename",
"(",
"filename",
")",
":",
"try",
":",
"filename_parts",
"=",
"filename",
".",
"split",
"(",
"os",
".",
"sep",
")",
"[",
"-",
"1",
"]",
".",
"split",
"(",
"'-'",
")",
"except",
"AttributeError",
":",
"return",
"None",
... | extract the numeric version from the xml filename | [
"extract",
"the",
"numeric",
"version",
"from",
"the",
"xml",
"filename"
] | 99710c213cd81fe6fd1e5c150d6e20efe2d1e33b | https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/utils.py#L93-L105 |
242,994 | elifesciences/elife-article | elifearticle/utils.py | get_last_commit_to_master | def get_last_commit_to_master(repo_path="."):
"""
returns the last commit on the master branch. It would be more ideal to get the commit
from the branch we are currently on, but as this is a check mostly to help
with production issues, returning the commit from master will be sufficient.
"""
las... | python | def get_last_commit_to_master(repo_path="."):
"""
returns the last commit on the master branch. It would be more ideal to get the commit
from the branch we are currently on, but as this is a check mostly to help
with production issues, returning the commit from master will be sufficient.
"""
las... | [
"def",
"get_last_commit_to_master",
"(",
"repo_path",
"=",
"\".\"",
")",
":",
"last_commit",
"=",
"None",
"repo",
"=",
"None",
"try",
":",
"repo",
"=",
"Repo",
"(",
"repo_path",
")",
"except",
"(",
"InvalidGitRepositoryError",
",",
"NoSuchPathError",
")",
":",... | returns the last commit on the master branch. It would be more ideal to get the commit
from the branch we are currently on, but as this is a check mostly to help
with production issues, returning the commit from master will be sufficient. | [
"returns",
"the",
"last",
"commit",
"on",
"the",
"master",
"branch",
".",
"It",
"would",
"be",
"more",
"ideal",
"to",
"get",
"the",
"commit",
"from",
"the",
"branch",
"we",
"are",
"currently",
"on",
"but",
"as",
"this",
"is",
"a",
"check",
"mostly",
"t... | 99710c213cd81fe6fd1e5c150d6e20efe2d1e33b | https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/utils.py#L107-L125 |
242,995 | elifesciences/elife-article | elifearticle/utils.py | calculate_journal_volume | def calculate_journal_volume(pub_date, year):
"""
volume value is based on the pub date year
pub_date is a python time object
"""
try:
volume = str(pub_date.tm_year - year + 1)
except TypeError:
volume = None
except AttributeError:
volume = None
return volume | python | def calculate_journal_volume(pub_date, year):
"""
volume value is based on the pub date year
pub_date is a python time object
"""
try:
volume = str(pub_date.tm_year - year + 1)
except TypeError:
volume = None
except AttributeError:
volume = None
return volume | [
"def",
"calculate_journal_volume",
"(",
"pub_date",
",",
"year",
")",
":",
"try",
":",
"volume",
"=",
"str",
"(",
"pub_date",
".",
"tm_year",
"-",
"year",
"+",
"1",
")",
"except",
"TypeError",
":",
"volume",
"=",
"None",
"except",
"AttributeError",
":",
... | volume value is based on the pub date year
pub_date is a python time object | [
"volume",
"value",
"is",
"based",
"on",
"the",
"pub",
"date",
"year",
"pub_date",
"is",
"a",
"python",
"time",
"object"
] | 99710c213cd81fe6fd1e5c150d6e20efe2d1e33b | https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/utils.py#L127-L138 |
242,996 | elifesciences/elife-article | elifearticle/utils.py | author_name_from_json | def author_name_from_json(author_json):
"concatenate an author name from json data"
author_name = None
if author_json.get('type'):
if author_json.get('type') == 'group' and author_json.get('name'):
author_name = author_json.get('name')
elif author_json.get('type') == 'person' and... | python | def author_name_from_json(author_json):
"concatenate an author name from json data"
author_name = None
if author_json.get('type'):
if author_json.get('type') == 'group' and author_json.get('name'):
author_name = author_json.get('name')
elif author_json.get('type') == 'person' and... | [
"def",
"author_name_from_json",
"(",
"author_json",
")",
":",
"author_name",
"=",
"None",
"if",
"author_json",
".",
"get",
"(",
"'type'",
")",
":",
"if",
"author_json",
".",
"get",
"(",
"'type'",
")",
"==",
"'group'",
"and",
"author_json",
".",
"get",
"(",... | concatenate an author name from json data | [
"concatenate",
"an",
"author",
"name",
"from",
"json",
"data"
] | 99710c213cd81fe6fd1e5c150d6e20efe2d1e33b | https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/utils.py#L140-L149 |
242,997 | elifesciences/elife-article | elifearticle/utils.py | text_from_affiliation_elements | def text_from_affiliation_elements(department, institution, city, country):
"format an author affiliation from details"
return ', '.join(element for element in [department, institution, city, country] if element) | python | def text_from_affiliation_elements(department, institution, city, country):
"format an author affiliation from details"
return ', '.join(element for element in [department, institution, city, country] if element) | [
"def",
"text_from_affiliation_elements",
"(",
"department",
",",
"institution",
",",
"city",
",",
"country",
")",
":",
"return",
"', '",
".",
"join",
"(",
"element",
"for",
"element",
"in",
"[",
"department",
",",
"institution",
",",
"city",
",",
"country",
... | format an author affiliation from details | [
"format",
"an",
"author",
"affiliation",
"from",
"details"
] | 99710c213cd81fe6fd1e5c150d6e20efe2d1e33b | https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/utils.py#L151-L153 |
242,998 | cdeboever3/cdpybio | cdpybio/mutect.py | read_variants | def read_variants(fns, remove=['DBSNP'], keep_only=True,
min_tumor_f=0.1, min_tumor_cov=14,
min_normal_cov=8):
"""Read muTect results from the list of files fns
Parameters
----------
fns : list
List of MuTect output files.
Returns
-------
variant... | python | def read_variants(fns, remove=['DBSNP'], keep_only=True,
min_tumor_f=0.1, min_tumor_cov=14,
min_normal_cov=8):
"""Read muTect results from the list of files fns
Parameters
----------
fns : list
List of MuTect output files.
Returns
-------
variant... | [
"def",
"read_variants",
"(",
"fns",
",",
"remove",
"=",
"[",
"'DBSNP'",
"]",
",",
"keep_only",
"=",
"True",
",",
"min_tumor_f",
"=",
"0.1",
",",
"min_tumor_cov",
"=",
"14",
",",
"min_normal_cov",
"=",
"8",
")",
":",
"variants",
"=",
"[",
"]",
"for",
... | Read muTect results from the list of files fns
Parameters
----------
fns : list
List of MuTect output files.
Returns
-------
variants : pandas.DataFrame
Pandas DataFrame summarizing variant calling results.
remove : list
List of site types for column "dbsnp_site" t... | [
"Read",
"muTect",
"results",
"from",
"the",
"list",
"of",
"files",
"fns"
] | 38efdf0e11d01bc00a135921cb91a19c03db5d5c | https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/mutect.py#L4-L77 |
242,999 | honzamach/pynspect | pynspect/compilers.py | ConversionRule.traverse | def traverse(self, traverser, **kwargs):
"""
Implementation of mandatory interface for traversing the whole rule tree.
This method will call the ``traverse`` method of child rule tree and
then perform arbitrary conversion of the result before returning it back.
The optional ``kwa... | python | def traverse(self, traverser, **kwargs):
"""
Implementation of mandatory interface for traversing the whole rule tree.
This method will call the ``traverse`` method of child rule tree and
then perform arbitrary conversion of the result before returning it back.
The optional ``kwa... | [
"def",
"traverse",
"(",
"self",
",",
"traverser",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"self",
".",
"rule",
".",
"traverse",
"(",
"traverser",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"conversion",
"(",
"result",
")"
] | Implementation of mandatory interface for traversing the whole rule tree.
This method will call the ``traverse`` method of child rule tree and
then perform arbitrary conversion of the result before returning it back.
The optional ``kwargs`` are passed down to traverser callback as additional
... | [
"Implementation",
"of",
"mandatory",
"interface",
"for",
"traversing",
"the",
"whole",
"rule",
"tree",
".",
"This",
"method",
"will",
"call",
"the",
"traverse",
"method",
"of",
"child",
"rule",
"tree",
"and",
"then",
"perform",
"arbitrary",
"conversion",
"of",
... | 0582dcc1f7aafe50e25a21c792ea1b3367ea5881 | https://github.com/honzamach/pynspect/blob/0582dcc1f7aafe50e25a21c792ea1b3367ea5881/pynspect/compilers.py#L186-L198 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.