text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>job_2 = Job(2)
operation_21 = Operation(1, job_2.id)
operation_21.add_machine(Machine(1, 3))
operation_21.add_machine(Machine(3, 6))
operation_21.add_machine(Machine(5, 5))
job_2.add_operation(operation_21)
operation_22 = Operation(2, job_2.id)
operation_22.add_machine(Machine(1, 4))
operation_22.add_mac... | code_fim | medium | {
"lang": "python",
"repo": "share424/Flexible-Job-Shop-Scheduling-Problem",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: share424/Flexible-Job-Shop-Scheduling-Problem path: /test.py
from ga import GeneticAlgorithm, TwoPointCrossover, UniformCrossover, POXCrossover
from fjsp import FJSP, Problem, Job, Operation, Machine, save_as_fig
ga = GeneticAlgorithm()
<|fim_suffix|>problem = Problem([job_1, job_2], 5)
resourc... | code_fim | hard | {
"lang": "python",
"repo": "share424/Flexible-Job-Shop-Scheduling-Problem",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>problem = Problem([job_1, job_2], 5)
resources = ga.solve(problem)
save_as_fig('test.png', resources, width=10, height=5)
# p1 = [2, 2, 1, 3, 2, 4, 5, 3, 1, 5, 4, 3, 1, 2]
# p2 = [5, 1, 2, 1, 4, 3, 2, 5, 3, 2, 2, 1, 4, 3]
# co = POXCrossover()
# print(co.crossover(p1, p2))<|fim_prefix|># repo: share424/... | code_fim | hard | {
"lang": "python",
"repo": "share424/Flexible-Job-Shop-Scheduling-Problem",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>,
"heinous":14090,
"hip":10254,
"disputant":20671,
"aether":21653,
"antecedent":12197,
"castanets":20164,
"sidecar":31359,
"sailor":4310,
"upwind":30984,
"genealogist":23476,
"gaffe":32138,
"eddie":14652,
"portcullis":18151,
"pleural":26178,
"cage":6068,
"complained":4849,
"confirmed":2593,
"johnson":2584... | code_fim | hard | {
"lang": "python",
"repo": "virtualdvid/NLP",
"path": "/gapnlp/lg/word2int_en.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: virtualdvid/NLP path: /gapnlp/lg/word2int_en.py
plicate":26795,
"industries":8401,
"younger":2044,
"allegory":11630,
"stack":12246,
"curl":9682,
"aid":1316,
"theoretic":17730,
"protested":4262,
"translation":3481,
"passionately":6140,
"vocative":24172,
"cleft":9339,
"celadon":31437,
"bottle":2809... | code_fim | hard | {
"lang": "python",
"repo": "virtualdvid/NLP",
"path": "/gapnlp/lg/word2int_en.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>5563,
"togarmah":29118,
"wobble":23609,
"tzar":23118,
"chauffeur":10293,
"camouflaged":24577,
"follow":749,
"telegraph":5879,
"biophysics":32557,
"bush":3952,
"winch":19692,
"saxophone":23486,
"setting":2192,
"creditor":11689,
"assimilation":15127,
"vise":17695,
"impunity":9500,
"told":304,
"europe":1021,... | code_fim | hard | {
"lang": "python",
"repo": "virtualdvid/NLP",
"path": "/gapnlp/lg/word2int_en.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Si no le cobras la comision al cliente
d=y*(1-ct-i-(ct+i)*iva)
print("Si la comision no se la cobras al cliente obtienes: "+str(d))
# Si el pago no es a meses sin intereses
else:
print("Elegiste pago normal")
x=y/(1-ct-ct*iva)
print("Monto a cobrar para obtener "+str(y)+" pesos:"... | code_fim | medium | {
"lang": "python",
"repo": "jrtorresb/CLIP-example-python",
"path": "/Programa_Comisiones_Clip.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jrtorresb/CLIP-example-python path: /Programa_Comisiones_Clip.py
'''
******************************************************
*** Programa para el proyecto calculo de comisiones***
*** Realizado por José Roberto Torres Bello ***
*** Noviembre 2019 ***
***... | code_fim | hard | {
"lang": "python",
"repo": "jrtorresb/CLIP-example-python",
"path": "/Programa_Comisiones_Clip.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> res_dict = {'cols': cols, 'error': error, 'time': t}
base_str = 'error {error:.4f}; time {time:.2f}; cols {cols}'
print(base_str.format(**res_dict))
if interval is not None and ncols <= 10:
colors = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99',
'#e31a1c... | code_fim | hard | {
"lang": "python",
"repo": "marianotepper/csnmf",
"path": "/csnmf/tests/test_movies.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marianotepper/csnmf path: /csnmf/tests/test_movies.py
"""
Copyright (c) 2015, Mariano Tepper, Duke University.
All rights reserved.
This file is part of RCNMF and is under the BSD 3-Clause License,
which can be found in the LICENSE file in the root directory, or at
http://opensour... | code_fim | hard | {
"lang": "python",
"repo": "marianotepper/csnmf",
"path": "/csnmf/tests/test_movies.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''
Report on number of transacations that invalidate many objects.
$ sudo -u encoded psql -tAc "select row_to_json(transactions) from transactions where timestamp::date = '2016-01-20'::date;" > transactions.txt
Beware that reverse link invalidations are entered into the transaction log, so any change... | code_fim | hard | {
"lang": "python",
"repo": "ENCODE-DCC/encoded",
"path": "/scripts/blackholes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Beware that reverse link invalidations are entered into the transaction log, so any changes will not be reflected.
'''
transactions = [json.loads(line) for line in open('transactions.txt')]
sum_txn = [(sum(uuid_row[uuid]['embeds'] for uuid in txn['data']['updated']), txn) for txn in transactions]
print(... | code_fim | hard | {
"lang": "python",
"repo": "ENCODE-DCC/encoded",
"path": "/scripts/blackholes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ENCODE-DCC/encoded path: /scripts/blackholes.py
'''
Report on 'blackhole' objects, those which are embedded in over many other objects.
Care should be taken with the reverse links from blackhole objects.
'''
from collections import defaultdict
import json
rows = [json.loads(line) for line in ... | code_fim | hard | {
"lang": "python",
"repo": "ENCODE-DCC/encoded",
"path": "/scripts/blackholes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if os.path.exists(jar_path):
shutil.rmtree(jar_path)
self.reader = BarCodeReader()
self.reader = BarCodeReader()<|fim_prefix|># repo: sunfuhong/pyzxing path: /src/test_create_reader.py
import os
import shutil
import unittest
from pyzxing import BarCodeReader
from pyzxi... | code_fim | hard | {
"lang": "python",
"repo": "sunfuhong/pyzxing",
"path": "/src/test_create_reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunfuhong/pyzxing path: /src/test_create_reader.py
import os
import shutil
import unittest
from pyzxing import BarCodeReader
from pyzxing.reader import jar_filename, jar_path
class TestCreateBarCodeReader(unittest.TestCase):
def test_create_reader_no_local(self):
<|fim_suffix|> if os... | code_fim | medium | {
"lang": "python",
"repo": "sunfuhong/pyzxing",
"path": "/src/test_create_reader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('core', '0002_auto_20210702_1942'),
('orders', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='discount',
name='company',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CA... | code_fim | medium | {
"lang": "python",
"repo": "hamzabell/syeta_collections_api",
"path": "/api/orders/migrations/0002_auto_20210705_0609.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hamzabell/syeta_collections_api path: /api/orders/migrations/0002_auto_20210705_0609.py
# Generated by Django 3.1.3 on 2021-07-05 06:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
mig... | code_fim | medium | {
"lang": "python",
"repo": "hamzabell/syeta_collections_api",
"path": "/api/orders/migrations/0002_auto_20210705_0609.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> A1 = Id('A') >> norm(loc=0, scale=1)
A0 = Id('A') >> norm(loc=0, scale=1)
B = Id('B') >> norm(loc=0, scale=1)
B1 = Id('B') >> norm(loc=0, scale=1)
B0 = Id('B') >> norm(loc=0, scale=1)
C = Id('C') >> norm(loc=0, scale=1)
C1 = Id('C') >> norm(loc=0, scale=1)
D = Id('D') >> no... | code_fim | hard | {
"lang": "python",
"repo": "danhlephuoc/sppl",
"path": "/tests/test_sum_simplify.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danhlephuoc/sppl path: /tests/test_sum_simplify.py
# Copyright 2020 MIT Probabilistic Computing Project.
# See LICENSE.txt
from math import log
from sppl.distributions import gamma
from sppl.distributions import norm
from sppl.math_util import allclose
from sppl.spe import ProductSPE
from sppl.... | code_fim | hard | {
"lang": "python",
"repo": "danhlephuoc/sppl",
"path": "/tests/test_sum_simplify.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ssc0 = spe_simplified.children[0]
assert isinstance(ssc0.children[1], ProductSPE)
assert ssc0.children[1].children == (A0, B0, C1)
assert isinstance(ssc0.children[0], ProductSPE)
assert ssc0.children[0].children[1] == C
ssc0c0 = ssc0.children[0].children[0]
assert isinstance(... | code_fim | hard | {
"lang": "python",
"repo": "danhlephuoc/sppl",
"path": "/tests/test_sum_simplify.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ResNet(nn.Module):
def __init__(self, ResidualBlock, num_classes=64):
super(ResNet, self).__init__()
self.inchannel = 64
self.conv1 = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1, bias=False),
nn.BatchNorm2d(64),
n... | code_fim | hard | {
"lang": "python",
"repo": "EpicTrol/SCNU-AiMatch",
"path": "/captcha_resnet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EpicTrol/SCNU-AiMatch path: /captcha_resnet.py
import torch.nn as nn
from torchvision import models
import torch.nn.functional as F
from captcha_setting import *
'''torchvision内置ResNet,准确率只有73%'''
# class ResNet18(nn.Module):
# def __init__(self):
# super(ResNet18, self).__init__()
#... | code_fim | hard | {
"lang": "python",
"repo": "EpicTrol/SCNU-AiMatch",
"path": "/captcha_resnet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>nt(f'Velocidade a cima do permitido. Multa de R${multa:.2f}')
else:
print('Velocidade dentro do permitido')<|fim_prefix|># repo: MarcosRibas/Projeto100Exercicios path: /Python/ex029.py
"""Ex029 Escreva um programa que leia a velocidade de um carro.
Se ele ultrapassar 80km/h, mostre uma mensagem <|fim... | code_fim | hard | {
"lang": "python",
"repo": "MarcosRibas/Projeto100Exercicios",
"path": "/Python/ex029.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MarcosRibas/Projeto100Exercicios path: /Python/ex029.py
"""Ex029 Escreva um programa que leia a velocidade de um carro.
Se ele ultrapassar 80km/h, mostre uma mensagem <|fim_suffix|>nt(f'Velocidade a cima do permitido. Multa de R${multa:.2f}')
else:
print('Velocidade dentro do permitido')<|fim... | code_fim | hard | {
"lang": "python",
"repo": "MarcosRibas/Projeto100Exercicios",
"path": "/Python/ex029.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>TRONICO------')
vel = int(input('Velocidade do carro(km/h): '))
if vel > 80:
multa = (vel - 80) * 7
print(f'Velocidade a cima do permitido. Multa de R${multa:.2f}')
else:
print('Velocidade dentro do permitido')<|fim_prefix|># repo: MarcosRibas/Projeto100Exercicios path: /Python/ex029.py
"""Ex... | code_fim | medium | {
"lang": "python",
"repo": "MarcosRibas/Projeto100Exercicios",
"path": "/Python/ex029.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from dazl import LOG, Network
import pytest
@pytest.mark.asyncio
async def test_startup_errors_should_halt_ready():
"""
Ensure that a failure to connect aborts ready futures.
"""
network = Network()
network.set_config(url="http://nowhere.at.all.localdomain:6865/", connect_timeout=1)
... | code_fim | medium | {
"lang": "python",
"repo": "digital-asset/dazl-client",
"path": "/python/tests/unit/test_startup_errors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
await f
raise AssertionError(
"client.ready() should not have ended because there is nothing to connect to"
)
except asyncio.TimeoutError:
raise AssertionError(
"client.ready() did not abort with an appropriate exception and was killed b... | code_fim | medium | {
"lang": "python",
"repo": "digital-asset/dazl-client",
"path": "/python/tests/unit/test_startup_errors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: digital-asset/dazl-client path: /python/tests/unit/test_startup_errors.py
# Copyright (c) 2017-2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import asyncio
from asyncio import CancelledE... | code_fim | medium | {
"lang": "python",
"repo": "digital-asset/dazl-client",
"path": "/python/tests/unit/test_startup_errors.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lazytype/ent path: /examples/todo-sqlite/src/schema/versions/9cb0712ecc8f_202161654454_add_tags_table_add_index_tags_owner_id_.py
# Code generated by github.com/lolopinto/ent/ent, DO NOT edit.
"""add tags table
add index tags_owner_id_idx to tags
Revision ID: 9cb0712ecc8f
Revises: f5df9362a90e
... | code_fim | hard | {
"lang": "python",
"repo": "lazytype/ent",
"path": "/examples/todo-sqlite/src/schema/versions/9cb0712ecc8f_202161654454_add_tags_table_add_index_tags_owner_id_.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('tags_owner_id_idx', table_name='tags')
op.drop_table('tags')
# ### end Alembic commands ###<|fim_prefix|># repo: lazytype/ent path: /examples/todo-sqlite/src/schema/versions/9cb0712ecc8f_20216165... | code_fim | hard | {
"lang": "python",
"repo": "lazytype/ent",
"path": "/examples/todo-sqlite/src/schema/versions/9cb0712ecc8f_202161654454_add_tags_table_add_index_tags_owner_id_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return args
def main(args):
""" parameters """
n_hidden = args.n_hidden
dim_z = args.dim_z
train_total_data, split_numbers, train_size,\
validation_data, validation_labels, validation_c,\
test_data, test_labels, test_c = \
joblib.load( args.augmented_data_path )
n_samples = train... | code_fim | hard | {
"lang": "python",
"repo": "gregversteeg/inv-rep",
"path": "/src/eval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gregversteeg/inv-rep path: /src/eval.py
import tensorflow as tf
import numpy as np
import os
import na_vib
import error_utils
import glob
import csv
import joblib
import argparse
"""parsing and configuration"""
def parse_args():
desc = "Tensorflow implementation of 'Variational AutoEncoder... | code_fim | hard | {
"lang": "python",
"repo": "gregversteeg/inv-rep",
"path": "/src/eval.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mebristo/station-b-libraries path: /PyStationB/projects/CellSignalling/cellsig_pipeline/structure.py
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). Se... | code_fim | hard | {
"lang": "python",
"repo": "mebristo/station-b-libraries",
"path": "/PyStationB/projects/CellSignalling/cellsig_pipeline/structure.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Path to the config with data retrieval and preprocessing settings, for a given experimental track."""
return experiment_dir(experiment_name) / DATA_CONFIG
def data_characterization_dir(experiment_name: str) -> Path: # pragma: no cover
"""Directory where we store the data after characteri... | code_fim | hard | {
"lang": "python",
"repo": "mebristo/station-b-libraries",
"path": "/PyStationB/projects/CellSignalling/cellsig_pipeline/structure.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Max of dataset: " + str(max(dset)))
print("Min of dataset: " + str(min(dset)))
# Determined that initial 0 values are noise because of .....???
# They may not be noise. They may be noise. You may need to make your own determination of what is and isn't noise
# How do you determine what's noise? Gr... | code_fim | hard | {
"lang": "python",
"repo": "devYaoYH/hackillinois_2020",
"path": "/example_histogram.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devYaoYH/hackillinois_2020 path: /example_histogram.py
import h5py
import os
import numpy as np
import matplotlib.pyplot as plt
cwd = os.getcwd()
#Open the data file
filepath = cwd + '\\demo.hdf'
f = h5py.File(filepath, 'r')
<|fim_suffix|># Determined that initial 0 values are noise because of ... | code_fim | hard | {
"lang": "python",
"repo": "devYaoYH/hackillinois_2020",
"path": "/example_histogram.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deyh2020/wtDigiTwin path: /wtDigiTwin/kalman/kalman.py
import numpy as np
import unittest
from scipy.linalg import expm
def EstimateKFTimeStep(u1,y1,z0,Xxd,Xud,Yx,Yu,P0,Q,R):
""" Performs one time step of Kalman filter estimation
INPUTS:
u1: inputs at time n
y1: measuremen... | code_fim | hard | {
"lang": "python",
"repo": "deyh2020/wtDigiTwin",
"path": "/wtDigiTwin/kalman/kalman.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_build_shaftonly(self):
# Build continuous matrices for the "Shaft only" case
np.set_printoptions(linewidth=500)
nDOF_2nd = 1 # Mech DOFs : q = [psi]
nDOF_1st = 2*nDOF_2nd # Mech state : x = [psi,psi_dot]
nP = 2 # E... | code_fim | hard | {
"lang": "python",
"repo": "deyh2020/wtDigiTwin",
"path": "/wtDigiTwin/kalman/kalman.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# --------------------------------------------------------------------------------}
# --- TESTS
# --------------------------------------------------------------------------------{
class Test(unittest.TestCase):
def test_discretize_exp(self):
# Discretize a continuous system using the exponen... | code_fim | hard | {
"lang": "python",
"repo": "deyh2020/wtDigiTwin",
"path": "/wtDigiTwin/kalman/kalman.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert not dash_duo.get_logs()
def test_cbmo003_multi_all(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(
children=[
html.Button("items", id="items"),
html.Button("values", id="values"),
html.Div(id="content1"),
html.Hr(),
... | code_fim | hard | {
"lang": "python",
"repo": "pikhovkin/dj-plotly-dash",
"path": "/tests/dj_project/tests/integration/callbacks/test_missing_outputs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pikhovkin/dj-plotly-dash path: /tests/dj_project/tests/integration/callbacks/test_missing_outputs.py
import pytest
import dash_html_components as html
# import dash_core_components as dcc
import dash
from dash.dependencies import Input, Output, ALL, MATCH
from dash.testing.plugin import *
from ... | code_fim | hard | {
"lang": "python",
"repo": "pikhovkin/dj-plotly-dash",
"path": "/tests/dj_project/tests/integration/callbacks/test_missing_outputs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return sum(ci) + sum(cj)
class DashView(BaseDashView):
dash = app
dash_duo.start_server(DashView)
dash_duo.wait_for_text_to_equal("#content1", "0\n0")
dash_duo.wait_for_text_to_equal("#content2", "")
dash_duo.wait_for_text_to_equal("#output", "0")
actions = [
... | code_fim | hard | {
"lang": "python",
"repo": "pikhovkin/dj-plotly-dash",
"path": "/tests/dj_project/tests/integration/callbacks/test_missing_outputs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # a workflow is defined by overloading the WorkflowRunner.workflow() method:
#
def workflow(self) :
#
# The output for this task will be written to the file helloWorld.out.txt
#
self.addTask("easy_task1", "echo 'Hello World!' > helloWorld.out.txt")
# Instant... | code_fim | medium | {
"lang": "python",
"repo": "jsnedecor/pyflow",
"path": "/pyflow/demo/helloWorld/helloWorld.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsnedecor/pyflow path: /pyflow/demo/helloWorld/helloWorld.py
#!/usr/bin/env python
#
# pyFlow - a lightweight parallel task engine
#
# Copyright (c) 2012-2017 Illumina, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted... | code_fim | medium | {
"lang": "python",
"repo": "jsnedecor/pyflow",
"path": "/pyflow/demo/helloWorld/helloWorld.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> #
# The output for this task will be written to the file helloWorld.out.txt
#
self.addTask("easy_task1", "echo 'Hello World!' > helloWorld.out.txt")
# Instantiate the workflow
#
wflow = HelloWorkflow()
# Run the worklow:
#
retval = wflow.run()
# done!
sys.exit(retval)<... | code_fim | hard | {
"lang": "python",
"repo": "jsnedecor/pyflow",
"path": "/pyflow/demo/helloWorld/helloWorld.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> out_file : str, optional
Path to an image file to save the output to. Must be compatible with
:class:`rasterio.DatasetReader`. If provided, a `reference_im` must be
provided (for metadata purposes).
reference_im : :class:`rasterio.DatasetReader` or `str`, optional
A... | code_fim | hard | {
"lang": "python",
"repo": "aws-samples/aws-open-data-satellite-lidar-tutorial",
"path": "/libs/solaris/vector/mask.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aws-samples/aws-open-data-satellite-lidar-tutorial path: /libs/solaris/vector/mask.py
vided,
`affine_obj` and `shape` are ignored.
geom_col : str, optional
The column containing geometries in `df`. Defaults to ``"geometry"``.
do_transform : bool, optional
Should th... | code_fim | hard | {
"lang": "python",
"repo": "aws-samples/aws-open-data-satellite-lidar-tutorial",
"path": "/libs/solaris/vector/mask.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
if out_file and not reference_im:
raise ValueError(
'If saving output to file, `reference_im` must be provided.')
if reference_im:
reference_im = _check_rasterio_im_load(reference_im)
# need to have a footprint mask for this function, so make it if not given... | code_fim | hard | {
"lang": "python",
"repo": "aws-samples/aws-open-data-satellite-lidar-tutorial",
"path": "/libs/solaris/vector/mask.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>Map.setCenter(-78, 36, 8)
Map.addLayer(empty.paint(dataset, 0, 2), {}, 'Landsat WRS-2 grid')
# Display the map.
Map<|fim_prefix|># repo: xiangtaoxu/earthengine-py-examples path: /Datasets/Vectors/landsat_wrs2_grid.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(cente... | code_fim | medium | {
"lang": "python",
"repo": "xiangtaoxu/earthengine-py-examples",
"path": "/Datasets/Vectors/landsat_wrs2_grid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiangtaoxu/earthengine-py-examples path: /Datasets/Vectors/landsat_wrs2_grid.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
<|fim_suffix|>Map.setCenter(-78, 36, 8)
Map.addLayer(empty.paint(dataset, 0, 2), {}, 'Landsat WRS-2 grid')... | code_fim | medium | {
"lang": "python",
"repo": "xiangtaoxu/earthengine-py-examples",
"path": "/Datasets/Vectors/landsat_wrs2_grid.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def build_embedding(vocab_path, model_path):
vector = KeyedVectors.load_word2vec_format(QA_WORD2VEC_BIN_PATH, binary=True)
w2i, _ = read_vocab(vocab_path)
vocab_size = len(w2i)
vector_size = vector.vector_size
embedding = {}
count = 0
for v, i in w2i.items():
tr... | code_fim | hard | {
"lang": "python",
"repo": "dulingkang/NLP-QA-Reason",
"path": "/preprocess/build_w2v.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dulingkang/NLP-QA-Reason path: /preprocess/build_w2v.py
import numpy as np
from optparse import OptionParser
from gensim.models import Word2Vec
from gensim.models.word2vec import LineSentence
from gensim.models.keyedvectors import KeyedVectors
import os, sys, inspect
currentdir = os.p... | code_fim | hard | {
"lang": "python",
"repo": "dulingkang/NLP-QA-Reason",
"path": "/preprocess/build_w2v.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joeyespo/aspen-python path: /aspen/exceptions.py
"""
Exceptions used by Aspen
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
class LoadError(Exception):
"""Represent a problem loading a... | code_fim | easy | {
"lang": "python",
"repo": "joeyespo/aspen-python",
"path": "/aspen/exceptions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class CRLFInjection(Exception):
def __str__(self):
return "Possible CRLF injection detected."<|fim_prefix|># repo: joeyespo/aspen-python path: /aspen/exceptions.py
"""
Exceptions used by Aspen
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import p... | code_fim | medium | {
"lang": "python",
"repo": "joeyespo/aspen-python",
"path": "/aspen/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Represent a problem loading a resource.
"""
# Define this here to avoid import issues when json doesn't exist.
class CRLFInjection(Exception):
def __str__(self):
return "Possible CRLF injection detected."<|fim_prefix|># repo: joeyespo/aspen-python path: /aspen/exceptions.py
"... | code_fim | easy | {
"lang": "python",
"repo": "joeyespo/aspen-python",
"path": "/aspen/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: realAyinde/tweets-to-text path: /tweets2text/handlers.py
import re
from django.contrib.sites.models import Site
from django.db import IntegrityError
from django.utils import timezone
from tweets2text.models import (
AccountActivity, FollowHistory, TweetTextCompilation
)
from zappa.asynchronou... | code_fim | hard | {
"lang": "python",
"repo": "realAyinde/tweets-to-text",
"path": "/tweets2text/handlers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for dm in activity.direct_message_events:
if dm.type == 'message_create':
m_data = dm.message_create['message_data']
try:
url = m_data["entities"]["urls"][0]["expanded_url"]
except (KeyError, IndexError):
pass
else... | code_fim | hard | {
"lang": "python",
"repo": "realAyinde/tweets-to-text",
"path": "/tweets2text/handlers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
array(np.array): the array of Cartesian products
"""
length = len(arrays)
dtype = np.result_type(*arrays)
arr = np.empty([len(a) for a in arrays] + [length], dtype=dtype)
for idx, array in enumerate(np.ix_(*arrays)):
arr[...,idx] = array
return arr.resh... | code_fim | hard | {
"lang": "python",
"repo": "analyticalmindsltd/smote_variants",
"path": "/smote_variants/base/_simplexsampling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: analyticalmindsltd/smote_variants path: /smote_variants/base/_simplexsampling.py
f add_samples(*,
pairs,
counts,
count,
X,
X_vertices,
vertex_weights=None):
"""
Create samples for 'count' split... | code_fim | hard | {
"lang": "python",
"repo": "analyticalmindsltd/smote_variants",
"path": "/smote_variants/base/_simplexsampling.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #if 'ANS' in self.__class__.__name__:
# print(os.getpid(), "vvv", len(weights))
choices = np.arange(all_simplices.shape[0])
if self.simplex_sampling != 'deterministic':
# sample the simplices
selected_indices = self.random_state.choice(choices,
... | code_fim | hard | {
"lang": "python",
"repo": "analyticalmindsltd/smote_variants",
"path": "/smote_variants/base/_simplexsampling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saswat0/inzpeech path: /ResNet/run_model.py
import os
import glob
import torch
import librosa
import numpy as np
import pandas as pd
import scipy.signal as signal
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
from model import Net_ResNet50
from torch.utils.... | code_fim | hard | {
"lang": "python",
"repo": "saswat0/inzpeech",
"path": "/ResNet/run_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> hop_len = int(sample_rate * hop_time)
melspectrogram = librosa.feature.melspectrogram(y=librosa.effects.preemphasis(y),
sr=sample_rate,
n_mels=40,
... | code_fim | hard | {
"lang": "python",
"repo": "saswat0/inzpeech",
"path": "/ResNet/run_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Retrieve properties.
Retrieve properties using PropertyCollector.RetrievePropertiesEx
and PropertyCollector.ContinueRetrievePropertiesEx
args:
:param vim: Vim object
:param prop_coll: PropertyCollector MOR
:param max_count: Max num of objects returned in a single call.
... | code_fim | hard | {
"lang": "python",
"repo": "Mirantis/vmware-dvs",
"path": "/networking_vsphere/utils/vim_util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not collector:
collector = vim.service_content.propertyCollector
return vim.CreatePropertyCollector(collector)
def destroy_property_collector(vim, collector):
if collector:
return vim.DestroyPropertyCollector(collector)
def wait_for_updates_ex(vim, version, collector=Non... | code_fim | hard | {
"lang": "python",
"repo": "Mirantis/vmware-dvs",
"path": "/networking_vsphere/utils/vim_util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>v = 4 * mathfont.em
f = mathfont.create("stack-displaystylegapmin%d" % v,
"Copyright (c) 2016 MathML Association")
f.math.AxisHeight = 0
f.math.StackBottomDisplayStyleShiftDown = 0
f.math.StackBottomShiftDown = 0
f.math.StackDisplayStyleGapMin = v
f.math.StackGapMin = 0
f.math.StackTop... | code_fim | hard | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/third_party/blink/web_tests/external/wpt/mathml/tools/stacks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># strict={'case': False, 'type': False, 'map': False},
# fixup=False
"""Return the numeric representation of levelName.
see getLevelName() for background
"""
try:
result = logging._nameToLevel.get(levelName)
if result is not None:
return r... | code_fim | hard | {
"lang": "python",
"repo": "tb3088/yamlreader",
"path": "/src/main/python/yamlreader/logging.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>contents = bytearray(128)
contents[0:8] = 'PLUS3DOS'.encode('ASCII') # +3DOS signature
contents[8] = 0x1A
contents[9:11] = [0x01, 0x00] # Issue and Version
contents += bytearray((0x00, 0x0A)) # Line number 10
contents += struct.pack('<H', len(command)) ... | code_fim | hard | {
"lang": "python",
"repo": "shred/nextskeleton",
"path": "/skeleton/tools/makeautoexec.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># raising an exception
@micropython.viper
def viper_raise(x:int):
raise OSError(x)
try:
viper_raise(1)
except OSError as e:
print(repr(e))
# this doesn't work at the moment
#@micropython.viper
#def g() -> uint:
# return -1
# calling GC after defining the function
@micropyth... | code_fim | hard | {
"lang": "python",
"repo": "jiapei100/Stereo",
"path": "/micropython/tests/micropython/viper_misc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>import argparse
parser=argparse.ArgumentParser()
parser.add_argument('--in_dir', default='.', help='input glob str')
parser.add_argument('-c', '--config', type=str, default='config/config.yaml',
help="yaml file for configuration")
parser.add_argument('--out', default='.', help='output... | code_fim | hard | {
"lang": "python",
"repo": "deciding/Voicefilter",
"path": "/tfrecord_producer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> db_name = input_db_name(conn)
nlq = input_nlq()
num_cols = input_num_cols()
tsq = TableSketchQuery(num_cols)
tsq.types = input_tsq_types(num_cols)
tsq_row_count = input_tsq_row_count()
for i in range(tsq_row_count):
tsq.values.append(input_tsq_row(i+1, tsq.types))
... | code_fim | hard | {
"lang": "python",
"repo": "umich-dbgroup/duoquest",
"path": "/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_folds = int(n_folds)
if n_folds <= 1:
raise ValueError('k-fold cross-validation requires at least one '
'train/test split by setting n_folds=2 or more')
if shuffle not in [True, False]:
raise TypeError('shuffle must be True or... | code_fim | hard | {
"lang": "python",
"repo": "vedraiyani/skutil",
"path": "/skutil/h2o/split.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vedraiyani/skutil path: /skutil/h2o/split.py
elif np.asarray(test_size).dtype.kind != 'i':
raise ValueError('Invalid value for test_size: %r' % test_size)
if train_size is not None:
if np.asarray(train_size).dtype.kind == 'f':
if train_size >= 1.:
... | code_fim | hard | {
"lang": "python",
"repo": "vedraiyani/skutil",
"path": "/skutil/h2o/split.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vedraiyani/skutil path: /skutil/h2o/split.py
type.kind != 'i':
raise ValueError('Invalid value for test_size: %r' % test_size)
if train_size is not None:
if np.asarray(train_size).dtype.kind == 'f':
if train_size >= 1.:
raise ValueError(
... | code_fim | hard | {
"lang": "python",
"repo": "vedraiyani/skutil",
"path": "/skutil/h2o/split.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>#veldisp = sqrt( confidenceRegion[0][0] * 4.3e-09 / (3*r500x) )
#veldisperr = (veldisp / 2) * ((confidenceRegion[1][0]+confidenceRegion[2][0])/confidenceRegion[0][0])
#
output = open(filebase+"_sisfit.ml.dat", 'w')
samples = array(samples)
samples[samples < 0] = 0.
veldispersions = sqrt(samples)
vel... | code_fim | hard | {
"lang": "python",
"repo": "arwright3/wtgpipeline",
"path": "/fit_SIS.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> curr = [0, 0]
def nbytes(n):
curr[0], curr[1] = curr[1], curr[1] + n
return data[curr[0]: curr[1]]
remaining_data = len(data)
if remaining_data > 0:
threading.Thread(target=PacketSender.await_acks, args=(conn,)).start()
# While ... | code_fim | hard | {
"lang": "python",
"repo": "lingt-xyz/Data-Communications-Computer-Networks",
"path": "/A3/A3_V1/packetSender.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while not packet.seq_num in PacketSender.acked_packets and not PacketSender.was_reset:
print("starting resend loop")
time.sleep(0.5)
acked_packets_lock.acquire()
if not packet.seq_num in PacketSender.acked_packets and not PacketSender.was_reset:
... | code_fim | hard | {
"lang": "python",
"repo": "lingt-xyz/Data-Communications-Computer-Networks",
"path": "/A3/A3_V1/packetSender.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> file_out.write(str(case)+','+str(average)+'\n')
#print(str(case)+','+str(average)+'\n')
line = file_test.readline()
case += 1
file_test.close()
file_out.close()
print('test complete')<|fim_prefix|># repo: det-tu/HFTP path: /test_multi.py
import torch
import torch.nn.functional as F
impo... | code_fim | hard | {
"lang": "python",
"repo": "det-tu/HFTP",
"path": "/test_multi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while case <= 153:
x = torch.FloatTensor(40).zero_()
y = torch.FloatTensor(20).zero_()
for ct in range(10):
line = file_test.readline()
if line == '':
break
line = line.split(',')
x[ct*4] = float(line[6])
x[ct*4+1] = float(line[7])/10000
... | code_fim | hard | {
"lang": "python",
"repo": "det-tu/HFTP",
"path": "/test_multi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: int-brain-lab/ibllib path: /ibllib/tests/extractors/test_extractors.py
SIONS
choice = biased_trials.Choice(
session_path=self.biased_lt5['path']).extract(save=False)[0]
self.assertTrue(isinstance(choice, np.ndarray))
data = raw.load_data(self.biased_lt5['path']... | code_fim | hard | {
"lang": "python",
"repo": "int-brain-lab/ibllib",
"path": "/ibllib/tests/extractors/test_extractors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # BIASED SESSIONS
st = biased_trials.StimOnTimes_deprecated(
self.biased_ge5['path']).extract()[0]
self.assertTrue(isinstance(st, np.ndarray))
def test_stimOnOffFreeze_times(self):
# TRAINING SESSIONS
st = training_trials.StimOnOffFreezeTimes(
... | code_fim | hard | {
"lang": "python",
"repo": "int-brain-lab/ibllib",
"path": "/ibllib/tests/extractors/test_extractors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: int-brain-lab/ibllib path: /ibllib/tests/extractors/test_extractors.py
th']).extract(save=False)[0]
self.assertTrue(isinstance(choice, np.ndarray))
data = raw.load_data(self.training_lt5['path'])
trial_nogo = np.array(
[~np.isnan(t['behavior_data']['States time... | code_fim | hard | {
"lang": "python",
"repo": "int-brain-lab/ibllib",
"path": "/ibllib/tests/extractors/test_extractors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, config, osc=None):
super(ParallelMigrationStrategy, self).__init__(config, osc)
def pre_execute(self):
pass
def do_execute(self):
params = self.input_parameters.params
for key, value in params.iteritems():
for resource_id, dict i... | code_fim | hard | {
"lang": "python",
"repo": "nec-openstack/watcher-zone-migration-plugin",
"path": "/zone_migration/strategy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
@classmethod
def get_goal_name(cls):
return "zone_migration"
@classmethod
def get_name(cls):
return "parallel_migration"
@classmethod
def get_display_name(cls):
return _("Parallel migration strategy")
@classmethod
def get_translatabl... | code_fim | hard | {
"lang": "python",
"repo": "nec-openstack/watcher-zone-migration-plugin",
"path": "/zone_migration/strategy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not d:
return None
o = AlipayInsSceneEcommerceInsureCheckModel()
if 'insure_admit_dto_list' in d:
o.insure_admit_dto_list = d['insure_admit_dto_list']
if 'partner_org_id' in d:
o.partner_org_id = d['partner_org_id']
if 'product... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/AlipayInsSceneEcommerceInsureCheckModel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def to_alipay_dict(self):
params = dict()
if self.insure_admit_dto_list:
if isinstance(self.insure_admit_dto_list, list):
for i in range(0, len(self.insure_admit_dto_list)):
element = self.insure_admit_dto_list[i]
if ... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/AlipayInsSceneEcommerceInsureCheckModel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Get output (can be multi-line)
outputLine = mockprogramInoutArray[2]
if outputLine.find("MOCK_PROGRAM_OUTPUT:") != 0:
print("Error, third line = '" + outputLine + "', does not match "
"^MOCK_PROGRAM_OUTPUT:")
sys.exit(6)
outputStr = outputLine.replace("MOCK_PROGRAM_OUTPUT: ", "")
numLinesOu... | code_fim | hard | {
"lang": "python",
"repo": "TriBITSPub/TriBITS",
"path": "/tribits/python_utils/mockprogram.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>inputArgs = ' '.join(sys.argv[1:])
#print("inputArgs = '" + inputArgs + "'"
if os.environ.get("MOCKPROGRAM_INOUT_FILE_OVERRIDE"):
mockProgramInOutFilePath=os.environ.get("MOCKPROGRAM_INOUT_FILE_OVERRIDE")
else:
mockProgramInOutFilePath='.mockprogram_inout.txt'
if not os.path.exists(mockProgramInOutF... | code_fim | hard | {
"lang": "python",
"repo": "TriBITSPub/TriBITS",
"path": "/tribits/python_utils/mockprogram.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>me, ext = os.path.splitext(file)
ext = ext[::-1][:-1][::-1]
if os.path.exists(os.path.join(DIR, ext.upper())):
shutil.move(os.path.join(DIR, file), os.path.join(DIR, ext.upper(), file))
else:
os.mkdir(os.path.join(DIR, ext.upper()))
shutil.move(o... | code_fim | medium | {
"lang": "python",
"repo": "PradyumnVikram/Directory-Sorter",
"path": "/sort_directory.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Do the actual building of the documentation.
"""
raise NotImplementedError
def move(self):
"""
Move the documentation from it's generated place to its final home.
This needs to understand both a single server dev environment,
as wel... | code_fim | hard | {
"lang": "python",
"repo": "thomaspurchas/readthedocs.org",
"path": "/readthedocs/doc_builder/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.version = version
def run(self):
for step in self.workflow:
fn = getattr(self, step)
result = fn()
assert result
@restoring_chdir
def force(self):
"""
An optional step to force a build even when nothing has changed.
... | code_fim | hard | {
"lang": "python",
"repo": "thomaspurchas/readthedocs.org",
"path": "/readthedocs/doc_builder/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Remove left title, then save image
pyplot.title("", loc="left", pad=20)
fig.savefig(
"%s%s%s"
% (
CONS["OUTPUT_PHOTO_DIRECTORY"],
plot_name,
CONS["PHOTO_TYPE"],
... | code_fim | hard | {
"lang": "python",
"repo": "thanhph111/prosthetic-foot-design",
"path": "/src/sub/plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dt = dt or self.datas[0].datetime.date(0)
print('%s, %s' % (dt.isoformat(), txt))
def notify_order(self, order):
if order.status in [order.Completed]:
if order.isbuy():
return self.log(
'BUY Executed at price: {} with size... | code_fim | hard | {
"lang": "python",
"repo": "phongle12300/BinanceTradingBot_RSI",
"path": "/BacktestStrategy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Here the conditions for openinng and closing a position have been set."""
if self.position.size == 0:
# The condition for activating BUY function --> By checking oversold condition.
if self.rsi_2 < 30 and self.rsi_3 < 40:
self.buyAlert = True
... | code_fim | hard | {
"lang": "python",
"repo": "phongle12300/BinanceTradingBot_RSI",
"path": "/BacktestStrategy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for line in ratings_dat:
arr = line.split('::')
new_line = '\t'.join(arr)
ratings_csv.write(new_line)
ratings_dat.close()
ratings_csv.close()<|fim_prefix|># repo: monsendag/goldfish path: /bin/createDataModel.py
#!/usr/bin/env python
# script :: creating a datamodel that fits mahout from ratings.dat... | code_fim | medium | {
"lang": "python",
"repo": "monsendag/goldfish",
"path": "/bin/createDataModel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #class_number x1 y1 width height image_width image_height
l.append([iclass,
int(member.find('bndbox').find('xmin').text),
int(member.find('bndbox').find('ymin').text),
int(member.find('bndbox').find('xmax').text)-... | code_fim | hard | {
"lang": "python",
"repo": "grantrosse/PyImageRoi",
"path": "/source/ExportPascal2txt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> np.savetxt(txtFileName, np.asarray(l),fmt='%d', delimiter =' ',newline='\n')
print('Successfully converted xml to txt.')
#=============================================================================
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()... | code_fim | hard | {
"lang": "python",
"repo": "grantrosse/PyImageRoi",
"path": "/source/ExportPascal2txt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
@admin.register(AuxiliaryTicket)
class AuxiliaryTicketAdmin(admin.ModelAdmin):
pass
@admin.register(UserTicket)
class UserTicketAdmin(admin.ModelAdmin):
pass<|fim_prefix|># repo: aman-roy/pune.pycon.org path: /ticket/admin.py
from django.contrib import admin
<|fim_middle|>from ticke... | code_fim | medium | {
"lang": "python",
"repo": "aman-roy/pune.pycon.org",
"path": "/ticket/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aman-roy/pune.pycon.org path: /ticket/admin.py
from django.contrib import admin
<|fim_suffix|>
@admin.register(AuxiliaryTicket)
class AuxiliaryTicketAdmin(admin.ModelAdmin):
pass
@admin.register(UserTicket)
class UserTicketAdmin(admin.ModelAdmin):
pass<|fim_middle|>from ticket.models i... | code_fim | medium | {
"lang": "python",
"repo": "aman-roy/pune.pycon.org",
"path": "/ticket/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
@admin.register(UserTicket)
class UserTicketAdmin(admin.ModelAdmin):
pass<|fim_prefix|># repo: aman-roy/pune.pycon.org path: /ticket/admin.py
from django.contrib import admin
from ticket.models import Ticket, UserTicket, AuxiliaryTicket
<|fim_middle|>@admin.register(Ticket)
class Ticket... | code_fim | medium | {
"lang": "python",
"repo": "aman-roy/pune.pycon.org",
"path": "/ticket/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return None
def GetAllJobGroups(self):
with self._lock:
return copy.deepcopy(self.all_job_groups)
def AddJobGroup(self, group):
with self._lock:
group.id = self._id_producer.GetNextId()
self._logger.debug('Creating runtime environment for %r.', group)
CommandExecu... | code_fim | hard | {
"lang": "python",
"repo": "lz-purple/Source",
"path": "/app/src/main/java/com/syd/source/aosp/external/toolchain-utils/automation/server/job_group_manager.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.