text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> assert host.file('/etc/netatalk/afp.conf').exists
def test_line_in_config(host):
conf_file = host.file('/etc/netatalk/afp.conf')
assert 'valid users = "root"' in conf_file.content_string
# assert conf_file.contains('valid_users = "root"')<|fim_prefix|># repo: eliahrebstock/ansible-role-n... | code_fim | easy | {
"lang": "python",
"repo": "eliahrebstock/ansible-role-netatalk",
"path": "/molecule/default/tests/test_default.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_config_exists(host):
assert host.file('/etc/netatalk/afp.conf').exists
def test_line_in_config(host):
conf_file = host.file('/etc/netatalk/afp.conf')
assert 'valid users = "root"' in conf_file.content_string
# assert conf_file.contains('valid_users = "root"')<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "eliahrebstock/ansible-role-netatalk",
"path": "/molecule/default/tests/test_default.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def publish_to_bus(
context: Any, payload: dict, extra_attributes: dict = {}, subject: Union[str, None] = None
) -> int:
"""A convenience function that publishes to the application message bus topic on SNS.
Calls `publish()` with a default topic ARN.
The message bus ARN must be specified... | code_fim | hard | {
"lang": "python",
"repo": "eladkehat/astromech",
"path": "/astromech/sns.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eladkehat/astromech path: /astromech/sns.py
import json
import os
from typing import Any, Union
import boto3
import botocore
from astromech.logging import logger
_client = None
"""A boto SNS client, initialized lazily by `client()`.
The client object is global, so that it gets reused between ... | code_fim | hard | {
"lang": "python",
"repo": "eladkehat/astromech",
"path": "/astromech/sns.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def publish(
topic_arn: str, context: Any, payload: dict, extra_attributes: dict = {}, subject: Union[str, None] = None
) -> int:
"""Publishes a message to the specified topic on SNS.
The function name and version from the context are added automatically as message attributes.
You can pr... | code_fim | hard | {
"lang": "python",
"repo": "eladkehat/astromech",
"path": "/astromech/sns.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return out
def test_generator():
server = WebServer(WEBSERVER_ROOT, WEBSERVER_PORT)
for t in _list_tests_in_folder(WEBSERVER_ROOT):
yield _run_test, t
del server
if __name__ == '__main__':
if len(sys.argv) < 2:
subprocess.call(['nosetests', 'concolic.py'])
else:
... | code_fim | hard | {
"lang": "python",
"repo": "daisy1754/Artemis",
"path": "/artemis-code/tests/system/concolic.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daisy1754/Artemis path: /artemis-code/tests/system/concolic.py
#!/usr/bin/env python
WEBSERVER_PORT = 8001
WEBSERVER_ROOT = './fixtures/concolic/'
WEBSERVER_URL = 'http://localhost:%s' % WEBSERVER_PORT
import sys
import nose
import re
import subprocess
from harness.environment import WebServer... | code_fim | medium | {
"lang": "python",
"repo": "daisy1754/Artemis",
"path": "/artemis-code/tests/system/concolic.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> out = []
for f in listdir(folder):
p = join(folder, f)
if not isfile(p) or f[0:1] == "_" or f[0:1] == "%" or '~' in f or '#' in f:
continue
out.append(f)
return out
def test_generator():
server = WebServer(WEBSERVER_ROOT, WEBSERVER_PORT)
... | code_fim | hard | {
"lang": "python",
"repo": "daisy1754/Artemis",
"path": "/artemis-code/tests/system/concolic.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kuc-k/Pomomo path: /bot/src/Settings.py
from configs import user_messages as u_msg, config
class Settings:
def __init__(self, duration, short_break=None, long_break=None, intervals=None):
<|fim_suffix|> @classmethod
async def is_valid(cls, ctx, duration: int, short_break: int = None... | code_fim | hard | {
"lang": "python",
"repo": "kuc-k/Pomomo",
"path": "/bot/src/Settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
async def is_valid(cls, ctx, duration: int, short_break: int = None,
long_break: int = None, intervals: int = None) -> bool:
if config.MAX_INTERVAL_MINUTES > duration > 0 \
and (not short_break or config.MAX_INTERVAL_MINUTES > short_break... | code_fim | hard | {
"lang": "python",
"repo": "kuc-k/Pomomo",
"path": "/bot/src/Settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # dump json and windows event logs from Windows servers
for server in servers:
server_str = ("attack-range-" + server).replace("_","-")
target_public_ip = aws_service.get_single_instance_public_ip(server_str, self.config)
if server_str == 'attack-range-... | code_fim | hard | {
"lang": "python",
"repo": "morpheusme/attack_range",
"path": "/modules/TerraformController.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: morpheusme/attack_range path: /modules/TerraformController.py
from modules.IEnvironmentController import IEnvironmentController
from python_terraform import *
from modules import aws_service, splunk_sdk, github_service
from tabulate import tabulate
import ansible_runner
import yaml
import time
i... | code_fim | hard | {
"lang": "python",
"repo": "morpheusme/attack_range",
"path": "/modules/TerraformController.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# copy json from nxlog
# copy raw data using powershell
# copy indexes
# packet capture with netsh
# see https://medium.com/threat-hunters-forge/mordor-pcaps-part-1-capturing-network-packets-from-windows-endpoints-with-network-shell-e117b84ec971
self.log.i... | code_fim | hard | {
"lang": "python",
"repo": "morpheusme/attack_range",
"path": "/modules/TerraformController.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#access internal split information
bk.extract_information(model)
#print X and predict(X) to file
bk.export_inputs_and_outputs(X, model.predict(X))<|fim_prefix|># repo: JanSKowalski/Hardware_Acceleration path: /4_xgboost/1_proof/frontend.py
from sklearn.datasets import load_iris
import xgboost
import bac... | code_fim | medium | {
"lang": "python",
"repo": "JanSKowalski/Hardware_Acceleration",
"path": "/4_xgboost/1_proof/frontend.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JanSKowalski/Hardware_Acceleration path: /4_xgboost/1_proof/frontend.py
from sklearn.datasets import load_iris
import xgboost
import backend as bk
<|fim_suffix|>#access internal split information
bk.extract_information(model)
#print X and predict(X) to file
bk.export_inputs_and_outputs(X, model... | code_fim | medium | {
"lang": "python",
"repo": "JanSKowalski/Hardware_Acceleration",
"path": "/4_xgboost/1_proof/frontend.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: real-digital/esque-wire path: /esque_wire/protocol/serializers/api/create_delegation_token_request.py
###############################################################
# Autogenerated module. Please don't modify. #
# Edit according file in protocol_generator/templates instead #
###... | code_fim | hard | {
"lang": "python",
"repo": "real-digital/esque-wire",
"path": "/esque_wire/protocol/serializers/api/create_delegation_token_request.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from ...structs.api.create_delegation_token_request import CreateDelegationTokenRequestData, Renewer
from ._main_serializers import ArraySerializer, ClassSerializer, Schema, int64Serializer, stringSerializer
renewerSchemas: Dict[int, Schema] = {
0: [("principal_type", stringSerializer), ("name", stri... | code_fim | medium | {
"lang": "python",
"repo": "real-digital/esque-wire",
"path": "/esque_wire/protocol/serializers/api/create_delegation_token_request.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/FengdieActivityCreatePagesData.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.FengdieActivityComponentModel import FengdieActivityComponentModel... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/FengdieActivityCreatePagesData.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not d:
return None
o = FengdieActivityCreatePagesData()
if 'components' in d:
o.components = d['components']
if 'page_data' in d:
o.page_data = d['page_data']
if 'page_path' in d:
o.page_path = d['page_path']
... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/FengdieActivityCreatePagesData.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @page_path.setter
def page_path(self, value):
self._page_path = value
@property
def title(self):
return self._title
@title.setter
def title(self, value):
self._title = value
def to_alipay_dict(self):
params = dict()
if self.components:... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/FengdieActivityCreatePagesData.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alldatacenter/alldata path: /ai/mmdetection/tests/test_models/test_detectors/test_single_stage_instance_seg.py
# Copyright (c) OpenMMLab. All rights reserved.
import unittest
from unittest import TestCase
import torch
from parameterized import parameterized
from mmdet.structures import DetDataS... | code_fim | hard | {
"lang": "python",
"repo": "alldatacenter/alldata",
"path": "/ai/mmdetection/tests/test_models/test_detectors/test_single_stage_instance_seg.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if device == 'cuda':
if not torch.cuda.is_available():
return unittest.skip('test requires GPU and torch+cuda')
detector = detector.cuda()
packed_inputs = demo_mm_inputs(
2, [[3, 128, 128], [3, 125, 130]], with_ma... | code_fim | hard | {
"lang": "python",
"repo": "alldatacenter/alldata",
"path": "/ai/mmdetection/tests/test_models/test_detectors/test_single_stage_instance_seg.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darklordabc/dota path: /dota/api.py
t(',') for hero, role in _hero_roles.items()
if role is not None} # drops base
# updated hero list
with open(_current_hero_path) as f:
d = json.load(f)['heroes']
_hero_names_to_id = {x['name'].split('npc_dota_hero_')[1]: x['id'] ... | code_fim | hard | {
"lang": "python",
"repo": "darklordabc/dota",
"path": "/dota/api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darklordabc/dota path: /dota/api.py
_hero_id_to_names = {v: k for k, v in _hero_names_to_id.items()}
with open(_abilities_path) as f:
_abilities = json.load(f)
_ability_id_to_name = {v['ID']: k for k, v in _abilities.items()}
_ability_name_to_id = {k: v['ID'] for k, v in _abilities... | code_fim | hard | {
"lang": "python",
"repo": "darklordabc/dota",
"path": "/dota/api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> d = {'radiant': bsr, 'dire': bsd}
return d
def barracks_status(self, team=None):
"""
8-bit unsigned int.
0 0 0 0 0 0 0 1
^ ^ ^ ^ ^ ^ ^ ^
1 2 3 4 5 6 7 8
1: unused
2: unused
3: bottom ranged
4: bottom melee
... | code_fim | hard | {
"lang": "python",
"repo": "darklordabc/dota",
"path": "/dota/api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ECSHackWeek/EISfit path: /eisfit/tests/test_preprocessing.py
from eisfit.preprocessing import readFile, readGamry
import numpy as np
# store some global test data
frequencies = np.array([0.0031623, 0.0039811, 0.0050119, 0.0063096,
0.0079433, 0.01, 0.012589, 0.015849, 0.01... | code_fim | hard | {
"lang": "python",
"repo": "ECSHackWeek/EISfit",
"path": "/eisfit/tests/test_preprocessing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Zi_gamry = np.array([-1367.239, -1502.195, -1621.813, -1672.93, -1668.395,
-1620.144, -1506.859, -1407.856, -1266.296, -1091.802,
-947.1432, -813.0331, -704.9116, -606.206, -516.6904,
-439.2898, -382.0586, -327.8677, -279.8773, -247.0336,
... | code_fim | hard | {
"lang": "python",
"repo": "ECSHackWeek/EISfit",
"path": "/eisfit/tests/test_preprocessing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>f_gamry = np.array([2.000156e+05, 1.589531e+05, 1.262344e+05, 1.002656e+05,
7.964063e+04, 6.332812e+04, 5.029688e+04, 3.998437e+04,
3.173438e+04, 2.526563e+04, 2.001562e+04, 1.589062e+04,
1.270313e+04, 1.007813e+04, 8.015625e+03, 6.328125e+03,
... | code_fim | hard | {
"lang": "python",
"repo": "ECSHackWeek/EISfit",
"path": "/eisfit/tests/test_preprocessing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RoSapia/Python-curso-em-video path: /curso-python/cursoemvideo/ex42aula12.py
'''Refaça o desafio 35 dos triângulos, acrescentando <|fim_suffix|> lados iguais
ESCALENO todos os lados diferentes'''<|fim_middle|>o recurso de mostrar que tipo de triângulo será
formado
EQUILÁTERO todos os lados ig... | code_fim | medium | {
"lang": "python",
"repo": "RoSapia/Python-curso-em-video",
"path": "/curso-python/cursoemvideo/ex42aula12.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> lados iguais
ESCALENO todos os lados diferentes'''<|fim_prefix|># repo: RoSapia/Python-curso-em-video path: /curso-python/cursoemvideo/ex42aula12.py
'''Refaça o desafio 35 dos triângulos, acrescentando <|fim_middle|>o recurso de mostrar que tipo de triângulo será
formado
EQUILÁTERO todos os lados ig... | code_fim | medium | {
"lang": "python",
"repo": "RoSapia/Python-curso-em-video",
"path": "/curso-python/cursoemvideo/ex42aula12.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
app = Application(
[
(r"/ping", handlers.PingHandler),
(r"/pong", handlers.PongHandler),
(r"/ticket", handlers.TicketHandler),
(r"/ticket/(%s)" % TICKET_REGEX, handlers.TicketIdHandler),
(r"/version", handlers.VersionHandler),
],
default_handler_class=h... | code_fim | hard | {
"lang": "python",
"repo": "zvxr/tickets",
"path": "/app/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zvxr/tickets path: /app/main.py
import app.handlers as handlers
import app.config as config
import tornado.web
from app.ticket_gen import TICKET_REGEX
class Application(tornado.web.Application):
"""Tornado 4.5 breaks sphinx. Provide workaround for autotornado."""
@property
def hand... | code_fim | hard | {
"lang": "python",
"repo": "zvxr/tickets",
"path": "/app/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> process_router(self.default_router)
return [[None, handlers]]
app = Application(
[
(r"/ping", handlers.PingHandler),
(r"/pong", handlers.PongHandler),
(r"/ticket", handlers.TicketHandler),
(r"/ticket/(%s)" % TICKET_REGEX, handlers.TicketIdHandler),
... | code_fim | hard | {
"lang": "python",
"repo": "zvxr/tickets",
"path": "/app/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'NgramExtractor|%(n)s|lc=%(lowercase)s' % self.__dict__
class MediaWikiExtractor:
None
class SentiWordNetExtractor:
def __init__(self, file, threshold=0.1):
table = list(csv.reader(filter(lambda x: x[0] != '#', open(file)), delimiter='\t'))
self.lemmatizer = nltk.s... | code_fim | hard | {
"lang": "python",
"repo": "whym/wikisentiment",
"path": "/fextract.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whym/wikisentiment path: /fextract.py
import csv
import re
import nltk
import sys
import myutils
def extract_contents(ent):
for (name, ext) in {'added': lambda x: x['entry']['content']['added'],
'removed': lambda x: x['entry']['content']['removed'],
... | code_fim | hard | {
"lang": "python",
"repo": "whym/wikisentiment",
"path": "/fextract.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, file='patterns.txt'):
self.patterns = {}
self.patterns_expanded = {}
for line in open(file):
line = myutils.comment_out(line).strip()
if len(line) == 0:
continue
a = line.split('\t')
... | code_fim | hard | {
"lang": "python",
"repo": "whym/wikisentiment",
"path": "/fextract.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.parametrize('py_map, bin_value',
_values
)
@pytest.mark.timeout(timeout=5)
def test_decode(py_map, bin_value):
map_dec = cbor.loads(bin_value)
assert map_dec is not None
# assert len(map_dec) != 0
assert type(map_dec) == type(py_map), f"dec: {map_dec}"
assert map_dec... | code_fim | medium | {
"lang": "python",
"repo": "LeBlue/pymcumgr",
"path": "/tests/mgmt/test_cborattr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeBlue/pymcumgr path: /tests/mgmt/test_cborattr.py
import pytest
import cbor
_values = [
({},
bytes([0xa0])
),
({'fooint': 0x0f00},
b'\xa1ffooint\x19\x0f\x00'
),
({'foostr': 'foo'},
b'\xa1ffoostrcfoo'
),
# this fails, not good
({'fooarr': ... | code_fim | medium | {
"lang": "python",
"repo": "LeBlue/pymcumgr",
"path": "/tests/mgmt/test_cborattr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> map_dec = cbor.loads(bin_value)
assert map_dec is not None
# assert len(map_dec) != 0
assert type(map_dec) == type(py_map), f"dec: {map_dec}"
assert map_dec == py_map<|fim_prefix|># repo: LeBlue/pymcumgr path: /tests/mgmt/test_cborattr.py
import pytest
import cbor
_values = [
(... | code_fim | medium | {
"lang": "python",
"repo": "LeBlue/pymcumgr",
"path": "/tests/mgmt/test_cborattr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> execute_alelo_api()<|fim_prefix|># repo: ricardochaves/financeiro-bot path: /base_site/alelo/management/commands/i_alelo.py
from base_site.alelo.tasks import execute_alelo_api
from django.core.management import BaseCommand
<|fim_middle|>class Command(BaseCommand):
def handle(self, *args, **... | code_fim | medium | {
"lang": "python",
"repo": "ricardochaves/financeiro-bot",
"path": "/base_site/alelo/management/commands/i_alelo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ricardochaves/financeiro-bot path: /base_site/alelo/management/commands/i_alelo.py
from base_site.alelo.tasks import execute_alelo_api
from django.core.management import BaseCommand
<|fim_suffix|> execute_alelo_api()<|fim_middle|>
class Command(BaseCommand):
def handle(self, *args, **... | code_fim | medium | {
"lang": "python",
"repo": "ricardochaves/financeiro-bot",
"path": "/base_site/alelo/management/commands/i_alelo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DevinSit/kubails path: /kubails/external_services/helm.py
import logging
import os
from typing import List
from kubails.utils.service_helpers import call_command
logger = logging.getLogger(__name__)
<|fim_suffix|> def template(
self,
output_dir: str,
value_files: Lis... | code_fim | hard | {
"lang": "python",
"repo": "DevinSit/kubails",
"path": "/kubails/external_services/helm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for string_var in string_vars:
command.extend(["--set-string", string_var])
command.append(self.helm_folder)
return call_command(command)<|fim_prefix|># repo: DevinSit/kubails path: /kubails/external_services/helm.py
import logging
import os
from typing import List
f... | code_fim | hard | {
"lang": "python",
"repo": "DevinSit/kubails",
"path": "/kubails/external_services/helm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for template_file in template_files:
command.extend(["-x", os.path.join(TEMPLATES_FOLDER, template_file)])
for string_var in string_vars:
command.extend(["--set-string", string_var])
command.append(self.helm_folder)
return call_command(command)<|f... | code_fim | hard | {
"lang": "python",
"repo": "DevinSit/kubails",
"path": "/kubails/external_services/helm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Drakulix/knex path: /backend/api/projectsInfo.py
from flask import request, jsonify, g, Blueprint
from flask_security import login_required
from uuid import UUID
<|fim_suffix|>
@projects_info.route('/api/projects/authors', methods=['GET'])
@login_required
def get_all_authors():
""" Return... | code_fim | medium | {
"lang": "python",
"repo": "Drakulix/knex",
"path": "/backend/api/projectsInfo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@projects_info.route('/api/projects/authors', methods=['GET'])
@login_required
def get_all_authors():
""" Returns a list of all email adresses used in projects "authors" field.
"""
try:
authors = g.projects.distinct('authors')
all_authors = sorted(authors, key=lambda k: str(k).... | code_fim | medium | {
"lang": "python",
"repo": "Drakulix/knex",
"path": "/backend/api/projectsInfo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tryroadmap/join-house-prices-solutions-project path: /src/logistic_predict.py
import train
import logistic_regression
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import preprocessing
import time
from datetime import datetime... | code_fim | hard | {
"lang": "python",
"repo": "tryroadmap/join-house-prices-solutions-project",
"path": "/src/logistic_predict.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for lag in lag_list:
trend_column_lag = "Trend_" + column + "_" + str(lag)
df[trend_column_lag] = (df[column]-df[column].shift(lag, fill_value=-999))/df[column].shift(lag, fill_value=0)
return df
def calculate_lag(df, lag_list, column):
for lag in lag_list:
column_lag... | code_fim | hard | {
"lang": "python",
"repo": "tryroadmap/join-house-prices-solutions-project",
"path": "/src/logistic_predict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
data,country_dict,all_data = train.addingWolrd(add_columns)
dates_list = ['2020-03-01', '2020-03-02', '2020-03-03', '2020-03-04', '2020-03-05', '2020-03-06', '2020-03-07', '2020-03-08', '2020-03-09',
'2020-03-10', '2020-03-11','2020-03-12','2020-03-13','2020-03-14','2020-03-15','20... | code_fim | hard | {
"lang": "python",
"repo": "tryroadmap/join-house-prices-solutions-project",
"path": "/src/logistic_predict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SamP20/hackspace-flask-theme path: /setup.py
from setuptools import setup, find_namespace_packages
setup(
nam<|fim_suffix|> zip_safe=False,
install_requires=[
"flask>=2.0",
]
)<|fim_middle|>e='bristolhackspace.flask_theme',
packages=find_namespace_packages(include=['brist... | code_fim | medium | {
"lang": "python",
"repo": "SamP20/hackspace-flask-theme",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s(include=['bristolhackspace.*']),
include_package_data=True,
zip_safe=False,
install_requires=[
"flask>=2.0",
]
)<|fim_prefix|># repo: SamP20/hackspace-flask-theme path: /setup.py
from setuptools import setup, find_namespace_packages
setup(
nam<|fim_middle|>e='bristolhackspa... | code_fim | medium | {
"lang": "python",
"repo": "SamP20/hackspace-flask-theme",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Article Page
v1_api.register(ArticleResource())
v1_api.register(TagResource())
v1_api.register(LikeChannelResource())
#Listing
v1_api.register(ListingResource())
v1_api.register(LikeListingResource())
# Send Mail
# v1_api.register(SendMailResource())
# Forum
v1_api.register(QuestionResource())
v1_api.... | code_fim | hard | {
"lang": "python",
"repo": "Makeystreet/makeystreet",
"path": "/woot/apps/catalog/api_urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Makeystreet/makeystreet path: /woot/apps/catalog/api_urls.py
from django.conf.urls import patterns, include, url
from tastypie.api import Api
from api import *
v1_api = Api(api_name='v1')
v1_api.register(MyTagResource())
v1_api.register(UserProfileResource())
v1_api.register(MakeyResource())
... | code_fim | hard | {
"lang": "python",
"repo": "Makeystreet/makeystreet",
"path": "/woot/apps/catalog/api_urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ahmedlone127/nlu path: /nlu/pipe/extractors/extraction_resolver_OS.py
"""
Resolve Annotator Classes in the Pipeline to Extractor Configs and Methods.
Each Spark NLP Annotator Class is mapped to at least one
Every Annotator should have 2 configs. Some might offor multuple configs/method pairs, ba... | code_fim | hard | {
"lang": "python",
"repo": "ahmedlone127/nlu",
"path": "/nlu/pipe/extractors/extraction_resolver_OS.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>t_full_config,
},
NGramGenerator: {
'default': default_ngram_config,
'default_full': default_full_config,
},
ChunkEmbeddings: {
'default': default_chunk_embedding_config,
'default_full': default_full_config,
},
StopWordsCleaner: {
'default': ... | code_fim | hard | {
"lang": "python",
"repo": "ahmedlone127/nlu",
"path": "/nlu/pipe/extractors/extraction_resolver_OS.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chickert/reinforcement_learning path: /behavior_cloning/safety_backup_C/C/environment_models/pusher.py
from environment_models.base import BaseEnv
from airobot_utils.pusher_simulator import PusherSimulator
<|fim_suffix|>
self.simulator = PusherSimulator(render=False)
def transi... | code_fim | medium | {
"lang": "python",
"repo": "chickert/reinforcement_learning",
"path": "/behavior_cloning/safety_backup_C/C/environment_models/pusher.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.simulator = PusherSimulator(render=False)
def transition_function(state, action):
self.simulator.apply_action(action)
return self.simulator.get_obs()
def reward_function(state, action):
return self.simulator.comput... | code_fim | medium | {
"lang": "python",
"repo": "chickert/reinforcement_learning",
"path": "/behavior_cloning/safety_backup_C/C/environment_models/pusher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> S = Sentinel("S")
assert repr(S) == "S"
assert S == S
assert S in {S}
def test_bytesify():
assert bytesify(b"123") == b"123"
assert bytesify(bytearray(b"123")) == b"123"
assert bytesify("123") == b"123"
with pytest.raises(UnicodeEncodeError):
bytesify(u"\u1234")
... | code_fim | hard | {
"lang": "python",
"repo": "Lukasa/h11",
"path": "/h11/tests/test_util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lukasa/h11 path: /h11/tests/test_util.py
import re
import pytest
from .._util import *
def test_ProtocolError():
try:
raise ProtocolError("foo")
except ProtocolError as e:
assert str(e) == "foo"
assert e.error_status_hint == 400
try:
raise ProtocolE... | code_fim | hard | {
"lang": "python",
"repo": "Lukasa/h11",
"path": "/h11/tests/test_util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> span = opentracing.tracer.start_span("custom_sdk_span")
span.set_tag('span.kind', "producer")
span.finish()
span = opentracing.tracer.start_span("custom_sdk_span")
span.set_tag('span.kind', "client")
span.finish()
span = opentracing.tracer.start_sp... | code_fim | hard | {
"lang": "python",
"repo": "datadevx/python-sensor",
"path": "/tests/test_ot_span.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: datadevx/python-sensor path: /tests/test_ot_span.py
import time
import opentracing
from nose.tools import assert_equals
class TestOTSpan:
def setUp(self):
""" Clear all spans before a test run """
recorder = opentracing.tracer.recorder
recorder.clear_spans()
de... | code_fim | hard | {
"lang": "python",
"repo": "datadevx/python-sensor",
"path": "/tests/test_ot_span.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OkunaOrg/okuna-api path: /openbook_common/migrations/0015_auto_20190801_1255.py
# Generated by Django 2.2.3 on 2019-08-01 10:55
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddField(
model_name='... | code_fim | hard | {
"lang": "python",
"repo": "OkunaOrg/okuna-api",
"path": "/openbook_common/migrations/0015_auto_20190801_1255.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='badge',
name='keyword_description_de',
field=models.CharField(blank=True, max_length=64, null=True, unique=True, verbose_name='keyword_description'),
),
migrations.AddField(
model_na... | code_fim | hard | {
"lang": "python",
"repo": "OkunaOrg/okuna-api",
"path": "/openbook_common/migrations/0015_auto_20190801_1255.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Primary phone
primary_ph = [None]
if c[fi] is not None and len(c[fi]) > 0:
primary_ph = c[fi]
fi += 1 # fi = 45
# radio phone, TTY/TDD, Telex, Account, Anniversary, Assistant's name, billing info (skip)
fi += 7 # fi = 52
# Birthday
birthday = [None]
if c[fi... | code_fim | hard | {
"lang": "python",
"repo": "l33tllama/CSVtoVcard",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: l33tllama/CSVtoVcard path: /main.py
import csv, vobject
filename = "contacts.CSV"
delimiter=","
# array get - return empty string if None
def ag(a, i):
if a[i] == None:
return ""
else:
return a[i]
def create_vcard(c):
print c
# field index
fi = 0
# Nam... | code_fim | hard | {
"lang": "python",
"repo": "l33tllama/CSVtoVcard",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>N = 10
start_time = time.time()
for i in range(N):
df = bitstamp.groupby([bitstamp.Datetime.dt.year, bitstamp.Datetime.dt.month]).agg({'Close': 'mean', 'High': 'max'})
exec_time = (time.time() - start_time) / N
print("Processing time: %s s." % exec_time)
task_names = ["Library loading"] + ["File load... | code_fim | hard | {
"lang": "python",
"repo": "RevoltBI/project-julia-meetup",
"path": "/src/bitstamp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RevoltBI/project-julia-meetup path: /src/bitstamp.py
import time
start_time = time.time()
from datetime import datetime
import pandas as pd
lib_load_time = time.time() - start_time
print("Libraries loading time: %s s." % lib_load_time)
<|fim_suffix|>start_time = time.time()
bitstamp['Datetime']... | code_fim | medium | {
"lang": "python",
"repo": "RevoltBI/project-julia-meetup",
"path": "/src/bitstamp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (np.shape(bicycle_area)[0] == 0) or (np.shape(person_area)[0] == 0):
area_diff = -1
area_diff = -1
for i in range(np.shape(bicycle_area)[0]):
try:
area_diff_temp = np.max((np.abs(bicycle_area[i]-person_area[:])))
area_diff = np.max(area_diff_temp... | code_fim | hard | {
"lang": "python",
"repo": "ProWorkNR/snow-cardiac",
"path": "/ukb/weak_supervision/coral/tutorials/primitive_helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def bike_human_size(object_names, object_area):
names = object_names.split(' , ')[1:]
person_area = np.array([0])
bicycle_area = np.array([0])
for i in range(np.shape(names)[0]):
name = names[i]
if ('person' in name) or ('man' in name) or ('woman' in name) or ('gi... | code_fim | hard | {
"lang": "python",
"repo": "ProWorkNR/snow-cardiac",
"path": "/ukb/weak_supervision/coral/tutorials/primitive_helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ProWorkNR/snow-cardiac path: /ukb/weak_supervision/coral/tutorials/primitive_helpers.py
import numpy as np
class PrimitiveObject(object):
def save_primitive_matrix(self,primitive_mtx):
self.primitive_mtx = primitive_mtx
self.discrete_primitive_mtx = primitive_mtx
sel... | code_fim | hard | {
"lang": "python",
"repo": "ProWorkNR/snow-cardiac",
"path": "/ukb/weak_supervision/coral/tutorials/primitive_helpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: papagr/everest path: /everest/url.py
"""
URL <-> resource conversion.
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Jun 28, 2011.
"""
from pyparsing import ParseException
from pyramid.compat import url_unquote
f... | code_fim | hard | {
"lang": "python",
"repo": "papagr/everest",
"path": "/everest/url.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Converts the given filter specification to a CQL filter expression.
"""
registry = get_current_registry()
visitor_cls = registry.getUtility(IFilterSpecificationVisitor,
name=EXPRESSION_KINDS.CQL)
visitor = visito... | code_fim | hard | {
"lang": "python",
"repo": "papagr/everest",
"path": "/everest/url.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antonysama/cdQA path: /cdqa/pipeline/cdqa_sklearn.py
import joblib
import warnings
import pandas as pd
import numpy as np
import torch
from sklearn.base import BaseEstimator
from cdqa.retriever import TfidfRetriever, BM25Retriever
from cdqa.utils.converters import generate_squad_examples
from ... | code_fim | hard | {
"lang": "python",
"repo": "antonysama/cdQA",
"path": "/cdqa/pipeline/cdqa_sklearn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def cuda(self):
""" Send reader to GPU
"""
self.reader.model.cuda()
self.reader.device = torch.device("cuda")
return self
def dump_reader(self, filename):
""" Dump reader model to a .joblib object
"""
self.cpu()
joblib.dump(s... | code_fim | hard | {
"lang": "python",
"repo": "antonysama/cdQA",
"path": "/cdqa/pipeline/cdqa_sklearn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: biolink/kgx path: /kgx/sink/null_sink.py
from typing import Any
from kgx.sink import Sink
class NullSink(Sink):
"""
A NullSink just ignores any date written to it,
effectively a /dev/null device for Transformer
data flows, in which the inspection of the input
knowledge g... | code_fim | hard | {
"lang": "python",
"repo": "biolink/kgx",
"path": "/kgx/sink/null_sink.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def write_edge(self, record) -> None:
"""
Write an edge record to the underlying store.
Parameters
----------
record: Any
An edge record
"""
pass
def finalize(self) -> None:
"""
Operations that ought to be done ... | code_fim | hard | {
"lang": "python",
"repo": "biolink/kgx",
"path": "/kgx/sink/null_sink.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
pass
def finalize(self) -> None:
"""
Operations that ought to be done after
writing all the incoming data should be called
by this method.
"""
pass<|fim_prefix|># repo: biolink/kgx path: /kgx/sink/null_sink.py
from typing import An... | code_fim | hard | {
"lang": "python",
"repo": "biolink/kgx",
"path": "/kgx/sink/null_sink.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def change_int(_values):
#转换为int型
match_re = re.match(".*?(\d+).*",_values)
if match_re:
nums = int(match_re.group(1))
else:
nums = 0
return nums
class BeihuaItemLoader(ItemLoader):
#自定义itemloader
default_output_processor = TakeFirst()
class BeihuaItem(scrapy.... | code_fim | medium | {
"lang": "python",
"repo": "ericliu1973/tiebaspider",
"path": "/tieba/items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ericliu1973/tiebaspider path: /tieba/items.py
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy import Field
from scrapy.loader import ItemLoader
from scrapy.loader.proc... | code_fim | hard | {
"lang": "python",
"repo": "ericliu1973/tiebaspider",
"path": "/tieba/items.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def MakeStressStrainPlot(s_test, e_test, s_full, e_full, e_pred , inc):
fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot(e_test, s_test, 's',c='blue',alpha=0.75)
axt=ax.twinx()
#axt.plot(e_test, d_test, 's',c='red' ,alpha=0.75)
ax.plot(e_full, s_full, '-' ,c='blue')
#axt.plot(e... | code_fim | hard | {
"lang": "python",
"repo": "PapStatMechMat/SeaPy",
"path": "/Tutorials/RunSEAmodes.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ####Plotting
fig2=plt.figure()
ax2=fig2.add_subplot(111)
ax2.plot(Sig,'s',markersize=20)
ax2.set_xlabel('index '+r'$j$')
ax2.set_ylabel(r'$\varsigma_j$')
ax2.set_xlim((-0.2,r))
fig2.tight_layout()
fig2.savefig('Fig5_SV.png',bbox_inches='tight', pad_inches = 0, transpare... | code_fim | hard | {
"lang": "python",
"repo": "PapStatMechMat/SeaPy",
"path": "/Tutorials/RunSEAmodes.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PapStatMechMat/SeaPy path: /Tutorials/RunSEAmodes.py
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from numpy import dot, multiply, diag, power,ones,average
from scipy.signal import convolve2d
from numpy import pi, exp, sin, co... | code_fim | hard | {
"lang": "python",
"repo": "PapStatMechMat/SeaPy",
"path": "/Tutorials/RunSEAmodes.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stdiorion/competitive-programming path: /contests_atcoder/abc192/abc192_d.py
x = input()
m = int(input())
d = 0
for y in x:
d = max(d, int(y))
def base(x, n):
res = 0
for i, y in enumerate(x[::-1]):
res += int(y) * n ** i
return res
def okay(n):
return base(x, n) <=... | code_fim | medium | {
"lang": "python",
"repo": "stdiorion/competitive-programming",
"path": "/contests_atcoder/abc192/abc192_d.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if okay(mid):
ok = mid
else:
ng = mid
return ok
if len(x) == 1:
if int(x) > m:
print(0)
else:
print(1)
else:
if not okay(d + 1):
print(0)
else:
print(meguru... | code_fim | medium | {
"lang": "python",
"repo": "stdiorion/competitive-programming",
"path": "/contests_atcoder/abc192/abc192_d.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ymw = ymbpw[bra_criterion & hs_criterion]
ymw = ymw.groupby(['year','month','wld_id']).sum()
return [ymb, ymbp, ymbw, ymp, ympw, ymw]<|fim_prefix|># repo: DataViva/dataviva-scripts path: /scripts/secex_monthly/_shard.py
def shard(ymbpw):
ymbpw = ymbpw.reset_index()
bra_crite... | code_fim | medium | {
"lang": "python",
"repo": "DataViva/dataviva-scripts",
"path": "/scripts/secex_monthly/_shard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataViva/dataviva-scripts path: /scripts/secex_monthly/_shard.py
def shard(ymbpw):
ymbpw = ymbpw.reset_index()
bra_criterion = ymbpw.bra_id.map(lambda x: len(x) == 9)
hs_criterion = ymbpw.hs_id.map(lambda x: len(x) == 6)
wld_criterion = ymbpw.wld_id.map(lambda x: len(x) == 5)... | code_fim | medium | {
"lang": "python",
"repo": "DataViva/dataviva-scripts",
"path": "/scripts/secex_monthly/_shard.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cerebrumaize/leetcode path: /312.burst.balloons/3.py
#!/usr/bin/env python
'''code description'''
# pylint: disable = I0011, E0401, C0103, C0321
class Solution(object):
'''Solution description'''
def maxCoins(self, nums):
'''Solution function description'''
nums=[1]+nums+... | code_fim | medium | {
"lang": "python",
"repo": "cerebrumaize/leetcode",
"path": "/312.burst.balloons/3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for interval in range(2,n):
for start in range(n-interval):
end=start+interval
ans[start][end]=max([nums[start]*nums[mid]*nums[end]+ans[start][mid]+ans[mid][end] for mid in range(start+1,end)])
return ans[0][n-1]
def main():
'''main function... | code_fim | medium | {
"lang": "python",
"repo": "cerebrumaize/leetcode",
"path": "/312.burst.balloons/3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaddlePaddle/PaddleHelix path: /apps/molecular_generation/JT_VAE/sample.py
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# 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 co... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PaddleHelix",
"path": "/apps/molecular_generation/JT_VAE/sample.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>res = []
for i in range(args.nsample):
smi = model.sample_prior()
print(i, smi)
res.append(smi)
with open(args.output, 'w')as f:
for smi in res:
f.write(smi + '\n')<|fim_prefix|># repo: PaddlePaddle/PaddleHelix path: /apps/molecular_generation/JT_VAE/sample.py
# Copyright (c) 20... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PaddleHelix",
"path": "/apps/molecular_generation/JT_VAE/sample.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # for a large part a cloen of Wij Amsterdam test
test_path = os.path.dirname(__file__)
file_path = os.path.join(test_path, "test_responses", "nlvoorelkaar_supply.html")
with open(file_path, 'r') as data_file:
self.response = data_file.read()
scraper = N... | code_fim | medium | {
"lang": "python",
"repo": "wkoot/helpradar",
"path": "/src/tests/test_nlvoorelkaar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wkoot/helpradar path: /src/tests/test_nlvoorelkaar.py
import os
from unittest import TestCase
import pytest
import requests_mock
from bs4 import BeautifulSoup
from models import InitiativeImport
from platformen.nlvoorelkaar import NLvoorElkaarSource, NLvoorElkaar
<|fim_suffix|> def test_de... | code_fim | hard | {
"lang": "python",
"repo": "wkoot/helpradar",
"path": "/src/tests/test_nlvoorelkaar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert self.actual.description.startswith("Naast het schrijven van mijn scriptie zou ik graag mensen helpen")
def test_alternative_place_regex(self):
assert self.actual.location == "Amstelveen"
@pytest.mark.skip(reason="Test methods for debugging specific items")
def test_mis... | code_fim | hard | {
"lang": "python",
"repo": "wkoot/helpradar",
"path": "/src/tests/test_nlvoorelkaar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sql = """INSERT INTO reco_config
(RUN_ID, PRIMDS_ID, DO_RECO, RECO_SPLIT, WRITE_RECO, WRITE_DQM,
WRITE_AOD, WRITE_MINIAOD, WRITE_NANOAOD, PROC_VERSION, ALCA_SKIM, PHYSICS_SKIM,
DQM_SEQ, CMSSW_ID, MULTICORE, SCRAM_ARCH, GLOBAL_TAG)
... | code_fim | hard | {
"lang": "python",
"repo": "dmwm/T0",
"path": "/src/python/T0/WMBS/Oracle/RunConfig/InsertRecoConfig.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
sql = """INSERT INTO reco_config
(RUN_ID, PRIMDS_ID, DO_RECO, RECO_SPLIT, WRITE_RECO, WRITE_DQM,
WRITE_AOD, WRITE_MINIAOD, WRITE_NANOAOD, PROC_VERSION, ALCA_SKIM, PHYSICS_SKIM,
DQM_SEQ, CMSSW_ID, MULTICORE, SCRAM_ARCH, GLOBAL_TAG)
... | code_fim | hard | {
"lang": "python",
"repo": "dmwm/T0",
"path": "/src/python/T0/WMBS/Oracle/RunConfig/InsertRecoConfig.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmwm/T0 path: /src/python/T0/WMBS/Oracle/RunConfig/InsertRecoConfig.py
"""
_InsertRecoConfig_
Oracle implementation of InsertRecoConfig
"""
from WMCore.Database.DBFormatter import DBFormatter
class InsertRecoConfig(DBFormatter):
<|fim_suffix|>
sql = """INSERT INTO reco_config
... | code_fim | hard | {
"lang": "python",
"repo": "dmwm/T0",
"path": "/src/python/T0/WMBS/Oracle/RunConfig/InsertRecoConfig.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pasqualguerrero/telegrampy path: /telegrampy/tests/test_utils.py
import os
from unittest import TestCase
from telegrampy import utils
from telegrampy.exceptions import MissingTelegramBotToken, MissingTelegramChatId
class TestUtils(TestCase):
def test_get_telegram_bot_token(self):
<|fim_su... | code_fim | hard | {
"lang": "python",
"repo": "pasqualguerrero/telegrampy",
"path": "/telegrampy/tests/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
with self.assertRaises(MissingTelegramChatId):
utils.get_telegram_chat_id()
os.environ["TELEGRAM_CHAT_ID"] = "foo_chat_id"
chat_id = utils.get_telegram_chat_id()
self.assertEqual(chat_id, "foo_chat_id")<|fim_prefix|># repo: pasqualguerrero/telegrampy path: /... | code_fim | hard | {
"lang": "python",
"repo": "pasqualguerrero/telegrampy",
"path": "/telegrampy/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.assertRaises(MissingTelegramBotToken):
utils.get_telegram_bot_token()
os.environ["TELEGRAM_BOT_TOKEN"] = "foo_token"
token = utils.get_telegram_bot_token()
self.assertEqual(token, "foo_token")
def test_get_telegram_chat_id(self):
with s... | code_fim | medium | {
"lang": "python",
"repo": "pasqualguerrero/telegrampy",
"path": "/telegrampy/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lfamarantine/Baruch-CIS-2300 path: /classwork/10_28_2020 (classwork).py
# In-class exercise
# input a number, iterate 5 times, and g<|fim_suffix|>
total += num
print("Total:", total)
main()<|fim_middle|>et running total;
def main():
total = 0
for _ in range(5):
nu... | code_fim | medium | {
"lang": "python",
"repo": "lfamarantine/Baruch-CIS-2300",
"path": "/classwork/10_28_2020 (classwork).py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.