body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def _rec_to_ndarr(rec_arr, data_type=float):
'\n Function to transform a numpy record array to a nd array.\n dupe of SimPEG.electromagnetics.natural_source.utils.rec_to_ndarr to avoid circular import\n '
return np.array(recFunc.structured_to_unstructured(recFunc.repack_fields(rec_arr[list(rec_arr.dtype... | -7,502,075,036,549,811,000 | Function to transform a numpy record array to a nd array.
dupe of SimPEG.electromagnetics.natural_source.utils.rec_to_ndarr to avoid circular import | SimPEG/electromagnetics/natural_source/survey.py | _rec_to_ndarr | JKutt/simpeg | python | def _rec_to_ndarr(rec_arr, data_type=float):
'\n Function to transform a numpy record array to a nd array.\n dupe of SimPEG.electromagnetics.natural_source.utils.rec_to_ndarr to avoid circular import\n '
return np.array(recFunc.structured_to_unstructured(recFunc.repack_fields(rec_arr[list(rec_arr.dtype... |
def toRecArray(self, returnType='RealImag'):
"\n Returns a numpy.recarray for a SimpegNSEM impedance data object.\n\n :param returnType: Switches between returning a rec array where the impedance is split to real and imaginary ('RealImag') or is a complex ('Complex')\n :type returnType: str, op... | 3,530,613,215,818,577,000 | Returns a numpy.recarray for a SimpegNSEM impedance data object.
:param returnType: Switches between returning a rec array where the impedance is split to real and imaginary ('RealImag') or is a complex ('Complex')
:type returnType: str, optional
:rtype: numpy.recarray
:return: Record array with data, with indexed col... | SimPEG/electromagnetics/natural_source/survey.py | toRecArray | JKutt/simpeg | python | def toRecArray(self, returnType='RealImag'):
"\n Returns a numpy.recarray for a SimpegNSEM impedance data object.\n\n :param returnType: Switches between returning a rec array where the impedance is split to real and imaginary ('RealImag') or is a complex ('Complex')\n :type returnType: str, op... |
@classmethod
def fromRecArray(cls, recArray, srcType='primary'):
"\n Class method that reads in a numpy record array to NSEMdata object.\n\n :param recArray: Record array with the data. Has to have ('freq','x','y','z') columns and some ('zxx','zxy','zyx','zyy','tzx','tzy')\n :type recArray: num... | -6,614,493,823,147,336,000 | Class method that reads in a numpy record array to NSEMdata object.
:param recArray: Record array with the data. Has to have ('freq','x','y','z') columns and some ('zxx','zxy','zyx','zyy','tzx','tzy')
:type recArray: numpy.recarray
:param srcType: The type of SimPEG.EM.NSEM.SrcNSEM to be used
:type srcType: str, opti... | SimPEG/electromagnetics/natural_source/survey.py | fromRecArray | JKutt/simpeg | python | @classmethod
def fromRecArray(cls, recArray, srcType='primary'):
"\n Class method that reads in a numpy record array to NSEMdata object.\n\n :param recArray: Record array with the data. Has to have ('freq','x','y','z') columns and some ('zxx','zxy','zyx','zyy','tzx','tzy')\n :type recArray: num... |
@contextmanager
def chdir(d):
'A context manager that temporary changes the working directory.\n '
olddir = os.getcwd()
os.chdir(d)
(yield)
os.chdir(olddir) | 1,714,808,242,589,344,500 | A context manager that temporary changes the working directory. | extra/release.py | chdir | DucNg/beets | python | @contextmanager
def chdir(d):
'\n '
olddir = os.getcwd()
os.chdir(d)
(yield)
os.chdir(olddir) |
def bump_version(version):
'Update the version number in setup.py, docs config, changelog,\n and root module.\n '
version_parts = [int(p) for p in version.split('.')]
assert (len(version_parts) == 3), 'invalid version number'
minor = '{}.{}'.format(*version_parts)
major = '{}'.format(*version_... | 1,878,278,604,259,459,800 | Update the version number in setup.py, docs config, changelog,
and root module. | extra/release.py | bump_version | DucNg/beets | python | def bump_version(version):
'Update the version number in setup.py, docs config, changelog,\n and root module.\n '
version_parts = [int(p) for p in version.split('.')]
assert (len(version_parts) == 3), 'invalid version number'
minor = '{}.{}'.format(*version_parts)
major = '{}'.format(*version_... |
@release.command()
@click.argument('version')
def bump(version):
'Bump the version number.\n '
bump_version(version) | -6,585,817,667,597,795,000 | Bump the version number. | extra/release.py | bump | DucNg/beets | python | @release.command()
@click.argument('version')
def bump(version):
'\n '
bump_version(version) |
def get_latest_changelog():
'Extract the first section of the changelog.\n '
started = False
lines = []
with open(CHANGELOG) as f:
for line in f:
if re.match('^--+$', line.strip()):
if started:
del lines[(- 1)]
break
... | -2,016,547,498,757,757,700 | Extract the first section of the changelog. | extra/release.py | get_latest_changelog | DucNg/beets | python | def get_latest_changelog():
'\n '
started = False
lines = []
with open(CHANGELOG) as f:
for line in f:
if re.match('^--+$', line.strip()):
if started:
del lines[(- 1)]
break
else:
started =... |
def rst2md(text):
'Use Pandoc to convert text from ReST to Markdown.\n '
pandoc = subprocess.Popen(['pandoc', '--from=rst', '--to=markdown', '--wrap=none'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, _) = pandoc.communicate(text.encode('utf-8'))
md = stdout.decode... | -1,097,655,531,828,343,000 | Use Pandoc to convert text from ReST to Markdown. | extra/release.py | rst2md | DucNg/beets | python | def rst2md(text):
'\n '
pandoc = subprocess.Popen(['pandoc', '--from=rst', '--to=markdown', '--wrap=none'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, _) = pandoc.communicate(text.encode('utf-8'))
md = stdout.decode('utf-8').strip()
return re.sub('^- ', '- '... |
def changelog_as_markdown():
'Get the latest changelog entry as hacked up Markdown.\n '
rst = get_latest_changelog()
rst = re.sub(':doc:`/plugins/(\\w+)`', '``\\1``', rst)
rst = re.sub(':ref:`([^<]+)(<[^>]+>)`', '\\1', rst)
rst = re.sub('(\\s)`([^`]+)`([^_])', '\\1``\\2``\\3', rst)
rst = re.s... | -8,174,653,492,084,834,000 | Get the latest changelog entry as hacked up Markdown. | extra/release.py | changelog_as_markdown | DucNg/beets | python | def changelog_as_markdown():
'\n '
rst = get_latest_changelog()
rst = re.sub(':doc:`/plugins/(\\w+)`', '``\\1``', rst)
rst = re.sub(':ref:`([^<]+)(<[^>]+>)`', '\\1', rst)
rst = re.sub('(\\s)`([^`]+)`([^_])', '\\1``\\2``\\3', rst)
rst = re.sub(':ref:`(\\w+)-cmd`', '``\\1``', rst)
rst = re.... |
@release.command()
def changelog():
"Get the most recent version's changelog as Markdown.\n "
print(changelog_as_markdown()) | 7,300,083,879,938,557,000 | Get the most recent version's changelog as Markdown. | extra/release.py | changelog | DucNg/beets | python | @release.command()
def changelog():
"\n "
print(changelog_as_markdown()) |
def get_version(index=0):
'Read the current version from the changelog.\n '
with open(CHANGELOG) as f:
cur_index = 0
for line in f:
match = re.search('^\\d+\\.\\d+\\.\\d+', line)
if match:
if (cur_index == index):
return match.group(... | 2,229,043,007,905,601,000 | Read the current version from the changelog. | extra/release.py | get_version | DucNg/beets | python | def get_version(index=0):
'\n '
with open(CHANGELOG) as f:
cur_index = 0
for line in f:
match = re.search('^\\d+\\.\\d+\\.\\d+', line)
if match:
if (cur_index == index):
return match.group(0)
else:
... |
@release.command()
def version():
'Display the current version.\n '
print(get_version()) | 4,739,928,957,776,093,000 | Display the current version. | extra/release.py | version | DucNg/beets | python | @release.command()
def version():
'\n '
print(get_version()) |
@release.command()
def datestamp():
"Enter today's date as the release date in the changelog.\n "
dt = datetime.datetime.now()
stamp = '({} {}, {})'.format(dt.strftime('%B'), dt.day, dt.year)
marker = '(in development)'
lines = []
underline_length = None
with open(CHANGELOG) as f:
... | -7,742,174,435,753,201,000 | Enter today's date as the release date in the changelog. | extra/release.py | datestamp | DucNg/beets | python | @release.command()
def datestamp():
"\n "
dt = datetime.datetime.now()
stamp = '({} {}, {})'.format(dt.strftime('%B'), dt.day, dt.year)
marker = '(in development)'
lines = []
underline_length = None
with open(CHANGELOG) as f:
for line in f:
if (marker in line):
... |
@release.command()
def prep():
'Run all steps to prepare a release.\n\n - Tag the commit.\n - Build the sdist package.\n - Generate the Markdown changelog to ``changelog.md``.\n - Bump the version number to the next version.\n '
cur_version = get_version()
subprocess.check_call(['git', 'tag',... | 8,656,651,602,921,603,000 | Run all steps to prepare a release.
- Tag the commit.
- Build the sdist package.
- Generate the Markdown changelog to ``changelog.md``.
- Bump the version number to the next version. | extra/release.py | prep | DucNg/beets | python | @release.command()
def prep():
'Run all steps to prepare a release.\n\n - Tag the commit.\n - Build the sdist package.\n - Generate the Markdown changelog to ``changelog.md``.\n - Bump the version number to the next version.\n '
cur_version = get_version()
subprocess.check_call(['git', 'tag',... |
@release.command()
def publish():
'Unleash a release unto the world.\n\n - Push the tag to GitHub.\n - Upload to PyPI.\n '
version = get_version(1)
with chdir(BASE):
subprocess.check_call(['git', 'push'])
subprocess.check_call(['git', 'push', '--tags'])
path = os.path.join(BASE,... | -8,958,813,535,979,738,000 | Unleash a release unto the world.
- Push the tag to GitHub.
- Upload to PyPI. | extra/release.py | publish | DucNg/beets | python | @release.command()
def publish():
'Unleash a release unto the world.\n\n - Push the tag to GitHub.\n - Upload to PyPI.\n '
version = get_version(1)
with chdir(BASE):
subprocess.check_call(['git', 'push'])
subprocess.check_call(['git', 'push', '--tags'])
path = os.path.join(BASE,... |
@release.command()
def ghrelease():
'Create a GitHub release using the `github-release` command-line\n tool.\n\n Reads the changelog to upload from `changelog.md`. Uploads the\n tarball from the `dist` directory.\n '
version = get_version(1)
tag = ('v' + version)
with open(os.path.join(BASE,... | 2,627,795,155,991,059,500 | Create a GitHub release using the `github-release` command-line
tool.
Reads the changelog to upload from `changelog.md`. Uploads the
tarball from the `dist` directory. | extra/release.py | ghrelease | DucNg/beets | python | @release.command()
def ghrelease():
'Create a GitHub release using the `github-release` command-line\n tool.\n\n Reads the changelog to upload from `changelog.md`. Uploads the\n tarball from the `dist` directory.\n '
version = get_version(1)
tag = ('v' + version)
with open(os.path.join(BASE,... |
def getEtiqueta(linea: str) -> str:
'Obtiene el nombre de la captura\n\n Args:\n linea (str): Linea donde se va a buscar la etiqueta\n\n Returns:\n str: Regresa el nombre de la etiqueta\n '
pattern = '\\s+([a-z]{1,5})\\s+([a-z]{1,24})'
busqueda = re.search(pattern, linea, re.IGNORECAS... | -1,470,548,433,536,994,600 | Obtiene el nombre de la captura
Args:
linea (str): Linea donde se va a buscar la etiqueta
Returns:
str: Regresa el nombre de la etiqueta | Precompilar/relativo.py | getEtiqueta | EzioFenix/Compilador-M68HC11 | python | def getEtiqueta(linea: str) -> str:
'Obtiene el nombre de la captura\n\n Args:\n linea (str): Linea donde se va a buscar la etiqueta\n\n Returns:\n str: Regresa el nombre de la etiqueta\n '
pattern = '\\s+([a-z]{1,5})\\s+([a-z]{1,24})'
busqueda = re.search(pattern, linea, re.IGNORECAS... |
def calcularEtiqueta(sustraendo: str, minuendo: str) -> str:
"Resta la diferencia entre dos PC en hexadecimal\n sustraendo - minuendo\n\n - Si\n - Sustraendo - minuendo\n - En caso de error regresa 'e10' operando muy grande\n\n Args:\n sustraendo (str): Ejemplo '0x7'\n minuendo (str): E... | -1,091,928,827,621,050,600 | Resta la diferencia entre dos PC en hexadecimal
sustraendo - minuendo
- Si
- Sustraendo - minuendo
- En caso de error regresa 'e10' operando muy grande
Args:
sustraendo (str): Ejemplo '0x7'
minuendo (str): Ejemplo '0x1'
Returns:
str: Ejemplo '0x06' | Precompilar/relativo.py | calcularEtiqueta | EzioFenix/Compilador-M68HC11 | python | def calcularEtiqueta(sustraendo: str, minuendo: str) -> str:
"Resta la diferencia entre dos PC en hexadecimal\n sustraendo - minuendo\n\n - Si\n - Sustraendo - minuendo\n - En caso de error regresa 'e10' operando muy grande\n\n Args:\n sustraendo (str): Ejemplo '0x7'\n minuendo (str): E... |
def bindigits(n: int, bits: int) -> str:
"Convierte a binario un numero de complemento A2 en caso de negativo, normal en caso de ser positivo\n\n Args:\n n (int): E.g 7\n bits (int): eg 3\n\n Returns:\n str: E.g '001'\n "
s = bin((n & int(('1' * bits), 2)))[2:]
return ('{0:0>%s... | -555,204,515,090,442,560 | Convierte a binario un numero de complemento A2 en caso de negativo, normal en caso de ser positivo
Args:
n (int): E.g 7
bits (int): eg 3
Returns:
str: E.g '001' | Precompilar/relativo.py | bindigits | EzioFenix/Compilador-M68HC11 | python | def bindigits(n: int, bits: int) -> str:
"Convierte a binario un numero de complemento A2 en caso de negativo, normal en caso de ser positivo\n\n Args:\n n (int): E.g 7\n bits (int): eg 3\n\n Returns:\n str: E.g '001'\n "
s = bin((n & int(('1' * bits), 2)))[2:]
return ('{0:0>%s... |
def convertirA2Hex(numero: int) -> str:
'Convierte un numero decimal a hexadecimal\n\n - Si el número es decimal lo convierte a complemento A2\n\n Args:\n numero (int): Número decimal que se quiere convertir Eg. 07\n\n Returns:\n str: Eg. 0x07\n '
cuantosBits = ((len(hex(numero)) - 2) ... | -6,387,372,555,459,491,000 | Convierte un numero decimal a hexadecimal
- Si el número es decimal lo convierte a complemento A2
Args:
numero (int): Número decimal que se quiere convertir Eg. 07
Returns:
str: Eg. 0x07 | Precompilar/relativo.py | convertirA2Hex | EzioFenix/Compilador-M68HC11 | python | def convertirA2Hex(numero: int) -> str:
'Convierte un numero decimal a hexadecimal\n\n - Si el número es decimal lo convierte a complemento A2\n\n Args:\n numero (int): Número decimal que se quiere convertir Eg. 07\n\n Returns:\n str: Eg. 0x07\n '
cuantosBits = ((len(hex(numero)) - 2) ... |
def tarako_passed(review):
'Add the tarako tag to the app.'
tag = Tag(tag_text='tarako')
tag.save_tag(review.app)
WebappIndexer.index_ids([review.app.pk])
send_tarako_mail(review) | 1,414,064,931,217,316,000 | Add the tarako tag to the app. | mkt/reviewers/models.py | tarako_passed | ngokevin/zamboni | python | def tarako_passed(review):
tag = Tag(tag_text='tarako')
tag.save_tag(review.app)
WebappIndexer.index_ids([review.app.pk])
send_tarako_mail(review) |
def tarako_failed(review):
'Remove the tarako tag from the app.'
tag = Tag(tag_text='tarako')
tag.remove_tag(review.app)
WebappIndexer.index_ids([review.app.pk])
send_tarako_mail(review) | -5,799,101,042,945,683,000 | Remove the tarako tag from the app. | mkt/reviewers/models.py | tarako_failed | ngokevin/zamboni | python | def tarako_failed(review):
tag = Tag(tag_text='tarako')
tag.remove_tag(review.app)
WebappIndexer.index_ids([review.app.pk])
send_tarako_mail(review) |
@classmethod
def get_event(cls, addon, status, **kwargs):
"Return the review event type constant.\n\n This is determined by the app type and the queue the addon is\n currently in (which is determined from the status).\n\n Note: We're not using addon.status because this is called after the\n ... | 7,765,533,970,006,714,000 | Return the review event type constant.
This is determined by the app type and the queue the addon is
currently in (which is determined from the status).
Note: We're not using addon.status because this is called after the
status has been updated by the reviewer action. | mkt/reviewers/models.py | get_event | ngokevin/zamboni | python | @classmethod
def get_event(cls, addon, status, **kwargs):
"Return the review event type constant.\n\n This is determined by the app type and the queue the addon is\n currently in (which is determined from the status).\n\n Note: We're not using addon.status because this is called after the\n ... |
@classmethod
def award_points(cls, user, addon, status, **kwargs):
'Awards points to user based on an event and the queue.\n\n `event` is one of the `REVIEWED_` keys in constants.\n `status` is one of the `STATUS_` keys in constants.\n\n '
event = cls.get_event(addon, status, **kwargs)
... | -170,779,754,332,337,860 | Awards points to user based on an event and the queue.
`event` is one of the `REVIEWED_` keys in constants.
`status` is one of the `STATUS_` keys in constants. | mkt/reviewers/models.py | award_points | ngokevin/zamboni | python | @classmethod
def award_points(cls, user, addon, status, **kwargs):
'Awards points to user based on an event and the queue.\n\n `event` is one of the `REVIEWED_` keys in constants.\n `status` is one of the `STATUS_` keys in constants.\n\n '
event = cls.get_event(addon, status, **kwargs)
... |
@classmethod
def award_moderation_points(cls, user, addon, review_id):
'Awards points to user based on moderated review.'
event = amo.REVIEWED_APP_REVIEW
score = amo.REVIEWED_SCORES.get(event)
cls.objects.create(user=user, addon=addon, score=score, note_key=event)
cls.get_key(invalidate=True)
us... | -6,911,730,646,535,177,000 | Awards points to user based on moderated review. | mkt/reviewers/models.py | award_moderation_points | ngokevin/zamboni | python | @classmethod
def award_moderation_points(cls, user, addon, review_id):
event = amo.REVIEWED_APP_REVIEW
score = amo.REVIEWED_SCORES.get(event)
cls.objects.create(user=user, addon=addon, score=score, note_key=event)
cls.get_key(invalidate=True)
user_log.info((u'Awarding %s points to user %s for "... |
@classmethod
def get_total(cls, user):
'Returns total points by user.'
key = cls.get_key(('get_total:%s' % user.id))
val = cache.get(key)
if (val is not None):
return val
val = ReviewerScore.objects.no_cache().filter(user=user).aggregate(total=Sum('score')).values()[0]
if (val is None):
... | -763,553,648,910,366,800 | Returns total points by user. | mkt/reviewers/models.py | get_total | ngokevin/zamboni | python | @classmethod
def get_total(cls, user):
key = cls.get_key(('get_total:%s' % user.id))
val = cache.get(key)
if (val is not None):
return val
val = ReviewerScore.objects.no_cache().filter(user=user).aggregate(total=Sum('score')).values()[0]
if (val is None):
val = 0
cache.set(k... |
@classmethod
def get_recent(cls, user, limit=5):
'Returns most recent ReviewerScore records.'
key = cls.get_key(('get_recent:%s' % user.id))
val = cache.get(key)
if (val is not None):
return val
val = ReviewerScore.objects.no_cache().filter(user=user)
val = list(val[:limit])
cache.se... | -5,398,352,852,748,852,000 | Returns most recent ReviewerScore records. | mkt/reviewers/models.py | get_recent | ngokevin/zamboni | python | @classmethod
def get_recent(cls, user, limit=5):
key = cls.get_key(('get_recent:%s' % user.id))
val = cache.get(key)
if (val is not None):
return val
val = ReviewerScore.objects.no_cache().filter(user=user)
val = list(val[:limit])
cache.set(key, val, None)
return val |
@classmethod
def get_performance(cls, user):
'Returns sum of reviewer points.'
key = cls.get_key(('get_performance:%s' % user.id))
val = cache.get(key)
if (val is not None):
return val
sql = '\n SELECT `reviewer_scores`.*,\n SUM(`reviewer_scores`.`score`) AS `t... | 7,279,862,741,735,119,000 | Returns sum of reviewer points. | mkt/reviewers/models.py | get_performance | ngokevin/zamboni | python | @classmethod
def get_performance(cls, user):
key = cls.get_key(('get_performance:%s' % user.id))
val = cache.get(key)
if (val is not None):
return val
sql = '\n SELECT `reviewer_scores`.*,\n SUM(`reviewer_scores`.`score`) AS `total`\n FROM `reviewe... |
@classmethod
def get_performance_since(cls, user, since):
'\n Returns sum of reviewer points since the given datetime.\n '
key = cls.get_key(('get_performance:%s:%s' % (user.id, since.isoformat())))
val = cache.get(key)
if (val is not None):
return val
sql = '\n SEL... | 8,008,705,010,501,285,000 | Returns sum of reviewer points since the given datetime. | mkt/reviewers/models.py | get_performance_since | ngokevin/zamboni | python | @classmethod
def get_performance_since(cls, user, since):
'\n \n '
key = cls.get_key(('get_performance:%s:%s' % (user.id, since.isoformat())))
val = cache.get(key)
if (val is not None):
return val
sql = '\n SELECT `reviewer_scores`.*,\n SUM(`revie... |
@classmethod
def _leaderboard_query(cls, since=None, types=None):
'\n Returns common SQL to leaderboard calls.\n '
query = cls.objects.values_list('user__id', 'user__display_name').annotate(total=Sum('score')).exclude(user__groups__name__in=('No Reviewer Incentives', 'Staff', 'Admins')).order_by('... | -7,027,020,255,559,473,000 | Returns common SQL to leaderboard calls. | mkt/reviewers/models.py | _leaderboard_query | ngokevin/zamboni | python | @classmethod
def _leaderboard_query(cls, since=None, types=None):
'\n \n '
query = cls.objects.values_list('user__id', 'user__display_name').annotate(total=Sum('score')).exclude(user__groups__name__in=('No Reviewer Incentives', 'Staff', 'Admins')).order_by('-total')
if (since is not None):
... |
@classmethod
def get_leaderboards(cls, user, days=7, types=None):
"Returns leaderboards with ranking for the past given days.\n\n This will return a dict of 3 items::\n\n {'leader_top': [...],\n 'leader_near: [...],\n 'user_rank': (int)}\n\n If the user is not in the... | -8,640,058,109,515,062,000 | Returns leaderboards with ranking for the past given days.
This will return a dict of 3 items::
{'leader_top': [...],
'leader_near: [...],
'user_rank': (int)}
If the user is not in the leaderboard, or if the user is in the top 5,
'leader_near' will be an empty list and 'leader_top' will contain 5
eleme... | mkt/reviewers/models.py | get_leaderboards | ngokevin/zamboni | python | @classmethod
def get_leaderboards(cls, user, days=7, types=None):
"Returns leaderboards with ranking for the past given days.\n\n This will return a dict of 3 items::\n\n {'leader_top': [...],\n 'leader_near: [...],\n 'user_rank': (int)}\n\n If the user is not in the... |
@classmethod
def all_users_by_score(cls):
'\n Returns reviewers ordered by highest total points first.\n '
query = cls._leaderboard_query()
scores = []
for row in query:
(user_id, name, total) = row
user_level = (len(amo.REVIEWED_LEVELS) - 1)
for (i, level) in enume... | -463,350,881,850,450,900 | Returns reviewers ordered by highest total points first. | mkt/reviewers/models.py | all_users_by_score | ngokevin/zamboni | python | @classmethod
def all_users_by_score(cls):
'\n \n '
query = cls._leaderboard_query()
scores = []
for row in query:
(user_id, name, total) = row
user_level = (len(amo.REVIEWED_LEVELS) - 1)
for (i, level) in enumerate(amo.REVIEWED_LEVELS):
if (total < level... |
def execute_post_review_task(self):
'\n Call the correct post-review function for the queue.\n '
if (self.passed is None):
raise ValueError('cannot execute post-review task when unreviewed')
elif self.passed:
tarako_passed(self)
action = amo.LOG.PASS_ADDITIONAL_REVIEW
... | -707,987,219,861,457,900 | Call the correct post-review function for the queue. | mkt/reviewers/models.py | execute_post_review_task | ngokevin/zamboni | python | def execute_post_review_task(self):
'\n \n '
if (self.passed is None):
raise ValueError('cannot execute post-review task when unreviewed')
elif self.passed:
tarako_passed(self)
action = amo.LOG.PASS_ADDITIONAL_REVIEW
else:
tarako_failed(self)
action ... |
def test_lookup_cache(self):
'\n Make sure that the content type cache (see ContentTypeManager)\n works correctly. Lookups for a particular content type -- by model or\n by ID -- should hit the database only on the first lookup.\n '
ContentType.objects.get_for_model(ContentType)
... | 55,209,758,312,207,290 | Make sure that the content type cache (see ContentTypeManager)
works correctly. Lookups for a particular content type -- by model or
by ID -- should hit the database only on the first lookup. | django/contrib/contenttypes/tests.py | test_lookup_cache | coderanger/django | python | def test_lookup_cache(self):
'\n Make sure that the content type cache (see ContentTypeManager)\n works correctly. Lookups for a particular content type -- by model or\n by ID -- should hit the database only on the first lookup.\n '
ContentType.objects.get_for_model(ContentType)
... |
def test_shortcut_view(self):
'\n Check that the shortcut view (used for the admin "view on site"\n functionality) returns a complete URL regardless of whether the sites\n framework is installed\n '
request = HttpRequest()
request.META = {'SERVER_NAME': 'Example.com', 'SERVER_POR... | 5,184,480,617,571,533,000 | Check that the shortcut view (used for the admin "view on site"
functionality) returns a complete URL regardless of whether the sites
framework is installed | django/contrib/contenttypes/tests.py | test_shortcut_view | coderanger/django | python | def test_shortcut_view(self):
'\n Check that the shortcut view (used for the admin "view on site"\n functionality) returns a complete URL regardless of whether the sites\n framework is installed\n '
request = HttpRequest()
request.META = {'SERVER_NAME': 'Example.com', 'SERVER_POR... |
def _get_paths_from_images(path):
'get image path list from image folder'
assert os.path.isdir(path), '{:s} is not a valid directory'.format(path)
images = []
for (dirpath, _, fnames) in sorted(os.walk(path)):
for fname in sorted(fnames):
if is_image_file(fname):
img_... | 3,823,462,890,462,621,700 | get image path list from image folder | mmedit/models/inpaintors/vic/common.py | _get_paths_from_images | f74066357/Image_Inpainting | python | def _get_paths_from_images(path):
assert os.path.isdir(path), '{:s} is not a valid directory'.format(path)
images = []
for (dirpath, _, fnames) in sorted(os.walk(path)):
for fname in sorted(fnames):
if is_image_file(fname):
img_path = os.path.join(dirpath, fname)
... |
def _get_paths_from_lmdb(dataroot):
'get image path list from lmdb'
import lmdb
env = lmdb.open(dataroot, readonly=True, lock=False, readahead=False, meminit=False)
keys_cache_file = os.path.join(dataroot, '_keys_cache.p')
logger = logging.getLogger('base')
if os.path.isfile(keys_cache_file):
... | -5,246,789,503,854,577,000 | get image path list from lmdb | mmedit/models/inpaintors/vic/common.py | _get_paths_from_lmdb | f74066357/Image_Inpainting | python | def _get_paths_from_lmdb(dataroot):
import lmdb
env = lmdb.open(dataroot, readonly=True, lock=False, readahead=False, meminit=False)
keys_cache_file = os.path.join(dataroot, '_keys_cache.p')
logger = logging.getLogger('base')
if os.path.isfile(keys_cache_file):
logger.info('Read lmdb ke... |
def get_image_paths(data_type, dataroot):
'get image path list\n support lmdb or image files'
(env, paths) = (None, None)
if (dataroot is not None):
if (data_type == 'lmdb'):
(env, paths) = _get_paths_from_lmdb(dataroot)
elif (data_type == 'img'):
paths = sorted(_g... | -6,485,064,618,622,332,000 | get image path list
support lmdb or image files | mmedit/models/inpaintors/vic/common.py | get_image_paths | f74066357/Image_Inpainting | python | def get_image_paths(data_type, dataroot):
'get image path list\n support lmdb or image files'
(env, paths) = (None, None)
if (dataroot is not None):
if (data_type == 'lmdb'):
(env, paths) = _get_paths_from_lmdb(dataroot)
elif (data_type == 'img'):
paths = sorted(_g... |
def read_img(env, path, out_nc=3, fix_channels=True):
'\n Reads image using cv2 (rawpy if dng) or from lmdb by default\n (can also use using PIL instead of cv2)\n Arguments:\n out_nc: Desired number of channels\n fix_channels: changes the images to the desired number of channels\n ... | -8,034,327,278,745,694,000 | Reads image using cv2 (rawpy if dng) or from lmdb by default
(can also use using PIL instead of cv2)
Arguments:
out_nc: Desired number of channels
fix_channels: changes the images to the desired number of channels
Output:
Numpy uint8, HWC, BGR, [0,255] by default | mmedit/models/inpaintors/vic/common.py | read_img | f74066357/Image_Inpainting | python | def read_img(env, path, out_nc=3, fix_channels=True):
'\n Reads image using cv2 (rawpy if dng) or from lmdb by default\n (can also use using PIL instead of cv2)\n Arguments:\n out_nc: Desired number of channels\n fix_channels: changes the images to the desired number of channels\n ... |
def fix_img_channels(img, out_nc):
'\n fix image channels to the expected number\n '
if (img.ndim == 2):
img = np.tile(np.expand_dims(img, axis=2), (1, 1, 3))
if ((out_nc == 3) and (img.shape[2] == 4)):
img = bgra2rgb(img)
elif (img.shape[2] > out_nc):
img = img[:, :, :... | -2,006,961,338,334,872,300 | fix image channels to the expected number | mmedit/models/inpaintors/vic/common.py | fix_img_channels | f74066357/Image_Inpainting | python | def fix_img_channels(img, out_nc):
'\n \n '
if (img.ndim == 2):
img = np.tile(np.expand_dims(img, axis=2), (1, 1, 3))
if ((out_nc == 3) and (img.shape[2] == 4)):
img = bgra2rgb(img)
elif (img.shape[2] > out_nc):
img = img[:, :, :out_nc]
elif ((img.shape[2] == 3) and... |
def bgra2rgb(img):
'\n cv2.cvtColor(img, cv2.COLOR_BGRA2BGR) has an issue removing the alpha channel,\n this gets rid of wrong transparent colors that can harm training\n '
if (img.shape[2] == 4):
(b, g, r, a) = cv2.split(img.astype(np.uint8))
b = cv2.bitwise_and(b, b, mask=a)
... | 2,376,992,496,783,938,000 | cv2.cvtColor(img, cv2.COLOR_BGRA2BGR) has an issue removing the alpha channel,
this gets rid of wrong transparent colors that can harm training | mmedit/models/inpaintors/vic/common.py | bgra2rgb | f74066357/Image_Inpainting | python | def bgra2rgb(img):
'\n cv2.cvtColor(img, cv2.COLOR_BGRA2BGR) has an issue removing the alpha channel,\n this gets rid of wrong transparent colors that can harm training\n '
if (img.shape[2] == 4):
(b, g, r, a) = cv2.split(img.astype(np.uint8))
b = cv2.bitwise_and(b, b, mask=a)
... |
def rgb2ycbcr(img, only_y=True):
'same as matlab rgb2ycbcr\n only_y: only return Y channel\n Input:\n uint8, [0, 255]\n float, [0, 1]\n '
in_img_type = img.dtype
img_ = img.astype(np.float32)
if (in_img_type != np.uint8):
img_ *= 255.0
if only_y:
rlt = ((np.dot... | -4,436,954,248,337,563,600 | same as matlab rgb2ycbcr
only_y: only return Y channel
Input:
uint8, [0, 255]
float, [0, 1] | mmedit/models/inpaintors/vic/common.py | rgb2ycbcr | f74066357/Image_Inpainting | python | def rgb2ycbcr(img, only_y=True):
'same as matlab rgb2ycbcr\n only_y: only return Y channel\n Input:\n uint8, [0, 255]\n float, [0, 1]\n '
in_img_type = img.dtype
img_ = img.astype(np.float32)
if (in_img_type != np.uint8):
img_ *= 255.0
if only_y:
rlt = ((np.dot... |
def bgr2ycbcr(img, only_y=True, separate=False):
'bgr version of matlab rgb2ycbcr\n Python opencv library (cv2) cv2.COLOR_BGR2YCrCb has\n different parameters with MATLAB color convertion.\n only_y: only return Y channel\n separate: if true, will returng the channels as\n separate images\n Inp... | -7,023,631,035,229,426,000 | bgr version of matlab rgb2ycbcr
Python opencv library (cv2) cv2.COLOR_BGR2YCrCb has
different parameters with MATLAB color convertion.
only_y: only return Y channel
separate: if true, will returng the channels as
separate images
Input:
uint8, [0, 255]
float, [0, 1] | mmedit/models/inpaintors/vic/common.py | bgr2ycbcr | f74066357/Image_Inpainting | python | def bgr2ycbcr(img, only_y=True, separate=False):
'bgr version of matlab rgb2ycbcr\n Python opencv library (cv2) cv2.COLOR_BGR2YCrCb has\n different parameters with MATLAB color convertion.\n only_y: only return Y channel\n separate: if true, will returng the channels as\n separate images\n Inp... |
def ycbcr2rgb(img, only_y=True):
'\n bgr version of matlab ycbcr2rgb\n Python opencv library (cv2) cv2.COLOR_YCrCb2BGR has\n different parameters to MATLAB color convertion.\n\n Input:\n uint8, [0, 255]\n float, [0, 1]\n '
in_img_type = img.dtype
img_ = img.astype(np.float32)
... | -428,444,737,155,177,860 | bgr version of matlab ycbcr2rgb
Python opencv library (cv2) cv2.COLOR_YCrCb2BGR has
different parameters to MATLAB color convertion.
Input:
uint8, [0, 255]
float, [0, 1] | mmedit/models/inpaintors/vic/common.py | ycbcr2rgb | f74066357/Image_Inpainting | python | def ycbcr2rgb(img, only_y=True):
'\n bgr version of matlab ycbcr2rgb\n Python opencv library (cv2) cv2.COLOR_YCrCb2BGR has\n different parameters to MATLAB color convertion.\n\n Input:\n uint8, [0, 255]\n float, [0, 1]\n '
in_img_type = img.dtype
img_ = img.astype(np.float32)
... |
def denorm(x, min_max=((- 1.0), 1.0)):
'\n Denormalize from [-1,1] range to [0,1]\n formula: xi\' = (xi - mu)/sigma\n Example: "out = (x + 1.0) / 2.0" for denorm\n range (-1,1) to (0,1)\n for use with proper act in Generator output (ie. tanh)\n '
out = ((x - min_max[0])... | 5,438,653,087,262,055,000 | Denormalize from [-1,1] range to [0,1]
formula: xi' = (xi - mu)/sigma
Example: "out = (x + 1.0) / 2.0" for denorm
range (-1,1) to (0,1)
for use with proper act in Generator output (ie. tanh) | mmedit/models/inpaintors/vic/common.py | denorm | f74066357/Image_Inpainting | python | def denorm(x, min_max=((- 1.0), 1.0)):
'\n Denormalize from [-1,1] range to [0,1]\n formula: xi\' = (xi - mu)/sigma\n Example: "out = (x + 1.0) / 2.0" for denorm\n range (-1,1) to (0,1)\n for use with proper act in Generator output (ie. tanh)\n '
out = ((x - min_max[0])... |
def np2tensor(img, bgr2rgb=True, data_range=1.0, normalize=False, change_range=True, add_batch=True):
'\n Converts a numpy image array into a Tensor array.\n Parameters:\n img (numpy array): the input image numpy array\n add_batch (bool): choose if new tensor needs batch dimension added\n '
... | -1,375,393,900,745,936,400 | Converts a numpy image array into a Tensor array.
Parameters:
img (numpy array): the input image numpy array
add_batch (bool): choose if new tensor needs batch dimension added | mmedit/models/inpaintors/vic/common.py | np2tensor | f74066357/Image_Inpainting | python | def np2tensor(img, bgr2rgb=True, data_range=1.0, normalize=False, change_range=True, add_batch=True):
'\n Converts a numpy image array into a Tensor array.\n Parameters:\n img (numpy array): the input image numpy array\n add_batch (bool): choose if new tensor needs batch dimension added\n '
... |
def tensor2np(img, rgb2bgr=True, remove_batch=True, data_range=255, denormalize=False, change_range=True, imtype=np.uint8):
'\n Converts a Tensor array into a numpy image array.\n Parameters:\n img (tensor): the input image tensor array\n 4D(B,(3/1),H,W), 3D(C,H,W), or 2D(H,W), any range, RG... | -3,020,553,353,486,757,000 | Converts a Tensor array into a numpy image array.
Parameters:
img (tensor): the input image tensor array
4D(B,(3/1),H,W), 3D(C,H,W), or 2D(H,W), any range, RGB channel order
remove_batch (bool): choose if tensor of shape BCHW needs to be squeezed
denormalize (bool): Used to denormalize from [-1,1] r... | mmedit/models/inpaintors/vic/common.py | tensor2np | f74066357/Image_Inpainting | python | def tensor2np(img, rgb2bgr=True, remove_batch=True, data_range=255, denormalize=False, change_range=True, imtype=np.uint8):
'\n Converts a Tensor array into a numpy image array.\n Parameters:\n img (tensor): the input image tensor array\n 4D(B,(3/1),H,W), 3D(C,H,W), or 2D(H,W), any range, RG... |
def hilo(high, low, close, high_length=None, low_length=None, mamode=None, offset=None, **kwargs):
'Indicator: Gann HiLo (HiLo)'
high = verify_series(high)
low = verify_series(low)
close = verify_series(close)
high_length = (int(high_length) if (high_length and (high_length > 0)) else 13)
low_le... | -493,136,803,108,728,260 | Indicator: Gann HiLo (HiLo) | pandas_ta/overlap/hilo.py | hilo | MyBourse/pandas-ta | python | def hilo(high, low, close, high_length=None, low_length=None, mamode=None, offset=None, **kwargs):
high = verify_series(high)
low = verify_series(low)
close = verify_series(close)
high_length = (int(high_length) if (high_length and (high_length > 0)) else 13)
low_length = (int(low_length) if (l... |
def test_output_data(mp_tmpdir):
'Check GeoTIFF as output data.'
output_params = dict(grid='geodetic', format='GeoTIFF', path=mp_tmpdir, pixelbuffer=0, metatiling=1, bands=1, dtype='int16', delimiters=dict(bounds=Bounds((- 180.0), (- 90.0), 180.0, 90.0), effective_bounds=Bounds((- 180.439453125), (- 90.0), 180.... | -6,277,988,863,151,543,000 | Check GeoTIFF as output data. | test/test_formats_geotiff.py | test_output_data | Scartography/mapchete | python | def test_output_data(mp_tmpdir):
output_params = dict(grid='geodetic', format='GeoTIFF', path=mp_tmpdir, pixelbuffer=0, metatiling=1, bands=1, dtype='int16', delimiters=dict(bounds=Bounds((- 180.0), (- 90.0), 180.0, 90.0), effective_bounds=Bounds((- 180.439453125), (- 90.0), 180.439453125, 90.0), zoom=[5], pro... |
def test_for_web(client, mp_tmpdir):
'Send GTiff via flask.'
tile_base_url = '/wmts_simple/1.0.0/cleantopo_br/default/WGS84/'
for url in ['/']:
response = client.get(url)
assert (response.status_code == 200)
for url in [(tile_base_url + '5/30/62.tif'), (tile_base_url + '5/30/63.tif'), (t... | -5,188,252,424,518,334,000 | Send GTiff via flask. | test/test_formats_geotiff.py | test_for_web | Scartography/mapchete | python | def test_for_web(client, mp_tmpdir):
tile_base_url = '/wmts_simple/1.0.0/cleantopo_br/default/WGS84/'
for url in ['/']:
response = client.get(url)
assert (response.status_code == 200)
for url in [(tile_base_url + '5/30/62.tif'), (tile_base_url + '5/30/63.tif'), (tile_base_url + '5/31/62... |
def test_input_data(mp_tmpdir, cleantopo_br):
'Check GeoTIFF proces output as input data.'
with mapchete.open(cleantopo_br.path) as mp:
tp = BufferedTilePyramid('geodetic')
tile = tp.tile(5, 5, 5)
output_params = dict(grid='geodetic', format='GeoTIFF', path=mp_tmpdir, pixelbuffer=0, meta... | -3,211,887,975,729,637,000 | Check GeoTIFF proces output as input data. | test/test_formats_geotiff.py | test_input_data | Scartography/mapchete | python | def test_input_data(mp_tmpdir, cleantopo_br):
with mapchete.open(cleantopo_br.path) as mp:
tp = BufferedTilePyramid('geodetic')
tile = tp.tile(5, 5, 5)
output_params = dict(grid='geodetic', format='GeoTIFF', path=mp_tmpdir, pixelbuffer=0, metatiling=1, bands=2, dtype='int16', delimiters... |
def test_write_geotiff_tags(mp_tmpdir, cleantopo_br, write_rasterfile_tags_py):
'Pass on metadata tags from user process to rasterio.'
conf = dict(**cleantopo_br.dict)
conf.update(process=write_rasterfile_tags_py)
with mapchete.open(conf) as mp:
for tile in mp.get_process_tiles():
(d... | 5,183,305,310,551,301,000 | Pass on metadata tags from user process to rasterio. | test/test_formats_geotiff.py | test_write_geotiff_tags | Scartography/mapchete | python | def test_write_geotiff_tags(mp_tmpdir, cleantopo_br, write_rasterfile_tags_py):
conf = dict(**cleantopo_br.dict)
conf.update(process=write_rasterfile_tags_py)
with mapchete.open(conf) as mp:
for tile in mp.get_process_tiles():
(data, tags) = mp.execute(tile)
assert data.... |
@pytest.mark.remote
def test_s3_write_output_data(gtiff_s3, s3_example_tile, mp_s3_tmpdir):
'Write and read output.'
with mapchete.open(gtiff_s3.dict) as mp:
process_tile = mp.config.process_pyramid.tile(*s3_example_tile)
assert mp.config.output.profile()
assert mp.config.output.empty(pr... | 3,358,115,100,684,328,000 | Write and read output. | test/test_formats_geotiff.py | test_s3_write_output_data | Scartography/mapchete | python | @pytest.mark.remote
def test_s3_write_output_data(gtiff_s3, s3_example_tile, mp_s3_tmpdir):
with mapchete.open(gtiff_s3.dict) as mp:
process_tile = mp.config.process_pyramid.tile(*s3_example_tile)
assert mp.config.output.profile()
assert mp.config.output.empty(process_tile).mask.all()
... |
def no_translate_debug_logs(logical_line, filename):
"Check for 'LOG.debug(_('\n\n As per our translation policy,\n https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation\n we shouldn't translate debug level logs.\n\n * This check assumes that 'LOG' is a logger.\n * Use filename so we can s... | 3,433,835,137,199,243,000 | Check for 'LOG.debug(_('
As per our translation policy,
https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation
we shouldn't translate debug level logs.
* This check assumes that 'LOG' is a logger.
* Use filename so we can start enforcing this in specific folders instead
of needing to do so all at once.
M... | manila/hacking/checks.py | no_translate_debug_logs | scality/manila | python | def no_translate_debug_logs(logical_line, filename):
"Check for 'LOG.debug(_('\n\n As per our translation policy,\n https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation\n we shouldn't translate debug level logs.\n\n * This check assumes that 'LOG' is a logger.\n * Use filename so we can s... |
def check_explicit_underscore_import(logical_line, filename):
"Check for explicit import of the _ function\n\n We need to ensure that any files that are using the _() function\n to translate logs are explicitly importing the _ function. We\n can't trust unit test to catch whether the import has been\n ... | 7,424,160,099,128,621,000 | Check for explicit import of the _ function
We need to ensure that any files that are using the _() function
to translate logs are explicitly importing the _ function. We
can't trust unit test to catch whether the import has been
added so we need to check for it here. | manila/hacking/checks.py | check_explicit_underscore_import | scality/manila | python | def check_explicit_underscore_import(logical_line, filename):
"Check for explicit import of the _ function\n\n We need to ensure that any files that are using the _() function\n to translate logs are explicitly importing the _ function. We\n can't trust unit test to catch whether the import has been\n ... |
def __init__(self, tree, filename):
'This object is created automatically by pep8.\n\n :param tree: an AST tree\n :param filename: name of the file being analyzed\n (ignored by our checks)\n '
self._tree = tree
self._errors = [] | -3,440,636,442,667,781,600 | This object is created automatically by pep8.
:param tree: an AST tree
:param filename: name of the file being analyzed
(ignored by our checks) | manila/hacking/checks.py | __init__ | scality/manila | python | def __init__(self, tree, filename):
'This object is created automatically by pep8.\n\n :param tree: an AST tree\n :param filename: name of the file being analyzed\n (ignored by our checks)\n '
self._tree = tree
self._errors = [] |
def run(self):
'Called automatically by pep8.'
self.visit(self._tree)
return self._errors | -4,209,563,323,373,041,000 | Called automatically by pep8. | manila/hacking/checks.py | run | scality/manila | python | def run(self):
self.visit(self._tree)
return self._errors |
def add_error(self, node, message=None):
'Add an error caused by a node to the list of errors for pep8.'
message = (message or self.CHECK_DESC)
error = (node.lineno, node.col_offset, message, self.__class__)
self._errors.append(error) | -9,018,306,392,635,961,000 | Add an error caused by a node to the list of errors for pep8. | manila/hacking/checks.py | add_error | scality/manila | python | def add_error(self, node, message=None):
message = (message or self.CHECK_DESC)
error = (node.lineno, node.col_offset, message, self.__class__)
self._errors.append(error) |
def choisir_matelots(self, exception=None):
'Retourne le matelot le plus apte à accomplir la volonté.'
proches = []
matelots = self.navire.equipage.get_matelots_libres(exception)
graph = self.navire.graph
gouvernail = self.navire.gouvernail
if ((gouvernail is None) or (gouvernail.tenu is not Non... | -7,845,727,070,930,788,000 | Retourne le matelot le plus apte à accomplir la volonté. | src/secondaires/navigation/equipage/volontes/tenir_gouvernail.py | choisir_matelots | stormi/tsunami | python | def choisir_matelots(self, exception=None):
proches = []
matelots = self.navire.equipage.get_matelots_libres(exception)
graph = self.navire.graph
gouvernail = self.navire.gouvernail
if ((gouvernail is None) or (gouvernail.tenu is not None)):
return None
for matelot in matelots:
... |
def executer(self, sequence):
'Exécute la volonté.'
if (sequence is None):
self.terminer()
return
(matelot, sorties, gouvernail) = sequence
navire = self.navire
ordres = []
if sorties:
aller = LongDeplacer(matelot, navire, *sorties)
ordres.append(aller)
tenir ... | -8,178,484,088,887,182,000 | Exécute la volonté. | src/secondaires/navigation/equipage/volontes/tenir_gouvernail.py | executer | stormi/tsunami | python | def executer(self, sequence):
if (sequence is None):
self.terminer()
return
(matelot, sorties, gouvernail) = sequence
navire = self.navire
ordres = []
if sorties:
aller = LongDeplacer(matelot, navire, *sorties)
ordres.append(aller)
tenir = OrdreTenirGouvernai... |
def crier_ordres(self, personnage):
"On fait crier l'ordre au personnage."
msg = "{} s'écrie : un homme à la barre !".format(personnage.distinction_audible)
self.navire.envoyer(msg) | 8,899,339,267,492,573,000 | On fait crier l'ordre au personnage. | src/secondaires/navigation/equipage/volontes/tenir_gouvernail.py | crier_ordres | stormi/tsunami | python | def crier_ordres(self, personnage):
msg = "{} s'écrie : un homme à la barre !".format(personnage.distinction_audible)
self.navire.envoyer(msg) |
@classmethod
def extraire_arguments(cls, navire):
'Extrait les arguments de la volonté.'
return () | -4,547,812,160,985,041,000 | Extrait les arguments de la volonté. | src/secondaires/navigation/equipage/volontes/tenir_gouvernail.py | extraire_arguments | stormi/tsunami | python | @classmethod
def extraire_arguments(cls, navire):
return () |
def get_usgs_data(station_id, start_date, end_date, parameter='00060', cache_dir=None):
"Get river discharge data from the USGS REST web service.\n\n See `U.S. Geological Survey Water Services\n <https://waterservices.usgs.gov/>`_ (USGS)\n\n Parameters\n ----------\n station_id : str\n The sta... | 8,764,079,998,482,199,000 | Get river discharge data from the USGS REST web service.
See `U.S. Geological Survey Water Services
<https://waterservices.usgs.gov/>`_ (USGS)
Parameters
----------
station_id : str
The station id to get
start_date : str
String for start date in the format: 'YYYY-MM-dd', e.g. '1980-01-01'
end_date : str
S... | src/ewatercycle/observation/usgs.py | get_usgs_data | cffbots/ewatercycle | python | def get_usgs_data(station_id, start_date, end_date, parameter='00060', cache_dir=None):
"Get river discharge data from the USGS REST web service.\n\n See `U.S. Geological Survey Water Services\n <https://waterservices.usgs.gov/>`_ (USGS)\n\n Parameters\n ----------\n station_id : str\n The sta... |
def create_token(self, body, **kwargs):
'Create token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_token(body, async_req=True)\n >>> result = thread.get()\n\n ... | -8,848,656,419,021,497,000 | Create token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_token(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param V1Token body: Token body (requ... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | create_token | deeplearning2012/polyaxon | python | def create_token(self, body, **kwargs):
'Create token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_token(body, async_req=True)\n >>> result = thread.get()\n\n ... |
def create_token_with_http_info(self, body, **kwargs):
'Create token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_token_with_http_info(body, async_req=True)\n >>> re... | 8,630,615,746,013,322,000 | Create token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_token_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param V1Token body: T... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | create_token_with_http_info | deeplearning2012/polyaxon | python | def create_token_with_http_info(self, body, **kwargs):
'Create token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_token_with_http_info(body, async_req=True)\n >>> re... |
def delete_token(self, uuid, **kwargs):
'Delete token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.delete_token(uuid, async_req=True)\n >>> result = thread.get()\n\n ... | -4,694,829,903,950,469,000 | Delete token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_token(uuid, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str uuid: UUid of the namespac... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | delete_token | deeplearning2012/polyaxon | python | def delete_token(self, uuid, **kwargs):
'Delete token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.delete_token(uuid, async_req=True)\n >>> result = thread.get()\n\n ... |
def delete_token_with_http_info(self, uuid, **kwargs):
'Delete token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.delete_token_with_http_info(uuid, async_req=True)\n >>> re... | 3,539,230,458,003,127,300 | Delete token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_token_with_http_info(uuid, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str uuid: UUid ... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | delete_token_with_http_info | deeplearning2012/polyaxon | python | def delete_token_with_http_info(self, uuid, **kwargs):
'Delete token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.delete_token_with_http_info(uuid, async_req=True)\n >>> re... |
def get_token(self, uuid, **kwargs):
'Get token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_token(uuid, async_req=True)\n >>> result = thread.get()\n\n :param a... | -8,607,238,751,932,570,000 | Get token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_token(uuid, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str uuid: UUid of the namespace (req... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | get_token | deeplearning2012/polyaxon | python | def get_token(self, uuid, **kwargs):
'Get token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_token(uuid, async_req=True)\n >>> result = thread.get()\n\n :param a... |
def get_token_with_http_info(self, uuid, **kwargs):
'Get token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_token_with_http_info(uuid, async_req=True)\n >>> result = th... | -2,203,539,906,283,325,000 | Get token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_token_with_http_info(uuid, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str uuid: UUid of the... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | get_token_with_http_info | deeplearning2012/polyaxon | python | def get_token_with_http_info(self, uuid, **kwargs):
'Get token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_token_with_http_info(uuid, async_req=True)\n >>> result = th... |
def get_user(self, **kwargs):
'Get current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_user(async_req=True)\n >>> result = thread.get()\n\n :param async_re... | -753,648,831,554,459,300 | Get current user # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user(async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param _preload_content: if False, the urll... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | get_user | deeplearning2012/polyaxon | python | def get_user(self, **kwargs):
'Get current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_user(async_req=True)\n >>> result = thread.get()\n\n :param async_re... |
def get_user_with_http_info(self, **kwargs):
'Get current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_user_with_http_info(async_req=True)\n >>> result = thread.ge... | 2,460,918,540,667,456,000 | Get current user # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param _return_http_data_onl... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | get_user_with_http_info | deeplearning2012/polyaxon | python | def get_user_with_http_info(self, **kwargs):
'Get current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.get_user_with_http_info(async_req=True)\n >>> result = thread.ge... |
def list_tokens(self, **kwargs):
'List tokens # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.list_tokens(async_req=True)\n >>> result = thread.get()\n\n :param async_r... | -2,749,900,521,780,329,000 | List tokens # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_tokens(async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param int offset: Pagination offset.
:param ... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | list_tokens | deeplearning2012/polyaxon | python | def list_tokens(self, **kwargs):
'List tokens # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.list_tokens(async_req=True)\n >>> result = thread.get()\n\n :param async_r... |
def list_tokens_with_http_info(self, **kwargs):
'List tokens # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.list_tokens_with_http_info(async_req=True)\n >>> result = thread.g... | 365,656,943,147,210,240 | List tokens # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_tokens_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param int offset: Pagination ... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | list_tokens_with_http_info | deeplearning2012/polyaxon | python | def list_tokens_with_http_info(self, **kwargs):
'List tokens # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.list_tokens_with_http_info(async_req=True)\n >>> result = thread.g... |
def patch_token(self, token_uuid, body, **kwargs):
'Patch token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.patch_token(token_uuid, body, async_req=True)\n >>> result = th... | 9,195,283,307,072,790,000 | Patch token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_token(token_uuid, body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str token_uuid: UUID... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | patch_token | deeplearning2012/polyaxon | python | def patch_token(self, token_uuid, body, **kwargs):
'Patch token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.patch_token(token_uuid, body, async_req=True)\n >>> result = th... |
def patch_token_with_http_info(self, token_uuid, body, **kwargs):
'Patch token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.patch_token_with_http_info(token_uuid, body, async_req=... | 1,879,753,834,479,708,200 | Patch token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_token_with_http_info(token_uuid, body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str t... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | patch_token_with_http_info | deeplearning2012/polyaxon | python | def patch_token_with_http_info(self, token_uuid, body, **kwargs):
'Patch token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.patch_token_with_http_info(token_uuid, body, async_req=... |
def patch_user(self, body, **kwargs):
'Patch current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.patch_user(body, async_req=True)\n >>> result = thread.get()\n\n ... | 6,286,542,450,307,694,000 | Patch current user # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_user(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param V1User body: (required)
:p... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | patch_user | deeplearning2012/polyaxon | python | def patch_user(self, body, **kwargs):
'Patch current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.patch_user(body, async_req=True)\n >>> result = thread.get()\n\n ... |
def patch_user_with_http_info(self, body, **kwargs):
'Patch current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.patch_user_with_http_info(body, async_req=True)\n >>> ... | 8,619,010,782,155,876,000 | Patch current user # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_user_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param V1User body... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | patch_user_with_http_info | deeplearning2012/polyaxon | python | def patch_user_with_http_info(self, body, **kwargs):
'Patch current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.patch_user_with_http_info(body, async_req=True)\n >>> ... |
def update_token(self, token_uuid, body, **kwargs):
'Update token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.update_token(token_uuid, body, async_req=True)\n >>> result =... | 287,668,840,200,222,080 | Update token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_token(token_uuid, body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str token_uuid: UU... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | update_token | deeplearning2012/polyaxon | python | def update_token(self, token_uuid, body, **kwargs):
'Update token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.update_token(token_uuid, body, async_req=True)\n >>> result =... |
def update_token_with_http_info(self, token_uuid, body, **kwargs):
'Update token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.update_token_with_http_info(token_uuid, body, async_r... | 4,044,100,548,066,564,600 | Update token # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_token_with_http_info(token_uuid, body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | update_token_with_http_info | deeplearning2012/polyaxon | python | def update_token_with_http_info(self, token_uuid, body, **kwargs):
'Update token # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.update_token_with_http_info(token_uuid, body, async_r... |
def update_user(self, body, **kwargs):
'Update current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.update_user(body, async_req=True)\n >>> result = thread.get()\n\n ... | 7,695,697,686,336,718,000 | Update current user # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_user(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param V1User body: (required)
... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | update_user | deeplearning2012/polyaxon | python | def update_user(self, body, **kwargs):
'Update current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.update_user(body, async_req=True)\n >>> result = thread.get()\n\n ... |
def update_user_with_http_info(self, body, **kwargs):
'Update current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.update_user_with_http_info(body, async_req=True)\n >... | -1,182,087,638,114,787,600 | Update current user # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_user_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param V1User bo... | sdks/python/http_client/v1/polyaxon_sdk/api/users_v1_api.py | update_user_with_http_info | deeplearning2012/polyaxon | python | def update_user_with_http_info(self, body, **kwargs):
'Update current user # noqa: E501\n\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.update_user_with_http_info(body, async_req=True)\n >... |
@commands.command()
@ext.long_help('A fun command to generate a wheres waldo effect in discord, see if you can find him first!Optionally takes a size parameter to make it easier or harder')
@ext.short_help('Can you find him?')
@ext.example(('waldo', 'waldo 10'))
async def waldo(self, ctx, size=MAX_WALDO_GRID_SIZE):
... | -2,751,101,128,740,316,000 | Play Where's Waldo!
Usage: <prefix>waldo [size = 100] | bot/cogs/memes_cog/memes_cog.py | waldo | Cavesprout/ClemBot | python | @commands.command()
@ext.long_help('A fun command to generate a wheres waldo effect in discord, see if you can find him first!Optionally takes a size parameter to make it easier or harder')
@ext.short_help('Can you find him?')
@ext.example(('waldo', 'waldo 10'))
async def waldo(self, ctx, size=MAX_WALDO_GRID_SIZE):
... |
@ext.command()
@ext.chainable()
@ext.long_help('A fun command to spongebob meme text in discord')
@ext.short_help('sO yOu doNt KnOw wHat tHiS Is?')
@ext.example('spongebob hello world')
async def spongebob(self, ctx, *, args):
'\n Spongebob Text\n '
random.seed(time.time())
args = args.replace... | -1,629,035,964,380,109,600 | Spongebob Text | bot/cogs/memes_cog/memes_cog.py | spongebob | Cavesprout/ClemBot | python | @ext.command()
@ext.chainable()
@ext.long_help('A fun command to spongebob meme text in discord')
@ext.short_help('sO yOu doNt KnOw wHat tHiS Is?')
@ext.example('spongebob hello world')
async def spongebob(self, ctx, *, args):
'\n \n '
random.seed(time.time())
args = args.replace('"', "'")
... |
@ext.command(aliases=['rave', '🦀'])
@commands.cooldown(1, CRAB_COMMAND_COOLDOWN, commands.BucketType.guild)
@ext.long_help('A fun command to generate a crab rave gif with specified text overlay')
@ext.short_help('Generates a crab rave gif')
@ext.chainable_input()
@ext.example('crab hello from crab world')
async def cr... | 3,072,281,457,158,416,000 | Create your own crab rave.
Usage: <prefix>crab [is_rave=True] [text=Bottom text\n is dead]
Aliases: rave, 🦀 | bot/cogs/memes_cog/memes_cog.py | crab | Cavesprout/ClemBot | python | @ext.command(aliases=['rave', '🦀'])
@commands.cooldown(1, CRAB_COMMAND_COOLDOWN, commands.BucketType.guild)
@ext.long_help('A fun command to generate a crab rave gif with specified text overlay')
@ext.short_help('Generates a crab rave gif')
@ext.chainable_input()
@ext.example('crab hello from crab world')
async def cr... |
@ext.command(hidden=True, aliases=['ctray', 'trayforjay'])
async def cookouttray(self, ctx, input):
'\n For those who do finances with cookout trays, we proudly present the command for you\n Simply type one of the following:\n cookouttray\n ctray\n tray... | -5,427,305,081,996,591,000 | For those who do finances with cookout trays, we proudly present the command for you
Simply type one of the following:
cookouttray
ctray
trayforjay
Followed by a monetary value such as (leave off the dollar sign):
20
100
3.14
To have it converted into cookou... | bot/cogs/memes_cog/memes_cog.py | cookouttray | Cavesprout/ClemBot | python | @ext.command(hidden=True, aliases=['ctray', 'trayforjay'])
async def cookouttray(self, ctx, input):
'\n For those who do finances with cookout trays, we proudly present the command for you\n Simply type one of the following:\n cookouttray\n ctray\n tray... |
def _invalid_headers(self, url, headers):
'\n Verify whether the provided metadata in the URL is also present in the headers\n :param url: .../file.txt&content-type=app%2Fjson&Signature=..\n :param headers: Content-Type=app/json\n :return: True or False\n '
metadata_to_check =... | 350,650,712,124,656,700 | Verify whether the provided metadata in the URL is also present in the headers
:param url: .../file.txt&content-type=app%2Fjson&Signature=..
:param headers: Content-Type=app/json
:return: True or False | moto/s3/responses.py | _invalid_headers | nom3ad/moto | python | def _invalid_headers(self, url, headers):
'\n Verify whether the provided metadata in the URL is also present in the headers\n :param url: .../file.txt&content-type=app%2Fjson&Signature=..\n :param headers: Content-Type=app/json\n :return: True or False\n '
metadata_to_check =... |
def syncify(*types):
"\n Converts all the methods in the given types (class definitions)\n into synchronous, which return either the coroutine or the result\n based on whether ``asyncio's`` event loop is running.\n "
for t in types:
for name in dir(t):
if ((not name.startswith('_... | 6,797,930,550,718,388,000 | Converts all the methods in the given types (class definitions)
into synchronous, which return either the coroutine or the result
based on whether ``asyncio's`` event loop is running. | telethon/sync.py | syncify | SlavikMIPT/Telethon | python | def syncify(*types):
"\n Converts all the methods in the given types (class definitions)\n into synchronous, which return either the coroutine or the result\n based on whether ``asyncio's`` event loop is running.\n "
for t in types:
for name in dir(t):
if ((not name.startswith('_... |
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
'Support two kind of enties - MiCloud and Gateway.'
if ('servers' in entry.data):
return (await _setup_micloud_entry(hass, entry))
if entry.data:
hass.config_entries.async_update_entry(entry, data={}, options=entry.data)
... | -7,320,851,031,940,415,000 | Support two kind of enties - MiCloud and Gateway. | custom_components/xiaomi_gateway3/__init__.py | async_setup_entry | Gamma-Software/HomeAssistantConfig | python | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
if ('servers' in entry.data):
return (await _setup_micloud_entry(hass, entry))
if entry.data:
hass.config_entries.async_update_entry(entry, data={}, options=entry.data)
(await _setup_logger(hass))
if (not entry.up... |
async def _handle_device_remove(hass: HomeAssistant):
'Remove device from Hass and Mi Home if the device is renamed to\n `delete`.\n '
async def device_registry_updated(event: Event):
if (event.data['action'] != 'update'):
return
registry = hass.data['device_registry']
... | -369,399,004,895,719,400 | Remove device from Hass and Mi Home if the device is renamed to
`delete`. | custom_components/xiaomi_gateway3/__init__.py | _handle_device_remove | Gamma-Software/HomeAssistantConfig | python | async def _handle_device_remove(hass: HomeAssistant):
'Remove device from Hass and Mi Home if the device is renamed to\n `delete`.\n '
async def device_registry_updated(event: Event):
if (event.data['action'] != 'update'):
return
registry = hass.data['device_registry']
... |
async def shutdown_client(app: Application):
'\n Attempt to close the async HTTP client session.\n\n :param app: The application object\n '
logger.info('Stopping HTTP client')
try:
(await app['client'].close())
except KeyError:
pass | -6,666,553,373,865,942,000 | Attempt to close the async HTTP client session.
:param app: The application object | virtool/shutdown.py | shutdown_client | KingBain/virtool | python | async def shutdown_client(app: Application):
'\n Attempt to close the async HTTP client session.\n\n :param app: The application object\n '
logger.info('Stopping HTTP client')
try:
(await app['client'].close())
except KeyError:
pass |
async def shutdown_dispatcher(app: Application):
"\n Attempt to close the app's `Dispatcher` object.\n\n :param app: The application object\n "
logger.info('Stopping dispatcher')
try:
(await app['dispatcher'].close())
except KeyError:
pass | 1,539,764,078,448,729,900 | Attempt to close the app's `Dispatcher` object.
:param app: The application object | virtool/shutdown.py | shutdown_dispatcher | KingBain/virtool | python | async def shutdown_dispatcher(app: Application):
"\n Attempt to close the app's `Dispatcher` object.\n\n :param app: The application object\n "
logger.info('Stopping dispatcher')
try:
(await app['dispatcher'].close())
except KeyError:
pass |
async def shutdown_executors(app: Application):
'\n Attempt to close the `ThreadPoolExecutor` and `ProcessPoolExecutor`.\n\n :param app: the application object\n '
try:
app['executor'].shutdown(wait=True)
except KeyError:
pass
try:
app['process_executor'].shutdown(wait=T... | 8,947,247,468,802,912,000 | Attempt to close the `ThreadPoolExecutor` and `ProcessPoolExecutor`.
:param app: the application object | virtool/shutdown.py | shutdown_executors | KingBain/virtool | python | async def shutdown_executors(app: Application):
'\n Attempt to close the `ThreadPoolExecutor` and `ProcessPoolExecutor`.\n\n :param app: the application object\n '
try:
app['executor'].shutdown(wait=True)
except KeyError:
pass
try:
app['process_executor'].shutdown(wait=T... |
async def shutdown_scheduler(app: Application):
"\n Attempt to the close the app's `aiojobs` scheduler.\n\n :param app: The application object\n "
scheduler = get_scheduler_from_app(app)
(await scheduler.close()) | -6,032,335,249,375,110,000 | Attempt to the close the app's `aiojobs` scheduler.
:param app: The application object | virtool/shutdown.py | shutdown_scheduler | KingBain/virtool | python | async def shutdown_scheduler(app: Application):
"\n Attempt to the close the app's `aiojobs` scheduler.\n\n :param app: The application object\n "
scheduler = get_scheduler_from_app(app)
(await scheduler.close()) |
async def shutdown_redis(app: Application):
"\n Attempt to close the app's `redis` instance.\n\n :param app: The application object\n "
logger.info('Closing Redis connection')
try:
app['redis'].close()
(await app['redis'].wait_closed())
except KeyError:
pass | -5,224,621,293,652,626,000 | Attempt to close the app's `redis` instance.
:param app: The application object | virtool/shutdown.py | shutdown_redis | KingBain/virtool | python | async def shutdown_redis(app: Application):
"\n Attempt to close the app's `redis` instance.\n\n :param app: The application object\n "
logger.info('Closing Redis connection')
try:
app['redis'].close()
(await app['redis'].wait_closed())
except KeyError:
pass |
async def drop_fake_postgres(app: Application):
'\n Drop a fake PostgreSQL database if the instance was run with the ``--fake`` option.\n\n :param app: the application object\n\n '
if (app['config'].fake and ('fake_' in app['config'].postgres_connection_string)):
async with app['pg'].begin() as... | -5,690,571,300,743,319,000 | Drop a fake PostgreSQL database if the instance was run with the ``--fake`` option.
:param app: the application object | virtool/shutdown.py | drop_fake_postgres | KingBain/virtool | python | async def drop_fake_postgres(app: Application):
'\n Drop a fake PostgreSQL database if the instance was run with the ``--fake`` option.\n\n :param app: the application object\n\n '
if (app['config'].fake and ('fake_' in app['config'].postgres_connection_string)):
async with app['pg'].begin() as... |
@image_comparison(baseline_images=['test_plot'], extensions=['png'])
def test_plot():
'\n Test the rasters plot as multiples subplots.\n '
rasters = ['data/relatives/forest_111.tif', 'data/relatives/forest_112.tif', 'data/relatives/forest_113.tif', 'data/relatives/forest_121.tif', 'data/relatives/forest_1... | -8,635,016,727,795,173,000 | Test the rasters plot as multiples subplots. | tests/test_plots.py | test_plot | rochamatcomp/python-rocha | python | @image_comparison(baseline_images=['test_plot'], extensions=['png'])
def test_plot():
'\n \n '
rasters = ['data/relatives/forest_111.tif', 'data/relatives/forest_112.tif', 'data/relatives/forest_113.tif', 'data/relatives/forest_121.tif', 'data/relatives/forest_122.tif', 'data/relatives/forest_123.tif', 'd... |
def convert_custom_objects(obj):
'Handles custom object lookup.\n\n Arguments:\n obj: object, dict, or list.\n\n Returns:\n The same structure, where occurrences\n of a custom object name have been replaced\n with the custom object.\n '
if... | 6,778,651,313,674,850,000 | Handles custom object lookup.
Arguments:
obj: object, dict, or list.
Returns:
The same structure, where occurrences
of a custom object name have been replaced
with the custom object. | horovod/spark/keras/tensorflow.py | convert_custom_objects | HCYXAS/horovod | python | def convert_custom_objects(obj):
'Handles custom object lookup.\n\n Arguments:\n obj: object, dict, or list.\n\n Returns:\n The same structure, where occurrences\n of a custom object name have been replaced\n with the custom object.\n '
if... |
def run(datasets, splice_sites, sub_models, save, vis, iter, metrics, summary, config, num_folds, bal, imbal, imbal_t, imbal_f, batch_size, epochs):
"\n Parameters\n ----------\n dataset: a string {nn269, ce, hs3d} indicating which dataset to use\n splice_site_type: a string {acceptor, donor} indicating... | 5,203,899,123,250,973,000 | Parameters
----------
dataset: a string {nn269, ce, hs3d} indicating which dataset to use
splice_site_type: a string {acceptor, donor} indicating which splice
site to train on
model_architecture: a string {cnn, dnn, rnn} indicating which model
architecture to use for training
save_model: boolean, whether to sav... | sub_models.py | run | tmartin2/EnsembleSplice-Inactive | python | def run(datasets, splice_sites, sub_models, save, vis, iter, metrics, summary, config, num_folds, bal, imbal, imbal_t, imbal_f, batch_size, epochs):
"\n Parameters\n ----------\n dataset: a string {nn269, ce, hs3d} indicating which dataset to use\n splice_site_type: a string {acceptor, donor} indicating... |
@check_type(dict)
def get_note_text(note):
'Parses note content from different note types.\n\n :param dict: an ArchivesSpace note.\n\n :returns: a list containing note content.\n :rtype: list\n '
def parse_subnote(subnote):
'Parses note content from subnotes.\n\n :param dict: an Arch... | 9,174,333,711,460,146,000 | Parses note content from different note types.
:param dict: an ArchivesSpace note.
:returns: a list containing note content.
:rtype: list | rac_aspace/data_helpers.py | get_note_text | RockefellerArchiveCenter/rac_aspace | python | @check_type(dict)
def get_note_text(note):
'Parses note content from different note types.\n\n :param dict: an ArchivesSpace note.\n\n :returns: a list containing note content.\n :rtype: list\n '
def parse_subnote(subnote):
'Parses note content from subnotes.\n\n :param dict: an Arch... |
@check_type(dict)
def text_in_note(note, query_string):
'Performs fuzzy searching against note text.\n\n :param dict note: an ArchivesSpace note.\n :param str query_string: a string to match against.\n\n :returns: True if a match is found for `query_string`, False if no match is\n found.\n :r... | -4,301,119,841,621,400,000 | Performs fuzzy searching against note text.
:param dict note: an ArchivesSpace note.
:param str query_string: a string to match against.
:returns: True if a match is found for `query_string`, False if no match is
found.
:rtype: bool | rac_aspace/data_helpers.py | text_in_note | RockefellerArchiveCenter/rac_aspace | python | @check_type(dict)
def text_in_note(note, query_string):
'Performs fuzzy searching against note text.\n\n :param dict note: an ArchivesSpace note.\n :param str query_string: a string to match against.\n\n :returns: True if a match is found for `query_string`, False if no match is\n found.\n :r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.