text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: ccastillo-py/BBDD_Peewee path: /recetas/reportes.py
'''
Reportes de recetas
'''
from recetas.models import Receta
def imprimir(recetas):
for receta in recetas:
print(f"Código: {receta.codigo} - Contenido: {receta.contenido} "
f"- Fecha de creación: {receta.fec... | code_fim | hard | {
"lang": "python",
"repo": "ccastillo-py/BBDD_Peewee",
"path": "/recetas/reportes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> salir = True
while salir:
print('')
print('-'*100)
print('Bienvenido al buscador de recetas. ¿Qué desea realizar?'.center(100, ' '))
print('-'*100)
print('''
1) Búsqueda de receta por código
2) Salir del buscador''')
try:
... | code_fim | hard | {
"lang": "python",
"repo": "ccastillo-py/BBDD_Peewee",
"path": "/recetas/reportes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
opcion = int(input('\nEscoja opción\n>>'))
if opcion == 1:
valor = input('Introduce código de receta: ').upper()
recetas = Receta.select().where(Receta.codigo == valor)
imprimir(recetas)
elif opcion == 2... | code_fim | hard | {
"lang": "python",
"repo": "ccastillo-py/BBDD_Peewee",
"path": "/recetas/reportes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paulacduffy/irisdatasetproject path: /plots.py
#Paula Duffy Programming & Scripting Project
#Histogram & Boxplot
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Import pandas, numpy & matplotlib libraries
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/i... | code_fim | medium | {
"lang": "python",
"repo": "paulacduffy/irisdatasetproject",
"path": "/plots.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Scatterplot of ratio of sepal length to sepal width
dataset.plot(kind="scatter", x="sepal-length", y="sepal-width")
plt.show()
#reference: http://www.learn4master.com/machine-learning/visualize-iris-dataset-using-python<|fim_prefix|># repo: paulacduffy/irisdatasetproject path: /plots.py
#Paula Duffy Pro... | code_fim | medium | {
"lang": "python",
"repo": "paulacduffy/irisdatasetproject",
"path": "/plots.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tierpsy/tierpsy-tracker path: /tierpsy/__init__.py
# # -*- coding: utf-8 -*-
# """
# Created on Tue Jul 7 11:29:01 2015
# @author: ajaver
# """
import os
import sys
import warnings
from .version import __version__
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size cha... | code_fim | medium | {
"lang": "python",
"repo": "Tierpsy/tierpsy-tracker",
"path": "/tierpsy/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Init code to load external dll
ctypes.CDLL('mkl_avx2.dll')
ctypes.CDLL('mkl_def.dll')
ctypes.CDLL('mkl_vml_avx2.dll')
ctypes.CDLL('mkl_vml_def.dll')
# Restore dll search path.
ctypes.windll.kernel32.SetDllDirectoryW(sys... | code_fim | hard | {
"lang": "python",
"repo": "Tierpsy/tierpsy-tracker",
"path": "/tierpsy/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnh865/election_sim path: /votesim/benchmarks/tests/test_benchmark_tactical.py
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 10 01:19:07 2020
@author: John
"""
import os
import pdb
import votesim
import logging
import numpy as np
from votesim.benchmarks import tactical
<|fim_suffix|> # Ch... | code_fim | hard | {
"lang": "python",
"repo": "johnh865/election_sim",
"path": "/votesim/benchmarks/tests/test_benchmark_tactical.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_benchmark():
methods = ['plurality', 'irv', 'score']
benchmark = tactical.tactical_dummy()
df = benchmark.run(methods, cpus=1,)
# test re-run capability
e2 = benchmark.rerun(index=0, df=df)
# Check to make sure outputs of re-run are the same.
s1 = df.loc[0]
... | code_fim | hard | {
"lang": "python",
"repo": "johnh865/election_sim",
"path": "/votesim/benchmarks/tests/test_benchmark_tactical.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaulKuin/uvotpy path: /uvotpy/uvotmisc.py
if (symb != ' '):
nc = len(l[0].split(symb))
else:
nc = len(l[0].split())
k = len(l)
data = N.zeros( (k,nc) )
j = 0
for i in range(k):
#print i,j,l[i]
if symb != ' ':
xx = l[i].split(symb)
else:
... | code_fim | hard | {
"lang": "python",
"repo": "PaulKuin/uvotpy",
"path": "/uvotpy/uvotmisc.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> tcorr : float
time correction in seconds
success: bool
True: time corr computed from the CALDB file
False: rough estimate (to ~2 sec)
For a mission time of T, the correction in seconds is computed
with the following:
T1 = (T-TSTART)/86400
TCORR =... | code_fim | hard | {
"lang": "python",
"repo": "PaulKuin/uvotpy",
"path": "/uvotpy/uvotmisc.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaulKuin/uvotpy path: /uvotpy/uvotmisc.py
offset = c_offset,
order = order, wheelpos=wheelpos)
def WC_zemaxlines(dis_zmx,wav_zmx,xpix,ypix,wave,
wpixscale=0.960,
cpixscale = 1.0,
lines = (1723,1908,2297,2405,2530,2595,2699,2733,2906,3070,4649),
c_offs... | code_fim | hard | {
"lang": "python",
"repo": "PaulKuin/uvotpy",
"path": "/uvotpy/uvotmisc.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HAKSOAT/TWLight path: /TWLight/resources/migrations/0028_auto_20170126_2225.py
# -*- coding: utf-8 -*-
from django.db import migrations, models
<|fim_suffix|> dependencies = [("resources", "0027_auto_20170117_2046")]
operations = [
migrations.AlterField(
model_name=... | code_fim | hard | {
"lang": "python",
"repo": "HAKSOAT/TWLight",
"path": "/TWLight/resources/migrations/0028_auto_20170126_2225.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name="partner",
name="status",
field=models.IntegerField(
default=1,
help_text="Should this Partner be displayed to end users? Is it open for applications right now?",
... | code_fim | hard | {
"lang": "python",
"repo": "HAKSOAT/TWLight",
"path": "/TWLight/resources/migrations/0028_auto_20170126_2225.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for c in range(self.instrument.scan.columnCount()):
self.treeView.resizeColumnToContents(c)
@Slot(bool)
def onShowPushButtonClicked(self, checked: bool):
self.showScan(self.treeView.currentIndex())
@Slot(QtCore.QModelIndex)
def showScan(self, index: QtCore.QMo... | code_fim | hard | {
"lang": "python",
"repo": "awacha/cct",
"path": "/cct/qtgui2/listing/scanview.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awacha/cct path: /cct/qtgui2/listing/scanview.py
from typing import Optional
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import pyqtSlot as Slot
from .scanview_ui import Ui_Form
from ..utils.plotscan import PlotScan
from ..utils.window import WindowRequiresDevices
from ...core2.datacl... | code_fim | hard | {
"lang": "python",
"repo": "awacha/cct",
"path": "/cct/qtgui2/listing/scanview.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Add token to keys-list
if token is not '':
keys.append(line.split('=')[-1].rstrip('\n'))
auth = tweepy.OAuthHandler(*keys[:2])
auth.set_access_token(*keys[2:])
return auth
def json_dump_line(json_object, file_object):
"""
Dum... | code_fim | hard | {
"lang": "python",
"repo": "jorgenriseth/vox-populi",
"path": "/corpus_creation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif os.path.isdir(filepath):
# Browse one dir deeper
rm_empty_json_in_path(path + f + '/')
if __name__ == '__main__':
number_of_tweets = int(input("Number of tweets per user:"))
# Ensure that the argument is a positive integer.
assert number_of_tweets > 0, "N... | code_fim | hard | {
"lang": "python",
"repo": "jorgenriseth/vox-populi",
"path": "/corpus_creation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jorgenriseth/vox-populi path: /corpus_creation.py
import os
import sys
import tweepy
import json
class CorpusCreator:
"""
Class for creating corpus structure and loading tweets
using tweepy.
Structure:
-> corpus
---> party1
-----> user11
-----> user12
... | code_fim | hard | {
"lang": "python",
"repo": "jorgenriseth/vox-populi",
"path": "/corpus_creation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> "sts": "FWD",
"tree_type": "MST",
"vlan": 1
}
},
"status": "FAILED",
"value": "There should not be any Non Edge Designated Forwarding port"
}
}<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/li... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/nxos/tests/ShowSpanningTreeIssuImpact/cli/equal/golden_output_expected.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/nxos/tests/ShowSpanningTreeIssuImpact/cli/equal/golden_output_expected.py
expected_output = {
"issu_proceed_status": "ISSU Cannot Proceed",
"criteria1": {
"status": "PASSED",
"value": "No Topology change must... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/nxos/tests/ShowSpanningTreeIssuImpact/cli/equal/golden_output_expected.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> cols = self.df.columns
tbb = ''
for row in range(self.df.shape[0]):
tbb = tbb + '<tr> '
for col in cols:
tbb = tbb + '<th> {text} </th>'.format(text=self.df.loc[row, col])
tbb = tbb + '</tr>'
tb = '<tbody> {body} </tbody>'... | code_fim | hard | {
"lang": "python",
"repo": "diveki/groceryPriceCompare",
"path": "/data_handling/data_management.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: diveki/groceryPriceCompare path: /data_handling/data_management.py
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'scraper'))
from scraper import *
import pandas as pd
import numpy as np
class SearchResult:
def __init__(self, data):
self.data = data
... | code_fim | hard | {
"lang": "python",
"repo": "diveki/groceryPriceCompare",
"path": "/data_handling/data_management.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
store_list = init_stores(STORE_DICT['HU'])
prod_collect = []
for st in store_list:
class2call = STORE_MAP['HU'].get(st.name)
prod_info = class2call('alpro coconut', st)
prod_info.start_collecting_data()
prod_collect.extend(prod_info.... | code_fim | hard | {
"lang": "python",
"repo": "diveki/groceryPriceCompare",
"path": "/data_handling/data_management.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whosonfirst/py-mapzen-whosonfirst-utils path: /scripts/wof-filter-meta
#!/usr/bin/env python
import os
import sys
import logging
import csv
if __name__ == '__main__':
import optparse
opt_parser = optparse.OptionParser()
opt_parser.add_option('-c', '--country', dest='country', act... | code_fim | medium | {
"lang": "python",
"repo": "whosonfirst/py-mapzen-whosonfirst-utils",
"path": "/scripts/wof-filter-meta",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> fh = open(path, 'r')
reader = csv.DictReader(fh)
for row in reader:
if row['wof_country'].upper() != options.country.upper():
continue
if not writer:
out = sys.stdout
if options.out:
ou... | code_fim | hard | {
"lang": "python",
"repo": "whosonfirst/py-mapzen-whosonfirst-utils",
"path": "/scripts/wof-filter-meta",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> options, args = opt_parser.parse_args()
if options.verbose:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
writer = None
for path in args:
fh = open(path, 'r')
reader = csv.DictReader(fh)
for row in re... | code_fim | hard | {
"lang": "python",
"repo": "whosonfirst/py-mapzen-whosonfirst-utils",
"path": "/scripts/wof-filter-meta",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif short_code == '3':
if display_user():
print("Below is a list of all your user accounts")
print('\n')
for user in display_user():
print(f" {user.first_name} {user.last_name} account name {Counter}")
print('\n')
else:
... | code_fim | hard | {
"lang": "python",
"repo": "millywayne/password-locker",
"path": "/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Last Name...")
l_name = input()
print("Email Adress...")
e_adress = input()
print("Enter username... Hint: Generating a secure passlock")
user_name = input()
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklm... | code_fim | hard | {
"lang": "python",
"repo": "millywayne/password-locker",
"path": "/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: millywayne/password-locker path: /run.py
from typing import Counter
from user import user
from passlocker import passlocker
import random
def create_user(fname, lname, email,):
"""
new user function
"""
new_user = user(fname, lname, email)
return new_user
def create_pass... | code_fim | hard | {
"lang": "python",
"repo": "millywayne/password-locker",
"path": "/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif is_rmarkdown(page.body):
# It should not use page_id as a kwarg to keep the cache key consistent
rmarkdown_page(page.id, clear_cache=True)<|fim_prefix|># repo: daigotanaka/kawaraban path: /core/receivers.py
from django.db.models.signals import post_save
from django.dispatch impor... | code_fim | hard | {
"lang": "python",
"repo": "daigotanaka/kawaraban",
"path": "/core/receivers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daigotanaka/kawaraban path: /core/receivers.py
from django.db.models.signals import post_save
from django.dispatch import receiver
from core.models import Page
from core.rutils import is_rmarkdown, rmarkdown_page
from core.utils import is_markdown, markdown_page
<|fim_suffix|> page = kwargs... | code_fim | medium | {
"lang": "python",
"repo": "daigotanaka/kawaraban",
"path": "/core/receivers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> verbose_name_plural = "concentradores"
class DistribuidorPotencial(models.Model):
id = models.AutoField(primary_key=True)
nombre_distribuidor = models.CharField(max_length=100)
rfc = models.CharField(max_length=13)
telefono = models.CharField(max_length=20)
direccion = models... | code_fim | hard | {
"lang": "python",
"repo": "oxigenocc/oxigeno.cc",
"path": "/mysite/oxigeno/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oxigenocc/oxigeno.cc path: /mysite/oxigeno/models.py
from django.db import models
from django_google_maps import fields as map_fields
from simple_history.models import HistoricalRecords
# Create your models here.
class Distribuidor(models.Model):
id = models.AutoField(primary_key=True)
... | code_fim | hard | {
"lang": "python",
"repo": "oxigenocc/oxigeno.cc",
"path": "/mysite/oxigeno/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scikit-hep/awkward path: /tests/test_1685_IndexedArray_project_parameters.py
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import numpy as np
import pytest # noqa: F401
<|fim_suffix|>
def test():
layout = ak.contents.IndexedArray(
ak.index.... | code_fim | medium | {
"lang": "python",
"repo": "scikit-hep/awkward",
"path": "/tests/test_1685_IndexedArray_project_parameters.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test():
layout = ak.contents.IndexedArray(
ak.index.Index64(np.array([0, 1, 2, 3], np.int64)),
ak.contents.NumpyArray(
np.arange(10), parameters={"this": "that", "some": "hidden"}
),
parameters={"some": "other"},
)
assert layout.project().parame... | code_fim | medium | {
"lang": "python",
"repo": "scikit-hep/awkward",
"path": "/tests/test_1685_IndexedArray_project_parameters.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zzmjohn/scs path: /python/scs.py
#!/usr/bin/env python
import _scs_direct
import _scs_indirect
from warnings import warn
from scipy import sparse
def solve(probdata, cone, opts={}, USE_INDIRECT=False):
""" This Python routine "unpacks" scipy sparse matrix A into the
data structures ... | code_fim | hard | {
"lang": "python",
"repo": "zzmjohn/scs",
"path": "/python/scs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if sparse.issparse(c):
c = c.toDense()
m, n = A.shape
Adata, Aindices, Acolptr = A.data, A.indices, A.indptr
if USE_INDIRECT:
return _scs_indirect.csolve((m, n), Adata, Aindices, Acolptr, b, c, cone, opts, warm)
else:
return _scs_direct.csolve((m, n), Adata, A... | code_fim | hard | {
"lang": "python",
"repo": "zzmjohn/scs",
"path": "/python/scs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [x, y, z]
def get_distance(self, star):
"""Returns the angular distance to the given star.
:param star: Star object to get distance to
:return: Angular distance."""
if self == star:
return 0
a_car = self.get_cartesian_coords()
... | code_fim | hard | {
"lang": "python",
"repo": "granasat/startrackerpy",
"path": "/startrackerpy/server/startracker/star.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return: List of Stars"""
return self._neighbours
def get_cartesian_coords(self):
"""Converts the given ra and dec to its cartesian coordinates.
:return: List of cartesian coords [x,y,z]"""
r = 1
dec = self.dec + 90
x = r * math.sin(np.deg2rad(... | code_fim | medium | {
"lang": "python",
"repo": "granasat/startrackerpy",
"path": "/startrackerpy/server/startracker/star.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: granasat/startrackerpy path: /startrackerpy/server/startracker/star.py
import math
import numpy as np
from astropy.coordinates import SkyCoord
from astropy import units as u
class Star:
"""Represents a star and provides methods to convert coordinates,
save a list of neighboors..."""
... | code_fim | medium | {
"lang": "python",
"repo": "granasat/startrackerpy",
"path": "/startrackerpy/server/startracker/star.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hovel/pybbm path: /pybb/templatetags/pybb_tags.py
import inspect
import math
import time
import warnings
import django
from django import template
from django.core.cache import cache
from django.utils.safestring import mark_safe
from django.utils.encoding import smart_text
from django.utils.htm... | code_fim | hard | {
"lang": "python",
"repo": "hovel/pybbm",
"path": "/pybb/templatetags/pybb_tags.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@register.filter
def pybb_is_topic_unread(topic, user):
if not user.is_authenticated:
return False
last_topic_update = topic.updated or topic.created
unread = not ForumReadTracker.objects.filter(
forum=topic.forum,
user=user.id,
time_stamp__gte=last_topic_upd... | code_fim | hard | {
"lang": "python",
"repo": "hovel/pybbm",
"path": "/pybb/templatetags/pybb_tags.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@register.filter
def endswith(str, substr):
return str.endswith(substr)
@register.assignment_tag
def pybb_get_profile(*args, **kwargs):
try:
return util.get_pybb_profile(kwargs.get('user') or args[0])
except:
return None
@register.assignment_tag(takes_context=True)
def pybb... | code_fim | hard | {
"lang": "python",
"repo": "hovel/pybbm",
"path": "/pybb/templatetags/pybb_tags.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kinto/kinto path: /kinto/plugins/accounts/utils.py
import bcrypt
from kinto.core import utils
ACCOUNT_CACHE_KEY = "accounts:{}:verified"
ACCOUNT_POLICY_NAME = "account"
ACCOUNT_RESET_PASSWORD_CACHE_KEY = "accounts:{}:reset-password"
ACCOUNT_VALIDATION_CACHE_KEY = "accounts:{}:validation-key"
DE... | code_fim | hard | {
"lang": "python",
"repo": "Kinto/kinto",
"path": "/kinto/plugins/accounts/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def delete_cached_validation_key(username, registry):
"""Given a username, delete the validation key from the cache."""
hmac_secret = registry.settings["userid_hmac_secret"]
cache_key = utils.hmac_digest(hmac_secret, ACCOUNT_VALIDATION_CACHE_KEY.format(username))
cache = registry.cache
... | code_fim | hard | {
"lang": "python",
"repo": "Kinto/kinto",
"path": "/kinto/plugins/accounts/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eleparts/raspi-beginnerKit path: /2.Raspberry PI Sensor Kit/Python/1.Ultrasonic sensor.py
'''
* 라즈베리파이 센서 키트 Ultrasonic sensor 동작 예제
*
* 본 예제는 Ultrasonic sensor(초음파 거리측정)의 예제로 초음파 센서와 물체의 거리를 터미널 창으로 실시간 출력해 줍니다.
*
* 사용 소자 : Ultrasonic 센서
* VCC 핀 : 5V | GND 핀 : GND
* TRIG핀 : GPIO 38번 | BCM : 2... | code_fim | medium | {
"lang": "python",
"repo": "eleparts/raspi-beginnerKit",
"path": "/2.Raspberry PI Sensor Kit/Python/1.Ultrasonic sensor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> distance = pulse_duration * (34000 / 2) # 초음파 이동 시간으로 거리 계산 (공기 중 초음파 속도 약 340m/s, 이동거리/2)
distance = round(distance, 1)
print("Distance: ", distance, "cm")
time.sleep(0.2)
finally:
GPIO.cleanup() # GPIO 상태 초기화, 없을 경우 예제 재 실행 시 사용중인 GPIO 경고 발생<|fim_prefix|... | code_fim | hard | {
"lang": "python",
"repo": "eleparts/raspi-beginnerKit",
"path": "/2.Raspberry PI Sensor Kit/Python/1.Ultrasonic sensor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ax.plot_surface(dt_vals, punc_vals, P_vals, rstride=8, cstride=8, alpha=0.3,
cmap=cmm, linewidth=0, antialiased=False)
ax.set_xlabel('dt')
ax.set_ylabel('Punctuality')
ax.set_zlabel('P(dt, Punctuality)')
def predict(arr, regr):
predict = np.array(arr).dot(regr.... | code_fim | hard | {
"lang": "python",
"repo": "robotenique/mlAlgorithms",
"path": "/supervised/gradDescent/osregression.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robotenique/mlAlgorithms path: /supervised/gradDescent/osregression.py
import numpy as np
from sklearn import linear_model
from matplotlib import use, cm
use('TkAgg')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
import math
def main():
data = np.loadtxt('osdata.txt... | code_fim | hard | {
"lang": "python",
"repo": "robotenique/mlAlgorithms",
"path": "/supervised/gradDescent/osregression.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndresMWeber/Anvil path: /anvil/sub_rig_templates/hand.py
import string
import anvil.config as cfg
from base_sub_rig_template import SubRigTemplate
import anvil.objects.attribute as at
import anvil.node_types as nt
class Hand(SubRigTemplate):
BUILT_IN_META_DATA = SubRigTemplate.BUILT_IN_MET... | code_fim | hard | {
"lang": "python",
"repo": "AndresMWeber/Anvil",
"path": "/anvil/sub_rig_templates/hand.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_up_fist_pose(self):
# for now just hook it up to the controls
pass
def set_up_spread_pose(self):
# for now just hook it up to the controls
pass
def set_up_curl_pose(self):
# for now just hook it up to the controls
pass
def connect_... | code_fim | hard | {
"lang": "python",
"repo": "AndresMWeber/Anvil",
"path": "/anvil/sub_rig_templates/hand.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(Hand, self).rename(*input_dicts, **kwargs)
def set_up_fist_pose(self):
# for now just hook it up to the controls
pass
def set_up_spread_pose(self):
# for now just hook it up to the controls
pass
def set_up_curl_pose(self):
# for now just... | code_fim | hard | {
"lang": "python",
"repo": "AndresMWeber/Anvil",
"path": "/anvil/sub_rig_templates/hand.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SublimeText/UnitTesting path: /unittesting/helpers/__init__.py
from .temp_directory_test_case import TempDirectoryTestCase # noqa: F401
from .view_test_case import ViewT<|fim_suffix|>_cast import OverridePreferencesTestCase # noqa: F401<|fim_middle|>estCase # noqa: F401
from .override_prefere... | code_fim | easy | {
"lang": "python",
"repo": "SublimeText/UnitTesting",
"path": "/unittesting/helpers/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>estCase # noqa: F401
from .override_preferences_test_cast import OverridePreferencesTestCase # noqa: F401<|fim_prefix|># repo: SublimeText/UnitTesting path: /unittesting/helpers/__init__.py
from .temp_directory_test_case import TempDirectoryTe<|fim_middle|>stCase # noqa: F401
from .view_test_case imp... | code_fim | easy | {
"lang": "python",
"repo": "SublimeText/UnitTesting",
"path": "/unittesting/helpers/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_cast import OverridePreferencesTestCase # noqa: F401<|fim_prefix|># repo: SublimeText/UnitTesting path: /unittesting/helpers/__init__.py
from .temp_directory_test_case import TempDirectoryTestCase # noqa: F401
from .view_test_case import ViewT<|fim_middle|>estCase # noqa: F401
from .override_prefere... | code_fim | easy | {
"lang": "python",
"repo": "SublimeText/UnitTesting",
"path": "/unittesting/helpers/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :rtype: None
"""
# Take the variable of the FMU that have the specified variability and causality
# the result is a dictionary which has as key the name of the variable with the dot notation
# and as element a class of type << pyfmi.fmi.ScalarVariable >>
# A... | code_fim | hard | {
"lang": "python",
"repo": "krzysztofarendt/EstimationPy-KA",
"path": "/estimationpy/fmu_utils/model.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krzysztofarendt/EstimationPy-KA path: /estimationpy/fmu_utils/model.py
def initialize_simulator(self, startTime=None):
"""
This method performs a simulation of length zero to initialize the model.
The initialization is needed only once before running the first simu... | code_fim | hard | {
"lang": "python",
"repo": "krzysztofarendt/EstimationPy-KA",
"path": "/estimationpy/fmu_utils/model.py",
"mode": "psm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krzysztofarendt/EstimationPy-KA path: /estimationpy/fmu_utils/model.py
es) > 0, 'No measured outputs found'
# Try to align the measured output data
self.check_data_list(outDataSeries, align = True)
# Now transform it into a matrix with time as first column and th... | code_fim | hard | {
"lang": "python",
"repo": "krzysztofarendt/EstimationPy-KA",
"path": "/estimationpy/fmu_utils/model.py",
"mode": "psm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|> Notes
-----
If the dtype provided was Boolean, the resulting array will
be Boolean with `True` if the corresponding pixel had a value
greater than or equal to 128, `False` otherwise.
If the dtype provided was a float dtype, the values will be mapped to
the unit interval [0, 1]... | code_fim | hard | {
"lang": "python",
"repo": "laurent-dinh/fuel",
"path": "/fuel/converters/mnist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
subparser.add_argument(
"--dtype", help="dtype to save to; by default, images will be " +
"returned in their original unsigned byte format",
choices=('float32', 'float64', 'bool'), type=str, default=None)
subparser.set_defaults(func=convert_mnist)
def read_mnist_i... | code_fim | hard | {
"lang": "python",
"repo": "laurent-dinh/fuel",
"path": "/fuel/converters/mnist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: laurent-dinh/fuel path: /fuel/converters/mnist.py
import gzip
import os
import struct
import h5py
import numpy
from fuel.converters.base import fill_hdf5_file, check_exists
MNIST_IMAGE_MAGIC = 2051
MNIST_LABEL_MAGIC = 2049
TRAIN_IMAGES = 'train-images-idx3-ubyte.gz'
TRAIN_LABELS = 'train-labe... | code_fim | hard | {
"lang": "python",
"repo": "laurent-dinh/fuel",
"path": "/fuel/converters/mnist.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DSeiferth/PK_Model path: /pkmodel/model.py
#
# Model class
#
class Model:
"""A Pharmokinetic (PK) model
Parameters
----------
value: numeric, optional
an example paramter
Vc: float
central compartment volume
Vps: list of floats
list of volumes of... | code_fim | hard | {
"lang": "python",
"repo": "DSeiferth/PK_Model",
"path": "/pkmodel/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Volume of the central compartment.
"""
return self.__central_volume
@property
def size(self):
"""
Returns the number of peripheral compartments.
"""
return self.__n_compartments
@property
def CL(self):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "DSeiferth/PK_Model",
"path": "/pkmodel/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daniel-de-vries/OpenLEGO path: /openlego/utils/general_utils.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2018 D. de Vries
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 t... | code_fim | hard | {
"lang": "python",
"repo": "daniel-de-vries/OpenLEGO",
"path": "/openlego/utils/general_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def unscale_value(v, ref0, ref):
# TODO: add docstring
if isinstance(v, list):
v = np.array(v)
return v*(ref-ref0)+ref0
def scale_value(v, adder, scaler):
# TODO: add docstring
if adder is None:
adder = 0.
if scaler is None:
scaler = 1.
if isinstance(v... | code_fim | hard | {
"lang": "python",
"repo": "daniel-de-vries/OpenLEGO",
"path": "/openlego/utils/general_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def change_object_type(obj, new_type):
# type: (Union[str, SupportsInt, SupportsFloat], str) -> Union[str, int, float]
"""Attempts to change an object (usually a string) to a different object type."""
if new_type == 'str':
return str(obj)
elif new_type == 'int':
return int(... | code_fim | hard | {
"lang": "python",
"repo": "daniel-de-vries/OpenLEGO",
"path": "/openlego/utils/general_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
[type]: [Annotation and Task IDs]
"""
try:
logging.info("executing create_object_detection_record_controller function")
create_ner_record_request = request.dict(exclude_none=True)
project_flow_record = self.CRUDProjectFlow.r... | code_fim | hard | {
"lang": "python",
"repo": "Chronicles-of-AI/osAIris",
"path": "/datahub/sql/controllers/monitoring/data_monitoring_controller.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chronicles-of-AI/osAIris path: /datahub/sql/controllers/monitoring/data_monitoring_controller.py
ernal_call import APIInterface
from sql import config, logger
from sql.crud.data_monitoring_crud import CRUDDataMonitoring
from sql.crud.project_flow_crud import CRUDProjectFlow
from sql.crud.services... | code_fim | hard | {
"lang": "python",
"repo": "Chronicles-of-AI/osAIris",
"path": "/datahub/sql/controllers/monitoring/data_monitoring_controller.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Set the debug by-pass mode flag for log.error_on_exception() exception trap."""
global CRDS_EXCEPTION_TRAP
old_flag = CRDS_EXCEPTION_TRAP
if flag is not None:
CRDS_EXCEPTION_TRAP = flag
return old_flag
def _reraise(*args, **keys):
"""Signal to exception_trap_logger to u... | code_fim | hard | {
"lang": "python",
"repo": "spacetelescope/crds",
"path": "/crds/core/log.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.console is None:
self.console = self.add_stream_handler(stream)
def remove_console_handler(self):
if self.console is not None:
self.remove_stream_handler(self.console)
self.console = None
def add_stream_handler(self, filelike, level=log... | code_fim | hard | {
"lang": "python",
"repo": "spacetelescope/crds",
"path": "/crds/core/log.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spacetelescope/crds path: /crds/core/log.py
exceptions onto CRDS messages or adding information:
>>> with log.error_on_exception("Something bad happened and we trapped it"):
... raise ValueError("some value was bad.")
CRDS - ERROR - Something bad happened and we trapped it : some value was ... | code_fim | hard | {
"lang": "python",
"repo": "spacetelescope/crds",
"path": "/crds/core/log.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>nt(x, '- It\'s a positive number.')
elif x == 0:
print(x, '- It\'s zero.')
else:
print(x, '- It\'s negative.')<|fim_prefix|># repo: IhToN/DAW1-PRG path: /Ejercicios/PrimTrim/Ejercicio4.py
"""
Escribe un programa que reconozca una entrada de un número y nos diga si es negativo, positivo o cero... | code_fim | medium | {
"lang": "python",
"repo": "IhToN/DAW1-PRG",
"path": "/Ejercicios/PrimTrim/Ejercicio4.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IhToN/DAW1-PRG path: /Ejercicios/PrimTrim/Ejercicio4.py
"""
Escribe un programa que reconozca una entrada de un número y nos diga si es negativo, positivo o cero.
"""
x <|fim_suffix|>nt(x, '- It\'s a positive number.')
elif x == 0:
print(x, '- It\'s zero.')
else:
print(x, '- It\'s neg... | code_fim | hard | {
"lang": "python",
"repo": "IhToN/DAW1-PRG",
"path": "/Ejercicios/PrimTrim/Ejercicio4.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vighnesh153/ds-algo path: /src/arrays/rotate-image.py
def solve(matrix):
iteration = 0
size = len(matrix)
while iteration < size // 2:
# We only need to modify number of elements in that row - 1 elements
for i in range(size - iteration * 2 - 1):
i1 = j1 = ... | code_fim | medium | {
"lang": "python",
"repo": "vighnesh153/ds-algo",
"path": "/src/arrays/rotate-image.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
A = [
[5, 1, 9, 11],
[2, 4, 8, 10],
[13, 3, 6, 7],
[15, 14, 12, 16]
]
solve(A)
for row in A:
print(row)<|fim_prefix|># repo: vighnesh153/ds-algo path: /src/arrays/rotate-image.py
def solve(matrix):
iteration = 0
size = len(matrix)
while iteration < size // 2:
# W... | code_fim | medium | {
"lang": "python",
"repo": "vighnesh153/ds-algo",
"path": "/src/arrays/rotate-image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rajeshrinet/pystokes path: /examples/test-gt/periodic/matrixPeriodic_Fourier.py
4*eta) + 6.01396825396826*PI**4*b**6*exp(-9.0*PI**2/(L**2*xi**2))/(L**4*eta) + 1.13777777777778*PI**4*b**6*exp(-8.0*PI**2/(L**2*xi**2))/(L**4*eta) - 7.96444444444445*PI**4*b**4*exp(-12.0*PI**2/(L**2*xi**2))/(L**4*eta*... | code_fim | hard | {
"lang": "python",
"repo": "rajeshrinet/pystokes",
"path": "/examples/test-gt/periodic/matrixPeriodic_Fourier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return numpy.array([[0, (0.166666666666667*b**2*exp(-12.0*PI**2/(L**2*xi**2))/eta + 0.444444444444444*b**2*exp(-9.0*PI**2/(L**2*xi**2))/eta + 0.25*b**2*exp(-8.0*PI**2/(L**2*xi**2))/eta + 2.0*PI**2*b**2*exp(-12.0*PI**2/(L**2*xi**2))/(L**2*eta*xi**2) + 4.0*PI**2*b**2*exp(-9.0*PI**2/(L**2*xi**2))/(L**2*e... | code_fim | medium | {
"lang": "python",
"repo": "rajeshrinet/pystokes",
"path": "/examples/test-gt/periodic/matrixPeriodic_Fourier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>*6*eta*xi**4) + 69.12*PI**6*b**4*exp(-6.0*PI**2/(L**2*xi**2))/(L**6*eta*xi**4) - 32.0*PI**6*b**4*exp(-5.0*PI**2/(L**2*xi**2))/(L**6*eta*xi**4) - 20.48*PI**6*b**4*exp(-4.0*PI**2/(L**2*xi**2))/(L**6*eta*xi**4) + 15.36*PI**6*b**4*exp(-3.0*PI**2/(L**2*xi**2))/(L**6*eta*xi**4) + 2.56*PI**6*b**4*exp(-2.0*PI**2/... | code_fim | hard | {
"lang": "python",
"repo": "rajeshrinet/pystokes",
"path": "/examples/test-gt/periodic/matrixPeriodic_Fourier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: radheyshyamjangid/Current-Feed path: /currentfeed/apidataget/forms.py
from django.contrib.auth.models import User
from django import forms
from django.contrib.auth.forms import UserCreationForm
<|fim_suffix|> model=User
fields=('username','first_name','last_name','email','password... | code_fim | medium | {
"lang": "python",
"repo": "radheyshyamjangid/Current-Feed",
"path": "/currentfeed/apidataget/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> email = forms.EmailField(required=True)
class Meta:
model=User
fields=('username','first_name','last_name','email','password1','password2')
def save(self, commit=True):
user=super(UserForm,self).save(commit=False)
user.first_name=self.cleaned_data['first_name'... | code_fim | medium | {
"lang": "python",
"repo": "radheyshyamjangid/Current-Feed",
"path": "/currentfeed/apidataget/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model=User
fields=('username','first_name','last_name','email','password1','password2')
def save(self, commit=True):
user=super(UserForm,self).save(commit=False)
user.first_name=self.cleaned_data['first_name']
user.last_name=self.cleaned_data['last_name']
... | code_fim | medium | {
"lang": "python",
"repo": "radheyshyamjangid/Current-Feed",
"path": "/currentfeed/apidataget/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """State admin."""
fields = ( 'name',)
readonly_fields = ('created', 'modified')
list_display = ('name',)
ordering = ('name',)
search_fields = ('name',)
date_hierarchy = 'modified' # Jerarquizar por fechas
list_filter = ('name',)<|fim_prefix|># repo: jorgesaw/oclock path:... | code_fim | hard | {
"lang": "python",
"repo": "jorgesaw/oclock",
"path": "/apps/locations/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jorgesaw/oclock path: /apps/locations/admin.py
"""Locations admin."""
# Django
from django.contrib import admin
# Models
from apps.locations.models import (
City,
State
)
@admin.register(City)
class CityAdmin(admin.ModelAdmin):
"""City admin."""
autocomplete_fields = ('state... | code_fim | medium | {
"lang": "python",
"repo": "jorgesaw/oclock",
"path": "/apps/locations/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for price in [100, 110, 120, 130]:
market.place(Order(Side.BUY, 'abc', 10, price))
market.place(Order(Side.BUY, 'abc', 10, price))
def test_format_order_book(self):
market = Market()
for price in [110, 120, 130, 140]:
market.place(Order(Sid... | code_fim | hard | {
"lang": "python",
"repo": "mahiro/python-marketsim",
"path": "/tests/test_order_book.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mahiro/python-marketsim path: /tests/test_order_book.py
from marketsim import Market, Order, OrderStat, Side
import re
import unittest
class TestOrderBook(unittest.TestCase):
def strip_spaces(self, str):
str = re.sub(r'^\s+|\s+$', '', str)
str = re.compile(r'^\s+', re.MULTILI... | code_fim | hard | {
"lang": "python",
"repo": "mahiro/python-marketsim",
"path": "/tests/test_order_book.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if enviorment set GPU_ARCH_FLAG
gpu_arch_flag = os.getenv("GPU_ARCH_FLAG", None)
if gpu_arch_flag is not None:
args.append("%s" % gpu_arch_flag)
lib_dir = os.path.join(os.pardir, 'lib')
if os.path.exists(lib_dir):
... | code_fim | hard | {
"lang": "python",
"repo": "rapidsai/xgboost",
"path": "/jvm-packages/create_jni.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rapidsai/xgboost path: /jvm-packages/create_jni.py
#!/usr/bin/env python
import errno
import argparse
import glob
import os
import platform
import shutil
import subprocess
import sys
from contextlib import contextmanager
# Monkey-patch the API inconsistency between Python2.X and 3.X.
if sys.plat... | code_fim | hard | {
"lang": "python",
"repo": "rapidsai/xgboost",
"path": "/jvm-packages/create_jni.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> )
self.uuid_model1 = uuid.uuid4()
self.uuid_model1_bis_private = uuid.uuid4()
self.uuid_model2 = uuid.uuid4()
self.uuid_model3 = uuid.uuid4()
self.uuid_model4 = uuid.uuid4()
self.model1 = create_specific_mo... | code_fim | hard | {
"lang": "python",
"repo": "appukuttan-shailesh/hbp-validation-framework",
"path": "/tests_old/test_api/data_for_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: appukuttan-shailesh/hbp-validation-framework path: /tests_old/test_api/data_for_test.py
e_models_test_results,
create_fake_collab,
create_all_parameters,
create_specific_test,
create_specific_testcode,
create_specific_model,
create_specific_result,
... | code_fim | hard | {
"lang": "python",
"repo": "appukuttan-shailesh/hbp-validation-framework",
"path": "/tests_old/test_api/data_for_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: appukuttan-shailesh/hbp-validation-framework path: /tests_old/test_api/data_for_test.py
Param_BrainRegion,
Param_CellType,
Param_ModelSope,
Param_AbstractionLevel,
Param_ScoreTy... | code_fim | hard | {
"lang": "python",
"repo": "appukuttan-shailesh/hbp-validation-framework",
"path": "/tests_old/test_api/data_for_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Solution:
def detectCycle(self, head: Optional[ListNode]) -> Optional[ListNode]:
"""set based"""
curr = head
cache = set()
while curr:
cache.add(curr)
curr = curr.next
if curr in cache:
return curr
retur... | code_fim | hard | {
"lang": "python",
"repo": "fimh/dsa-py",
"path": "/array_linked_list/142.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fimh/dsa-py path: /array_linked_list/142.py
"""
Question: Linked List Cycle II
Difficulty: Medium
Link: https://leetcode.com/problems/linked-list-cycle-ii/
Ref: https://leetcode-cn.com/problems/linked-list-cycle-ii/
Given the head of a linked list, return the node where the cycle ... | code_fim | hard | {
"lang": "python",
"repo": "fimh/dsa-py",
"path": "/array_linked_list/142.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Definition for singly-linked list.
from typing import Optional
from L141 import locate_node
from L206 import construct_test_head, ListNode
class Solution:
def detectCycle(self, head: Optional[ListNode]) -> Optional[ListNode]:
"""set based"""
curr = head
cache = set()
... | code_fim | hard | {
"lang": "python",
"repo": "fimh/dsa-py",
"path": "/array_linked_list/142.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Relies on default flags within expect helper
with _expect() as c:
test(c)
def can_turn_off_or_change_defaults(self):
with _expect(flags="--capture=no", kwargs=dict(pty=False)) as c:
test(c, verbose=False, color=False, pty=False, capture="no")
def... | code_fim | hard | {
"lang": "python",
"repo": "KantiCodes/invocations",
"path": "/tests/pytest_.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with _expect(extra_flags="--whatever -man -k 'lmao' -x") as c:
test(c, k="lmao", x=True, opts="--whatever -man")
def can_disable_warnings(self):
with _expect(extra_flags="--disable-warnings") as c:
test(c, warnings=False)<|fim_prefix|># repo: KantiCodes/invocat... | code_fim | hard | {
"lang": "python",
"repo": "KantiCodes/invocations",
"path": "/tests/pytest_.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KantiCodes/invocations path: /tests/pytest_.py
from contextlib import contextmanager
from invoke import MockContext
from invocations.pytest import test
@contextmanager
def _expect(flags=None, extra_flags=None, kwargs=None):
if kwargs is None:
kwargs = dict(pty=True)
flags = fl... | code_fim | medium | {
"lang": "python",
"repo": "KantiCodes/invocations",
"path": "/tests/pytest_.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: averytorres/WazHack-Clone path: /action_handlers/inventory_index_ih.py
from game_states import GameStates
from components.equipment import EquipmentSlots
from action_handlers.weapon_inventory_index_ih import get_weapon_inventory_description
from action_handlers.armor_inventory_index_ih import get... | code_fim | hard | {
"lang": "python",
"repo": "averytorres/WazHack-Clone",
"path": "/action_handlers/inventory_index_ih.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> invent_states = []
invent_states.append(GameStates.SHOW_INVENTORY)
invent_states.append(GameStates.SHOW_WEAPON_INVENTORY)
invent_states.append(GameStates.SHOW_ARMOR_INVENTORY)
invent_states.append(GameStates.SHOW_SCROLL_INVENTORY)
invent_states.append(GameStates.SHOW_QUAFF_INVENTO... | code_fim | hard | {
"lang": "python",
"repo": "averytorres/WazHack-Clone",
"path": "/action_handlers/inventory_index_ih.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> invent_states.append(GameStates.SHOW_INVENTORY)
invent_states.append(GameStates.SHOW_WEAPON_INVENTORY)
invent_states.append(GameStates.SHOW_ARMOR_INVENTORY)
invent_states.append(GameStates.SHOW_SCROLL_INVENTORY)
invent_states.append(GameStates.SHOW_QUAFF_INVENTORY)
invent_states.ap... | code_fim | medium | {
"lang": "python",
"repo": "averytorres/WazHack-Clone",
"path": "/action_handlers/inventory_index_ih.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.