text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: brainmentorspvtltd/MSIT_AdvancePython path: /OnlineShop/cgi-bin/search.py
#!/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
import cgi
import base
form = cgi.FieldStorage()
search = form.getvalue("q")
<|fim_suffix|>print('''
<div class="container">
<h1 class="text-center">Pr... | code_fim | medium | {
"lang": "python",
"repo": "brainmentorspvtltd/MSIT_AdvancePython",
"path": "/OnlineShop/cgi-bin/search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> token = TokenController.create_token({"user": "any_user"})
assert token.get("status") == "ok"<|fim_prefix|># repo: EvertonTomalok/bossa-box-backend-python path: /tests/controllers/test_token.py
from src.controllers.token import TokenController
<|fim_middle|>
def test_token():
| code_fim | easy | {
"lang": "python",
"repo": "EvertonTomalok/bossa-box-backend-python",
"path": "/tests/controllers/test_token.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EvertonTomalok/bossa-box-backend-python path: /tests/controllers/test_token.py
from src.controllers.token import TokenController
<|fim_suffix|> token = TokenController.create_token({"user": "any_user"})
assert token.get("status") == "ok"<|fim_middle|>def test_token():
| code_fim | easy | {
"lang": "python",
"repo": "EvertonTomalok/bossa-box-backend-python",
"path": "/tests/controllers/test_token.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if option == 'border':
pytplot.data_quants[i].attrs['plot_options']['extras']['border'] = value
if option == 'var_label_ticks':
pytplot.data_quants[i].attrs['plot_options']['var_label_ticks'] = value
return
def _ylog_check(data_quants, value... | code_fim | hard | {
"lang": "python",
"repo": "MAVENSDC/PyTplot",
"path": "/pytplot/options.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if option == 'crosshair_y':
pytplot.data_quants[i].attrs['plot_options']['yaxis_opt']['crosshair'] = value
if option == 'crosshair_z':
pytplot.data_quants[i].attrs['plot_options']['zaxis_opt']['crosshair'] = value
if option == 'static':... | code_fim | hard | {
"lang": "python",
"repo": "MAVENSDC/PyTplot",
"path": "/pytplot/options.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MAVENSDC/PyTplot path: /pytplot/options.py
Laboratory for Atmospheric and Space Physics.
# Verify current version before use at: https://github.com/MAVENSDC/PyTplot
import pytplot
import numpy as np
from pytplot import tplot_utilities as utilities
from copy import deepcopy
def options(name, opt... | code_fim | hard | {
"lang": "python",
"repo": "MAVENSDC/PyTplot",
"path": "/pytplot/options.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kindrebo13/ltmwe path: /main_nmt.py
# -*- coding: utf-8 -*-
"""
Builds a word embedding Modified Latent Tree Model (MLTM) for use in feature
extraction from text. All non-leaf nodes from the tree are considered latent
variables. These features are injected into a GRU encoder-decoder
with att... | code_fim | hard | {
"lang": "python",
"repo": "kindrebo13/ltmwe",
"path": "/main_nmt.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Reset random seeds before initialization and training of mltm model
set_seed_everywhere(args.seed,args.cuda)
#Modified NMTModel with latent tree model variables injected into context vector
mltm_model = NMTModelWithMLTM(source_vocab_size=len(vectorizer.source_vocab),
source_embed... | code_fim | hard | {
"lang": "python",
"repo": "kindrebo13/ltmwe",
"path": "/main_nmt.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('forum', '0080_auto_20200418_0628'),
]
operations = [
migrations.AddField(
model_name='person',
name='auth',
field=models.CharField(blank=True, choices=[('slack', 'slack'), ('google', 'google')], max_length=10, null=True),
... | code_fim | easy | {
"lang": "python",
"repo": "thedeadwoods/Comradery-API",
"path": "/forum/migrations/0081_person_auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thedeadwoods/Comradery-API path: /forum/migrations/0081_person_auth.py
# Generated by Django 2.2.7 on 2020-04-20 08:33
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AddField(
model_name='person',
name='auth',
fi... | code_fim | medium | {
"lang": "python",
"repo": "thedeadwoods/Comradery-API",
"path": "/forum/migrations/0081_person_auth.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.result = MarginOfError(a, b)
return self.result
def Cochran(self, a, b, c, d):
self.result = CochranSampleSize(a, b, c, d)
return self.result
def FindUnknownStdPopSampleSize(self, a, b, c):
self.result = UnknownPopStdSampleSize(a, b, c)
return... | code_fim | hard | {
"lang": "python",
"repo": "Ericbrod10/statsCalculator",
"path": "/Calculator/Calculator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def multiply(self, a, b):
self.result = multiplication(a, b)
return self.result
def divide(self, a, b):
self.result = division(a, b)
return self.result
def square(self, a):
self.result = squared(a)
return self.result
def root(self, a):
... | code_fim | hard | {
"lang": "python",
"repo": "Ericbrod10/statsCalculator",
"path": "/Calculator/Calculator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ericbrod10/statsCalculator path: /Calculator/Calculator.py
from Calculator.Addition import addition
from Calculator.Subtraction import subtraction
from Calculator.Multiplication import multiplication
from Calculator.Division import division
from Calculator.Squared import squared
from Calculator.S... | code_fim | hard | {
"lang": "python",
"repo": "Ericbrod10/statsCalculator",
"path": "/Calculator/Calculator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ConducteurSerializer(serializers.ModelSerializer):
class Meta:
model = Conducteur
fields = '__all__'
class MissionReadSerializer(serializers.ModelSerializer):
vehicule = VehiculeReadSerializer()
conducteur = ConducteurSerializer()
class Meta:
model = Missi... | code_fim | hard | {
"lang": "python",
"repo": "Roskobby/AutoCare",
"path": "/mission/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Roskobby/AutoCare path: /mission/serializers.py
from rest_framework import serializers
from .models import Vehicule, Conducteur, Mission, Marque, Modele
from users.models import User
from users.serializers import UserSerializer
class MarqueSerializer(serializers.ModelSerializer):
class Meta... | code_fim | hard | {
"lang": "python",
"repo": "Roskobby/AutoCare",
"path": "/mission/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class VehiculeReadSerializer(serializers.ModelSerializer):
modele = ModeleReadSerializer()
class Meta:
model = Vehicule
fields = '__all__'
class VehiculeWriteSerializer(serializers.ModelSerializer):
class Meta:
model = Vehicule
fields = '__all__'
class Co... | code_fim | medium | {
"lang": "python",
"repo": "Roskobby/AutoCare",
"path": "/mission/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cZahn/skultrafast path: /skultrafast/base_functions.py
# -*- coding: utf-8 -*-
"""
Module to import the base functions from.
"""
from __future__ import print_function
try:
from skultrafast.base_funcs.base_functions_cl import (_fold_exp,
... | code_fim | hard | {
"lang": "python",
"repo": "cZahn/skultrafast",
"path": "/skultrafast/base_functions.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>unctions_np import(_fold_exp,
_fold_exp_and_coh,
_coh_gaussian)
print("pyopencl and numba not found, using pure numpy-basefunctions")<|fim_prefix|># repo: cZahn/skultrafast pa... | code_fim | hard | {
"lang": "python",
"repo": "cZahn/skultrafast",
"path": "/skultrafast/base_functions.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dginformatica/GoWDiscordTeamBot path: /tower_data.py
import copy
import csv
import json
import operator
import os
import threading
import discord
import requests
from requests import HTTPError
from util import bool_to_emoticon, merge
class TowerOfDoomData:
TOWER_CONFIG_FILE = 'towerofdoom... | code_fim | hard | {
"lang": "python",
"repo": "dginformatica/GoWDiscordTeamBot",
"path": "/tower_data.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_value = my_data.get(option, '<ERROR>')
return old_value, new_value
def format_output_config(self, prefix, guild, color):
my_data = self.get(guild)
e = discord.Embed(title='Tower of Doom Config', color=color)
help_text = '\n'.join([
"To configur... | code_fim | hard | {
"lang": "python",
"repo": "dginformatica/GoWDiscordTeamBot",
"path": "/tower_data.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebov/scikit-rough path: /data/data.py
from dataclasses import dataclass
from pathlib import Path
from typing import Union
import pandas as pd
DATA_DIR = Path(__file__).parent / "resources"
@dataclass
class Dataset:
data: pd.DataFrame
target_col: Union[int, str]
<|fim_suffix|>
def ge... | code_fim | medium | {
"lang": "python",
"repo": "sebov/scikit-rough",
"path": "/data/data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> df = pd.read_csv(DATA_DIR / "lymphography.data", header=None)
df_class = df[0]
df.drop(0, axis=1, inplace=True)
df[19] = df_class
dec_col = 19
return Dataset(df, dec_col)
def get_data_methane():
df = pd.read_csv(DATA_DIR / "methane_data.csv", sep=";")
df_target = pd.read_... | code_fim | hard | {
"lang": "python",
"repo": "sebov/scikit-rough",
"path": "/data/data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [migrations.RunPython(create_eventtype)]<|fim_prefix|># repo: bornhack/bornhack-website path: /src/events/migrations/0003_create_another_eventtype.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2018-03-25 14:16
from __future__ import unicode_literals
from django.db import mi... | code_fim | medium | {
"lang": "python",
"repo": "bornhack/bornhack-website",
"path": "/src/events/migrations/0003_create_another_eventtype.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [("events", "0002_create_eventtype")]
operations = [migrations.RunPython(create_eventtype)]<|fim_prefix|># repo: bornhack/bornhack-website path: /src/events/migrations/0003_create_another_eventtype.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2018-03-25 14:16
from __... | code_fim | medium | {
"lang": "python",
"repo": "bornhack/bornhack-website",
"path": "/src/events/migrations/0003_create_another_eventtype.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bornhack/bornhack-website path: /src/events/migrations/0003_create_another_eventtype.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2018-03-25 14:16
from __future__ import unicode_literals
from django.db import migrations
def create_eventtype(apps, schema_editor):
Type = apps.g... | code_fim | easy | {
"lang": "python",
"repo": "bornhack/bornhack-website",
"path": "/src/events/migrations/0003_create_another_eventtype.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: biuyq/FMixCutMatch path: /FMCmatch/implementations/test_lightning.py
from torchvision import datasets, transforms, models
import torch
from torch import optim
from implementations.lightning import FMix
from pytorch_lightning import LightningModule, Trainer, data_loader
# ######### Data
print('=... | code_fim | hard | {
"lang": "python",
"repo": "biuyq/FMixCutMatch",
"path": "/FMCmatch/implementations/test_lightning.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> labels_hat = torch.argmax(x, dim=1)
val_acc = torch.sum(y == labels_hat).item() / (len(y) * 1.0)
val_acc = torch.tensor(val_acc)
loss = self.fmix.loss(x, y, train=False)
output = {
'val_loss': loss,
'val_acc': val_acc,
}
# c... | code_fim | hard | {
"lang": "python",
"repo": "biuyq/FMixCutMatch",
"path": "/FMCmatch/implementations/test_lightning.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dataset = dummy_dataset.DummyDataset(
mode=self.mode, return_array=self.return_array, callback=callback)
if self.mode is tuple:
expected = tuple(dataset.data[:, 3])
elif self.mode is dict:
expected = dict(zip(('a', 'b', 'c'), dataset.data[:, 3])... | code_fim | hard | {
"lang": "python",
"repo": "crcrpar/chainer",
"path": "/tests/chainer_tests/dataset_tests/tabular_tests/test_tabular_dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crcrpar/chainer path: /tests/chainer_tests/dataset_tests/tabular_tests/test_tabular_dataset.py
import unittest
import numpy as np
from chainer import testing
from chainer_tests.dataset_tests.tabular_tests import dummy_dataset
@testing.parameterize(*testing.product({
'mode': [tuple, dict, ... | code_fim | hard | {
"lang": "python",
"repo": "crcrpar/chainer",
"path": "/tests/chainer_tests/dataset_tests/tabular_tests/test_tabular_dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(indices, [3])
self.assertIsNone(key_indices)
dataset = dummy_dataset.DummyDataset(
mode=self.mode, return_array=self.return_array, callback=callback)
if self.mode is tuple:
expected = tuple(dataset.data[:, 3])
elif ... | code_fim | hard | {
"lang": "python",
"repo": "crcrpar/chainer",
"path": "/tests/chainer_tests/dataset_tests/tabular_tests/test_tabular_dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print >> sys.stderr, '{}: reading nodes..'.format(now())
num_entities = 0
with closing(open(nodespath)) as f:
nodes = f.readlines()
num_entities = len(nodes)
node_dict = [nodes[i].rstrip('\n').split('\t') for i in range(len(nodes))]
vertexmap = dict([[... | code_fim | hard | {
"lang": "python",
"repo": "huynhvp/Benchmark_Fact_Checking",
"path": "/public/Benchmark/knowledge_linker/knowledge_linker/frontend/confmatrix.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> global WORKER_DATA
B = A.tocsc()
WORKER_DATA['A'] = A
WORKER_DATA['B'] = B
WORKER_DATA['kind'] = kind
import signal
signal.signal(signal.SIGINT, signal.SIG_IGN)
def _worker(st):
try:
global WORKER_DATA
A = WORKER_DATA['A']
B = WORKER_DATA['B']
... | code_fim | hard | {
"lang": "python",
"repo": "huynhvp/Benchmark_Fact_Checking",
"path": "/public/Benchmark/knowledge_linker/knowledge_linker/frontend/confmatrix.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huynhvp/Benchmark_Fact_Checking path: /public/Benchmark/knowledge_linker/knowledge_linker/frontend/confmatrix.py
# Copyright 2016 The Trustees of Indiana University.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | code_fim | hard | {
"lang": "python",
"repo": "huynhvp/Benchmark_Fact_Checking",
"path": "/public/Benchmark/knowledge_linker/knowledge_linker/frontend/confmatrix.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Disfactory/Disfactory path: /backend/api/utils.py
def set_function_attributes(**kwargs):
def decorator(func):
for key, val in kwargs.items():
setattr(func, key, val)
<|fim_suffix|>
def normalize_townname(townname):
return townname.replace("台", "臺")<|fim_middle|> ... | code_fim | easy | {
"lang": "python",
"repo": "Disfactory/Disfactory",
"path": "/backend/api/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return decorator
def normalize_townname(townname):
return townname.replace("台", "臺")<|fim_prefix|># repo: Disfactory/Disfactory path: /backend/api/utils.py
def set_function_attributes(**kwargs):
def decorator(func):
<|fim_middle|> for key, val in kwargs.items():
setattr(f... | code_fim | medium | {
"lang": "python",
"repo": "Disfactory/Disfactory",
"path": "/backend/api/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return func
return decorator
def normalize_townname(townname):
return townname.replace("台", "臺")<|fim_prefix|># repo: Disfactory/Disfactory path: /backend/api/utils.py
def set_function_attributes(**kwargs):
<|fim_middle|> def decorator(func):
for key, val in kwargs.items():
... | code_fim | medium | {
"lang": "python",
"repo": "Disfactory/Disfactory",
"path": "/backend/api/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LorenDavie/songrank path: /songrank/migrations/0002_auto_20201224_1501.py
# Generated by Django 3.1.4 on 2020-12-24 15:01
from django.db import migrations
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AlterModelOptions(
name='ranking',
... | code_fim | medium | {
"lang": "python",
"repo": "LorenDavie/songrank",
"path": "/songrank/migrations/0002_auto_20201224_1501.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('songrank', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='ranking',
options={'ordering': ['ranking']},
),
]<|fim_prefix|># repo: LorenDavie/songrank path: /songrank/migrations/0002_auto_20201224_150... | code_fim | medium | {
"lang": "python",
"repo": "LorenDavie/songrank",
"path": "/songrank/migrations/0002_auto_20201224_1501.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('songrank', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='ranking',
options={'ordering': ['ranking']},
),
]<|fim_prefix|># repo: LorenDavie/songrank path: /songrank/migrations/0002_auto_20201224_15... | code_fim | medium | {
"lang": "python",
"repo": "LorenDavie/songrank",
"path": "/songrank/migrations/0002_auto_20201224_1501.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ProEgitim/Python-Dersleri-BEM path: /Ogrenciler/Erdogan-Canbay/soru4.py
liste1=[1,2,3]
print(liste1*3)
liste2=[4,2,8,7,9,1]
print(liste2)
liste2.sort(reverse=True)
print(liste2)
liste3=[1,2,3]
liste4=[4,5,6]
liste5=[7,8,9]
<|fim_suffix|>demet1=(1,2,3,4,5,6,7)
print(type(demet1))
print(demet1[3... | code_fim | easy | {
"lang": "python",
"repo": "ProEgitim/Python-Dersleri-BEM",
"path": "/Ogrenciler/Erdogan-Canbay/soru4.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>demet1=(1,2,3,4,5,6,7)
print(type(demet1))
print(demet1[3])<|fim_prefix|># repo: ProEgitim/Python-Dersleri-BEM path: /Ogrenciler/Erdogan-Canbay/soru4.py
liste1=[1,2,3]
print(liste1*3)
liste2=[4,2,8,7,9,1]
print(liste2)
liste2.sort(reverse=True)
print(liste2)
<|fim_middle|>liste3=[1,2,3]
liste4=[4,5,6]
... | code_fim | medium | {
"lang": "python",
"repo": "ProEgitim/Python-Dersleri-BEM",
"path": "/Ogrenciler/Erdogan-Canbay/soru4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ionelmc/bcbio-nextgen path: /tests/integration/test_automated_analysis.py
"""This directory is setup with configurations to run the main functional test.
It exercises a full analysis pipeline on a smaller subset of data.
"""
import os
import subprocess
import pytest
from tests.conftest import m... | code_fim | hard | {
"lang": "python",
"repo": "ionelmc/bcbio-nextgen",
"path": "/tests/integration/test_automated_analysis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.marks('speed2', 'cancer', 'cancermulti', 'install_required')
def test_7_cancer(install_test_files, data_dir):
"""Test paired tumor-normal calling using multiple
calling approaches: MuTect, VarScan, FreeBayes.
"""
with make_workdir() as workdir:
cl = ["bcbio_nextgen.py",
... | code_fim | hard | {
"lang": "python",
"repo": "ionelmc/bcbio-nextgen",
"path": "/tests/integration/test_automated_analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.marks('speed2', 'install_required')
def test_6_bamclean(install_test_files, data_dir):
with make_workdir() as workdir:
cl = ["bcbio_nextgen.py",
get_post_process_yaml(data_dir, workdir),
os.path.join(data_dir, os.pardir, "100326_FC6107FAAXX"),
... | code_fim | hard | {
"lang": "python",
"repo": "ionelmc/bcbio-nextgen",
"path": "/tests/integration/test_automated_analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blacksburg98/dyplot path: /examples/tutorial2.py
import datetime as dt
from finpy.financial.equity import get_tickdata
import finpy.utils.fpdateutil as du
from finpy.financial.portfolio import Portfolio
from dyplot.dygraphs import Dygraphs
if __name__ == '__m<|fim_suffix|>e")
for tick ... | code_fim | hard | {
"lang": "python",
"repo": "blacksburg98/dyplot",
"path": "/examples/tutorial2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e")
for tick in ls_symbols:
dg.plot(series=tick, mseries=all_stocks.normalized(tick))
dg.set_options(title="Tutorial 2")
div = dg.savefig(csv_file="tutorial2.csv", html_file="tutorial2.html")<|fim_prefix|># repo: blacksburg98/dyplot path: /examples/tutorial2.py
import datetime as... | code_fim | hard | {
"lang": "python",
"repo": "blacksburg98/dyplot",
"path": "/examples/tutorial2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rucio/rucio path: /lib/rucio/core/did_meta_plugins/json_meta.py
# -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | code_fim | hard | {
"lang": "python",
"repo": "rucio/rucio",
"path": "/lib/rucio/core/did_meta_plugins/json_meta.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @transactional_session
def delete_metadata(self, scope, name, key, *, session: "Session"):
"""
Delete a key from the metadata column
:param scope: the scope of did
:param name: the name of the did
:param key: the key to be deleted
:param session: Th... | code_fim | hard | {
"lang": "python",
"repo": "rucio/rucio",
"path": "/lib/rucio/core/did_meta_plugins/json_meta.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: boklae/rocon_client_sdk_py path: /rocon_client_sdk_py/virtual_core/actions/base.py
import abc
class Action(object):
def __init__(self):
self.name = 'Not_defined'
self.func_name = 'Not_defined'
self.test = 'hi'
pass
<|fim_suffix|> @abc.abstractmethod
as... | code_fim | medium | {
"lang": "python",
"repo": "boklae/rocon_client_sdk_py",
"path": "/rocon_client_sdk_py/virtual_core/actions/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @abc.abstractmethod
async def on_perform(self, context):
raise NotImplementedError("Please Implement this method")<|fim_prefix|># repo: boklae/rocon_client_sdk_py path: /rocon_client_sdk_py/virtual_core/actions/base.py
import abc
class Action(object):
def __init__(self):
self... | code_fim | medium | {
"lang": "python",
"repo": "boklae/rocon_client_sdk_py",
"path": "/rocon_client_sdk_py/virtual_core/actions/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,):
_LOOKOUT.__init__(self)
self.name = "LOOKOUTS"
self.specie = 'nouns'
self.basic = "lookout"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_lookouts.py
from xai.brain.wordbase.nouns._lookout import _LOOKOUT
<|fim_middle|>#calss hea... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_lookouts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_lookouts.py
from xai.brain.wordbase.nouns._lookout import _LOOKOUT
<|fim_suffix|> _LOOKOUT.__init__(self)
self.name = "LOOKOUTS"
self.specie = 'nouns'
self.basic = "lookout"
self.jsondata = {}<|fim_middle|>#calss header
class _LOOKOUTS(_LO... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_lookouts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samirsen/image-generator path: /skipthoughts.py
'''
Skip-thought vectors
Adapted from https://github.com/ryankiros/skip-thoughts
'''
import os
import theano
import theano.tensor as tensor
import sys
import numpy
import copy
import nltk
from collections import OrderedDict, defaultdict
from scip... | code_fim | hard | {
"lang": "python",
"repo": "samirsen/image-generator",
"path": "/skipthoughts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def encode(model, X, use_norm=True, verbose=True, batch_size=128, use_eos=False):
"""
Encode sentences in the list X. Each entry will return a vector
"""
# first, do preprocessing
X = preprocess(X)
# word dictionary and init
d = defaultdict(lambda : 0)
for w in model['utable'].keys():
d[w] = 1... | code_fim | hard | {
"lang": "python",
"repo": "samirsen/image-generator",
"path": "/skipthoughts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue('404' in response.status)
def test_future_releases_not_in_mentions_response(self):
response = self.app.get(reverse('press-mentions'))
self.assertTrue(self.in_ten_minutes.title not in response)
class PressMentionViewTest(WebTest):
def setUp(self):
... | code_fim | hard | {
"lang": "python",
"repo": "sitedata/website-5",
"path": "/foundation/press/tests/test_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sitedata/website-5 path: /foundation/press/tests/test_views.py
from django.urls import reverse
from django.utils import timezone
from django.template import defaultfilters
from django_webtest import WebTest
from datetime import timedelta
from ..models import PressRelease, PressMention
class ... | code_fim | hard | {
"lang": "python",
"repo": "sitedata/website-5",
"path": "/foundation/press/tests/test_views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
PrideApp().run()<|fim_prefix|># repo: Textualize/textual path: /examples/pride.py
from textual.app import App, ComposeResult
from textual.widgets import Static
<|fim_middle|>class PrideApp(App):
"""Displays a pride flag."""
COLORS = ["red", "orange", "yellow", "g... | code_fim | hard | {
"lang": "python",
"repo": "Textualize/textual",
"path": "/examples/pride.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Textualize/textual path: /examples/pride.py
from textual.app import App, ComposeResult
from textual.widgets import Static
class PrideApp(App):
<|fim_suffix|>if __name__ == "__main__":
PrideApp().run()<|fim_middle|> """Displays a pride flag."""
COLORS = ["red", "orange", "yellow", "g... | code_fim | hard | {
"lang": "python",
"repo": "Textualize/textual",
"path": "/examples/pride.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from . import features as features
from . import plot as plot
from . import console as console<|fim_prefix|># repo: rnaimehaom/hops path: /hops/__init__.py
__all__ = ["features","data","plot","user","console"]
<|fim_middle|>from .observations import calc_features as calc_features
from .learner import Ma... | code_fim | medium | {
"lang": "python",
"repo": "rnaimehaom/hops",
"path": "/hops/__init__.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rnaimehaom/hops path: /hops/__init__.py
__all__ = ["features","data","plot","user","console"]
<|fim_suffix|>from . import features as features
from . import plot as plot
from . import console as console<|fim_middle|>from .observations import calc_features as calc_features
from .learner import Ma... | code_fim | medium | {
"lang": "python",
"repo": "rnaimehaom/hops",
"path": "/hops/__init__.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
main()<|fim_prefix|># repo: MattBajro/pynet path: /class9/mytest/whatever.py
#!/usr/bin/env python
def func3():
<|fim_middle|> print "Whatever func3"
def main():
print "Do something in Whatever"
| code_fim | medium | {
"lang": "python",
"repo": "MattBajro/pynet",
"path": "/class9/mytest/whatever.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MattBajro/pynet path: /class9/mytest/whatever.py
#!/usr/bin/env python
<|fim_suffix|>
def main():
print "Do something in Whatever"
if __name__ == "__main__":
main()<|fim_middle|>def func3():
print "Whatever func3"
| code_fim | easy | {
"lang": "python",
"repo": "MattBajro/pynet",
"path": "/class9/mytest/whatever.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "Do something in Whatever"
if __name__ == "__main__":
main()<|fim_prefix|># repo: MattBajro/pynet path: /class9/mytest/whatever.py
#!/usr/bin/env python
def func3():
print "Whatever func3"
<|fim_middle|>
def main():
| code_fim | easy | {
"lang": "python",
"repo": "MattBajro/pynet",
"path": "/class9/mytest/whatever.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: markrofail/multi-modal-deep-learning-for-vehicle-sensor-data-abstraction-and-attack-detection path: /src/regnet/data/kitti/image_rescale1.py
import configparser
import os
import numpy as np
from PIL import Image as im
from scipy.stats import entropy as entropy_helper
from tqdm import tqdm
from ... | code_fim | hard | {
"lang": "python",
"repo": "markrofail/multi-modal-deep-learning-for-vehicle-sensor-data-abstraction-and-attack-detection",
"path": "/src/regnet/data/kitti/image_rescale1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Information gain = before - after')
print("NEAREST gain =\t {:.4f} - {:.4f} = \t{:.4f}".format(ent,
ent_NEAREST,
diff_NEAREST
... | code_fim | hard | {
"lang": "python",
"repo": "markrofail/multi-modal-deep-learning-for-vehicle-sensor-data-abstraction-and-attack-detection",
"path": "/src/regnet/data/kitti/image_rescale1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: codwest/EMKD path: /utils/data_utils.py
import numpy as np
def cut_384(img):
"""
cut a 512*512 ct img to 385*384
:param img:
:return:
"""
if len(img.shape) > 2:
ret = img[:, 50:434, 60:444]
else:
ret = img[50:434, 60:444]
return ret
<|fim_suffix|... | code_fim | hard | {
"lang": "python",
"repo": "codwest/EMKD",
"path": "/utils/data_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
clip the pixel values into [lower_bound, upper_bound], and standardize them
"""
img = np.clip(img, lower_bound, upper_bound)
# x=x*2-1: map x to [-1,1]
img = 2 * (img - lower_bound) / (upper_bound - lower_bound) - 1
return img<|fim_prefix|># repo: codwest/EMKD path: /utils... | code_fim | hard | {
"lang": "python",
"repo": "codwest/EMKD",
"path": "/utils/data_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def window_standardize(img, lower_bound, upper_bound):
"""
clip the pixel values into [lower_bound, upper_bound], and standardize them
"""
img = np.clip(img, lower_bound, upper_bound)
# x=x*2-1: map x to [-1,1]
img = 2 * (img - lower_bound) / (upper_bound - lower_bound) - 1
re... | code_fim | medium | {
"lang": "python",
"repo": "codwest/EMKD",
"path": "/utils/data_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SteeleRobert/Transformer-XMC path: /datasets/label_embedding.py
#!/usr/bin/env python
# encoding: utf-8
import argparse
import os
import numpy as np
from sklearn.datasets import load_svmlight_file
import scipy.sparse as sp
import pickle
from sklearn.preprocessing import normalize
from tqdm impor... | code_fim | hard | {
"lang": "python",
"repo": "SteeleRobert/Transformer-XMC",
"path": "/datasets/label_embedding.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-d", "--dataset", type=str, required=True, help="dataset name: [ Eurlex-4K | Wiki10-31K | AmazonCat-13K | Wiki-500K ]"
)
parser.add_argument(
"-e", "--embed-type", type=str, required=True, h... | code_fim | hard | {
"lang": "python",
"repo": "SteeleRobert/Transformer-XMC",
"path": "/datasets/label_embedding.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = list(GameRoomDB.rooms.keys())
return data
def join_room(self, sid, room_name):
session = self.sio.get_session(sid)
if session['room_name'] is not None:
return _ack(IsInRoomError(session['room_name']))
connection = session['connection']
... | code_fim | hard | {
"lang": "python",
"repo": "VinhLoiIT/parcheesi",
"path": "/server/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> room = GameRoomDB.rooms[room_name]
if room.is_playing:
return _ack(IsPlayingError())
room.ready(session['connection'])
if room.is_able_to_start():
self.sio.start_background_task(room.start)
return _ack(NoError())
def command(self, sid... | code_fim | hard | {
"lang": "python",
"repo": "VinhLoiIT/parcheesi",
"path": "/server/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VinhLoiIT/parcheesi path: /server/server.py
from connection import PlayerConnection
from typing import List
from error import IsInRoomError, IsPlayingError, NoError, Status
from gamedb import GameRoomDB
from socketio import Server, WSGIApp
import eventlet
class ParcheesiServer:
MAX_CAPACIT... | code_fim | hard | {
"lang": "python",
"repo": "VinhLoiIT/parcheesi",
"path": "/server/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: goldfarb/Loudness path: /not_current/verbose.py
import subprocess
##PATH=../../../../cygwin64/usr/local/bin/ffmpeg/ffmpeg-20150702-git-03b2b40-win64-shared/bin:$PATH
log = open('full.txt', 'a')
import subprocess
week = ['08-03', '08-04', '08-05', '08-06', '08-07']
weekend = ['08-08', '08-09']
... | code_fim | hard | {
"lang": "python",
"repo": "goldfarb/Loudness",
"path": "/not_current/verbose.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in week:
print i
command = 'ffmpeg -nostats -i MultiCoder_SOAP_1_DCTECH-MC01X_'+i+'-2015_06-00-00.wav -filter_complex ebur128=framelog=verbose:peak=true -f null -'
c = subprocess.call(command, stdout=log, stderr=log, shell=True)
command = 'ffmpeg -nostats -i MultiCoder_SOAP_1_DCTECH-MC01X_'+i+... | code_fim | medium | {
"lang": "python",
"repo": "goldfarb/Loudness",
"path": "/not_current/verbose.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IMOKURI/Hungry-Geese path: /handyrl/envs/kaggle/hungry_geese.py
gle-environments/blob/master/LICENSE for details)
# wrapper of Hungry Geese environment from kaggle
import importlib
import random
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import to... | code_fim | hard | {
"lang": "python",
"repo": "IMOKURI/Hungry-Geese",
"path": "/handyrl/envs/kaggle/hungry_geese.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IMOKURI/Hungry-Geese path: /handyrl/envs/kaggle/hungry_geese.py
v2(h_v))
return {"policy": p, "value": v}
class RandomModel(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, _=None):
xh = x[:, 0, :]
h = torch.argmax(xh.sum(axis=2)... | code_fim | hard | {
"lang": "python",
"repo": "IMOKURI/Hungry-Geese",
"path": "/handyrl/envs/kaggle/hungry_geese.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # food
for pos in obs["food"]:
b[16, self.to_row(o_row, pos), self.to_col(o_col, pos)] = 1
return b
def observation_reverse_pos(self, player=None):
"""
尻尾から順番に 1, 0.9, 0.8, ... という並び
"""
if player is None:
player = 0
... | code_fim | hard | {
"lang": "python",
"repo": "IMOKURI/Hungry-Geese",
"path": "/handyrl/envs/kaggle/hungry_geese.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> can_be_written_as_Abundant = [False for i in range(0, limit+1)]
for i in range(0, len(abundant)):
for j in range(i, len(abundant)):
if(abundant[i] + abundant[j] <= limit):
can_be_written_as_Abundant[abundant[i]+abundant[j]] = True
else:
... | code_fim | hard | {
"lang": "python",
"repo": "bernardosequeir/CTFSolutions",
"path": "/project_euler/Problem23/p23.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bernardosequeir/CTFSolutions path: /project_euler/Problem23/p23.py
import math
def Sieve_E(upper_limit):
prime_bool = [True for i in range(upper_limit+1)]
prime_list = []
p = 2
while(p * p <= upper_limit):
if(prime_bool[p]):
for i in range(p*2, upper_limit +... | code_fim | hard | {
"lang": "python",
"repo": "bernardosequeir/CTFSolutions",
"path": "/project_euler/Problem23/p23.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ECSIM/opem path: /opem/Test/test_Amphlett.py
544028644916 W
VStack : 1.0724845597135508 V
Vcell : 1.0724845597135508 V
###########
I : 0.2
Enernst : 1.19075 V
Eta Activation : 0.1639764642376006 V
Eta Concentration : 3.90114074903386e-05 V
Eta Ohmic : 0.0003505137928660484 V
Loss : 0.164365989437... | code_fim | hard | {
"lang": "python",
"repo": "ECSIM/opem",
"path": "/opem/Test/test_Amphlett.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>91 V
Vcell : 0.895161422984791 V
###########
I : 1.5
Enernst : 1.19075 V
Eta Activation : 0.29741936073692266 V
Eta Concentration : 0.00029512586364904603 V
Eta Ohmic : 0.002640013349713048 V
Loss : 0.30035449995028474 V
PEM Efficiency : 0.5707663461857149
Power : 1.3355932500745729 W
Power-Stack : 1.3355... | code_fim | hard | {
"lang": "python",
"repo": "ECSIM/opem",
"path": "/opem/Test/test_Amphlett.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ECSIM/opem path: /opem/Test/test_Amphlett.py
00, A:30000000000, B:None, JMax:None)
>>> Eta_Ohmic_Calc(i,l,A,T,lambda_param)
[Error] Rho Calculation Failed (i:160000000, A:30000000000, T:20000000000, lambda:50000000000)
[Error] Eta Ohmic Calculation Failed (i:160000000, l:50000000000, A:3000000000... | code_fim | hard | {
"lang": "python",
"repo": "ECSIM/opem",
"path": "/opem/Test/test_Amphlett.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DTIC2019/NurcallEstacionEnfermeria path: /reinicioAutomatico.py
from HorariosEjecucionNurcallApp.HorariosProcesos import *
import sched, time
time.sleep(30)
s = sched.scheduler(time.time, time.sleep)
segundos = 20
import os
import os.path as path
nombreArchivo = "Reporte.nurcall"
def Envia... | code_fim | hard | {
"lang": "python",
"repo": "DTIC2019/NurcallEstacionEnfermeria",
"path": "/reinicioAutomatico.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for hora, minuto in horasReinicio:
if hour == hora and minute == minuto:
time.sleep(30)
os.system('sudo reboot')
for hora, minuto in horasBorrarFoto:
if hour == hora and minute == minuto:
time.sleep(30)
os.system("sudo rm -rf " + nom... | code_fim | hard | {
"lang": "python",
"repo": "DTIC2019/NurcallEstacionEnfermeria",
"path": "/reinicioAutomatico.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if path.exists(nombreArchivo):
try:
os.system("python3 EnviarFoto.py")
except Exception as inst:
print(type(inst))
print(inst.args)
print(inst)
print("No se pudo enviar la foto")
def do_something(sc):
hour = int(time.strf... | code_fim | medium | {
"lang": "python",
"repo": "DTIC2019/NurcallEstacionEnfermeria",
"path": "/reinicioAutomatico.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> except KeyError:
print('Warning: Course name-to-ID dict was not made with reference to ' + entry['code'])
isMissingReference = True
if isMissingReference:
print('Note: Usually the name-to-ID dict will only fail to make a reference to a course if it was not offered between 2011 and 2016')
print('Ed... | code_fim | hard | {
"lang": "python",
"repo": "claraqin/CoursePath",
"path": "/python_scripts/make_req_dict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: claraqin/CoursePath path: /python_scripts/make_req_dict.py
# Makes pre-requisite/co-requisite dictionary from Edusalsa's prereq JSON
# Updated so that keys are course IDs, not course names
# Relies on comprehensiveness of output from make_course_dicts.py
import json
import sys
isMissingReferenc... | code_fim | hard | {
"lang": "python",
"repo": "claraqin/CoursePath",
"path": "/python_scripts/make_req_dict.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>req_dict = {}
for line in sys.stdin:
entry = json.loads(line)
try:
key = course_name2id[entry['code']]
prereqs = [course_name2id[prereq] for prereq in entry['prereq']]
coreqs = [course_name2id[coreq] for coreq in entry['coreq']]
req_dict[key] = [prereqs, coreqs]
except KeyError:
print('Wa... | code_fim | medium | {
"lang": "python",
"repo": "claraqin/CoursePath",
"path": "/python_scripts/make_req_dict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: decentraminds/osmosis-streaming-driver path: /tests/test_data_plugin.py
# SPDX-License-Identifier: Apache-2.0
import pytest
from unittest import mock
from osmosis_streaming_driver.data_plugin import Plugin
from osmosis_driver_interface.exceptions import OsmosisError
from osmosis_streaming_driv... | code_fim | hard | {
"lang": "python",
"repo": "decentraminds/osmosis-streaming-driver",
"path": "/tests/test_data_plugin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert plugin.type() == 'Streaming'
@pytest.mark.xfail(raises=OsmosisError)
def test_generate_url_not_a_stream():
plugin.generate_url('https://not-a-wss-stream')
@mock.patch('requests.get', side_effect=mocked_requests_get)
def test_generate_url_valid_stream(mock_get):
stream_url = plugin.g... | code_fim | hard | {
"lang": "python",
"repo": "decentraminds/osmosis-streaming-driver",
"path": "/tests/test_data_plugin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hboshnak/batchwave path: /examples/nr_create_waveform_batch.py
"""
This example shows how to create multiple waveforms by sweeping various parameters.
"""
import wfmcreator
from wfmcreator import nr
carrier_counts = [1, 2, 4, 8]
channel_bandwidths = [20e6, 50e6, 100e6]
subcarrier_spacings = [30... | code_fim | hard | {
"lang": "python",
"repo": "hboshnak/batchwave",
"path": "/examples/nr_create_waveform_batch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># carrier
for num_carriers in carrier_counts:
del subblock.carriers
subblock.num_carriers = num_carriers
for bandwidth in channel_bandwidths:
for scs in subcarrier_spacings:
for modulation in modulation_schemes:
for carrier in subblock.carriers:
... | code_fim | hard | {
"lang": "python",
"repo": "hboshnak/batchwave",
"path": "/examples/nr_create_waveform_batch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # pdsch
pdsch = carrier.pdsch[0]
pdsch.rb_allocation = '0:last'
pdsch.slot_allocation = '0:last'
pdsch.symbol_allocation = '0:last'
pdsch.modulation_type = nr.PdschModulationType.QAM256
... | code_fim | hard | {
"lang": "python",
"repo": "hboshnak/batchwave",
"path": "/examples/nr_create_waveform_batch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dpdi-unifor/tahiti path: /migrations/versions/a13c4b5cc25f_updating_kmodes_in_spark_platform.py
"""Updating Kmodes in Spark platform
Revision ID: a13c4b5cc25f
Revises: 86699b2e6672
Create Date: 2020-09-21 09:05:00.976893
"""
from alembic import context
from alembic import op
from sqlalchemy im... | code_fim | hard | {
"lang": "python",
"repo": "dpdi-unifor/tahiti",
"path": "/migrations/versions/a13c4b5cc25f_updating_kmodes_in_spark_platform.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ctx = context.get_context()
session = sessionmaker(bind=ctx.bind)()
connection = session.connection()
try:
connection.execute('SET FOREIGN_KEY_CHECKS=0;')
for cmd in reversed(all_commands):
if isinstance(cmd[1], str):
connection.execute(cmd[1])
... | code_fim | hard | {
"lang": "python",
"repo": "dpdi-unifor/tahiti",
"path": "/migrations/versions/a13c4b5cc25f_updating_kmodes_in_spark_platform.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.parameter_view._remove_parameter_button_fired()
self.assertEqual(
self.parameter_view.selected_model_view,
self.parameter_view.model_views[0]
)
self.parameter_view._remove_parameter_button_fired()
self.assertIsNone(self.parameter_view.se... | code_fim | hard | {
"lang": "python",
"repo": "force-h2020/force-wfmanager",
"path": "/force_wfmanager/ui/setup/mco/tests/test_mco_parameter_view.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: force-h2020/force-wfmanager path: /force_wfmanager/ui/setup/mco/tests/test_mco_parameter_view.py
# (C) Copyright 2010-2020 Enthought, Inc., Austin, TX
# All rights reserved.
import unittest
from traits.testing.unittest_tools import UnittestTools
from force_bdss.api import InputSlotInfo
from... | code_fim | hard | {
"lang": "python",
"repo": "force-h2020/force-wfmanager",
"path": "/force_wfmanager/ui/setup/mco/tests/test_mco_parameter_view.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> parameter_model_view = self.parameter_view.model_views[1]
self.parameter_view.selected_model_view = parameter_model_view
self.parameter_view._remove_parameter_button_fired()
self.assertEqual(2, len(self.workflow.mco_model.parameters))
self.assertEqual(2, len(self.p... | code_fim | hard | {
"lang": "python",
"repo": "force-h2020/force-wfmanager",
"path": "/force_wfmanager/ui/setup/mco/tests/test_mco_parameter_view.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: themousepotato/unscrapulous path: /unscrapulous/scrapers/sebi_debarred_bse.py
#!/usr/bin/python
#-*- coding: utf-8 -*-
from unscrapulous.utils import *
PARENT_SOURCES = ['https://www.bseindia.com', 'https://www.bseindia.com/investors/']
SOURCE = 'https://www.bseindia.com/investors/debent.aspx'
... | code_fim | hard | {
"lang": "python",
"repo": "themousepotato/unscrapulous",
"path": "/unscrapulous/scrapers/sebi_debarred_bse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.