text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> path_valid = self.is_path_in_view(view) if self.path_in_init_view else True
target_valid = not self.is_target_in_view(view) if self.target_not_in_init_view else True
return path_valid and target_valid
def get_view(self, world, pos):
# find start of view because view_pos indicates center of view
... | code_fim | hard | {
"lang": "python",
"repo": "kevinkepp/search-for-this",
"path": "/sft/sim/PathWorldGenerator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def init_path(self, world, graph):
# only add one path for now
# sample length for path
self.generator.generate_path(self.sample_path_length(), graph, path_id=0)
nodes = sorted(graph.nodes(), key=lambda n: n.id)
self.logger.log_parameter("Generated path", [str(n.pos) for n in nodes])
self.ren... | code_fim | hard | {
"lang": "python",
"repo": "kevinkepp/search-for-this",
"path": "/sft/sim/PathWorldGenerator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tungnt244/ie_tourism_model path: /tests/layer_test.py
import unittest
import numpy as np
from keras.models import Sequential
from keras.layers import Embedding
<|fim_suffix|> def test_chain_crf(self):
vocab_size = 20
n_classes = 11
model = Sequential()
model.a... | code_fim | medium | {
"lang": "python",
"repo": "tungnt244/ie_tourism_model",
"path": "/tests/layer_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class LayerTest(unittest.TestCase):
def test_chain_crf(self):
vocab_size = 20
n_classes = 11
model = Sequential()
model.add(Embedding(vocab_size, n_classes))
layer = ChainCRF()
model.add(layer)
model.compile(loss=layer.loss, optimizer='sgd')
... | code_fim | medium | {
"lang": "python",
"repo": "tungnt244/ie_tourism_model",
"path": "/tests/layer_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Train first mini batch
batch_size, maxlen = 2, 2
x = np.random.randint(1, vocab_size, size=(batch_size, maxlen))
y = np.random.randint(n_classes, size=(batch_size, maxlen))
y = np.eye(n_classes)[y]
model.train_on_batch(x, y)
print(x)
print... | code_fim | hard | {
"lang": "python",
"repo": "tungnt244/ie_tourism_model",
"path": "/tests/layer_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
nodes = CptNodesHolder(filename=options.counts_file)
genef = open(options.gene_file)
gidx = []
gidx_dict = {}
for l in genef:
(idx, gene) = l.strip().split()
gidx.append((int(idx)-1, gene))
gidx_dict[gene] = int(idx)
genef.close()
bin_effects = []... | code_fim | hard | {
"lang": "python",
"repo": "FunctionLab/flib",
"path": "/bnserver.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FunctionLab/flib path: /bnserver.py
import socket
import struct
import logging
logger = logging.getLogger(__name__)
import operator
import sys
import numpy
from counter import Counter
from cdatabase import CDatabase
from xdslparser import CptNodesHolder
class BNServer:
INFERENCE, DATA, GR... | code_fim | hard | {
"lang": "python",
"repo": "FunctionLab/flib",
"path": "/bnserver.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def inference_otf(self, genes):
results = {}
s = self.open_socket()
size = 1 + 4 # opcode + num. datasets
#for i in range(len(self.bin_effects)):
# bins = len(self.bin_effects[i])
# size += 4*(bins + 2) # data id + num. bins + bin log ratios
... | code_fim | hard | {
"lang": "python",
"repo": "FunctionLab/flib",
"path": "/bnserver.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __eq__(self, other):
if other==None:
return False
return all(this_v == other_v for this_v, other_v in zip(self.values, other.values))
def __repr__(self):
return " ".join(map(
lambda x: x[0] + ":" + x[1], zip(self.fields, map(str,self.values))
))<|fim_prefix|># repo: marcofavorito/info... | code_fim | medium | {
"lang": "python",
"repo": "marcofavorito/information-extraction-from-annotated-wikipedia",
"path": "/disambiguation/BabelNetConcept.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marcofavorito/information-extraction-from-annotated-wikipedia path: /disambiguation/BabelNetConcept.py
import constants as c
class BabelNetConcept(object):
"""
This class represents the annotation schema provided in the annotated corpus.
There is also the field "subConceptList", used to keep ... | code_fim | hard | {
"lang": "python",
"repo": "marcofavorito/information-extraction-from-annotated-wikipedia",
"path": "/disambiguation/BabelNetConcept.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
return " ".join(map(
lambda x: x[0] + ":" + x[1], zip(self.fields, map(str,self.values))
))<|fim_prefix|># repo: marcofavorito/information-extraction-from-annotated-wikipedia path: /disambiguation/BabelNetConcept.py
import constants as c
class BabelNetConcept(object):
"""
T... | code_fim | medium | {
"lang": "python",
"repo": "marcofavorito/information-extraction-from-annotated-wikipedia",
"path": "/disambiguation/BabelNetConcept.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = await tile38.ttl(key, id)
assert response.ok
assert response.ttl < expire<|fim_prefix|># repo: trivedisorabh/pyle38 path: /tests/test_command_ttl.py
import pytest
key = "fleet"
id = "truck"
expire = 5
<|fim_middle|>
@pytest.mark.asyncio
async def test_command_ttl(tile38):
res... | code_fim | medium | {
"lang": "python",
"repo": "trivedisorabh/pyle38",
"path": "/tests/test_command_ttl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trivedisorabh/pyle38 path: /tests/test_command_ttl.py
import pytest
key = "fleet"
id = "truck"
expire = 5
<|fim_suffix|> response = await tile38.ttl(key, id)
assert response.ok
assert response.ttl < expire<|fim_middle|>@pytest.mark.asyncio
async def test_command_ttl(tile38):
res... | code_fim | medium | {
"lang": "python",
"repo": "trivedisorabh/pyle38",
"path": "/tests/test_command_ttl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if self.coherent_mode_decomposition is None:
self.calculate()
if self.view_type != 0:
self.do_plot_send_mode()
beamline = WOBeamline(light_source=self.get_light_source())
print(">>> sending mode: ", int(self.mode_index))
self.send("WofryDa... | code_fim | hard | {
"lang": "python",
"repo": "oasys-esrf-kit/OASYS1-ESRF-Extensions",
"path": "/orangecontrib/esrf/wofry/widgets/extension/ow_undulator_coherent_mode_decomposition_1D.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
self.set_visible()
def set_visible(self):
self.emittances_box_h.setVisible(self.scan_direction_flag == 0)
self.emittances_box_v.setVisible(self.scan_direction_flag == 1)
def increase_mode_index(self):
self.mode_index += 1
if self.coherent_mode_decomposit... | code_fim | hard | {
"lang": "python",
"repo": "oasys-esrf-kit/OASYS1-ESRF-Extensions",
"path": "/orangecontrib/esrf/wofry/widgets/extension/ow_undulator_coherent_mode_decomposition_1D.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oasys-esrf-kit/OASYS1-ESRF-Extensions path: /orangecontrib/esrf/wofry/widgets/extension/ow_undulator_coherent_mode_decomposition_1D.py
ceive_syned_data"),
("Trigger", TriggerOut, "receive_trigger_signal"),
]
outputs = [
{"name":"WofryData",
... | code_fim | hard | {
"lang": "python",
"repo": "oasys-esrf-kit/OASYS1-ESRF-Extensions",
"path": "/orangecontrib/esrf/wofry/widgets/extension/ow_undulator_coherent_mode_decomposition_1D.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def reset(self):
self._start_time, self._end_time, self._elapsed_time = None, None, None
def start(self):
if self._start_time:
raise StartTimerException()
self._start_time = self.DEFAULT_CLOCK_FUNCTION()
def end(self):
if not self._start_time:
... | code_fim | hard | {
"lang": "python",
"repo": "o7878x/pytoolkit",
"path": "/src/timer/base_timer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: o7878x/pytoolkit path: /src/timer/base_timer.py
import time
from typing import Optional, Callable
from src.timer.timer_exception import StartTimerException, EndTimerException, CalculateTimerException
<|fim_suffix|> def end(self):
if not self._start_time:
raise EndTimerExc... | code_fim | hard | {
"lang": "python",
"repo": "o7878x/pytoolkit",
"path": "/src/timer/base_timer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
timer = BaseTimer()
timer.start()
for i in range(1000):
pass
timer.end()
print(timer.calculate())<|fim_prefix|># repo: o7878x/pytoolkit path: /src/timer/base_timer.py
import time
from typing import Optional, Callable
from src.timer.timer_exception i... | code_fim | hard | {
"lang": "python",
"repo": "o7878x/pytoolkit",
"path": "/src/timer/base_timer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f"Adding a new const node: {name}", file=sys.stderr)
node = graph_def.node.add()
node.op = 'Const'
node.name = name
node.attr['value'].tensor.CopyFrom(new_tensor)
node.attr['dtype'].type = new_tensor.dtype
return graph_def.SerializeToString()<|fim_prefix|># repo: shonoh... | code_fim | medium | {
"lang": "python",
"repo": "shonohs/modelutils",
"path": "/modelutils/tensorflow/set_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shonohs/modelutils path: /modelutils/tensorflow/set_data.py
import sys
def set_data(model_filepath, name, value):
import tensorflow
graph_def = tensorflow.compat.v1.GraphDef()
graph_def.ParseFromString(model_filepath.read_bytes())
new_tensor = tensorflow.make_tensor_proto(value... | code_fim | medium | {
"lang": "python",
"repo": "shonohs/modelutils",
"path": "/modelutils/tensorflow/set_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> node = graph_def.node.add()
node.op = 'Const'
node.name = name
node.attr['value'].tensor.CopyFrom(new_tensor)
node.attr['dtype'].type = new_tensor.dtype
return graph_def.SerializeToString()<|fim_prefix|># repo: shonohs/modelutils path: /modelutils/tensorflow/set_data.py
import sy... | code_fim | hard | {
"lang": "python",
"repo": "shonohs/modelutils",
"path": "/modelutils/tensorflow/set_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WilliamsJose/E-Meeting-Python path: /src/main.py
import json
import os
from getpass import getpass
from time import sleep
from datetime import datetime
from uuid import uuid1
f = "C:/Users/Williams/Desktop/E-Meeting-Python/database/db.json"
def main():
clear()
#Cadastrar o primeiro coor... | code_fim | hard | {
"lang": "python",
"repo": "WilliamsJose/E-Meeting-Python",
"path": "/src/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Escreve no arquivo
def fileWrite(db):
try:
with open(f, "w+", encoding="utf8") as fw:
fw.write(json.dumps(db, ensure_ascii=False, indent=4))
fw.close()
except IOError:
print("Erro na gravação do arquivo. " + str(IOError))
def welcome(nome):
clear()
pr... | code_fim | hard | {
"lang": "python",
"repo": "WilliamsJose/E-Meeting-Python",
"path": "/src/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrterry/yoink path: /yoink/simplify.py
"""Functions for simplifying line segments"""
from __future__ import division
import numpy as np
from skimage import img_as_bool
#from skimage.morphology import skeletonize
def rdp_indexes(points, eps2, dist2=None):
"""Indexes of points kept using the... | code_fim | hard | {
"lang": "python",
"repo": "mrterry/yoink",
"path": "/yoink/simplify.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert False
def point_line_dist2(p, l1, l2):
"""Distance**2 between sequence of N, M-dimensional points and line l1-l2
Parameters
----------
p : array_like
sequence of N, M-dimensional points. shape = (N, M)
l1 : array_like
start of line segment len == M
l2 ... | code_fim | hard | {
"lang": "python",
"repo": "mrterry/yoink",
"path": "/yoink/simplify.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> desc = spectrum.find('spectrumDesc')
settings = desc.find('spectrumSettings')
instrument = settings.find('spectrumInstrument')
for param in instrument.iter('cvParam'):
if param.get('name') == 'TimeInMinutes':
return param.get('value')
return None
# an encapsulatio... | code_fim | hard | {
"lang": "python",
"repo": "bjpop/HiTIME",
"path": "/hitime/md_io.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bjpop/HiTIME path: /hitime/md_io.py
#!/bin/env python
from lxml import etree
import sys
import resource
import base64
import struct
import numpy as np
from itertools import *
import math
import csv
import logging
import os
import os.path
import pymzml
from collections import deque
import resourc... | code_fim | hard | {
"lang": "python",
"repo": "bjpop/HiTIME",
"path": "/hitime/md_io.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> grains.graphics.write_centroids_image(img=ga.base_image,
centroids=ga.centroids,
filename=fn)
if not no_summary:
fn = "{}.summary.txt".format(extensionless)
ga.write_summary(filename=fn)... | code_fim | hard | {
"lang": "python",
"repo": "seatonullberg/grains",
"path": "/grains/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seatonullberg/grains path: /grains/cli.py
import os
import click
import grains
@click.command()
@click.argument("filename")
@click.option("--h", default=0, help="content height in microns")
@click.option("--w", default=0, help="content width in microns")
@click.option("--no_histogram", is_flag=... | code_fim | hard | {
"lang": "python",
"repo": "seatonullberg/grains",
"path": "/grains/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> grains.graphics.write_histogram(data=ga.areas,
filename=fn)
if not no_centroids:
fn = "{}.centroids.png".format(extensionless)
grains.graphics.write_centroids_image(img=ga.base_image,
centroid... | code_fim | hard | {
"lang": "python",
"repo": "seatonullberg/grains",
"path": "/grains/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i, num in enumerate(ns):
ans += ones
if num == 1:
ans += i
if num == 2:
ans += twos
ones += num == 1
twos += num == 2
print ans<|fim_prefix|># repo: Wizmann/ACM-ICPC path: /51nod/1305.py
n = int(raw_input())
ns = map(int, [raw_input() for i in xrange(n)])
<|fim_mi... | code_fim | medium | {
"lang": "python",
"repo": "Wizmann/ACM-ICPC",
"path": "/51nod/1305.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Wizmann/ACM-ICPC path: /51nod/1305.py
n = int(raw_input())
ns = map(int, [raw_input() for i in xrange(n)])
<|fim_suffix|>ones, twos = 0, 0
ans = 0
for i, num in enumerate(ns):
ans += ones
if num == 1:
ans += i
if num == 2:
ans += twos
ones += num == 1
twos +=... | code_fim | medium | {
"lang": "python",
"repo": "Wizmann/ACM-ICPC",
"path": "/51nod/1305.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lyy520/CSSCheckStyle path: /ckstyle/browsers/BinaryRule.py
#/usr/bin/python
#encoding=utf-8
'''
0b111111111
|||||||||
|||||||||
|||||||||--ie6 ---------|
||||||||--ie7 ---------|
|||||||--ie8 ---------| ALLIE
||||||--ie9+ ---------|
|||||
|||||--opera
|... | code_fim | medium | {
"lang": "python",
"repo": "lyy520/CSSCheckStyle",
"path": "/ckstyle/browsers/BinaryRule.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>NOIE6 = IE9PLUS | IE8 | IE7 | NONEIE
NOIE67 = IE9PLUS | IE8 | NONEIE
NOIE678= IE9PLUS | NONEIE
NONE = 0b000000000
ALL = 0b111111111<|fim_prefix|># repo: lyy520/CSSCheckStyle path: /ckstyle/browsers/BinaryRule.py
#/usr/bin/python
#encoding=utf-8
'''
0b111111111
|||||||||
|||||||||
|||... | code_fim | hard | {
"lang": "python",
"repo": "lyy520/CSSCheckStyle",
"path": "/ckstyle/browsers/BinaryRule.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> fight_messages.append(", ".join(messages))
if char1.is_alive:
leveled_up = char1.gain_exp(char2)
if leveled_up:
fight_messages.append(f"{char1.name} feels stronger.")
char1.weapon.register_kill(char2)
else:
leveled_up = char2.gain_exp(char1)
... | code_fim | hard | {
"lang": "python",
"repo": "LuRsT/the_longest_corridor",
"path": "/combat/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LuRsT/the_longest_corridor path: /combat/__init__.py
from dragn.dice import D6
def fight(char1, char2):
if char1.dex + D6() > char2.dex + D6():
attacker, defender = char1, char2
else:
defender, attacker = char1, char2
<|fim_suffix|> fight_messages.append(", ".joi... | code_fim | hard | {
"lang": "python",
"repo": "LuRsT/the_longest_corridor",
"path": "/combat/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gabriel-wolf/ArticleAnalyzer.py path: /document analyzer.py
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 20:13:30 2018
@author: Gabriel Wolf
"""
import spacy
nlp = spacy.load('en_core_web_sm')
from spacy.lang.en import English
from spacy import displacy
from spacy.symbols import nsubj, VER... | code_fim | hard | {
"lang": "python",
"repo": "gabriel-wolf/ArticleAnalyzer.py",
"path": "/document analyzer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
f = open('exportspacy.html','w', encoding="utf-8")
message = html
f.write(message)
f.close()
sentence_spans = list(doc.sents)
summarytext = (" ".join([x['sentence'].text for x in ranked]))
summaryhtml = """<!DOCTYPE html><html><body style="font-size: 16px; font-family: -apple-system, BlinkMacSyste... | code_fim | hard | {
"lang": "python",
"repo": "gabriel-wolf/ArticleAnalyzer.py",
"path": "/document analyzer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> collection_admin.permissions.remove_user(USER_USERNAME, 'edit')
# Edit permission is removed again.
collection_user = self.user_res.collection.get(collection_admin.id)
collection_user.name = 'Another collection'
with self.assertRaises(ResolweServerError):
... | code_fim | hard | {
"lang": "python",
"repo": "romunov/resolwe-bio-py",
"path": "/resdk/tests/functional/permissions/e2e_permissions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> collection_admin.permissions.add_user(USER_USERNAME, 'edit')
# User can edit the collection.
collection_user = self.user_res.collection.get(collection_admin.id)
collection_user.name = 'New test collection'
collection_user.save()
collection_admin.permission... | code_fim | hard | {
"lang": "python",
"repo": "romunov/resolwe-bio-py",
"path": "/resdk/tests/functional/permissions/e2e_permissions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: romunov/resolwe-bio-py path: /resdk/tests/functional/permissions/e2e_permissions.py
# pylint: disable=missing-docstring,no-member
from resdk.exceptions import ResolweServerError
from ..base import USER_USERNAME, BaseResdkFunctionalTest
<|fim_suffix|> def test_permissions(self):
colle... | code_fim | medium | {
"lang": "python",
"repo": "romunov/resolwe-bio-py",
"path": "/resdk/tests/functional/permissions/e2e_permissions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sarincr/Semester-Long-Program-on-App-Development path: /23.Add/09.RegForm/main.py
from tkinter import*
root = Tk()
root.geometry('500x500')
root.title("Registration Form")
def Base():
print("Completed")
lbl0 = Label(root, text="Registration form",width=20,font=("bold", 20))
lbl0.place(x=90,... | code_fim | medium | {
"lang": "python",
"repo": "sarincr/Semester-Long-Program-on-App-Development",
"path": "/23.Add/09.RegForm/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lbl4 = Label(root, text="Age:",width=20,)
lbl4.place(x=70,y=280)
entr2 = Entry(root)
entr2.place(x=240,y=280)
Button(root, text='Submit',width=20,bg='brown',fg='white', command=Base).place(x=180,y=380)
root.mainloop()<|fim_prefix|># repo: sarincr/Semester-Long-Program-on-App-Development path: /23.Ad... | code_fim | hard | {
"lang": "python",
"repo": "sarincr/Semester-Long-Program-on-App-Development",
"path": "/23.Add/09.RegForm/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ydl = youtube_dl.YoutubeDL(ydl_opts)
filename = ydl.prepare_filename(ydl.extract_info(url, download=False))
remove_download(url)
if(os.path.exists(filename)):
pass
else:
update_download(path, filename, url, progress=0, downloader='youtube', source=source_uid)
... | code_fim | hard | {
"lang": "python",
"repo": "kmd000/datahoarder",
"path": "/datahoarder/download.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class DownloadWatcherThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self, name='DownloadWatcherThread', daemon=True)
def run(self):
# Run loop
while True:
# Check if there are any files downloading
skip = False
... | code_fim | hard | {
"lang": "python",
"repo": "kmd000/datahoarder",
"path": "/datahoarder/download.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kmd000/datahoarder path: /datahoarder/download.py
# Python dependencies
import time
import threading
import os
# Third-party dependencies
import requests
# Datahoarder imports
from datahoarder.models import Download
from datahoarder.logger import logger
def update_download(destin... | code_fim | hard | {
"lang": "python",
"repo": "kmd000/datahoarder",
"path": "/datahoarder/download.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muondu/multiplication-table path: /multiplication_table.py
a = int(input("Enter where you want to start: "))
b = int(input("Enter where you want to end: ")<|fim_suffix|> print("%4d " % (x*y), end = "")
print()<|fim_middle|>)
for x in range(a,b):
for y in range(a,b):
| code_fim | easy | {
"lang": "python",
"repo": "muondu/multiplication-table",
"path": "/multiplication_table.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("%4d " % (x*y), end = "")
print()<|fim_prefix|># repo: muondu/multiplication-table path: /multiplication_table.py
a = int(input("Enter where you want to start: "))
b = int(input("Enter where you want to end: ")<|fim_middle|>)
for x in range(a,b):
for y in range(a,b):
| code_fim | easy | {
"lang": "python",
"repo": "muondu/multiplication-table",
"path": "/multiplication_table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AntonMezhanskiy/sayagain-back path: /apps/sayagain/models.py
from django.db import models
from django.contrib.auth.models import User
from apps.core.models import BaseModel
<|fim_suffix|> example = models.CharField(
max_length=500,
default='',
blank=True,
verb... | code_fim | hard | {
"lang": "python",
"repo": "AntonMezhanskiy/sayagain-back",
"path": "/apps/sayagain/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return self.word
class Meta:
verbose_name = 'Слово'
verbose_name_plural = 'Слова'<|fim_prefix|># repo: AntonMezhanskiy/sayagain-back path: /apps/sayagain/models.py
from django.db import models
from django.contrib.auth.models import User
from apps.core.m... | code_fim | hard | {
"lang": "python",
"repo": "AntonMezhanskiy/sayagain-back",
"path": "/apps/sayagain/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> [end_of_stream,count_readings]=generate_stream.stream_output(10)
self.assertTrue( [end_of_stream,count_readings]==[True,10])
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: clean-code-craft-tcq-1/stream-bms-data-reetika97 path: /stream_test.py
import unittest
import g... | code_fim | hard | {
"lang": "python",
"repo": "clean-code-craft-tcq-1/stream-bms-data-reetika97",
"path": "/stream_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: clean-code-craft-tcq-1/stream-bms-data-reetika97 path: /stream_test.py
import unittest
import generate_stream
class GenerateStreamTest(unittest.TestCase):
def test_within_range_temp(self):
<|fim_suffix|> TestReading=generate_stream.generate_param_reading('temperature')
self.assertTrue((... | code_fim | hard | {
"lang": "python",
"repo": "clean-code-craft-tcq-1/stream-bms-data-reetika97",
"path": "/stream_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wuhao101/pmp path: /etabotsite/etabotapp/views.py
from django.shortcuts import render
from django.contrib.auth.models import User
from rest_framework import generics, permissions, status, mixins
from rest_framework.response import Response
from .serializers import UserSerializer, ProjectSerialize... | code_fim | hard | {
"lang": "python",
"repo": "wuhao101/pmp",
"path": "/etabotsite/etabotapp/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> queryset = Project.objects.all()
serializer_class = ProjectSerializer
permission_classes = (permissions.IsAuthenticated, IsOwner)
def get_queryset(self, *args, **kwargs):
return Project.objects.all().filter(owner=self.request.user)
class ProjectUpdateView(generics.GenericAPIVie... | code_fim | hard | {
"lang": "python",
"repo": "wuhao101/pmp",
"path": "/etabotsite/etabotapp/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ProjectCreateView(generics.ListCreateAPIView):
"""This class defines the create behavior of our rest api."""
queryset = Project.objects.all()
serializer_class = ProjectSerializer
permission_classes = (permissions.IsAuthenticated, IsOwner)
def perform_create(self, serializer):
... | code_fim | hard | {
"lang": "python",
"repo": "wuhao101/pmp",
"path": "/etabotsite/etabotapp/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lugrace/OptimizeMRIScanTimes path: /og/dopamine/dopamine/recon_env/compute_dists.py
import argparse
import models
from util import util
from torch.autograd import Variable
import torch
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-... | code_fim | hard | {
"lang": "python",
"repo": "lugrace/OptimizeMRIScanTimes",
"path": "/og/dopamine/dopamine/recon_env/compute_dists.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>im0 = util.load_image(opt.path0).transpose(2, 0, 1) / 255.
im1 = util.load_image(opt.path1).transpose(2, 0, 1) / 255.
# Load images
img0 = Variable(torch.FloatTensor(im0)[None,:,:,:])#util.im2tensor(im0) # RGB image from [-1,1]
img1 = Variable(torch.FloatTensor(im1)[None,:,:,:])#util.im2tensor(im1)
print... | code_fim | medium | {
"lang": "python",
"repo": "lugrace/OptimizeMRIScanTimes",
"path": "/og/dopamine/dopamine/recon_env/compute_dists.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Leenhazaimeh/data-structures-and-algorithms-1 path: /python/tests/test_multi_bracket_validation.py
import pytest
from challenges.multi_bracket_validation.multi_bracket_validation import *
def test_valid_data():
<|fim_suffix|> actual1=multi_bracket_validation('({()}')
actual2=multi_bracke... | code_fim | hard | {
"lang": "python",
"repo": "Leenhazaimeh/data-structures-and-algorithms-1",
"path": "/python/tests/test_multi_bracket_validation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_valid_data():
actual1=multi_bracket_validation('({()}')
actual2=multi_bracket_validation('({())')
actual3=multi_bracket_validation('({())))')
actual4=multi_bracket_validation('({()]')
excepted=False
assert actual1==excepted
assert actual2==excepted
assert actual3==... | code_fim | hard | {
"lang": "python",
"repo": "Leenhazaimeh/data-structures-and-algorithms-1",
"path": "/python/tests/test_multi_bracket_validation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> actual1=multi_bracket_validation('({()}')
actual2=multi_bracket_validation('({())')
actual3=multi_bracket_validation('({())))')
actual4=multi_bracket_validation('({()]')
excepted=False
assert actual1==excepted
assert actual2==excepted
assert actual3==excepted
assert act... | code_fim | hard | {
"lang": "python",
"repo": "Leenhazaimeh/data-structures-and-algorithms-1",
"path": "/python/tests/test_multi_bracket_validation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HSE-LAMBDA/rapid-ao path: /advopt/meta.py
import inspect
__all__ = [
'classfunc',
'apply_with_kwargs'
]
def get_kwargs(func):
params = inspect.signature(func).parameters
return [p.name for p in params.values()]
def apply_with_kwargs(f, *args, **kwargs):
accepted_kwargs = get_kwargs(f... | code_fim | medium | {
"lang": "python",
"repo": "HSE-LAMBDA/rapid-ao",
"path": "/advopt/meta.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
def __call__(self, *args, **kwargs):
return f(*self.args, **self.kwargs)(*args, **kwargs)
clazz = type(
f.__name__,
(object, ),
dict(__init__=__init__, __call__=__call__)
)
clazz.__init__.__sign... | code_fim | medium | {
"lang": "python",
"repo": "HSE-LAMBDA/rapid-ao",
"path": "/advopt/meta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'Dockstoredoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4... | code_fim | hard | {
"lang": "python",
"repo": "dockstore/dockstore-documentation",
"path": "/docs/conf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dockstore/dockstore-documentation path: /docs/conf.py
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# https://www.sphinx-doc.org/en/master/config... | code_fim | hard | {
"lang": "python",
"repo": "dockstore/dockstore-documentation",
"path": "/docs/conf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jael24/IHM_TP1 path: /kivyapp/file_dialog.py
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.popup import Popup
class FileDialog(FloatLayout):
def __init__(self, on_file_selected, dialog_title, btn_text, **kwargs):
"""
@param on_file_selected: a callback returning... | code_fim | medium | {
"lang": "python",
"repo": "Jael24/IHM_TP1",
"path": "/kivyapp/file_dialog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def show(self):
self._popup.open()
def _dismiss_popup(self):
self._popup.dismiss()
def _btn_load_clicked(self):
# TODO Check if image?
path = self._file_chooser.path
content = self._text_input.text
filename = (self._file_chooser.selection and s... | code_fim | medium | {
"lang": "python",
"repo": "Jael24/IHM_TP1",
"path": "/kivyapp/file_dialog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s'),
path('summernote/', include('django_summernote.urls')),
path('recipe/<slug:slug>/', views.RecipeDetails.as_view(), name='recipe_details'),
# path('comments/', include('django_comments_xtd.urls')),
path('ratings/', include('star_ratings.urls', namespace='ratings')),
path('friendshi... | code_fim | hard | {
"lang": "python",
"repo": "repacheco1/foodfficient-web",
"path": "/mysite/foodfficient/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: repacheco1/foodfficient-web path: /mysite/foodfficient/urls.py
from django.urls import path, include
from django.contrib.auth import views as auth_views
from django.conf import settings
from . import views
from django.conf.urls.static import static
urlpatterns = [
path('', views.homePageView... | code_fim | hard | {
"lang": "python",
"repo": "repacheco1/foodfficient-web",
"path": "/mysite/foodfficient/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertAlmostEqual(expected_output, actual_output)
def _test_unary_operator(self, op, inputs_to_output_map):
for input_, expected_output in inputs_to_output_map.items():
a = input_
actual_output = op(a)
self.assertAlmostEqual(expected_outp... | code_fim | hard | {
"lang": "python",
"repo": "andrewjunyoung/mvl",
"path": "/test/test_nvl.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> inputs_to_output_map = {
(0, 1): 0,
(1, 0): 0,
(1, 1): 1,
(0, 0): 0,
(0.5, 0): 0,
(0, 0.5): 0,
(0.5, 1): 0.5,
(1, 0.5): 0.5,
(0.5, 0.5): 0.25,
(0.2, 0.6):... | code_fim | hard | {
"lang": "python",
"repo": "andrewjunyoung/mvl",
"path": "/test/test_nvl.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewjunyoung/mvl path: /test/test_nvl.py
# Imports from third party packages.
from unittest import TestCase
from unittest import main as unittest_main
# Imports from the local package.
from mvl.lukasiewicz import (
LogicValue,
LogicSystem,
LukasiewiczLogicValue,
PriestLogicValu... | code_fim | hard | {
"lang": "python",
"repo": "andrewjunyoung/mvl",
"path": "/test/test_nvl.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_products(self, categoryid):
resp,content = self.send('/uc/services/product_gets', json.JSONEncoder(ensure_ascii = True).encode({'userid':self.userid,'sessionid':self.sessionid,'categoryid':categoryid}))
if resp.status == 200:
jsonresp = json.loads(content)
... | code_fim | hard | {
"lang": "python",
"repo": "caibinglong1987/ucserver",
"path": "/tools/ucunittest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: caibinglong1987/ucserver path: /tools/ucunittest.py
import json
import httplib2
import argparse
class UCUnitTest(object):
def __init__(self, host):
self.host = host
self.client = httplib2.Http(disable_ssl_certificate_validation=True)#httplib.HTTPConnection(host, port, timeout... | code_fim | hard | {
"lang": "python",
"repo": "caibinglong1987/ucserver",
"path": "/tools/ucunittest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> resp,content = self.send('/uc/services/prdcategory_gets', json.JSONEncoder(ensure_ascii = True).encode({'userid':self.userid,'sessionid':self.sessionid}))
if resp.status == 200:
jsonresp = json.loads(content)
print jsonresp
if jsonresp["error_no"] != 0:
... | code_fim | hard | {
"lang": "python",
"repo": "caibinglong1987/ucserver",
"path": "/tools/ucunittest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
rc = output(*sys.argv[1:])
sys.exit(rc)<|fim_prefix|># repo: robotframework/robotframework path: /atest/testdata/standard_libraries/operating_system/files/prog.py
import sys
def output(rc=0, stdout='', stderr='', count=1):
<|fim_middle|> if stdout:
sys.std... | code_fim | medium | {
"lang": "python",
"repo": "robotframework/robotframework",
"path": "/atest/testdata/standard_libraries/operating_system/files/prog.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
rc = output(*sys.argv[1:])
sys.exit(rc)<|fim_prefix|># repo: robotframework/robotframework path: /atest/testdata/standard_libraries/operating_system/files/prog.py
import sys
def output(rc=0, stdout='', stderr='', count=1):
<|fim_middle|> if stdout:
sys.stdo... | code_fim | medium | {
"lang": "python",
"repo": "robotframework/robotframework",
"path": "/atest/testdata/standard_libraries/operating_system/files/prog.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robotframework/robotframework path: /atest/testdata/standard_libraries/operating_system/files/prog.py
import sys
def output(rc=0, stdout='', stderr='', count=1):
<|fim_suffix|>if __name__ == '__main__':
rc = output(*sys.argv[1:])
sys.exit(rc)<|fim_middle|> if stdout:
sys.stdo... | code_fim | medium | {
"lang": "python",
"repo": "robotframework/robotframework",
"path": "/atest/testdata/standard_libraries/operating_system/files/prog.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StanfordVL/hand_eye_calibration path: /hand_eye_calibration_experiments/bin/compute_set_of_hand_eye_calibrations.py
read_time_stamped_poses_from_csv_file,
write_double_numpy_array_to_csv_file)
from hand_eye_calibration.time_alignment import (calcula... | code_fim | hard | {
"lang": "python",
"repo": "StanfordVL/hand_eye_calibration",
"path": "/hand_eye_calibration_experiments/bin/compute_set_of_hand_eye_calibrations.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Fill in result entries.
result_entry.success.append(success)
result_entry.num_initial_poses.append(len(dual_quat_B_H_vec))
result_entry.num_poses_kept.append(num_poses_kept)
result_entry.runtimes.append(runtime)
result_entry.singular_values.append(singular... | code_fim | hard | {
"lang": "python",
"repo": "StanfordVL/hand_eye_calibration",
"path": "/hand_eye_calibration_experiments/bin/compute_set_of_hand_eye_calibrations.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dq_H_E_optimized = optimized_calibration.pose_dq
time_offset_optimized = optimized_calibration.time_offset
print("Initial guess time offset: \t{}".format(
time_offset_initial_guess))
print("Optimized time offset: \t\t{}".format(time_offset_o... | code_fim | hard | {
"lang": "python",
"repo": "StanfordVL/hand_eye_calibration",
"path": "/hand_eye_calibration_experiments/bin/compute_set_of_hand_eye_calibrations.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vilkasgroup/epages_client path: /tests/test_dataobject_order_update.py
# -*- coding: utf-8 -*-
import unittest
from pprint import pprint
# import the package
import epages_client
from epages_client.dataobjects.order_update import OrderUpdate
from epages_client.dataobjects.remove_value import Re... | code_fim | hard | {
"lang": "python",
"repo": "vilkasgroup/epages_client",
"path": "/tests/test_dataobject_order_update.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> order = OrderUpdate()
order.customerComment = RemoveValue()
order.internalNote = RemoveValue()
order.viewedOn = RemoveValue()
order.rejectedOn = RemoveValue()
order.inProcessOn = RemoveValue()
order.pendingOn = RemoveValue()
order.readyForDis... | code_fim | hard | {
"lang": "python",
"repo": "vilkasgroup/epages_client",
"path": "/tests/test_dataobject_order_update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guiyaocheng/DeepRL-InformationExtraction path: /code/plots.py
''' plot R, Q, completion rate for multiple files at the same time'''
import sys, argparse
import matplotlib.pyplot as plt
import math
import numpy as np
# plt.gcf().subplots_adjust(bottom=0.15)
# plt.gcf().subplots_adjust(right=1.05... | code_fim | hard | {
"lang": "python",
"repo": "guiyaocheng/DeepRL-InformationExtraction",
"path": "/code/plots.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# for i in range(len(f)):
# plt.plot(f[i][:N], color=colors[i], label=labels[i], linestyle=linestyles[i], markersize=6, linewidth=3) #normal scale
# # plt.plot([-math.log(abs(x)) for x in f[i][:N]], color=colors[i], label=labels[i], linestyle=linestyles[i], markersize=6, linewidth=3) #log scale... | code_fim | hard | {
"lang": "python",
"repo": "guiyaocheng/DeepRL-InformationExtraction",
"path": "/code/plots.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('competition', '0024_auto_20170203_0619'),
]
operations = [
migrations.AlterField(
model_name='division',
name='sportingpulse_url',
field=models.URLField(blank=True, editable=False, max_length=1024, null=True),
),
... | code_fim | medium | {
"lang": "python",
"repo": "goodtune/vitriolic",
"path": "/tournamentcontrol/competition/migrations/0025_matchvideo_baseline.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: goodtune/vitriolic path: /tournamentcontrol/competition/migrations/0025_matchvideo_baseline.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-27 21:08
from __future__ import unicode_literals
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('co... | code_fim | medium | {
"lang": "python",
"repo": "goodtune/vitriolic",
"path": "/tournamentcontrol/competition/migrations/0025_matchvideo_baseline.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='division',
name='sportingpulse_url',
field=models.URLField(blank=True, editable=False, max_length=1024, null=True),
),
migrations.AlterUniqueTogether(
name='division',
... | code_fim | medium | {
"lang": "python",
"repo": "goodtune/vitriolic",
"path": "/tournamentcontrol/competition/migrations/0025_matchvideo_baseline.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LaYeqa/bespoke-fit path: /openff/bespokefit/tests/test_smirks_generation.py
"""
Test the smirks generator.
"""
from typing import List, Tuple
import pytest
from openforcefield.topology import Molecule
from openff.bespokefit.forcefield_tools import ForceFieldEditor
from openff.bespokefit.smirks... | code_fim | hard | {
"lang": "python",
"repo": "LaYeqa/bespoke-fit",
"path": "/openff/bespokefit/tests/test_smirks_generation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mol = Molecule.from_smiles("CC")
smirks_list = gen.generate_smirks(molecule=mol)
# we only request one parameter type
types = set([smirk.type for smirk in smirks_list])
assert len(types) == 1
@pytest.mark.parametrize("bespoke_smirks", [
pytest.param(True, id="Generate bespoke te... | code_fim | hard | {
"lang": "python",
"repo": "LaYeqa/bespoke-fit",
"path": "/openff/bespokefit/tests/test_smirks_generation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Get the full list of smirks which cover this molecule from the forcefield, no new smirks should be generated here.
"""
gen = SmirksGenerator()
gen.target_smirks = [SmirksType.Vdw, SmirksType.Bonds, SmirksType.Angles, SmirksType.ProperTorsions]
mol = Molecule.from_smiles("CO")
... | code_fim | hard | {
"lang": "python",
"repo": "LaYeqa/bespoke-fit",
"path": "/openff/bespokefit/tests/test_smirks_generation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YoshikazuArimitsu/aksdp path: /tests/test_graph.py
from aksdp.data import JsonData
from aksdp.dataset import DataSet
from aksdp.task import Task
from aksdp.graph import Graph, TaskStatus
import unittest
class ErrorTask(Task):
def main(self, ds):
raise ValueError("ValueError")
clas... | code_fim | hard | {
"lang": "python",
"repo": "YoshikazuArimitsu/aksdp",
"path": "/tests/test_graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def input_datakeys(self):
return ["DynTaskA"]
def main(self, ds: DataSet):
return DataSet()
class DynTaskC(Task):
def input_datakeys(self):
return ["DynTaskX"]
def main(self, ds: DataSet):
... | code_fim | hard | {
"lang": "python",
"repo": "YoshikazuArimitsu/aksdp",
"path": "/tests/test_graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: D0T1X/recipes path: /cookbook/migrations/0041_auto_20200502_1446.py
# Generated by Django 3.0.5 on 2020-05-02 12:46
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|> operations = [
migrations.AddField(
model_name='mealplan',
... | code_fim | medium | {
"lang": "python",
"repo": "D0T1X/recipes",
"path": "/cookbook/migrations/0041_auto_20200502_1446.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='mealplan',
name='title',
field=models.CharField(blank=True, default='', max_length=64),
),
migrations.AlterField(
model_name='mealplan',
name='recipe',
field=... | code_fim | medium | {
"lang": "python",
"repo": "D0T1X/recipes",
"path": "/cookbook/migrations/0041_auto_20200502_1446.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('cookbook', '0040_auto_20200502_1433'),
]
operations = [
migrations.AddField(
model_name='mealplan',
name='title',
field=models.CharField(blank=True, default='', max_length=64),
),
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "D0T1X/recipes",
"path": "/cookbook/migrations/0041_auto_20200502_1446.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def make_color(c):
if not isinstance(c, str):
c = ",".join(map(str, list(map(int, c))))
c = "({})".format(c)
return c
class BaseLoader:
def __init__(self, path, origin, color_dict, valve_dimension, connection_dimension):
self._path = path
self._origin = origin... | code_fim | hard | {
"lang": "python",
"repo": "NMGRL/pychron",
"path": "/pychron/canvas/canvas2D/scene/base_scene_loader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NMGRL/pychron path: /pychron/canvas/canvas2D/scene/base_scene_loader.py
# ===============================================================================
# Copyright 2021 ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... | code_fim | hard | {
"lang": "python",
"repo": "NMGRL/pychron",
"path": "/pychron/canvas/canvas2D/scene/base_scene_loader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i, (name, heading, pitch) in enumerate([
('px', 0, 0),
('nx', 180, 0),
('py', 0, 90),
('py', 0, -90),
('pz', 90, 0),
('nz', 270, 0),
]):
file_name = sys.argv[1] + '.%d.%s.jpg' % (i + 1, name)
if not os.path.exists(file_name):
url = (
'http://maps.go... | code_fim | medium | {
"lang": "python",
"repo": "mikeboers/PyRtx",
"path": "/scripts/get_streetview.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mikeboers/PyRtx path: /scripts/get_streetview.py
'''
Assemble with:
txmake -fov 120 -envcube test.*.jpg test-cube.tif
https://maps.google.com/maps?q=charles+and+commercial,+vancouver&ll=&spn=0.005439,0.009205&sll=49.273059,-123.069550&layer=c&cbp=13,98.04,,0,52.65&cbll=49.273059,-123.... | code_fim | hard | {
"lang": "python",
"repo": "mikeboers/PyRtx",
"path": "/scripts/get_streetview.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.