text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> solr_fields = {}
storage = PropertySheetSchemaStorage()
if not storage:
return solr_fields
for listing_name, slot_provider in LISTING_TO_SLOTS.items():
fields_by_listing = {}
for slot_name in slot_provider():
definition... | code_fim | hard | {
"lang": "python",
"repo": "4teamwork/opengever.core",
"path": "/opengever/api/listing_custom_fields.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def reply(self):
solr_fields = {}
storage = PropertySheetSchemaStorage()
if not storage:
return solr_fields
for listing_name, slot_provider in LISTING_TO_SLOTS.items():
fields_by_listing = {}
for slot_name in slot_provider():
... | code_fim | medium | {
"lang": "python",
"repo": "4teamwork/opengever.core",
"path": "/opengever/api/listing_custom_fields.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmwbook/small-projects path: /MultipleMovieTimer/main.py
= False
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main.ui'
#
# Created: Wed May 21 20:35:02 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from... | code_fim | hard | {
"lang": "python",
"repo": "tmwbook/small-projects",
"path": "/MultipleMovieTimer/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmwbook/small-projects path: /MultipleMovieTimer/main.py
= var.readline().strip()
self.updateGUITimers(movie2Time, self.textBrowser_2)
movie3Time = var.readline().strip()
self.updateGUITimers(movie3Time, self.textBrowser_5)
movie4Ti... | code_fim | hard | {
"lang": "python",
"repo": "tmwbook/small-projects",
"path": "/MultipleMovieTimer/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Ui_Form1(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
if os.path.exists(os.getcwd() + '\\settings.ini') and os.path.getsize(os.getcwd() + '\\settings.ini') > 0:
with open(os.getcwd() + '\\settings.ini', 'r') as var:
... | code_fim | hard | {
"lang": "python",
"repo": "tmwbook/small-projects",
"path": "/MultipleMovieTimer/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self):
return DBService(self.core).getNextFields("Communities", self.parameters["start"], self.parameters["offset"])<|fim_prefix|># repo: signeus/API-Web path: /modules/services/dbservices/community/get_communities_by_offset_service.py
# -*- coding: utf-8 -*-
from services.interfaces.... | code_fim | medium | {
"lang": "python",
"repo": "signeus/API-Web",
"path": "/modules/services/dbservices/community/get_communities_by_offset_service.py",
"mode": "spm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: signeus/API-Web path: /modules/services/dbservices/community/get_communities_by_offset_service.py
# -*- coding: utf-8 -*-
from services.interfaces.i_service import IService
from services.dbservices.db_service import DBService
class GetCommunitiesByOffsetService(IService):
<|fim_suffix|> r... | code_fim | medium | {
"lang": "python",
"repo": "signeus/API-Web",
"path": "/modules/services/dbservices/community/get_communities_by_offset_service.py",
"mode": "psm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_suffix|>def unique_factors(n):
return len(set(trial_division(n)))
fs = [0]
c = 0
for i in range(1,1000000):
c+= 1
fs.append(unique_factors(i))
if len(fs) > 4:
if fs[-4:] == [4,4,4,4]:
print c -3
break<|fim_prefix|># repo: jobby/project-euler path: /python/problem4... | code_fim | hard | {
"lang": "python",
"repo": "jobby/project-euler",
"path": "/python/problem47.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jobby/project-euler path: /python/problem47.py
def prime_sieve(n):
if n==2: return [2]
elif n<2: return []
s=range(3,n+1,2)
mroot = n ** 0.5
half=(n+1)/2-1
i=0
m=3
while m <= mroot:
if s[i]:
j=(m*m-3)/2
s[j]=0
while j<half:
s[j]=0
j+=m
i=i+1
m=2*i+3
return [2]+[x... | code_fim | medium | {
"lang": "python",
"repo": "jobby/project-euler",
"path": "/python/problem47.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silencezhao90/gree-server path: /models/v1/model_base.py
from abc import ABCMeta, abstractmethod
from datetime import datetime
from enum import Enum
from application.response import ResponseError
class ModelBase:
__metaclass__ = ABCMeta
@classmethod
@abstractmethod
def _get_cl... | code_fim | hard | {
"lang": "python",
"repo": "silencezhao90/gree-server",
"path": "/models/v1/model_base.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def get_by_id(cls, id):
schema = cls._get_cls_schema().query.get(id)
if schema is None:
raise ResponseError(info='对应编号信息不存在')
return cls(schema)
@classmethod
def get_by_uid(cls, uid):
schema = cls._get_cls_schema().query.filter_by(u... | code_fim | hard | {
"lang": "python",
"repo": "silencezhao90/gree-server",
"path": "/models/v1/model_base.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_dict(self, include_keys=None, exclude_keys=None, depth=0, lite=False):
""" 把用 property 装饰的属性封装到一个 dict 中再返回
:param include_keys, list, 指定需要返回的属性, 默认为全部, 但不包含下划线开始的属性
:param exclude_keys, list, 指定需要排除的属性, 默认为 []
:param depth, int, 深度, object 可能含有对其它 object 的引用,... | code_fim | hard | {
"lang": "python",
"repo": "silencezhao90/gree-server",
"path": "/models/v1/model_base.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_brand(self, obj):
return obj.brand.upper()
class CSVMerchantFeedTest(TestCase):
def test_csv_empty(self):
feed = CSVMerchantFeed([])
output = feed.get_content()
self.assertEquals(output, CSV_HEADINGS)
def test_csv(self):
feed = CSVMerchantFee... | code_fim | medium | {
"lang": "python",
"repo": "willv/django-google-product-feeder",
"path": "/google_product_feeder/tests.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: willv/django-google-product-feeder path: /google_product_feeder/tests.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.core.urlresolvers import reverse
from google_product_feeder.feed import CSVMerchantFeed, M... | code_fim | hard | {
"lang": "python",
"repo": "willv/django-google-product-feeder",
"path": "/google_product_feeder/tests.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class EmptyFakeModel(object):
# A fake model with no attributes.
def __getattr__(self, name):
raise AttributeError
class UppercaseBrandFeed(CSVMerchantFeed):
def get_brand(self, obj):
return obj.brand.upper()
class CSVMerchantFeedTest(TestCase):
def test_csv_empty(self... | code_fim | hard | {
"lang": "python",
"repo": "willv/django-google-product-feeder",
"path": "/google_product_feeder/tests.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fonzo14/sent2vec.py path: /setup.py
from setuptools import setup, find_packages
from setuptools.extension import Extension
from sys import platform
cython = True
try:
from Cython.Build import cythonize
cython = True
except ImportError:
cython = False
<|fim_suffix|># Package details
setup... | code_fim | hard | {
"lang": "python",
"repo": "fonzo14/sent2vec.py",
"path": "/setup.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> extensions = cythonize(extensions)
else:
extensions = [
Extension('sent2vec',
sources=[
'sent2vec/sent2vec.cpp',
'sent2vec/cpp/src/args.cc',
'sent2vec/cpp/src/dictionary.cc',
'sent2vec/cpp/src/fasttext.cc',
'sent2vec/cpp/src/main.cc',
'sent2vec... | code_fim | hard | {
"lang": "python",
"repo": "fonzo14/sent2vec.py",
"path": "/setup.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> h_n = h_n.contiguous().view(h_n.size()[0], h_n.size()[1]*h_n.size()[2])
# [batch_size, 4*hidden_size]
# print('h_n2:', h_n.size())
# final_hidden_state: [1, batch_size, hidden_size]
logtis = self.proj(h_n)
# print('logtis:', logtis.size())
# final_... | code_fim | hard | {
"lang": "python",
"repo": "lcaamtb/text_classification_pytorch",
"path": "/models/model_rnn_torch.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lcaamtb/text_classification_pytorch path: /models/model_rnn_torch.py
"""
Created on 01/10/18.
Author: morgan
Copyright defined in text_classification/LICENSE.txt
"""
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
class RNNClassifier(nn.Mod... | code_fim | medium | {
"lang": "python",
"repo": "lcaamtb/text_classification_pytorch",
"path": "/models/model_rnn_torch.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># class Medicamento_SaidaAdmin(admin.ModelAdmin):
# list_display = ['medicamento','quantidade','data_saida','usuario']
# admin.site.register(Usuario,UsuarioAdmin)
# admin.site.register(Lote,LoteAdmin)
# admin.site.register(Fornecedor,FornecedorAdmin)
# admin.site.register(Cliente,ClienteAdmin)
# admin.... | code_fim | hard | {
"lang": "python",
"repo": "Francislley/farmacia01",
"path": "/controle/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># class Medicamento_EntradaAdmin(admin.ModelAdmin):
# list_display = ['medicamento','lote','quantidade','data_entrada','usuario']
# class Medicamento_SaidaAdmin(admin.ModelAdmin):
# list_display = ['medicamento','quantidade','data_saida','usuario']
# admin.site.register(Usuario,UsuarioAdmin)
# admin.... | code_fim | medium | {
"lang": "python",
"repo": "Francislley/farmacia01",
"path": "/controle/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Francislley/farmacia01 path: /controle/admin.py
from django.contrib import admin
# from .models import Usuario
# from .models import Lote
# from .models import Fornecedor
# from .models import Cliente
# from .models import Medicamento
# from .models import Medicamento_Entrada
# from .models impor... | code_fim | medium | {
"lang": "python",
"repo": "Francislley/farmacia01",
"path": "/controle/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> created = models.DateTimeField(auto_now_add=True)
login_addr = models.GenericIPAddressField()
hostname = models.CharField(max_length=200)<|fim_prefix|># repo: navneetpathania374/Aunthony path: /tsmt-master/tsmt/models.py
from django.db import models
<|fim_middle|># Create your models here.
c... | code_fim | easy | {
"lang": "python",
"repo": "navneetpathania374/Aunthony",
"path": "/tsmt-master/tsmt/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: navneetpathania374/Aunthony path: /tsmt-master/tsmt/models.py
from django.db import models
<|fim_suffix|> created = models.DateTimeField(auto_now_add=True)
login_addr = models.GenericIPAddressField()
hostname = models.CharField(max_length=200)<|fim_middle|># Create your models here.
c... | code_fim | easy | {
"lang": "python",
"repo": "navneetpathania374/Aunthony",
"path": "/tsmt-master/tsmt/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Probibility of not copying: p_{word}(w) * (1 - p(z))
out_prob = torch.mul(prob, 1 - copy.expand_as(prob))
mul_attn = torch.mul(attn, copy.expand_as(attn))
return out_prob, mul_attn
def _debug_copy(self, src, copy, prob, out_prob, attn, mul_attn):
v, mid = pr... | code_fim | hard | {
"lang": "python",
"repo": "ixaxaar/OpenNMT-memnets",
"path": "/onmt/modules/CopyGenerator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> today = str(date.today())
today_list = today.split('-') # ['2019', '08', '08']
lunar_day = lunar.getDayBySolar((int)(datetime.datetime.now().year), (int)(datetime.datetime.now().month), (int)(datetime.datetime.now().day)) # 输入年月日
# 判断是否为润年
if (lunar_day.Lleap):
china_day = "... | code_fim | hard | {
"lang": "python",
"repo": "xinchenxy/ncov2019-",
"path": "/wechat_virus/virus-weixinbot-master/daily_news.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xinchenxy/ncov2019- path: /wechat_virus/virus-weixinbot-master/daily_news.py
import requests
import sxtwl
import datetime
from datetime import date
import lxml
from lxml import etree
# 日历中文索引
ymc = [u"十一", u"十二", u"正", u"二", u"三", u"四", u"五", u"六", u"七", u"八", u"九", u"十"]
rmc = [u"初一", u"初二", u"初... | code_fim | hard | {
"lang": "python",
"repo": "xinchenxy/ncov2019-",
"path": "/wechat_virus/virus-weixinbot-master/daily_news.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GabrielBalabanResearch/TCRpower path: /tcrpower/powercalc.py
import numpy as np
import numdifftools as nd
from scipy import stats
from scipy import optimize
from functools import partial
class TCRPowerCalculator:
def __init__(self, pcmodel):
self.pcmodel = pcmodel
self.predict_variance = s... | code_fim | medium | {
"lang": "python",
"repo": "GabrielBalabanResearch/TCRpower",
"path": "/tcrpower/powercalc.py",
"mode": "psm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> opt_res = optimize.root_scalar(lambda freq: opt_f(freq) - conf_level,
method = "brentq",
bracket = [1.0e-16, 1])
return opt_res.root
def get_limit_of_detection_nreads(self, tcr_freq, conf_level = 0.95):
opt_nreads = partial(self.pcmodel.predict_detection_probability, tcr_freq... | code_fim | medium | {
"lang": "python",
"repo": "GabrielBalabanResearch/TCRpower",
"path": "/tcrpower/powercalc.py",
"mode": "spm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 获取所有图片的特征向量
def get_all_features(self,des_list, num_word,centres):
# start_time = datetime.now() # 测试时间
allvec = np.zeros((len(des_list), num_word), 'float32')
for i in range(len(des_list)):
if des_list[i].any() != None:
allvec[i] = self.des2f... | code_fim | hard | {
"lang": "python",
"repo": "tf369/Img_Retriveler",
"path": "/features_builder.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.num_words = num_words #聚类中心
self.img_paths =img_paths
self.dataset_matrix =dataset_matrix #dataset_matrix:图像数据的矩阵表示 注:img_paths dataset_matrix这两个参数只需要指定一个
def getClusterCentures(self):
start_time = datetime.now() # 测试时间
feature_getter = FeatureGette... | code_fim | hard | {
"lang": "python",
"repo": "tf369/Img_Retriveler",
"path": "/features_builder.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tf369/Img_Retriveler path: /features_builder.py
from datetime import datetime
import cv2
import numpy as np
from sklearn.cluster import KMeans,MiniBatchKMeans
class FeatureGetter(object):
def __init__(self):
self.sift_det = cv2.xfeatures2d.SIFT_create()
def get_img(self, img_path... | code_fim | hard | {
"lang": "python",
"repo": "tf369/Img_Retriveler",
"path": "/features_builder.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dataset = tf.data.experimental.load(
op.join(device_alldata_dir, confusion_class),
element_spec=element_spec,
)
volumes = [tf.squeeze(tensor[0]) for _, tensor in dataset]
baseline = tf.zeros(shape=volume_shape, dtype=tf.float32)
print("Computing integrated gradients")
... | code_fim | hard | {
"lang": "python",
"repo": "richford/hbn-pod2-qc",
"path": "/docker/dl-integrated-gradients-gcp/ig/ig/integrated_gradients.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--gcs_bucket",
type=str,
help=(
"The name of the gcs bucket that will contain the saved models, "
"checkpoints, etc."
),
)
parser.add_argument(
... | code_fim | hard | {
"lang": "python",
"repo": "richford/hbn-pod2-qc",
"path": "/docker/dl-integrated-gradients-gcp/ig/ig/integrated_gradients.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thatkahunaguy/p5-Vehicle-Detection path: /Classifier.py
class Classifier(object):
"""
Trained classifier
"""
def __init__(self, classifier, scaler, orient, color_space, pix_per_cell,
cell_per_block,<|fim_suffix|>lf.orient = orient
self.pix_per_cell = p... | code_fim | hard | {
"lang": "python",
"repo": "thatkahunaguy/p5-Vehicle-Detection",
"path": "/Classifier.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>lf.orient = orient
self.pix_per_cell = pix_per_cell
self.cell_per_block = cell_per_block
self.spatial_size = spatial_size
self.hist_bins = hist_bins<|fim_prefix|># repo: thatkahunaguy/p5-Vehicle-Detection path: /Classifier.py
class Classifier(object):
"""
Trained c... | code_fim | medium | {
"lang": "python",
"repo": "thatkahunaguy/p5-Vehicle-Detection",
"path": "/Classifier.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return r
def MergeFilesHadd(output, fileList, n=20):
cmd = ["hadd", "-n", str(n), output]
cmd.extend(fileList)
subprocess.call(cmd)<|fim_prefix|># repo: aiola/alice-yale-hfjet path: /merging/MergeFiles.py
#!/usr/bin/env python
from ROOT import TFileMerger
import subprocess
def Me... | code_fim | hard | {
"lang": "python",
"repo": "aiola/alice-yale-hfjet",
"path": "/merging/MergeFiles.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def MergeFilesHadd(output, fileList, n=20):
cmd = ["hadd", "-n", str(n), output]
cmd.extend(fileList)
subprocess.call(cmd)<|fim_prefix|># repo: aiola/alice-yale-hfjet path: /merging/MergeFiles.py
#!/usr/bin/env python
from ROOT import TFileMerger
import subprocess
def MergeFiles(outpu... | code_fim | hard | {
"lang": "python",
"repo": "aiola/alice-yale-hfjet",
"path": "/merging/MergeFiles.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aiola/alice-yale-hfjet path: /merging/MergeFiles.py
#!/usr/bin/env python
from ROOT import TFileMerger
import subprocess
def MergeFiles(output, fileList, skipList=[], acceptList=[], n=20):
merger = TFileMerger(False)
merger.OutputFile(output);
merger.SetMaxOpenedFiles(n);
print... | code_fim | medium | {
"lang": "python",
"repo": "aiola/alice-yale-hfjet",
"path": "/merging/MergeFiles.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_argparse(tmp_path):
tmpl = write_file(tmp_path / 't.yaml', 'key: {{ var }}')
inp = write_file(tmp_path / 'i.json', '{"var": "Hello!"}')
out = tmp_path / 'o.json'
jiml.cli.main(jiml.cli.parse_args(
'-t', str(tmpl),
'-i', str(inp),
'-o', str(out),
))<|f... | code_fim | easy | {
"lang": "python",
"repo": "vmstarchenko/jiml",
"path": "/tests/test_cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anudeepdaggupati/hello-world- path: /b.py
import random
a=input("enter 'r' to roll the dice <|fim_suffix|>(random.randint(1,6))
elif(a=="q"):
print("bye!")
exit()
else:
print("give either 'r' or 'q'")<|fim_middle|>and 'q' to quit")
while True:
if (a=="r"):
print | code_fim | easy | {
"lang": "python",
"repo": "anudeepdaggupati/hello-world-",
"path": "/b.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
exit()
else:
print("give either 'r' or 'q'")<|fim_prefix|># repo: anudeepdaggupati/hello-world- path: /b.py
import random
a=input("enter 'r' to roll the dice and 'q' to quit")
while True:
if (a=="r"):
print<|fim_middle|>(random.randint(1,6))
elif(a=="q"):
print("bye!" | code_fim | easy | {
"lang": "python",
"repo": "anudeepdaggupati/hello-world-",
"path": "/b.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03393/s938542133.py
s = input()
if len(s) < 26:
for i in range(26):
c = chr(ord("a")+i)
if c not in s:
<|fim_suffix|> s1 = s[0:i-1]
for j in range(26):
c = chr(ord("a")+j)
if c... | code_fim | hard | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03393/s938542133.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> s1 = s[0:i-1]
for j in range(26):
c = chr(ord("a")+j)
if c > s[i-1] and c not in s1:
print(s1+c)
exit()
print(-1)<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03393/s938542133.py
s = inp... | code_fim | hard | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03393/s938542133.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if c > s[i-1] and c not in s1:
print(s1+c)
exit()
print(-1)<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03393/s938542133.py
s = input()
if len(s) < 26:
for i in range(26):
c = chr(ord("a")+i)
if c not in s:
<|fim_m... | code_fim | hard | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03393/s938542133.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rajeshravula588/Flask_Content path: /flask_project/saral.py
from flask import Flask
app=Flask('__name__')
<|fim_suffix|> name ="saral"
age="20"
return "my name is {} and age is {}".format(name,age)<|fim_middle|>@app.route("/my/<name>/<age>")
def my(name,age):
| code_fim | easy | {
"lang": "python",
"repo": "Rajeshravula588/Flask_Content",
"path": "/flask_project/saral.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> name ="saral"
age="20"
return "my name is {} and age is {}".format(name,age)<|fim_prefix|># repo: Rajeshravula588/Flask_Content path: /flask_project/saral.py
from flask import Flask
app=Flask('__name__')
<|fim_middle|>@app.route("/my/<name>/<age>")
def my(name,age):
| code_fim | easy | {
"lang": "python",
"repo": "Rajeshravula588/Flask_Content",
"path": "/flask_project/saral.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
self.default_objects["Receiver"]["count"] = 2
#self.default_data["IR"] = 1
self.conditions["must have 2 Receivers"] = lambda name, fixed, variances, count: name != "Receiver" or count == 2
self.conditions["must have Listener Up and View"] = lamb... | code_fim | medium | {
"lang": "python",
"repo": "mberz/python-sofa",
"path": "/src/sofa/conventions/MultiSpeakerBRIR.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.conditions["must have 2 Receivers"] = lambda name, fixed, variances, count: name != "Receiver" or count == 2
self.conditions["must have Listener Up and View"] = lambda name, fixed, variances, count: name != "Listener" or ("Up" in fixed + variances and "View" in fixed + variances)
... | code_fim | hard | {
"lang": "python",
"repo": "mberz/python-sofa",
"path": "/src/sofa/conventions/MultiSpeakerBRIR.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mberz/python-sofa path: /src/sofa/conventions/MultiSpeakerBRIR.py
# Copyright (c) 2019 Jannika Lossner
#
# 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 restric... | code_fim | medium | {
"lang": "python",
"repo": "mberz/python-sofa",
"path": "/src/sofa/conventions/MultiSpeakerBRIR.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ktp-forked-repos/wis-core path: /python/gen.py
#!/usr/bin/env python2
from rpcz import compiler
<|fim_suffix|>compiler.generate_proto(PROTO, '.')
compiler.generate_proto(
PROTO, '.',
with_plugin='python_rpcz', suffix='_rpcz.py')<|fim_middle|>PROTO = '../index_server.proto'
| code_fim | easy | {
"lang": "python",
"repo": "ktp-forked-repos/wis-core",
"path": "/python/gen.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ktp-forked-repos/wis-core path: /python/gen.py
#!/usr/bin/env python2
<|fim_suffix|>compiler.generate_proto(PROTO, '.')
compiler.generate_proto(
PROTO, '.',
with_plugin='python_rpcz', suffix='_rpcz.py')<|fim_middle|>from rpcz import compiler
PROTO = '../index_server.proto'
| code_fim | medium | {
"lang": "python",
"repo": "ktp-forked-repos/wis-core",
"path": "/python/gen.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>PROTO = '../index_server.proto'
compiler.generate_proto(PROTO, '.')
compiler.generate_proto(
PROTO, '.',
with_plugin='python_rpcz', suffix='_rpcz.py')<|fim_prefix|># repo: ktp-forked-repos/wis-core path: /python/gen.py
#!/usr/bin/env python2
<|fim_middle|>from rpcz import compiler
| code_fim | easy | {
"lang": "python",
"repo": "ktp-forked-repos/wis-core",
"path": "/python/gen.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _checkLevel(level, case=False, type=False, map=False):
#TODO define check as dictionary
pass
# """Check parameter against defined values
#
# Returns corresponding or original Integer, or NOTSET if no-match.
# Will raise TypeError or ValueError as applicable.
#
# NOTE: ... | code_fim | hard | {
"lang": "python",
"repo": "tb3088/yamlreader",
"path": "/src/main/python/yamlreader/logging.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return no_match
def getLevelOrName(level):
pass
def _checkLevel(level, case=False, type=False, map=False):
#TODO define check as dictionary
pass
# """Check parameter against defined values
#
# Returns corresponding or original Integer, or NOTSET if no-match.
# Will rais... | code_fim | hard | {
"lang": "python",
"repo": "tb3088/yamlreader",
"path": "/src/main/python/yamlreader/logging.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def render_content(context,**pageargs):
__M_caller = context.caller_stack._push_frame()
try:
int = context.get('int', UNDEFINED)
str = context.get('str', UNDEFINED)
rentals = context.get('rentals', UNDEFINED)
def content():
return render_content(context)... | code_fim | hard | {
"lang": "python",
"repo": "codycolson/INTEX",
"path": "/chf/cached_templates/templates/account.rentalcart.html.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: codycolson/INTEX path: /chf/cached_templates/templates/account.rentalcart.html.py
# -*- coding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1428612037.145222
_enable_loop = ... | code_fim | hard | {
"lang": "python",
"repo": "codycolson/INTEX",
"path": "/chf/cached_templates/templates/account.rentalcart.html.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chasingSublimity/destroy-all-software path: /Computation/lambda.py
IS_ZERO = lambda x: x == 0
ONE = 1
SUB1 = lambda x: x - 1
MULT = lambda x: lambda y: x * y
IF = lambda cond: lambda t_func: lambda f_func: t_func(None) if cond else f_func(None)
print(
(
lambda myself: (
l... | code_fim | hard | {
"lang": "python",
"repo": "chasingSublimity/destroy-all-software",
"path": "/Computation/lambda.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> )(
lambda _: ONE
)(
lambda _: MULT(n)( myself(myself)(SUB1(n)) )
)
)
)
)
(6)
)<|fim_prefix|># repo: chasingSublimity/destroy-all-software path: /Computation/lambda.py
IS_ZERO = lambda x: x =... | code_fim | hard | {
"lang": "python",
"repo": "chasingSublimity/destroy-all-software",
"path": "/Computation/lambda.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
with open(join("data", name_of_selected_count), "r") as file:
count = int(file.read())
except FileNotFoundError:
os.mkdir("data")
messagebox.showerror("Save Error", "No data folder was found; created one now.")
return
... | code_fim | hard | {
"lang": "python",
"repo": "SimonMaracine/Counter",
"path": "/src/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SimonMaracine/Counter path: /src/main.py
import os
import tkinter as tk
from tkinter import messagebox
from os.path import join
from pynput import keyboard
from src.save_count import SaveCount
class MainApplication(tk.Frame):
def __init__(self, root: tk.Tk):
super().__init__(root... | code_fim | hard | {
"lang": "python",
"repo": "SimonMaracine/Counter",
"path": "/src/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Phoenix-Z/LeetCode path: /Python/SubtreeOfAnotherTree/SubtreeOfAnotherTree.py
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
<|fim_suffix|># (119ms)
def isSubtree(self, ... | code_fim | medium | {
"lang": "python",
"repo": "Phoenix-Z/LeetCode",
"path": "/Python/SubtreeOfAnotherTree/SubtreeOfAnotherTree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not root:
now.append("$")
return
now.append(`root.val`)
traverse(root.left, now)
traverse(root.right, now)
s_list, t_list = [], []
traverse(s, s_list)
traverse(t, t_list)
s_str, t_str= "," + ... | code_fim | medium | {
"lang": "python",
"repo": "Phoenix-Z/LeetCode",
"path": "/Python/SubtreeOfAnotherTree/SubtreeOfAnotherTree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Return:
df (Dataframe): A dataframe with one column showing number of missing values, one column showing percentage of missing values with 4 digits
"""
df = pd.concat({'num_missing_values':df.isnull().sum(), 'pct_missing_values':df.isnull().mean().round(4)}, axis=1)
)
return d... | code_fim | medium | {
"lang": "python",
"repo": "CaraFJ/Utility",
"path": "/missing_value_count_and_percent.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CaraFJ/Utility path: /missing_value_count_and_percent.py
def missing_value_count_and_percent(df):
"""
Return the number and percent of missing values for each column.
<|fim_suffix|> """
df = pd.concat({'num_missing_values':df.isnull().sum(), 'pct_missing_values':df.isnull().mean(... | code_fim | hard | {
"lang": "python",
"repo": "CaraFJ/Utility",
"path": "/missing_value_count_and_percent.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> i = m
j = n
while i > 0 and j > 0:
if X[i-1] == Y[j-1]:
s += X[i-1]
i -= 1
j -= 1
elif dp[i-1][j] > dp[i][j-1]:
i -= 1
else:
j -= 1
return s
X = "AGGTAB"
Y = "GXTXAYB"
print("Length of LCS... | code_fim | medium | {
"lang": "python",
"repo": "ashish-5209/Dynamic-Programming",
"path": "/printingLcs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ashish-5209/Dynamic-Programming path: /printingLcs.py
def lcs(X, Y, m, n):
dp = [[0]*(n+1) for i in range(m+1)]
for i in range(1,m+1):
for j in range(1,n+1):
<|fim_suffix|> i = m
j = n
while i > 0 and j > 0:
if X[i-1] == Y[j-1]:
s += X[i-... | code_fim | medium | {
"lang": "python",
"repo": "ashish-5209/Dynamic-Programming",
"path": "/printingLcs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>X = "AGGTAB"
Y = "GXTXAYB"
print("Length of LCS is ", lcs(X , Y, len(X), len(Y)))<|fim_prefix|># repo: ashish-5209/Dynamic-Programming path: /printingLcs.py
def lcs(X, Y, m, n):
dp = [[0]*(n+1) for i in range(m+1)]
for i in range(1,m+1):
for j in range(1,n+1):
if X[i... | code_fim | hard | {
"lang": "python",
"repo": "ashish-5209/Dynamic-Programming",
"path": "/printingLcs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> func = partial(self._threaded_resolve_code_lens, code_lens)
func = require_monitor(func)
return func
def _threaded_resolve_code_lens(
self, code_lens: CodeLensTypedDict, monitor: IMonitor
) -> CodeLensTypedDict:
from robotframework_ls.impl.code_lens import ... | code_fim | hard | {
"lang": "python",
"repo": "martinRenou/robotframework-lsp",
"path": "/robotframework-ls/src/robotframework_ls/server_api/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _threaded_hover(
self, doc_uri: str, line, col, monitor: IMonitor
) -> Optional[HoverTypedDict]:
from robotframework_ls.impl.hover import hover
completion_context = self._create_completion_context(
doc_uri, line, col, monitor
)
if completion... | code_fim | hard | {
"lang": "python",
"repo": "martinRenou/robotframework-lsp",
"path": "/robotframework-ls/src/robotframework_ls/server_api/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for y in range(4):
for x in range(4):
failed = not self.test_debug_pixel(200 + x, 200 + y, "Bindless({},{})".format(x, y)) or failed
rdtest.log.end_section("Bindless tests")
if failed:
raise rdtest.TestFailureException("Some tests were not ... | code_fim | hard | {
"lang": "python",
"repo": "baldurk/renderdoc",
"path": "/util/test/tests/D3D12/D3D12_Resource_Mapping_Zoo.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baldurk/renderdoc path: /util/test/tests/D3D12/D3D12_Resource_Mapping_Zoo.py
import renderdoc as rd
from typing import List
import rdtest
class D3D12_Resource_Mapping_Zoo(rdtest.TestCase):
demos_test_name = 'D3D12_Resource_Mapping_Zoo'
def test_debug_pixel(self, x, y, test_name):
... | code_fim | hard | {
"lang": "python",
"repo": "baldurk/renderdoc",
"path": "/util/test/tests/D3D12/D3D12_Resource_Mapping_Zoo.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>data = wav.readframes(nframes)
data = scale * np.array(struct.unpack('<%dh'%nframes, data)) / float((1 << 14))
plt.plot(data)
plt.show()<|fim_prefix|># repo: robwasab/BPSK-over-audio path: /plot.py
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import numpy as np
import struc... | code_fim | medium | {
"lang": "python",
"repo": "robwasab/BPSK-over-audio",
"path": "/plot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robwasab/BPSK-over-audio path: /plot.py
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import numpy as np
import struct
import wave
scale = 0.01
wav = wave.open('output.wav', 'r')
<|fim_suffix|>data = wav.readframes(nframes)
data = scale * np.array(struct.unpack('<%d... | code_fim | medium | {
"lang": "python",
"repo": "robwasab/BPSK-over-audio",
"path": "/plot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JavierSLX/Python-Platzi path: /18-ahorcado.py
# -*- coding: utf-8 -*-
import random
IMAGES = ['''
+---+
| |
|
|
|
|
=========''', '''
+---+
| |
O |
|
|
|
=========''', '''
+---+
| |
... | code_fim | hard | {
"lang": "python",
"repo": "JavierSLX/Python-Platzi",
"path": "/18-ahorcado.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> +---+
| |
O |
/|\ |
| |
/ \ |
=========''', '''
''']
WORDS = [
'lavadora',
'secadora',
'sofa',
'gobierno',
'diputado',
'democracia',
'computadora',
'teclado'
]
# Funcion que regresa una palabra aleatoria
def randomWord():
id = ran... | code_fim | hard | {
"lang": "python",
"repo": "JavierSLX/Python-Platzi",
"path": "/18-ahorcado.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>api.add_resource(Store,'/store/<string:name>')
api.add_resource(Item,'/item/<string:name>') # http://localhost:5000/student/Rolf
api.add_resource(ItemList,'/items')
api.add_resource(StoreList,'/stores')
api.add_resource(UserRegister, '/register')
if __name__ == '__main__':
from db import db
db.i... | code_fim | hard | {
"lang": "python",
"repo": "tdhv/store",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tdhv/store path: /app.py
# create item based on name using post method, get specific item or list of items using get method, update item using put and delete item using del method.
import os
<|fim_suffix|>from security import authenticate, identity
from resources.user import UserRegister
from re... | code_fim | medium | {
"lang": "python",
"repo": "tdhv/store",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_deregisterDevice(self):
self.network_svc.devices[self.device_id] = ""
self.network_svc.deregister_device(self.device_id)
self.assertNotIn(self.device_id, self.network_svc.devices.keys())
def test_deregisterInvalidDevice(self):
with self.assertRaises(Unknow... | code_fim | hard | {
"lang": "python",
"repo": "mLe110/network-simulator",
"path": "/network_simulator/test/service/test_networkSimulatorService.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mLe110/network-simulator path: /network_simulator/test/service/test_networkSimulatorService.py
from unittest import TestCase
from unittest.mock import patch, mock_open, call
from network_simulator.exceptions.device_exceptions import DeviceAlreadyRegisteredException, UnknownDeviceException
from n... | code_fim | hard | {
"lang": "python",
"repo": "mLe110/network-simulator",
"path": "/network_simulator/test/service/test_networkSimulatorService.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> file = open("a.txt", "r")
aa=""
for i in file.readline():
if (i.isdigit()):
break
aa= aa+i
baa = aa.replace(" ","")
os.chdir("/home/ec2-user/sdpd")
file1 = open(baa + ".txt","r")
aa = aa + " \n \n \n \n" + file1.read()
return aa
#return 'string ... | code_fim | hard | {
"lang": "python",
"repo": "KushalP1/SnapCrop-flaskserver",
"path": "/flaskserver.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KushalP1/SnapCrop-flaskserver path: /flaskserver.py
import os
from flask import Flask
from flask import request
result=""
app = Flask(__name__)
@app.route('/postjson', methods = ['POST'])
def postJsonHandler():
global result
#print (request.is_json)
content = request.get_json()
... | code_fim | medium | {
"lang": "python",
"repo": "KushalP1/SnapCrop-flaskserver",
"path": "/flaskserver.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JackMGrundy/coding-challenges path: /common-problems-leetcode/medium/maximal-square.py
"""
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
Example:
Input:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output: 4
"""
# 196ms. 98 perc... | code_fim | hard | {
"lang": "python",
"repo": "JackMGrundy/coding-challenges",
"path": "/common-problems-leetcode/medium/maximal-square.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Most of it is straightforwards. The one thing I want to note is that temp variable switch. Basically because our dp is
a single array, when we're processing element i, we've already replaced element i-1 with an updated value. That's a problem
because the i-1 value represents the j-1,i-1 value for the ith ... | code_fim | hard | {
"lang": "python",
"repo": "JackMGrundy/coding-challenges",
"path": "/common-problems-leetcode/medium/maximal-square.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
data_df = pd.read_csv(file_name, header=header, encoding=encoding)
return data_df
#train = load_data_from(train_data_path)
data = load_data_from_csv(validate_data_path)
out.write(data['content'][0].encode('utf-8'))
inp.close()
out.close()<|fim_prefix|># repo: JeffWang3/Fine-grained_SA path: ... | code_fim | hard | {
"lang": "python",
"repo": "JeffWang3/Fine-grained_SA",
"path": "/CNN/fastText/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JeffWang3/Fine-grained_SA path: /CNN/fastText/test.py
#-*- coding: utf-8 -*-
import re
import sys
import os
import pandas as pd
import jieba
import logging
import argparse
from sklearn.externals import joblib
from sklearn.svm import SVC
from sklearn.naive_bayes import MultinomialNB
from sklearn.m... | code_fim | hard | {
"lang": "python",
"repo": "JeffWang3/Fine-grained_SA",
"path": "/CNN/fastText/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def successor(self,root):
temp = root
if root.right:
while temp.left:
temp = temp.left
return temp
def inorder(self,root):
if root is not None:
self.inorder(root.left)
print(root.data)
self.inorder(root... | code_fim | hard | {
"lang": "python",
"repo": "naveenc131/project",
"path": "/Practice/bst.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: naveenc131/project path: /Practice/bst.py
class Node(object):
def __init__(self,data):
self.data = data
self.left = None
self.right = None
self.parent = None
class tree(object):
def __init__(self):
self.root = None
def insert(self,root... | code_fim | hard | {
"lang": "python",
"repo": "naveenc131/project",
"path": "/Practice/bst.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antonyalexcm/Bridgelabz_updated path: /Data_structures/Palindrome_checker.py
class Node:
def __init__(self,data):
self.data = data
self.next = None
self.prev = None
class dequeue:
def __init__(self):
self.front = None
self.last = None
se... | code_fim | hard | {
"lang": "python",
"repo": "antonyalexcm/Bridgelabz_updated",
"path": "/Data_structures/Palindrome_checker.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def pal_check(self, pal_lis):
for i in pal_lis:
llist.add_front(i)
while(self.count != 0):
if(self.front.data == self.last.data):
llist.remove_front()
if(self.count > 1):
llist.remove_last()
... | code_fim | hard | {
"lang": "python",
"repo": "antonyalexcm/Bridgelabz_updated",
"path": "/Data_structures/Palindrome_checker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def NotifyJobComplete(self, job_):
self._logger.debug('Handling %r completion event.', job_)
group = job_.group
with self._lock:
# We need to perform an action only if the group hasn't already failed.
if group.status != job_group.STATUS_FAILED:
if job_.status == job.STA... | code_fim | hard | {
"lang": "python",
"repo": "lz-purple/Source",
"path": "/app/src/main/java/com/syd/source/aosp/external/toolchain-utils/automation/server/job_group_manager.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShogoAkiyama/rltorch2 path: /a2c/qmaneger.py
import torch
import torch.multiprocessing as mp
import random
class QManeger(object):
def __init__(self, opt, q_trace, q_batch):
self.traces_s = []
self.traces_a = []
self.traces_r = []
self.lock = mp.Lock()
... | code_fim | hard | {
"lang": "python",
"repo": "ShogoAkiyama/rltorch2",
"path": "/a2c/qmaneger.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def produce_batch(self):
batch_size = self.opt.batch_size
res_s, res_a, res_r = self.traces_s[:batch_size], self.traces_a[:batch_size], \
self.traces_r[:batch_size]
# delete
del self.traces_s[:batch_size]
del self.traces_a[:batch_... | code_fim | hard | {
"lang": "python",
"repo": "ShogoAkiyama/rltorch2",
"path": "/a2c/qmaneger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>lAdmin)
admin.site.register(Item)
admin.site.register(Product)<|fim_prefix|># repo: w3kernel/sokalbikal path: /product/admin.py
from django.contrib import admin
from mptt.admin import MPTTModelAdmin
from product.models import Item,Product,Category
# Re<|fim_middle|>gister your models here.
admin.site.reg... | code_fim | medium | {
"lang": "python",
"repo": "w3kernel/sokalbikal",
"path": "/product/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: w3kernel/sokalbikal path: /product/admin.py
from django.contrib import admin
from mptt.admin import MPTTModelAdmin
from product.models import Item,Product,Category
# Re<|fim_suffix|>lAdmin)
admin.site.register(Item)
admin.site.register(Product)<|fim_middle|>gister your models here.
admin.site.reg... | code_fim | medium | {
"lang": "python",
"repo": "w3kernel/sokalbikal",
"path": "/product/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>x_0 = 2.71
Y_0 = np.array([2.71, 2.009],dtype = float) # функция и производная в точке х_0
"""
Из-за особенностей заданя, не представляется возмоность увеличить значение производной в начальной точке, поэтому 2
Так же, не стоит менять шаг, иначе все перестает работать ¯\_(ツ)_/¯
"""
L = [2.71, 7.34]
... | code_fim | hard | {
"lang": "python",
"repo": "k1lv1n/comp_math",
"path": "/task5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: k1lv1n/comp_math path: /task5.py
import numpy as np
import matplotlib.pyplot as plt
def f(x:float,y:np.ndarray) -> np.ndarray:
"""
Работает с вектором { y , y'}
"""
# return some function result
return np.array([y[1], np.sqrt(abs(-np.exp(y[1])*y[0] + 2.71*y[0]**2/... | code_fim | hard | {
"lang": "python",
"repo": "k1lv1n/comp_math",
"path": "/task5.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>xes_2, yes_2 = dormand_prince(x_0, Y_0, h_3, N_3)
for i,x in enumerate(xes_2):
if abs(x-0.5)<1e-3:
print(x,yes_2[i])
if abs(x-1)<1e-3:
print(x,yes_2[i])
if abs(x-1.5)<1e-3:
print(x,yes_2[i])
if abs(x-2)<1e-3:
print(x,yes_2[i])
if abs(x-2.5)<1e-... | code_fim | hard | {
"lang": "python",
"repo": "k1lv1n/comp_math",
"path": "/task5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mallik-G/DeltaWarehouse path: /src/utils/url_path.py
class UrlPath:
@staticmethod
def combine(*args):<|fim_suffix|> result += path if path.endswith('/') else '{}/'.format(path)
#result = result[:-1]
return result<|fim_middle|>
result = ''
for path in args:... | code_fim | easy | {
"lang": "python",
"repo": "Mallik-G/DeltaWarehouse",
"path": "/src/utils/url_path.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>path)
#result = result[:-1]
return result<|fim_prefix|># repo: Mallik-G/DeltaWarehouse path: /src/utils/url_path.py
class UrlPath:
@staticmethod
def combine(*args):<|fim_middle|>
result = ''
for path in args:
result += path if path.endswith('/') else '{... | code_fim | medium | {
"lang": "python",
"repo": "Mallik-G/DeltaWarehouse",
"path": "/src/utils/url_path.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.