text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>#run tests on math functions
import math
print('math.sqrt(2)=', runFunction(math.sqrt, 2))
print('math.factorial(8)=', runFunction(math.factorial, 8))<|fim_prefix|># repo: wgatharia/csci131 path: /6-functions/exercise_6.3.py
"""
File: exercise_6.3.py
Author: William Gatharia
This code demon... | code_fim | easy | {
"lang": "python",
"repo": "wgatharia/csci131",
"path": "/6-functions/exercise_6.3.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jkroboth/planets path: /test.py
import glob
import numpy
filenames = glob.glob('inflammation*.csv')
filenames = filenames[0:3]
<|fim_suffix|> data = numpy.loadtxt(fname=f, delimiter=',')
print(data.shape)<|fim_middle|>
for f in filenames:
print(f)
| code_fim | easy | {
"lang": "python",
"repo": "jkroboth/planets",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = numpy.loadtxt(fname=f, delimiter=',')
print(data.shape)<|fim_prefix|># repo: jkroboth/planets path: /test.py
import glob
import numpy
filenames = glob.glob('inflammation*.csv')
filenames = filenames[0:3]
<|fim_middle|>for f in filenames:
print(f)
| code_fim | easy | {
"lang": "python",
"repo": "jkroboth/planets",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(
r"^switch_contest_participation/?$",
api.switch_contest_participation,
name="switch_contest_participation",
)
]<|fim_prefix|># repo: trojsten/web path: /trojsten/people/api_urls.py
from django.conf.urls import url
from trojsten.people import api
<|fi... | code_fim | easy | {
"lang": "python",
"repo": "trojsten/web",
"path": "/trojsten/people/api_urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trojsten/web path: /trojsten/people/api_urls.py
from django.conf.urls import url
<|fim_suffix|>urlpatterns = [
url(
r"^switch_contest_participation/?$",
api.switch_contest_participation,
name="switch_contest_participation",
)
]<|fim_middle|>from trojsten.people im... | code_fim | easy | {
"lang": "python",
"repo": "trojsten/web",
"path": "/trojsten/people/api_urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ttm/dissertacao path: /scripts/espacializacao.py
#-*- coding: utf8 -*-
import numpy as n, pylab as p, Image
im = Image.open('../figuras/cabeca.png')
height = im.size[1]
# We need a float array between 0-1, rather than
# a uint8 array between 0-255
im2 = n.array(im).astype(n.float) / 255
<|fim... | code_fim | hard | {
"lang": "python",
"repo": "ttm/dissertacao",
"path": "/scripts/espacializacao.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>xy = (0.5, 0.7)
ab = AnnotationBbox(imagebox, xy,
xybox=(120., -80.),
xycoords='data',
boxcoords="offset points",
pad=0.5,
arrowprops=dict(arrowstyle="->",connectionstyle="angle,angleA=0,angleB=90,rad=3")
)
ax.add_artist(ab)
# With newer (1.0) versions of matplotlib, you can
# use the ... | code_fim | hard | {
"lang": "python",
"repo": "ttm/dissertacao",
"path": "/scripts/espacializacao.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(
self,
formats: Optional[Iterable] = None,
video_streams: Optional[int] = None,
audio_streams: Optional[int] = None,
bitrate: Optional[range] = None,
inlines: Optional[Iterable] = None,
):
self._formats = formats
self._vi... | code_fim | hard | {
"lang": "python",
"repo": "medunigraz/outpost.django.signage",
"path": "/src/outpost/django/signage/validators.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: medunigraz/outpost.django.signage path: /src/outpost/django/signage/validators.py
import json
import subprocess
from collections.abc import Iterable
from enum import Enum
from fractions import Fraction
from typing import (
Any,
Optional,
)
from django.core.exceptions import ValidationErr... | code_fim | hard | {
"lang": "python",
"repo": "medunigraz/outpost.django.signage",
"path": "/src/outpost/django/signage/validators.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
formats: Optional[Iterable] = None,
video_streams: Optional[int] = None,
audio_streams: Optional[int] = None,
bitrate: Optional[range] = None,
inlines: Optional[Iterable] = None,
):
self._formats = formats
self._video_streams = vide... | code_fim | hard | {
"lang": "python",
"repo": "medunigraz/outpost.django.signage",
"path": "/src/outpost/django/signage/validators.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: r4inm4ker/Kraken path: /DCCIntegrations/softimage/Application/Plugins/kraken_si.py
# Kraken_Plugin
import win32com.client
from win32com.client import constants
import os
import sys
import inspect
from win32com.client import constants
from multiprocessing import Pool
import webbrowser
import Q... | code_fim | hard | {
"lang": "python",
"repo": "r4inm4ker/Kraken",
"path": "/DCCIntegrations/softimage/Application/Plugins/kraken_si.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Deffered importing: We can only import the kraken modules after the
# plugin has loaded, as it configures the python import paths on load.
from kraken.core.objects.rig import Rig
from kraken import plugins
if rigFilePath == "" and si.Interactive is True:
fileBrowser = XSIU... | code_fim | hard | {
"lang": "python",
"repo": "r4inm4ker/Kraken",
"path": "/DCCIntegrations/softimage/Application/Plugins/kraken_si.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> finally:
if progressBar is not None:
progressBar.Visible = False
return builtRig
def BuildKrakenRig_Init(in_ctxt):
cmd = in_ctxt.Source
cmd.Description = 'Builds a Kraken Rig from a .krg File'
cmd.ReturnValue = True
args = cmd.Arguments
args.Add('rigFile... | code_fim | hard | {
"lang": "python",
"repo": "r4inm4ker/Kraken",
"path": "/DCCIntegrations/softimage/Application/Plugins/kraken_si.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
The gone_bust function takes an integer n, and should print either "Pheww!" or
"HELP! HELP!" depending on whether he survives or not.
Tests:
>>> gone_bust(2)
HELP! HELP!
>>> gone_bust(6)
Pheww!
>>> gone_bust(10)
HELP! HELP!
"""
# This code tests your solution. Don't edit it.
import d... | code_fim | medium | {
"lang": "python",
"repo": "LukeBriggsDev/GCSE-Code-Tasks",
"path": "/p01.1/six_or_bust.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LukeBriggsDev/GCSE-Code-Tasks path: /p01.1/six_or_bust.py
"""
Problem:
A desperate gambler has bet all of his money on a final last throw of the die.
If he rolls a six, he survives to fight another day.
Anything else, and he gets thrown to the thugs waiting for him in the back all... | code_fim | hard | {
"lang": "python",
"repo": "LukeBriggsDev/GCSE-Code-Tasks",
"path": "/p01.1/six_or_bust.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if os.path.exists(indrafolder / "firstrun") == True:
firstrun = True
print("Hello!")
sleep(2)
print("I'm Your Friendly Conversation Program!")
sleep(2)
print("my name is Indra!")
sleep(2)
while True:
name = input("what is your name? ")
if not name:
... | code_fim | medium | {
"lang": "python",
"repo": "Hartsaxena/ProjectIndra",
"path": "/Vitals/NewGame.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hartsaxena/ProjectIndra path: /Vitals/NewGame.py
# This detects if the current Operating system is macOS
if platform.system() != "Darwin":
print("Warning! It seems you aren't running this on a macOS system!")
sleep(2)
print("This program will most definitely fail if it is not run on ... | code_fim | medium | {
"lang": "python",
"repo": "Hartsaxena/ProjectIndra",
"path": "/Vitals/NewGame.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sauske/Py2Excel path: /Client/Tools/ExcelTable/Bat/goods_info_pb2.py
x13\n\x08goods_id\x18\x01 \x02(\r:\x01\x30\x12\x0e\n\x04name\x18\x02 \x01(\x0c:\x00\x12\x0e\n\x03sex\x18\x03 \x01(\r:\x01\x30\x12\x16\n\x0blevel_limit\x18\x04 \x01(\r:\x01\x30\x12\x19\n\x0e\x63lub_vip_level\x18\x05 \x01(\x05:\x0... | code_fim | hard | {
"lang": "python",
"repo": "Sauske/Py2Excel",
"path": "/Client/Tools/ExcelTable/Bat/goods_info_pb2.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sauske/Py2Excel path: /Client/Tools/ExcelTable/Bat/goods_info_pb2.py
2 .TableProto.goods_info.GoodsAttr\x12\x15\n\x0b\x64\x65scription\x18\x1d \x01(\x0c:\x00\x12\x13\n\x08limit_id\x18\x1e \x01(\r:\x01\x30\x12\x15\n\x0bsubSystemId\x18\x1f \x01(\x0c:\x00\x1aK\n\x05Price\x12\x13\n\x08price_dq\x18\x0... | code_fim | hard | {
"lang": "python",
"repo": "Sauske/Py2Excel",
"path": "/Client/Tools/ExcelTable/Bat/goods_info_pb2.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>_GOODS_INFO_ARRAY = _descriptor.Descriptor(
name='goods_info_ARRAY',
full_name='TableProto.goods_info_ARRAY',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='items', full_name='TableProto.goods_info_ARRAY.items', index=0,
number... | code_fim | hard | {
"lang": "python",
"repo": "Sauske/Py2Excel",
"path": "/Client/Tools/ExcelTable/Bat/goods_info_pb2.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swc2124/nbodyparallel path: /mpinbd_lib.py
# ====================================================================
# Author : swc21
# Date : 2018-03-14 09:41:11
# Project : ClusterFiles
# File Name : mpinbd_lib
# Last Modified by : swc21
# Last Modified time : 2018-03-14 10:29:0... | code_fim | hard | {
"lang": "python",
"repo": "swc2124/nbodyparallel",
"path": "/mpinbd_lib.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>group_observers = group_world.Incl(observers)
comm_observers = comm_world.Create(group=group_observers)
group_workers = group_world.Incl(workers)
comm_workers = comm_world.Create(group=group_workers)
group_managers = group_world.Incl(managers)
comm_managers = comm_world.Create(group=group_managers)
'''
if... | code_fim | hard | {
"lang": "python",
"repo": "swc2124/nbodyparallel",
"path": "/mpinbd_lib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in motifs:
res = GetEntreeProsite(i)
results.append({
'name': res.getName(),
'type': res.getPrositeType(),
'accession number': res.getAccessionNumber(),
'occurence': res.getOccurenceNumber()
... | code_fim | hard | {
"lang": "python",
"repo": "LouaiKB/Bioinformatic-tools",
"path": "/back-end/ScanProsite.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LouaiKB/Bioinformatic-tools path: /back-end/ScanProsite.py
from Lecture import LireFasta
from Bio.ExPASy import ScanProsite
from getEntrees import GetEntreeProsite
<|fim_suffix|>def getMotifs(path):
fastaSeq = LireFasta(path, 'fasta')
sequence = fastaSeq.getSequence()
result = scan... | code_fim | medium | {
"lang": "python",
"repo": "LouaiKB/Bioinformatic-tools",
"path": "/back-end/ScanProsite.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def getMotifs(path):
fastaSeq = LireFasta(path, 'fasta')
sequence = fastaSeq.getSequence()
result = scanSequence(sequence)
motifs = []
results = []
if len(result):
for i in range(len(result)):
a = result[i]['signature_ac']
motifs.append(a)
... | code_fim | medium | {
"lang": "python",
"repo": "LouaiKB/Bioinformatic-tools",
"path": "/back-end/ScanProsite.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#--insert '0' in the first position
xoff = np.hstack((0,delr_cum))
yoff = np.hstack((0,delc_cum))
wr = shapefile.Writer()
wr.field('row',fieldType='N',size=20)
wr.field('column',fieldType='N',size=20)
wr.field('delx',fieldType='N',size=20)
wr.field('dely',fieldType='N',size=20)
wr.field('cellnum',fieldT... | code_fim | hard | {
"lang": "python",
"repo": "jtwhite79/my_python_junk",
"path": "/gather/gathered/make_grid_centroid_points.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jtwhite79/my_python_junk path: /gather/gathered/make_grid_centroid_points.py
import re
import math
import numpy as np
import shapefile
def free_u1drel(length,file):
line = file.readline().strip().split()
data = []
if line[0].upper() == 'CONSTANT':
for l in range(length):... | code_fim | hard | {
"lang": "python",
"repo": "jtwhite79/my_python_junk",
"path": "/gather/gathered/make_grid_centroid_points.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>wr = shapefile.Writer()
wr.field('row',fieldType='N',size=20)
wr.field('column',fieldType='N',size=20)
wr.field('delx',fieldType='N',size=20)
wr.field('dely',fieldType='N',size=20)
wr.field('cellnum',fieldType='N',size=20)
cell_count = 0
for r in range(0,nrow):
for c in range(0,ncol):
... | code_fim | hard | {
"lang": "python",
"repo": "jtwhite79/my_python_junk",
"path": "/gather/gathered/make_grid_centroid_points.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># main
words = sys.argv
if len(words) > 1:
if words[1] == "/dice":
try:
throwDice(words[2], words[3], words[4])
except IndexError:
print(" Bad dice syntax, usage: /dice dice_count number_of_dice_sides target_number_for_throw_again")
elif words[1] == "/color... | code_fim | hard | {
"lang": "python",
"repo": "haterzlin/textlivechat",
"path": "/py/parse_command.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haterzlin/textlivechat path: /py/parse_command.py
#!/usr/bin/python3
"""
parse commands for chat server, do whatever is needed and pri
- commands:
/webrtc to allow webrtc signaling functionality
/dice throws dice
message saves message from user to log
"""
<|fim_suffix|> # throw x... | code_fim | medium | {
"lang": "python",
"repo": "haterzlin/textlivechat",
"path": "/py/parse_command.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1)
random_forest = Pipeline([('vect', CountVectorizer()), ('tfidf', TfidfTransformer()), ('Random', RandomForestClassifier(random_state=1))])
random_forest = random_forest.fit(X_train, y_train)
ypred = ra... | code_fim | medium | {
"lang": "python",
"repo": "ibrahimyesilay/NSE_Sentiment_Analysis",
"path": "/site_crawler/NLP_models/random_forest/random_forest_accuracy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ibrahimyesilay/NSE_Sentiment_Analysis path: /site_crawler/NLP_models/random_forest/random_forest_accuracy.py
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import metrics
from sklearn.pipeline import Pipeline
from sklearn.ensemble import RandomForestClassifier
from sklearn.model... | code_fim | medium | {
"lang": "python",
"repo": "ibrahimyesilay/NSE_Sentiment_Analysis",
"path": "/site_crawler/NLP_models/random_forest/random_forest_accuracy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testAddNoticeToOrigins(self):
# test new NoticeOrigin
self.origins.add_notice_to_origins('origin_str', self.notice_info)
self.assertEqual(len(self.origins.origins), 1)
self.assertEqual(self.origins.origins[0].origin_str, 'origin_str')
self.assertEqual(len(se... | code_fim | hard | {
"lang": "python",
"repo": "tern-tools/tern",
"path": "/tests/test_class_origins.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tern-tools/tern path: /tests/test_class_origins.py
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
import unittest
from tern.classes.notice import Notice
from tern.classes.origins import Origins
from test_fixtures import TestTemplate2
class TestC... | code_fim | hard | {
"lang": "python",
"repo": "tern-tools/tern",
"path": "/tests/test_class_origins.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> _capabilities = {"model": 'qubit'}
def __init__(self, wires, shots=1024, **kwargs):
if shots <= 0:
raise ValueError("Number of shots must be a positive integer.")
super().__init__(wires, shots)
self.reset()
self.analytic = False
@property
def ... | code_fim | hard | {
"lang": "python",
"repo": "thomascherickal/PennyLane-qsharp",
"path": "/pennylane_qsharp/device.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thomascherickal/PennyLane-qsharp path: /pennylane_qsharp/device.py
# Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# ... | code_fim | hard | {
"lang": "python",
"repo": "thomascherickal/PennyLane-qsharp",
"path": "/pennylane_qsharp/device.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
parser = colossalai.get_default_parser()
parser.add_argument('--from_torch', default=False, action='store_true')
parser.add_argument('--use_dummy_dataset', default=False, action='store_true')
args = parser.parse_args()
disable_existing_loggers()
if args.from_torch:
... | code_fim | hard | {
"lang": "python",
"repo": "hpcaitech/ColossalAI",
"path": "/examples/language/gpt/titans/train_gpt.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> train_ds = WebtextDataset(path=data_path, seq_len=gpc.config.SEQ_LEN)
train_dataloader = utils.get_dataloader(train_ds,
seed=42,
batch_size=gpc.config.BATCH_SIZE,
pin... | code_fim | hard | {
"lang": "python",
"repo": "hpcaitech/ColossalAI",
"path": "/examples/language/gpt/titans/train_gpt.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hpcaitech/ColossalAI path: /examples/language/gpt/titans/train_gpt.py
import contextlib
import os
import torch
import torch.nn as nn
from dataset.webtext import WebtextDataset
from titans.model.gpt import GPTLMLoss
import colossalai
import colossalai.utils as utils
from colossalai.context.paral... | code_fim | hard | {
"lang": "python",
"repo": "hpcaitech/ColossalAI",
"path": "/examples/language/gpt/titans/train_gpt.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ListConfigBGPPutErrorTestCase(NetworkApiTestCase):
list_config_bgp_uri = '/api/v4/list-config-bgp/'
fixtures_path = 'networkapi/api_list_config_bgp/v4/fixtures/{}'
fixtures = [
'networkapi/config/fixtures/initial_config.json',
'networkapi/system/fixtures/initial_variabl... | code_fim | hard | {
"lang": "python",
"repo": "globocom/GloboNetworkAPI",
"path": "/networkapi/api_list_config_bgp/v4/tests/sanity/sync/test_put.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: globocom/GloboNetworkAPI path: /networkapi/api_list_config_bgp/v4/tests/sanity/sync/test_put.py
# -*- coding: utf-8 -*-
from django.test.client import Client
from networkapi.test.test_case import NetworkApiTestCase
from networkapi.util.geral import mount_url
class ListConfigBGPPutSuccessTestCa... | code_fim | hard | {
"lang": "python",
"repo": "globocom/GloboNetworkAPI",
"path": "/networkapi/api_list_config_bgp/v4/tests/sanity/sync/test_put.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def test_put_inexistent_list_config_bgp(self):
"""Test PUT inexistent ListConfigBGP."""
list_config_bgp_path = self.json_path.\
format('inexistent_list_config_bgp.json')
response = self.client.put(
self.list_config_bgp_uri,
da... | code_fim | hard | {
"lang": "python",
"repo": "globocom/GloboNetworkAPI",
"path": "/networkapi/api_list_config_bgp/v4/tests/sanity/sync/test_put.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DKokh/tauRAMD path: /Ligand_swap_out/Scripts/change_coordinate.py
#!/usr/bin/env python
import os
import sys
import string
import re
def Usage():
print ("Usage: python ../change_charge.py template.mol2 new_coordinates.pdb new_name.mol2")
<|fim_suffix|>begin = 0
atom_number = 0
fout=open... | code_fim | hard | {
"lang": "python",
"repo": "DKokh/tauRAMD",
"path": "/Ligand_swap_out/Scripts/change_coordinate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>begin = 0
atom_number = 0
fout=open(file_input3,"w")
for l in lines1:
s = re.split("\s+",l)
# print l,begin
if (l.find("@<TRIPOS>ATOM")>=0):
begin = 1
fout.write(l)
elif (l.find("@<TRIPOS>BOND")>=0):
begin = 2
fout.write(l)
elif(begin == 1):
if s[2].strip... | code_fim | hard | {
"lang": "python",
"repo": "DKokh/tauRAMD",
"path": "/Ligand_swap_out/Scripts/change_coordinate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luozhouyang/easylib path: /easylib/log/logger_initializer.py
import logging
from logging.handlers import TimedRotatingFileHandler
from logging.handlers import RotatingFileHandler
class TimedRotatingLoggerInitializer:
def __init__(self,
path='/tmp/easylib.log',
... | code_fim | hard | {
"lang": "python",
"repo": "luozhouyang/easylib",
"path": "/easylib/log/logger_initializer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> path='/tmp/easylib.log',
name=None,
max_bytes=5 * 1024 * 1024,
backup_count=5,
format='%(asctime)s - %(levelname)s - %(name)s - %(filename)s - %(lineno)d - %(funcName)s -%(message)s',
level=logging.INFO):... | code_fim | hard | {
"lang": "python",
"repo": "luozhouyang/easylib",
"path": "/easylib/log/logger_initializer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@dataclass(frozen=True)
class TicketCheckIn:
id: UUID
occurred_at: datetime
ticket_id: TicketID
initiator_id: UserID<|fim_prefix|># repo: byceps/byceps path: /byceps/services/ticketing/models/checkin.py
"""
byceps.services.ticketing.models.checkin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... | code_fim | hard | {
"lang": "python",
"repo": "byceps/byceps",
"path": "/byceps/services/ticketing/models/checkin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: byceps/byceps path: /byceps/services/ticketing/models/checkin.py
"""
byceps.services.ticketing.models.checkin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2023 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
<|fim_suffix|>@dataclass(frozen=True)
clas... | code_fim | hard | {
"lang": "python",
"repo": "byceps/byceps",
"path": "/byceps/services/ticketing/models/checkin.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@dataclass(frozen=True)
class TicketValidForCheckIn:
id: TicketID
code: TicketCode
used_by: User
occupied_seat_id: SeatID | None
@dataclass(frozen=True)
class TicketCheckIn:
id: UUID
occurred_at: datetime
ticket_id: TicketID
initiator_id: UserID<|fim_prefix|># repo: bycep... | code_fim | hard | {
"lang": "python",
"repo": "byceps/byceps",
"path": "/byceps/services/ticketing/models/checkin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaocher82/Bobber path: /bobber/lib/docker/__init__.py
# SPDX-License-Identifier: MIT
import docker
from bobber.lib.docker.management import DockerManager
<|fim_suffix|># Map the instance methods to allow importing as "bobber.docker.<instance>"
# in other modules.
build = manager.build
cast = man... | code_fim | easy | {
"lang": "python",
"repo": "kaocher82/Bobber",
"path": "/bobber/lib/docker/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Map the instance methods to allow importing as "bobber.docker.<instance>"
# in other modules.
build = manager.build
cast = manager.cast
execute = manager.execute
export = manager.export
load = manager.load<|fim_prefix|># repo: kaocher82/Bobber path: /bobber/lib/docker/__init__.py
# SPDX-License-Identif... | code_fim | easy | {
"lang": "python",
"repo": "kaocher82/Bobber",
"path": "/bobber/lib/docker/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: demisto/content path: /Packs/CommonScripts/Scripts/WordTokenizeTest/WordTokenizeTest_test.py
from WordTokenizeTest import main
from CommonServerPython import formats
import demistomock as demisto
<|fim_suffix|> mocker.patch.object(demisto, 'args', return_value={'value': '<pre>this is a test<... | code_fim | hard | {
"lang": "python",
"repo": "demisto/content",
"path": "/Packs/CommonScripts/Scripts/WordTokenizeTest/WordTokenizeTest_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mocker.patch.object(demisto, 'args', return_value={'value': '<pre>this is a test</pre>'})
mocker.patch.object(demisto, 'results')
main()
assert demisto.results.call_count == 1
# call_args is tuple (args list, kwargs). we only need the first one
results = demisto.results.call_args[0... | code_fim | hard | {
"lang": "python",
"repo": "demisto/content",
"path": "/Packs/CommonScripts/Scripts/WordTokenizeTest/WordTokenizeTest_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baby5/HackerRank path: /Algorithms/Implementation/Triplets.py
#coding:utf-8
from collections import deque
n, d = map(int, raw_input().split())
a_list = map(int, raw_input().split())
<|fim_suffix|> while queue and a == queue[0][0]:
cell = queue.popleft()
if cell[1] == 3:
... | code_fim | medium | {
"lang": "python",
"repo": "baby5/HackerRank",
"path": "/Algorithms/Implementation/Triplets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while queue and a == queue[0][0]:
cell = queue.popleft()
if cell[1] == 3:
count += 1
else:
queue.append((cell[0]+d, cell[1]+1))
queue.append((a+d, 2))
print count<|fim_prefix|># repo: baby5/HackerRank path: /Algorithms/Implementat... | code_fim | medium | {
"lang": "python",
"repo": "baby5/HackerRank",
"path": "/Algorithms/Implementation/Triplets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> line_path = paths.LinePath(*self._coordinate_list)
self.assertIsInstance(line_path.centroid, coordinates.Coordinate)
self.assertEqual("55.29942, -4.55506, 0.0", line_path.centroid.__str__())
def test_height_changes(self):
c1 = coordinates.Coordinate(-43.232, 55.323, 50... | code_fim | hard | {
"lang": "python",
"repo": "Kevin-Prichard/kmlplus",
"path": "/test/test_paths.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kevin-Prichard/kmlplus path: /test/test_paths.py
from unittest import TestCase
from kmlplus import paths, coordinates
class TestPaths(TestCase):
@classmethod
def setUpClass(cls):
cls._origin = coordinates.Coordinate(55.33, -4.33)
cls._c1 = coordinates.Coordinate("55.323... | code_fim | hard | {
"lang": "python",
"repo": "Kevin-Prichard/kmlplus",
"path": "/test/test_paths.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_arc_path(self):
c1 = coordinates.Coordinate("55.1234, -4.1234, 0")
ap1 = paths.ArcPath(origin=c1, start_bearing=10, end_bearing=270, radius=25, direction='anticlockwise',
points=100)
print(ap1)
ap = paths.ArcPath(self._origin, 100, 2... | code_fim | hard | {
"lang": "python",
"repo": "Kevin-Prichard/kmlplus",
"path": "/test/test_paths.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.exists(path):
url_dir = 'http://www.tcdb.org/public/'
urllib.request.urlretrieve('%s%s' % (url_dir, filename), path)
return path
def main(args):
'''main method.'''
df = parse(args[0])
df.to_csv('out.csv', index=False)
if __name__ == '__main__':
m... | code_fim | hard | {
"lang": "python",
"repo": "neilswainston/transport4j",
"path": "/transport4j/tcdb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neilswainston/transport4j path: /transport4j/tcdb.py
'''
(c) University of Liverpool 2019
All rights reserved.
@author: neilswainston
'''
# pylint: disable=invalid-name
import os.path
import re
import sys
import urllib
from Bio import SeqIO
import pandas as pd
def parse(out_dir='data'):
... | code_fim | hard | {
"lang": "python",
"repo": "neilswainston/transport4j",
"path": "/transport4j/tcdb.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Get fasta DataFrame.'''
regex = re.compile(
r'gnl\|TC-DB\|([^\|]+)\|(\S+) ?([^\[]*) ?(?:(?:\[)(.*)(?:\]))?')
data = []
for record in SeqIO.parse(_get_file('tcdb', out_dir), 'fasta'):
match = regex.match(record.description)
data.append([term.strip() if term els... | code_fim | hard | {
"lang": "python",
"repo": "neilswainston/transport4j",
"path": "/transport4j/tcdb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> threading.Thread.__init__(self)
self.queue = queue
def run(self):
while True:
proxy_info = self.queue.get()
global count
global output
count = count + 1
if (count % 100 == 0):
logging.info("Processed %... | code_fim | hard | {
"lang": "python",
"repo": "89berner/abnormal",
"path": "/abnormal/proxies.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_proxies():
proxies = from_cyber_syndrome()
logging.info("Got %s proxies from cyber syndrome" % len(proxies))
return proxies
def check_proxies(threads, proxies_amount):
queue = Queue.Queue()
for i in range(threads):
t = ThreadUrl(queue)
t.setDaemon(True)
... | code_fim | hard | {
"lang": "python",
"repo": "89berner/abnormal",
"path": "/abnormal/proxies.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 89berner/abnormal path: /abnormal/proxies.py
#!/usr/bin/env python
import Queue
import threading
import urllib2
import time
import re
from time import sleep
import requests
import logging
output = []
count = 0
def parse_scripts(content):
soup = BeautifulSoup(content)
all_data = []
... | code_fim | hard | {
"lang": "python",
"repo": "89berner/abnormal",
"path": "/abnormal/proxies.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = executed_data[1]
assert type(data[0]) == datetime
assert type(data[1]) == int
assert type(data[2]) == str
assert data[2] == "Request."
current_unit_address = int(data[3])
assert type(current_unit_address) == int
f_code = int(data[4])
assert type(f_code) == int
... | code_fim | hard | {
"lang": "python",
"repo": "1vanC1ndr1c/modbus_gui_app",
"path": "/test/test_database/test_db_write.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1vanC1ndr1c/modbus_gui_app path: /test/test_database/test_db_write.py
import json
from datetime import datetime
import pytest
from modbus_gui_app.db_handler import Backend
executed_data = []
class MockDBConnection:
def __init__(self):
self.name = "MockDBConn"
@staticmethod
... | code_fim | hard | {
"lang": "python",
"repo": "1vanC1ndr1c/modbus_gui_app",
"path": "/test/test_database/test_db_write.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pybind/pybind11 path: /tests/test_virtual_functions.py
import pytest
import env # noqa: F401
m = pytest.importorskip("pybind11_tests.virtual_functions")
from pybind11_tests import ConstructorStats # noqa: E402
def test_override(capture, msg):
class ExtendedExampleVirt(m.ExampleVirt):
... | code_fim | hard | {
"lang": "python",
"repo": "pybind/pybind11",
"path": "/tests/test_virtual_functions.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 123
def lucky_number(self):
return 42.0
for obj in [m.D_Repeat(), m.D_Tpl()]:
assert obj.say_something(3) == "B says hi 3 times"
assert obj.unlucky_number() == 4444
assert obj.lucky_number() == 888.0
assert obj.say_everything() =... | code_fim | hard | {
"lang": "python",
"repo": "pybind/pybind11",
"path": "/tests/test_virtual_functions.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert o.A_value().value == "hi"
a = o.A_ref()
assert a.value == "hi"
a.value = "bye"
assert a.value == "bye"
def test_inherited_virtuals():
class AR(m.A_Repeat):
def unlucky_number(self):
return 99
class AT(m.A_Tpl):
def unlucky_number(self):
... | code_fim | hard | {
"lang": "python",
"repo": "pybind/pybind11",
"path": "/tests/test_virtual_functions.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeckerCHAN/shadowsocks path: /utils/ad_block/loader.py
__author__ = 'Decker'
import urllib
class ad_list_loader(object):
def __init__(self, ad_list_content):
<|fim_suffix|> for line in self.ad_list_content.splitlines():
if line.startswith('#'):
continue<|f... | code_fim | medium | {
"lang": "python",
"repo": "DeckerCHAN/shadowsocks",
"path": "/utils/ad_block/loader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for line in self.ad_list_content.splitlines():
if line.startswith('#'):
continue<|fim_prefix|># repo: DeckerCHAN/shadowsocks path: /utils/ad_block/loader.py
__author__ = 'Decker'
import urllib
class ad_list_loader(object):
<|fim_middle|> def __init__(self, ad_list... | code_fim | medium | {
"lang": "python",
"repo": "DeckerCHAN/shadowsocks",
"path": "/utils/ad_block/loader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return flight_computers
def select_leader():
leader = 0
while True:
resp = requests.get(f'http://127.0.0.1:{5000 + leader}/is_leader', timeout=1)
if resp.status_code != 200:
continue
resp_leader = json.loads(resp.content)['leader']
if resp_leader:... | code_fim | hard | {
"lang": "python",
"repo": "Guilian-Deflandre/LSDS-Project1",
"path": "/starter-code/without-ksp.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Guilian-Deflandre/LSDS-Project1 path: /starter-code/without-ksp.py
import argparse
import math
import pickle
import numpy as np
import time
import random
import requests
import json
from multiprocessing import Process
from computers import *
# Load the pickle files
actions = pickle.load(open("d... | code_fim | hard | {
"lang": "python",
"repo": "Guilian-Deflandre/LSDS-Project1",
"path": "/starter-code/without-ksp.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> while not complete:
if timestep % 100 == 0:
diff = time.time() - t0
if diff == 0:
diff = 1
speed = timestep / diff
if speed == 0:
speed = 1
left = len(states) - timestep
remaining_time = int... | code_fim | hard | {
"lang": "python",
"repo": "Guilian-Deflandre/LSDS-Project1",
"path": "/starter-code/without-ksp.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: magreiner/MMLP path: /backend/mmlp/manager/ComputeManager.py
from __future__ import annotations
import dataclasses
import os
import tempfile
from multiprocessing import Process
from pathlib import Path
from shutil import copytree
from typing import Union
from mmlp.Config import Config
from mmlp... | code_fim | hard | {
"lang": "python",
"repo": "magreiner/MMLP",
"path": "/backend/mmlp/manager/ComputeManager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ensure monitoring services for training are running
# monitoring_services = snap.parameters['monitoring']
# for service in monitoring_services:
# # Ports to expose from monitoring service
# ports = {}
# ports[] = service['port']
#
... | code_fim | hard | {
"lang": "python",
"repo": "magreiner/MMLP",
"path": "/backend/mmlp/manager/ComputeManager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skimpax/python-rfxcom path: /tests/protocol/test_base.py
from unittest import TestCase
from rfxcom.protocol.base import BasePacketHandler
from rfxcom.exceptions import InvalidPacketLength
from rfxcom.exceptions import MalformedPacket
class BaseTestCase(TestCase):
<|fim_suffix|> def test_ma... | code_fim | hard | {
"lang": "python",
"repo": "skimpax/python-rfxcom",
"path": "/tests/protocol/test_base.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.assertRaises(NotImplementedError):
self.parser.load(self.data)
def test_log_namer(self):
self.assertEquals(self.parser.log.name,
'rfxcom.protocol.BasePacketHandler')<|fim_prefix|># repo: skimpax/python-rfxcom path: /tests/protocol/test... | code_fim | hard | {
"lang": "python",
"repo": "skimpax/python-rfxcom",
"path": "/tests/protocol/test_base.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>lip = audio.get_section_audio(util_audio.Section(0, 7))
audio.vis_section(util_audio.Section(0, 7), 25, 5)
# IPython.display.Audio(data=audio_clip, rate=sr)
pass<|fim_prefix|># repo: akurmustafa/audio_lib path: /main.py
import os
# import IPython.display
from utils import util_audio
cur_folder_path = o... | code_fim | medium | {
"lang": "python",
"repo": "akurmustafa/audio_lib",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akurmustafa/audio_lib path: /main.py
import os
# import IPython.display
from utils import util_audio
cur_folder_path = os.getcwd()+'\\'
data_folder_path = cur_folder_path+'data\\'
audio_file_name = 'yaz_gazeteci_yaz.wav'
audio_file_path = data_folder_path+audio_file_name
sr, audio_data = util_... | code_fim | medium | {
"lang": "python",
"repo": "akurmustafa/audio_lib",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _icon = "issabel.png"
class Vicidial(_Callcenter):
_icon = "vicidial.png"
# Aliases<|fim_prefix|># repo: marquicus/diagrams path: /diagrams/onprem/callcenter.py
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OnPrem
class _Callcenter(_OnPrem):
_type ... | code_fim | medium | {
"lang": "python",
"repo": "marquicus/diagrams",
"path": "/diagrams/onprem/callcenter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marquicus/diagrams path: /diagrams/onprem/callcenter.py
# This module is automatically generated by autogen.sh. DO NOT EDIT.
<|fim_suffix|> _icon = "issabel.png"
class Vicidial(_Callcenter):
_icon = "vicidial.png"
# Aliases<|fim_middle|>from . import _OnPrem
class _Callcenter(_OnPre... | code_fim | hard | {
"lang": "python",
"repo": "marquicus/diagrams",
"path": "/diagrams/onprem/callcenter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EUDAT-B2FIND/md-ingestion path: /mdingestion/community/midas.py
from .base import Repository
from ..service_types import SchemaType, ServiceType
<|fim_suffix|> if not doc.publisher:
doc.publisher = 'Lithuanian National Open Access Research Data Archive (MIDAS)'<|fim_middle|>c... | code_fim | hard | {
"lang": "python",
"repo": "EUDAT-B2FIND/md-ingestion",
"path": "/mdingestion/community/midas.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not doc.publisher:
doc.publisher = 'Lithuanian National Open Access Research Data Archive (MIDAS)'<|fim_prefix|># repo: EUDAT-B2FIND/md-ingestion path: /mdingestion/community/midas.py
from .base import Repository
from ..service_types import SchemaType, ServiceType
<|fim_middle|>c... | code_fim | hard | {
"lang": "python",
"repo": "EUDAT-B2FIND/md-ingestion",
"path": "/mdingestion/community/midas.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pierson-we/tacotron path: /youtube_data.py
import subprocess
import sys
import os
import glob
import nlpre
import inflect
import numpy as np
def download(url):
if not os.path.exists(url.split('=')[-1] + '.wav'):
cmd = 'youtube-dl -q -x --restrict-filenames --audio-format wav --audio-quality 0... | code_fim | hard | {
"lang": "python",
"repo": "pierson-we/tacotron",
"path": "/youtube_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def create_files(seg_dict, file_hz):
metadata = []
for srt_file in seg_dict:
wav_file = srt_file.split('.srt')[0] + '.wav'
count = 0
for snippet in seg_dict[srt_file]:
text = seg_dict[srt_file][snippet]['text']
clean = clean_text(text)
if clean.strip() == '':
continue
snippet_file ... | code_fim | hard | {
"lang": "python",
"repo": "pierson-we/tacotron",
"path": "/youtube_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> card_ids = sorted(cards.keys())
data = np.empty(len(card_ids), dtype=cls.table_def.dtype)
id_ = data['ID']
cp = data['CP']
x = data['X']
cd = data['CD']
ps = data['PS']
seid = data['SEID']
def _get_val(val, default):
if... | code_fim | hard | {
"lang": "python",
"repo": "13269252368/h5nastran",
"path": "/h5nastran/node.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(len(ids)):
nid = ids[i]
arr = np.array(x[i])
arr.setflags(write=False)
result[nid] = arr
self._grid_dict = ImmutableDict(result)
return self._grid_dict
def grid_in_basic_dict(self):
# type: () -> Immutabl... | code_fim | hard | {
"lang": "python",
"repo": "13269252368/h5nastran",
"path": "/h5nastran/node.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 13269252368/h5nastran path: /h5nastran/node.py
from __future__ import print_function, absolute_import
from six import iteritems, itervalues
from six.moves import range
import tables
import numpy as np
from typing import Dict
from card_table import CardTable, TableDef, DataHelper
from immutable_... | code_fim | hard | {
"lang": "python",
"repo": "13269252368/h5nastran",
"path": "/h5nastran/node.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> check_cli_execute_file_pipeline(
script_relative_path('../../dagster_examples/intro_tutorial/config.py'),
'hello_with_config_pipeline',
script_relative_path('../../dagster_examples/intro_tutorial/config_env.yaml'),
)
def test_run_config():
run()<|fim_prefix|># repo: t... | code_fim | hard | {
"lang": "python",
"repo": "treff7es/dagster",
"path": "/examples/dagster_examples_tests/tutorial_tests/test_config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: treff7es/dagster path: /examples/dagster_examples_tests/tutorial_tests/test_config.py
# encoding: utf-8
from dagster import execute_pipeline
from dagster.utils import check_cli_execute_file_pipeline, check_script, script_relative_path
from dagster_examples.intro_tutorial.config import hello_with... | code_fim | hard | {
"lang": "python",
"repo": "treff7es/dagster",
"path": "/examples/dagster_examples_tests/tutorial_tests/test_config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert result.success
assert len(result.solid_result_list) == 1
assert result.result_for_solid('hello_with_config').output_value() == 'Hello, world!'
def test_tutorial_script_part_four():
check_script(script_relative_path('../../dagster_examples/intro_tutorial/config.py'))
def test_tut... | code_fim | hard | {
"lang": "python",
"repo": "treff7es/dagster",
"path": "/examples/dagster_examples_tests/tutorial_tests/test_config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Amber916Young/WranglerScripts path: /findControlledBy.py
import requests
import json
import argparse
import os.path
HEADERS = {'content-type': 'application/json'}
DEBUG_ON = False
SERVER = 'http://www.encodeproject.org'
AUTHID = 'default provided by keypairs.json'
AUTHPW = 'default provided by k... | code_fim | hard | {
"lang": "python",
"repo": "Amber916Young/WranglerScripts",
"path": "/findControlledBy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> key = biosample
if key not in controlfiles:
controlfiles[key] = [ff_obj['accession']]
else:
print "error: biosample has multiple files"
controlfiles[key].append(ff_obj['accession'])
controlfiles[key].append... | code_fim | hard | {
"lang": "python",
"repo": "Amber916Young/WranglerScripts",
"path": "/findControlledBy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chr33z/py-spotify-setlist-generator path: /py_spotify_sg_cli.py
from __future__ import print_function, unicode_literals
from PyInquirer import prompt, print_json
from py_spotify_sg import SpotifySetlistGenerator
import msvcrt
import os
import json
import sys
import webbrowser
setlist_generator =... | code_fim | hard | {
"lang": "python",
"repo": "chr33z/py-spotify-setlist-generator",
"path": "/py_spotify_sg_cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # If the song name is empty then the info attribute often provides some info
if not name and info:
print('{}. !Info: {}'.format(count, info))
else:
print('{}. {}'.format(count, name))
count += 1
print('')
def find_authentifications():
'''
... | code_fim | hard | {
"lang": "python",
"repo": "chr33z/py-spotify-setlist-generator",
"path": "/py_spotify_sg_cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## manhattan_distance
def manhattan_distance_0_getargs() : #TEST 71
return [ Point((0,0)), Point((3,4)) ]
def manhattan_distance_0_testanswer(val, original_val = None) :
return val == 7
make_test(type = 'FUNCTION_ENCODED_ARGS',
getargs = manhattan_distance_0_getargs,
testanswe... | code_fim | hard | {
"lang": "python",
"repo": "sandhoefner/sandhoefner.github.io",
"path": "/6034/lab5/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sandhoefner/sandhoefner.github.io path: /6034/lab5/tests.py
DED_ARGS',
getargs = id_tree_classify_point_1_getargs,
testanswer = id_tree_classify_point_1_testanswer,
expected_val = "female",
name = 'id_tree_classify_point')
#stump -> apply classifier
#class... | code_fim | hard | {
"lang": "python",
"repo": "sandhoefner/sandhoefner.github.io",
"path": "/6034/lab5/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#BOUNDARY_ANS_8: Boundaries should never intersect training points!
BOUNDARY_ANS_8_getargs = 'BOUNDARY_ANS_8' #TEST 54
def BOUNDARY_ANS_8_testanswer(val, original_val = None):
if val == None:
raise NotImplementedError
return val == 4
make_test(type = 'VALUE',
getargs = BOUNDARY_... | code_fim | hard | {
"lang": "python",
"repo": "sandhoefner/sandhoefner.github.io",
"path": "/6034/lab5/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def generate_random_key(length=DEFAULT_KEYLENGTH):
rndfile = Random.new()
return rndfile.read(length // 8)
def get_default_params(params=None):
if type(params) in [str, bytes]:
raise ValueError("Calling get_default_params with a key directly is deprecated, it expects a params dict")
... | code_fim | hard | {
"lang": "python",
"repo": "ably/ably-python",
"path": "/ably/util/crypto.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.