text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> '''
returns: data, labels
'''
_alldata = read_csv(file, 1128, input_name='smiles', target_name=target_name)
assert len(_alldata[0]) == len(_alldata[1])
data, labels = permute_data(_alldata[0], _alldata[1], FixSeed=12345)
assert len(data) == len(labels)
return data, labels
... | code_fim | hard | {
"lang": "python",
"repo": "tevang/keras-neural-graph-fingerprint",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def parseZeroNineSeasonData(season, text):
gameCounter = 0
for line in text:
pool = re.match("==(=|)Pool\s+(\d+)(|=)==", line)
if ( pool ):
while ( gameCounter < 12 ):
poolId = pool.group(2)
line = next(text)
foundMatch ... | code_fim | hard | {
"lang": "python",
"repo": "fintanr/hcup-stats",
"path": "/parse-hcup-results.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fintanr/hcup-stats path: /parse-hcup-results.py
nted out values, but our regex elimiates
# these
cons = re.split("\)", myString)
totalConversions = 0
for con in cons:
thisConCount = re.match(".*\[\[.*\|.*\]\]\s\((\d+)\/\d+", con)
if ( thisConCount ):
... | code_fim | hard | {
"lang": "python",
"repo": "fintanr/hcup-stats",
"path": "/parse-hcup-results.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return urls
def extractTimes(timeList):
pipedTimes = ""
for j in timeList:
pipedTimes = "%s|%s" % ( pipedTimes, j)
pipedTimes = re.sub("^\|","", pipedTimes)
return(pipedTimes)
def extractSeasonData(urls):
for season, url in urls.iteritems():
print "Extracting Da... | code_fim | hard | {
"lang": "python",
"repo": "fintanr/hcup-stats",
"path": "/parse-hcup-results.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rivas-lab/lof-enrichment path: /scripts/query_genes.py
import argparse
import cPickle
import os
import sys
import pandas as pd
def describe_overlap(genes, piemm_results, afr_ss, amr_ss, lof_gene):
# Read summary stats
afr_ss = pd.read_table(afr_ss, index_col=0)
amr_ss = pd.read_tabl... | code_fim | hard | {
"lang": "python",
"repo": "rivas-lab/lof-enrichment",
"path": "/scripts/query_genes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> piemm_results = 'piemm_res_01_05_05.pickle'
afr_ss = 'AFR_ss.tsv'
amr_ss = 'AMR_ss.tsv'
lof_gene = 'lof_gene.tsv'
parser = argparse.ArgumentParser(
description=('Query a gene list of Ensembl IDs or gene symbols to '
'see which genes are enriched for LoF var... | code_fim | hard | {
"lang": "python",
"repo": "rivas-lab/lof-enrichment",
"path": "/scripts/query_genes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
try:
# Create Dataframe
print(success[0])
df = pd.read_csv("data/churn.csv")
# Generate Profile
print(success[1])
profile = ProfileReport(df, title='Churn Profiling Report', html={'style':{'full_width':True}})
... | code_fim | medium | {
"lang": "python",
"repo": "boogiedev/churning-a-blind-eye",
"path": "/generate_report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: boogiedev/churning-a-blind-eye path: /generate_report.py
#!/usr/bin/env python3
# Import Libraries
import pandas as pd
from pandas_profiling import ProfileReport
success = [
"\nCreated dataframe from data/churn.csv ...\n",
"\nCreating profiling object ...\n",
"\nCreating HTML file \... | code_fim | hard | {
"lang": "python",
"repo": "boogiedev/churning-a-blind-eye",
"path": "/generate_report.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Generate Profile
print(success[1])
profile = ProfileReport(df, title='Churn Profiling Report', html={'style':{'full_width':True}})
# Output Profile as HTML in Local Dir
print(success[2])
profile.to_file(output_file="churn_report.html")
# ... | code_fim | medium | {
"lang": "python",
"repo": "boogiedev/churning-a-blind-eye",
"path": "/generate_report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> a_pair = foo_enum[0]
self.assertEqual('a', a_pair.symbol)
self.assertEqual(1, a_pair.value)
b_pair = foo_enum[1]
self.assertEqual('b', b_pair.symbol)
self.assertEqual(2, b_pair.value)
c_pair = bar_enum[0]
self.assertEqual('c', c_pair.symbol... | code_fim | hard | {
"lang": "python",
"repo": "jddixon/fieldz",
"path": "/tests/test_proto_spec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jddixon/fieldz path: /tests/test_proto_spec.py
#!/usr/bin/env python3
# ~/dev/py/fieldz/testProtoSpec.py
##############################################
# XXX WARNING: ACTUAL ROUND TRIPS ARE DISABLED
##############################################
import time
import unittest
from io import Strin... | code_fim | hard | {
"lang": "python",
"repo": "jddixon/fieldz",
"path": "/tests/test_proto_spec.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # crude tests of __eq__ AKA ==
self.assertFalse(match is None)
self.assertTrue(match == match)
# one way of saying it ------------------
self.assertTrue(match.__eq__(cloned_spec))
self.assertTrue(cloned_spec.__eq__(match))
# this is the same test -... | code_fim | hard | {
"lang": "python",
"repo": "jddixon/fieldz",
"path": "/tests/test_proto_spec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rafaelschlatter/pipedesign-api path: /tests/ml/test_preprocessor.py
import os
import pandas as pd
from src.infrastructure import blobhandler
from src.ml import preprocessor
class TestPreprocessor:
<|fim_suffix|> handler = blobhandler.BlobHandler()
pipedesigns = handler.download_b... | code_fim | medium | {
"lang": "python",
"repo": "rafaelschlatter/pipedesign-api",
"path": "/tests/ml/test_preprocessor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> handler = blobhandler.BlobHandler()
pipedesigns = handler.download_blobs(os.environ["CONTAINER_NAME_DATA"])
proc = preprocessor.Preprocessor()
dataset = proc.create_training_data(pipedesigns)
assert isinstance(dataset, pd.DataFrame)
def test_flatten_pipesegment... | code_fim | medium | {
"lang": "python",
"repo": "rafaelschlatter/pipedesign-api",
"path": "/tests/ml/test_preprocessor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HUFS-VLab/tf-SSS-AE path: /dataset_loader.py
import os
import glob
import json
import random
class DatasetLoader:
def __init__(self, target_manifest, dataset_path, is_trained=True):
self.target_manifest = target_manifest
self.dataset_path = dataset_path
self.is_traine... | code_fim | hard | {
"lang": "python",
"repo": "HUFS-VLab/tf-SSS-AE",
"path": "/dataset_loader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> example = data_list[0]
item_name = example['item']
item_type = example['type']
self.name = item_name
getData_path = lambda x : os.path.join(self.dataset_path, x +'.npy')
if self.is_trained:
ra... | code_fim | hard | {
"lang": "python",
"repo": "HUFS-VLab/tf-SSS-AE",
"path": "/dataset_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if n_data <= 30:
start = 0
end = start + int(n_data * 0.75)
else:
start = 0
end = 30
self.trainData_list = [getData_path(data['wav']) for data in data_list[start:end]]
... | code_fim | hard | {
"lang": "python",
"repo": "HUFS-VLab/tf-SSS-AE",
"path": "/dataset_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pebsconsulting/codalab-worksheets path: /codalab/codalab/context_processors.py
from django.conf import settings
from codalab import settings as codalab_settings
def app_version_proc(request):
<|fim_suffix|>def common_settings(request):
"A context processor that returns dev settings"
ret... | code_fim | medium | {
"lang": "python",
"repo": "pebsconsulting/codalab-worksheets",
"path": "/codalab/codalab/context_processors.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> "A context processor that provides 'app_version'."
return {
'CODALAB_VERSION': settings.CODALAB_VERSION,
}
def common_settings(request):
"A context processor that returns dev settings"
return {}<|fim_prefix|># repo: pebsconsulting/codalab-worksheets path: /codalab/codalab/con... | code_fim | easy | {
"lang": "python",
"repo": "pebsconsulting/codalab-worksheets",
"path": "/codalab/codalab/context_processors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def common_settings(request):
"A context processor that returns dev settings"
return {}<|fim_prefix|># repo: pebsconsulting/codalab-worksheets path: /codalab/codalab/context_processors.py
from django.conf import settings
from codalab import settings as codalab_settings
<|fim_middle|>
def app_ver... | code_fim | medium | {
"lang": "python",
"repo": "pebsconsulting/codalab-worksheets",
"path": "/codalab/codalab/context_processors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PPAPI/ppapi path: /filesystem.py
__author__ = 'jschumacher'
import zipfile
from shutil import rmtree
from werkzeug.utils import secure_filename
req_version=None
try:
# For Python 3.0 and later
from urllib.request import urlopen
req_version=3
except ImportError:
# Fall back to Pyth... | code_fim | hard | {
"lang": "python",
"repo": "PPAPI/ppapi",
"path": "/filesystem.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f.close()
## Function to create cmd file for montecarlo run
# @param _case case name <string>
# @param _run_id run id <string>
# @param _system operating system <string>
# @param _jac if set to True creat cmd file with jacobian input switch <boolean>
def create_monteca... | code_fim | hard | {
"lang": "python",
"repo": "PPAPI/ppapi",
"path": "/filesystem.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## Function to read file content
# @param _file_name file name <string>
def get_file_content(self, _file_name):
fh = open(_file_name, 'r')
return fh.read()
fh.close()
## Function to download resource base zip file from master server
# @param _case case name <... | code_fim | hard | {
"lang": "python",
"repo": "PPAPI/ppapi",
"path": "/filesystem.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ENTI_OVERLAP_BASINS_FILE = os.path.join(pathlib.Path(__file__).parent.absolute(), 'test_data', 'enti_osheds.zip')
ENTI_DISCRETE_BASINS_FILE = os.path.join(pathlib.Path(__file__).parent.absolute(), 'test_data', 'enti_dsheds.zip')<|fim_prefix|># repo: Ecotrust/uc-dhsvm-harness path: /dhsvm_harness/tests/te... | code_fim | hard | {
"lang": "python",
"repo": "Ecotrust/uc-dhsvm-harness",
"path": "/dhsvm_harness/tests/testing_settings.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>RESET_BASIN_JSON = os.path.join(pathlib.Path(__file__).parent.absolute(), 'test_data', 'enti_1065.geojson')
RESET_BASIN_ID = "enti_1065"
RESET_TEST_BASIN_IDS = [
'enti_11', # NW tip
'enti_270', # Top of weird Western 'mouth'
'enti_396', # Near the center of the basin
'enti_43... | code_fim | hard | {
"lang": "python",
"repo": "Ecotrust/uc-dhsvm-harness",
"path": "/dhsvm_harness/tests/testing_settings.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ecotrust/uc-dhsvm-harness path: /dhsvm_harness/tests/testing_settings.py
import os, pathlib
BASIN_JSON_1 = os.path.join(pathlib.Path(__file__).parent.absolute(), 'test_data', 'basin_3726.geojson')
BASIN_1_ID = "metw_3726"
BASIN_JSON_2 = os.path.join(pathlib.Path(__file__).parent.absolute(), 'tes... | code_fim | hard | {
"lang": "python",
"repo": "Ecotrust/uc-dhsvm-harness",
"path": "/dhsvm_harness/tests/testing_settings.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jkochNU/scqubits path: /scqubits/tests/test_transmon.py
# test_transmon.py
# meant to be run with 'pytest'
#
# This file is part of scqubits.
#
# Copyright (c) 2019, Jens Koch and Peter Groszkowski
# All rights reserved.
#
# This source code is licensed under the BSD-style license found ... | code_fim | hard | {
"lang": "python",
"repo": "jkochNU/scqubits",
"path": "/scqubits/tests/test_transmon.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.qbt = Transmon(EJ=1.0, EC=1.0, ng=0.0, ncut=10)
self.qbt.plot_n_wavefunction(esys=None, which=1, mode='real')<|fim_prefix|># repo: jkochNU/scqubits path: /scqubits/tests/test_transmon.py
# test_transmon.py
# meant to be run with 'pytest'
#
# This file is part of scqubits.
#
# Copy... | code_fim | medium | {
"lang": "python",
"repo": "jkochNU/scqubits",
"path": "/scqubits/tests/test_transmon.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, bot):
self.bot = bot
@c.command(aliases=['st'], pass_context=True, description='自分のステータスが知れます')
@c.cooldown(10, 2, c.BucketType.user)
async def status(self, ctx):
channel_id = ctx.channel.id
user = ctx.author
exp = db.player.experience.ge... | code_fim | medium | {
"lang": "python",
"repo": "FaberSid/FFM-project",
"path": "/module/status.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FaberSid/FFM-project path: /module/status.py
import json
import math
import random
from discord import Embed
from discord.ext import commands as c
from module import battle, db
with open('../assets/items.json', encoding='utf-8') as f:
items = json.load(f)
channel_in_transaction = []
speci... | code_fim | hard | {
"lang": "python",
"repo": "FaberSid/FFM-project",
"path": "/module/status.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.bot = bot
@c.command(aliases=['st'], pass_context=True, description='自分のステータスが知れます')
@c.cooldown(10, 2, c.BucketType.user)
async def status(self, ctx):
channel_id = ctx.channel.id
user = ctx.author
exp = db.player.experience.get(user.id)
embed = Em... | code_fim | medium | {
"lang": "python",
"repo": "FaberSid/FFM-project",
"path": "/module/status.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sprij/fablein path: /lein/__init__.py
"""
Automation tasks with Fabric.
$ fab lein new [TEMPLATE] NAME # generate a new project skeleton *
<|fim_suffix|>* TO BE IMPLEMENTED
"""
from .task import RunnerTask, HelpTask
from .configuration import ConfigLoader
config_loader = ConfigLoader()
config ... | code_fim | easy | {
"lang": "python",
"repo": "sprij/fablein",
"path": "/lein/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>config_loader = ConfigLoader()
config = config_loader.get()
for task_name, task_config in config.iteritems():
globals()[task_name] = RunnerTask(task_config)
globals()['help'] = HelpTask(config)<|fim_prefix|># repo: sprij/fablein path: /lein/__init__.py
"""
Automation tasks with Fabric.
$ fab lein ne... | code_fim | medium | {
"lang": "python",
"repo": "sprij/fablein",
"path": "/lein/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JorgeDeLosSantos/_blogs_ path: /Numython/Posts/analisis-estructural-con-python-i/ast.py
# -*- coding: utf8 -*-
import numpy as np
import numpy.linalg as la
# Datos iniciales
k1 = 1000.0
k2 = 2000.0
k3 = 3000.0
P = 5000.0
# Matrices por elemento
K1 = np.array([[k1,-k1],[-k1,k1]])
K2 = np.array([... | code_fim | medium | {
"lang": "python",
"repo": "JorgeDeLosSantos/_blogs_",
"path": "/Numython/Posts/analisis-estructural-con-python-i/ast.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Vector de desplazamientos
USOL = np.concatenate(([0,0],USOL))
# Obteniendo las fuerzas nodales
NF = np.dot(K,USOL)
# Presentando los resultados
for nodo in range(4):
print("%g UX = %-8.4f FX = %-8.4f"%(nodo+1, USOL[nodo], NF[nodo]))<|fim_prefix|># repo: JorgeDeLosSantos/_blogs_ path: /Numytho... | code_fim | hard | {
"lang": "python",
"repo": "JorgeDeLosSantos/_blogs_",
"path": "/Numython/Posts/analisis-estructural-con-python-i/ast.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>DUELING = True
fis = BuildFis()
# fis = None
FILE_NAME = "DQN_" + globalvars.DEFAULT_ENV_NAME.upper()
if DUELING:
FILE_NAME += "_DUELING"
if fis is not None:
FILE_NAME += "_FUZZY"
FILE_NAME += '.hd5'
def training():
gym_env = gym.make(globalvars.DEFAULT_ENV_NAME)
gym_env = gym_env.unwrap... | code_fim | medium | {
"lang": "python",
"repo": "doandongnguyen/FuzzyDQN",
"path": "/training.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doandongnguyen/FuzzyDQN path: /training.py
import os
import gym
import random
import numpy as np
import matplotlib.pyplot as plt
import globalvars
from agents.agent import Agent
from environment import Environment
from memberships import BuildFis
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "doandongnguyen/FuzzyDQN",
"path": "/training.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> search_fields = ['text', 'post']
list_filter = ('created_by', 'post')
list_display = ['created_by', 'text', 'post']
class TCUserAdmin(UserAdmin):
add_form = TCUserCreationForm
form = TCUserChangeForm
model = TCUser
list_display = ('email', 'last_name', 'first_name', 'phone_nu... | code_fim | medium | {
"lang": "python",
"repo": "thorion21/2NHack-Breast-Cancer-Classifier",
"path": "/2nhack/core/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class CommentAdmin(admin.ModelAdmin):
search_fields = ['text', 'post']
list_filter = ('created_by', 'post')
list_display = ['created_by', 'text', 'post']
class TCUserAdmin(UserAdmin):
add_form = TCUserCreationForm
form = TCUserChangeForm
model = TCUser
list_display = ('email... | code_fim | medium | {
"lang": "python",
"repo": "thorion21/2NHack-Breast-Cancer-Classifier",
"path": "/2nhack/core/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thorion21/2NHack-Breast-Cancer-Classifier path: /2nhack/core/admin.py
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .forms import TCUserCreationForm, TCUserChangeForm
from .models import TCUser, Post, Comment
<|fim_suffix|> search_fields = ['text', 'p... | code_fim | hard | {
"lang": "python",
"repo": "thorion21/2NHack-Breast-Cancer-Classifier",
"path": "/2nhack/core/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoseRoberts87/project-deap path: /deap/file_reader.py
import pandas as pd
import numpy as np
def get_extension(file=None):
"""returns file extension"""
ext = file.split(".")
if len(ext) > 1:
return ext[-1]
return None
<|fim_suffix|>def object_handler():
# TODO: impl... | code_fim | hard | {
"lang": "python",
"repo": "JoseRoberts87/project-deap",
"path": "/deap/file_reader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def num_to_str():
# TODO: implement
pass
def str_to_num(df, cols, nulls_as=0, errors='coerce'):
for col in cols:
df[col] = pd.to_numeric(df[col], errors=errors)
df = df.replace(np.nan, nulls_as, regex=True)
return df
def object_handler():
# TODO: implement
pass
de... | code_fim | hard | {
"lang": "python",
"repo": "JoseRoberts87/project-deap",
"path": "/deap/file_reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def df_format_cols(df, cols):
df.columns = cols
return df
def convert_timestamps(df, col):
pd.to_datetime(df[col], errors='coerce').apply(lambda x: x.date())
def num_to_str():
# TODO: implement
pass
def str_to_num(df, cols, nulls_as=0, errors='coerce'):
for col in cols:
... | code_fim | hard | {
"lang": "python",
"repo": "JoseRoberts87/project-deap",
"path": "/deap/file_reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> npt.assert_array_almost_equal(hodge_assembled_ref, hodge_assembled)
hodge_assembled_ref = assemble_slow(
self.mesh, hodge_02_lob, func_space_extgauss_0.dof_map.dof_map_internal, func_space_lob_2.dof_map.dof_map)
hodge_assembled = assemble(
hodge_02_lob, (fun... | code_fim | hard | {
"lang": "python",
"repo": "Idate96/Mimetic-Fem",
"path": "/src/tests/assemble_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Idate96/Mimetic-Fem path: /src/tests/assemble_test.py
"""Test for basis forms."""
import path_magic
import unittest
from mesh import CrazyMesh
from basis_forms import BasisForm
from hodge import hodge
from function_space import FunctionSpace, DualSpace, NextSpace
from forms import Form
import num... | code_fim | hard | {
"lang": "python",
"repo": "Idate96/Mimetic-Fem",
"path": "/src/tests/assemble_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> basis_ext_gauss = BasisForm(func_space_extgauss)
print(basis_ext_gauss.num_basis)
basis_ext_gauss.quad_grid = 'lobatto'
M_extgauss = inner(basis_ext_gauss, basis_ext_gauss)
M_lob_ass_ref = assemble_slow(self.mesh, M_lob, func_space_lob.dof_map.dof_map,
... | code_fim | hard | {
"lang": "python",
"repo": "Idate96/Mimetic-Fem",
"path": "/src/tests/assemble_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # URL Configuration.
# --------------------------------------------------------------------------
ROOT_URLCONF = '%s.urls' % SITE_NAME
WSGI_APPLICATION = 'avalonstar.wsgi.application'
# django-rest-framework.
# ----------------------------------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "bryanveloso/avalonstar-tv",
"path": "/avalonstar/settings/base.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bryanveloso/avalonstar-tv path: /avalonstar/settings/base.py
# -*- coding: utf-8 -*-
from os.path import abspath, basename, dirname, join, normpath
from sys import path
from configurations import Configuration, values
from postgresify import postgresify
class Base(Configuration):
# Path co... | code_fim | hard | {
"lang": "python",
"repo": "bryanveloso/avalonstar-tv",
"path": "/avalonstar/settings/base.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shank02/Programming-Lab path: /Semester 3/Code Optimization and Debugging-I/Python/Exp_23 - Perform Basic timSort.py
# Python3 program to perform basic timSort
# Tim Sort is a sorting algorithm based on Insertion Sort and Merge Sort.
# A stable sorting algorithm works in O(n Log n) time
# ... | code_fim | hard | {
"lang": "python",
"repo": "shank02/Programming-Lab",
"path": "/Semester 3/Code Optimization and Debugging-I/Python/Exp_23 - Perform Basic timSort.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def tim_sort(array):
n= len(array)
minrun=find_minrun(n)
for start in range(0,n,minrun):
end=min(start+minrun-1,n-1)
insertion_sort(array,start,end)
size=minrun
while size<n:
for left in range(0,n,2*size):
mid=min(n-1,left+size-1)
... | code_fim | hard | {
"lang": "python",
"repo": "shank02/Programming-Lab",
"path": "/Semester 3/Code Optimization and Debugging-I/Python/Exp_23 - Perform Basic timSort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def insertion_sort(array,left,right):
for i in range(left+1,right+1):
element=array[i]
j=i-1
while element<array[j] and j>=left:
array[j+1]=array[j]
j-=1
array[j+1]=element
return array
def merge(array,l,m,r):
array_leng... | code_fim | hard | {
"lang": "python",
"repo": "shank02/Programming-Lab",
"path": "/Semester 3/Code Optimization and Debugging-I/Python/Exp_23 - Perform Basic timSort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cscenter/project_screenshots path: /tests/unit/precision_recall_calculator/test_precision_recall_calculator.py
import unittest
import numpy as np
from tests.regression.precision_recall_calculator import PrecisionRecallCalculator
class TestPrecisionRecallCalculator(unittest.TestCase):
def t... | code_fim | medium | {
"lang": "python",
"repo": "cscenter/project_screenshots",
"path": "/tests/unit/precision_recall_calculator/test_precision_recall_calculator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pr_ctor = PrecisionRecallCalculator()
pr_ctor.add_false_negative()
self.assertEqual(pr_ctor.precision(), np.inf)
self.assertAlmostEqual(pr_ctor.recall(), 0., delta=1e-16)
self.assertEqual(pr_ctor.fscore(), np.inf)
print(pr_ctor)
def test_pr_ctor_handles... | code_fim | hard | {
"lang": "python",
"repo": "cscenter/project_screenshots",
"path": "/tests/unit/precision_recall_calculator/test_precision_recall_calculator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test__build_topology_error_network_with_router_and_interfaces(self):
provisioning_exception = exceptions.UnknownProvisioningError(
db_exc.DBConnectionError,
network_id='foo_n', router_id='foo_r', subnets=[{'id': 'foo_s'}])
with mock.patch.object(self.mixin,
... | code_fim | hard | {
"lang": "python",
"repo": "openstack/neutron",
"path": "/neutron/tests/unit/services/auto_allocate/test_db.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openstack/neutron path: /neutron/tests/unit/services/auto_allocate/test_db.py
er the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under t... | code_fim | hard | {
"lang": "python",
"repo": "openstack/neutron",
"path": "/neutron/tests/unit/services/auto_allocate/test_db.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test__provision_external_connectivity_with_provisioning_error(self):
self.mixin._l3_plugin.create_router.side_effect = Exception
with testtools.ExpectedException(
exceptions.UnknownProvisioningError) as e:
self.mixin._provision_external_connectivity(
... | code_fim | hard | {
"lang": "python",
"repo": "openstack/neutron",
"path": "/neutron/tests/unit/services/auto_allocate/test_db.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: avatao-content/tutorial path: /solvable/tutorial/eventhandlers.py
from tfwsdk import sdk
def on_step(current_state: int):
sdk.message_send('CURRENT STATE: ' + str(current_state))
def on_deploy(current_state: int):
sdk.message_send('DEPLOY BUTTON CLICKED')
return True # if deploy was... | code_fim | hard | {
"lang": "python",
"repo": "avatao-content/tutorial",
"path": "/solvable/tutorial/eventhandlers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> sdk.message_send('MESSAGE BUTTON CLICKED: ' + button_value)
def on_ide_write(current_state: int, name_of_file: str, content_of_file: str):
sdk.message_send('IDE WRITE')
def on_terminal_command(current_state: int, executed_command: str):
sdk.message_send('COMMAND EXECUTED: ' + executed_comman... | code_fim | medium | {
"lang": "python",
"repo": "avatao-content/tutorial",
"path": "/solvable/tutorial/eventhandlers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0xJeremy/ctrl.engine path: /build/lib/ctrlengine/ai/dev/verify.py
import tensorflow as tf
import cv2
import argparse
import numpy as np
DEFAULT_CAMERA = 0
INPUT_DETAILS = None
OUTPUT_DETAILS = None
FLOATING_MODEL = None
MEAN = 0.0
STD = 255.0
def load_interpreter(path):
global INPUT_DETAILS, O... | code_fim | medium | {
"lang": "python",
"repo": "0xJeremy/ctrl.engine",
"path": "/build/lib/ctrlengine/ai/dev/verify.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser(description='A tool for testing a trained model')
parser.add_argument('-p', '--path', help='Specifies where the saved model lives', required=True)
parser.add_argument('-c', '--camera', help='Specifies which camera number to use for capturing i... | code_fim | hard | {
"lang": "python",
"repo": "0xJeremy/ctrl.engine",
"path": "/build/lib/ctrlengine/ai/dev/verify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> global FLOATING_MODEL, MEAN, STD
# frame = cv2.resize(frame, (width, height))
frame = np.expand_dims(frame, axis=0)
if FLOATING_MODEL:
frame = (np.float32(frame) - MEAN) / STD
return frame
def print_results(results):
for item in results:
print("{}: {:08.6f}".format(item[0], item[1]))
print()
... | code_fim | medium | {
"lang": "python",
"repo": "0xJeremy/ctrl.engine",
"path": "/build/lib/ctrlengine/ai/dev/verify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Blueshoe/djangocms-layouter path: /layouter/cms_toolbars.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from cms.toolbar_base import CMSToolbar
from cms.toolbar_pool import toolbar_pool
from cms.constants import RIGHT
<|fim_suffix|>
def populate(self):
# classes f... | code_fim | medium | {
"lang": "python",
"repo": "Blueshoe/djangocms-layouter",
"path": "/layouter/cms_toolbars.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def populate(self):
# classes for scripting and styling
extra_classes = ['js-layouterMenu', 'layouter-menuButton']
# Button should have active state if grid is shown
if self.request.session.get('layouter_grid'):
extra_classes.append('cms-btn-active')
... | code_fim | medium | {
"lang": "python",
"repo": "Blueshoe/djangocms-layouter",
"path": "/layouter/cms_toolbars.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """开课"""
list_display = ["id", "teacher", "subject", "semester"]
class SelectCourseAdmin(object):
"""选课"""
list_display = ["id", "student", "course"]
xadmin.site.register(Semester, SemesterAdmin)
xadmin.site.register(Course, CourseAdmin)
xadmin.site.register(SelectCourse, SelectCourseA... | code_fim | hard | {
"lang": "python",
"repo": "LauZyHou/CurriculaVariableCat_Back",
"path": "/apps/course/adminx.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LauZyHou/CurriculaVariableCat_Back path: /apps/course/adminx.py
from course.models import Semester, Course, SelectCourse
import xadmin
class SemesterAdmin(object):
"""学期"""
list_display = ["id", "year", "season"]
class CourseWeekAdmin(object):
"""上课星期"""
list_display = ["id",... | code_fim | medium | {
"lang": "python",
"repo": "LauZyHou/CurriculaVariableCat_Back",
"path": "/apps/course/adminx.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CourseWeekAdmin(object):
"""上课星期"""
list_display = ["id", "week"]
class CourseTimeAdmin(object):
"""上课时间"""
list_display = ["id", "time"]
class CourseAdmin(object):
"""开课"""
list_display = ["id", "teacher", "subject", "semester"]
class SelectCourseAdmin(object):
"""... | code_fim | medium | {
"lang": "python",
"repo": "LauZyHou/CurriculaVariableCat_Back",
"path": "/apps/course/adminx.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: risooonho/nimp path: /nimp/build.py
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2019 Dontnod Entertainment
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without res... | code_fim | hard | {
"lang": "python",
"repo": "risooonho/nimp",
"path": "/nimp/build.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' Retrieves all symbol transactions from a symbol server '''
server_txt_path = os.path.join(symsrv, "000Admin", "server.txt")
if not os.path.exists(server_txt_path):
logging.error("Unable to find the file %s, aborting.", server_txt_path)
return None
line_re = re.compile(... | code_fim | hard | {
"lang": "python",
"repo": "risooonho/nimp",
"path": "/nimp/build.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steven-mercatante/timer-backend path: /clients/models.py
from django.db import models
from django.conf import settings
<|fim_suffix|> user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
)
name = models.CharField(max_length=255)<|fim_middle|>c... | code_fim | easy | {
"lang": "python",
"repo": "steven-mercatante/timer-backend",
"path": "/clients/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
)
name = models.CharField(max_length=255)<|fim_prefix|># repo: steven-mercatante/timer-backend path: /clients/models.py
from django.db import models
from django.conf import settings
<|fim_middle|>
c... | code_fim | easy | {
"lang": "python",
"repo": "steven-mercatante/timer-backend",
"path": "/clients/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linhduongtuan/Kaggle-2020-Alaska2 path: /dataset_mean_std_dct.py
import argparse
import os
import numpy as np
import cv2
import torch
from pytorch_toolbelt.utils import fs, to_numpy
from tqdm import tqdm
from alaska2 import idct8
from alaska2.dataset import idct8v2
from alaska2.models.dct impor... | code_fim | hard | {
"lang": "python",
"repo": "linhduongtuan/Kaggle-2020-Alaska2",
"path": "/dataset_mean_std_dct.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
def _fmt_t(t: Tensor):
if t.numel() > 5:
return f"tensor of ({','.join(map(str, t.shape))})"
def __fmt_t(t: Tensor):
return "[" + ",".join([f"{v:.3g}" if v.ndim == 0 else __fmt_t(v) for v in t]) + "]"
ret... | code_fim | hard | {
"lang": "python",
"repo": "linhduongtuan/Kaggle-2020-Alaska2",
"path": "/dataset_mean_std_dct.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0xmc/maint-notification path: /xmaintnote/event.py
from icalendar import Event
from xmaintnote import exc
class XMaintNoteEvent(Event):
# XXX-kbaker
# controls ordering - probably not necessary
# and can probably get rid of this class entirely
# besides canonical_order the lib... | code_fim | hard | {
"lang": "python",
"repo": "0xmc/maint-notification",
"path": "/xmaintnote/event.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if name.upper() in self.singletons and name in self:
raise exc.PropertyError('Multiple values supplied for singleton property %r' % name)
super(XMaintNoteEvent, self).add(name, value, **kwargs)<|fim_prefix|># repo: 0xmc/maint-notification path: /xmaintnote/event.py
from icalen... | code_fim | hard | {
"lang": "python",
"repo": "0xmc/maint-notification",
"path": "/xmaintnote/event.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def init_net(net, init_type='normal', init_gain=0.02):
"""
Initializes the input module with the given parameters.
Parameters
----------
m : torch.nn.Module
Module to initialize.
init_type : str
'normal', 'xavier', 'kaiming', or 'orthogonal'. Orthogonal initializat... | code_fim | hard | {
"lang": "python",
"repo": "Candy-Crusher/spatiotemporal_variable_separation",
"path": "/var_sep/networks/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Candy-Crusher/spatiotemporal_variable_separation path: /var_sep/networks/utils.py
# Copyright 2020 Jérémie Donà, Jean-Yves Franceschi, Patrick Gallinari, Sylvain Lamprier
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... | code_fim | hard | {
"lang": "python",
"repo": "Candy-Crusher/spatiotemporal_variable_separation",
"path": "/var_sep/networks/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kopardev/TALON path: /testing_suite/test_ISM_identification.py
import pytest
from talon import talon, init_refs
from .helper_fns import fetch_correct_ID, get_db_cursor
@pytest.mark.integration
class TestIdentifyISM(object):
def test_ISM_suffix(self):
""" Example where the transcript... | code_fim | hard | {
"lang": "python",
"repo": "kopardev/TALON",
"path": "/testing_suite/test_ISM_identification.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> conn, cursor = get_db_cursor()
build = "toy_build"
database = "scratch/toy.db"
run_info = talon.init_run_info(database, build)
talon.get_counters(database)
edge_dict = init_refs.make_edge_dict(cursor)
location_dict = init_refs.make_location_dict(bui... | code_fim | hard | {
"lang": "python",
"repo": "kopardev/TALON",
"path": "/testing_suite/test_ISM_identification.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route('/contact')
def contact():
"""Renders the contact page."""
return render_template('contact.html', title='Contact',
year=datetime.now().year,
message='Your contact page.')
@app.route('/about')
def about():
"""Renders the about page."""
return render_template('about.htm... | code_fim | hard | {
"lang": "python",
"repo": "mukulhase/FlaskAzure",
"path": "/FlaskWebProject1/views.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mukulhase/FlaskAzure path: /FlaskWebProject1/views.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Routes and views for the flask application.
"""
from datetime import datetime
from flask import render_template
from FlaskWebProject1 import app
import os, json, urllib, urllib2, httplib
from fla... | code_fim | hard | {
"lang": "python",
"repo": "mukulhase/FlaskAzure",
"path": "/FlaskWebProject1/views.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mjdhasan/pytext path: /pytext/torchscript/batchutils.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List, Optional, Tuple
class PytextEmbeddingModuleBatchSort:
def __init__(
self,
batchElement: Tuple[
... | code_fim | hard | {
"lang": "python",
"repo": "mjdhasan/pytext",
"path": "/pytext/torchscript/batchutils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> argno = self.argno
if argno == 0:
this = self.batchElement[0]
that = other.batchElement[0]
if this is None:
return True
elif that is None:
return False
else:
# TBD: tokenize this a... | code_fim | hard | {
"lang": "python",
"repo": "mjdhasan/pytext",
"path": "/pytext/torchscript/batchutils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tencent/QT4A path: /test/test_apktool/test_repack.py
# -*- coding: UTF-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License");... | code_fim | hard | {
"lang": "python",
"repo": "Tencent/QT4A",
"path": "/test/test_apktool/test_repack.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TestRepack(unittest.TestCase):
def test_get_apk_signature(self):
apk_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'qt4a', 'androiddriver', 'tools', 'QT4AHelper.apk')
apk_file = apkfile.APKFile(apk_path)
for it in apk_... | code_fim | medium | {
"lang": "python",
"repo": "Tencent/QT4A",
"path": "/test/test_apktool/test_repack.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: llybin/drf-recaptcha path: /tests/test_fields.py
import pytest
from django.core.exceptions import ImproperlyConfigured
from drf_recaptcha.fields import ReCaptchaV2Field, ReCaptchaV3Field
from drf_recaptcha.validators import ReCaptchaV2Validator, ReCaptchaV3Validator
@pytest.mark.parametrize(
... | code_fim | hard | {
"lang": "python",
"repo": "llybin/drf-recaptcha",
"path": "/tests/test_fields.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.parametrize(
("params", "from_settings", "settings_default", "error"),
[
({}, None, "0.6", "Default score value should be int or float"),
({}, None, -0.1, "Default score value should be between 0.0 - 1.0"),
({}, None, 1.1, "Default score value should be betwee... | code_fim | hard | {
"lang": "python",
"repo": "llybin/drf-recaptcha",
"path": "/tests/test_fields.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cnt_validators = len(field.validators)
assert cnt_validators > 0
assert isinstance(field.validators[cnt_validators - 1], validator_class)
@pytest.mark.parametrize(
("params", "from_settings", "settings_default", "error"),
[
({}, None, "0.6", "Default score value should be int... | code_fim | hard | {
"lang": "python",
"repo": "llybin/drf-recaptcha",
"path": "/tests/test_fields.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='userworkspace',
name='started_as_shared_workspace',
field=models.BooleanField(default=False, help_text='auto-filled on save'),
),
migrations.AlterField(
model_name='userworkspace',
... | code_fim | medium | {
"lang": "python",
"repo": "TwoRavens/TwoRavens",
"path": "/tworaven_apps/user_workspaces/migrations/0006_auto_20190619_1734.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TwoRavens/TwoRavens path: /tworaven_apps/user_workspaces/migrations/0006_auto_20190619_1734.py
# Generated by Django 2.1.9 on 2019-06-19 21:34
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|> dependencies = [
('user_workspaces', '0005_auto_201... | code_fim | medium | {
"lang": "python",
"repo": "TwoRavens/TwoRavens",
"path": "/tworaven_apps/user_workspaces/migrations/0006_auto_20190619_1734.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class MultiFileLineDocument(object):
def __init__(self, lexicon, source):
self.lexicon = lexicon
self.source = source
def __iter__(self):
for root, subdirs, files in os.walk(self.source):
for fname in files:
full_path = os.path.join(root, fname... | code_fim | hard | {
"lang": "python",
"repo": "AndMu/Wikiled.Python.Nlp",
"path": "/src/wikilednlp/utilities/DocumentExtractors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.total = 0
for root, subdirs, files in os.walk(self.source):
for fname in files:
full_path = os.path.join(root, fname)
if '.bin' in full_path or '.npy' in full_path:
logger.debug('Ignore %s', fname)
else:
... | code_fim | hard | {
"lang": "python",
"repo": "AndMu/Wikiled.Python.Nlp",
"path": "/src/wikilednlp/utilities/DocumentExtractors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndMu/Wikiled.Python.Nlp path: /src/wikilednlp/utilities/DocumentExtractors.py
import itertools
import os
from io import open
from gensim import utils
from gensim.models.doc2vec import TaggedDocument
from ..utilities import logger, Constants
from smart_open import smart_open
class SingleFileLi... | code_fim | hard | {
"lang": "python",
"repo": "AndMu/Wikiled.Python.Nlp",
"path": "/src/wikilednlp/utilities/DocumentExtractors.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lufeng22/dnnviewer path: /dnnviewer/utils/statistics.py
import numpy as np
def get_strongest(weights, topn):
""" Get the top n strongest (max absolute value) weights of each row """
nstrongest_idx = np.argpartition(np.abs(weights), -topn, axis=0<|fim_suffix|>.shape[1])]
... | code_fim | medium | {
"lang": "python",
"repo": "lufeng22/dnnviewer",
"path": "/dnnviewer/utils/statistics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>.shape[1])]
for i in range(topn)])
return nstrongest_idx, nstrongest<|fim_prefix|># repo: lufeng22/dnnviewer path: /dnnviewer/utils/statistics.py
import numpy as np
def get_strongest(weights, topn):
""" Get the top n strongest (max absolute value) weights of each row... | code_fim | medium | {
"lang": "python",
"repo": "lufeng22/dnnviewer",
"path": "/dnnviewer/utils/statistics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UranWolf/Python-Projects-for-Beginners path: /Alarm Clock/alarm_clock.py
#importing the required modules
from datetime import datetime
from playsound import playsound
<|fim_suffix|>print("Alarm Set!")
while True:
#obtaining the current time
now = datetime.now()
#obtaining the hour, minut... | code_fim | hard | {
"lang": "python",
"repo": "UranWolf/Python-Projects-for-Beginners",
"path": "/Alarm Clock/alarm_clock.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
#obtaining the current time
now = datetime.now()
#obtaining the hour, minute, second and period of the current time
current_hour = now.strftime("%I")
current_minute = now.strftime("%M")
current_seconds = now.strftime("%S")
current_period = now.strftime("%p")
if(alarm_pe... | code_fim | medium | {
"lang": "python",
"repo": "UranWolf/Python-Projects-for-Beginners",
"path": "/Alarm Clock/alarm_clock.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from functools import partial, reduce
sorted = sorted
# Aliases
comp = compose
__version__ = '0.5.3'<|fim_prefix|># repo: joyrexus/toolz path: /toolz/__init__.py
from .itertoolz import (groupby, countby, frequencies, reduceby,
first, second, nth, take, drop, rest, last,
... | code_fim | hard | {
"lang": "python",
"repo": "joyrexus/toolz",
"path": "/toolz/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>from . import sandbox
from functools import partial, reduce
sorted = sorted
# Aliases
comp = compose
__version__ = '0.5.3'<|fim_prefix|># repo: joyrexus/toolz path: /toolz/__init__.py
from .itertoolz import (groupby, countby, frequencies, reduceby,
first, second, nth, take, dr... | code_fim | hard | {
"lang": "python",
"repo": "joyrexus/toolz",
"path": "/toolz/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joyrexus/toolz path: /toolz/__init__.py
from .itertoolz import (groupby, countby, frequencies, reduceby,
first, second, nth, take, drop, rest, last,
get, merge_sorted, concat, concatv, mapcat,
isdistinct, interleave, interpos... | code_fim | hard | {
"lang": "python",
"repo": "joyrexus/toolz",
"path": "/toolz/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyriver/py3dep path: /conftest.py
"""Configuration for pytest."""
import pytest
from click.testing import CliRunner
@pytest.fixture
def runner():
<|fim_suffix|> doctest_namespace["py3dep"] = py3dep<|fim_middle|> """Return a CliRunner."""
return CliRunner()
@pytest.fixture(autouse=T... | code_fim | medium | {
"lang": "python",
"repo": "hyriver/py3dep",
"path": "/conftest.py",
"mode": "psm",
"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.