text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> return {k: map_fn(v) for k, v in seq_to_file.items()}
def get_png_file_to_advance_mapper(lineheight):
def map_fn(filename):
wid, ht = PNG(filename).get_size()
return int(round(float(lineheight) * wid / ht))
return map_fn
def cp_name(cp):
"""return uniXXXX or uXXXXX(X) as a name for the... | code_fim | hard | {
"lang": "python",
"repo": "googlefonts/noto-emoji",
"path": "/add_glyphs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Roiki11/simple_message_py path: /scripts/state_server_test.py
#!/usr/bin/env python
# Copyright (c) 2016, G.A. vd. Hoorn
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License a... | code_fim | hard | {
"lang": "python",
"repo": "Roiki11/simple_message_py",
"path": "/scripts/state_server_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
feedbackfactory = fb.feedbackfactory()
factory = protocol.SimpleMessageFactory(disable_nagle=True)
state_ep.listen(factory)
feedback.listen(feedbackfactory)
print("listening..")
reactor.run()
if __name__ == "__main__":
main()<|fim_prefix|># repo: Roiki11/simple_message_py p... | code_fim | hard | {
"lang": "python",
"repo": "Roiki11/simple_message_py",
"path": "/scripts/state_server_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Simple Message client instance for this endpoint
client = SimpleMessageServer()
feedbackfactory = fb.feedbackfactory()
factory = protocol.SimpleMessageFactory(disable_nagle=True)
state_ep.listen(factory)
feedback.listen(feedbackfactory)
print("listening..")
reactor.run(... | code_fim | hard | {
"lang": "python",
"repo": "Roiki11/simple_message_py",
"path": "/scripts/state_server_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: niran/armstrong.core.arm_content path: /armstrong/core/arm_content/templatetags/content_helpers.py
from django import template
from armstrong.core.arm_content.images.sorl import get_preset_thumbnail
<|fim_suffix|>@register.filter
def thumbnail(value, arg):
return get_preset_thumbnail(value, ... | code_fim | easy | {
"lang": "python",
"repo": "niran/armstrong.core.arm_content",
"path": "/armstrong/core/arm_content/templatetags/content_helpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@register.filter
def thumbnail(value, arg):
return get_preset_thumbnail(value, arg).url<|fim_prefix|># repo: niran/armstrong.core.arm_content path: /armstrong/core/arm_content/templatetags/content_helpers.py
from django import template
from armstrong.core.arm_content.images.sorl import get_preset_th... | code_fim | easy | {
"lang": "python",
"repo": "niran/armstrong.core.arm_content",
"path": "/armstrong/core/arm_content/templatetags/content_helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Convert given datetime strings into actual objects, adding timezones to keep rethinkdb happy
date_start = datetime.datetime.strptime(jam_obj["date_start"], "%Y-%m-%d %H:%M")
date_start = date_start.replace(tzinfo=datetime.timezone.utc)
date_end = datetime.datetime.strpti... | code_fim | medium | {
"lang": "python",
"repo": "landizz/site",
"path": "/pysite/views/staff/jams/edit_basics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: landizz/site path: /pysite/views/staff/jams/edit_basics.py
import datetime
from flask import redirect, request, url_for
from werkzeug.exceptions import BadRequest, NotFound
from pysite.base_route import RouteView
from pysite.constants import ALL_STAFF_ROLES
from pysite.decorators import csrf, r... | code_fim | hard | {
"lang": "python",
"repo": "landizz/site",
"path": "/pysite/views/staff/jams/edit_basics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for key in REQUIRED_KEYS:
arg = request.form.get(key)
if not arg:
return BadRequest()
jam_obj[key] = arg
# Convert given datetime strings into actual objects, adding timezones to keep rethinkdb happy
date_start = datetime.datet... | code_fim | medium | {
"lang": "python",
"repo": "landizz/site",
"path": "/pysite/views/staff/jams/edit_basics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> synset_mapping_filename: Union[Path, str]
) -> Tuple[List[str], Dict[str, str]]:
"""Parses the synset mapping file.
Args:
synset_mapping_filename: a path to the synset mapping file.
Returns:
A tuple containing a list of synsets and a dict from synset to its name.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "daniilgaltsev/ImageNet-Training",
"path": "/imagenet_training/data/imagenet/download_urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daniilgaltsev/ImageNet-Training path: /imagenet_training/data/imagenet/download_urls.py
"""Module containing function to download image urls."""
import asyncio
import json
import os
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
import aiohttp
GET_SYNSET_... | code_fim | hard | {
"lang": "python",
"repo": "daniilgaltsev/ImageNet-Training",
"path": "/imagenet_training/data/imagenet/download_urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _unshare_linked_tree(self, directory, force_file_removal=False):
"""
will have the share remove itself
"""
logging.debug("Started traversing %s\'s tree from bottom up for un-sharing" % self.directory)
for root, subdirectories, files in os.walk(directory, top... | code_fim | hard | {
"lang": "python",
"repo": "cormite/network-filesystem-shares",
"path": "/src/nfs4_share/share.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
locks down the share for changing anything other than the access
"""
logging.debug("Locking %s (and subdirectories)" % self.directory)
LOCK_ACL.append(target=self.directory)
for subdirectory in self._subdirectories():
LOCK_ACL.append(target=s... | code_fim | hard | {
"lang": "python",
"repo": "cormite/network-filesystem-shares",
"path": "/src/nfs4_share/share.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cormite/network-filesystem-shares path: /src/nfs4_share/share.py
import logging
import os
import sys
from . acl import AccessControlList, AccessControlEntity
class Share:
"""
Share object that is represented by a directory on the filesystem.
Non-python Dependencies
-----------... | code_fim | hard | {
"lang": "python",
"repo": "cormite/network-filesystem-shares",
"path": "/src/nfs4_share/share.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name='Commitment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
... | code_fim | hard | {
"lang": "python",
"repo": "lfalvarez/proposals-core",
"path": "/dj_proposals_candidates/migrations/0001_initial.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>bose_name='modified')),
('name', models.CharField(max_length=255)),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
('description', models.TextField()),
('remote_id', models.IntegerField()),
('is... | code_fim | hard | {
"lang": "python",
"repo": "lfalvarez/proposals-core",
"path": "/dj_proposals_candidates/migrations/0001_initial.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lfalvarez/proposals-core path: /dj_proposals_candidates/migrations/0001_initial.py
# Generated by Django 3.1.6 on 2021-04-15 22:53
import autoslug.fields
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migra... | code_fim | hard | {
"lang": "python",
"repo": "lfalvarez/proposals-core",
"path": "/dj_proposals_candidates/migrations/0001_initial.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> wavFilePath = extractWavAudio.extract_wav_fromFile(filePath, fileName)
# spliting the audio file in to multiple audio
AudioSplit.split(wavFilePath, captionTitle)
# initiate the subtitle file path
vtt = WebVTT()
# initiate slite wav file
num_files = len(os.listdir('../Datas/S... | code_fim | hard | {
"lang": "python",
"repo": "Thinupavi/Research",
"path": "/subtitleGenarator1/scripts/runner_vtt_from_local_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Thinupavi/Research path: /subtitleGenarator1/scripts/runner_vtt_from_local_file.py
import os
import time
from webvtt import WebVTT, Caption
from scripts.audio2text_cog import Microsoft_ASR
from scripts.translate import TRANSLATR_TO_TEXT
from scripts.extractCaption import Extract_Caption
import ... | code_fim | hard | {
"lang": "python",
"repo": "Thinupavi/Research",
"path": "/subtitleGenarator1/scripts/runner_vtt_from_local_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SurenNihalani/merou path: /grouper/ctl/user_proxy.py
from __future__ import print_function
import BaseHTTPServer
import getpass
import logging
import urllib2
from mrproxy import UserProxyHandler
# Workaround for https://github.com/gmjosack/mrproxy/issues/2
class ProxyHandler(UserProxyHandler)... | code_fim | hard | {
"lang": "python",
"repo": "SurenNihalani/merou",
"path": "/grouper/ctl/user_proxy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> server = build_user_proxy_server(
args.username, args.backend_port, args.listen_host, args.listen_port
)
try:
logging.info(
"Starting user_proxy on host (%s) and port (%s) with user (%s)",
args.listen_host,
args.listen_port,
usern... | code_fim | hard | {
"lang": "python",
"repo": "SurenNihalani/merou",
"path": "/grouper/ctl/user_proxy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MSylvia/snipt path: /blogs/views.py
from django.shortcuts import get_object_or_404, render_to_response
from annoying.functions import get_object_or_None
from django.template import RequestContext
from snipts.models import Snipt
import datetime
THEME_CHOICES = {
'D': 'blogs/themes/default/'... | code_fim | hard | {
"lang": "python",
"repo": "MSylvia/snipt",
"path": "/blogs/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if snipt.user != request.user:
snipt.views = snipt.views + 1
snipt.save()
context = {
'blog_user': request.blog_user,
'custom_css': custom_css,
'detail': True,
'has_snipts': True,
'header': header,
'normal_snipts': normal_snipts,
... | code_fim | hard | {
"lang": "python",
"repo": "MSylvia/snipt",
"path": "/blogs/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> normal_snipts = Snipt.objects.filter(blog_post=False, user=request.blog_user, public=True).order_by('-created')
normal_snipts = normal_snipts.exclude(title__in=[''])
normal_snipts = normal_snipts.exclude(tags__name__in=['tmp'])
normal_snipts = normal_snipts[:3]
if snipt.user != reques... | code_fim | hard | {
"lang": "python",
"repo": "MSylvia/snipt",
"path": "/blogs/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rust-lang/rust-enhanced path: /tests/test_phantom_style.py
"""Tests for `rust_phantom_style` settings."""
from rust_test_common import *
class TestPhantomStyle(TestBase):
def test_style_none(self):
self._override_setting('rust_phantom_style', 'none')
self._with_open_file('... | code_fim | hard | {
"lang": "python",
"repo": "rust-lang/rust-enhanced",
"path": "/tests/test_phantom_style.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_style_popup(self):
self._override_setting('rust_phantom_style', 'popup')
self._with_open_file('tests/error-tests/tests/cast-to-unsized-trait-object-suggestion.rs',
self._test_style_popup)
def _test_style_popup(self, view):
with UiIntercept(passthrough=... | code_fim | hard | {
"lang": "python",
"repo": "rust-lang/rust-enhanced",
"path": "/tests/test_phantom_style.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:type K: int
:type N: int
:rtype: int
"""
dp = [[0] * (K + 1) for i in range(N + 1)]
for m in range(1, N + 1):
for k in range(1, K + 1):
dp[m][k] = dp[m - 1][k - 1] + dp[m - 1][k] + 1
if dp[m][K] >= N:
... | code_fim | medium | {
"lang": "python",
"repo": "danyfang/SourceCode",
"path": "/py/leetcode/EggDrop.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danyfang/SourceCode path: /py/leetcode/EggDrop.py
'''
Leetcode problem No 891 Super Egg Drop
Solution written by Xuqiang Fang on 12 Aug, 2018
'''
<|fim_suffix|>def main():
s = Solution()
print(s.superEggDrop(3, 6))
print(s.superEggDrop(3, 14))
if __name__ == '__main__':
main()<|... | code_fim | hard | {
"lang": "python",
"repo": "danyfang/SourceCode",
"path": "/py/leetcode/EggDrop.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = Solution()
print(s.superEggDrop(3, 6))
print(s.superEggDrop(3, 14))
if __name__ == '__main__':
main()<|fim_prefix|># repo: danyfang/SourceCode path: /py/leetcode/EggDrop.py
'''
Leetcode problem No 891 Super Egg Drop
Solution written by Xuqiang Fang on 12 Aug, 2018
'''
<|fim_middle|>... | code_fim | hard | {
"lang": "python",
"repo": "danyfang/SourceCode",
"path": "/py/leetcode/EggDrop.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def reset_strength(self):
self.strength = 1
def move_right(self):
self.center_x += 10
def set_attack(self):
if self.health > 0:
self.counter = 0
self.mode = 1
else:
self.set_dead
def set_defend(self):
if self.h... | code_fim | hard | {
"lang": "python",
"repo": "kosorio2/programmingFinal",
"path": "/Cardsgame/cards/data/player.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kosorio2/programmingFinal path: /Cardsgame/cards/data/player.py
from cards.data.character import Character
import arcade
import random
class Player(Character):
def __init__(self, file, size):
super().__init__(file, size)
self.health = 100
self.strength = 1
w... | code_fim | hard | {
"lang": "python",
"repo": "kosorio2/programmingFinal",
"path": "/Cardsgame/cards/data/player.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_strength(self):
return self.strength
def reset_strength(self):
self.strength = 1
def move_right(self):
self.center_x += 10
def set_attack(self):
if self.health > 0:
self.counter = 0
self.mode = 1
else:
... | code_fim | hard | {
"lang": "python",
"repo": "kosorio2/programmingFinal",
"path": "/Cardsgame/cards/data/player.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matnad/cif-esports-trophy path: /tests/cif-governance/test_set_base_uri.py
import brownie
SET_BASE_URI = 7
def test_set_base_uri(gov, cif, deployer, accounts):
cif.transferOwnership(gov, {'from': deployer})
assert cif.baseURI() == ""
new_base_uri = "http://example.com/cif/"
tx... | code_fim | medium | {
"lang": "python",
"repo": "matnad/cif-esports-trophy",
"path": "/tests/cif-governance/test_set_base_uri.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tx_info = gov.transactions(1)
assert tx_info[0] == SET_BASE_URI
assert not tx_info[1] # executed
assert gov.stringPayloads(1) == new_base_uri
# Check Can't Execute
tx_fail = gov.executeTransaction(1, {'from': accounts[0]})
assert "Executed" not in tx_fail.events
assert no... | code_fim | hard | {
"lang": "python",
"repo": "matnad/cif-esports-trophy",
"path": "/tests/cif-governance/test_set_base_uri.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: renatodev95/Python path: /aprendizado/curso_em_video/desafios/desafio048.py
soma = 0
n = 0
for c in range(1, 501, 2):
if c % 3 == 0:
soma += c
n += 1
pr<|fim_suffix|>ão MÚLTIPLOS DE TRÊS é igual a: {}'.format(n, soma))<|fim_middle|>int('A SOMA entre todos os {} NÚMEROS Í... | code_fim | easy | {
"lang": "python",
"repo": "renatodev95/Python",
"path": "/aprendizado/curso_em_video/desafios/desafio048.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>int('A SOMA entre todos os {} NÚMEROS ÍMPARES que são MÚLTIPLOS DE TRÊS é igual a: {}'.format(n, soma))<|fim_prefix|># repo: renatodev95/Python path: /aprendizado/curso_em_video/desafios/desafio048.py
soma = 0
n = 0
for c in range(1, 501, 2):
if<|fim_middle|> c % 3 == 0:
soma += c
... | code_fim | easy | {
"lang": "python",
"repo": "renatodev95/Python",
"path": "/aprendizado/curso_em_video/desafios/desafio048.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
A DynamoDB Server Host.
"""
class Meta:
table_name = settings.value.DYNAMODB_TABLE_HOSTS
if settings.value.APPLICATION_ENV == 'development':
host = settings.value.DYNAMODB_URL
session_cls = CustomPynamoSession
service = UnicodeAttribute(hash_ke... | code_fim | hard | {
"lang": "python",
"repo": "chiragchamoli/discovery",
"path": "/app/models/host.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chiragchamoli/discovery path: /app/models/host.py
from .. import settings
from botocore.vendored import requests
from botocore.vendored.requests import adapters
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute, NumberAttribute, UTCDateTimeAttribute, JSONAttribute... | code_fim | hard | {
"lang": "python",
"repo": "chiragchamoli/discovery",
"path": "/app/models/host.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ysc3839/vcmp-python-demo path: /vcmp/stream.py
from typing import AnyStr
from io import BytesIO
from struct import Struct
struct_int32 = Struct('<i')
struct_float = Struct('<f')
struct_uint16_be = Struct('>H')
class Stream(BytesIO):
def write_byte(self, b: int) -> None:
self.write(b... | code_fim | hard | {
"lang": "python",
"repo": "ysc3839/vcmp-python-demo",
"path": "/vcmp/stream.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def read_float(self) -> float:
return struct_float.unpack(self.read(struct_float.size))[0]
def read_string(self, to_str=True, encoding='utf-8') -> AnyStr:
length = struct_uint16_be.unpack(self.read(struct_uint16_be.size))[0]
s = self.read(length)
if to_str:
... | code_fim | hard | {
"lang": "python",
"repo": "ysc3839/vcmp-python-demo",
"path": "/vcmp/stream.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return struct_float.unpack(self.read(struct_float.size))[0]
def read_string(self, to_str=True, encoding='utf-8') -> AnyStr:
length = struct_uint16_be.unpack(self.read(struct_uint16_be.size))[0]
s = self.read(length)
if to_str:
s = s.decode(encoding)
... | code_fim | hard | {
"lang": "python",
"repo": "ysc3839/vcmp-python-demo",
"path": "/vcmp/stream.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test creating instances of the database and database sessions."""
db = DB(connect_url=TEST_URL, web_app=web_app, echo=web_app)
db.init()
with db.session() as session:
archive = Archive(archive_id='0000', name='test')
session.add(archive)
with pytest.raises(IntegrityE... | code_fim | hard | {
"lang": "python",
"repo": "Sandy4321/histore",
"path": "/tests/archive/manager/test_database_connection.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sandy4321/histore path: /tests/archive/manager/test_database_connection.py
# This file is part of the History Store (histore).
#
# Copyright (C) 2018-2021 New York University.
#
# The History Store (histore) is released under the Revised BSD License. See
# file LICENSE for full license details.
... | code_fim | medium | {
"lang": "python",
"repo": "Sandy4321/histore",
"path": "/tests/archive/manager/test_database_connection.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janushendersonassetallocation/loman path: /loman/__init__.py
from loman.computeengine import (
Computation, Comput<|fim_suffix|>rom loman.consts import States
import loman.util as util<|fim_middle|>ationFactory, MapException, LoopDetectedException, NonExistentNodeException,
node, C, inpu... | code_fim | medium | {
"lang": "python",
"repo": "janushendersonassetallocation/loman",
"path": "/loman/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>stentNodeException,
node, C, input_node, calc_node)
from loman.consts import States
import loman.util as util<|fim_prefix|># repo: janushendersonassetallocation/loman path: /loman/__init__.py
from loman.computeengine import (
Computation, Comput<|fim_middle|>ationFactory, MapException, LoopDetec... | code_fim | easy | {
"lang": "python",
"repo": "janushendersonassetallocation/loman",
"path": "/loman/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>_GETALERTEVENTNOTRECOVERLISTRESPONSE = _descriptor.Descriptor(
name='GetAlertEventNotRecoverListResponse',
full_name='alert_event.GetAlertEventNotRecoverListResponse',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='page', full_name='... | code_fim | hard | {
"lang": "python",
"repo": "easyopsapis/easyops-api-python",
"path": "/alert_service_sdk/api/alert_event/get_alert_event_not_recover_list_pb2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: easyopsapis/easyops-api-python path: /alert_service_sdk/api/alert_event/get_alert_event_not_recover_list_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: get_alert_event_not_recover_list.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x)... | code_fim | hard | {
"lang": "python",
"repo": "easyopsapis/easyops-api-python",
"path": "/alert_service_sdk/api/alert_event/get_alert_event_not_recover_list_pb2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>_GETALERTEVENTNOTRECOVERLISTRESPONSEWRAPPER = _descriptor.Descriptor(
name='GetAlertEventNotRecoverListResponseWrapper',
full_name='alert_event.GetAlertEventNotRecoverListResponseWrapper',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
nam... | code_fim | hard | {
"lang": "python",
"repo": "easyopsapis/easyops-api-python",
"path": "/alert_service_sdk/api/alert_event/get_alert_event_not_recover_list_pb2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:return: FastQ object, but the sequence and the quality score are cut according to the indices
"""
if not isinstance(start_index,int) or not isinstance(end_index,int) or end_index <= start_index:
raise InValidCuttingIndices
temp = Fastq([self.strings[0] ,
self.strings[1][start_index... | code_fim | hard | {
"lang": "python",
"repo": "junhull/Resic",
"path": "/Utility/Fastq_class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: junhull/Resic path: /Utility/Fastq_class.py
#Exceptions: Fastq class
class MyException(Exception):
def __init__(self):
self.message = ''
def __repr__(self):
return self.message
class InValidFastQFile(MyException):
def __init__(self):
self.message=''
class NumOfLinesNotDivisibleBy4(InVal... | code_fim | hard | {
"lang": "python",
"repo": "junhull/Resic",
"path": "/Utility/Fastq_class.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.message = 'Invalid Filtering Indices'
class Fastq:
"""
first string - identifier
second string - sequence
third string - identifier (may be different than first line)
forth line - confidence (of each nucleotide in the sequence)
"""
def __init__(self, strings):
"""
:param strings: The 4... | code_fim | hard | {
"lang": "python",
"repo": "junhull/Resic",
"path": "/Utility/Fastq_class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
("/gae_bingo/tests/run_step", RunStep),
]<|fim_prefix|># repo: BarbaraEMac/Side-Project path: /apps/gae_bingo/tests/urls.py
#!/usr/bin/env python
# Google App Engine Bingo
<|fim_middle|>from apps.gae_bingo.tests import RunStep
| code_fim | easy | {
"lang": "python",
"repo": "BarbaraEMac/Side-Project",
"path": "/apps/gae_bingo/tests/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BarbaraEMac/Side-Project path: /apps/gae_bingo/tests/urls.py
#!/usr/bin/env python
<|fim_suffix|>from apps.gae_bingo.tests import RunStep
urlpatterns = [
("/gae_bingo/tests/run_step", RunStep),
]<|fim_middle|># Google App Engine Bingo
| code_fim | easy | {
"lang": "python",
"repo": "BarbaraEMac/Side-Project",
"path": "/apps/gae_bingo/tests/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dists = [Point.distance(p, pt) for pt in self if p != pt]
cl = min(dists)
return self[dists.index(cl)]
def furthest (self, p: Point) -> Point:
dists = [Point.distance(p, pt) for pt in self if p != pt]
cl = max(dists)
return self[dists.index(cl)]
de... | code_fim | hard | {
"lang": "python",
"repo": "rubenafo/ay",
"path": "/ay/plist.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rubenafo/ay path: /ay/plist.py
import numpy
from numpy import random
from ay.Point import Point
class plist (list[Point]):
def __init__(self, items: list =[], seed: int=0):
list.__init__(self, items)
self.seed = seed
self.rnd: random.Generator = numpy.random.defaul... | code_fim | medium | {
"lang": "python",
"repo": "rubenafo/ay",
"path": "/ay/plist.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pesu-isfcr/Nagasundari path: /Simulation/sm_image_build/app/meter.py
from flask import Flask, request, jsonify
import random
import threading
import requests
import os
from flask_cors import cross_origin
import datetime
import hashlib
fport = int(os.environ["fport"])
meter_id = os.environ["meter... | code_fim | hard | {
"lang": "python",
"repo": "pesu-isfcr/Nagasundari",
"path": "/Simulation/sm_image_build/app/meter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route("/get_devices")
@cross_origin()
def get_devices():
global status
return jsonify(status), 200
@app.route("/get_current")
@cross_origin()
def get_current():
global glob_current
return str(glob_current), 200
def sendUsage():
threading.Timer(1, sendUsage).start()
curVal... | code_fim | hard | {
"lang": "python",
"repo": "pesu-isfcr/Nagasundari",
"path": "/Simulation/sm_image_build/app/meter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: denisergashbaev/memory-augmented-self-play path: /SelfPlay/memory/lstm_memory.py
from collections import deque
import numpy as np
import torch.nn as nn
from memory.base_memory import BaseMemory
from memory.memory_config import MemoryConfig
from utils.constant import *
import torch
from torch.au... | code_fim | medium | {
"lang": "python",
"repo": "denisergashbaev/memory-augmented-self-play",
"path": "/SelfPlay/memory/lstm_memory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print(history.unsqueeze(0).size())
# _, (self.hidden_state, _) = self.internal_memory(history, self.hidden_state)
_, (self.hidden_state, self.cell_state) = self.internal_memory(history.unsqueeze(0), (self.hidden_state, self.cell_state))
# self.internal_memory.append(Varia... | code_fim | hard | {
"lang": "python",
"repo": "denisergashbaev/memory-augmented-self-play",
"path": "/SelfPlay/memory/lstm_memory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pytorch/xla path: /test/dynamo/test_dynamo_integrations_util.py
import os
import sys
import torch
import torch_xla
import torch.nn as nn
import torch.nn.functional as F
import torch_xla.core.xla_model as xm
import torch_xla.debug.metrics as met
import unittest
dummy_model = torch.nn.Sequential(... | code_fim | hard | {
"lang": "python",
"repo": "pytorch/xla",
"path": "/test/dynamo/test_dynamo_integrations_util.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> xla_device = xm.xla_device()
t1 = torch.randn(20, 5)
assert (torch_xla._XLAC._check_tensor_need_materialization([t1]) == [False])
t1 = t1.to(xla_device)
assert (torch_xla._XLAC._check_tensor_need_materialization([t1]) == [False])
# call mark_step to clear pending irs on t1. This sh... | code_fim | hard | {
"lang": "python",
"repo": "pytorch/xla",
"path": "/test/dynamo/test_dynamo_integrations_util.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> xla_device = xm.xla_device()
xla_input = torch.randn(64, 256, 14, 14).to(xla_device)
xla_dummy_model = dummy_model.to(xla_device)
xla_out = xla_dummy_model(xla_input)
hash = torch_xla._XLAC._get_graph_hash([xla_out])
# Warm up the cache.
torch_xla._XLAC._xla_warm_up_cache([xla_... | code_fim | hard | {
"lang": "python",
"repo": "pytorch/xla",
"path": "/test/dynamo/test_dynamo_integrations_util.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Deletes tracks whose state covariance matrix (more specifically its trace)
exceeds a given threshold.
"""
covar_trace_thresh: float = Property(doc="Covariance matrix trace threshold")
def check_for_deletion(self, track, **kwargs):
"""Check if a given track should be deleted
... | code_fim | medium | {
"lang": "python",
"repo": "jswright-dstl/Fuzzy-Felt-Framework",
"path": "/stonesoup/deleter/error.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jswright-dstl/Fuzzy-Felt-Framework path: /stonesoup/deleter/error.py
# -*- coding: utf-8 -*-
"""Contains collection of error based deleters"""
import numpy as np
from ..base import Property
from .base import Deleter
class CovarianceBasedDeleter(Deleter):
""" Track deleter based on covarian... | code_fim | medium | {
"lang": "python",
"repo": "jswright-dstl/Fuzzy-Felt-Framework",
"path": "/stonesoup/deleter/error.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> A track is flagged for deletion if the trace of its state covariance
matrix is higher than :py:attr:`~covar_trace_thresh`.
Parameters
----------
track : :class:`stonesoup.types.Track`
A track object to be checked for deletion.
Returns
-... | code_fim | hard | {
"lang": "python",
"repo": "jswright-dstl/Fuzzy-Felt-Framework",
"path": "/stonesoup/deleter/error.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: collab-project/luma.cryptocurrency path: /luma/cryptocurrency/endpoint/bitstamp.py
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Thijs Triemstra and contributors
# See LICENSE.rst for details.
"""
Endpoint for bitstamp.net
:see: https://www.bitstamp.net/api/
"""
from datetime import datetime
f... | code_fim | medium | {
"lang": "python",
"repo": "collab-project/luma.cryptocurrency",
"path": "/luma/cryptocurrency/endpoint/bitstamp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> base = 'https://www.bitstamp.net/api/{api_version}/ticker/btc{currency}/'
return base.format(
currency=self.currency_code.lower(),
api_version=self.api_version
)<|fim_prefix|># repo: collab-project/luma.cryptocurrency path: /luma/cryptocurrency/endpoint/bi... | code_fim | hard | {
"lang": "python",
"repo": "collab-project/luma.cryptocurrency",
"path": "/luma/cryptocurrency/endpoint/bitstamp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def parse_price(self):
return float(self.json_data.get('last'))
def parse_timestamp(self):
return datetime.fromtimestamp(
int(self.json_data.get('timestamp')), tz=tzutc())
class Bitstamp(Endpoint):
api_version = 'v2'
responseType = BitstampResponse
def g... | code_fim | medium | {
"lang": "python",
"repo": "collab-project/luma.cryptocurrency",
"path": "/luma/cryptocurrency/endpoint/bitstamp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qamine-test/codewars path: /kyu_7/maximum_multiple/maximum_multiple.py
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
<|fim_suffix|> Notes:
1. The parameters (divisor, bound)
passed to the function are... | code_fim | hard | {
"lang": "python",
"repo": "qamine-test/codewars",
"path": "/kyu_7/maximum_multiple/maximum_multiple.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> Notes:
1. The parameters (divisor, bound)
passed to the function are only positve values .
2. It's guaranteed that a divisor is Found .
:param divisor:
:param bound:
:return:
"""
while bound > 0:
if bound % divisor == 0:
return bound... | code_fim | medium | {
"lang": "python",
"repo": "qamine-test/codewars",
"path": "/kyu_7/maximum_multiple/maximum_multiple.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fearlessshi/armour-geetest path: /examples/__init__.py
# -*- coding: utf-8 -*-
# Time : 2021/7/22 0:36
# Author : QIN2DIM
# Github : https://github.com/QIN2DIM
# Description:
<|fim_suffix|>__all__ = [
# 使用了对应验证版本的测试站点
'URLS_GT3', 'URLS_GT2',
# demo示例
'demo_geetest2'... | code_fim | medium | {
"lang": "python",
"repo": "fearlessshi/armour-geetest",
"path": "/examples/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [
# 使用了对应验证版本的测试站点
'URLS_GT3', 'URLS_GT2',
# demo示例
'demo_geetest2', 'demo_geetest3'
]<|fim_prefix|># repo: fearlessshi/armour-geetest path: /examples/__init__.py
# -*- coding: utf-8 -*-
# Time : 2021/7/22 0:36
# Author : QIN2DIM
# Github : https://github.com/QIN2D... | code_fim | easy | {
"lang": "python",
"repo": "fearlessshi/armour-geetest",
"path": "/examples/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>__version__ = ['0.1.1']
__all__ = [
# 使用了对应验证版本的测试站点
'URLS_GT3', 'URLS_GT2',
# demo示例
'demo_geetest2', 'demo_geetest3'
]<|fim_prefix|># repo: fearlessshi/armour-geetest path: /examples/__init__.py
# -*- coding: utf-8 -*-
# Time : 2021/7/22 0:36
# Author : QIN2DIM
# Github :... | code_fim | medium | {
"lang": "python",
"repo": "fearlessshi/armour-geetest",
"path": "/examples/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: exastro-suite/oase path: /oase-root/web_app/views/restapi/actionhistory.py
# Copyright 2019 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... | code_fim | hard | {
"lang": "python",
"repo": "exastro-suite/oase",
"path": "/oase-root/web_app/views/restapi/actionhistory.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(objects_list) > 0:
for act in objects_list:
try:
driver_type_id = ActionType.objects.get(action_type_id=act.action_type_id).driver_type_id
driver_type = DriverType.objects.get(driver_type_id=driver_type_id)
... | code_fim | hard | {
"lang": "python",
"repo": "exastro-suite/oase",
"path": "/oase-root/web_app/views/restapi/actionhistory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if events_request.request_type_id == PRODUCTION:
msg = 'Successful completion. (Production environment)'
elif events_request.request_type_id == STAGING:
msg = 'Successful completion. (Staging environment)'
else:
msg = 'I... | code_fim | hard | {
"lang": "python",
"repo": "exastro-suite/oase",
"path": "/oase-root/web_app/views/restapi/actionhistory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joanvelro/IA_resources path: /create_config_file.py
from configparser import ConfigParser
#Get the configparser object
config_object = ConfigParser()
config_object["DB_DESCRIPTIVE_SQLSERVER"] = {
"driver": "ODBC Driver 13 for SQL Server",
"user": "sa",
"pass": "sa$2019",
"serv... | code_fim | easy | {
"lang": "python",
"repo": "joanvelro/IA_resources",
"path": "/create_config_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Write the above sections to config.ini file
with open('config.ini', 'w') as conf:
config_object.write(conf)<|fim_prefix|># repo: joanvelro/IA_resources path: /create_config_file.py
from configparser import ConfigParser
#Get the configparser object
config_object = ConfigParser()
<|fim_middle|>
con... | code_fim | hard | {
"lang": "python",
"repo": "joanvelro/IA_resources",
"path": "/create_config_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MrFreemanser/Bot path: /cosmos/core/functions/context/context.py
from .generic_responses import GenericResponse
from .functions import *
from discord.ext import commands
class CosmosContext(commands.Context):
async def fetch_cosmos_user_profile(self, _id=None):
return await self.... | code_fim | hard | {
"lang": "python",
"repo": "MrFreemanser/Bot",
"path": "/cosmos/core/functions/context/context.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.bot.emotes
@property
def embeds(self):
return self.bot.theme.embeds
@property
def embed_line(self):
return self.bot.theme.embeds.one_line.primary
async def send_line(self, *args, delete_after=None, **kwargs):
return await self.send(embed=s... | code_fim | hard | {
"lang": "python",
"repo": "MrFreemanser/Bot",
"path": "/cosmos/core/functions/context/context.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: At252/mergify-engine path: /mergify_engine/rules/live_resolvers.py
# -*- encoding: utf-8 -*-
#
# Copyright © 2021 Mergify SAS
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the Licen... | code_fim | hard | {
"lang": "python",
"repo": "At252/mergify-engine",
"path": "/mergify_engine/rules/live_resolvers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
return await ctxt.repository.installation.get_team_members(team_slug)
except http.HTTPNotFound:
raise LiveResolutionFailure(f"Team `{name}` does not exist")
except http.HTTPClientSideError as e:
ctxt.log.warning(
"fail to get the organization, team or m... | code_fim | hard | {
"lang": "python",
"repo": "At252/mergify-engine",
"path": "/mergify_engine/rules/live_resolvers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> reason: str
async def _resolve_login(
ctxt: context.Context, name: str
) -> typing.List[github_types.GitHubLogin]:
if not name:
return []
elif not isinstance(name, str):
return [github_types.GitHubLogin(name)]
elif name[0] != "@":
return [github_types.GitHubLo... | code_fim | hard | {
"lang": "python",
"repo": "At252/mergify-engine",
"path": "/mergify_engine/rules/live_resolvers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
from augment.SingleAugmentor import SingleAugmentor<|fim_prefix|># repo: IlyaZherebtsov/segmentation_image_augmentation path: /augment/__init__.py
from augment.Augmentor import Augmentor
from augment.MultiPartAugmentor import MultiPartAugmentor
from<|fim_middle|> augment.SemanticAugmentor import Semanti... | code_fim | easy | {
"lang": "python",
"repo": "IlyaZherebtsov/segmentation_image_augmentation",
"path": "/augment/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IlyaZherebtsov/segmentation_image_augmentation path: /augment/__init__.py
from augment.Augmentor import Augmentor
from augment.MultiPartAugmentor import MultiPartAugmentor
from<|fim_suffix|>
from augment.SingleAugmentor import SingleAugmentor<|fim_middle|> augment.SemanticAugmentor import Semanti... | code_fim | easy | {
"lang": "python",
"repo": "IlyaZherebtsov/segmentation_image_augmentation",
"path": "/augment/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-Security/PyObjCTest/test_oidsalg.py
import Security
from PyObjCTools.TestSupport import TestCase
class Testoidsalg(TestCase):
def test_unsuppported(self):
self.assertFalse(hasattr(Security, "CSSMOID_MD2"))
self.assertFalse(hasatt... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-Security/PyObjCTest/test_oidsalg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lse(hasattr(Security, "CSSMOID_APPLE_TP_RESOURCE_SIGN"))
self.assertFalse(hasattr(Security, "CSSMOID_APPLE_TP_PKINIT_CLIENT"))
self.assertFalse(hasattr(Security, "CSSMOID_APPLE_TP_PKINIT_SERVER"))
self.assertFalse(hasattr(Security, "CSSMOID_APPLE_TP_CODE_SIGNING"))
self.ass... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-Security/PyObjCTest/test_oidsalg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
self.assertFalse(hasattr(Security, "CSSMOID_DOTMAC_CERT_REQ_ARCHIVE_FETCH"))
self.assertFalse(hasattr(Security, "CSSMOID_DOTMAC_CERT_REQ_ARCHIVE_REMOVE"))
self.assertFalse(hasattr(Security, "CSSMOID_DOTMAC_CERT_REQ_SHARED_SERVICES"))
self.assertFalse(hasattr(Security, "CS... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-Security/PyObjCTest/test_oidsalg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matthiasblanke/PEWO path: /rules/placement/rappas.smk
"""
This module makes placements with RAPPAS
Note: this module expect AR to be already computed
"""
__author__ = "Benjamin Linard, Nikolai Romashchenko"
__license__ = "MIT"
import os
from pathlib import Path
import pewo.config as cfg
from p... | code_fim | hard | {
"lang": "python",
"repo": "matthiasblanke/PEWO",
"path": "/rules/placement/rappas.smk",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Creates a list of input reads files. For generated reads from a pruning,
all read lengths are passed in a single RAPPAS execution.
Read lengths can not be wildcards and must be set manually
"""
output_dir = os.path.join(_working_dir, "R")
# one read per fasta
if cfg.ge... | code_fim | hard | {
"lang": "python",
"repo": "matthiasblanke/PEWO",
"path": "/rules/placement/rappas.smk",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmavrich/pdm_utils path: /tests/unit/test_import_genome.py
subcluster_set=self.subcluster_set,
file_ref="flat_file", ticket_ref="ticket",
retrieve_ref="phagesdb", retain_ref="mysql")
with self.subTest():
self.assertTrue(len(self.bndl.evaluati... | code_fim | hard | {
"lang": "python",
"repo": "tmavrich/pdm_utils",
"path": "/tests/unit/test_import_genome.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Verify correct number of errors are produced using:
'add' ticket type and 'seq' in seq_set."""
self.gnm.seq = Seq("ATGC", IUPAC.ambiguous_dna)
import_genome.check_genome(
self.gnm, self.tkt.type, self.tkt.eval_flags,
self.id_set, self.seq_set, sel... | code_fim | hard | {
"lang": "python",
"repo": "tmavrich/pdm_utils",
"path": "/tests/unit/test_import_genome.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmavrich/pdm_utils path: /tests/unit/test_import_genome.py
count, 1)
def test_check_genome_48(self):
"""Verify correct number of errors are produced using:
'_cds_features_tally' = 0."""
self.gnm._cds_features_tally = 0
import_genome.check_genome(
s... | code_fim | hard | {
"lang": "python",
"repo": "tmavrich/pdm_utils",
"path": "/tests/unit/test_import_genome.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: the-tale/the-tale path: /src/the_tale/the_tale/common/utils/conf.py
import smart_imports
smart_imports.all()
settings = utils_app_settings.app_settings('UTILS',
<|fim_suffix|> DEFAUL_ERROR_MESSAGE='Произошла ошибка, мы уже работаем... | code_fim | hard | {
"lang": "python",
"repo": "the-tale/the-tale",
"path": "/src/the_tale/the_tale/common/utils/conf.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> DEFAUL_ERROR_MESSAGE='Произошла ошибка, мы уже работаем над её устранением, повторите попытку через некоторое время')<|fim_prefix|># repo: the-tale/the-tale path: /src/the_tale/the_tale/common/utils/conf.py
import smart_imports
smart_imports.all()
settings = utils_app_settings.a... | code_fim | hard | {
"lang": "python",
"repo": "the-tale/the-tale",
"path": "/src/the_tale/the_tale/common/utils/conf.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mvcisback/magnumSTL path: /magnum/test_mpc.py
import funcy as fn
from magnum.mpc import echo_env_mpc
<|fim_suffix|> results = list(fn.take(10, echo_env_mpc(g)))
assert len(results) == 10<|fim_middle|>def test_mpc_smoke():
from magnum.examples.feasible_example import feasible_example... | code_fim | medium | {
"lang": "python",
"repo": "mvcisback/magnumSTL",
"path": "/magnum/test_mpc.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> results = list(fn.take(10, echo_env_mpc(g)))
assert len(results) == 10<|fim_prefix|># repo: mvcisback/magnumSTL path: /magnum/test_mpc.py
import funcy as fn
from magnum.mpc import echo_env_mpc
def test_mpc_smoke():
<|fim_middle|> from magnum.examples.feasible_example import feasible_example... | code_fim | medium | {
"lang": "python",
"repo": "mvcisback/magnumSTL",
"path": "/magnum/test_mpc.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: basilfx/xknx path: /xknx/devices/switch.py
"""
Module for managing a switch via KNX.
It provides functionality for
* switching 'on' and 'off'.
* reading the current state from KNX bus.
"""
from xknx.remote_value import RemoteValueSwitch
from .device import Device
class Switch(Device):
""... | code_fim | hard | {
"lang": "python",
"repo": "basilfx/xknx",
"path": "/xknx/devices/switch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def set_off(self):
"""Switch off switch."""
await self.switch.off()
async def do(self, action):
"""Execute 'do' commands."""
if action == "on":
await self.set_on()
elif action == "off":
await self.set_off()
else:
... | code_fim | hard | {
"lang": "python",
"repo": "basilfx/xknx",
"path": "/xknx/devices/switch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return the current switch state of the device."""
# None will return False
return bool(self.switch.value)
async def set_on(self):
"""Switch on switch."""
await self.switch.on()
async def set_off(self):
"""Switch off switch."""
await self... | code_fim | hard | {
"lang": "python",
"repo": "basilfx/xknx",
"path": "/xknx/devices/switch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.