text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>hile raw_input('Hello!, to start listening press enter, to exit press q\n') != 'q':
idf.guess()<|fim_prefix|># repo: jdzejdzej/music_idf path: /app.py
from application.identifier import Identifier
if _<|fim_middle|>_name__ == '__main__':
idf = Identifier()
w | code_fim | easy | {
"lang": "python",
"repo": "jdzejdzej/music_idf",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simontu/Lung-Segmentation-Project path: /Edge Detection.py
from PIL import Image, ImageFilter
import numpy as np
import glob
from numpy import array
import matplotlib.pyplot as plt
from skimage import morphology
import scipy.ndimage
def sample_stack(stack, rows=2, cols=2, start_with=0, show_ever... | code_fim | hard | {
"lang": "python",
"repo": "simontu/Lung-Segmentation-Project",
"path": "/Edge Detection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>imgs = np.load("/Users/paulmccabe/Desktop/Segmentation Project/" + "justmask_%d.npy" % (id))
counter = 0
print("Saving as jpg Images...")
for img in imgs:
scipy.misc.imsave('/Users/paulmccabe/Desktop/Segmentation Project' + '/jpg mask images/justmask{}.jpg'.format(counter), img)
counter += 1
count... | code_fim | hard | {
"lang": "python",
"repo": "simontu/Lung-Segmentation-Project",
"path": "/Edge Detection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __sub__(self, other):
return Rational(
self.numer * other.denom - other.numer * self.denom,
self.denom * other.denom
)
def __mul__(self, other):
return Rational(
self.numer * other.numer,
self.denom * other.denom
... | code_fim | medium | {
"lang": "python",
"repo": "chiaweikokai/Python35-General",
"path": "/xmath.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chiaweikokai/Python35-General path: /xmath.py
# using python3
class Rational:
def __init__(self, numer, denom):
self.numer = numer
self.denom = denom
<|fim_suffix|> return "{numer}/{denom}".format(
numer=self.numer, denom=self.denom
)
def __r... | code_fim | hard | {
"lang": "python",
"repo": "chiaweikokai/Python35-General",
"path": "/xmath.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "Rational({numer}/{denom})".format(
numer=self.numer, denom=self.denom
)<|fim_prefix|># repo: chiaweikokai/Python35-General path: /xmath.py
# using python3
class Rational:
def __init__(self, numer, denom):
self.numer = numer
self.denom = denom
... | code_fim | hard | {
"lang": "python",
"repo": "chiaweikokai/Python35-General",
"path": "/xmath.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhaygarud/mock-pratical path: /mock_pratical_no_1.py
run=[] #Creating a empty list
no_players=int(input("enter the number of the players in the team :"))
for i in range (no_players):
run_score=int(input("Enter the runs scored by the player "+str(i+1)+":"))
run.append(run_score)
#c... | code_fim | hard | {
"lang": "python",
"repo": "abhaygarud/mock-pratical",
"path": "/mock_pratical_no_1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("___________________________________")
max=0
result=run[0]
for i in run:
freq=run.count(i)
if freq>max:
max=freq
result=i
print(f"run scored with the highest frequncy {result} is",max)
print("-------------'THANKYO... | code_fim | hard | {
"lang": "python",
"repo": "abhaygarud/mock-pratical",
"path": "/mock_pratical_no_1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Afwas1337627/donations path: /setup.py
import sqlite3
if __name__ == '__main__':
conn = sqlite3.connect('donations.sqlite')
c = conn.cursor()
<|fim_suffix|> query = """CREATE TABLE members(
id INTEGER PRIMARY KEY,
member INTEGER UNIQUE,
member_name TEXT,
... | code_fim | hard | {
"lang": "python",
"repo": "Afwas1337627/donations",
"path": "/setup.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> query = """CREATE TABLE members(
id INTEGER PRIMARY KEY,
member INTEGER UNIQUE,
member_name TEXT,
faction INTEGER,
FOREIGN KEY(faction) REFERENCES factions(faction));"""
c.execute(query)
conn.commit()
query = """CREATE TABLE bank(
id INTEGER... | code_fim | hard | {
"lang": "python",
"repo": "Afwas1337627/donations",
"path": "/setup.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> c.execute(query)
conn.commit()
query = """CREATE TABLE members(
id INTEGER PRIMARY KEY,
member INTEGER UNIQUE,
member_name TEXT,
faction INTEGER,
FOREIGN KEY(faction) REFERENCES factions(faction));"""
c.execute(query)
conn.commit()
query = ... | code_fim | medium | {
"lang": "python",
"repo": "Afwas1337627/donations",
"path": "/setup.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IMFanchao/IE_TEAM_PROJECT path: /TeamProject/src/VICHealth_app/views.py
from django.shortcuts import render, render_to_response, get_object_or_404, redirect
from .models import Club
from .forms import InputForm
# Create your views here.
def base(request):
<|fim_suffix|> return render(request,... | code_fim | medium | {
"lang": "python",
"repo": "IMFanchao/IE_TEAM_PROJECT",
"path": "/TeamProject/src/VICHealth_app/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render(request, 'VICHealth_app/health_tips.html')
def sub_info(request):
club=Club.objects.all()
form=InputForm()
context = { "club":club, "form":form }
return render(request, 'VICHealth_app/sub_info.html', context)<|fim_prefix|># repo: IMFanchao/IE_TEAM_PROJECT path: /TeamP... | code_fim | medium | {
"lang": "python",
"repo": "IMFanchao/IE_TEAM_PROJECT",
"path": "/TeamProject/src/VICHealth_app/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> club=Club.objects.all()
form=InputForm()
context = { "club":club, "form":form }
return render(request, 'VICHealth_app/sub_info.html', context)<|fim_prefix|># repo: IMFanchao/IE_TEAM_PROJECT path: /TeamProject/src/VICHealth_app/views.py
from django.shortcuts import render, render_to_resp... | code_fim | hard | {
"lang": "python",
"repo": "IMFanchao/IE_TEAM_PROJECT",
"path": "/TeamProject/src/VICHealth_app/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> b = np.ascontiguousarray(b, dtype=np.float64)
r = np.ascontiguousarray(r, dtype=np.float64)
s = np.empty(r.shape + (3,), dtype=np.float64)
driver.quad_solution_vector(b, r, s)
return s
def contact_points(a, e, cosw, sinw, cosi, sini, L):
a = np.ascontiguousarray(a, dtype=np.float... | code_fim | medium | {
"lang": "python",
"repo": "ethankruse/exoplanet-core",
"path": "/src/exoplanet_core/numpy/ops.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ethankruse/exoplanet-core path: /src/exoplanet_core/numpy/ops.py
# -*- coding: utf-8 -*-
__all__ = ["kepler", "quad_solution_vector", "contact_points"]
import numpy as np
from .. import driver
def kepler(mean_anomaly, eccentricity):
mean_anomaly = np.ascontiguousarray(mean_anomaly, dtyp... | code_fim | medium | {
"lang": "python",
"repo": "ethankruse/exoplanet-core",
"path": "/src/exoplanet_core/numpy/ops.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Regression testing challenge116 """
expect(main(input)).to.eq(expected)<|fim_prefix|># repo: mattjhussey/pemjh path: /tests/challenge116/test_challenge116.py
""" Tests for challenge116 """
import pytest
from robber import expect
from pemjh.challenge116 import main
<|fim_middle|>
@pyte... | code_fim | hard | {
"lang": "python",
"repo": "mattjhussey/pemjh",
"path": "/tests/challenge116/test_challenge116.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattjhussey/pemjh path: /tests/challenge116/test_challenge116.py
""" Tests for challenge116 """
import pytest
from robber import expect
from pemjh.challenge116 import main
<|fim_suffix|> """ Regression testing challenge116 """
expect(main(input)).to.eq(expected)<|fim_middle|>@pyte... | code_fim | hard | {
"lang": "python",
"repo": "mattjhussey/pemjh",
"path": "/tests/challenge116/test_challenge116.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlhackergz/torch-quiver path: /srcs/python/quiver/dist_node_cuda_sampler.py
import copy
from typing import List, Optional, Tuple, NamedTuple, Union, Callable
import torch
from torch import Tensor
from torch_sparse import SparseTensor
import time
import torch_quiver as qv
from torch.distributed i... | code_fim | hard | {
"lang": "python",
"repo": "mlhackergz/torch-quiver",
"path": "/srcs/python/quiver/dist_node_cuda_sampler.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __len__(self):
return self.num_parts
class distributeCudaRandomNodeSampler(torch.utils.data.DataLoader):
r"""A data loader that randomly samples nodes within a graph and returns
their induced subgraph.
.. note::
For an example of using :obj:`RandomNodeSampler`, see
... | code_fim | hard | {
"lang": "python",
"repo": "mlhackergz/torch-quiver",
"path": "/srcs/python/quiver/dist_node_cuda_sampler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-alexander-acosta/AAGESuite-Antiguo path: /carga_horaria/views.py
io hayan sido validados correctamente."
def form_valid(self, form):
colegio = form.save(commit=False)
colegio.periode = self.request.session.get('periodo', 2020)
colegio.save()
return redirect(... | code_fim | hard | {
"lang": "python",
"repo": "j-alexander-acosta/AAGESuite-Antiguo",
"path": "/carga_horaria/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@login_required
def asignatura_maybe(request, pk):
pp = get_object_or_404(Periodo, pk=pk)
candidatas = Asignatura.objects.filter(periodos__colegio=pp.colegio, combinable=True).exclude(periodos__pk__in=[pk]).distinct()
if candidatas:
return render(request, 'carga_horaria/asignatura/asig... | code_fim | hard | {
"lang": "python",
"repo": "j-alexander-acosta/AAGESuite-Antiguo",
"path": "/carga_horaria/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@login_required
def profesores_info(request):
output = io.BytesIO()
# Create a workbook and add a worksheet.
workbook = xlsxwriter.Workbook(output)
worksheet = workbook.add_worksheet('Profesores')
# Some data we want to write to the worksheet.
qs = get_for_user(request, Profe... | code_fim | hard | {
"lang": "python",
"repo": "j-alexander-acosta/AAGESuite-Antiguo",
"path": "/carga_horaria/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> root_path = request.app['PATH-DB']
cpt = 0
d = dict()
dirs_data = dict()
for root, dirs, files in os.walk(root_path, topdown=False):
cpt += len(files)
size = sum(getsize(join(root, name)) for name in files)
subdir_size = sum(dirs_data[join(root,d)] for d in dirs... | code_fim | medium | {
"lang": "python",
"repo": "hgn/hippo2d",
"path": "/utils/page_disk_info.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> page = request.app['BLOB-HEADER']
page += stats_count_info(request)
page += request.app['BLOB-FOOTER']
return web.Response(body=page, content_type='text/html')
def handle(request):
return generate_disk_info_page(request)<|fim_prefix|># repo: hgn/hippo2d path: /utils/page_disk_info.p... | code_fim | hard | {
"lang": "python",
"repo": "hgn/hippo2d",
"path": "/utils/page_disk_info.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hgn/hippo2d path: /utils/page_disk_info.py
import os
import time
import re
import json
from os.path import join, getsize
from aiohttp import web
from utils import helper
TBL_HEAD = '''
<table class="table table-striped table-hover table-sm">
<thead>
<tr>
<th scope="col">Directory</... | code_fim | medium | {
"lang": "python",
"repo": "hgn/hippo2d",
"path": "/utils/page_disk_info.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>arture: {**valmap(xml.textgetter, {
'ride_number': 'RitNummer',
'time': 'VertrekTijd',
'destination': 'EindBestemming',
'train_type': 'TreinSoort',
'carrier': 'Vervoerder',
'platform': 'VertrekSpoor',
}), **{
... | code_fim | hard | {
"lang": "python",
"repo": "ariebovenberg/snug",
"path": "/examples/ns/load.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ariebovenberg/snug path: /examples/ns/load.py
"""deserialization tools"""
import typing as t
from datetime import datetime
from functools import partial
from toolz import compose, flip, valmap
from valuable import load, xml
from . import types
registry = load.PrimitiveRegistry({
bool: ... | code_fim | hard | {
"lang": "python",
"repo": "ariebovenberg/snug",
"path": "/examples/ns/load.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # The following line creates an instance of the HaralickTextureExtraction application
HaralickTextureExtraction = otbApplication.Registry.CreateApplication("HaralickTextureExtraction")
# The following lines set all the application parameters:
HaralickTextureExtraction.SetParameterString("in", image... | code_fim | medium | {
"lang": "python",
"repo": "C-Cazals/DEV",
"path": "/PYTHON/SVM/HaralickExtraction.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: C-Cazals/DEV path: /PYTHON/SVM/HaralickExtraction.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Import the otb applications package
import otbApplication
<|fim_suffix|>
# The following line creates an instance of the HaralickTextureExtraction application
HaralickTextureExtraction = otbA... | code_fim | medium | {
"lang": "python",
"repo": "C-Cazals/DEV",
"path": "/PYTHON/SVM/HaralickExtraction.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# The following line creates an instance of the HaralickTextureExtraction application
HaralickTextureExtraction = otbApplication.Registry.CreateApplication("HaralickTextureExtraction")
# The following lines set all the application parameters:
HaralickTextureExtraction.SetParameterString("in", imag... | code_fim | medium | {
"lang": "python",
"repo": "C-Cazals/DEV",
"path": "/PYTHON/SVM/HaralickExtraction.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rozavetrov/posocad path: /core/gObjects.py
from typing import Tuple, List
import math
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
self.constraints = []
def __str__(self):
return f"({self.x}, {self.y})"
<|fim_suffix|>p1 = Point(0, 0)
p2... | code_fim | hard | {
"lang": "python",
"repo": "rozavetrov/posocad",
"path": "/core/gObjects.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Parallelism(Constraints):
def __init__(self, line1, line2):
super().__init__()
self.line1 = line1
self.line2 = line2
def get_const(self):
dx = self.line2.length() / math.sqrt(1 + self.line1.tang()**2)
dy = self.line1.tang() * dx
self.line2.p2... | code_fim | hard | {
"lang": "python",
"repo": "rozavetrov/posocad",
"path": "/core/gObjects.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manibhushan05/tms path: /web/transiq/enquiry/urls.py
from . import views
from django.conf.urls import url,re_path
enquiryUrlPattern = [
url(r'daily-rate-enquir<|fim_suffix|>ct-us-landing-page/$', views.contact_us_landing_page),
]<|fim_middle|>y', views.daily_rate_enquiry_form),
re_path(r... | code_fim | easy | {
"lang": "python",
"repo": "manibhushan05/tms",
"path": "/web/transiq/enquiry/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ct-us-landing-page/$', views.contact_us_landing_page),
]<|fim_prefix|># repo: manibhushan05/tms path: /web/transiq/enquiry/urls.py
from . import views
from django.conf.urls import url,re<|fim_middle|>_path
enquiryUrlPattern = [
url(r'daily-rate-enquiry', views.daily_rate_enquiry_form),
re_path(r... | code_fim | medium | {
"lang": "python",
"repo": "manibhushan05/tms",
"path": "/web/transiq/enquiry/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>oductSearch"),
path('detail/', views.detail, name="detail"),
]<|fim_prefix|># repo: oxo1996/TroubleSearch path: /skincare/urls.py
from django.contrib import admin
from django.urls import path
from . import views
urlpatterns = [
path('', views.skincare, name<|fim_middle|>="skin"),
path('produ... | code_fim | medium | {
"lang": "python",
"repo": "oxo1996/TroubleSearch",
"path": "/skincare/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oxo1996/TroubleSearch path: /skincare/urls.py
from django.contrib import admin
from django.urls import path
from<|fim_suffix|>oductSearch"),
path('detail/', views.detail, name="detail"),
]<|fim_middle|> . import views
urlpatterns = [
path('', views.skincare, name="skin"),
path('produ... | code_fim | medium | {
"lang": "python",
"repo": "oxo1996/TroubleSearch",
"path": "/skincare/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bazitur/my-euler-solutions path: /problem_7.py
#/usr/bin/env python3
def nth_prime(n):
<|fim_suffix|>if __name__ == "__main__":
n = int(input("Which one? "))
print(nth_prime(n))<|fim_middle|> ans = 2
known = []
for _ in range(n):
while not all(ans%x != 0 for x in known... | code_fim | medium | {
"lang": "python",
"repo": "bazitur/my-euler-solutions",
"path": "/problem_7.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
n = int(input("Which one? "))
print(nth_prime(n))<|fim_prefix|># repo: bazitur/my-euler-solutions path: /problem_7.py
#/usr/bin/env python3
def nth_prime(n):
<|fim_middle|> ans = 2
known = []
for _ in range(n):
while not all(ans%x != 0 for x in known... | code_fim | medium | {
"lang": "python",
"repo": "bazitur/my-euler-solutions",
"path": "/problem_7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> batch_size = len(pointclouds)
fig = plt.figure(figsize=(8, batch_size / 2))
ncols = 5
nrows = max(1, batch_size // 5)
for idx, pc in enumerate(pointclouds):
label = categories[int(labels[idx].item())]
pred = categories[int(pred_labels[idx])]
colour = 'g' if lab... | code_fim | medium | {
"lang": "python",
"repo": "enginBozkurt/Data-Augmentation-combined-with-Adversarial-Examples-for-Robust-Point-Cloud-Classification",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enginBozkurt/Data-Augmentation-combined-with-Adversarial-Examples-for-Robust-Point-Cloud-Classification path: /main.py
import torch
from training import PointNetTrain, PointAugmentTrain, Model
#from PointAugment.Augment.config import opts
from data_utils.dataloader import DataLoaderClass
from mpl... | code_fim | hard | {
"lang": "python",
"repo": "enginBozkurt/Data-Augmentation-combined-with-Adversarial-Examples-for-Robust-Point-Cloud-Classification",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
with open("config.yaml", "r") as yamlfile:
config = yaml.load(yamlfile, Loader=yaml.FullLoader)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# PointNet
training_instance_2 = PointNetTrain(config['MODEL']['POINTNET'], device)
... | code_fim | medium | {
"lang": "python",
"repo": "enginBozkurt/Data-Augmentation-combined-with-Adversarial-Examples-for-Robust-Point-Cloud-Classification",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Milkve/mgeconvert path: /mgeconvert/converters/mge_to_caffe.py
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the... | code_fim | hard | {
"lang": "python",
"repo": "Milkve/mgeconvert",
"path": "/mgeconvert/converters/mge_to_caffe.py",
"mode": "psm",
"license": "LicenseRef-scancode-generic-cla",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert isinstance(prototxt, str) and isinstance(
caffemodel, str
), "'prototxt' and 'caffemodel' must be string"
converter.dump(prototxt, caffemodel)<|fim_prefix|># repo: Milkve/mgeconvert path: /mgeconvert/converters/mge_to_caffe.py
# MegEngine is Licensed under the Apache License, V... | code_fim | hard | {
"lang": "python",
"repo": "Milkve/mgeconvert",
"path": "/mgeconvert/converters/mge_to_caffe.py",
"mode": "spm",
"license": "LicenseRef-scancode-generic-cla",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: urudaro/data-ue path: /Ranitidin_Actavis_film-coated_tablet_SmPC.py
<<<<<<< HEAD
{'_data': [['Common', [['Skin', u'Ospecifika hud-reakti oner'], ['General', u'Tr\xf6tthet']]],
['Uncommon',
[['GI',
u'Buksm\xe4rta, diarr\xe9, f\xf6r-stoppnin g, illam\xe5ende (de... | code_fim | hard | {
"lang": "python",
"repo": "urudaro/data-ue",
"path": "/Ranitidin_Actavis_film-coated_tablet_SmPC.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>],
=======
['Eye', u'Dimsyn (reversibel), troligen orsakade av ackommodations-st\xf6rningar'],
['Cardiac', u'Som med andra H2-receptor-antagonister: bradykardi och AV-block'],
>>>>>>> eb0dbf7cfbd3e1c8a568eedcf6ca5658233104cc
['Vascular', u'Vaskulit'],
['... | code_fim | hard | {
"lang": "python",
"repo": "urudaro/data-ue",
"path": "/Ranitidin_Actavis_film-coated_tablet_SmPC.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmcda001/AdventOfCode2019 path: /day7_AmplificationCircuit/amplifier.py
import sys
sys.path.append('../')
from IntcodeComputer.intcode import Program
<|fim_suffix|> with open(fn) as f:
program = Program([int(i) for i in f.readline().split(',')])
program.run()
result = ... | code_fim | easy | {
"lang": "python",
"repo": "jmcda001/AdventOfCode2019",
"path": "/day7_AmplificationCircuit/amplifier.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(fn) as f:
program = Program([int(i) for i in f.readline().split(',')])
program.run()
result = program.instructions<|fim_prefix|># repo: jmcda001/AdventOfCode2019 path: /day7_AmplificationCircuit/amplifier.py
import sys
sys.path.append('../')
from IntcodeComputer.intc... | code_fim | easy | {
"lang": "python",
"repo": "jmcda001/AdventOfCode2019",
"path": "/day7_AmplificationCircuit/amplifier.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return dict(
observations=tensor_utils.stack_tensor_list(observations),
actions=tensor_utils.stack_tensor_list(actions),
rewards=tensor_utils.stack_tensor_list(rewards),
agent_infos=tensor_utils.stack_tensor_dict_list(agent_infos),
env_infos=tensor_utils.stack_t... | code_fim | hard | {
"lang": "python",
"repo": "lchenat/gym_bullet",
"path": "/hierarchical_envs/go.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lchenat/gym_bullet path: /hierarchical_envs/go.py
from hierarchical_envs.pb_envs.gym_locomotion_envs import InsectBulletEnv
import argparse
import joblib
import tensorflow as tf
from rllab.misc.console import query_yes_no
# from rllab.sampler.utils import rollout
#from pybullet_my_envs.gym_loco... | code_fim | hard | {
"lang": "python",
"repo": "lchenat/gym_bullet",
"path": "/hierarchical_envs/go.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('low_level', type=str,
help='path to lower_level policy')
parser.add_argument('--max_path_length', type=int, default=500,
help='Max length of rollout')
parser... | code_fim | hard | {
"lang": "python",
"repo": "lchenat/gym_bullet",
"path": "/hierarchical_envs/go.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alvarantson/HAPE path: /shop/models.py
from django.db import models
import string
import random
def id_generator(size=32, chars=string.ascii_uppercase + string.digits):
exists = True
while exists == True:
ran = ''.join(random.choice(chars) for _ in range(size))
if len(Item.objects.filter(r... | code_fim | hard | {
"lang": "python",
"repo": "alvarantson/HAPE",
"path": "/shop/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.discount_percentage == 0:
return self.name + " - " + str(self.price) + "€"
else:
return self.name + " - " + str( self.price*((100-self.discount_percentage)/100) ) + "€ - DISCOUNT " + str(self.discount_percentage) + "%"<|fim_prefix|># repo: alvarantson/HAPE path: /shop/models.py
from dja... | code_fim | medium | {
"lang": "python",
"repo": "alvarantson/HAPE",
"path": "/shop/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
if self.discount_percentage == 0:
return self.name + " - " + str(self.price) + "€"
else:
return self.name + " - " + str( self.price*((100-self.discount_percentage)/100) ) + "€ - DISCOUNT " + str(self.discount_percentage) + "%"<|fim_prefix|># repo: alvarantson/HAPE path: /sho... | code_fim | hard | {
"lang": "python",
"repo": "alvarantson/HAPE",
"path": "/shop/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@torch.no_grad()
def evaluate(*, model: torch.nn.Module, dataset, logger: Logger, step: int, epoch: int, device, hparams):
loader = DataLoader(dataset=dataset, batch_size=256, shuffle=False, drop_last=False)
model.eval()
losses = []
for i, (x, _) in enumerate(loader):
x = x.to(dev... | code_fim | hard | {
"lang": "python",
"repo": "395t/coding-assignment-week-4-opt-2",
"path": "/src/vae/lib/trainer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 395t/coding-assignment-week-4-opt-2 path: /src/vae/lib/trainer.py
import os
import time
import torch
from torch.utils.data import DataLoader
from torchvision.datasets import SVHN
from torchvision.transforms import ToTensor
from lib.utils import Logger, normal_logpdf, sumflat, print_model_info, t... | code_fim | hard | {
"lang": "python",
"repo": "395t/coding-assignment-week-4-opt-2",
"path": "/src/vae/lib/trainer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if i == 0 and (epoch % hparams.sample_freq == 0 or epoch == hparams.epochs):
n = 6
samples = model.decoder(torch.randn(n**2, hparams.z_dim, device=device))
logger.log_image_grid('reconstructions', tanh_to_uint8(x_hat[:n**2]), step, nrow=n)
logger.log... | code_fim | hard | {
"lang": "python",
"repo": "395t/coding-assignment-week-4-opt-2",
"path": "/src/vae/lib/trainer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # parse xml
try:
xml_schema_doc = etree.parse("./open-mensa-v2.xsd")
xml_schema = etree.XMLSchema(xml_schema_doc)
# doc = etree.parse(xml_data.encode())
print('XML well formed, syntax ok.')
etree.fromstring(xml_data.encode(), parser=etree.XMLParser(schema=xm... | code_fim | hard | {
"lang": "python",
"repo": "BananaNosh/OpenMensaParserOsnabrueck",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BananaNosh/OpenMensaParserOsnabrueck path: /main.py
# Copyright 2018 Google LLC
#
# 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/licenses/L... | code_fim | hard | {
"lang": "python",
"repo": "BananaNosh/OpenMensaParserOsnabrueck",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Luotianxiao/crypto-crawler path: /crypto_crawler/app.py
from flask import Flask
from threading import Timer
from crypto_crawler.const import BITCOIN_CRAWLING_PERIOD_SEC, COIN_MARKET_CAP_URL
from crypto_crawler.crawler import get_web_content, filter_invalid_records
<|fim_suffix|>
@app.route("/")... | code_fim | hard | {
"lang": "python",
"repo": "Luotianxiao/crypto-crawler",
"path": "/crypto_crawler/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/pause")
def pause():
global crawl_enabled
crawl_enabled = False
return "PAUSED!"
@app.route("/status")
def status():
return "100%"
@app.route("/")
def default():
return "SAMPLE TRADING SYSTEM"
if __name__ == "__main__":
crawl_bitcoin_price()
app.run()<|fim_pr... | code_fim | medium | {
"lang": "python",
"repo": "Luotianxiao/crypto-crawler",
"path": "/crypto_crawler/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route("/")
def default():
return "SAMPLE TRADING SYSTEM"
if __name__ == "__main__":
crawl_bitcoin_price()
app.run()<|fim_prefix|># repo: Luotianxiao/crypto-crawler path: /crypto_crawler/app.py
from flask import Flask
from threading import Timer
from crypto_crawler.const import BITCOI... | code_fim | medium | {
"lang": "python",
"repo": "Luotianxiao/crypto-crawler",
"path": "/crypto_crawler/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/contrib/others/movielens_sequence_ID2897_for_PyTorch/spotlight/sampling.py
# Copyright 2018 The Cornac Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | code_fim | medium | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/contrib/others/movielens_sequence_ID2897_for_PyTorch/spotlight/sampling.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns
-------
items: np.array of shape [shape]
Sampled item ids.
"""
if random_state is None:
random_state = np.random.RandomState()
items = random_state.randint(0, num_items, shape, dtype=np.int64)
return items<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch... | code_fim | hard | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/contrib/others/movielens_sequence_ID2897_for_PyTorch/spotlight/sampling.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wojons/pyForp path: /test.py
import pyForp
import pprint
pp = pprint.PrettyPrinter(indent=4)
def fib(n):
<|fim_suffix|>forp = pyForp.pyForp()
forp.start()
print fib(2)
forp.stop()
pp.pprint(forp.dump())<|fim_middle|> if n < 2:
return n
return fib(n-2) + fib(n-1)
| code_fim | medium | {
"lang": "python",
"repo": "wojons/pyForp",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>forp = pyForp.pyForp()
forp.start()
print fib(2)
forp.stop()
pp.pprint(forp.dump())<|fim_prefix|># repo: wojons/pyForp path: /test.py
import pyForp
import pprint
pp = pprint.PrettyPrinter(indent=4)
def fib(n):
<|fim_middle|> if n < 2:
return n
return fib(n-2) + fib(n-1)
| code_fim | medium | {
"lang": "python",
"repo": "wojons/pyForp",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/Nortel-MsCarrier-MscPassport-AtmEbrMIB.py
Texts: mscAtmIfVccEbrInfoTotalConnectionRecoveries.setStatus('mandatory')
mscAtmIfVccEbrInfoTotalPathOptimizations = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 12, 40, 1, 2), Counter32()).setMaxAc... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/Nortel-MsCarrier-MscPassport-AtmEbrMIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>tel-MsCarrier-MscPassport-AtmEbrMIB", "mscAtmIfVccEbrInfoIndex"))
if mibBuilder.loadTexts: mscAtmIfVccEbrInfoOperEntry.setStatus('mandatory')
mscAtmIfVccEbrInfoRecoverySubscribed = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 12, 30, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(Sing... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/Nortel-MsCarrier-MscPassport-AtmEbrMIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/Nortel-MsCarrier-MscPassport-AtmEbrMIB.py
atus('mandatory')
mscAtmIfVptPnniEbrConnectionRecovery = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 7, 7, 20, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1).... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/Nortel-MsCarrier-MscPassport-AtmEbrMIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PemLer/Journey_of_Algorithm path: /leetcode/201-300/T227_calculate.py
class Solution:
def calculate(self, s: str) -> int:
nums = []
ops = []
def cal():
a = nums.pop()
b = nums.pop()
c = ops.pop()
if c == '+':
... | code_fim | hard | {
"lang": "python",
"repo": "PemLer/Journey_of_Algorithm",
"path": "/leetcode/201-300/T227_calculate.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while i < len(s) and s[i].isdigit():
t += s[i]
i += 1
nums.append(int(t))
elif not ops:
ops.append(s[i])
i += 1
elif s[i] == '+' or s[i] == '-':
while ops:
... | code_fim | hard | {
"lang": "python",
"repo": "PemLer/Journey_of_Algorithm",
"path": "/leetcode/201-300/T227_calculate.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def pi_series():
odd_nums = odds()
approximation = 0
while True:
approximation += (4 / next(odd_nums))
yield approximation
approximation -= (4 / next(odd_nums))
yield approximation
approx_pi = pi_series()
# The high... | code_fim | medium | {
"lang": "python",
"repo": "Scottie-Richardson/python-masterclass",
"path": "/Generators/pi_generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Scottie-Richardson/python-masterclass path: /Generators/pi_generator.py
# Generates an infinite series of odd numbers
def odds():
n = 1
while True:
yield n
n += 2
<|fim_suffix|># The higher the range used here the closer to an acurate approximation of PI.
for x in range(... | code_fim | hard | {
"lang": "python",
"repo": "Scottie-Richardson/python-masterclass",
"path": "/Generators/pi_generator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Creating Model and begin classification
#=======================================
classif = svm.SVC(class_weight=CLASS_WEIGHT)
clf = grid_search.GridSearchCV(classif, parameters, scoring=scoring, cv=5, n_jobs=jobs,verbose=3,refit=testAvailable)
print("Begin\n...")
clf.fit(X,y)
... | code_fim | hard | {
"lang": "python",
"repo": "Mathieu-Seurin/dat-eeg",
"path": "/code/learnData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mathieu-Seurin/dat-eeg path: /code/learnData.py
[1], np.std(model[2]))
elif modelType=='Ridge':
for model in results:
print(model)
strScores += "{:.4} {} {}\n".format(model[0]['alpha'], model[1], np.std(model[2]))
else: #Linear, C is the ... | code_fim | hard | {
"lang": "python",
"repo": "Mathieu-Seurin/dat-eeg",
"path": "/code/learnData.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print strSave
return strSave
def testModel(best,X,y,xTest,yTest,penalty):
print("Predicting Data :")
yPredTrain = best.predict(X)
yPredTest = best.predict(xTest)
scores = getScores(y, yPredTrain, yTest, yPredTest)
printScores(scores)
if penalty=='l1':
s... | code_fim | hard | {
"lang": "python",
"repo": "Mathieu-Seurin/dat-eeg",
"path": "/code/learnData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_discovery_fallback_ok(session_app_data, caplog):
caplog.set_level(logging.DEBUG)
builtin = Builtin(
Namespace(app_data=session_app_data, try_first_with=[], python=["magic-one", sys.executable], env=os.environ),
)
result = builtin.run()
assert result is not None, caplo... | code_fim | hard | {
"lang": "python",
"repo": "pypa/virtualenv",
"path": "/tests/unit/discovery/test_discovery.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pypa/virtualenv path: /tests/unit/discovery/test_discovery.py
from __future__ import annotations
import logging
import os
import sys
from argparse import Namespace
from pathlib import Path
from uuid import uuid4
import pytest
from virtualenv.discovery.builtin import Builtin, get_interpreter
fr... | code_fim | hard | {
"lang": "python",
"repo": "pypa/virtualenv",
"path": "/tests/unit/discovery/test_discovery.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NorthcoteHS/10MCOD-Thomas-MCSHANE path: /user/MEOW.py
import webbrowser
import time
x=10
while x > 0:
print (x), time.sleep(1)
x=x-1
while<|fim_suffix|>"https://www.youtube.com/watch?v=IuysY1BekOE")<|fim_middle|> x==0:
print ("MEOW")
webbrowser.open( | code_fim | easy | {
"lang": "python",
"repo": "NorthcoteHS/10MCOD-Thomas-MCSHANE",
"path": "/user/MEOW.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>"https://www.youtube.com/watch?v=IuysY1BekOE")<|fim_prefix|># repo: NorthcoteHS/10MCOD-Thomas-MCSHANE path: /user/MEOW.py
import webbrowser
import time
x=10
while x > 0:
print (x), time.sleep(1)
x=x-1
while<|fim_middle|> x==0:
print ("MEOW")
webbrowser.open( | code_fim | easy | {
"lang": "python",
"repo": "NorthcoteHS/10MCOD-Thomas-MCSHANE",
"path": "/user/MEOW.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emreorta/DeepSpell path: /keras_spell.py
# encoding: utf-8
'''
Created on Nov 26, 2015
@author: tal
Based in part on:
Learn math - https://github.com/fchollet/keras/blob/master/examples/addition_rnn.py
See https://medium.com/@majortal/deep-spelling-9ffef96a24f6#.2c9pu8nlm
"""
Modified by Pave... | code_fim | hard | {
"lang": "python",
"repo": "emreorta/DeepSpell",
"path": "/keras_spell.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.exists(MODEL_CHECKPOINT_DIRECTORYNAME):
os.makedirs(MODEL_CHECKPOINT_DIRECTORYNAME)
if dataset_params_filename is not None:
with open(dataset_params_filename, 'rb') as f:
dataset_params = pickle.load(f)
assert dataset_params['chars'] == dataset.... | code_fim | hard | {
"lang": "python",
"repo": "emreorta/DeepSpell",
"path": "/keras_spell.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wisvem/holbertonschool-higher_level_programming path: /0x09-python-everything_is_object/101-locked_class.py
#!/usr/bin/python3
"""Locked class module"""
<|fim_suffix|> """test class with locked dynamic attruibute creation
"""
__slots__ = 'first_name'<|fim_middle|>
class LockedClass:
| code_fim | easy | {
"lang": "python",
"repo": "wisvem/holbertonschool-higher_level_programming",
"path": "/0x09-python-everything_is_object/101-locked_class.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """test class with locked dynamic attruibute creation
"""
__slots__ = 'first_name'<|fim_prefix|># repo: wisvem/holbertonschool-higher_level_programming path: /0x09-python-everything_is_object/101-locked_class.py
#!/usr/bin/python3
"""Locked class module"""
<|fim_middle|>
class LockedClass:
| code_fim | easy | {
"lang": "python",
"repo": "wisvem/holbertonschool-higher_level_programming",
"path": "/0x09-python-everything_is_object/101-locked_class.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sankket/Cryptocurrency-Data-Analyzer path: /Data_Analyzer.py
if float(data[x]['quoteVolume'])>100:
all_positions.append(x)
for x in all_positions:
c.append(float(data[x]['priceChangePercent']))
i = sorted(range(len(c)), key=lambda k: c[k])
i.reverse()
... | code_fim | hard | {
"lang": "python",
"repo": "sankket/Cryptocurrency-Data-Analyzer",
"path": "/Data_Analyzer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 3 hour change parameter score calculation
a = float(price_chance_3_hour[x])
if a <= 5 and a > -1:
score += 0.25
elif a <= -1 and a > -3:
score += 0.5
elif a <= -3 and a > -6:
score += 0.75
... | code_fim | hard | {
"lang": "python",
"repo": "sankket/Cryptocurrency-Data-Analyzer",
"path": "/Data_Analyzer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 1 hour change parameter score calculation
a = float(price_chance_1_hour[x])
if a <= 2 and a >= 0:
score += 0.5
elif a <= 0 and a > -2:
score += 0.75
elif a <= -2:
score += 1
# 3 hour ... | code_fim | hard | {
"lang": "python",
"repo": "sankket/Cryptocurrency-Data-Analyzer",
"path": "/Data_Analyzer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: christopheryin/plankton path: /training and predicting/train_squeezenet.py
#adapted from https://github.com/DeepLearningSandbox/DeepLearningSandbox/tree/master/transfer_learning
import os
import sys
import glob
import argparse
import matplotlib.pyplot as plt
from keras.applications.imagenet_uti... | code_fim | hard | {
"lang": "python",
"repo": "christopheryin/plankton",
"path": "/training and predicting/train_squeezenet.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def plot_training(history):
acc = history.history['acc']
val_acc = history.history['val_acc']
loss = history.history['loss']
val_loss = history.history['val_loss']
epochs = range(len(acc))
plt.plot(epochs, acc, 'r.')
plt.plot(epochs, val_acc, 'r')
plt.title('Training and v... | code_fim | hard | {
"lang": "python",
"repo": "christopheryin/plankton",
"path": "/training and predicting/train_squeezenet.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dealer = players[-1];
for player in players :
dealer.retrieve_cards(player);
player.bet = 0;
def display_accounts(players) :
for player in players[:-1] :
change = player.money - player.initial_money;
word = 'gain';
if change < 0 :
... | code_fim | hard | {
"lang": "python",
"repo": "arjunkeerthi/BlackJack",
"path": "/BlackJack/blackjack.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arjunkeerthi/BlackJack path: /BlackJack/blackjack.py
from card import Card;
from deck import Deck;
import people;
import chip;
import sys;
import time;
def display_instructions() :
print('\nInstructions: The objective of this game is to obtain a hand of cards whose value is as close ... | code_fim | hard | {
"lang": "python",
"repo": "arjunkeerthi/BlackJack",
"path": "/BlackJack/blackjack.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f'{player.name} stands.\n');
return True;
def hit(player, dealer, hand_index=0) :
dealer.deal_card(player, hand_index);
done = check_status(player, hand_index);
if isinstance(player, people.Dealer) :
while not player.check_hard_17() and not done:
... | code_fim | hard | {
"lang": "python",
"repo": "arjunkeerthi/BlackJack",
"path": "/BlackJack/blackjack.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for item in ARMY:
try:
count = int(data.get(item, [''])[0])
except:
count = 0
try:
prior = int(data.get("%s_priority" % item, [''])[0])
ex... | code_fim | hard | {
"lang": "python",
"repo": "bogoslov/RJ_Bots",
"path": "/apps/crisis/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bogoslov/RJ_Bots path: /apps/crisis/views.py
# Create your views here.
# -*- coding: utf-8 -*-
from json import dumps
from django.shortcuts import render_to_response
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.conf im... | code_fim | hard | {
"lang": "python",
"repo": "bogoslov/RJ_Bots",
"path": "/apps/crisis/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> params = self.utils.get_daily_params(uid)
context = {"username": self.utils.get_user_name(uid),
"is_auth": is_auth,
"is_daily": is_daily,
"is_leader": request.session.get("is_leader", False),
"mercs": ["off"] + MER... | code_fim | hard | {
"lang": "python",
"repo": "bogoslov/RJ_Bots",
"path": "/apps/crisis/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EinfachTuen/simplest-MLP-for-Mel-to-STFT path: /experimentData.py
import librosa
import librosa.display
import matplotlib.pyplot as plt
import os
import numpy as np
import time
import multiprocessing as mp
from tempfile import TemporaryFile
class DataSet():
def __init__(self,training_folder)... | code_fim | hard | {
"lang": "python",
"repo": "EinfachTuen/simplest-MLP-for-Mel-to-STFT",
"path": "/experimentData.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> process = mp.Process(target=self.readFiles, args=(queue,file_list,start_read,end_read))
processes.append(process)
for process in processes:
print("start process")
process.start()
returns = []
for process in processes:
ret... | code_fim | hard | {
"lang": "python",
"repo": "EinfachTuen/simplest-MLP-for-Mel-to-STFT",
"path": "/experimentData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>6e29e232daf462652f66ee8acc11838b'))
print(rsp.text)<|fim_prefix|># repo: magicEmperor/Crawler-collection path: /WeChat/acces_TK.py
import requests
rsp = requests.get('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_cred<|fim_middle|>ential&appid=%s&secret=%s'%('wx27c0e6ef6a7f0716',' | code_fim | easy | {
"lang": "python",
"repo": "magicEmperor/Crawler-collection",
"path": "/WeChat/acces_TK.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: magicEmperor/Crawler-collection path: /WeChat/acces_TK.py
import requests
rsp = requests.get('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_cred<|fim_suffix|>6e29e232daf462652f66ee8acc11838b'))
print(rsp.text)<|fim_middle|>ential&appid=%s&secret=%s'%('wx27c0e6ef6a7f0716',' | code_fim | easy | {
"lang": "python",
"repo": "magicEmperor/Crawler-collection",
"path": "/WeChat/acces_TK.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
sys.argv += problem_args('librispeech_clean_small')
# sys.argv += problem_args('common_voice')
t2t_trainer.main(None)
print('All done.')
if __name__ == '__main__':
main()<|fim_prefix|># repo: stefan-falk/tensor2tensor path: /tensor2tensor/bin/test.py
import os
import sys
from... | code_fim | hard | {
"lang": "python",
"repo": "stefan-falk/tensor2tensor",
"path": "/tensor2tensor/bin/test.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.