text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: adnrs96/runtime path: /storyruntime/DeploymentLock.py
# -*- coding: utf-8 -*-
import asyncio
class DeploymentLock:
lock = asyncio.Lock()
apps = {}
<|fim_suffix|> return True
async def release(self, app_id):
async with self.lock:
self.apps.pop(app_id)<|f... | code_fim | hard | {
"lang": "python",
"repo": "adnrs96/runtime",
"path": "/storyruntime/DeploymentLock.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return True
async def release(self, app_id):
async with self.lock:
self.apps.pop(app_id)<|fim_prefix|># repo: adnrs96/runtime path: /storyruntime/DeploymentLock.py
# -*- coding: utf-8 -*-
import asyncio
class DeploymentLock:
<|fim_middle|>
lock = asyncio.Lock()
... | code_fim | hard | {
"lang": "python",
"repo": "adnrs96/runtime",
"path": "/storyruntime/DeploymentLock.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def threshold(self):
return self.level
@threshold.setter
def threshold(self, level):
self.setLevel(level)
warn = logging.Logger.warning<|fim_prefix|># repo: catboost/catboost path: /contrib/python/setuptools/py3/setuptools/_distutils/log.py
"""
A simple log... | code_fim | hard | {
"lang": "python",
"repo": "catboost/catboost",
"path": "/contrib/python/setuptools/py3/setuptools/_distutils/log.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catboost/catboost path: /contrib/python/setuptools/py3/setuptools/_distutils/log.py
"""
A simple log mechanism styled after PEP 282.
Retained for compatibility and should not be used.
"""
import logging
import warnings
<|fim_suffix|> warnings.warn(Log.__doc__) # avoid DeprecationWarnin... | code_fim | hard | {
"lang": "python",
"repo": "catboost/catboost",
"path": "/contrib/python/setuptools/py3/setuptools/_distutils/log.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> features from x_data
estimator = SVR(kernel="linear")
selector = RFE(estimator, 2, step=1)
selector = selector.fit( x_data,y_data )
print( selector.support_ )# [False False True True]
print( selector.ranking_ )# [2 3 1 1]<|fim_prefix|># repo: ybdesire/machinelearning path: /feature_selection/fea... | code_fim | medium | {
"lang": "python",
"repo": "ybdesire/machinelearning",
"path": "/feature_selection/fea_select_by_rfe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ybdesire/machinelearning path: /feature_selection/fea_select_by_rfe.py
from sklearn.datasets import load_iris
from sklearn.feature_selection import RFE
from sklearn.svm import SVR
<|fim_suffix|>fit( x_data,y_data )
print( selector.support_ )# [False False True True]
print( selector.rank... | code_fim | hard | {
"lang": "python",
"repo": "ybdesire/machinelearning",
"path": "/feature_selection/fea_select_by_rfe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """double Z-test hypothesis"""
def __init__(self, kind, sigma1, sigma2):
dist = stats.norm(0, 1)
super(Z2Hyp, self).__init__(dist, kind=kind)
self.sigma1 = sigma1
self.sigma2 = sigma2
def criterion(self, sample1, sample2):
m1 = sample1.mean()
m2... | code_fim | medium | {
"lang": "python",
"repo": "BobNobrain/matstat-labs",
"path": "/s/double/Z2Hyp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BobNobrain/matstat-labs path: /s/double/Z2Hyp.py
from scipy import stats
import numpy as np
from .DoubleHyp import DoubleHyp
class Z2Hyp(DoubleHyp):
"""double Z-test hypothesis"""
def __init__(self, kind, sigma1, sigma2):
<|fim_suffix|> def criterion(self, sample1, sample2):
... | code_fim | medium | {
"lang": "python",
"repo": "BobNobrain/matstat-labs",
"path": "/s/double/Z2Hyp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@requests_post.post(schema=PostSchema, validators=(marshmallow_body_validator,))
def _requests_post(request):
"""
:param request:
:return:
"""
uuid = request.validated['uuid']
return uuid
@requests_get.get()
def _requests_get(request):
return request.matchdict['uuid']
# Se... | code_fim | hard | {
"lang": "python",
"repo": "tomascorrea/cornice.ext.apispec",
"path": "/examples/minimalist.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomascorrea/cornice.ext.apispec path: /examples/minimalist.py
from marshmallow import Schema, fields
from cornice import Service
from cornice.validators import marshmallow_body_validator
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
<|fim_suffix|> """
... | code_fim | hard | {
"lang": "python",
"repo": "tomascorrea/cornice.ext.apispec",
"path": "/examples/minimalist.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linksmith/unusualbusiness path: /unusualbusiness/pages/templatetags/article_tags.py
from django import template
from unusualbusiness.pages.models import Quote, StaticContent
register = template.Library()
<|fim_suffix|> return {
'static_content': StaticContent.objects.select_related(... | code_fim | hard | {
"lang": "python",
"repo": "linksmith/unusualbusiness",
"path": "/unusualbusiness/pages/templatetags/article_tags.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> quotes = Quote.objects.all()
quote = None
if quotes.count() > 1:
quote = quotes[1]
return {
'quote': quote,
'request': context['request'],
}
@register.inclusion_tag('pages/blocks/quotes.html', takes_context=True)
def all_quotes(context):
return {
'... | code_fim | hard | {
"lang": "python",
"repo": "linksmith/unusualbusiness",
"path": "/unusualbusiness/pages/templatetags/article_tags.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def train_epochs(resume=False, use_glove=True):
"""Train multiple opochs"""
print('total epochs: ', cfg.EPOCHS, '; use_glove: ', use_glove)
training_data, word_to_idx, label_to_idx = data_loader()
model, best_acc, start_epoch = get_model(word_to_idx, label_to_idx,
... | code_fim | hard | {
"lang": "python",
"repo": "pidugusundeep/Citation-Classification-using-Deep-Learning",
"path": "/train_batch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pidugusundeep/Citation-Classification-using-Deep-Learning path: /train_batch.py
"""
Part of BME595 project
Program:
Train models for citation classification
"""
import time
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.optim as optim
from model import Batc... | code_fim | hard | {
"lang": "python",
"repo": "pidugusundeep/Citation-Classification-using-Deep-Learning",
"path": "/train_batch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Step 4. Compute your loss function. (Again, Torch wants the target
# word wrapped in a variable)
loss = loss_function(labels, targets)
# Step 5. Do the backward pass and update the gradient
loss.backward()
optimizer.step()
train_loss += loss.data
... | code_fim | hard | {
"lang": "python",
"repo": "pidugusundeep/Citation-Classification-using-Deep-Learning",
"path": "/train_batch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Loss layer
model.add(Dense(n_classes, activation='softmax'))<|fim_prefix|># repo: glemaitre/IBIOM-M2-deep-learning path: /solutions/04_03.py
# Keras model
## Convolution layers
model = Sequential()
model.add(Conv2D(10, kernel_size=(3, 3),
activation='relu',
input_sh... | code_fim | medium | {
"lang": "python",
"repo": "glemaitre/IBIOM-M2-deep-learning",
"path": "/solutions/04_03.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glemaitre/IBIOM-M2-deep-learning path: /solutions/04_03.py
# Keras model
## Convolution layers
model = Sequential()
model.add(Conv2D(10, kernel_size=(3, 3),
activation='relu',
input_shape=input_shape))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(... | code_fim | medium | {
"lang": "python",
"repo": "glemaitre/IBIOM-M2-deep-learning",
"path": "/solutions/04_03.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, ch_emb, wd_emb):
# [B, Tw, Tc, C] -> [B, C, Tw, Tc]
ch_emb = ch_emb.permute(0, 3, 1, 2)
ch_emb = F.dropout(ch_emb, p=self.dropout_c, training=self.training)
ch_emb = self.conv2d(ch_emb)
ch_emb = F.relu(ch_emb)
ch_emb, _ = torch.max(ch_e... | code_fim | hard | {
"lang": "python",
"repo": "DoDucNhan/Surveillance-VQA",
"path": "/L-GCN/model/embedding.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dropout_w=0.1, dropout_c=0.05):
super().__init__()
self.conv2d = nn.Conv2d(
cemb_dim, d_model, kernel_size=(1, 5), padding=0, bias=True)
nn.init.kaiming_normal_(self.conv2d.weight, nonlinearity='relu')
self.conv1d = nn.Linear(wemb_dim + d_model,... | code_fim | medium | {
"lang": "python",
"repo": "DoDucNhan/Surveillance-VQA",
"path": "/L-GCN/model/embedding.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DoDucNhan/Surveillance-VQA path: /L-GCN/model/embedding.py
import torch
import torch.nn.functional as F
from torch import nn
# https://github.com/BangLiu/QANet-PyTorch/blob/master/model/QANet.py
class Highway(nn.Module):
def __init__(self, layer_num, size):
<|fim_suffix|> def __init__(s... | code_fim | hard | {
"lang": "python",
"repo": "DoDucNhan/Surveillance-VQA",
"path": "/L-GCN/model/embedding.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getCellsFromRay(self, sourceCellCoordinates: List[int], direction: List[int], distance: int = -1) -> List[int]:
cellIndices: list[int] = []
if distance < 0:
distance = max(self.cellWidth, self.cellHeight)
cellCoordinates = sourceCellCoordinates.copy()
for offset in range(distance):
... | code_fim | hard | {
"lang": "python",
"repo": "thrabchak/chessmod",
"path": "/project/chess/chessBoard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return list(filter(lambda cellIndex: isinstance(self.getPieceFromCell(cellIndex), chess.rookChessPiece.RookChessPiece), pieceIndices))
def isKingInCheck(self, teamIndex: int) -> bool:
# Get combined list of all the valid attack based destination cell indices of all pieces on the other team.
allOpp... | code_fim | hard | {
"lang": "python",
"repo": "thrabchak/chessmod",
"path": "/project/chess/chessBoard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thrabchak/chessmod path: /project/chess/chessBoard.py
from typing import Dict, List, Set
from enum import Enum
from chess.board import Board, BoardPieceActionType
import chess.chessPieceSet
import chess.rookChessPiece
import chess.kingChessPiece
class ChessEndGameCondition(Enum):
NONE = -1
CH... | code_fim | hard | {
"lang": "python",
"repo": "thrabchak/chessmod",
"path": "/project/chess/chessBoard.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>CHIJRI_CONTENTS = [
{"_id": 1, "f29flg": False, "f30flg": False, "fadjst": 0},
{"_id": 2, "f29flg": False, "f30flg": False, "fadjst": 0},
{"_id": 3, "f29flg": False, "f30flg": False, "fadjst": 0},
{"_id": 4, "f29flg": False, "f30flg": False, "fadjst": 0},
{"_id": 5, "f29flg": False, "f30flg": False, "... | code_fim | medium | {
"lang": "python",
"repo": "MFarelS/ID_AzanBot",
"path": "/populate_chijri.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MFarelS/ID_AzanBot path: /populate_chijri.py
#!/usr/bin/env python
import logging
from pymongo import MongoClient
from credentials import DBNAME, DBUSER, DBPASS, DBAUTH
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s:%(lineno)d - %(levelname)s - %(message)s',
... | code_fim | medium | {
"lang": "python",
"repo": "MFarelS/ID_AzanBot",
"path": "/populate_chijri.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># MongoDB connection
client = MongoClient()
db = client[DBNAME]
db.authenticate(DBUSER, DBPASS, source=DBAUTH)
CHIJRI_CONTENTS = [
{"_id": 1, "f29flg": False, "f30flg": False, "fadjst": 0},
{"_id": 2, "f29flg": False, "f30flg": False, "fadjst": 0},
{"_id": 3, "f29flg": False, "f30flg": False, "fadjst":... | code_fim | medium | {
"lang": "python",
"repo": "MFarelS/ID_AzanBot",
"path": "/populate_chijri.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KamalDGRT/ProgrammingPractice path: /LeetCode/Word_Break/solution.py
s = "leetcode"
wordDict = ["leet","code"]
# s = "applepenapple"
# wordDict = ["apple","pen"]
<|fim_suffix|> print("Word In List: ", word)
if word in s:
s = s.replace(word, "", 1)
print("New String: ", s... | code_fim | medium | {
"lang": "python",
"repo": "KamalDGRT/ProgrammingPractice",
"path": "/LeetCode/Word_Break/solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if condition:
print("Breakable")
else:
print("Not Breakable")<|fim_prefix|># repo: KamalDGRT/ProgrammingPractice path: /LeetCode/Word_Break/solution.py
s = "leetcode"
wordDict = ["leet","code"]
# s = "applepenapple"
# wordDict = ["apple","pen"]
<|fim_middle|># s = "catsandog"
# wordDict = ["cat... | code_fim | hard | {
"lang": "python",
"repo": "KamalDGRT/ProgrammingPractice",
"path": "/LeetCode/Word_Break/solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kcorring/ds4100-music-analytics path: /tests/test_spotify_track_finder.py
#!/usr/bin/python
'''tests spotify track finder'''
from __future__ import absolute_import, print_function
import logging
import os
import unittest
from muslytics.ITunesXMLParser import unpickle_library
from muslytics impo... | code_fim | hard | {
"lang": "python",
"repo": "kcorring/ds4100-music-analytics",
"path": "/tests/test_spotify_track_finder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Verify correct audio features were retrieved from Spotify."""
# 1ehPJRt49h6N0LoryqKZXq, 8737: How Far I'll Go (Alessia Cara Version) by Alessia Cara
# 2fGFaTDbE8aS4f31fM0XE4, 5037: Pop 101 (feat. Anami Vice) by Marianas Trench
targets = {8737: {'danceability': 0.317,
... | code_fim | hard | {
"lang": "python",
"repo": "kcorring/ds4100-music-analytics",
"path": "/tests/test_spotify_track_finder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i_id, s_id in targets.iteritems():
self.assertEqual(s_id, matches[i_id])
def test_audio_features(self):
"""Verify correct audio features were retrieved from Spotify."""
# 1ehPJRt49h6N0LoryqKZXq, 8737: How Far I'll Go (Alessia Cara Version) by Alessia Cara
... | code_fim | hard | {
"lang": "python",
"repo": "kcorring/ds4100-music-analytics",
"path": "/tests/test_spotify_track_finder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def reinitialize_conditions(self):
"""
Re-initialize all current conditions by querying the managed plumbing engine.
"""
if self._plumb is not None and self.current_step is not None:
time = self._plumb.time
pressures = self._plumb.current_pressur... | code_fim | hard | {
"lang": "python",
"repo": "roguextech/Waterloo-Rocketry-topside",
"path": "/topside/procedures/procedures_engine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for condition, _ in self.current_step.conditions:
if condition.satisfied():
return True
return False
def proceed(self):
"""
Move from the current step post-node to the next step pre-node.
If multiple conditions are satisfied, this f... | code_fim | hard | {
"lang": "python",
"repo": "roguextech/Waterloo-Rocketry-topside",
"path": "/topside/procedures/procedures_engine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roguextech/Waterloo-Rocketry-topside path: /topside/procedures/procedures_engine.py
from enum import Enum
import topside as top
class StepPosition(Enum):
Before = 1
After = 2
class ProceduresEngine:
"""
An interface for managing Procedure-PlumbingEngine interactions.
A P... | code_fim | hard | {
"lang": "python",
"repo": "roguextech/Waterloo-Rocketry-topside",
"path": "/topside/procedures/procedures_engine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def unfold_results(results: list):
for item in results:
if isinstance(item, tuple):
yield from item
else:
yield item
async def on_post_process_message(self, msg: types.Message, results: list, *_):
for item i... | code_fim | medium | {
"lang": "python",
"repo": "LDmitriy7/aiogram-tools",
"path": "/aiogram_tools/middlewares/misc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LDmitriy7/aiogram-tools path: /aiogram_tools/middlewares/misc.py
from __future__ import annotations
import inspect
from aiogram import types
from aiogram.dispatcher.middlewares import BaseMiddleware
class EmptyAnswerCallbackQuery(BaseMiddleware):
"""Отвечает пустым сообщением на любой Cal... | code_fim | hard | {
"lang": "python",
"repo": "LDmitriy7/aiogram-tools",
"path": "/aiogram_tools/middlewares/misc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pedroperrusi/deep-learning-for-robotics path: /Class02/robotic_arm/env_sim/helpers.py
import numpy as np
import contextlib
with contextlib.redirect_stdout(None):
import pygame
import pygame.locals
import matplotlib
import matplotlib.backends.backend_agg as agg
import scipy.stats as stats
impo... | code_fim | hard | {
"lang": "python",
"repo": "pedroperrusi/deep-learning-for-robotics",
"path": "/Class02/robotic_arm/env_sim/helpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> rect.center += np.asarray(container)
rect.center += np.array([np.cos(part.rot_angle) * part.offset,
-np.sin(part.rot_angle) * part.offset])
#Get current angle with respect to the origin
def print_angle(x, y, origin):
if x <= origin[0] and y <= origin[1]:
opposite = origin[1] - y
... | code_fim | hard | {
"lang": "python",
"repo": "pedroperrusi/deep-learning-for-robotics",
"path": "/Class02/robotic_arm/env_sim/helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kchennen/metadome path: /prebuild_all.py
import traceback
import logging
import os
from time import sleep
import metadome.default_settings as settings
from metadome.application import app, celery
from metadome.tasks import create_prebuild_visualization, initialize_metadomain
from metadome.domain... | code_fim | hard | {
"lang": "python",
"repo": "kchennen/metadome",
"path": "/prebuild_all.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_log.debug("submitting metadomain jobs")
results = {domain_id: initialize_metadomain.delay(domain_id)
for domain_id in os.listdir(settings.METADOMAIN_DIR)}
_log.debug("waiting for results")
try:
monitor(results)
except:
_log.debug("revoking all jobs")
for result in results.values()... | code_fim | hard | {
"lang": "python",
"repo": "kchennen/metadome",
"path": "/prebuild_all.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saforem2/l2hmc path: /l2hmc/lattice/matrices.py
import numpy as np
GELLMANN_MATRICES = np.array([
np.matrix([ # lambda_1
[0, 1, 0],
[1, 0, 0],
[0, 0, 0],
], dtype=np.complex),
np.matrix([ # lambda_2
[0, 1j, 0],
[1j, 0, 0],
[0, 0, 0],... | code_fim | hard | {
"lang": "python",
"repo": "saforem2/l2hmc",
"path": "/l2hmc/lattice/matrices.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
DIRAC_MATRICES = np.array([
np.matrix([
[+1, 0, 0, 0],
[0, +1, 0, 0],
[0, 0, -1, 0],
[0, 0, 0, -1],
], dtype=np.complex),
np.matrix([
[0, 0, 0, +1],
[0, 0, +1, 0],
[0, -1, 0, 0],
[-1, 0, 0, 0],
], dtype=np.complex),
np.m... | code_fim | hard | {
"lang": "python",
"repo": "saforem2/l2hmc",
"path": "/l2hmc/lattice/matrices.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#x[> 0.5] = 1 #not the answer
x[x > 0.5] = 1 #the answer
print(x)
#Question 7
x = np.array([1, 2, 3, 4, 5])
#print((x > 1)[:3]) #not the answer
#print(x[:3] > 1) #not the answer
print((x > 1).nonzero()[0][:3]) #the answer
#pr... | code_fim | hard | {
"lang": "python",
"repo": "dilayercelik/CompNeuro_Washington",
"path": "/Week 1/quiz1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>##Option 1 #the answer
#if x in [2, 5, 9]:
#y = True
#else:
#y = False
##Option 2 #the answer
#y = False
#if x in [2, 5, 9]:
#y = True
##Option 3
#y = x in [2, 5, 9] #the answer
##Option 4
#if x == [2, 5, 9]:
#y = True
#else:
#y = False
... | code_fim | hard | {
"lang": "python",
"repo": "dilayercelik/CompNeuro_Washington",
"path": "/Week 1/quiz1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dilayercelik/CompNeuro_Washington path: /Week 1/quiz1.py
# -*- coding: utf-8 -*-
"""
Created on Fri May 8 16:13:47 2020
@author: Dilay Ercelik
"""
# Quiz Week 1 (see also png files)
# Grade: 14/14 (100%)
import numpy as np
import matplotlib.pyplot as plt
#Queston 1
A = np... | code_fim | hard | {
"lang": "python",
"repo": "dilayercelik/CompNeuro_Washington",
"path": "/Week 1/quiz1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: royqh1979/programming_with_python path: /Chap06Recursion/1-1.内接递归三角形.py
from easygraphics.turtle import *
def inner_triangle(size,level):
<|fim_suffix|>create_world(800,600)
set_speed(10)
setxy(-200,-200)
inner_triangle(400,10)
pause()
close_world()<|fim_middle|> """
绘制内接递归三角形
:param ... | code_fim | hard | {
"lang": "python",
"repo": "royqh1979/programming_with_python",
"path": "/Chap06Recursion/1-1.内接递归三角形.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>create_world(800,600)
set_speed(10)
setxy(-200,-200)
inner_triangle(400,10)
pause()
close_world()<|fim_prefix|># repo: royqh1979/programming_with_python path: /Chap06Recursion/1-1.内接递归三角形.py
from easygraphics.turtle import *
def inner_triangle(size,level):
<|fim_middle|> """
绘制内接递归三角形
:param ... | code_fim | hard | {
"lang": "python",
"repo": "royqh1979/programming_with_python",
"path": "/Chap06Recursion/1-1.内接递归三角形.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def eval(self,state):
try:
y = self.rhs.eval(state)
state[self.lhs] = y
except EvaluationError:
print(self.statement,"Unknown Error")<|fim_prefix|># repo: lavishm58/Python-Interpreter path: /interpreter/src/assign.py
from error import *
from expres... | code_fim | hard | {
"lang": "python",
"repo": "lavishm58/Python-Interpreter",
"path": "/interpreter/src/assign.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lavishm58/Python-Interpreter path: /interpreter/src/assign.py
from error import *
from expression import *
from keywords import *
class AssignmentStatement(object):
def __init__(self,statement):
self.statement = statement
self.lhs = None
self.rhs = None
<|fim_suffi... | code_fim | hard | {
"lang": "python",
"repo": "lavishm58/Python-Interpreter",
"path": "/interpreter/src/assign.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_find_nominal_hv(self):
assert (
find_nominal_hv(
"peeemtee/tests/samples/waveform_data_dummy.h5", 5e6
)
== 1100
)
def test_calculate_rise_times(self):
waveforms = np.array(
[
[0, 0, 0,... | code_fim | hard | {
"lang": "python",
"repo": "JonasReubelt/PeeEmTee",
"path": "/peeemtee/tests/test_tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JonasReubelt/PeeEmTee path: /peeemtee/tests/test_tools.py
import numpy as np
from unittest import TestCase
from peeemtee.tools import (
calculate_charges,
bin_data,
peak_finder,
gaussian,
gaussian_with_offset,
calculate_transit_times,
find_nominal_hv,
calculate_ris... | code_fim | hard | {
"lang": "python",
"repo": "JonasReubelt/PeeEmTee",
"path": "/peeemtee/tests/test_tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_calculate_mean_signal(self):
signals = np.array(
[
[0, 0.1, 1.2, -1.04, -5.213, -11.1, -15.43, -8.435, -1.1, -0],
[0, 0.5, -1.8, -2.04, -15.456, -13.4, -10.56, -6.355, -1.0, -0],
[
0,
0... | code_fim | hard | {
"lang": "python",
"repo": "JonasReubelt/PeeEmTee",
"path": "/peeemtee/tests/test_tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /Alignment/MuonAlignment/python/geometryDiffVisualization.py
from __future__ import absolute_import
import re
from math import *
from .svgfig import rgb, SVG, pathtoPath, load as load_svg
from .geometryXMLparser import *
from signConventions import *
def dt_colors(wheel, stati... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Alignment/MuonAlignment/python/geometryDiffVisualization.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> newBox = pathtoPath(svgitem)
# Inkscape outputs wrong SVG: paths are filled with movetos, rather than linetos; this fixes that
first = True
for i, di in enumerate(newBox.d):
if not first and di[0] == "m":
di = list(di)
... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Alignment/MuonAlignment/python/geometryDiffVisualization.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tx = float(m.group(1))
ty = float(m.group(2))
tr = float(m.group(3))
newBox = svgitem.clone()
svgitem["style"] = "fill:#e1e1e1;fill-opacity:1;stroke:#000000;stroke-width:5.0;stroke-dasharray:1, 1;stroke-dashoffset:0"
newBox["style"]... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/Alignment/MuonAlignment/python/geometryDiffVisualization.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> NumberOfNumbers = int(input("How many numbers do you want to calculate? "))
NumArray = []
for x in range(NumberOfNumbers):
Number = float(input("Number: "))
NumArray.append(Number)
Total = 0
for i in range(NumberOfNumbers):
Total = Total + NumArray[(i-1)]
To... | code_fim | medium | {
"lang": "python",
"repo": "yungnando/Computer-Science",
"path": "/GCSE/FunctionChallenge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yungnando/Computer-Science path: /GCSE/FunctionChallenge.py
#Function Challenge
# Created by Tiago Ferreira on 08/02/2016.
# Copyright (c) 2016 Tiago Ferreira
<|fim_suffix|>def Average():
NumberOfNumbers = int(input("How many numbers do you want to calculate? "))
NumArray = []
for... | code_fim | hard | {
"lang": "python",
"repo": "yungnando/Computer-Science",
"path": "/GCSE/FunctionChallenge.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def Average():
NumberOfNumbers = int(input("How many numbers do you want to calculate? "))
NumArray = []
for x in range(NumberOfNumbers):
Number = float(input("Number: "))
NumArray.append(Number)
Total = 0
for i in range(NumberOfNumbers):
Total = Total + NumArra... | code_fim | hard | {
"lang": "python",
"repo": "yungnando/Computer-Science",
"path": "/GCSE/FunctionChallenge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Now print the list content
for paragraph in mylist.get_paragraphs():
print(paragraph)
print(paragraph.text_recursive)
Expected_result = """
Available lists of the document: 5
<lpod.list.odf_list object at 0x1018434d0> "text:list"
The 4th list got paragraphs: 9
<lpod.paragraph.odf_paragraph obje... | code_fim | hard | {
"lang": "python",
"repo": "jdum/odfdo",
"path": "/recipes/accessing_other_element_from_element_like_list.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdum/odfdo path: /recipes/accessing_other_element_from_element_like_list.py
#!/usr/bin/env python
from odfdo import Document
# ODF export of Wikipedia article Hitchhiker's Guide to the Galaxy (CC-By-SA)
filename = "collection2.odt"
doc = Document(filename)
# The body object is an XML element ... | code_fim | hard | {
"lang": "python",
"repo": "jdum/odfdo",
"path": "/recipes/accessing_other_element_from_element_like_list.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>Expected_result = """
Available lists of the document: 5
<lpod.list.odf_list object at 0x1018434d0> "text:list"
The 4th list got paragraphs: 9
<lpod.paragraph.odf_paragraph object at 0x101843650> "text:p"
BBC Cult website, official website for the TV show version (includes information, links and downloads... | code_fim | hard | {
"lang": "python",
"repo": "jdum/odfdo",
"path": "/recipes/accessing_other_element_from_element_like_list.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Constructor
'''<|fim_prefix|># repo: lo100/MyRaspiHome path: /framework/data_cleanser/data_cleanser.py
'''
Created on 06.03.2014
@author: harb
'''
<|fim_middle|>class DataCleanser(object):
'''
classdocs
'''
def __init__(self, params):
| code_fim | medium | {
"lang": "python",
"repo": "lo100/MyRaspiHome",
"path": "/framework/data_cleanser/data_cleanser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lo100/MyRaspiHome path: /framework/data_cleanser/data_cleanser.py
'''
Created on 06.03.2014
@author: harb
'''
<|fim_suffix|>
def __init__(self, params):
'''
Constructor
'''<|fim_middle|>class DataCleanser(object):
'''
classdocs
'''
| code_fim | easy | {
"lang": "python",
"repo": "lo100/MyRaspiHome",
"path": "/framework/data_cleanser/data_cleanser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, params):
'''
Constructor
'''<|fim_prefix|># repo: lo100/MyRaspiHome path: /framework/data_cleanser/data_cleanser.py
'''
Created on 06.03.2014
<|fim_middle|>@author: harb
'''
class DataCleanser(object):
'''
classdocs
'''
| code_fim | medium | {
"lang": "python",
"repo": "lo100/MyRaspiHome",
"path": "/framework/data_cleanser/data_cleanser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: julianwachholz/thefarland path: /apps/minecraft/migrations/0004_auto_20141121_1448.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel... | code_fim | hard | {
"lang": "python",
"repo": "julianwachholz/thefarland",
"path": "/apps/minecraft/migrations/0004_auto_20141121_1448.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='LogAction',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', serialize=False, auto_created=True)),
('timestamp', models.DateTimeField(auto_now_add=True)),
(... | code_fim | hard | {
"lang": "python",
"repo": "julianwachholz/thefarland",
"path": "/apps/minecraft/migrations/0004_auto_20141121_1448.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>eyes = Eyes()
logger.set_logger(StdoutLogger())
# Force Eyes to grab a full page screenshot.
eyes.force_full_page_screenshot = True
eyes.stitch_mode = StitchMode.CSS
try:
driver = eyes.open(driver, "Python app", "applitools", {'width': 800, 'height': 600})
driver.get('http://www.applitools.com'... | code_fim | hard | {
"lang": "python",
"repo": "mdaffern/eyes.selenium.python",
"path": "/samples/test_script.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mdaffern/eyes.selenium.python path: /samples/test_script.py
from selenium import webdriver
from selenium.webdriver.common.by import By
from applitools import (
logger, StdoutLogger,
Eyes, StitchMode, Region,
Target, IgnoreRegionBySelector, FloatingRegion, FloatingBounds)
# os.enviro... | code_fim | hard | {
"lang": "python",
"repo": "mdaffern/eyes.selenium.python",
"path": "/samples/test_script.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> hero = driver.find_element_by_class_name("hero-container")
eyes.check_region_by_element(hero, "Page Hero", target=(Target()
.ignore(Region(20, 20, 50, 50), Region(40, 40, 10, 20)))
)
eyes.close()
fina... | code_fim | hard | {
"lang": "python",
"repo": "mdaffern/eyes.selenium.python",
"path": "/samples/test_script.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Arguments
-------
inputs: list
list of input dataframes.
Returns
-------
dataframe
"""
input_df = inputs[0]
str_list = []
for column_item in self.conf:
column_name = column_item['column']
... | code_fim | hard | {
"lang": "python",
"repo": "schoenemeyer/gQuant",
"path": "/gquant/plugin_nodes/transform/valueFilterNode.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schoenemeyer/gQuant path: /gquant/plugin_nodes/transform/valueFilterNode.py
from gquant.dataframe_flow import Node
from .volumeFilterNode import VolumeFilterNode
class ValueFilterNode(Node):
def columns_setup(self):
self.required = {"asset": "int64"}
<|fim_suffix|>if __name__ == "... | code_fim | hard | {
"lang": "python",
"repo": "schoenemeyer/gQuant",
"path": "/gquant/plugin_nodes/transform/valueFilterNode.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qiboteam/qibocal path: /src/qibocal/protocols/characterization/resonator_spectroscopy_attenuation.py
from dataclasses import dataclass, field
from typing import Optional
import numpy as np
from qibolab import AcquisitionType, AveragingMode, ExecutionParameters
from qibolab.platform import Platfo... | code_fim | hard | {
"lang": "python",
"repo": "qiboteam/qibocal",
"path": "/src/qibocal/protocols/characterization/resonator_spectroscopy_attenuation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@dataclass
class ResonatorSpectroscopyAttenuationData(ResonatorSpectroscopyData):
"""Data structure for resonator spectroscopy with attenuation."""
attenuations: dict[QubitId, int] = field(default_factory=dict)
def _acquisition(
params: ResonatorSpectroscopyAttenuationParameters,
platf... | code_fim | hard | {
"lang": "python",
"repo": "qiboteam/qibocal",
"path": "/src/qibocal/protocols/characterization/resonator_spectroscopy_attenuation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: snsokolov/contests path: /codeforces/667C_ling.py
#!/usr/bin/env python3
# 667C_ling.py - Codeforces.com/problemset/problem/667/C by Sergey 2016
import unittest
import sys
from collections import deque
###############################################################################
# Ling Class ... | code_fim | hard | {
"lang": "python",
"repo": "snsokolov/contests",
"path": "/codeforces/667C_ling.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Time limit test
# self.time_limit_test(5000)
def time_limit_test(self, nmax):
""" Timelimit testing """
import random
import timeit
# Random inputs
test = str(nmax) + " " + str(nmax) + "\n"
numnums = [str(i) + " " + str(i+1) for i in ... | code_fim | hard | {
"lang": "python",
"repo": "snsokolov/contests",
"path": "/codeforces/667C_ling.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def uinput():
return next(it) if it else sys.stdin.readline().rstrip()
# Reading single elements
self.s = uinput()
def calculate(self):
""" Main calcualtion function of the class """
chars = list(self.s)
slen = len(chars)
result = ... | code_fim | hard | {
"lang": "python",
"repo": "snsokolov/contests",
"path": "/codeforces/667C_ling.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Abhishek2019/HackerRank path: /solution/practice/algorithms/implementation/divisible-sum-pairs/solution.py
# Functions from itertools can save you from writing nested for-loops.
from itertools import combinations
n, k = map(<|fim_suffix|>rint(sum(sum(pair) % k == 0 for pair in combinations(a, 2)... | code_fim | easy | {
"lang": "python",
"repo": "Abhishek2019/HackerRank",
"path": "/solution/practice/algorithms/implementation/divisible-sum-pairs/solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>int, input().split())
a = list(map(int, input().split()))
print(sum(sum(pair) % k == 0 for pair in combinations(a, 2)))<|fim_prefix|># repo: Abhishek2019/HackerRank path: /solution/practice/algorithms/implementation/divisible-sum-pairs/solution.py
# Functions from itertools can save you from writing nest... | code_fim | easy | {
"lang": "python",
"repo": "Abhishek2019/HackerRank",
"path": "/solution/practice/algorithms/implementation/divisible-sum-pairs/solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if load_flux_bias: # reload and set flux bias
if DCSources is None or fluxlines_dict is None:
ts = f"({timestamp}) " if timestamp is not None else ""
log.warning(
f"DCSources and fluxlines_dict must be specified if user "
f"wants to loa... | code_fim | hard | {
"lang": "python",
"repo": "QudevETH/PycQED_py3",
"path": "/pycqed/utilities/reload_settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QudevETH/PycQED_py3 path: /pycqed/utilities/reload_settings.py
import pycqed.utilities.general as gen
import logging
log = logging.getLogger(__name__)
def reload_settings(timestamp=None, timestamp_filters=None, load_flux_bias=True,
qubits=None, dev=None,
... | code_fim | hard | {
"lang": "python",
"repo": "QudevETH/PycQED_py3",
"path": "/pycqed/utilities/reload_settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cmbennett01/py-ote path: /src/pyoteapp/helpDialog.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'helpDialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit... | code_fim | medium | {
"lang": "python",
"repo": "cmbennett01/py-ote",
"path": "/src/pyoteapp/helpDialog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #If we found it, use it.
if site_cache:
site = site_cache[0]
else:
site = save_as_site_object(Page(url))
for platform_name in get_platform_names():
signature = __import__('cmfieldguide.cmsdetector.signatures.' + platform_name,
fromlist=... | code_fim | hard | {
"lang": "python",
"repo": "stevenbrent/cmfieldguide",
"path": "/cmfieldguide/cmsdetector/engine.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stevenbrent/cmfieldguide path: /cmfieldguide/cmsdetector/engine.py
import signatures
import pkgutil
import datetime
from operator import itemgetter, attrgetter
from cmfieldguide.cmsdetector.models import Site, Page, save_as_site_object
<|fim_suffix|>def get_platform_names():
names = []
... | code_fim | hard | {
"lang": "python",
"repo": "stevenbrent/cmfieldguide",
"path": "/cmfieldguide/cmsdetector/engine.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Aggrega le informazioni disponibili su un utente:
* dati anagrafici
* identità collegate
* biglietti
* ordini
* coupon
"""
user = User.objects.get(id=uid)
output = {
'user': user_data(user),
'tickets': user_tickets(user),
... | code_fim | hard | {
"lang": "python",
"repo": "EuroPython/epcon",
"path": "/assopy/dataaccess.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assigned_coupon = models.Coupon.objects\
.filter(user__user=u)\
.values('code')
user_coupon = models.OrderItem.objects\
.filter(price__lt=0, order__user__user=u)\
.values('code')
qs = models.Coupon.objects\
.filter(Q(code__in=assigned_coupon)|Q(code__in... | code_fim | hard | {
"lang": "python",
"repo": "EuroPython/epcon",
"path": "/assopy/dataaccess.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EuroPython/epcon path: /assopy/dataaccess.py
from assopy import models
from conference import cachef
from conference.models import Ticket
from django.contrib.auth.models import User
from django.urls import reverse
from django.db.models import Q
cache_me = cachef.CacheFunction(prefix='assopy:')
... | code_fim | hard | {
"lang": "python",
"repo": "EuroPython/epcon",
"path": "/assopy/dataaccess.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jisaacstone/sfzlint path: /tests/test_valid.py
# -*- coding: utf-8 -*-
from unittest import TestCase
from sfzlint import parser
from inspect import cleandoc
class TestValid(TestCase):
def assertEqual(self, aa, bb, *args, **kwargs):
# handle tokens transparently
if hasattr(... | code_fim | hard | {
"lang": "python",
"repo": "jisaacstone/sfzlint",
"path": "/tests/test_valid.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sfz = self._parse(
'''
<control>
set_cc1=0
label_cc1=150
''')
self.assertEqual(sfz.headers[0]['label_cc1'], 150)
def test_default_curve(self):
sfz = self._parse(
'''
<region>
pitch_... | code_fim | hard | {
"lang": "python",
"repo": "jisaacstone/sfzlint",
"path": "/tests/test_valid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sfz = self._parse(
'''
<region>
pitchlfo_depth_oncc17=0.5
loopmode=loop_sustain
''')
self.assertEqual(sfz.headers[0]['pitchlfo_depth_oncc17'], 0.5)
def test_double_n(self):
sfz = self._parse(
'''
... | code_fim | hard | {
"lang": "python",
"repo": "jisaacstone/sfzlint",
"path": "/tests/test_valid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ekene966/hackerrank path: /python/the-minion-game.py
VOWELS = 'AEIOU'
PLAYER_ONE_NAME = "Kevin"
PLAYER_TWO_NAME = "Stuart"
DRAW = "Draw"
<|fim_suffix|> player_one_score = 0
player_two_score = 0
for index, first_letter in enumerate(string):
score_for_letter = len(string) - in... | code_fim | medium | {
"lang": "python",
"repo": "ekene966/hackerrank",
"path": "/python/the-minion-game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
string = input()
minion_game(string)<|fim_prefix|># repo: ekene966/hackerrank path: /python/the-minion-game.py
VOWELS = 'AEIOU'
PLAYER_ONE_NAME = "Kevin"
PLAYER_TWO_NAME = "Stuart"
DRAW = "Draw"
def minion_game(string):
player_one_score = 0
player_two_score = ... | code_fim | hard | {
"lang": "python",
"repo": "ekene966/hackerrank",
"path": "/python/the-minion-game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_sample_synth_model(decoder, input_shape=(8,)):
inputs = keras.Input(shape=input_shape)
x = decoder(inputs)
x = layers.Lambda(lambda h: tf.cast(h, tf.float32))(x)
return keras.Model(inputs, x, name="synth")
def get_sample_model(latent_dim=8, sr=44100, duration=1.0):
input_sha... | code_fim | hard | {
"lang": "python",
"repo": "allanpichardo/vae_synth",
"path": "/models.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allanpichardo/vae_synth path: /models.py
0]
dim = tf.shape(z_mean)[1]
epsilon = tf.keras.backend.random_normal(shape=(batch, dim))
return z_mean + tf.exp(0.5 * z_log_var) * epsilon
class SampleVAE(keras.Model):
def call(self, inputs, training=None, mask=None):
... | code_fim | hard | {
"lang": "python",
"repo": "allanpichardo/vae_synth",
"path": "/models.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allanpichardo/vae_synth path: /models.py
o sample z, the vector encoding the STFT."""
def call(self, inputs):
z_mean, z_log_var = inputs
batch = tf.shape(z_mean)[0]
dim = tf.shape(z_mean)[1]
epsilon = tf.keras.backend.random_normal(shape=(batch, dim))
... | code_fim | hard | {
"lang": "python",
"repo": "allanpichardo/vae_synth",
"path": "/models.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dtklinh/Protein-Rigid-Domains-Estimation path: /venv/lib/python3.5/site-packages/csb/test/cases/bio/hmm/__init__.py
import csb.test as test
from csb.core import Enum, OrderedDict
from csb.bio.hmm import State, Transition, ProfileHMM, HMMLayer, ProfileLength, StateFactory, ProfileHMMSegment
from... | code_fim | hard | {
"lang": "python",
"repo": "dtklinh/Protein-Rigid-Domains-Estimation",
"path": "/venv/lib/python3.5/site-packages/csb/test/cases/bio/hmm/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testNeff(self):
self.assertEqual(self.layer.effective_matches, 5)
self.assertEqual(self.layer.effective_insertions, 4)
self.assertEqual(self.layer.effective_deletions, 3)
def testResidue(self):
def test(type):
self.layer.residue = ProteinRes... | code_fim | hard | {
"lang": "python",
"repo": "dtklinh/Protein-Rigid-Domains-Estimation",
"path": "/venv/lib/python3.5/site-packages/csb/test/cases/bio/hmm/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(TestHit, self).setUp()
self.h1 = HHpredHit(1, 'hit1', 2, 5, 3, 6, 0.5, 10)
self.h2 = HHpredHit(2, 'hit2', 3, 5, 4, 6, 0.2, 10)
def testEquals(self):
hit = HHpredHit(1, 'hit1', 2, 5, 3, 6, 0.5, 10)
self.assertTrue(self.h1.equals(hit))
... | code_fim | hard | {
"lang": "python",
"repo": "dtklinh/Protein-Rigid-Domains-Estimation",
"path": "/venv/lib/python3.5/site-packages/csb/test/cases/bio/hmm/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rush2catch/algorithms-leetcode path: /Basic Data Structures/array/leet_674_LongestContinuousIncreasingSubsequence.py
# Problem: Longest Continuous Increasing Subsequence
# Difficulty: Easy
# Category: Array
# Leetcode 674: https://leetcode.com/problems/longest-continuous-increasing-subsequence/de... | code_fim | medium | {
"lang": "python",
"repo": "rush2catch/algorithms-leetcode",
"path": "/Basic Data Structures/array/leet_674_LongestContinuousIncreasingSubsequence.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(nums) == 0:
return 0
start = 0
end = 1
maxLength = 1
while end < len(nums):
if nums[end] > nums[end - 1]:
maxLength = max(maxLength, end - start + 1 )
else:
start = end
end += 1
return maxLength
obj = Solution()
print(obj.find_length([1, 2, 3, 5, 4, 7]))
print(obj.f... | code_fim | medium | {
"lang": "python",
"repo": "rush2catch/algorithms-leetcode",
"path": "/Basic Data Structures/array/leet_674_LongestContinuousIncreasingSubsequence.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if settings.DEBUG:
import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
if settings.MEDIA_ROOT:
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()<|fim_prefix... | code_fim | hard | {
"lang": "python",
"repo": "oleg-chubin/let_me_play",
"path": "/let_me_play/urls.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.