text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: mindspore-ai/mindspore path: /tests/st/ops/dynamic_sequence/test_dynamic_list_append.py
# Copyright 2023 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of t... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/tests/st/ops/dynamic_sequence/test_dynamic_list_append.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setup_build_environment(self, env):
env.set("CUDACXX", self.spec["cuda"].prefix.bin.nvcc)
def cmake_args(self):
cuda_arch = self.spec.variants["cuda_arch"].value
return [self.define("CUTLASS_NVCC_ARCHS", ";".join(cuda_arch))]<|fim_prefix|># repo: JayjeetAtGithub/spack ... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/cutlass/package.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/cutlass/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/cutlass/package.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> cuda_arch = self.spec.variants["cuda_arch"].value
return [self.define("CUTLASS_NVCC_ARCHS", ";".join(cuda_arch))]<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/cutlass/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/cutlass/package.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rjagerman/chainerltr path: /chainerltr/functions/logcumsumexp.py
import chainer
from chainer.backends import cuda
from chainer import function_node
from chainer.utils import type_check
class LogCumSumExp(function_node.FunctionNode):
def check_type_forward(self, in_types):
type_chec... | code_fim | hard | {
"lang": "python",
"repo": "rjagerman/chainerltr",
"path": "/chainerltr/functions/logcumsumexp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def logcumsumexp(x):
"""Log-cumsum-exp of array elements over a given axis.
This function calculates logarithm of sum of exponential of array elements.
.. math::
y_i = \\log\\left(\\sum_{j=i}^n \\exp(x_{j})\\right)
Args:
x (~chainer.Variable): Elements to log-cumsum-exp... | code_fim | hard | {
"lang": "python",
"repo": "rjagerman/chainerltr",
"path": "/chainerltr/functions/logcumsumexp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class FuelSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = models.Fuel
fields = (
'url',
'id',
'date',
'liters',
'distance',
'price_l',
'vehicle',
'city',
... | code_fim | hard | {
"lang": "python",
"repo": "bbrowning918/pyfuel",
"path": "/backend/api/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbrowning918/pyfuel path: /backend/api/serializers.py
"""API Serializers"""
from rest_framework import serializers
from api import models
class TagSerializer(serializers.HyperlinkedModelSerializer):
<|fim_suffix|>class VehicleSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
... | code_fim | hard | {
"lang": "python",
"repo": "bbrowning918/pyfuel",
"path": "/backend/api/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = models.Fuel
fields = (
'url',
'id',
'date',
'liters',
'distance',
'price_l',
'vehicle',
'city',
'company',
'notes'
)<|fim_prefix|># repo: bbrowning918/pyf... | code_fim | hard | {
"lang": "python",
"repo": "bbrowning918/pyfuel",
"path": "/backend/api/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SpiNNakerManchester/sPyNNaker path: /spynnaker/pyNN/connections/ethernet_control_connection.py
# Copyright (c) 2017 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain ... | code_fim | hard | {
"lang": "python",
"repo": "SpiNNakerManchester/sPyNNaker",
"path": "/spynnaker/pyNN/connections/ethernet_control_connection.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _translate(self, label, key, payload=None):
translator = self.__translators[label]
if payload is None:
translator.translate_control_packet(MultiCastCommand(key))
else:
translator.translate_control_packet(MultiCastCommand(key, payload))<|fim_prefix|>#... | code_fim | hard | {
"lang": "python",
"repo": "SpiNNakerManchester/sPyNNaker",
"path": "/spynnaker/pyNN/connections/ethernet_control_connection.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mahandas/EMTech-19 path: /TranslatorServer_oldCopy.py
from flask import Flask, render_template, request, redirect, url_for, jsonify
from flask_socketio import SocketIO
import GtransWrapper as GTW
app = Flask(__name__)
app.config['SECRET_KEY'] = 'vnkdjnfjknfl1232#'
socketio = SocketIO(app)
... | code_fim | medium | {
"lang": "python",
"repo": "mahandas/EMTech-19",
"path": "/TranslatorServer_oldCopy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('received my event: ' + str(json))
SSIDmap[clients.index(str(json['user_name']))] = request.sid
for client in clients:
json['message'] = GTW.tanslatedata(json['message'], ClientLanguageMap[client])
print("response from Gtrans -> " + str(json['message']))
sock... | code_fim | hard | {
"lang": "python",
"repo": "mahandas/EMTech-19",
"path": "/TranslatorServer_oldCopy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('received my event: ' + str(json))
SSIDmap.append(request.sid)
clients.append(str(json['user_name']))
ClientLanguageMap[str(json['user_name'])] = str(json['language'])
print(str(json['user_name']) + " mapped to " + str(json['language']))
socketio.emit('addme', json, call... | code_fim | hard | {
"lang": "python",
"repo": "mahandas/EMTech-19",
"path": "/TranslatorServer_oldCopy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># FOR CHALLENGE
path('Masego', views.masego, name='index'),
path('JorjaSmith', views.jorjaSmith, name='index'),
path('Galimatias', views.galimatias, name='index'),
]<|fim_prefix|># repo: cs-fullstack-2019-spring/django-intro1-cw-ChelsGreg path: /cw1proj/project1/classwork1/urls.py
from djang... | code_fim | medium | {
"lang": "python",
"repo": "cs-fullstack-2019-spring/django-intro1-cw-ChelsGreg",
"path": "/cw1proj/project1/classwork1/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cs-fullstack-2019-spring/django-intro1-cw-ChelsGreg path: /cw1proj/project1/classwork1/urls.py
from django.urls import path
from . import views
<|fim_suffix|># FOR CHALLENGE
path('Masego', views.masego, name='index'),
path('JorjaSmith', views.jorjaSmith, name='index'),
path('Galimat... | code_fim | medium | {
"lang": "python",
"repo": "cs-fullstack-2019-spring/django-intro1-cw-ChelsGreg",
"path": "/cw1proj/project1/classwork1/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('todo', '0010_todoitem_calculate_streak'),
]
operations = [
migrations.AlterField(
model_name='todoitem',
name='order',
field=models.FloatField(),
),
]<|fim_prefix|># repo: jimbofreedman/naggingnelly-backend pa... | code_fim | easy | {
"lang": "python",
"repo": "jimbofreedman/naggingnelly-backend",
"path": "/backend/todo/migrations/0011_auto_20190405_0834.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jimbofreedman/naggingnelly-backend path: /backend/todo/migrations/0011_auto_20190405_0834.py
# Generated by Django 2.0.9 on 2019-04-05 08:34
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='todoitem',
na... | code_fim | medium | {
"lang": "python",
"repo": "jimbofreedman/naggingnelly-backend",
"path": "/backend/todo/migrations/0011_auto_20190405_0834.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> d = (radius + inner_radius * cos_v)
x = d * cos_u
y = d * sin_u
z = inner_radius * sin_v
nx = cos_u * cos_v
ny = sin_u * cos_v
nz = sin_v
vertices.extend([x, y, z])
... | code_fim | hard | {
"lang": "python",
"repo": "fos/fos",
"path": "/debug/debug_torus.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # One-time GL setup
glClearColor(1, 1, 1, 1)
glColor3f(1, 0, 0)
glEnable(GL_DEPTH_TEST)
glEnable(GL_CULL_FACE)
glCullFace(GL_BACK)
# Uncomment this line for a wireframe view
#glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
# Simple light setup. On Windows GL_LIGHT0 is enab... | code_fim | hard | {
"lang": "python",
"repo": "fos/fos",
"path": "/debug/debug_torus.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fos/fos path: /debug/debug_torus.py
#!/usr/bin/env python
import pyglet
pyglet.options['debug_gl'] = True
pyglet.options['debug_gl_trace'] = True
pyglet.options['debug_gl_trace_args'] = True
pyglet.options['debug_lib'] = True
pyglet.options['debug_media'] = True
pyglet.options['debug_trace'] = T... | code_fim | hard | {
"lang": "python",
"repo": "fos/fos",
"path": "/debug/debug_torus.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> region = os.environ.get(BIGQUERY_LOCATION)
topic = os.environ.get(BIGQUERY_TABLE_NAME)
# Because Error: memory limit exceeded. Function invocation was interrupted.
memory = 2048
timeout = 540
env_vars = get_deploy_env_vars()
cmd = f"""
gcloud functions deploy bitmex \
... | code_fim | medium | {
"lang": "python",
"repo": "maestro73/bitmex-historical-etl",
"path": "/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@task
def deploy(c):
region = os.environ.get(BIGQUERY_LOCATION)
topic = os.environ.get(BIGQUERY_TABLE_NAME)
# Because Error: memory limit exceeded. Function invocation was interrupted.
memory = 2048
timeout = 540
env_vars = get_deploy_env_vars()
cmd = f"""
gcloud functi... | code_fim | medium | {
"lang": "python",
"repo": "maestro73/bitmex-historical-etl",
"path": "/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maestro73/bitmex-historical-etl path: /tasks.py
import os
from invoke import task
from bitmex_historical_etl.constants import BIGQUERY_LOCATION, BIGQUERY_TABLE_NAME
from bitmex_historical_etl.utils import get_deploy_env_vars, set_environment
set_environment()
<|fim_suffix|> region = os.env... | code_fim | medium | {
"lang": "python",
"repo": "maestro73/bitmex-historical-etl",
"path": "/tasks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qjadud1994/RetinaNet_tensorflow path: /test.py
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import cv2, os
from tensorflow.contrib import learn
from PIL import Image, ImageDraw
os.environ["CUDA_VISIBLE_DEVICES"]="0"
from Detector.RetinaNet import RetinaNet
from util... | code_fim | hard | {
"lang": "python",
"repo": "qjadud1994/RetinaNet_tensorflow",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> box, label, score = sess.run(decode, feed_dict={_image : img})
label = [VOC[l+1] for l in label]
ori_img = ori_img.resize((608, 608), Image.BILINEAR)
ori_img = draw_boxes(ori_img, box, label, score)
plt.figure(figsize =(12, 12))
... | code_fim | hard | {
"lang": "python",
"repo": "qjadud1994/RetinaNet_tensorflow",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def supported_algorithms(self):
return ['equihash']
def update_supported_algorithms(self):
pass<|fim_prefix|># repo: JesperNaarttijarvi/minotaur path: /ewbf.py
from log import Log
from singleton import Singleton
from config import Config
import re
import os
from excavator_api i... | code_fim | medium | {
"lang": "python",
"repo": "JesperNaarttijarvi/minotaur",
"path": "/ewbf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JesperNaarttijarvi/minotaur path: /ewbf.py
from log import Log
from singleton import Singleton
from config import Config
import re
import os
from excavator_api import ExcavatorAPI
from excavator_api import ExcavatorAPIError
<|fim_suffix|>
def update_supported_algorithms(self):
pass<|fim_... | code_fim | hard | {
"lang": "python",
"repo": "JesperNaarttijarvi/minotaur",
"path": "/ewbf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def supported_algorithms(self):
return ['equihash']
def update_supported_algorithms(self):
pass<|fim_prefix|># repo: JesperNaarttijarvi/minotaur path: /ewbf.py
from log import Log
from singleton import Singleton
from config import Config
import re
import os
<|fim_middle|>from excavator_ap... | code_fim | hard | {
"lang": "python",
"repo": "JesperNaarttijarvi/minotaur",
"path": "/ewbf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> import filecmp
test_file = 'tjvpvwzrrll_8839_zh-TW.srt'
correct_file = 'tjvpvwzrrll_8839_zh-TW.srt.bak'
file_same = filecmp.cmp(test_file, correct_file)
assert file_same == True<|fim_prefix|># repo: jenhaoyang/backend_blog path: /pytest_exercise/test_demo.py
import pytest
@pytest.fi... | code_fim | easy | {
"lang": "python",
"repo": "jenhaoyang/backend_blog",
"path": "/pytest_exercise/test_demo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jenhaoyang/backend_blog path: /pytest_exercise/test_demo.py
import pytest
@pytest.fixture
def replace_dict():
return {"寶寶":"爸爸"}
<|fim_suffix|> import filecmp
test_file = 'tjvpvwzrrll_8839_zh-TW.srt'
correct_file = 'tjvpvwzrrll_8839_zh-TW.srt.bak'
file_same = filecmp.cmp(t... | code_fim | easy | {
"lang": "python",
"repo": "jenhaoyang/backend_blog",
"path": "/pytest_exercise/test_demo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>kit for adjusting and visualizing p values.',
url = ['https://github.com/UBC-MDS/p_toolkit_Python'],
download_url = 'https://github.com/UBC-MDS/p_toolkit_Python/archive/3.0.4.tar.gz',
keywords = ['pvalues'],
install_requires=['numpy', 'pandas']
)<|fim_prefix|># repo: UBC-MDS/p_toolkit_... | code_fim | medium | {
"lang": "python",
"repo": "UBC-MDS/p_toolkit_Python",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UBC-MDS/p_toolkit_Python path: /setup.py
#!/usr/bin/env python
from distutils.core import setup
setup(
name='p_toolkit',
version='v1.0',
author='Amy Goldlist, Veronique Mulholland and Esteban Angel',
packages=['p_toolkit'],
author_email= 'na',
license='MIT',
descripti... | code_fim | medium | {
"lang": "python",
"repo": "UBC-MDS/p_toolkit_Python",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>github.com/UBC-MDS/p_toolkit_Python/archive/3.0.4.tar.gz',
keywords = ['pvalues'],
install_requires=['numpy', 'pandas']
)<|fim_prefix|># repo: UBC-MDS/p_toolkit_Python path: /setup.py
#!/usr/bin/env python
from distutils.core import setup
setup(
name='p_toolkit',
version='v1.0',
... | code_fim | medium | {
"lang": "python",
"repo": "UBC-MDS/p_toolkit_Python",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def parse_args():
p = argparse.ArgumentParser()
p.add_argument('file_contains_ds4key', help='Path to a file that contains the DS4Key.')
p.add_argument('-o', '--output-prefix', help='Prefix of output file.')
p.add_argument('-p', '--e-padding-size', type=anybase, default=0xfc, help='Padding ... | code_fim | hard | {
"lang": "python",
"repo": "godzivan/e3pp",
"path": "/e3.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: godzivan/e3pp path: /e3.py
#!/usr/bin/env python3
# SPDX-License-Identifier: Unlicense
# Embrace, extend, extinguish
#
# Dumps information of a DS4 key block and (optionally) extracts it from
# a binary file. Also works with raw key blocks extracted by
# e.g. jedi_crypto.py.
#
# Extracts the unto... | code_fim | hard | {
"lang": "python",
"repo": "godzivan/e3pp",
"path": "/e3.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> operation_to_eval = f"{input_parameter}"
if value_1:
operation_to_eval += f" {math_1} {float(value_1)}"
if value_2:
operation_to_eval += f" {math_2} {float(value_2)}"
result = eval(operation_to_eval)
return result
else:
return "... | code_fim | hard | {
"lang": "python",
"repo": "neutronimaging/python_notebooks",
"path": "/notebooks/__code/metadata_overlapping_images/utilities.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neutronimaging/python_notebooks path: /notebooks/__code/metadata_overlapping_images/utilities.py
import re
from . import LIST_FUNNY_CHARACTERS
def string_cleaning(first_part_of_string_to_remove="", last_part_of_string_to_remove="", string_to_clean=""):
first_part_of_string_to_remove = firs... | code_fim | medium | {
"lang": "python",
"repo": "neutronimaging/python_notebooks",
"path": "/notebooks/__code/metadata_overlapping_images/utilities.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def is_error_in_operation(value):
operation = str(value.strip())
if operation:
try:
float(operation)
except ValueError:
return True
return False
if (not is_error_in_operation(value_1)) and \
(not is_error_in_o... | code_fim | hard | {
"lang": "python",
"repo": "neutronimaging/python_notebooks",
"path": "/notebooks/__code/metadata_overlapping_images/utilities.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # calculate grid online
grid = cs.csgrid_GMAO(48)
# fix a single polar point before testing. should not have real effect
index = (5, 24, 24) # index of the pole point
assert grid['lat_b'][index] == -90.0
assert grid['lon_b'][index] == 35.0
assert ds_FV3['lon_b'][index] == 350... | code_fim | medium | {
"lang": "python",
"repo": "sdeastham/cubedsphere",
"path": "/cubedsphere/tests/test_grid.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sdeastham/cubedsphere path: /cubedsphere/tests/test_grid.py
import numpy as np
from numpy.testing import assert_almost_equal
import cubedsphere as cs
def test_csgrid_gmap():
<|fim_suffix|> # fix a single polar point before testing. should not have real effect
index = (5, 24, 24) # index... | code_fim | hard | {
"lang": "python",
"repo": "sdeastham/cubedsphere",
"path": "/cubedsphere/tests/test_grid.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@behave.given(u'existing foo')
def existing_foo(context):
return None<|fim_prefix|># repo: dataloop-ai/dtlpy path: /tests/features/steps/xray/test_xray.py
import behave
@behave.given(u'Some initial setup')
def before_all(context):
return None
@behave.when(u'creating foo')
def creating_foo(con... | code_fim | hard | {
"lang": "python",
"repo": "dataloop-ai/dtlpy",
"path": "/tests/features/steps/xray/test_xray.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dataloop-ai/dtlpy path: /tests/features/steps/xray/test_xray.py
import behave
@behave.given(u'Some initial setup')
def before_all(context):
return None
@behave.when(u'creating foo')
def creating_foo(context):
return None
<|fim_suffix|> return None
@behave.then(u'return foo')
de... | code_fim | medium | {
"lang": "python",
"repo": "dataloop-ai/dtlpy",
"path": "/tests/features/steps/xray/test_xray.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return None
@behave.then(u'return bar')
def return_bar(context):
return None
@behave.then(u'foo')
def foo(context):
assert True == True
@behave.given(u'existing foo')
def existing_foo(context):
return None<|fim_prefix|># repo: dataloop-ai/dtlpy path: /tests/features/steps/xray/test_... | code_fim | medium | {
"lang": "python",
"repo": "dataloop-ai/dtlpy",
"path": "/tests/features/steps/xray/test_xray.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i','--input-fp',help='File that will be going to qiimeToMaaslin.py', type=str, required=True)
parser.add_argument('-o','--output-fp',help='Location for file to be written to', type... | code_fim | medium | {
"lang": "python",
"repo": "geoffrosen/simple-v-microbiome",
"path": "/prepare_for_qiimeToMaaslin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''
import argparse, csv
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i','--input-fp',help='File that will be going to qiimeToMaaslin.py', type=str, required=True)
parser.add_argument('-o','--output-fp',help='Location for f... | code_fim | medium | {
"lang": "python",
"repo": "geoffrosen/simple-v-microbiome",
"path": "/prepare_for_qiimeToMaaslin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geoffrosen/simple-v-microbiome path: /prepare_for_qiimeToMaaslin.py
#!/usr/bin/env python
'''
This script will take a file that will be going to qiimeToMaaslin
and will fix it to prevent errors from qiimeToMaaslin
<|fim_suffix|>import argparse, csv
def main():
parser = argparse.ArgumentPars... | code_fim | medium | {
"lang": "python",
"repo": "geoffrosen/simple-v-microbiome",
"path": "/prepare_for_qiimeToMaaslin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mibBuilder.loadTexts: h3cSyslogLoghostLanguage.setStatus('current')
if mibBuilder.loadTexts: h3cSyslogLoghostLanguage.setDescription('The language of the message sent to the loghost.')
h3cSyslogLoghostOperateRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 63, 1, 7, 3, 1, 7), RowStatus()).setMa... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp-with-texts/H3C-SYSLOG-MIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp-with-texts/H3C-SYSLOG-MIB.py
ibBuilder.loadTexts: h3cSyslogMaxLogbufferSize.setDescription('The maximum number of messages that can be stored in logbuffer.')
h3cSyslogMaxTrapbufferSize = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 63, 1, 1, 5), Integer32... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp-with-texts/H3C-SYSLOG-MIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp-with-texts/H3C-SYSLOG-MIB.py
on('Huawei-3com Technologies Co., Ltd.')
if mibBuilder.loadTexts: h3cSyslog.setContactInfo('Platform Team Huawei-3com Technologies Co., Ltd. Shang-Di Information Industry Base, Hai-Dian District Beijing P.R. China http://ww... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp-with-texts/H3C-SYSLOG-MIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yamen23ali/self-supervised-3d-tasks path: /self_supervised_3d_tasks/data/image_2d_loader.py
from PIL import Image
import numpy as np
from tensorflow.python.keras.preprocessing.image import random_zoom
import albumentations as ab
from self_supervised_3d_tasks.data.generator_base import DataGenerat... | code_fim | hard | {
"lang": "python",
"repo": "yamen23ali/self-supervised-3d-tasks",
"path": "/self_supervised_3d_tasks/data/image_2d_loader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.augment_zoom_only:
img = random_zoom(img, zoom_range=(0.85, 1.15), channel_axis=2, row_axis=0, col_axis=1,
fill_mode='constant', cval=0.0)
elif self.augment:
img = random_zoom(img, zoom_ra... | code_fim | hard | {
"lang": "python",
"repo": "yamen23ali/self-supervised-3d-tasks",
"path": "/self_supervised_3d_tasks/data/image_2d_loader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name="City",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
... | code_fim | hard | {
"lang": "python",
"repo": "mlavin/django-selectable",
"path": "/example/core/migrations/0001_initial.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlavin/django-selectable path: /example/core/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-25 01:13
from __future__ import unicode_literals
import django.db.models.deletion
import localflavor.us.models
from django.conf import settings
from django.db i... | code_fim | hard | {
"lang": "python",
"repo": "mlavin/django-selectable",
"path": "/example/core/migrations/0001_initial.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self , p1 , p2):
self.x = p1.getx() - p2.getx()
self.y = p1.gety() - p2.gety()
def getLen(self):
self.len = math.sqrt(self.x**2 + self.y**2)
return self.len<|fim_prefix|># repo: iisdd/Courses path: /python_fishc/38.0.py
import math
class Point(... | code_fim | easy | {
"lang": "python",
"repo": "iisdd/Courses",
"path": "/python_fishc/38.0.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.x = p1.getx() - p2.getx()
self.y = p1.gety() - p2.gety()
def getLen(self):
self.len = math.sqrt(self.x**2 + self.y**2)
return self.len<|fim_prefix|># repo: iisdd/Courses path: /python_fishc/38.0.py
import math
class Point():
def __init__(self , x = 0 ,... | code_fim | easy | {
"lang": "python",
"repo": "iisdd/Courses",
"path": "/python_fishc/38.0.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iisdd/Courses path: /python_fishc/38.0.py
import math
class Point():
def __init__(self , x = 0 , y = 0):
self.x = x
self.y = y
def getx(self):
<|fim_suffix|>
class Line():
def __init__(self , p1 , p2):
self.x = p1.getx() - p2.getx()
self... | code_fim | medium | {
"lang": "python",
"repo": "iisdd/Courses",
"path": "/python_fishc/38.0.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> lbl3 = Label(frame, bg='DarkSeaGreen3', width=15, height=10,
cursor='heart')
lbl3.pack(side=LEFT, padx=3)
lbl4 = Label(frame, bg='DarkSeaGreen4', width=15, height=10,
cursor='pencil')
lbl4.pack(side=LEFT)
self.pack()
def main():
root ... | code_fim | hard | {
"lang": "python",
"repo": "Ranjan2104/Tkinter-GUI--Series",
"path": "/Tkinter Widgets & Attributes/Tkinter cursors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ranjan2104/Tkinter-GUI--Series path: /Tkinter Widgets & Attributes/Tkinter cursors.py
from tkinter import Tk, Frame, Label
from tkinter import BOTH, LEFT
class Example(Frame):
def __init__(self):
super().__init__()
<|fim_suffix|>
root = Tk()
root.geometry("+300+300")
ap... | code_fim | hard | {
"lang": "python",
"repo": "Ranjan2104/Tkinter-GUI--Series",
"path": "/Tkinter Widgets & Attributes/Tkinter cursors.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> root = Tk()
root.geometry("+300+300")
app = Example()
root.mainloop()
if __name__ == '__main__':
main()<|fim_prefix|># repo: Ranjan2104/Tkinter-GUI--Series path: /Tkinter Widgets & Attributes/Tkinter cursors.py
from tkinter import Tk, Frame, Label
from tkinter import BOTH, LEFT
cla... | code_fim | hard | {
"lang": "python",
"repo": "Ranjan2104/Tkinter-GUI--Series",
"path": "/Tkinter Widgets & Attributes/Tkinter cursors.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShiSheng233/How_to_Fxxk_Weilei_s_Server path: /My memory/Repeater-no-Proxy.py
# -*- coding: UTF-8 -*-
import json
from os import system
from random import randint
from requests import get
from time import sleep
<|fim_suffix|>while True:
sleeptime = randint(6,15)
sleep(sleeptime)... | code_fim | hard | {
"lang": "python",
"repo": "ShiSheng233/How_to_Fxxk_Weilei_s_Server",
"path": "/My memory/Repeater-no-Proxy.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
sleeptime = randint(6,15)
sleep(sleeptime)
print("离上次复读过去了%d秒"%(sleeptime))
do()
print()
print("程序非正常结束,IP可能被封禁,请更换IP再试\n")
input("回车两次以退出...")
input()<|fim_prefix|># repo: ShiSheng233/How_to_Fxxk_Weilei_s_Server path: /My memory/Repeater-no-Proxy.py
# -*- coding: UT... | code_fim | hard | {
"lang": "python",
"repo": "ShiSheng233/How_to_Fxxk_Weilei_s_Server",
"path": "/My memory/Repeater-no-Proxy.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangyixiang/atserver path: /atserverwebapp/handlers/fsj.py
#!/usr/bin/env python
#coding:utf-8
# Author: Yixiang.Wang
# Purpose:
# Created: 2013/9/16
import logging
from tornado import escape
from tornado.escape import utf8
from tornado.options import options
from tornado.web import RequestHa... | code_fim | hard | {
"lang": "python",
"repo": "wangyixiang/atserver",
"path": "/atserverwebapp/handlers/fsj.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> status["frequency"] = astatus["frequency"]
status["stream_type"] = astatus["streamtype"]
status["update_time"] = astatus["updatetime"]
status["comment"] = astatus["comment"]
... | code_fim | hard | {
"lang": "python",
"repo": "wangyixiang/atserver",
"path": "/atserverwebapp/handlers/fsj.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> nr_cases = adapter.cases().count()
logger.info("Found {0} cases in database".format(nr_cases))
head = HeaderParser()
head.add_fileformat("VCFv4.3")
head.add_meta_line("NrCases", nr_cases)
head.add_info("Obs", '1', 'Integer', "The number of observations for the variant")
head.a... | code_fim | hard | {
"lang": "python",
"repo": "J35P312/loqusdb",
"path": "/loqusdb/commands/export.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ordered_chromosomes = []
for chrom in CHROMOSOME_ORDER:
if chrom in existing_chromosomes:
ordered_chromosomes.append(chrom)
existing_chromosomes.remove(chrom)
for chrom in existing_chromosomes:
ordered_chromosomes.append(chrom)
nr_cases = adapte... | code_fim | medium | {
"lang": "python",
"repo": "J35P312/loqusdb",
"path": "/loqusdb/commands/export.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: J35P312/loqusdb path: /loqusdb/commands/export.py
import logging
import click
import tempfile
from datetime import datetime
from vcftoolbox import (HeaderParser, print_headers, print_variant)
from loqusdb import __version__, CHROMOSOME_ORDER
from . import base_command
logger = logging.getLog... | code_fim | hard | {
"lang": "python",
"repo": "J35P312/loqusdb",
"path": "/loqusdb/commands/export.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>img = Variable(img.to(device))
model_path = sys.argv[1]
fcn = resnet_dilated.ResNetDilated_s(resnet_base=models.resnet34, resnet_name="resnet34_8s", num_classes=21, dilation=False)
fcn.load_state_dict(torch.load(model_path, map_location = torch.device(device)))
fcn.to(device)
fcn.eval()
res = fcn(img)... | code_fim | hard | {
"lang": "python",
"repo": "christian-rauch/pytorch-segmentation-detection",
"path": "/pytorch_segmentation_detection/recipes/pascal_voc/segmentation/resnet_34_8s_benchmark.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: christian-rauch/pytorch-segmentation-detection path: /pytorch_segmentation_detection/recipes/pascal_voc/segmentation/resnet_34_8s_benchmark.py
import sys, os
sys.path.insert(0, '../../../../vision/')
sys.path.append('../../../../../pytorch-segmentation-detection/')
# Use second GPU -pytorch-seg... | code_fim | hard | {
"lang": "python",
"repo": "christian-rauch/pytorch-segmentation-detection",
"path": "/pytorch_segmentation_detection/recipes/pascal_voc/segmentation/resnet_34_8s_benchmark.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> img = valid_transform(img_not_preprocessed)
img = img.unsqueeze(0)
img = Variable(img.to(device))
res = fcn(img)
img_not_preprocessed.size
tic = time.perf_counter()
benchmark_fcn()
toc = time.perf_counter()
print("inference time: ", toc-tic, "s")
plt.show()<|fim_prefix|># repo: chris... | code_fim | hard | {
"lang": "python",
"repo": "christian-rauch/pytorch-segmentation-detection",
"path": "/pytorch_segmentation_detection/recipes/pascal_voc/segmentation/resnet_34_8s_benchmark.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itzmeanjan/tgnize path: /tgnize/model/activity.py
#!/usr/bin/python3
from __future__ import annotations
class Activity:
<|fim_suffix|>
if __name__ == '__main__':
print('[!]This module is designed to be used as a backend handler')
exit(0)<|fim_middle|> def __init__(self, idx: int):
... | code_fim | medium | {
"lang": "python",
"repo": "itzmeanjan/tgnize",
"path": "/tgnize/model/activity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.index = idx
if __name__ == '__main__':
print('[!]This module is designed to be used as a backend handler')
exit(0)<|fim_prefix|># repo: itzmeanjan/tgnize path: /tgnize/model/activity.py
#!/usr/bin/python3
from __future__ import annotations
<|fim_middle|>class Activity:
def _... | code_fim | easy | {
"lang": "python",
"repo": "itzmeanjan/tgnize",
"path": "/tgnize/model/activity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> project = get_object_or_404(Project, name=project_path, owner=request.user)
shares = Share.objects.filter(project=project)
shares = [ob.as_json() for ob in shares]
return HttpResponse(json.dumps(shares), mimetype="application/json")
def remove_share(request, project_path):
if request... | code_fim | hard | {
"lang": "python",
"repo": "stermedia/AndroidLanguageEditor",
"path": "/ale/share_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def modify_shared_project_cell(request, hash_key):
project = get_object_or_404(Project, hashes__hash=hash_key)
return modify_project_cell(request, project)
def import_shared_project(request, hash_key):
project = get_object_or_404(Project, hashes__hash=hash_key)
import_project(request, p... | code_fim | medium | {
"lang": "python",
"repo": "stermedia/AndroidLanguageEditor",
"path": "/ale/share_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stermedia/AndroidLanguageEditor path: /ale/share_views.py
import hashlib
import random
import json
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404, redirect, render
import time
from ale.forms import ImportFileForm, RemoveShareForm
from ale.io_views imp... | code_fim | hard | {
"lang": "python",
"repo": "stermedia/AndroidLanguageEditor",
"path": "/ale/share_views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: utep-cs-systems-courses/os-shell-oayala3 path: /shell/shell.py
#! /usr/bin/env python3
import os, sys, time, re, array
ps1="$"
buff= ""
lBuff= ""
nextChar = 0
limit = 0
lLimit = 0
nextLine = 0
reDirI=False
reDirO=False
inFile=""
outFile=""
agrs1=[]
args2=[]
def getChar():
global nex... | code_fim | hard | {
"lang": "python",
"repo": "utep-cs-systems-courses/os-shell-oayala3",
"path": "/shell/shell.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> pid = os.getpid()
os.write(1, ("About to fork (pid:%d)\n" % pid).encode())
rc = os.fork()
if rc < 0:
os.write(2, ("fork failed, returning %d\n" % rc).encode())
sys.exit(1)
elif rc == 0: # child
if(reDirI):
args=reDirec... | code_fim | hard | {
"lang": "python",
"repo": "utep-cs-systems-courses/os-shell-oayala3",
"path": "/shell/shell.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> else: # parent (forked ok)
print("Parent: My pid==%d. Child's pid=%d" % (os.getpid(), rc), file=sys.stderr)
os.close(0)
os.dup(pr)
for fd in (pw, pr):
os.close(fd)
exe... | code_fim | hard | {
"lang": "python",
"repo": "utep-cs-systems-courses/os-shell-oayala3",
"path": "/shell/shell.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Erotemic/netharn path: /docs/yolo_notes.py
# iaa.Flipud(p=.5),
# iaa.Affine(
# # scale={"x": (1.0, 1.01), "y": (1.0, 1.01)},
# # translate_percent={"x": (-0.1, 0.1), "y": (-0.1, 0.1)},
# translate_percent=... | code_fim | hard | {
"lang": "python",
"repo": "Erotemic/netharn",
"path": "/docs/yolo_notes.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # def __len__(self):
# # hack
# if 'train' in self.split:
# return 100
# else:
# return super().__len__()
# def initialize(harn):
# super().initialize()
# harn.datasets['train']._augmenter = harn.datasets['train'].augmenter
# ... | code_fim | hard | {
"lang": "python",
"repo": "Erotemic/netharn",
"path": "/docs/yolo_notes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # def initialize(harn):
# super().initialize()
# harn.datasets['train']._augmenter = harn.datasets['train'].augmenter
# if harn.epoch <= 0:
# # disable augmenter for the first epoch
# harn.datasets['train'].augmenter = None<|fim_prefix|># repo: Erotemic/... | code_fim | hard | {
"lang": "python",
"repo": "Erotemic/netharn",
"path": "/docs/yolo_notes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert list(result['Frequency'].values) == [0, 0, 0, 0, 0.074*2, 0.036*2, 0, 0.044*2]
assert list(result['Identity'].values) == ['genotype-12' for i in range(len(left_series))]
assert list(result['Group_id'].values) == ['genotype-12' for i in range(len(left_series))]
assert list(result['Unique_id'].va... | code_fim | hard | {
"lang": "python",
"repo": "cdeitrick/Lolipop",
"path": "/tests/dataio_tests/test_graphics_plot_muller_diagram.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = annotation_plot._merge_groups(left_series, right_series)
logger.info(list(result.columns))
assert list(result['Generation'].values) == index
assert list(result['Population'].values) == [0, 0, 0, 0, 9.4*2, 4.7*2, 0, 9.675*2]
assert list(result['Frequency'].values) == [0, 0, 0, 0, 0.074*2, 0... | code_fim | hard | {
"lang": "python",
"repo": "cdeitrick/Lolipop",
"path": "/tests/dataio_tests/test_graphics_plot_muller_diagram.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cdeitrick/Lolipop path: /tests/dataio_tests/test_graphics_plot_muller_diagram.py
import pytest
import pandas
from muller import dataio
from muller.graphics import muller_plot
from loguru import logger
@pytest.fixture
def annotation_plot()->muller_plot.MullerPlot:
return muller_plot.MullerPlot(
... | code_fim | hard | {
"lang": "python",
"repo": "cdeitrick/Lolipop",
"path": "/tests/dataio_tests/test_graphics_plot_muller_diagram.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not in_interval and above_threshold:
# Start of a hit
in_interval = True
hit_start = i
if in_interval:
if not above_threshold:
# Hit ends at the start of this sample
hit_end ... | code_fim | hard | {
"lang": "python",
"repo": "ErikHogenbirk/strax",
"path": "/strax/processing/pulse_processing.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ErikHogenbirk/strax path: /strax/processing/pulse_processing.py
"""Functions that perform processing on pulses
(other than data reduction functions, which are in data_reduction.py)
"""
import numpy as np
import numba
import strax
export, __all__ = strax.exporter()
# Constant for use in record_l... | code_fim | hard | {
"lang": "python",
"repo": "ErikHogenbirk/strax",
"path": "/strax/processing/pulse_processing.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not in_interval:
# print('saving hit')
# Hit is done, add it to the result
if hit_end == hit_start:
print(r['time'], r['channel'], hit_start)
raise ValueError(
... | code_fim | hard | {
"lang": "python",
"repo": "ErikHogenbirk/strax",
"path": "/strax/processing/pulse_processing.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>import click
from MDAnalysis.lib.util import which
from fluctmatch.analysis import thermodynamics
@click.command("thermo", short_help="Calculate thermodynamic properties.")
@click.option(
"-s",
"topology",
metavar="FILE",
default="fluctmatch.xplor.psf",
show_default=True,
type=cl... | code_fim | hard | {
"lang": "python",
"repo": "nixnmtm/python-fluctmatch",
"path": "/src/fluctmatch/commands/cmd_thermo.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nixnmtm/python-fluctmatch path: /src/fluctmatch/commands/cmd_thermo.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# fluctmatch --- https://github.com/tclick/python-fluctmatch
# Copyright (c) 2013-2017 The fluct... | code_fim | hard | {
"lang": "python",
"repo": "nixnmtm/python-fluctmatch",
"path": "/src/fluctmatch/commands/cmd_thermo.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@click.command("thermo", short_help="Calculate thermodynamic properties.")
@click.option(
"-s",
"topology",
metavar="FILE",
default="fluctmatch.xplor.psf",
show_default=True,
type=click.Path(
exists=False,
file_okay=True,
resolve_path=False,
),
help... | code_fim | hard | {
"lang": "python",
"repo": "nixnmtm/python-fluctmatch",
"path": "/src/fluctmatch/commands/cmd_thermo.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
""" Write and test code to demonstrate calculating the number of
days, months, and years between two arbitrary dates.
"""
# dates lists for testing
dates = [
datetime.date(2010, 1, 15),
datetime.date(2012, 6, 29)
]
targets = [
datetime.da... | code_fim | hard | {
"lang": "python",
"repo": "joshgrib/2017S-coursework",
"path": "/ssw555ws/assignments/hw06/phase2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joshgrib/2017S-coursework path: /ssw555ws/assignments/hw06/phase2.py
# -*- coding: utf-8 -*-
"""
Josh Gribbon
SSW555WS - Agile Methods for Software Development
Homework 06 - Phase 2
2017-03-05
"""
import unittest
import datetime
def diffDates(d1, d2, units):
"""
Get day months and year ... | code_fim | hard | {
"lang": "python",
"repo": "joshgrib/2017S-coursework",
"path": "/ssw555ws/assignments/hw06/phase2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(diffDates(self.target1, self.test1, "years"), 10)
def testYearDiff1(self):
self.assertEqual(diffDates(self.target2, self.test1, "years"), 6)
def testYearDiff2(self):
self.assertEqual(diffDates(self.target1, self.test2, "years"), 12)
def testYearDiff3(se... | code_fim | hard | {
"lang": "python",
"repo": "joshgrib/2017S-coursework",
"path": "/ssw555ws/assignments/hw06/phase2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: staskh/ciagan path: /source/util_func.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 29 14:54:12 2018
@author: maximov
"""
import torch
import torch.nn as nn
import torch.utils.data
import os
from os import listdir, mkdir
from os.path import isfile, join, isdir
import... | code_fim | hard | {
"lang": "python",
"repo": "staskh/ciagan",
"path": "/source/util_func.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = getattr(arch, arch_name)(input_nc=ch_inp_num, num_classes=label_num, encode_one_hot = True, img_size = DATA_PARAMS['IMG_SIZE'])
if arch_name=='Generator':
model.apply(weights_init)
if epoch_start > 0:
model.load_state_dict(torch.load(model_dir + model_name + '_ep' + st... | code_fim | hard | {
"lang": "python",
"repo": "staskh/ciagan",
"path": "/source/util_func.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Agtiger/BASH-Model path: /data/OSIM/addMarkers.py
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 14 18:29:23 2021
@author: u0101727
"""
import os
import opensim
import numpy as np
pathMain = os.getcwd()
modelName = "subject3_c33"
referenceModelName = "runMaD_Scaled"
pathReferenceModel = os.pa... | code_fim | hard | {
"lang": "python",
"repo": "Agtiger/BASH-Model",
"path": "/data/OSIM/addMarkers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> newMkr = opensim.Marker()
newMkr.setName(c_marker.getName())
newMkr.setParentFrameName("/bodyset/{}".format(myBody.getName()))
newMkr.set_location(opensim.Vec3(my_marker_location))
myModel.addMarker(newMkr)
myModel.finalizeConnections
myModel.initSystem()
pathNewModel = os.path.jo... | code_fim | hard | {
"lang": "python",
"repo": "Agtiger/BASH-Model",
"path": "/data/OSIM/addMarkers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SelvorWhim/competitive path: /Bloomberg_codecon/2015_Finals/conference_room_scheduler.py
### INSTRUCTIONS ###
'''
Bloomberg needs a new system to schedule conference rooms! To keep things simple, the system operates in 15 minutes blocks, and only during an 8 hour workday, so that there are 32 ava... | code_fim | medium | {
"lang": "python",
"repo": "SelvorWhim/competitive",
"path": "/Bloomberg_codecon/2015_Finals/conference_room_scheduler.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>slot_mat = [[0 for x in range(32)] for y in range(N)] # table of rooms and slots. Will be 1 for taken - no identity need be saved
for q in queries:
if len(q) == 3: # Booking
if(areSlotsEmpty(slot_mat,q[0],q[1],q[2])):
for i in range(q[1]-1,q[2]+q[1]-1):
slot_mat[q[0... | code_fim | hard | {
"lang": "python",
"repo": "SelvorWhim/competitive",
"path": "/Bloomberg_codecon/2015_Finals/conference_room_scheduler.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _format_entry(obj):
if not obj:
return obj
elif isinstance(obj, tuple):
return [_format_entry(x) for x in list(obj)]
elif isinstance(obj, PRIMITIVES):
return obj
elif isinstance(obj, types.FunctionType):
return 'function <{}>'.format(obj.__name__)
el... | code_fim | hard | {
"lang": "python",
"repo": "Azure/azure-cli",
"path": "/scripts/dump_command_table.py",
"mode": "spm",
"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.