text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> LOGGERS.clear()
def test_bad_log_dir():
"""
test bad log dir warning and converstion to stream logger
"""
with pytest.warns(LoggerWarning):
log_file = '/abc/log.log'
logger = init_logger(__name__, log_file=log_file)
assert len(logger.handlers) == 1
... | code_fim | hard | {
"lang": "python",
"repo": "NREL/rex",
"path": "/tests/test_logging.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NREL/rex path: /tests/test_logging.py
# -*- coding: utf-8 -*-
"""
pytests for logging methodology
"""
import os
import pytest
import tempfile
from rex.utilities.exceptions import LoggerWarning
from rex.utilities.loggers import (init_logger, LOGGERS, add_handlers,
... | code_fim | hard | {
"lang": "python",
"repo": "NREL/rex",
"path": "/tests/test_logging.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: avast/retdec path: /scripts/type_extractor/type_extractor/lti_types.py
"""Dictionary of types used in headers and types for lti."""
LTI_TYPES = {
# default C types and some typedefs
'__int64': 'i64',
'bool': 'i1',
'double': 'double',
'long double': 'double',
'float': 'flo... | code_fim | hard | {
"lang": "python",
"repo": "avast/retdec",
"path": "/scripts/type_extractor/type_extractor/lti_types.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # modifiers
'*': '*',
'const': '',
'signed': '',
'unsigned': '',
# specials
'_In_': '',
'_In_opt_': '',
'_Inout_': 'OUT ',
'_Inout_opt_': 'OUT ',
'_Out_': 'OUT ',
'_Out_opt_': 'OUT ',
'_Reserved_': '',
# structs
'struct': '%struct.',
}<|fim_prefi... | code_fim | hard | {
"lang": "python",
"repo": "avast/retdec",
"path": "/scripts/type_extractor/type_extractor/lti_types.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: numpy/numpy path: /numpy/matrixlib/defmatrix.pyi
from collections.abc import Sequence, Mapping
from typing import Any
from numpy import matrix as matrix
from numpy._typing import ArrayLike, DTypeLike, NDArray
<|fim_suffix|>def bmat(
obj: str | Sequence[ArrayLike] | NDArray[Any],
ldict: N... | code_fim | easy | {
"lang": "python",
"repo": "numpy/numpy",
"path": "/numpy/matrixlib/defmatrix.pyi",
"mode": "psm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|>def asmatrix(data: ArrayLike, dtype: DTypeLike = ...) -> matrix[Any, Any]: ...
mat = asmatrix<|fim_prefix|># repo: numpy/numpy path: /numpy/matrixlib/defmatrix.pyi
from collections.abc import Sequence, Mapping
from typing import Any
from numpy import matrix as matrix
from numpy._typing import ArrayLike,... | code_fim | medium | {
"lang": "python",
"repo": "numpy/numpy",
"path": "/numpy/matrixlib/defmatrix.pyi",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adafruit/Adafruit_CircuitPython_CircuitPlayground path: /examples/circuitplayground_advanced_examples/circuitplayground_gravity_pulls_pixel.py
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""Gravity Pulls Pixel
This program uses the Circuit Playg... | code_fim | hard | {
"lang": "python",
"repo": "adafruit/Adafruit_CircuitPython_CircuitPlayground",
"path": "/examples/circuitplayground_advanced_examples/circuitplayground_gravity_pulls_pixel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
cp.pixels.brightness = 0.1 # Adjust overall brightness as desired, between 0 and 1
pixel_positions = compute_pixel_angles()
while True:
debug = cp.switch # True is toward the left
accel_x, accel_y = cp.acceleration[:2] # Ignore z
down_angle = positive_degrees(angle_in_degrees(accel_x, acc... | code_fim | hard | {
"lang": "python",
"repo": "adafruit/Adafruit_CircuitPython_CircuitPlayground",
"path": "/examples/circuitplayground_advanced_examples/circuitplayground_gravity_pulls_pixel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> list_attr_celeba_txt = os.path.join(cfg['root'], 'CelebA', 'Anno', 'list_attr_celeba.txt')
df = pd.read_csv(list_attr_celeba_txt, delim_whitespace=True, header=None)
df.columns = ["File", "5_o_Clock_Shadow", "Arched_Eyebrows", "Attractive", "Bags_Under_Eyes", "Bald", "Bangs",
... | code_fim | hard | {
"lang": "python",
"repo": "lucasxlu/MMNet",
"path": "/data/datasets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lucasxlu/MMNet path: /data/datasets.py
from skimage.color import gray2rgb
import torch
from torch.utils.data.sampler import SubsetRandomSampler
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
sys.path.append('../')
from config.cfg import cfg
class Ra... | code_fim | hard | {
"lang": "python",
"repo": "lucasxlu/MMNet",
"path": "/data/datasets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return sample
class UTKFaceDataset(Dataset):
"""
UTKFace dataset
"""
def __init__(self, train=True, transform=None):
files = os.listdir(os.path.join(cfg['root'], 'UTKFace'))
ages = [int(fname.split("_")[0]) for fname in files]
train_files, test_files, tr... | code_fim | hard | {
"lang": "python",
"repo": "lucasxlu/MMNet",
"path": "/data/datasets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>system("ccx element")
os.system("cgx -b post-n.fbd")
os.system("cgx -b post-e.fbd")<|fim_prefix|># repo: larsmei/CalculiX-Examples path: /Linear/Separate/test.py
#!/usr/bin/python
import os
os.system("c<|fim_middle|>gx -b pre.fbd")
os.system("ccx nodal")
os. | code_fim | easy | {
"lang": "python",
"repo": "larsmei/CalculiX-Examples",
"path": "/Linear/Separate/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: larsmei/CalculiX-Examples path: /Linear/Separate/test.py
#!/usr/bin/python
import os
os.system("c<|fim_suffix|>ost-n.fbd")
os.system("cgx -b post-e.fbd")<|fim_middle|>gx -b pre.fbd")
os.system("ccx nodal")
os.system("ccx element")
os.system("cgx -b p | code_fim | medium | {
"lang": "python",
"repo": "larsmei/CalculiX-Examples",
"path": "/Linear/Separate/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='queue',
name='value',
),
migrations.RemoveField(
model_name='ticketpriority',
name='value',
),
]<|fim_prefix|># repo: KerkhoffTechnologies/django-autotask path: /djau... | code_fim | medium | {
"lang": "python",
"repo": "KerkhoffTechnologies/django-autotask",
"path": "/djautotask/migrations/0009_auto_20190920_1648.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KerkhoffTechnologies/django-autotask path: /djautotask/migrations/0009_auto_20190920_1648.py
# Generated by Django 2.1.11 on 2019-09-20 16:48
from django.db import migrations
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='queue',
name='valu... | code_fim | medium | {
"lang": "python",
"repo": "KerkhoffTechnologies/django-autotask",
"path": "/djautotask/migrations/0009_auto_20190920_1648.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('lw2', '0003_auto_20180909_0727'),
]
operations = [
migrations.AddField(
model_name='post',
name='slug',
field=models.CharField(default='test', max_length=60),
preserve_default=False,
),
migrati... | code_fim | medium | {
"lang": "python",
"repo": "JD-P/accordius",
"path": "/lw2/migrations/0004_auto_20180909_2314.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('lw2', '0003_auto_20180909_0727'),
]
operations = [
migrations.AddField(
model_name='post',
name='slug',
field=models.CharField(default='test', max_length=60),
preserve_default=False,
),
migratio... | code_fim | medium | {
"lang": "python",
"repo": "JD-P/accordius",
"path": "/lw2/migrations/0004_auto_20180909_2314.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JD-P/accordius path: /lw2/migrations/0004_auto_20180909_2314.py
# Generated by Django 2.1.1 on 2018-09-09 23:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|> operations = [
migrations.AddField(
mo... | code_fim | medium | {
"lang": "python",
"repo": "JD-P/accordius",
"path": "/lw2/migrations/0004_auto_20180909_2314.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MovElb/Ann path: /src/model/bertynet/BatchGen.py
import random
class BatchGen:
"""Batch generator class which can be used either for training or inference.
"""
def __init__(self, data, batch_size, evaluation=False):
"""
Args:
data (list of lists): raw p... | code_fim | hard | {
"lang": "python",
"repo": "MovElb/Ann",
"path": "/src/model/bertynet/BatchGen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __len__(self):
return len(self.data) // self.batch_size
def __iter__(self):
"""
Yields:
batch (list of lists): len(batch) <= batch_size (may be less for last batch). Contains following data:
[0] - context_ids
[1] - context_t... | code_fim | hard | {
"lang": "python",
"repo": "MovElb/Ann",
"path": "/src/model/bertynet/BatchGen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jeromeyoung/wLogger path: /webServer/divers/mysql.py
# coding=UTF-8
from flask import Response,current_app,request,session
from sqlalchemy import text
from webServer.customer import Func,ApiCorsResponse
import json,time,datetime
# 自定义mysql 数据获取class
class MysqlDb():
today = time.strftime(... | code_fim | hard | {
"lang": "python",
"repo": "Jeromeyoung/wLogger",
"path": "/webServer/divers/mysql.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def get_request_num_by_status(cls):
with current_app.db.connect() as cursor:
sql = text("""
select count(*) as total_num,`status_code` from {0}
where `timestamp` >= UNIX_TIMESTAMP(:today) and `status_code` != 200
... | code_fim | hard | {
"lang": "python",
"repo": "Jeromeyoung/wLogger",
"path": "/webServer/divers/mysql.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if not request.args.get('code'):
return ApiCorsResponse.response('缺少code参数', False)
with current_app.db.connect() as cursor:
sql = text("""
select count(*) as total_num,`request_url` from {0}
where FROM_UNIXTIME(`times... | code_fim | hard | {
"lang": "python",
"repo": "Jeromeyoung/wLogger",
"path": "/webServer/divers/mysql.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_sulphur.py
#calss header
class _SULPHUR():
def __init__(self,):
<|fim_suffix|>
self.specie = 'nouns'
def run(self, obj1 = [], obj2 = []):
return self.jsondata<|fim_middle|> self.name = "SULPHUR"
self.definitions = [u'a pale yellow chemic... | code_fim | hard | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_sulphur.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomway777/datalineage path: /parsing.py
from database import connection
import re
# import parser
from tools import spliters
sql_query = '''SELECT ROUTINE_SCHEMA as sch, SPECIFIC_NAME as sp_name,
ROUTINE_TYPE, ROUTINE_BODY, ROUTINE_DEFINITION as `sql`,
SQL_DATA... | code_fim | medium | {
"lang": "python",
"repo": "tomway777/datalineage",
"path": "/parsing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Splitting comment and cleaning data
for k,v in ndict.items():
if k == 'sp_body':
nls = []
for i in v:
nls.append(spt.reformat(i))
ndict[k] = nls
## Split data using space and dot
print(ndict['sp_body'][1])<|fim_prefix|># repo: tomway777/datalineage path: /parsin... | code_fim | hard | {
"lang": "python",
"repo": "tomway777/datalineage",
"path": "/parsing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cxdcxd/chainer-gqn path: /experiments/shepard_metzler/predictions.py
import argparse
import math
import os
import random
import sys
import time
import chainer
import chainer.functions as cf
import cupy as cp
import matplotlib.pyplot as plt
import numpy as np
from chainer.backends import cuda
sy... | code_fim | hard | {
"lang": "python",
"repo": "cxdcxd/chainer-gqn",
"path": "/experiments/shepard_metzler/predictions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> query_viewpoints = xp.array(
(
camera_direction[0],
camera_direction[1],
camera_direction[2],
math.cos(yaw),
... | code_fim | hard | {
"lang": "python",
"repo": "cxdcxd/chainer-gqn",
"path": "/experiments/shepard_metzler/predictions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> generated_images = model.generate_image(
query_viewpoints, representation)[0]
yi_start = pitch_loop * image_height
yi_end = (pitch_loop + 1) * image_height
xi_start = yaw_loop * ima... | code_fim | hard | {
"lang": "python",
"repo": "cxdcxd/chainer-gqn",
"path": "/experiments/shepard_metzler/predictions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #we can use for loops to iterate through a variable
for i in range(n): #i in range [0,n-1]
y[i] = 2.0 * float(i) + 1.0 #set y = 2i+1
#we can iterate through the y elements one by one
for y_element in y:
print(y_element)
#execute the main function
if __name__ == "__main__":
main()<|fim_prefix|... | code_fim | medium | {
"lang": "python",
"repo": "Merlin1908/astr-119-hw-1",
"path": "/astr-119-hw-1/variables_and_loops.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #we can use nu,py to quickly make arrays
y= np.zeros(n,dtype=float) #declares 10 zeros
#we can use for loops to iterate through a variable
for i in range(n): #i in range [0,n-1]
y[i] = 2.0 * float(i) + 1.0 #set y = 2i+1
#we can iterate through the y elements one by one
for y_element in y:
... | code_fim | medium | {
"lang": "python",
"repo": "Merlin1908/astr-119-hw-1",
"path": "/astr-119-hw-1/variables_and_loops.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Merlin1908/astr-119-hw-1 path: /astr-119-hw-1/variables_and_loops.py
import numpy as np #we use numpy for lots of things
def main():
i = 0 #declare i equal to 0
n = 10 #declare n equal to 10
x = 119.0 #float x, these have a .
#we can use nu,py to quickly make arrays
y= np.zeros(n,dtype=... | code_fim | medium | {
"lang": "python",
"repo": "Merlin1908/astr-119-hw-1",
"path": "/astr-119-hw-1/variables_and_loops.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeachSword/LINE-DemoS-Bot path: /createLineAtAndVerify.py
from DeachSword.linepy import *
from DeachSword.LINEBASE import ttypes
import requests, json, time, os, string, random
def randstr(n):
random_str = ''.join([random.choice(string.ascii_letters + string.digits) for i in range(n)])
r... | code_fim | hard | {
"lang": "python",
"repo": "DeachSword/LINE-DemoS-Bot",
"path": "/createLineAtAndVerify.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> res = requests.post(host + endpoint, data=json.dumps(payload), headers=header)
accessPermissions(channelId, AuthToken)
return accessToken
createOA()
def accessPermissions(channelId, AuthToken):
url = 'https://access.line.me/dialog/api/permissions'
payload = {
"on": [
... | code_fim | hard | {
"lang": "python",
"repo": "DeachSword/LINE-DemoS-Bot",
"path": "/createLineAtAndVerify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> description = self.get_snapshot_description()
snapshot = self._raw.create_snapshot(
Description=description,
TagSpecifications=[
{
'ResourceType': 'snapshot',
'Tags': [
{'Key': 'Name', '... | code_fim | hard | {
"lang": "python",
"repo": "guenbakku/ebsant",
"path": "/core/volume.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guenbakku/ebsant path: /core/volume.py
# coding: utf-8
import utils
from snapshot import Snapshot
class Volume(object):
''' Represent Volume class '''
_config = {
'target_tag': 'ebsant',
}
def __init__(self, ec2, raw):
''' Instance constructor
Agrs:
... | code_fim | hard | {
"lang": "python",
"repo": "guenbakku/ebsant",
"path": "/core/volume.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uva-slp/pico path: /docker/pico/secrets.py
# Database info
DB_NAME = 'pico'
DB_USER = 'pico'
DB_PASS = 'password'
# Server email inf<|fim_suffix|>RT = 0
EMAIL_HOST_PASSWORD = ''
# secret key<|fim_middle|>o
SERVER_EMAIL = ''
EMAIL_HOST = ''
EMAIL_PO | code_fim | easy | {
"lang": "python",
"repo": "uva-slp/pico",
"path": "/docker/pico/secrets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>RT = 0
EMAIL_HOST_PASSWORD = ''
# secret key<|fim_prefix|># repo: uva-slp/pico path: /docker/pico/secrets.py
# Database info
DB_NAME = 'pico'
DB_USER = 'p<|fim_middle|>ico'
DB_PASS = 'password'
# Server email info
SERVER_EMAIL = ''
EMAIL_HOST = ''
EMAIL_PO | code_fim | medium | {
"lang": "python",
"repo": "uva-slp/pico",
"path": "/docker/pico/secrets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uva-slp/pico path: /docker/pico/secrets.py
# Database info
DB_NAME = 'pico'
DB_USER = 'p<|fim_suffix|>RT = 0
EMAIL_HOST_PASSWORD = ''
# secret key<|fim_middle|>ico'
DB_PASS = 'password'
# Server email info
SERVER_EMAIL = ''
EMAIL_HOST = ''
EMAIL_PO | code_fim | medium | {
"lang": "python",
"repo": "uva-slp/pico",
"path": "/docker/pico/secrets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def from_dict(dict):
"""
A convenience method that directly creates a new instance from a passed dictionary (that probably came from a
JSON response from the server.
"""
return SIO_SDC(**dict)<|fim_prefix|># repo: keerthanabs1/scaleio-py path:... | code_fim | hard | {
"lang": "python",
"repo": "keerthanabs1/scaleio-py",
"path": "/scaleiopy/api/scaleio/mapping/sdc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keerthanabs1/scaleio-py path: /scaleiopy/api/scaleio/mapping/sdc.py
# Imports
# Project imports
from scaleiopy.api.scaleio.mapping.sio_generic_object import SIO_Generic_Object
from scaleiopy.api.scaleio.mapping.link import SIO_Link
<|fim_suffix|> def __init__(self,
id=None,
... | code_fim | hard | {
"lang": "python",
"repo": "keerthanabs1/scaleio-py",
"path": "/scaleiopy/api/scaleio/mapping/sdc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.id = id
self.name = name
self.mdmConnectionState = mdmConnectionState
self.sdcIp = sdcIp
self.guid = sdcGuid
self.links = []
for link in links:
self.links.append(SIO_Link(link['href'], link['rel']))
@staticmethod
def from_di... | code_fim | hard | {
"lang": "python",
"repo": "keerthanabs1/scaleio-py",
"path": "/scaleiopy/api/scaleio/mapping/sdc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i, pf in enumerate(plotfiles):
ds = CastroDataset(pf)
ds.add_field(("gas", "ash"), function=_ash, display_name="ash", units="(dimensionless)", sampling_type="cell")
field = "ash"
sp = yt.SlicePlot(ds, "theta", field, center=[xctr, yctr, 0.0*cm], width=[L_x, L_y, ... | code_fim | hard | {
"lang": "python",
"repo": "AMReX-Astro/Castro",
"path": "/Exec/science/flame_wave/analysis/ash_timeseries.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AMReX-Astro/Castro path: /Exec/science/flame_wave/analysis/ash_timeseries.py
#!/usr/bin/env python3
import argparse
import os
import re
import sys
from functools import reduce
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import ImageGrid
imp... | code_fim | hard | {
"lang": "python",
"repo": "AMReX-Astro/Castro",
"path": "/Exec/science/flame_wave/analysis/ash_timeseries.py",
"mode": "psm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.logger.debug('Calling cavities')
traceback = None
cavities_list = []
tf_health, traceback = self._tf_health(force=False)
cavities = tf_health.get('cavities', {})
for cavity_name, cavity in cavities.items():
cavity['name'] = cavity_name
... | code_fim | hard | {
"lang": "python",
"repo": "davidvoler/ate_meteor",
"path": "/xmlrpc/server_process_base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidvoler/ate_meteor path: /xmlrpc/server_process_base.py
import xmlrpclib
from tornado.options import options
from ate_logger import AteLogger
class BaseXmlRpcProcess(object):
def __init__(self):
self.logger = AteLogger('XmlRpcProcess')
self._tf_status = False
def st... | code_fim | hard | {
"lang": "python",
"repo": "davidvoler/ate_meteor",
"path": "/xmlrpc/server_process_base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def cavities(self):
self.logger.debug('Calling cavities')
traceback = None
cavities_list = []
tf_health, traceback = self._tf_health(force=False)
cavities = tf_health.get('cavities', {})
for cavity_name, cavity in cavities.items():
cavity['na... | code_fim | hard | {
"lang": "python",
"repo": "davidvoler/ate_meteor",
"path": "/xmlrpc/server_process_base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(0,len(cls.indexes)):
if function<=cls.indexes[i]:
return cls.classes[i].execute(function-last,connection0,connection1,parameter0,parameter1,parameter2,gabor_filter_frequency,gabor_filter_orientation)
last = cls.indexes[i]<|fim_prefix|># repo: ... | code_fim | hard | {
"lang": "python",
"repo": "julienbiau/CGP-IP",
"path": "/cgpip/functions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: julienbiau/CGP-IP path: /cgpip/functions.py
import random
class Functions:
# Function Int
# Connection 0 Int
# Connection 1 Int
# Parameter 0 Real no limitation
# Parameter 1 Int [−16, +16]
# Parameter 2 Int [−16, +16]
# Gabor Filter Frequ. Int [0, 16]
# Gabor Fi... | code_fim | hard | {
"lang": "python",
"repo": "julienbiau/CGP-IP",
"path": "/cgpip/functions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> last = 0
function -= cls.outside_nb_functions
for i in range(0,len(cls.indexes)):
if function<=cls.indexes[i]:
return cls.classes[i].execute(function-last,connection0,connection1,parameter0,parameter1,parameter2,gabor_filter_frequency,gabor_filter_orien... | code_fim | hard | {
"lang": "python",
"repo": "julienbiau/CGP-IP",
"path": "/cgpip/functions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def write_to_csv(data: List[dict], filepath: Path):
header = data[0].keys()
with filepath.open('w') as fp:
writer = csv.DictWriter(fp, header, quoting=csv.QUOTE_MINIMAL)
writer.writeheader()
writer.writerows(data)
def main():
parser = argparse.ArgumentParser(descr... | code_fim | hard | {
"lang": "python",
"repo": "pddg/gnu-make-exercise",
"path": "/ex03/gen_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pddg/gnu-make-exercise path: /ex03/gen_data.py
import argparse
import csv
from pathlib import Path
from typing import List
from mimesis import schema
def generate_data_set(num: int) -> List[dict]:
<|fim_suffix|>def main():
parser = argparse.ArgumentParser(description="Test data generator")... | code_fim | hard | {
"lang": "python",
"repo": "pddg/gnu-make-exercise",
"path": "/ex03/gen_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
parser = argparse.ArgumentParser(description="Test data generator")
parser.add_argument("filename",
type=Path,
help="Path to output file name")
parser.add_argument("-n",
"--number",
type... | code_fim | hard | {
"lang": "python",
"repo": "pddg/gnu-make-exercise",
"path": "/ex03/gen_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qw85639229/Car_License_SVM path: /OCR_For_Car_License/chinese_template_generate.py
import cv2
import os
import numpy as np
template_path = './data/Chinese_Template'
templates = os.listdir(template_path)
chinese_chars = [x.split('.')[0] for x in templates]
template_imgs = []
for c in templates:
... | code_fim | hard | {
"lang": "python",
"repo": "qw85639229/Car_License_SVM",
"path": "/OCR_For_Car_License/chinese_template_generate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # cv2.imshow('otsu', cropped_otsu_img)
# cv2.waitKey(0)
cropped_otsu_img = cv2.resize(cropped_otsu_img, (100, 100))
cv2.imwrite('./data/chinese_template_process/%s.jpg' % chinese_chars[j], cropped_otsu_img)<|fim_prefix|># repo: qw85639229/Car_License_SVM path: /OCR_For_Car_License/chines... | code_fim | hard | {
"lang": "python",
"repo": "qw85639229/Car_License_SVM",
"path": "/OCR_For_Car_License/chinese_template_generate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # calculates the mean correlations for all images in the img_folders into a list
corrs_means = []
corrs_quantiles = []
corrs_vars = []
for img_folder in img_folders:
img_dir = os.path.join(dir, img_folder)
corrs_folder = os.path.join(img_dir, 'corrs', method)
... | code_fim | hard | {
"lang": "python",
"repo": "heysoos/cppn-tensorflow",
"path": "/visualize_natimg_correlations.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: heysoos/cppn-tensorflow path: /visualize_natimg_correlations.py
import numpy as np
import os
import sampler
import pickle
from operator import itemgetter
import matplotlib.pyplot as plt
from matplotlib import colors
from orderedset import OrderedSet
import scipy.stats
from p_tqdm import p_map
de... | code_fim | hard | {
"lang": "python",
"repo": "heysoos/cppn-tensorflow",
"path": "/visualize_natimg_correlations.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # calculate correlation means
corrs = np.nan_to_num(corrs) # set nan correlations to 0
folder_corrs_means.append(np.mean(corrs, axis=0))
folder_corrs_quantiles.append(
(np.quantile(corrs, 0.25, axis=0),
np.quantile(corrs, ... | code_fim | hard | {
"lang": "python",
"repo": "heysoos/cppn-tensorflow",
"path": "/visualize_natimg_correlations.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> _version_prefix = "rbac.authorization.k8s.io/"
class Storage(KubernetesBaseObject):
_version_prefix = "storage.k8s.io/"
class Authentication(KubernetesBaseObject):
_version_prefix = "authentication.k8s.io/"
class Authorization(KubernetesBaseObject):
_version_prefix = "authorizatio... | code_fim | hard | {
"lang": "python",
"repo": "Maxiimeeb/avionix",
"path": "/avionix/kube/base_objects.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Maxiimeeb/avionix path: /avionix/kube/base_objects.py
"""
Classes making up the main interfaces for other Kubernetes classes
"""
from typing import Optional
from avionix.options import DEFAULTS
from avionix.yaml.yaml_handling import HelmYaml
class KubernetesBaseObject(HelmYaml):
"""
B... | code_fim | hard | {
"lang": "python",
"repo": "Maxiimeeb/avionix",
"path": "/avionix/kube/base_objects.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>Agent.train(max_step=1500000, render=False, verbose=0,record_ep_inter=100)
Agent.test(max_step=10000, render=True, verbose=2)<|fim_prefix|># repo: maccoyhaha/Torch-rl path: /Torch_rl/example/RUN_Pendulum_with_batch_PPO.py
import gym
import time
from Torch_rl import Batch_PPO
from Torch_rl.model.Network i... | code_fim | hard | {
"lang": "python",
"repo": "maccoyhaha/Torch-rl",
"path": "/Torch_rl/example/RUN_Pendulum_with_batch_PPO.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maccoyhaha/Torch-rl path: /Torch_rl/example/RUN_Pendulum_with_batch_PPO.py
import gym
import time
from Torch_rl import Batch_PPO
from Torch_rl.model.Network import DenseNet
from torch import nn
#%%
envID ="Pendulum-v0"
env = gym.make(envID)
<|fim_suffix|>Agent = Batch_PPO(env, policy_model, val... | code_fim | hard | {
"lang": "python",
"repo": "maccoyhaha/Torch-rl",
"path": "/Torch_rl/example/RUN_Pendulum_with_batch_PPO.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "Hello, World!"<|fim_prefix|># repo: petriashev/Abstract-Rest-Service-Benchmark path: /python-flask/app.py
import logging
from flask import Flask
app = Flask(__name__)
app.logger.disabled = True
log = logging.getLogger('werkzeug')
log.disabled = True
<|fim_middle|>@app.route("/api/test")... | code_fim | easy | {
"lang": "python",
"repo": "petriashev/Abstract-Rest-Service-Benchmark",
"path": "/python-flask/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petriashev/Abstract-Rest-Service-Benchmark path: /python-flask/app.py
import logging
from flask import Flask
<|fim_suffix|>@app.route("/api/test")
def hello():
return "Hello, World!"<|fim_middle|>app = Flask(__name__)
app.logger.disabled = True
log = logging.getLogger('werkzeug')
log.disa... | code_fim | medium | {
"lang": "python",
"repo": "petriashev/Abstract-Rest-Service-Benchmark",
"path": "/python-flask/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#This method queries all puppies by ascending weight
def selectFatPuppies():
s = select([Puppy]).\
order_by("Puppy.weight")
results = session.execute(s)
print 'selectFatPuppies:'
print '-----------------'
print str(s)
for result in results:
print 'Weight: ',result.weight,\
'Name: ',res... | code_fim | hard | {
"lang": "python",
"repo": "robertkohl125/PuppyShelter",
"path": "/puppyExpressionLanguage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#This method queries all puppies grouped by the shelter in which they are staying
def selectPuppiesByShelter():
j = join(Puppy, Shelter,
Puppy.shelter_id == Shelter.shelter_id)
s = select([Shelter.name, Puppy.puppy_id, Puppy.name]).select_from(j).\
order_by("shelter.name")
results = session.execu... | code_fim | hard | {
"lang": "python",
"repo": "robertkohl125/PuppyShelter",
"path": "/puppyExpressionLanguage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robertkohl125/PuppyShelter path: /puppyExpressionLanguage.py
from sqlalchemy import *
from sqlalchemy.orm import *
from puppy_shelter_database_setup import Base, Puppy, Shelter
from sqlalchemy.sql import *
import datetime
engine = create_engine('sqlite:///puppyshelter.db')
Base.metadata.bind = e... | code_fim | hard | {
"lang": "python",
"repo": "robertkohl125/PuppyShelter",
"path": "/puppyExpressionLanguage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zjsyj/JiashengBlog path: /JiashengBlog/article/forms.py
from django import forms
from .models import ArticlePost
class ArticlePostForm(forms.ModelForm):
<|fim_suffix|> model = ArticlePost
fields = ('title', 'body')<|fim_middle|> class Meta:
| code_fim | easy | {
"lang": "python",
"repo": "zjsyj/JiashengBlog",
"path": "/JiashengBlog/article/forms.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = ArticlePost
fields = ('title', 'body')<|fim_prefix|># repo: zjsyj/JiashengBlog path: /JiashengBlog/article/forms.py
from django import forms
from .models import ArticlePost
<|fim_middle|>class ArticlePostForm(forms.ModelForm):
class Meta:
| code_fim | easy | {
"lang": "python",
"repo": "zjsyj/JiashengBlog",
"path": "/JiashengBlog/article/forms.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LennyPhoenix/Mini-Jam-56-Sky path: /source/__init__.py
from .button import Button
from .chunk import CHUNKS, Chunk
from .player import Player
from .tap_ba<|fim_suffix|>rt BucketBalloon
from .water_drop import WaterDrop<|fim_middle|>lloon import TapBalloon
from .bucket_balloon impo | code_fim | easy | {
"lang": "python",
"repo": "LennyPhoenix/Mini-Jam-56-Sky",
"path": "/source/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rt BucketBalloon
from .water_drop import WaterDrop<|fim_prefix|># repo: LennyPhoenix/Mini-Jam-56-Sky path: /source/__init__.py
from .button import Button
from .chunk import CHU<|fim_middle|>NKS, Chunk
from .player import Player
from .tap_balloon import TapBalloon
from .bucket_balloon impo | code_fim | medium | {
"lang": "python",
"repo": "LennyPhoenix/Mini-Jam-56-Sky",
"path": "/source/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lloon import TapBalloon
from .bucket_balloon import BucketBalloon
from .water_drop import WaterDrop<|fim_prefix|># repo: LennyPhoenix/Mini-Jam-56-Sky path: /source/__init__.py
from .button import Button
from .chunk import CHU<|fim_middle|>NKS, Chunk
from .player import Player
from .tap_ba | code_fim | easy | {
"lang": "python",
"repo": "LennyPhoenix/Mini-Jam-56-Sky",
"path": "/source/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aadeshnpn/swarm path: /test/test_evolution.py
"""Test case for convergence of evolution algorithm."""
from swarms.lib.agent import Agent
from swarms.lib.model import Model
from swarms.lib.time import SimultaneousActivation
from swarms.lib.space import Grid
from unittest import TestCase
import nu... | code_fim | hard | {
"lang": "python",
"repo": "aadeshnpn/swarm",
"path": "/test/test_evolution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.direction = model.random.rand() * (2 * np.pi)
self.speed = 2
self.radius = 3
# self.exchange_time = model.random.randint(2, 4)
# This doesn't help. Maybe only perform genetic operations when
# an agents meet 10% of its total population
# """
... | code_fim | hard | {
"lang": "python",
"repo": "aadeshnpn/swarm",
"path": "/test/test_evolution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dtienq/crawl-shop path: /examples/service/ShopeeCrawler.py
from .CrawService import CrawService
from requests_html import HTML
from ..base.base import session_factory
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from sele... | code_fim | hard | {
"lang": "python",
"repo": "dtienq/crawl-shop",
"path": "/examples/service/ShopeeCrawler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> html_has_category = HTML(html=browser.page_source)
categories = html_has_category.find('._2o2XQg')
for category in categories:
# save category to database
category_url = url + category.links.pop()
browser_category = craw_service.craw_html(categor... | code_fim | hard | {
"lang": "python",
"repo": "dtienq/crawl-shop",
"path": "/examples/service/ShopeeCrawler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steinitzu/jotbox path: /jotbox/whitelist/base.py
from abc import abstractmethod, ABC
from typing import Optional, Generic
from jotbox.types import TPayload, DateTimeStamp, TSub, TSession
class Whitelist(ABC, Generic[TPayload]):
@abstractmethod
async def add(self, payload: TPayload, unt... | code_fim | hard | {
"lang": "python",
"repo": "steinitzu/jotbox",
"path": "/jotbox/whitelist/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @abstractmethod
async def delete(self, delete: TPayload) -> None:
"""
Immediately revoke the token from the whitelist
"""
class SessionWhitelist(Whitelist[TSession], Generic[TSession, TSub]):
@abstractmethod
async def delete_sub(self, sub: TSub) -> None:
"... | code_fim | hard | {
"lang": "python",
"repo": "steinitzu/jotbox",
"path": "/jotbox/whitelist/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: umr-ds/pyserval path: /pyserval/lowlevel/client.py
"""
pyserval.lowlevel.client
~~~~~~~~~~~~~~~
Collection of API-objects
"""
from pyserval.lowlevel.connection import RestfulConnection
from pyserval.lowlevel.keyring import LowLevelKeyring
from pyserval.lowlevel.rhizome import LowLevelRhizome
fr... | code_fim | hard | {
"lang": "python",
"repo": "umr-ds/pyserval",
"path": "/pyserval/lowlevel/client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def new(
host: str = "localhost",
port: int = 4110,
user: str = "pyserval",
passwd: str = "pyserval",
):
"""Utility-method that creates a connection-object and then a lient from it
Args:
host (str): Hostname to connect ... | code_fim | hard | {
"lang": "python",
"repo": "umr-ds/pyserval",
"path": "/pyserval/lowlevel/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
host (str): Hostname to connect to
port (int): Port to connect to
user (str): Username for HTTP basic auth
passwd (str): Password for HTTP basic auth
Returns:
LowLevelClient: Fully instantiated client
"""
co... | code_fim | hard | {
"lang": "python",
"repo": "umr-ds/pyserval",
"path": "/pyserval/lowlevel/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ma1co/fwtool.py path: /fwtool/util/__init__.py
"""Some utility functions to unpack integers"""
import binascii
import struct
from collections import namedtuple
def parse64be(data):
return struct.unpack('>Q', data)[0]
def dump64be(value):
return struct.pack('>Q', value)
def parse64le(data):... | code_fim | hard | {
"lang": "python",
"repo": "ma1co/fwtool.py",
"path": "/fwtool/util/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> LITTLE_ENDIAN = '<'
BIG_ENDIAN = '>'
PADDING = '%dx'
CHAR = 'c'
STR = '%ds'
INT64 = 'Q'
INT32 = 'I'
INT16 = 'H'
INT8 = 'B'
def __init__(self, name, fields, byteorder=LITTLE_ENDIAN):
self.tuple = namedtuple(name, (n for n, fmt in fields if not isinstance(fmt, int)))
self.format = byteorder +... | code_fim | hard | {
"lang": "python",
"repo": "ma1co/fwtool.py",
"path": "/fwtool/util/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> reProj.change_projection(inShapefile, outShapefile, outEPSG)<|fim_prefix|># repo: HotMaps/Hotmaps-building_h-c path: /app/modules/common/CM/CM_TUW24/run_cm.py
import os
import sys
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.
ab... | code_fim | easy | {
"lang": "python",
"repo": "HotMaps/Hotmaps-building_h-c",
"path": "/app/modules/common/CM/CM_TUW24/run_cm.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HotMaps/Hotmaps-building_h-c path: /app/modules/common/CM/CM_TUW24/run_cm.py
import os
import sys
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.
abspath(__file__))))
if path not in sys.path:
sys.path.append(path)
import C... | code_fim | easy | {
"lang": "python",
"repo": "HotMaps/Hotmaps-building_h-c",
"path": "/app/modules/common/CM/CM_TUW24/run_cm.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return super(Firmware,self).comms_ok()
def external_event(self, event_name, arg):
super(Firmware,self).external_event(event_name, arg)
if event_name=="upgradeFirmware":
logging.info("Upgrading firmware on device "+self.properties["$id"]+" to "+str(arg))
... | code_fim | hard | {
"lang": "python",
"repo": "pervasivesolutions/synth",
"path": "/synth/devices/firmware.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def external_event(self, event_name, arg):
super(Firmware,self).external_event(event_name, arg)
if event_name=="upgradeFirmware":
logging.info("Upgrading firmware on device "+self.properties["$id"]+" to "+str(arg))
self.set_property("firmware", arg)
if e... | code_fim | hard | {
"lang": "python",
"repo": "pervasivesolutions/synth",
"path": "/synth/devices/firmware.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pervasivesolutions/synth path: /synth/devices/firmware.py
"""
firmware
========
Provides a device firmware revision, which can be change by incoming "upgradeFirmware" events,
and rolled-back to factory firmware by incoming "factoryReset" events.
Configurable parameters::
<|fim_suffix|> s... | code_fim | hard | {
"lang": "python",
"repo": "pervasivesolutions/synth",
"path": "/synth/devices/firmware.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cmuparlay/pbbsbench path: /benchmarks/nearestNeighbors/bench/testInputs
#!/usr/bin/env python3
bnchmrk="neighbors"
benchmark="Nearest Neighbors"
checkProgram="../bench/neighborsCheck"
dataDir = "../geometryData/data"
<|fim_suffix|> [1, "3DinCube_10M","-d 3 -k 10", "-d 3 -k 10"],
[1, "3Dp... | code_fim | hard | {
"lang": "python",
"repo": "cmuparlay/pbbsbench",
"path": "/benchmarks/nearestNeighbors/bench/testInputs",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>import sys
sys.path.insert(0, 'common')
import runTests
runTests.timeAllArgs(bnchmrk, benchmark, checkProgram, dataDir, tests)<|fim_prefix|># repo: cmuparlay/pbbsbench path: /benchmarks/nearestNeighbors/bench/testInputs
#!/usr/bin/env python3
bnchmrk="neighbors"
benchmark="Nearest Neighbors"
checkProgra... | code_fim | medium | {
"lang": "python",
"repo": "cmuparlay/pbbsbench",
"path": "/benchmarks/nearestNeighbors/bench/testInputs",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if clustermeta['incl_mstar'] == 1:
c_mcmc, rs_mcmc, normsersic_mcmc \
= map(lambda v:
(v[1],
v[2]-v[1],
v[1]-v[0]),
zip(*np.percentile(samples, [16, 50, 84], axis=0)))
elif clustermeta['incl_mstar'] == ... | code_fim | hard | {
"lang": "python",
"repo": "hainest/bmpmod",
"path": "/bmpmod/posterior_mcmc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hainest/bmpmod path: /bmpmod/posterior_mcmc.py
import defaultparams.params as params
from joblib import Parallel, delayed
from mod_mass import *
from gen import *
import scipy
import scipy.integrate
import numpy as np
def calc_rdelta_p(row, nemodel, clustermeta):
'''
Radius corresp... | code_fim | hard | {
"lang": "python",
"repo": "hainest/bmpmod",
"path": "/bmpmod/posterior_mcmc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PeterJCLaw/poltergeist path: /src/matches_for.py
from datetime import datetime
import sys
import talk
from display_utils import get_delayed_time
<|fim_suffix|> num = ident[6:]
# print "| {0} | {1} | {2} |".format(dt.time(), num, ' | '.join(team_ids))
print ident<|fim_middle|>req_team... | code_fim | hard | {
"lang": "python",
"repo": "PeterJCLaw/poltergeist",
"path": "/src/matches_for.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> num = ident[6:]
# print "| {0} | {1} | {2} |".format(dt.time(), num, ' | '.join(team_ids))
print ident<|fim_prefix|># repo: PeterJCLaw/poltergeist path: /src/matches_for.py
from datetime import datetime
import sys
import talk
from display_utils import get_delayed_time
<|fim_middle|>req_team... | code_fim | hard | {
"lang": "python",
"repo": "PeterJCLaw/poltergeist",
"path": "/src/matches_for.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for ident, stamp in match_data:
dt = datetime.fromtimestamp(stamp)
dt = get_delayed_time(dt)
teams_data = talk.command_yaml('get-match-teams {0}'.format(ident))
#print teams_data
team_ids = teams_data['teams']
if not req_team in team_ids:
continue
num = ident[6:]
# ... | code_fim | medium | {
"lang": "python",
"repo": "PeterJCLaw/poltergeist",
"path": "/src/matches_for.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>30):
print('Time: '+str(i))
time.sleep(1)
n = lora_proc('this is working')<|fim_prefix|># repo: CityofEdmonton/lora-ttn-messager path: /src/thethingsnetwork-send-v1/test.py
from lora import lora_proc
import time
<|fim_middle|>
n = lora_proc('testing')
for i in range( | code_fim | easy | {
"lang": "python",
"repo": "CityofEdmonton/lora-ttn-messager",
"path": "/src/thethingsnetwork-send-v1/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CityofEdmonton/lora-ttn-messager path: /src/thethingsnetwork-send-v1/test.py
from lora import lora_proc
import time
<|fim_suffix|>sleep(1)
n = lora_proc('this is working')<|fim_middle|>
n = lora_proc('testing')
for i in range(30):
print('Time: '+str(i))
time. | code_fim | medium | {
"lang": "python",
"repo": "CityofEdmonton/lora-ttn-messager",
"path": "/src/thethingsnetwork-send-v1/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>sleep(1)
n = lora_proc('this is working')<|fim_prefix|># repo: CityofEdmonton/lora-ttn-messager path: /src/thethingsnetwork-send-v1/test.py
from lora import lora_proc
import time
<|fim_middle|>
n = lora_proc('testing')
for i in range(30):
print('Time: '+str(i))
time. | code_fim | medium | {
"lang": "python",
"repo": "CityofEdmonton/lora-ttn-messager",
"path": "/src/thethingsnetwork-send-v1/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: christoffer/pycharm-pyxl path: /testdata/Comments.py
# coding: pyxl
def stuff_with_comments():
return (
<|fim_suffix|>]>
<!-- Comment -->
</html>
</frag>
)<|fim_middle|><frag>
<!DOCTYPE html>
<html><![CDATA[
<!-- I... | code_fim | hard | {
"lang": "python",
"repo": "christoffer/pycharm-pyxl",
"path": "/testdata/Comments.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> <!-- Inner comment -->
]]>
<!-- Comment -->
</html>
</frag>
)<|fim_prefix|># repo: christoffer/pycharm-pyxl path: /testdata/Comments.py
# coding: pyxl
def stuff_with_comments():
return (
<|fim_middle|><frag>
<!DOCTYPE html... | code_fim | hard | {
"lang": "python",
"repo": "christoffer/pycharm-pyxl",
"path": "/testdata/Comments.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.