text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> assert result is True
captured = capsys.readouterr()
assert 'setup(' in captured.out
assert 'The description of the package' in captured.out<|fim_prefix|># repo: crflynn/dephell path: /tests/test_commands/test_deps_convert.py
# built-in
from pathlib import Path
# project
from dephell.com... | code_fim | hard | {
"lang": "python",
"repo": "crflynn/dephell",
"path": "/tests/test_commands/test_deps_convert.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> command = DepsConvertCommand(argv=[], config=config)
result = command()
assert result is True
captured = capsys.readouterr()
assert 'setup(' in captured.out
assert 'The description of the package' in captured.out<|fim_prefix|># repo: crflynn/dephell path: /tests/test_commands/tes... | code_fim | hard | {
"lang": "python",
"repo": "crflynn/dephell",
"path": "/tests/test_commands/test_deps_convert.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anthony-kolesov/kts46 path: /pylib/jsonRpcClient.py
# Copyright 2010-2011 Anthony Kolesov
#
# 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 the License at
#
# http://www.apache... | code_fim | medium | {
"lang": "python",
"repo": "anthony-kolesov/kts46",
"path": "/pylib/jsonRpcClient.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.id += 1
return MethodCall(self.address, name, self.id)
class MethodCall(object):
def __init__(self, address, methodName, id=1):
self.address = address
self.name = methodName
self.id = id
def __call__(self, *args):
data = {'method':... | code_fim | medium | {
"lang": "python",
"repo": "anthony-kolesov/kts46",
"path": "/pylib/jsonRpcClient.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ICTU/quality-time path: /components/collector/src/source_collectors/jacoco/uncovered_lines.py
"""Jacoco coverage report uncovered lines collector."""
<|fim_suffix|>
class JacocoUncoveredLines(JacocoCoverageBaseClass):
"""Source class to get the number of uncovered lines from Jacoco XML repor... | code_fim | easy | {
"lang": "python",
"repo": "ICTU/quality-time",
"path": "/components/collector/src/source_collectors/jacoco/uncovered_lines.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Source class to get the number of uncovered lines from Jacoco XML reports."""
coverage_type = "line"<|fim_prefix|># repo: ICTU/quality-time path: /components/collector/src/source_collectors/jacoco/uncovered_lines.py
"""Jacoco coverage report uncovered lines collector."""
from .base import Ja... | code_fim | easy | {
"lang": "python",
"repo": "ICTU/quality-time",
"path": "/components/collector/src/source_collectors/jacoco/uncovered_lines.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('bad_influence', '0011_auto_20200420_1536'),
]
operations = [
migrations.DeleteModel(
name='Message',
),
]<|fim_prefix|># repo: PrimeCodingSolutions/otree-core path: /otree/oTree/bad_influence/migrations/0012_delete_message.py
# Gener... | code_fim | medium | {
"lang": "python",
"repo": "PrimeCodingSolutions/otree-core",
"path": "/otree/oTree/bad_influence/migrations/0012_delete_message.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PrimeCodingSolutions/otree-core path: /otree/oTree/bad_influence/migrations/0012_delete_message.py
# Generated by Django 2.2.4 on 2020-04-20 13:39
<|fim_suffix|>
dependencies = [
('bad_influence', '0011_auto_20200420_1536'),
]
operations = [
migrations.DeleteModel(
... | code_fim | medium | {
"lang": "python",
"repo": "PrimeCodingSolutions/otree-core",
"path": "/otree/oTree/bad_influence/migrations/0012_delete_message.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> filename_ext = ".mesh"
filter_glob = StringProperty(
default="*.mesh",
options={'HIDDEN'},
maxlen=255, # Max internal buffer length, longer would be clamped.
)
def execute(self, context):
pdx = importer.PdxFileImporter(self.filepath)
pdx.impor... | code_fim | hard | {
"lang": "python",
"repo": "oninoni/ClausewitzBlenderPlugin",
"path": "/import-export-clausewitz/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> bl_idname = "error.ok"
bl_label = "OK"
def execute(self, context):
return {'FINISHED'}
def menu_func_export(self, context):
self.layout.operator(ClausewitzExporter.bl_idname, text="Export .mesh (Clausewitz Engine)")
def menu_func_import(self, context):
self.layout.operator(Cl... | code_fim | hard | {
"lang": "python",
"repo": "oninoni/ClausewitzBlenderPlugin",
"path": "/import-export-clausewitz/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oninoni/ClausewitzBlenderPlugin path: /import-export-clausewitz/__init__.py
import bpy
from bpy_types import (Operator)
from bpy_extras.io_utils import (ImportHelper, ExportHelper)
from bpy.props import *
from . import (importer, exporter)
bl_info = {
"name": "Clausewitz Import/Export",
... | code_fim | hard | {
"lang": "python",
"repo": "oninoni/ClausewitzBlenderPlugin",
"path": "/import-export-clausewitz/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zcash-hackworks/zfaucet path: /faucet/urls.py
from django.conf.urls import url
from django.conf.urls.static import static
from django.conf import settings
<|fim_suffix|>
#TODO: check if dev or prod and only use below in dev
urlpatterns += urlpatterns + static(settings.MEDIA_URL, document_root=se... | code_fim | medium | {
"lang": "python",
"repo": "zcash-hackworks/zfaucet",
"path": "/faucet/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#TODO: check if dev or prod and only use below in dev
urlpatterns += urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: zcash-hackworks/zfaucet path: /faucet/urls.py
from django.conf.urls import url
from django.conf.urls.static import static
from django.conf ... | code_fim | medium | {
"lang": "python",
"repo": "zcash-hackworks/zfaucet",
"path": "/faucet/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Approximation of y'(t0 + h/2), using second derivative at t0
n2 = n1Half #=y0d + h / 2 * l1
# Approximation of x(t0 + h), using derivative at t0 + h / 2
k2Full = x0 + h * m2
# Approximation of y(t0 + h), using derivative at t0 + h / 2
l2Full = y0 + h * n... | code_fim | hard | {
"lang": "python",
"repo": "daniloarcidiacono/cart-pole",
"path": "/src/math/rk4_integrator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Approximation of x(t0 + h), using derivative at t0 + h / 2
k2Full = x0 + h * m2
# Approximation of y(t0 + h), using derivative at t0 + h / 2
l2Full = y0 + h * n2
# Approximation of x'(t0 + h), using second derivative at t0 + h / 2
m2Full = x0d + h * k2
... | code_fim | hard | {
"lang": "python",
"repo": "daniloarcidiacono/cart-pole",
"path": "/src/math/rk4_integrator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daniloarcidiacono/cart-pole path: /src/math/rk4_integrator.py
# Solves the following system of second order ODEs
#
# { x" = f(t, x, y, x', y', y")
# { y" = g(t, x, y, x', y')
#
# with initial values
#
# t0
# x(t0) = x0
# y(t0) = y0
# x'(t0) = x0d
# y'(t0) = y0d
#
# by applying RK4, using time ste... | code_fim | hard | {
"lang": "python",
"repo": "daniloarcidiacono/cart-pole",
"path": "/src/math/rk4_integrator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HYprivate/Sketch2CAD path: /networkTraining/utils/freeze_graph_tool.py
# @ Microsoft Research Asia, Internet Graphics Group,
# @ Project SketchCNN
# =========================================================================
"""
This file is written to convert model checkpoint to freeze graph
"""
f... | code_fim | hard | {
"lang": "python",
"repo": "HYprivate/Sketch2CAD",
"path": "/networkTraining/utils/freeze_graph_tool.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> freeze_graph.freeze_graph(input_graph_path, input_saver_def_path, input_binary, input_checkpoint_path,
output_node_names, restore_op_name, filename_tensor_name, output_graph_path,
clear_devices, initializer_nodes='', variable_names_blacklist=... | code_fim | hard | {
"lang": "python",
"repo": "HYprivate/Sketch2CAD",
"path": "/networkTraining/utils/freeze_graph_tool.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "%s changed from a directory to a non-directory" % self.path
def __init__(self, path):
self.path = path
class FileTypeChangedError(UpdateError):
def __str__(self):
return "file type of %s changed" % self.path
def __init__(self, path):
self.path = path... | code_fim | hard | {
"lang": "python",
"repo": "protonesso/conary",
"path": "/conary/local/errors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: protonesso/conary path: /conary/local/errors.py
#
# Copyright (c) SAS Institute Inc.
#
# 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 the License at
#
# http://www.apache.org/licen... | code_fim | hard | {
"lang": "python",
"repo": "protonesso/conary",
"path": "/conary/local/errors.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return "%s changed from a directory to a non-directory" % self.path
def __init__(self, path):
self.path = path
class FileTypeChangedError(UpdateError):
def __str__(self):
return "file type of %s changed" % self.path
def __init__(self, path):
... | code_fim | hard | {
"lang": "python",
"repo": "protonesso/conary",
"path": "/conary/local/errors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ax0 = fig.add_subplot(211); ax1 = fig.add_subplot(212)
ax0.plot(Phi, np.imag(PyRes[0]), 'C0', linewidth=2, label='Python S1');
ax1.plot(Phi, np.imag(PyRes[1]), 'C0',linewidth=2, label='Python S2')
ax1.plot(Phi, np.imag(CppS2), 'C1--',linewidth=2, label='C++ S1');
ax0.plot(Phi, np.ima... | code_fim | hard | {
"lang": "python",
"repo": "paaube/PyMieSim",
"path": "/tests/Benchmark/S1S2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paaube/PyMieSim path: /tests/Benchmark/S1S2.py
import matplotlib.pyplot as plt
import numpy as np
import timeit
from PyMieSim.LMT.python.Sphere import S1S2 as PyS1S2
from PyMieSim.LMT.Scatterer import SPHERE
def Speed(setup):
BenchPython = """PyS1S2(*args);"""
BenchCpp = """scat.S1S2... | code_fim | hard | {
"lang": "python",
"repo": "paaube/PyMieSim",
"path": "/tests/Benchmark/S1S2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ax0.grid(); ax1.grid();
ax0.legend(); ax1.legend();
plt.show()
setup = """
import numpy as np
from PyMieSim.LMT.python.Sphere import S1S2 as PyS1S2
from PyMieSim.LMT.Scatterer import SPHERE
Phi = np.linspace(-np.pi,np.pi,20000)
args = (1.8, 3e-6, 1e-6, 1, Phi)
scat = SPHERE(Index = 1.8, ... | code_fim | hard | {
"lang": "python",
"repo": "paaube/PyMieSim",
"path": "/tests/Benchmark/S1S2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isOk(n):
return n
n -= 10**I
n += 10 ** (I + 1)
a = str(n)[: -I - 1]
l = len(str(n))
for i in range(int(a[-1])-1, -1, -1):
a += str(i)
a = a[:l]
a += '0'*(l-len(a))
n = int(a[:l])
return calc(n, I+1)... | code_fim | hard | {
"lang": "python",
"repo": "yuto-moriizumi/AtCoder",
"path": "/ABC161/ABC161d.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuto-moriizumi/AtCoder path: /ABC161/ABC161d.py
# ABC161d
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# 再帰関数を使わない限りPypyで出すこと
def dump(*args):
sys.stderr.write(str(args))
k = int(input())
def isOk(n):
<|fim_suffix|> def... | code_fim | hard | {
"lang": "python",
"repo": "yuto-moriizumi/AtCoder",
"path": "/ABC161/ABC161d.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> n = int(input())
s = sorted(Counter([input() for _ in range(n)]).items(), key=lambda x: x[1], reverse=True)
print(s[0][0])
if __name__ == '__main__':
main()<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /ABC/abc001-abc050/abc008/b.py
# -*- coding: utf-8 -*-
<|fim_middle|>def main():
... | code_fim | easy | {
"lang": "python",
"repo": "KATO-Hiro/AtCoder",
"path": "/ABC/abc001-abc050/abc008/b.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /ABC/abc001-abc050/abc008/b.py
# -*- coding: utf-8 -*-
<|fim_suffix|> n = int(input())
s = sorted(Counter([input() for _ in range(n)]).items(), key=lambda x: x[1], reverse=True)
print(s[0][0])
if __name__ == '__main__':
main()<|fim_middle|>
def main():
... | code_fim | easy | {
"lang": "python",
"repo": "KATO-Hiro/AtCoder",
"path": "/ABC/abc001-abc050/abc008/b.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
main()<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /ABC/abc001-abc050/abc008/b.py
# -*- coding: utf-8 -*-
def main():
from collections import Counter
<|fim_middle|> n = int(input())
s = sorted(Counter([input() for _ in range(n)]).items(), key=lambda x: x[1], ... | code_fim | medium | {
"lang": "python",
"repo": "KATO-Hiro/AtCoder",
"path": "/ABC/abc001-abc050/abc008/b.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Swiss-Polar-Institute/project-application path: /ProjectApplication/project_core/migrations/0081_field_help_text_changes.py
# Generated by Django 2.2.6 on 2019-11-27 10:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_su... | code_fim | medium | {
"lang": "python",
"repo": "Swiss-Polar-Institute/project-application",
"path": "/ProjectApplication/project_core/migrations/0081_field_help_text_changes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('project_core', '0080_same_file_attached_twice'),
]
operations = [
migrations.AlterField(
model_name='organisation',
name='uid',
field=models.ForeignKey(help_text='UID of an organisation', on_delete=django.db.models.deleti... | code_fim | medium | {
"lang": "python",
"repo": "Swiss-Polar-Institute/project-application",
"path": "/ProjectApplication/project_core/migrations/0081_field_help_text_changes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from fextr import *
#from handseg import *
from KNTfinger import *<|fim_prefix|># repo: dawnknight/K_project path: /Data_Conversion/Kfunc/finger/__init__.py
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 15 17:20:51 2016
<|fim_middle|>@author: medialab
"""
| code_fim | easy | {
"lang": "python",
"repo": "dawnknight/K_project",
"path": "/Data_Conversion/Kfunc/finger/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dawnknight/K_project path: /Data_Conversion/Kfunc/finger/__init__.py
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 15 17:20:51 2016
<|fim_suffix|>from fextr import *
#from handseg import *
from KNTfinger import *<|fim_middle|>@author: medialab
"""
| code_fim | easy | {
"lang": "python",
"repo": "dawnknight/K_project",
"path": "/Data_Conversion/Kfunc/finger/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_modules_installed(self):
return self._query('*OPT?').strip().replace(' ', '').split(',')
def get_latest_error(self):
return self._query('syst:err?')
def clear_error_list(self):
self._write('*CLS')
return self.get_latest_error()
def set_preset(self... | code_fim | hard | {
"lang": "python",
"repo": "panlun/agilentlightwave",
"path": "/agilentlightwave/agilent_lightwave.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: panlun/agilentlightwave path: /agilentlightwave/agilent_lightwave.py
from ._agilent_lightwave_connection import AgilentLightwaveConnection
from .agilent_8164B_laser import LaserAgilent8164B
from .agilent_8164B_power_meter import PowerMeterAgilent8164B
class _AgilentLightwaveSystem(AgilentLightw... | code_fim | hard | {
"lang": "python",
"repo": "panlun/agilentlightwave",
"path": "/agilentlightwave/agilent_lightwave.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Create a AssetFinder for the given bundle.
Parameters
----------
bundle : str
The name of the bundle to create a pipeline engine for.
Returns
-------
engine : zipline.pipleine.engine.SimplePipelineEngine
The pipeline engine which can run pipelines against t... | code_fim | hard | {
"lang": "python",
"repo": "liudengfeng/zipline",
"path": "/zipline/research/factory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liudengfeng/zipline path: /zipline/research/factory.py
from zipline.data import bundles
from zipline.data.data_portal import DataPortal
from zipline.pipeline.domain import CN_EQUITIES
from zipline.utils.memoize import remember_last
import pandas as pd
DEFAULT_COUNTRY = CN_EQUITIES.country_code... | code_fim | hard | {
"lang": "python",
"repo": "liudengfeng/zipline",
"path": "/zipline/research/factory.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdhaagenson/capstone_insta path: /instauser/models.py
from django.db import models
from django.contrib.auth.models import AbstractUser
THEME_CHOICES = [
('default', (
('theme_vanilla.jpg', 'theme_vanilla'),
('theme_vanilla2.jpeg', '2')
)),
('Feb', (
('theme_fe... | code_fim | medium | {
"lang": "python",
"repo": "jdhaagenson/capstone_insta",
"path": "/instauser/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> display_name = models.CharField(max_length=40, unique=False)
bio = models.CharField(max_length=100, blank=True, null=True)
followers = models.ManyToManyField("self", symmetrical=False, blank=True, default='self')
profile_pic = models.ImageField(upload_to='image', default='/media/image/defa... | code_fim | medium | {
"lang": "python",
"repo": "jdhaagenson/capstone_insta",
"path": "/instauser/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sosolidkk/manga-unifier path: /unifier/support/django_helpers.py
import os
def getenv_or_raise_exception(varname) -> str:
"""
Retrieve a environment variable that MUST be set!
"""
env = os.getenv(varname)
if env is None:
raise EnvironmentError(f"Environment variable... | code_fim | medium | {
"lang": "python",
"repo": "sosolidkk/manga-unifier",
"path": "/unifier/support/django_helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def eval_env_as_float(varname, standard_value) -> float:
"""
Parse varname as float and return it
"""
return float(os.getenv(varname, standard_value))<|fim_prefix|># repo: sosolidkk/manga-unifier path: /unifier/support/django_helpers.py
import os
def getenv_or_raise_exception(varname) -... | code_fim | medium | {
"lang": "python",
"repo": "sosolidkk/manga-unifier",
"path": "/unifier/support/django_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def eval_env_as_float(varname, standard_value) -> float:
"""
Parse varname as float and return it
"""
return float(os.getenv(varname, standard_value))<|fim_prefix|># repo: sosolidkk/manga-unifier path: /unifier/support/django_helpers.py
import os
def getenv_or_raise_exception(varname) ... | code_fim | medium | {
"lang": "python",
"repo": "sosolidkk/manga-unifier",
"path": "/unifier/support/django_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SymJAX/SymJAX path: /symjax/data/speech_commands.py
import os
import urllib.request
import numpy as np
import tarfile
import time
from tqdm import tqdm
from scipy.io.wavfile import read as wav_read
from .utils import download_dataset
DOC = """speech commands classification
source: https://a... | code_fim | hard | {
"lang": "python",
"repo": "SymJAX/SymJAX",
"path": "/symjax/data/speech_commands.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Load train set
wavs = list()
labels = list()
noises = list()
noise_labels = list()
names = tar.getmembers()
for name in tqdm(names, ascii=True):
if "wav" not in name.name:
continue
f = tar.extractfile(name.name) # .read()
wav = wav_read(f)... | code_fim | hard | {
"lang": "python",
"repo": "SymJAX/SymJAX",
"path": "/symjax/data/speech_commands.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_function(self):
def is_monotonically_increasing(x):
return x.dropna().is_monotonic_increasing
return is_monotonically_increasing<|fim_prefix|># repo: alteryx/featuretools path: /featuretools/primitives/standard/aggregation/is_monotonically_increasing.py
from woodw... | code_fim | hard | {
"lang": "python",
"repo": "alteryx/featuretools",
"path": "/featuretools/primitives/standard/aggregation/is_monotonically_increasing.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alteryx/featuretools path: /featuretools/primitives/standard/aggregation/is_monotonically_increasing.py
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import BooleanNullable
from featuretools.primitives.base import AggregationPrimitive
class IsMonotonicallyIncreasi... | code_fim | hard | {
"lang": "python",
"repo": "alteryx/featuretools",
"path": "/featuretools/primitives/standard/aggregation/is_monotonically_increasing.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
"""
import itertools
def find_pythagorean_triplet():
for a in itertools.count(1):
for b in range(1000 - a, 0, -1):
c = (a ** 2 + b ** 2) ** 0.5
if a + b + c == 1000:
... | code_fim | medium | {
"lang": "python",
"repo": "shaundavin13/euler",
"path": "/1_10/9.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def find_pythagorean_triplet():
for a in itertools.count(1):
for b in range(1000 - a, 0, -1):
c = (a ** 2 + b ** 2) ** 0.5
if a + b + c == 1000:
return a * b * c
answer = find_pythagorean_triplet()<|fim_prefix|># repo: shaundavin13/euler path: /1_10/... | code_fim | medium | {
"lang": "python",
"repo": "shaundavin13/euler",
"path": "/1_10/9.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shaundavin13/euler path: /1_10/9.py
"""
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
"""
import itertools
... | code_fim | medium | {
"lang": "python",
"repo": "shaundavin13/euler",
"path": "/1_10/9.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class a_test(object):
nsubtests_running = 0
rval = 1
def __init__(self, tcfg):
tcfg.global_config['_sip_tm'] = SipTransactionManager(tcfg.global_config, self.recvRequest)
i = 0
ttype = tcfg.ttype
if len(ttype) == 1:
ttype += ttype
atests = ... | code_fim | hard | {
"lang": "python",
"repo": "sippy/voiptests",
"path": "/lib/alice_testcore.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sippy/voiptests path: /lib/alice_testcore.py
# Copyright (c) 2015 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistri... | code_fim | hard | {
"lang": "python",
"repo": "sippy/voiptests",
"path": "/lib/alice_testcore.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, tcfg):
tcfg.global_config['_sip_tm'] = SipTransactionManager(tcfg.global_config, self.recvRequest)
i = 0
ttype = tcfg.ttype
if len(ttype) == 1:
ttype += ttype
atests = [a_cfg(x) for x in ALL_TESTS * len(ttype)]
for subtest... | code_fim | hard | {
"lang": "python",
"repo": "sippy/voiptests",
"path": "/lib/alice_testcore.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imxintian/learning path: /BeiKeSpider/utils.py
class Loupan(object):
def __init__(self,xiaoqu,price,total):
<|fim_suffix|> def text(self):
return self.xiaoqu+","+self.price+","+self.total<|fim_middle|> self.xiaoqu = xiaoqu # 小区
self.price = price # 单价
self.... | code_fim | medium | {
"lang": "python",
"repo": "imxintian/learning",
"path": "/BeiKeSpider/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def text(self):
return self.xiaoqu+","+self.price+","+self.total<|fim_prefix|># repo: imxintian/learning path: /BeiKeSpider/utils.py
class Loupan(object):
def __init__(self,xiaoqu,price,total):
<|fim_middle|> self.xiaoqu = xiaoqu # 小区
self.price = price # 单价
self.... | code_fim | medium | {
"lang": "python",
"repo": "imxintian/learning",
"path": "/BeiKeSpider/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def detail_parse(self, response):
img_src = response.xpath('//section[@class="page"][1]//img/@src').extract_first()
d = {
'en_name': self.extract_value(response, "Compound Name:"),
'cat_no': self.extract_value(response, "Catalogue Number:"),
'img_url... | code_fim | hard | {
"lang": "python",
"repo": "Pandaaaa906/product_spider",
"path": "/product_spider/spiders/tlc_spider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ret = response.xpath(f'//p[text()={title!r}]/../following-sibling::td/p/descendant-or-self::text()').extract()
return "".join(ret) or None
def detail_parse(self, response):
img_src = response.xpath('//section[@class="page"][1]//img/@src').extract_first()
d = {
... | code_fim | medium | {
"lang": "python",
"repo": "Pandaaaa906/product_spider",
"path": "/product_spider/spiders/tlc_spider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pandaaaa906/product_spider path: /product_spider/spiders/tlc_spider.py
from string import ascii_uppercase
from urllib.parse import urljoin, splitquery, parse_qsl, urlencode
from scrapy import Request
from product_spider.items import RawData
from product_spider.utils.spider_mixin import BaseSpid... | code_fim | hard | {
"lang": "python",
"repo": "Pandaaaa906/product_spider",
"path": "/product_spider/spiders/tlc_spider.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sandeep77-san/AIMLCommunityProjects path: /deep-learning-based-fall-detection-master/posenet-python-master_week3_upload/Keypoint_read_videofile.py
import tensorflow as tf
import cv2
import time
import argparse
import posenet
import numpy as np
import pandas as pd
parser = argparse.ArgumentParser... | code_fim | hard | {
"lang": "python",
"repo": "sandeep77-san/AIMLCommunityProjects",
"path": "/deep-learning-based-fall-detection-master/posenet-python-master_week3_upload/Keypoint_read_videofile.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> col_names = ['action', 'frame_number', 'input_number', 'x_inputs', 'y_inputs']
csv_reader = pd.read_csv(r'C:\Users\insapab\Desktop\Python\Projects\Deep Learning based fall-detection\Week3\posenet-python-master\dataset1.csv',names=col_names, header=None)# reading old data to a dataframe ... | code_fim | hard | {
"lang": "python",
"repo": "sandeep77-san/AIMLCommunityProjects",
"path": "/deep-learning-based-fall-detection-master/posenet-python-master_week3_upload/Keypoint_read_videofile.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryanwwest/kademlia path: /venv/lib/python3.9/site-packages/hypercorn/asyncio/task_group.py
import asyncio
import weakref
from types import TracebackType
from typing import Coroutine
class TaskGroup:
def __init__(self, loop: asyncio.AbstractEventLoop) -> None:
self._loop = loop
... | code_fim | hard | {
"lang": "python",
"repo": "ryanwwest/kademlia",
"path": "/venv/lib/python3.9/site-packages/hypercorn/asyncio/task_group.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def __aexit__(self, exc_type: type, exc_value: BaseException, tb: TracebackType) -> None:
if exc_type is not None:
self._cancel_tasks()
try:
task = asyncio.gather(*self._tasks)
await task
finally:
task.cancel()
... | code_fim | medium | {
"lang": "python",
"repo": "ryanwwest/kademlia",
"path": "/venv/lib/python3.9/site-packages/hypercorn/asyncio/task_group.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mohan67nv/ProjectAmazonTextAnalysis path: /johannes/Amazon_notebook.py
# coding: utf-8
# In[2]:
import os
path = 'C:\\users\johannes\ProjectAmazonTextAnalysis\johannes'
os.chdir(path)
import pickle
import pandas as pd
import numpy as np
import sklearn
print(sklearn.__version__)
from sklearn... | code_fim | hard | {
"lang": "python",
"repo": "mohan67nv/ProjectAmazonTextAnalysis",
"path": "/johannes/Amazon_notebook.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for text in texts_lower:
text_occurences = np.zeros(len(words))
for word in text:
if word in words:
index = words.index(word)
text_occurences[index] += 1
word_occurances.append(text_occurences)
X_words = pd.DataFrame(np.array(wor... | code_fim | hard | {
"lang": "python",
"repo": "mohan67nv/ProjectAmazonTextAnalysis",
"path": "/johannes/Amazon_notebook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yield (
api.test('basic') +
api.platform('linux', 64) +
api.properties.tryserver(
path_config='kitchen',
mastername='tryserver.chromium.linux',
buildername='linux_chromium_rel_ng')
)<|fim_prefix|># repo: metux/chromium-suckless path: /infra/recipes/chromium_trybot.... | code_fim | hard | {
"lang": "python",
"repo": "metux/chromium-suckless",
"path": "/infra/recipes/chromium_trybot.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: metux/chromium-suckless path: /infra/recipes/chromium_trybot.py
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'build/chromium',
'build/chromium_android',
'build/chro... | code_fim | medium | {
"lang": "python",
"repo": "metux/chromium-suckless",
"path": "/infra/recipes/chromium_trybot.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def RunSteps(api):
return api.chromium_tests.trybot_steps(api)
def GenTests(api):
yield (
api.test('basic') +
api.platform('linux', 64) +
api.properties.tryserver(
path_config='kitchen',
mastername='tryserver.chromium.linux',
buildername='linux_chromium_rel_ng')
... | code_fim | hard | {
"lang": "python",
"repo": "metux/chromium-suckless",
"path": "/infra/recipes/chromium_trybot.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ManMMD/Manyu path: /homework_day_6/3.py
def jiance(s):
n=0
for i in s:
if i>='0' and i<<|fim_suffix|>:
print('invalid password')
S=raw_input('>>')
jiance(S)<|fim_middle|>='9':
n+=1
if (len(s)>=8) and (s.isalnum()==True) and (n>=2):
print('v... | code_fim | medium | {
"lang": "python",
"repo": "ManMMD/Manyu",
"path": "/homework_day_6/3.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>m()==True) and (n>=2):
print('valid password')
else:
print('invalid password')
S=raw_input('>>')
jiance(S)<|fim_prefix|># repo: ManMMD/Manyu path: /homework_day_6/3.py
def jiance(s):
n=0
for i in s:
if i>='0' and i<<|fim_middle|>='9':
n+=1
if (... | code_fim | medium | {
"lang": "python",
"repo": "ManMMD/Manyu",
"path": "/homework_day_6/3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>:
print('invalid password')
S=raw_input('>>')
jiance(S)<|fim_prefix|># repo: ManMMD/Manyu path: /homework_day_6/3.py
def jiance(s):
n=0
for i in s:
if i>='0' and i<='9':
n+=1
if (len(s)>=8) and (s.isalnu<|fim_middle|>m()==True) and (n>=2):
print('v... | code_fim | medium | {
"lang": "python",
"repo": "ManMMD/Manyu",
"path": "/homework_day_6/3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Cifar-10.1 dataset."""
BUILDER_CONFIGS = [
Cifar10_1Config(
description=(
"It is the first version of our dataset on which we tested any"
" classifier. As mentioned above, this makes the v4 dataset"
" independent of the classifiers we evalu... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/datasets",
"path": "/tensorflow_datasets/image_classification/cifar10_1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _info(self):
return tfds.core.DatasetInfo(
builder=self,
description=_DESCRIPTION,
features=tfds.features.FeaturesDict({
"image": tfds.features.Image(shape=(32, 32, 3)),
"label": tfds.features.ClassLabel(num_classes=10),
}),
supervi... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/datasets",
"path": "/tensorflow_datasets/image_classification/cifar10_1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/datasets path: /tensorflow_datasets/image_classification/cifar10_1.py
# coding=utf-8
# Copyright 2023 The TensorFlow Datasets Authors.
#
# 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... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/datasets",
"path": "/tensorflow_datasets/image_classification/cifar10_1.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DincerDogan/Data-Science-Learning-Path path: /Data Scientist Career Path/9. Data Visualization/2. Seaborn/1. Introduction/5. aggp.py
import codecademylib3_seaborn
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
<|fi... | code_fim | easy | {
"lang": "python",
"repo": "DincerDogan/Data-Science-Learning-Path",
"path": "/Data Scientist Career Path/9. Data Visualization/2. Seaborn/1. Introduction/5. aggp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>sns.barplot(data=gradebook, x="assignment_name", y="grade")
plt.show()<|fim_prefix|># repo: DincerDogan/Data-Science-Learning-Path path: /Data Scientist Career Path/9. Data Visualization/2. Seaborn/1. Introduction/5. aggp.py
import codecademylib3_seaborn
import warnings
warnings.filterwarnings('ignore')... | code_fim | easy | {
"lang": "python",
"repo": "DincerDogan/Data-Science-Learning-Path",
"path": "/Data Scientist Career Path/9. Data Visualization/2. Seaborn/1. Introduction/5. aggp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amjltc295/TetrisBattleAI path: /src/run_fixed_model.py
import time
from engine import TetrisEngine
from fixed_policy_agent import FixedPolicyAgent
width, height = 10, 20 # standard tetris friends rules
engine = TetrisEngine(width, height)
def run():
<|fim_suffix|> state, reward, done, ... | code_fim | medium | {
"lang": "python",
"repo": "amjltc295/TetrisBattleAI",
"path": "/src/run_fixed_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Accumulate reward
score += int(cleared_lines)
print(engine)
print('score : %d' % score)
# print(action)
time.sleep(.1)
if done:
print('score {0}'.format(score))
break
if __name__ == '__main__':
run()<|fim_prefix|># r... | code_fim | hard | {
"lang": "python",
"repo": "amjltc295/TetrisBattleAI",
"path": "/src/run_fixed_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuvipanda/github-ssh-auth path: /github-keys-check.py
#!/usr/bin/python3
import urllib.request
import argparse
import pwd
import grp
import sys
def key_for_user(user):
url = 'https://github.com/%s.keys' % user
with urllib.request.urlopen(url) as f:
return f.read().decode('utf-8'... | code_fim | hard | {
"lang": "python",
"repo": "yuvipanda/github-ssh-auth",
"path": "/github-keys-check.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Validates that a given username is:
1. A valid, existing user
2. Is a member of the group in_group
3. Has uid > min_uid
"""
user = pwd.getpwnam(username)
if in_group is None or username in grp.getgrnam(in_group).gr_mem:
return user.pw_uid > min_uid
... | code_fim | medium | {
"lang": "python",
"repo": "yuvipanda/github-ssh-auth",
"path": "/github-keys-check.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_violets.py
from xai.brain.wordbase.nouns._violet import _VIOLET
#calss header
class _VIOLETS(_VIOLET, ):
<|fim_suffix|> _VIOLET.__init__(self)
self.name = "VIOLETS"
self.specie = 'nouns'
self.basic = "violet"
self.jsondata = {}<|fim_middle... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_violets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _VIOLET.__init__(self)
self.name = "VIOLETS"
self.specie = 'nouns'
self.basic = "violet"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_violets.py
from xai.brain.wordbase.nouns._violet import _VIOLET
<|fim_middle|>#calss header
class _VIOLETS(_VIOLET, )... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_violets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = User
fields = ('first_name',
'last_name',
'email',
)
class CustomerForm(forms.ModelForm):
class Meta:
model = Customer
fields = ('phone_number',
'company_name')<|fim_prefix... | code_fim | easy | {
"lang": "python",
"repo": "Nezale/Cloud_Warehouse_Project",
"path": "/customer/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Customer
fields = ('phone_number',
'company_name')<|fim_prefix|># repo: Nezale/Cloud_Warehouse_Project path: /customer/forms.py
from django import forms
from django.contrib.auth.models import User
from customer.models import Customer
class UserForm(forms.ModelF... | code_fim | easy | {
"lang": "python",
"repo": "Nezale/Cloud_Warehouse_Project",
"path": "/customer/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nezale/Cloud_Warehouse_Project path: /customer/forms.py
from django import forms
from django.contrib.auth.models import User
from customer.models import Customer
<|fim_suffix|> class Meta:
model = User
fields = ('first_name',
'last_name',
'e... | code_fim | easy | {
"lang": "python",
"repo": "Nezale/Cloud_Warehouse_Project",
"path": "/customer/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marijnkoolen/fuzzy-search path: /fuzzy_search/phrase/phrase_model.py
ultdict(set)
self.token_in_phrase: Dict[str, Set[str]] = defaultdict(set)
self.first_word_in_phrase: Dict[str, Dict[str, int]] = defaultdict(dict)
self.first_token_in_phrase: Dict[str, Dict[str, int]] = d... | code_fim | hard | {
"lang": "python",
"repo": "marijnkoolen/fuzzy-search",
"path": "/fuzzy_search/phrase/phrase_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marijnkoolen/fuzzy-search path: /fuzzy_search/phrase/phrase_model.py
self._index_phrase_words(distractor_phrase)
self._index_phrase_tokens(distractor_phrase)
def remove_phrase(self, phrase: Phrase):
"""Remove a main phrase from the model, including its connections to an... | code_fim | hard | {
"lang": "python",
"repo": "marijnkoolen/fuzzy-search",
"path": "/fuzzy_search/phrase/phrase_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param variants: a list of variant strings or variant phrase objects to remove
:type variants: Union[List[str, Phrase]], None]
:param variants_of_phrase: an optional phrase string or phrase object for which all variants are to be removed
:type variants_of_phrase: Union[str,... | code_fim | hard | {
"lang": "python",
"repo": "marijnkoolen/fuzzy-search",
"path": "/fuzzy_search/phrase/phrase_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openworkouts/OpenWorkouts path: /ow/__init__.py
from pyramid.config import Configurator
from pyramid_zodbconn import get_connection
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.session import SignedCookieSessi... | code_fim | hard | {
"lang": "python",
"repo": "openworkouts/OpenWorkouts",
"path": "/ow/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main(global_config, **settings): # pragma: no cover
"""
This function returns a Pyramid WSGI application.
"""
session_factory = SignedCookieSessionFactory(
secret=settings['session.secret'],
cookie_name='ow-session')
authn_policy = AuthTktAuthenticationPolicy(
... | code_fim | medium | {
"lang": "python",
"repo": "openworkouts/OpenWorkouts",
"path": "/ow/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Author(models.Model):
author_name = models.CharField(max_length=100)
class ISBN(models.Model):
value = models.CharField(max_length=100)
class Book(models.Model):
book_name = models.CharField(max_length=100)
author = models.ForeignKey(Author)
isbn = models.OneToOneField(ISBN)... | code_fim | hard | {
"lang": "python",
"repo": "codacy/codacy-prospector",
"path": "/docs/multiple-tests/without-config-file/src/example.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: codacy/codacy-prospector path: /docs/multiple-tests/without-config-file/src/example.py
"""
Checks that Pylint does not complain about various
methods on Django model fields.
"""
# pylint: disable=C0111
from __future__ import print_function
from datetime import datetime, date
from decimal import ... | code_fim | hard | {
"lang": "python",
"repo": "codacy/codacy-prospector",
"path": "/docs/multiple-tests/without-config-file/src/example.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fruit_name = models.CharField(max_length=20)
class Seed(models.Model):
fruit = ForeignKey(Fruit)
def get_fruit_name(self):
return self.fruit.fruit_name
class User(models.Model):
username = models.CharField(max_length=32)
class UserProfile(models.Model):
user = OneToOneFi... | code_fim | hard | {
"lang": "python",
"repo": "codacy/codacy-prospector",
"path": "/docs/multiple-tests/without-config-file/src/example.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rb-rishika/dsilt-ml-code path: /13 Computer Vision/Tesseract OCR/ocr_pipeline.py
from imutils.object_detection import non_max_suppression
import numpy as np
import time
import cv2
from PIL import Image
import pytesseract
import re
from textblob import Word
image = cv2.imread('dsilt-ml-code/13 C... | code_fim | hard | {
"lang": "python",
"repo": "rb-rishika/dsilt-ml-code",
"path": "/13 Computer Vision/Tesseract OCR/ocr_pipeline.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # compute the offset factor as the resulting feature maps will
# be 4x smaller than the input image
(offsetX, offsetY) = (x * 4.0, y * 4.0)
# extract the rotation angle for the prediction and then
# compute the sin and cosine
angle = anglesData[x]
c... | code_fim | hard | {
"lang": "python",
"repo": "rb-rishika/dsilt-ml-code",
"path": "/13 Computer Vision/Tesseract OCR/ocr_pipeline.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: regiluze/minimun-DE-retriever path: /acceptance_specs/rest_api_specs.py
# -*- coding: utf-8 -*-
from expects import *
from server import app, BASE_PATH
from flask import json
with describe('Minimum extra DE data center REST API service acceptance specs'):
with before.each:
self.app... | code_fim | hard | {
"lang": "python",
"repo": "regiluze/minimun-DE-retriever",
"path": "/acceptance_specs/rest_api_specs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with it('returns 200 status code'):
result = self.app.put(BASE_PATH, data=json.dumps(self.input_data), content_type='application/json')
expect(result.status_code).to(equal(200))
with it('returns Berlin data center with 3 as minimun extra DE'):
result =... | code_fim | hard | {
"lang": "python",
"repo": "regiluze/minimun-DE-retriever",
"path": "/acceptance_specs/rest_api_specs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with it('returns Berlin data center with 3 as minimun extra DE'):
result = self.app.put(BASE_PATH, data=json.dumps(self.input_data), content_type='application/json')
result = json.loads(result.data)
expect(result['DE']).to(equal(3))
expect(result['D... | code_fim | hard | {
"lang": "python",
"repo": "regiluze/minimun-DE-retriever",
"path": "/acceptance_specs/rest_api_specs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spraakbanken/karp-backend path: /karp-backend/src/karp/auth_infrastructure/queries/lex_resources.py
import typing # noqa: D100, I001
from karp.auth.domain import errors
from karp.auth.application.queries import (
GetResourcePermissions,
ResourcePermissionDto,
IsResourceProtected,
)
... | code_fim | hard | {
"lang": "python",
"repo": "spraakbanken/karp-backend",
"path": "/karp-backend/src/karp/auth_infrastructure/queries/lex_resources.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
protected = "READ"
if protected:
resource_obj["protected"] = protected
resource_permissions.append(resource_obj)
return resource_permissions
class LexIsResourceProtected(IsResourceProtected): # noqa: D101
def __init... | code_fim | medium | {
"lang": "python",
"repo": "spraakbanken/karp-backend",
"path": "/karp-backend/src/karp/auth_infrastructure/queries/lex_resources.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewdmeier/brainslug path: /poc/brainslug.py
from abc import ABCMeta, abstractmethod
from functools import partial
import asyncio
import json
import threading
import uuid
import weakref
from aiohttp import web
# ✂ - brainslug/__init__.py ------------------------------------- ✂
# XXX: Cada mo... | code_fim | hard | {
"lang": "python",
"repo": "andrewdmeier/brainslug",
"path": "/poc/brainslug.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> app = ZombieApp(fn=fn, spec=spec)
APPS[fn.__name__] = app
return app
return _zombieapp
#
# Available apps
#
# ✂ - brainslug/pocapps.py -------------------------------------- ✂
@zombieapp(z=ZombieSpec(machine_id='pepe', platform='linux'))
def list_current_dir(userapi, z):
... | code_fim | hard | {
"lang": "python",
"repo": "andrewdmeier/brainslug",
"path": "/poc/brainslug.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.