text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> pser = pd.Series([90, 91, 85], index=[2, 4, 1])
psser = ps.from_pandas(pser)
self.assert_eq(psser.pct_change(), pser.pct_change(), check_exact=False)
self.assert_eq(psser.pct_change().sum(), pser.pct_change().sum(), almost=True)
self.assert_eq(psser.pct_change(peri... | code_fim | hard | {
"lang": "python",
"repo": "apache/spark",
"path": "/python/pyspark/pandas/tests/series/test_stat.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> pser = pd.Series([100, None, -300, None, 500, -700, np.inf, -np.inf], name="Koalas")
psser = ps.from_pandas(pser)
self.assert_eq(pser.div(0), psser.div(0))
self.assert_eq(pser.truediv(0), psser.truediv(0))
self.assert_eq(pser / 0, psser / 0)
self.assert_eq(... | code_fim | hard | {
"lang": "python",
"repo": "apache/spark",
"path": "/python/pyspark/pandas/tests/series/test_stat.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amichard/zeva path: /backend/api/serializers/record_of_sale.py
from enumfields.drf import EnumField, EnumSupportSerializerMixin
from rest_framework.serializers import ModelSerializer, \
SerializerMethodField, SlugRelatedField
from api.models.record_of_sale import RecordOfSale
from api.models... | code_fim | hard | {
"lang": "python",
"repo": "amichard/zeva",
"path": "/backend/api/serializers/record_of_sale.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ModelSerializer, EnumSupportSerializerMixin
):
validation_status = EnumField(RecordOfSaleStatuses, read_only=True)
vin_validation_status = EnumField(VINStatuses, read_only=True)
vehicle = VehicleMinSerializer(read_only=True)
class Meta:
model = RecordOfSale
fields = ('... | code_fim | hard | {
"lang": "python",
"repo": "amichard/zeva",
"path": "/backend/api/serializers/record_of_sale.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Classroom',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('Building', models.CharField(default='', max_length=25)),
... | code_fim | hard | {
"lang": "python",
"repo": "RohanShrothrium/CourseManagement",
"path": "/Course_Management/portal/migrations/0002_classroom_instructor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RohanShrothrium/CourseManagement path: /Course_Management/portal/migrations/0002_classroom_instructor.py
# Generated by Django 2.1.5 on 2019-11-10 16:47
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateMod... | code_fim | hard | {
"lang": "python",
"repo": "RohanShrothrium/CourseManagement",
"path": "/Course_Management/portal/migrations/0002_classroom_instructor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sonictk/python-skeletons path: /PySide/QtGui/QTextTable.py
# encoding: utf-8
# module PySide.QtGui
# from /corp.blizzard.net/BFD/Deploy/Packages/Published/ThirdParty/Qt4.8.4/2015-05-15.163857/prebuilt/linux_x64_gcc41_python2.7_ucs4/PySide/QtGui.so
# by generator 1.138
# no doc
# imports
import P... | code_fim | hard | {
"lang": "python",
"repo": "sonictk/python-skeletons",
"path": "/PySide/QtGui/QTextTable.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def splitCell(self, *args, **kwargs): # real signature unknown
pass
def __init__(self, *more): # real signature unknown; restored from __doc__
""" x.__init__(...) initializes x; see help(type(x)) for signature """
pass
staticMetaObject = None
__new__ = None<|fim_p... | code_fim | medium | {
"lang": "python",
"repo": "sonictk/python-skeletons",
"path": "/PySide/QtGui/QTextTable.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_get_proxy_ips(self):
res = self.bc.get_proxy_ips()
self.assertEqual(len(res) , 100)
if __name__ == "__main__":
unittest.main()<|fim_prefix|># repo: WattZhang/basecrawler path: /tests/test_basecrawler.py
# coding:utf8
from bs4 import BeautifulSoup
from selenium import web... | code_fim | hard | {
"lang": "python",
"repo": "WattZhang/basecrawler",
"path": "/tests/test_basecrawler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WattZhang/basecrawler path: /tests/test_basecrawler.py
# coding:utf8
from bs4 import BeautifulSoup
from selenium import webdriver
from basecrawler.basecrawler import BaseCrawler
import unittest
<|fim_suffix|> def setUp(self):
self.bc = BaseCrawler()
def test_get_phantomjs_browser... | code_fim | medium | {
"lang": "python",
"repo": "WattZhang/basecrawler",
"path": "/tests/test_basecrawler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> datetime = u'星期四, 十月 29, 2015'
res = self.bc.datetime_format(datetime)
self.assertEqual('2015-10-29', res)
def test_get_proxy_ips(self):
res = self.bc.get_proxy_ips()
self.assertEqual(len(res) , 100)
if __name__ == "__main__":
unittest.main()<|fim_prefix|>... | code_fim | hard | {
"lang": "python",
"repo": "WattZhang/basecrawler",
"path": "/tests/test_basecrawler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## na sequence feature map
from molmap.seq import GlobNASeqMolMap
from joblib import load as loadmap<|fim_prefix|># repo: shenwanxiang/bidd-molmap path: /molmap/__init__.py
__version__ = '1.3.9.7.2'
## to custom map object
from molmap.agg import AggMolMap
## cpds feature map
from molmap.map import Mo... | code_fim | medium | {
"lang": "python",
"repo": "shenwanxiang/bidd-molmap",
"path": "/molmap/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shenwanxiang/bidd-molmap path: /molmap/__init__.py
__version__ = '1.3.9.7.2'
## to custom map object
from molmap.agg import AggMolMap
## cpds feature map
from molmap.map import MolMap
from molmap.cpd import GlobCpdMolMap
<|fim_suffix|>## na sequence feature map
from molmap.seq import GlobNASeq... | code_fim | medium | {
"lang": "python",
"repo": "shenwanxiang/bidd-molmap",
"path": "/molmap/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> K = image_model.get_internal_calibration()
image_name = image_model.get_image_name()
img = cv2.imread(image_name, cv2.IMREAD_COLOR)
def to_homogenous_coords(vec2):
ans = np.ones(3)
ans[:2] = vec2
return ans
for line in lines_img_ga:
size = 1 #... | code_fim | hard | {
"lang": "python",
"repo": "ereide/pyga-camcal",
"path": "/examples/calibration_common.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ereide/pyga-camcal path: /examples/calibration_common.py
import cv2
from matplotlib import pyplot as plt
import numpy as np
import time
import os
# from pygacal import geometry, camera, rotation
from pygacal.geometry.transformations import *
from pygacal.rotation import minimizeError
from p... | code_fim | hard | {
"lang": "python",
"repo": "ereide/pyga-camcal",
"path": "/examples/calibration_common.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bluetenhonig/palettepen path: /code/ColorMLPrediction43MultilabelNoGrid.py
lab2dt2 = le.transform(no_nanlab2pt2)
lab2pt2_enc = len(lab2pt2) * [None]
j = 0
for i, el in enumerate(lab2pt2):
el = str(el)
if el != 'nan':
lab2pt2_enc[i] = lab2dt2[j]
... | code_fim | hard | {
"lang": "python",
"repo": "Bluetenhonig/palettepen",
"path": "/code/ColorMLPrediction43MultilabelNoGrid.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bluetenhonig/palettepen path: /code/ColorMLPrediction43MultilabelNoGrid.py
n_scores.append(prec)
train_scores.append(recall)
train_scores.append(f1)
else:
train_scores.append(i)
test_scores = []
for i in testing[:11]:
i = i[max_i... | code_fim | hard | {
"lang": "python",
"repo": "Bluetenhonig/palettepen",
"path": "/code/ColorMLPrediction43MultilabelNoGrid.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def train_test_split_decisiontreeclassifier(X_train, y_train):
params = []
# varying parameters
max_depth = [1, 5, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20]
combinations = len(max_depth)
print(combinations)
train_accuracy_score_all = []
train_fbeta_score_micro_all = [... | code_fim | hard | {
"lang": "python",
"repo": "Bluetenhonig/palettepen",
"path": "/code/ColorMLPrediction43MultilabelNoGrid.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #allocate output array
rec_mbir_final=np.zeros((num_slice,sino['Ns_orig'],sino['Ns_orig']),dtype=np.float32)
#Move all data to GPU
print('Moving data to GPU')
slice_1=slice(0,num_slice,2)
slice_2=slice(1,num_slice,2)
gdata=afnp.array(new_tom... | code_fim | hard | {
"lang": "python",
"repo": "arbrefleur/Xi-cam",
"path": "/xicam/plugins/tomography/tomocam/tomoCam.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arbrefleur/Xi-cam path: /xicam/plugins/tomography/tomocam/tomoCam.py
import tomopy
import argparse
import numpy as np
import afnumpy as afnp
import arrayfire as af
from gnufft import tvd_update,add_hessian
from XT_ForwardModel import forward_project, init_nufft_params, back_project
def gpuGridr... | code_fim | hard | {
"lang": "python",
"repo": "arbrefleur/Xi-cam",
"path": "/xicam/plugins/tomography/tomocam/tomoCam.py",
"mode": "psm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|> #loop over all slices
for iter_num in range(num_iter):
print('Iteration %d of %d'%(iter_num,num_iter))
#Derivative of the data fitting term
for i in range(num_slice/2):
temp_x[pad_idx,pad_idx]=x_recon[i]
Ax = forward_project(temp_x,nufft_... | code_fim | hard | {
"lang": "python",
"repo": "arbrefleur/Xi-cam",
"path": "/xicam/plugins/tomography/tomocam/tomoCam.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|> ,replace='median'
):
apunittab = self.table[instrument]['apunit']
model = self.table[instrument]['model']
apsize2 = None
value = None
if (apunittab=='arcsec') & (apunit=='pix'):
apsize2 = self.pix2arcsec(instrument,... | code_fim | hard | {
"lang": "python",
"repo": "bkornpob/kbastroutils",
"path": "/build/lib/kbastroutils/grismapcorr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> out = None
if not instrument:
print('Error: instrument is required. Set to None')
return
if not pixsize:
print('Error: pixsize is required. Set to None')
return
scale = self.table[instrument]['scale']
scaleunit = self.... | code_fim | hard | {
"lang": "python",
"repo": "bkornpob/kbastroutils",
"path": "/build/lib/kbastroutils/grismapcorr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bkornpob/kbastroutils path: /build/lib/kbastroutils/grismapcorr.py
import numpy as np
from scipy.interpolate import interp2d
import copy
class GrismApCorr:
def __init__(self):
TABLE = {'HST-WFC3-IR-G102':
{'ref': 'ISR WFC3-2011-05'
,'filter': 'G102... | code_fim | hard | {
"lang": "python",
"repo": "bkornpob/kbastroutils",
"path": "/build/lib/kbastroutils/grismapcorr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return M(c="dvi")(
#M("Home", f="index"),
M("Recovery Requests", f="recreq")(
M("New Request", m="create"),
M("List Current",
vars={"recreq.status":"1,2,3"}),
),
... | code_fim | hard | {
"lang": "python",
"repo": "sungkomp/SAMBRO",
"path": "/modules/templates/IRS/menus.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ DVI / Disaster Victim Identification """
return M(c="dvi")(
#M("Home", f="index"),
M("Recovery Requests", f="recreq")(
M("New Request", m="create"),
M("List Current",
vars... | code_fim | hard | {
"lang": "python",
"repo": "sungkomp/SAMBRO",
"path": "/modules/templates/IRS/menus.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sungkomp/SAMBRO path: /modules/templates/IRS/menus.py
# -*- coding: utf-8 -*-
from gluon import *
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
# ===================================================================... | code_fim | hard | {
"lang": "python",
"repo": "sungkomp/SAMBRO",
"path": "/modules/templates/IRS/menus.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: getsentry/changes path: /changes/api/build_flaky_tests.py
from __future__ import absolute_import
from changes.api.base import APIView
from changes.config import db
from changes.constants import Result
from changes.models.build import Build
from changes.models.job import Job
from changes.models.t... | code_fim | hard | {
"lang": "python",
"repo": "getsentry/changes",
"path": "/changes/api/build_flaky_tests.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Fall back to any test if this was never committed
if not most_recent_test:
most_recent_test = TestCase.query.filter(
TestCase.project_id == project_id,
TestCase.name_sha == test_name_sha,
).order_by(TestCase.date_created.desc()).fir... | code_fim | hard | {
"lang": "python",
"repo": "getsentry/changes",
"path": "/changes/api/build_flaky_tests.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DuneRoot/bpl-lib path: /tests/time/TestTime.py
import unittest
from datetime import datetime
from bpl_lib.network.Network import Network
from bpl_lib.time.Time import Time
class TestTime(unittest.TestCase):
<|fim_suffix|> def test_get_slot_number(self):
timestamp = 43021073
s... | code_fim | hard | {
"lang": "python",
"repo": "DuneRoot/bpl-lib",
"path": "/tests/time/TestTime.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertIsNotNone(time)
self.assertIsInstance(time, str)
self.assertEqual(time, date_time.strftime("%Y-%m-%d %H:%M:%S"))
def test_get_slot_number(self):
timestamp = 43021073
slot_number = Time.get_slot_number(timestamp)
self.assertIsNotNone(slot_num... | code_fim | medium | {
"lang": "python",
"repo": "DuneRoot/bpl-lib",
"path": "/tests/time/TestTime.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> date_time = datetime.utcfromtimestamp(1533122273)
time = Time.get_real_time(43021073)
self.assertIsNotNone(time)
self.assertIsInstance(time, str)
self.assertEqual(time, date_time.strftime("%Y-%m-%d %H:%M:%S"))
def test_get_slot_number(self):
timestamp ... | code_fim | hard | {
"lang": "python",
"repo": "DuneRoot/bpl-lib",
"path": "/tests/time/TestTime.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(cookie2json.format(args.cookie))<|fim_prefix|># repo: mlzxgzy/cookie2json path: /cookie2json/__main__.py
import cookie2json, argparse
<|fim_middle|>parser = argparse.ArgumentParser()
parser.add_argument('cookie', help='plz put cookie plaintext here')
args = parser.parse_args()
| code_fim | medium | {
"lang": "python",
"repo": "mlzxgzy/cookie2json",
"path": "/cookie2json/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlzxgzy/cookie2json path: /cookie2json/__main__.py
import cookie2json, argparse
<|fim_suffix|>print(cookie2json.format(args.cookie))<|fim_middle|>parser = argparse.ArgumentParser()
parser.add_argument('cookie', help='plz put cookie plaintext here')
args = parser.parse_args()
| code_fim | medium | {
"lang": "python",
"repo": "mlzxgzy/cookie2json",
"path": "/cookie2json/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # There is only two articles that made it, no more and *no less*
self.assertEqual(2, Article.objects.count())
# Check that the article in db are the one we expect
for article in Article.objects.all():
self.assertIn(article.title, ['Article B... | code_fim | hard | {
"lang": "python",
"repo": "liberation/django-swallow",
"path": "/swallow/tests/transactions.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liberation/django-swallow path: /swallow/tests/transactions.py
import os
import re
from base import BaseSwallowTests
try:
from django.test.utils import override_settings
except ImportError:
from override_settings import override_settings
from . import Article
from integration import Ar... | code_fim | hard | {
"lang": "python",
"repo": "liberation/django-swallow",
"path": "/swallow/tests/transactions.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_to_response("gedgo/documentaries.html",
{'documentaries': documentaries},
context_instance=RequestContext(request, site_context(request)))<|fim_prefix|># repo: RaD/gedgo path: /views/documentaries.py
from django.template import RequestContext
from django.contrib.auth.dec... | code_fim | medium | {
"lang": "python",
"repo": "RaD/gedgo",
"path": "/views/documentaries.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> documentaries = Documentary.objects.all().order_by('-last_updated')
return render_to_response("gedgo/documentaries.html",
{'documentaries': documentaries},
context_instance=RequestContext(request, site_context(request)))<|fim_prefix|># repo: RaD/gedgo path: /views/documentaries.p... | code_fim | medium | {
"lang": "python",
"repo": "RaD/gedgo",
"path": "/views/documentaries.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RaD/gedgo path: /views/documentaries.py
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
<|fim_suffix|> documentaries = Documentary.objects.all().order_by('-last_updated')
return render_to... | code_fim | medium | {
"lang": "python",
"repo": "RaD/gedgo",
"path": "/views/documentaries.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def write(self, fpath):
print('writing pipeline filepath = {!r}'.format(fpath))
text = self.make_pipeline_text()
with open(fpath, 'w') as file:
file.write(text)
def run(self, dry=False):
"""
Executes this pipeline.
Writes a temporary pi... | code_fim | hard | {
"lang": "python",
"repo": "Erotemic/misc",
"path": "/old/pipedef.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Erotemic/misc path: /old/pipedef.py
-*- coding: utf-8 -*-
"""
Module for programatic Sprokit pipeline definitions
pipedef (pypedef?)
Outline / Proof-of-concept
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from os.path import join, exists
import collecti... | code_fim | hard | {
"lang": "python",
"repo": "Erotemic/misc",
"path": "/old/pipedef.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_disorder.py
#calss header
class _DISORDER():
def __init__(self,):
self.name = "DISORDER"
self.definitions = [u'a state of untidiness or lack of organization: ', u'an illness of the mind or body: ', u'an angry, possibly violent, expression of n... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_disorder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jacobwindsor/tmerge path: /tmerge/merge/rules_test.py
import unittest
import copy
from tmerge.utils.fakers import Faker
from .rules import transcript_overlap, TSS_TES_overlap, ordered_subset, ruleset, first_last_exon_intron_overlap
class TestRules(unittest.TestCase):
def setUp(self):
... | code_fim | hard | {
"lang": "python",
"repo": "jacobwindsor/tmerge",
"path": "/tmerge/merge/rules_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(3):
t2.remove_junction(*t2.sorted_junctions[0])
self.assertFalse(ruleset(t1, t2))
def test_tolerance(self):
t1 = self.faker.tm(3)
t2 = copy.deepcopy(t1)
for junction in t2.sorted_junctions:
t2.add_junction(junction[0] - ... | code_fim | hard | {
"lang": "python",
"repo": "jacobwindsor/tmerge",
"path": "/tmerge/merge/rules_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: niieq/fudbyte path: /fudbyte/apps/restaurant/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-21 12:31
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
impo... | code_fim | hard | {
"lang": "python",
"repo": "niieq/fudbyte",
"path": "/fudbyte/apps/restaurant/migrations/0001_initial.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>'slug', models.CharField(blank=True, editable=False, max_length=255, null=True, unique=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('active', models.BooleanField(default=True)),
... | code_fim | hard | {
"lang": "python",
"repo": "niieq/fudbyte",
"path": "/fudbyte/apps/restaurant/migrations/0001_initial.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: msr-fiddle/pipedream path: /runtime/translation/seq2seq/data/sampler.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import logging
import torch
from torch.utils.data.sampler import Sampler
from seq2seq.utils import get_world_size, get_rank
class BucketingSampler(... | code_fim | hard | {
"lang": "python",
"repo": "msr-fiddle/pipedream",
"path": "/runtime/translation/seq2seq/data/sampler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __len__(self):
return self.num_samples // self.world_size
def set_epoch(self, epoch):
"""
Sets current epoch index. This value is used to seed RNGs in __iter__()
function.
:param epoch: index of current epoch
"""
self.epoch = epoch
cl... | code_fim | hard | {
"lang": "python",
"repo": "msr-fiddle/pipedream",
"path": "/runtime/translation/seq2seq/data/sampler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
admin.site.register(models.CheckIn, admin_class=CheckinAdmin)<|fim_prefix|># repo: hackkosice/registration path: /checkin/admin.py
from django.contrib import admin
from checkin import models
# Register your models here.
class CheckinAdmin(admin.ModelAdmin):
list_display = (
'user', 'chec... | code_fim | easy | {
"lang": "python",
"repo": "hackkosice/registration",
"path": "/checkin/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CheckinAdmin(admin.ModelAdmin):
list_display = (
'user', 'check_type', 'application', 'update_time'
)
search_fields = list_display
date_hierarchy = 'update_time'
def get_actions(self, request):
return []
admin.site.register(models.CheckIn, admin_class=CheckinAd... | code_fim | easy | {
"lang": "python",
"repo": "hackkosice/registration",
"path": "/checkin/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hackkosice/registration path: /checkin/admin.py
from django.contrib import admin
from checkin import models
# Register your models here.
class CheckinAdmin(admin.ModelAdmin):
<|fim_suffix|> return []
admin.site.register(models.CheckIn, admin_class=CheckinAdmin)<|fim_middle|> list_... | code_fim | medium | {
"lang": "python",
"repo": "hackkosice/registration",
"path": "/checkin/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mlab_dir = path.dirname(path.abspath(__file__))
env = Environment(
loader=FileSystemLoader(path.join(mlab_dir, "templates"))
)
job_template = env.get_template("array_job_template.sh")
info_template = env.get_template("info.txt")
output_from_job_template = job_template.rend... | code_fim | hard | {
"lang": "python",
"repo": "knightlab-analyses/regression-benchmarking",
"path": "/q2_mlab/orchestrator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: knightlab-analyses/regression-benchmarking path: /q2_mlab/orchestrator.py
#!/usr/bin/env python
import json
import math
import click
import random
from os import path, makedirs
from sklearn.model_selection import ParameterGrid
from jinja2 import Environment, FileSystemLoader
from q2_mlab import R... | code_fim | hard | {
"lang": "python",
"repo": "knightlab-analyses/regression-benchmarking",
"path": "/q2_mlab/orchestrator.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> output_from_info_template = info_template.render(
PARAMS_FP=PARAMS_FP,
CHUNK_SIZE=CHUNK_SIZE,
N_PARAMS=N_PARAMS,
REMAINDER=REMAINDER,
N_CHUNKS=N_CHUNKS,
)
output_script = path.join(
base_dir, dataset, "_".join([preparation, target, ALGORITHM]) +... | code_fim | hard | {
"lang": "python",
"repo": "knightlab-analyses/regression-benchmarking",
"path": "/q2_mlab/orchestrator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
("core", "0049_add_manytomany_referral_user"),
]
operations = [
migrations.RunPython(forwards, reverse_code=backwards),
]<|fim_prefix|># repo: MTES-MCT/partaj path: /src/backend/partaj/core/migrations/0050_add_exist... | code_fim | hard | {
"lang": "python",
"repo": "MTES-MCT/partaj",
"path": "/src/backend/partaj/core/migrations/0050_add_existing_referral_user_to_manytomany.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MTES-MCT/partaj path: /src/backend/partaj/core/migrations/0050_add_existing_referral_user_to_manytomany.py
# Generated by Django 3.0.5 on 2021-11-03 15:14
from django.db import migrations
def forwards(apps, schema_editor):
"""
Copy all existing relations between users and referrals, as... | code_fim | medium | {
"lang": "python",
"repo": "MTES-MCT/partaj",
"path": "/src/backend/partaj/core/migrations/0050_add_existing_referral_user_to_manytomany.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
("core", "0049_add_manytomany_referral_user"),
]
operations = [
migrations.RunPython(forwards, reverse_code=backwards),
]<|fim_prefix|># repo: MTES-MCT/partaj path: /src/backend/partaj/core/migrations/0050_add_exis... | code_fim | hard | {
"lang": "python",
"repo": "MTES-MCT/partaj",
"path": "/src/backend/partaj/core/migrations/0050_add_existing_referral_user_to_manytomany.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def get(params: argparse.Namespace) -> LASSIEncoder:
if params.encoder_type == 'basic_cnn':
logger.debug('Build BasicCNN encoder')
return LASSIEncoderBasicCNN(params)
elif params.encoder_type == 'resnet':
logger.debug('Build ResNet1... | code_fim | hard | {
"lang": "python",
"repo": "Mametchiii/lassi-reproducibility",
"path": "/src/models/lassi_encoder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def latent_dimension() -> int:
return 512
class LASSIEncoderLinear(LASSIEncoder):
def __init__(self, params: argparse.Namespace):
super(LASSIEncoderLinear, self).__init__(params)
self.encoder = MLP(
layers=[GenModelFactory.get(params).latent... | code_fim | hard | {
"lang": "python",
"repo": "Mametchiii/lassi-reproducibility",
"path": "/src/models/lassi_encoder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mametchiii/lassi-reproducibility path: /src/models/lassi_encoder.py
import argparse
from loguru import logger
import torch
import torch.nn as nn
import torchvision
from models.common import BasicCNNCelebAEncoder, MLP
from models.gen_model_factory import GenModelFactory
class MyBatchNorm1d(nn.... | code_fim | hard | {
"lang": "python",
"repo": "Mametchiii/lassi-reproducibility",
"path": "/src/models/lassi_encoder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ucasqcz/Hydra path: /src/models/lenet.py
from collections import OrderedDict
import torch.nn as nn
from .hydra_base import Hydra, Block
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
<|fim_suffix|> # Head constructor
def define_head(n_... | code_fim | hard | {
"lang": "python",
"repo": "ucasqcz/Hydra",
"path": "/src/models/lenet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Define the heads and stack them on
for head in heads:
module = define_head(head['n_classes'])
h = self.add_head(module, head['task_id'])
h.stack_on(x)
# Don't forget to build the model
self.build()<|fim_prefix|># repo: ucasqcz/Hydra p... | code_fim | hard | {
"lang": "python",
"repo": "ucasqcz/Hydra",
"path": "/src/models/lenet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bevis-wong/rt-thread path: /bsp/stm32f4xx-HAL/drivers/SConscript
Import('RTT_ROOT')
Import('rtconfig')
from building import *
cwd = os.path.join(str(Dir('#')), 'drivers')
# add the general drivers.
src = Split("""
board.c
stm32f4xx_it.c
""")
if GetDepend(['RT_USING_PIN']):
src += ['drv_gpi... | code_fim | hard | {
"lang": "python",
"repo": "bevis-wong/rt-thread",
"path": "/bsp/stm32f4xx-HAL/drivers/SConscript",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if GetDepend(['RT_USING_PWM']):
src += ['drv_pwm.c']
CPPPATH = [cwd]
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
Return('group')<|fim_prefix|># repo: bevis-wong/rt-thread path: /bsp/stm32f4xx-HAL/drivers/SConscript
Import('RTT_ROOT')
Import('rtconfig')
from building impor... | code_fim | hard | {
"lang": "python",
"repo": "bevis-wong/rt-thread",
"path": "/bsp/stm32f4xx-HAL/drivers/SConscript",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/torchgeo path: /torchgeo/datamodules/nasa_marine_debris.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""NASA Marine Debris datamodule."""
from typing import Any
import torch
from torch import Tensor
from ..datasets import NASAMarin... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/torchgeo",
"path": "/torchgeo/datamodules/nasa_marine_debris.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.val_split_pct = val_split_pct
self.test_split_pct = test_split_pct
self.collate_fn = collate_fn
def setup(self, stage: str) -> None:
"""Set up datasets.
Args:
stage: Either 'fit', 'validate', 'test', or 'predict'.
"""
self.dat... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/torchgeo",
"path": "/torchgeo/datamodules/nasa_marine_debris.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> content = buff.getvalue()
buff.close()
message = protocol.thread.received(
message=content, client=s.getpeername()[0])
self.logic_queue.put(message)
... | code_fim | hard | {
"lang": "python",
"repo": "doctoromer/haya-data",
"path": "/server/network.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Attributes:
logger (logging.Logger): The logger of the thread.
logic_queue (Queue.Queue): The queue of the logic thread.
network_queue (Queue.Queue): The queue of the thread.
running (bool): The flag of the main loop.
sockets (dict): Dict of the connections... | code_fim | hard | {
"lang": "python",
"repo": "doctoromer/haya-data",
"path": "/server/network.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doctoromer/haya-data path: /server/network.py
"""
This module handles the connections of the server.
Attributes:
receiver_running (bool): Flag to kill the receiver thread
"""
import socket
import threading
import logging
import select
import cStringIO as StringIO
import protocol... | code_fim | hard | {
"lang": "python",
"repo": "doctoromer/haya-data",
"path": "/server/network.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bradh/shakenfist path: /shakenfist/tests/test_net.py
import mock
import testtools
from shakenfist import net
class NetTestCase(testtools.TestCase):
def setUp(self):
super(NetTestCase, self).setUp()
self.ipmanager_persist = mock.patch(
'shakenfist.db.persist_ip... | code_fim | hard | {
"lang": "python",
"repo": "bradh/shakenfist",
"path": "/shakenfist/tests/test_net.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.ipmanager_persist = mock.patch(
'shakenfist.db.persist_ipmanager')
self.mock_ipmanager_persist = self.ipmanager_persist.start()
def test_init(self):
net.Network(uuid='notauuid', vxlan_id=42, provide_dhcp=True,
provide_nat=True, physical_nic... | code_fim | hard | {
"lang": "python",
"repo": "bradh/shakenfist",
"path": "/shakenfist/tests/test_net.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PitPietro/python-scripts path: /text_to_speech/email_reader.py
from datetime import datetime
from gtts import gTTS
from time import sleep
from selenium import webdriver
import pyautogui as p_gui
def open_file(path):
with open(path, 'r') as my_file:
text_lines = my_file.readlines()
... | code_fim | hard | {
"lang": "python",
"repo": "PitPietro/python-scripts",
"path": "/text_to_speech/email_reader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> usr_el = my_browser.find_element_by_css_selector('#identifierId')
usr_el.send_keys(username)
usr_el.submit()
# login_1 = my_browser.find_element_by_css_selector('.VfPpkd-RLmnJb')
# login_1.click()
sleep(2)
pdw_el = my_browser.find_element_by_css_selector('.I0VJ4d > div:nth-c... | code_fim | medium | {
"lang": "python",
"repo": "PitPietro/python-scripts",
"path": "/text_to_speech/email_reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> my_browser.get('https://mail.google.com/mail/u/0/#inbox')
sleep(2)
return my_browser
def read_single_mail(browser, prev_id, obj, body):
prev_el = browser.find_element_by_id(prev_id)
prev_el.click()
sleep(2)
obj_txt = browser.find_element_by_id(obj).text
# sender_txt = b... | code_fim | hard | {
"lang": "python",
"repo": "PitPietro/python-scripts",
"path": "/text_to_speech/email_reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> The instance mask matrices are expected to be in the shape of (num_instances,
height, width, 1) or (num_instance, height, width). The height and width
correspond to the image height and width. For each instance mask, the pixel
value is either 0, representing a background, or 1, representing the ob... | code_fim | hard | {
"lang": "python",
"repo": "jianzhnie/models",
"path": "/official/vision/data/tf_example_feature_key.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jianzhnie/models path: /official/vision/data/tf_example_feature_key.py
# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of th... | code_fim | hard | {
"lang": "python",
"repo": "jianzhnie/models",
"path": "/official/vision/data/tf_example_feature_key.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@dataclass
class EncodedPanopticMaskFeatureKey(
tf_example_feature_key.TfExampleFeatureKeyBase):
"""Feature keys for encoded panoptic category and instance masks.
Both panoptic mask matrices are expected to be in the shape of (height, width,
1) or (height, width). The height and width correspo... | code_fim | hard | {
"lang": "python",
"repo": "jianzhnie/models",
"path": "/official/vision/data/tf_example_feature_key.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mozaiques/denis path: /tests/test_base.py
import denis
paris_lat_lng = (48.864716, 2.349014)
base = denis.Base(paris_lat_lng)
def test_xy_to_latlng():
<|fim_suffix|> assert denis.is_zero(p2._x - 10.5)
assert denis.is_zero(p2._y - 10.5)
def test_latlng_to_xy():
p1 = base.make_poin... | code_fim | medium | {
"lang": "python",
"repo": "mozaiques/denis",
"path": "/tests/test_base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_latlng_to_xy():
p1 = base.make_point(lat_lng=(48.865, 2.3486))
p2 = base.make_point(x_y=(p1._x, p1._y))
assert denis.is_zero(p2.latitude - 48.865)
assert denis.is_zero(p2.longitude - 2.3486)<|fim_prefix|># repo: mozaiques/denis path: /tests/test_base.py
import denis
paris_lat_... | code_fim | medium | {
"lang": "python",
"repo": "mozaiques/denis",
"path": "/tests/test_base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tricksterDRE/special-meme path: /meme/api_1_0/resources/tasks_in_period.py
from flask_restful import Resource, reqparse
from flask import jsonify
from datetime import datetime
from meme.models import Task
from meme import ma
class TasksInPeriodSchema(ma.ModelSchema):
class Meta:
mod... | code_fim | hard | {
"lang": "python",
"repo": "tricksterDRE/special-meme",
"path": "/meme/api_1_0/resources/tasks_in_period.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args['period_start'] is None or args['period_end'] is None:
return {'error': 'missing required parameter'}, 400
try:
period_start = datetime.strptime(args['period_start'], '%Y-%m-%dT%H:%M:%S')
period_end = datetime.strptime(args['period_end'], '%Y-%m... | code_fim | hard | {
"lang": "python",
"repo": "tricksterDRE/special-meme",
"path": "/meme/api_1_0/resources/tasks_in_period.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kamyu104/LeetCode-Solutions path: /Python/find-the-width-of-columns-of-a-grid.py
# Time: O(m * n)
# Space: O(1)
# array
class Solution(object):
def findColumnWidth(self, grid):
"""
:type grid: List[List[int]]
:rtype: List[int]
"""
def length(x):
... | code_fim | hard | {
"lang": "python",
"repo": "kamyu104/LeetCode-Solutions",
"path": "/Python/find-the-width-of-columns-of-a-grid.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:type grid: List[List[int]]
:rtype: List[int]
"""
return [max(len(str(x)) for x in col) for col in itertools.izip(*grid)]<|fim_prefix|># repo: kamyu104/LeetCode-Solutions path: /Python/find-the-width-of-columns-of-a-grid.py
# Time: O(m * n)
# Space: O(1)
# ar... | code_fim | hard | {
"lang": "python",
"repo": "kamyu104/LeetCode-Solutions",
"path": "/Python/find-the-width-of-columns-of-a-grid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def findColumnWidth(self, grid):
"""
:type grid: List[List[int]]
:rtype: List[int]
"""
return [max(len(str(x)) for x in col) for col in itertools.izip(*grid)]<|fim_prefix|># repo: kamyu104/LeetCode-Solutions path: /Python/find-the-width-of-columns-of-a-grid.py
... | code_fim | medium | {
"lang": "python",
"repo": "kamyu104/LeetCode-Solutions",
"path": "/Python/find-the-width-of-columns-of-a-grid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def prices(self):
"""
gives easy access to all prices in the book through a :class:`piecash.model_common.CallableList`
of :class:`piecash.core.commodity.Price`
"""
from .commodity import Price
return CallableList(self.session.query(Price))... | code_fim | hard | {
"lang": "python",
"repo": "tfree87/piecash",
"path": "/piecash/core/book.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tfree87/piecash path: /piecash/core/book.py
import warnings
from sqlalchemy import Column, VARCHAR, ForeignKey
from sqlalchemy.orm import relation
from sqlalchemy.orm.exc import NoResultFound
from .._declbase import DeclarativeBaseGuid
from .._common import CallableList
from . import factories
... | code_fim | hard | {
"lang": "python",
"repo": "tfree87/piecash",
"path": "/piecash/core/book.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dschinzo/Competitive-Programming path: /HackerRank/solution/practice/mathematics/fundamentals/most-distant/solution.py
alist = []
blist = []
for i in range(int(input())):
a, b = input().split(' ')
alist.append(int(a))
blist.append(int(b))
x1 = min(alist)
x2 = ma<|fim_suffix|> y2**2)**... | code_fim | medium | {
"lang": "python",
"repo": "dschinzo/Competitive-Programming",
"path": "/HackerRank/solution/practice/mathematics/fundamentals/most-distant/solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> y2**2)**0.5, (x2**2 + y2**2)**0.5,(x2**2 + y1**2)**0.5,(x1**2 + y1**2)**0.5))<|fim_prefix|># repo: dschinzo/Competitive-Programming path: /HackerRank/solution/practice/mathematics/fundamentals/most-distant/solution.py
alist = []
blist = []
for i in range(int(input())):
a, b = input().split(' ')
... | code_fim | medium | {
"lang": "python",
"repo": "dschinzo/Competitive-Programming",
"path": "/HackerRank/solution/practice/mathematics/fundamentals/most-distant/solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if category2 == 'new' and dt > dt2:
# time_diff = dt - dt2
# score = calculation.index(tokens, tokens2)
score = calculation.index(cleaned, cleaned2, tfidf)
if score >= threshold:
result.append([time, tweet, time2, tweet2, score, 'sim... | code_fim | hard | {
"lang": "python",
"repo": "dwiajik/twit-macet-mining-v2",
"path": "/create_pair_dataset_tfidf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dwiajik/twit-macet-mining-v2 path: /create_pair_dataset_tfidf.py
import argparse
import csv
from datetime import datetime, timedelta
import os
from modules import cleaner, tokenizer
from modules.similarity_tfidf import *
from modules.tfidf import TFIDF
parser = argparse.ArgumentParser(descripti... | code_fim | hard | {
"lang": "python",
"repo": "dwiajik/twit-macet-mining-v2",
"path": "/create_pair_dataset_tfidf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LMiceOrg/Modelingtools path: /autotools/modelparser/excelmodeldeclarationparser.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Excel ModelDeclaration模型声明解析器
ExcelModelDeclarationParser
元模型定义表单
1: 实体程序模型:
序号, 模型类别(大类,模型分类, 模型细类), 中文名称, 英文名称,模型名称,
模型编号, LVC分类,组件类型,功能要求,模型粒度,模型设计(功... | code_fim | hard | {
"lang": "python",
"repo": "LMiceOrg/Modelingtools",
"path": "/autotools/modelparser/excelmodeldeclarationparser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> md_no = ''
md_type1 = ''
md_type2 = ''
md_type3 = ''
md_cname = ''
md_ename=''
md_name=''
md_serno=''
md_lvc=''
md_type =''
md_req =''
md_grain=''
md_dfunc =''
md_dintf=''
md_dalgo=''
... | code_fim | hard | {
"lang": "python",
"repo": "LMiceOrg/Modelingtools",
"path": "/autotools/modelparser/excelmodeldeclarationparser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>output = """
{n(c,c), q(a,b,b), q(a,b,c), q(b,b,c), q(b,c,a), q(c,a,a), q(c,b,c), r(a,a,b), r(a,a,c), s(a,b), s(a,c), s(c,b), s(c,c), t(a), t(b), v(c), w(a,a), w(b,b), w(b,c)}
"""<|fim_prefix|># repo: bernardocuteri/wasp path: /tests/wasp1/AllAnswerSets/bug_09.test.py
input = """
q(a,b,c).
q(b,c,a).
q(c,... | code_fim | hard | {
"lang": "python",
"repo": "bernardocuteri/wasp",
"path": "/tests/wasp1/AllAnswerSets/bug_09.test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>p(X,Y) :- q(X,b,Z), r(Z,b,Y), not r(X,Y,Z).
m(X,Y) :- u(a,X,Y,Y,c,X).
v(X) :- s(a,X), not t(X).
n(X,X) :- q(X,b,X).
r(X,Y,Z) :- t(a), s(X,Z), w(X,Y), not p(Z,Y).
"""
output = """
{n(c,c), q(a,b,b), q(a,b,c), q(b,b,c), q(b,c,a), q(c,a,a), q(c,b,c), r(a,a,b), r(a,a,c), s(a,b), s(a,c), s(c,b), s(c,c), t(a),... | code_fim | easy | {
"lang": "python",
"repo": "bernardocuteri/wasp",
"path": "/tests/wasp1/AllAnswerSets/bug_09.test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bernardocuteri/wasp path: /tests/wasp1/AllAnswerSets/bug_09.test.py
input = """
q(a,b,c).
q(b,c,a).
q(c,b,c).
q(b,b,c).
q(a,b,b).
q(c,a,a).
s(c,b).
s(a,b).
s(a,c).
s(c,c).
<|fim_suffix|>p(X,Y) :- q(X,b,Z), r(Z,b,Y), not r(X,Y,Z).
m(X,Y) :- u(a,X,Y,Y,c,X).
v(X) :- s(a,X), not t(X).
n(X,X) :- q(X... | code_fim | easy | {
"lang": "python",
"repo": "bernardocuteri/wasp",
"path": "/tests/wasp1/AllAnswerSets/bug_09.test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Input fields."""
slug = StringField(label="Slug")
class Output:
data_id = IntegerField(label="Data ID")
def run(self, inputs, outputs):
data_id = self.get_data_id_by_slug(inputs.slug)
outputs.data_id = data_id<|fim_prefix|># repo: genialis/resolwe pat... | code_fim | hard | {
"lang": "python",
"repo": "genialis/resolwe",
"path": "/resolwe/process/tests/processes/python_data_by_slug.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: genialis/resolwe path: /resolwe/process/tests/processes/python_data_by_slug.py
from resolwe.process import IntegerField, Process, StringField
class PythonProcessDataIdBySlug(Process):
"""The process is used for testing get_data_id_by_slug."""
slug = "test-python-process-data-id-by-slug... | code_fim | medium | {
"lang": "python",
"repo": "genialis/resolwe",
"path": "/resolwe/process/tests/processes/python_data_by_slug.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self, inputs, outputs):
data_id = self.get_data_id_by_slug(inputs.slug)
outputs.data_id = data_id<|fim_prefix|># repo: genialis/resolwe path: /resolwe/process/tests/processes/python_data_by_slug.py
from resolwe.process import IntegerField, Process, StringField
class PythonPr... | code_fim | medium | {
"lang": "python",
"repo": "genialis/resolwe",
"path": "/resolwe/process/tests/processes/python_data_by_slug.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: efokschaner/pbundler path: /debug.py
"""
A simple wrapper to invoke pbundler without needing to install it, making debugging easier in an IDE
"""
import sys
from pbundler import PBCli
<|fim_suffix|> sys.exit(PBCli().run(sys.argv))
if __name__ == '__main__':
main()<|fim_middle|>
def mai... | code_fim | easy | {
"lang": "python",
"repo": "efokschaner/pbundler",
"path": "/debug.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
main()<|fim_prefix|># repo: efokschaner/pbundler path: /debug.py
"""
A simple wrapper to invoke pbundler without needing to install it, making debugging easier in an IDE
"""
import sys
from pbundler import PBCli
<|fim_middle|>def main():
sys.exit(PBCli().run(sys.argv... | code_fim | easy | {
"lang": "python",
"repo": "efokschaner/pbundler",
"path": "/debug.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.