text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> parser.add_argument('--filter-file', default='~/.notification_filter', metavar='PATH',
help='Read simple scheme rules for filtering notifications from file (default: %(default)s).')
parser.add_argument('--filter-test', nargs=2, metavar=('SUMMARY', 'BODY'),
help='Do not start daemon, just test given ... | code_fim | hard | {
"lang": "python",
"repo": "jakeprobst/notification-thing",
"path": "/notification_thing/daemon.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jakeprobst/notification-thing path: /notification_thing/daemon.py
int_function
import itertools as it, operator as op, functools as ft
from time import time
from dbus.mainloop.glib import DBusGMainLoop
import dbus, dbus.service
import os, sys
import gi
gi.require_version('Gtk', '3.0')
from gi.r... | code_fim | hard | {
"lang": "python",
"repo": "jakeprobst/notification-thing",
"path": "/notification_thing/daemon.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser = argparse.ArgumentParser(description='Desktop notification server.')
parser.add_argument('-f', '--no-fs-check',
action='store_false', dest='fs_check', default=True,
help='Dont queue messages if active window is fullscreen')
parser.add_argument('-u', '--no-urgency-check',
action='store_fa... | code_fim | hard | {
"lang": "python",
"repo": "jakeprobst/notification-thing",
"path": "/notification_thing/daemon.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f'Motion: {args [0]}')
# Keyboard click<|fim_prefix|># repo: ellastyko/Widowmaker-1917-1922 path: /engine/handlers.py
from config import *
<|fim_middle|># Screen change
def change_size(*args):
pass
# print(f'Size: {args [0]}')
# Mouse move
def on_motion(*args):
| code_fim | medium | {
"lang": "python",
"repo": "ellastyko/Widowmaker-1917-1922",
"path": "/engine/handlers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ellastyko/Widowmaker-1917-1922 path: /engine/handlers.py
from config import *
# Screen change
def change_size(*args):
<|fim_suffix|># Mouse move
def on_motion(*args):
print(f'Motion: {args [0]}')
# Keyboard click<|fim_middle|> pass
# print(f'Size: {args [0]}')
| code_fim | easy | {
"lang": "python",
"repo": "ellastyko/Widowmaker-1917-1922",
"path": "/engine/handlers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ellastyko/Widowmaker-1917-1922 path: /engine/handlers.py
from config import *
<|fim_suffix|> pass
# print(f'Size: {args [0]}')
# Mouse move
def on_motion(*args):
print(f'Motion: {args [0]}')
# Keyboard click<|fim_middle|># Screen change
def change_size(*args):
| code_fim | easy | {
"lang": "python",
"repo": "ellastyko/Widowmaker-1917-1922",
"path": "/engine/handlers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ensure_kafka_empty()
assert requests.post(change_url, json=dict(code=200, body='Something went wrong.')).json() == 'ok'
report_uptime(service_url, lambda body: body.startswith('Hello,'), kafka_prod, 'uptime')
assert get_kafka_message()['passes'] == False
assert requests.post(change_url... | code_fim | hard | {
"lang": "python",
"repo": "pkalliok/website-uptime-tracker",
"path": "/test_uptime_producer.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkalliok/website-uptime-tracker path: /test_uptime_producer.py
import requests
from test_mock_web_service import run_mock_service_in_background, \
change_url, service_url
from uptime_producer import report_uptime
from kafka import KafkaConsumer, KafkaProducer
from json import loads
kafk... | code_fim | hard | {
"lang": "python",
"repo": "pkalliok/website-uptime-tracker",
"path": "/test_uptime_producer.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_failing_site():
ensure_kafka_empty()
assert requests.post(change_url, json=dict(code=503, body='sorryy')).json() == 'ok'
report_uptime(service_url, lambda body: True, kafka_prod, 'uptime')
msg = get_kafka_message()
assert msg['httpStatus'] == 503
assert msg['passes'] == Tr... | code_fim | hard | {
"lang": "python",
"repo": "pkalliok/website-uptime-tracker",
"path": "/test_uptime_producer.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>version, geos_version_info as geos_version_info
from .linestring import LinearRing as LinearRing, LineString as LineString
from .point import Point as Point
from .polygon import Polygon as Polygon
HAS_GEOS = ... # type: Any<|fim_prefix|># repo: AsymmetricVentures/mypy-django path: /django/contrib/gis/g... | code_fim | hard | {
"lang": "python",
"repo": "AsymmetricVentures/mypy-django",
"path": "/django/contrib/gis/geos/__init__.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AsymmetricVentures/mypy-django path: /django/contrib/gis/geos/__init__.pyi
# Stubs for django.contrib.gis.geos (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
from .collections import GeometryCollection as GeometryCollection, Mult... | code_fim | hard | {
"lang": "python",
"repo": "AsymmetricVentures/mypy-django",
"path": "/django/contrib/gis/geos/__init__.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/clusterfuzz path: /src/clusterfuzz/_internal/tests/appengine/libs/oss_fuzz_github_test.py
# Copyright 2022 Google LLC
#
# 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 Licens... | code_fim | hard | {
"lang": "python",
"repo": "google/clusterfuzz",
"path": "/src/clusterfuzz/_internal/tests/appengine/libs/oss_fuzz_github_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.testcase4 = data_types.Testcase(job_type='job1', **testcase_args2)
self.testcase4.put()
self.testcase5 = data_types.Testcase(job_type='job4', **testcase_args1)
self.testcase5.put()
test_helpers.patch(self, [
'clusterfuzz._internal.config.db_config.get_value',
])
... | code_fim | hard | {
"lang": "python",
"repo": "google/clusterfuzz",
"path": "/src/clusterfuzz/_internal/tests/appengine/libs/oss_fuzz_github_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_types.Job(
name='job4', environment_string=JOB4_ENVIRONMENT,
platform='linux').put()
testcase_args1 = {
'bug_information': '300',
}
testcase_args2 = {
'bug_information': '300',
'github_repo_id': GITHUB_REPO_ID,
'github_issue_num': GITH... | code_fim | hard | {
"lang": "python",
"repo": "google/clusterfuzz",
"path": "/src/clusterfuzz/_internal/tests/appengine/libs/oss_fuzz_github_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get response
errcode, errmsg, headers = http.getreply()
if errcode != 200:
raise Error(errcode, errmsg, headers)
f = http.getfile()
return f.read()
if __name__ == '__main__':
server = Server("www.pythonware.com")
print(server.fetch("/index.h... | code_fim | hard | {
"lang": "python",
"repo": "uthcode/learntosolveit",
"path": "/languages/python/web_httplib_example_1.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uthcode/learntosolveit path: /languages/python/web_httplib_example_1.py
import http.client
USER_AGENT = "httplib-example-1.py"
class Error:
# Indicates an HTTP Error
def __init__(self, url, errcode, errmsg, headers):
self.url = url
self.errcode = errcode
self.hea... | code_fim | hard | {
"lang": "python",
"repo": "uthcode/learntosolveit",
"path": "/languages/python/web_httplib_example_1.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zzccchen/PeppaPeppa path: /API/ocr_paddle/infer.py
# coding: utf-8
from __future__ import print_function
import os
import time
import numpy as np
import paddle.fluid as fluid
from PIL import Image, ImageFilter
from .crnn_ctc_model import ctc_infer
from .utility import get_ctc_feeder_data
cl... | code_fim | hard | {
"lang": "python",
"repo": "zzccchen/PeppaPeppa",
"path": "/API/ocr_paddle/infer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Remove unused tokens in prediction result."""
start_index = 0
end_index = len(words)
if sos in words:
start_index = np.where(words == sos)[0][0] + 1
if eos in words:
end_index = np.where(words == eos)[0][0]
return words[start_index:end_index]
def real_infer(img... | code_fim | hard | {
"lang": "python",
"repo": "zzccchen/PeppaPeppa",
"path": "/API/ocr_paddle/infer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: falau/pogom path: /pogom/pokeller.py
# -*- coding: utf-8 -*-
import logging
import time
from threading import Thread
from .models import Pokemon
log = logging.getLogger(__name__)
log.setLevel(level=10)
<|fim_suffix|> while True:
time.sleep(10)
try:
... | code_fim | hard | {
"lang": "python",
"repo": "falau/pogom",
"path": "/pogom/pokeller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self):
while True:
time.sleep(10)
try:
self.notify(Pokemon.get_active())
except Exception as e:
log.debug(e)<|fim_prefix|># repo: falau/pogom path: /pogom/pokeller.py
# -*- coding: utf-8 -*-
import logging
import time... | code_fim | medium | {
"lang": "python",
"repo": "falau/pogom",
"path": "/pogom/pokeller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: easilylazy/pattern-recognition path: /homework-12345/homework5/param.py
import getopt,sys
max_len = 65 #句子最大长度
embedding_size = 300
hidden_size = 100
batch_size = 64
epoch = 40
label_num = 5
eval_time = 100 # 每训练100个batch后对测试集或验证集进行测试
learning_rate=0.001
weight_decay=0
try:
argv=(sys.argv[1:... | code_fim | medium | {
"lang": "python",
"repo": "easilylazy/pattern-recognition",
"path": "/homework-12345/homework5/param.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return info_str,max_len ,embedding_size ,hidden_size ,batch_size,epoch,label_num ,eval_time,learning_rate,weight_decay
if __name__=='__main__':
print(get_param())<|fim_prefix|># repo: easilylazy/pattern-recognition path: /homework-12345/homework5/param.py
import getopt,sys
max_len = 65 #句子最大长度
... | code_fim | medium | {
"lang": "python",
"repo": "easilylazy/pattern-recognition",
"path": "/homework-12345/homework5/param.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Object and Object Tracker Interface
# Important: These objects need to be created _after_ the simulation is
# initialized (i.e. after the SimFinger instance is created).
if args.add_cube:
# only import when really needed
import trifinger_object_tracking.py_object_tracker... | code_fim | hard | {
"lang": "python",
"repo": "rr-learning/rrc_simulation",
"path": "/scripts/pybullet_backend.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rr-learning/rrc_simulation path: /scripts/pybullet_backend.py
#!/usr/bin/env python3
"""Run robot_interfaces Backend for pyBullet using multi-process robot data."""
import argparse
import math
import robot_interfaces
from rrc_simulation import collision_objects, drivers, camera
def main():
... | code_fim | hard | {
"lang": "python",
"repo": "rr-learning/rrc_simulation",
"path": "/scripts/pybullet_backend.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # initialize the object tracker interface
object_tracker_data = object_tracker.Data("object_tracker", True)
object_tracker_backend = object_tracker.SimulationBackend(
object_tracker_data, cube, args.real_time_mode
)
if args.cameras:
from trifinger_c... | code_fim | hard | {
"lang": "python",
"repo": "rr-learning/rrc_simulation",
"path": "/scripts/pybullet_backend.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/ASCEND-ATMP-MIB.py
#
# PySNMP MIB module ASCEND-ATMP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-ATMP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:10:01 2019
# On host DAVWANG4-M-1475 platfo... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/ASCEND-ATMP-MIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>TableColumn((1, 3, 6, 1, 4, 1, 529, 24, 16, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: atmpHAIpAddress.setStatus('mandatory')
atmpFAIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 529, 24, 16, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: atmpFAIpAddress.se... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/ASCEND-ATMP-MIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>etMaxAccess("readonly")
if mibBuilder.loadTexts: atmpFAUserName.setStatus('mandatory')
atmpInPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 529, 24, 16, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: atmpInPkts.setStatus('mandatory')
atmpInOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 529, ... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/ASCEND-ATMP-MIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.form_cfg = {}
form_class = kwargs.get('form_class') or getattr(self.view, 'form_class', None)
if form_class:
if 'model' not in kwargs and hasattr(form_class.Meta, 'model'):
... | code_fim | hard | {
"lang": "python",
"repo": "baxter07/django-ajax-views",
"path": "/ajaxviews/plugins.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baxter07/django-ajax-views path: /ajaxviews/plugins.py
._multiple_filter_response(values_list)
elif isinstance(filter_field, tuple):
if len(filter_field) == 2 and filter_field[1] == 'date':
return self._date_filter_response(filter_field[0])
... | code_fim | hard | {
"lang": "python",
"repo": "baxter07/django-ajax-views",
"path": "/ajaxviews/plugins.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def form_meta(self):
return getattr(self.view.get_form_class(), 'Meta', None)
def dispatch(self, request, *args, **kwargs):
super().dispatch(request, *args, **kwargs)
self.json_cfg['init_view_type'] = 'formView'
# noinspection PyBroadException
def ge... | code_fim | hard | {
"lang": "python",
"repo": "baxter07/django-ajax-views",
"path": "/ajaxviews/plugins.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/contrib/audio/speech-transformer/test/steps/segmentation/internal/merge_targets.py
#!/usr/bin/env python3
# Copyright 2017 Vimal Manohar
# Apache 2.0
"""
This script merges targets created from multiple sources (systems) into
single targets matrices.
Usa... | code_fim | hard | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/contrib/audio/speech-transformer/test/steps/segmentation/internal/merge_targets.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if sum(confident_in_source) == 1:
# We are confident in only one source. Keep frame.
return False
for source_idx in range(num_sources):
if source_idx == best_source:
assert confident_in_source[source_idx]
continue
if not confident_in_source[... | code_fim | hard | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/contrib/audio/speech-transformer/test/steps/segmentation/internal/merge_targets.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: k-monitor/procurement-explorer path: /src/data_tasks/preprocessed_tsv.py
from os import listdir
from os.path import isfile, join
import pandas as pd
<|fim_suffix|>df = pd.read_csv("data/interim/interim.tsv", encoding="utf-8", sep="\t")
text_files = [f for f in listdir(in_path) if isfile(join(i... | code_fim | medium | {
"lang": "python",
"repo": "k-monitor/procurement-explorer",
"path": "/src/data_tasks/preprocessed_tsv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>df["cleaned text"] = texts
is_text = [True if len(e) > 0 else False for e in texts]
df_final = df[is_text]
with open("data/processed/redflags.tsv", "w") as outfile:
outfile.write(df_final.to_csv(index=False, sep="\t"))<|fim_prefix|># repo: k-monitor/procurement-explorer path: /src/data_tasks/prepro... | code_fim | hard | {
"lang": "python",
"repo": "k-monitor/procurement-explorer",
"path": "/src/data_tasks/preprocessed_tsv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Annarien/GravitationalLenses path: /Training/KerasCnn_g_r.py
_string):
os.mkdir('../Results/g_r_%s/' % dt_string)
# Helper methods
def getPositiveImages(images_dir, max_num, input_shape):
"""
This gets the positively simulated images in the g, r and i bands.
Args:
image... | code_fim | hard | {
"lang": "python",
"repo": "Annarien/GravitationalLenses",
"path": "/Training/KerasCnn_g_r.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def gettingKFoldConfusionMatrix(test_data, test_labels, images_47, labels_47, images_84, labels_84, all_unseen_images,
all_unseen_labels, kf_counter):
test_confusion_matrix = gettingTrueFalsePositiveNegatives(test_data,
... | code_fim | hard | {
"lang": "python",
"repo": "Annarien/GravitationalLenses",
"path": "/Training/KerasCnn_g_r.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> count += 1
def usingCnnModel(training_data, training_labels, val_data, val_labels):
"""
This is using the CNN model and setting it up.
Args:
training_data(numpy arrays): This is the numpy array of the training data.
training_labels(numpy arrays): This is the numpy... | code_fim | hard | {
"lang": "python",
"repo": "Annarien/GravitationalLenses",
"path": "/Training/KerasCnn_g_r.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lingh0205/publish_news path: /com/lingh/test/argu.py
import time
import argparse
parser = argparse.ArgumentParser(description='manual to this script')
parser.add_argument('--gpus', type=str, default = None)
parser.a<|fim_suffix|>t args.gpus
print args.batch_size
print time.ctime()
print (int(time... | code_fim | medium | {
"lang": "python",
"repo": "lingh0205/publish_news",
"path": "/com/lingh/test/argu.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>dd_argument('--batch-size', type=int, default=32)
args = parser.parse_args()
print args.gpus
print args.batch_size
print time.ctime()
print (int(time.time())) - 1<|fim_prefix|># repo: lingh0205/publish_news path: /com/lingh/test/argu.py
import time
import argparse
parser = argparse.ArgumentParser(descrip... | code_fim | medium | {
"lang": "python",
"repo": "lingh0205/publish_news",
"path": "/com/lingh/test/argu.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>t args.gpus
print args.batch_size
print time.ctime()
print (int(time.time())) - 1<|fim_prefix|># repo: lingh0205/publish_news path: /com/lingh/test/argu.py
import time
import argparse
parser = argparse.ArgumentParser(description='manual <|fim_middle|>to this script')
parser.add_argument('--gpus', type=st... | code_fim | medium | {
"lang": "python",
"repo": "lingh0205/publish_news",
"path": "/com/lingh/test/argu.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leo-editor/leo-editor path: /leo/plugins/quickMove.py
>
from copy import deepcopy
from typing import Any, Sequence
from leo.core import leoGlobals as g
from leo.plugins.mod_scripting import scriptingController
# for the right click context menu, and child items
from leo.core.leoQt import QtWidget... | code_fim | hard | {
"lang": "python",
"repo": "leo-editor/leo-editor",
"path": "/leo/plugins/quickMove.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for cb, txt in [
(cb_goto_target, 'Goto target'),
(cb_permanent, 'Make permanent'),
# (cb_clear, 'Clear permanent'),
(cb_set_parent, 'Set parent'),
]:
but = b.button
... | code_fim | hard | {
"lang": "python",
"repo": "leo-editor/leo-editor",
"path": "/leo/plugins/quickMove.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leo-editor/leo-editor path: /leo/plugins/quickMove.py
.db:
g.app.db['_quickmove'] = {'global_targets': []}
return True
def onCreate(tag, keywords):
quickMove(keywords['c'])
#@+node:tbrown.20150822130731.1: ** visit_next_target
@g.command("quickmove_visit_next_target")
def visit_n... | code_fim | hard | {
"lang": "python",
"repo": "leo-editor/leo-editor",
"path": "/leo/plugins/quickMove.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catapult-project/catapult path: /telemetry/third_party/pyfakefs/pyfakefs/fake_tempfile_test.py
#! /usr/bin/env python
#
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/telemetry/third_party/pyfakefs/pyfakefs/fake_tempfile_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class FakeTempfileModuleTest(unittest.TestCase):
"""Test the 'tempfile' module mock."""
def setUp(self):
self.filesystem = fake_filesystem.FakeFilesystem(path_separator='/')
self.tempfile = fake_tempfile.FakeTempfileModule(self.filesystem)
self.orig_logging = fake_tempfile.logging
se... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/telemetry/third_party/pyfakefs/pyfakefs/fake_tempfile_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NaleRaphael/nac path: /nac/core/loader.py
from __future__ import absolute_import
import os
import re
import sys
from fnmatch import fnmatch
from . import case
from . import suite
__all__ = ['BenchmarkLoader']
case_type_dict = {
'time': case.TimeBenchmarkCase,
'mem': case.MemBenchmarkCa... | code_fim | hard | {
"lang": "python",
"repo": "NaleRaphael/nac",
"path": "/nac/core/loader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def load_cases_from_module(self, mod):
suite = self.cls_basic_suite()
for v in dir(mod):
attr = getattr(mod, v)
if not isinstance(attr, type) or not issubclass(attr, self.cls_basic_case):
continue
# In case that user imports case_clas... | code_fim | hard | {
"lang": "python",
"repo": "NaleRaphael/nac",
"path": "/nac/core/loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _load_module(name, fn, info=None):
import imp
if info is None:
path = os.path.dirname(fn)
fo, fn, info = imp.find_module(name, [path])
else:
fo = open(fn, info[1])
try:
mod = imp.load_module(name, fo, fn, info)
except:
raise
finally:
... | code_fim | hard | {
"lang": "python",
"repo": "NaleRaphael/nac",
"path": "/nac/core/loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with torch.no_grad():
losses, meta = [], []
# iterate over the loader
for i, (_, filename, _, start_idx) in tqdm.tqdm(
enumerate(loader), total=len(loader)
):
# add the movements
losses.append(
np.hstack(
... | code_fim | hard | {
"lang": "python",
"repo": "mvdwerve/price-representation-research",
"path": "/convert_targets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # convert to dataframes and merge the items
df = pd.DataFrame(data=np.vstack(losses))
dfmeta = pd.DataFrame.from_records(meta, columns=["filename", "startidx"])
df["filename"] = dfmeta["filename"]
df["startidx"] = dfmeta["startidx"]
print(df)
# conv... | code_fim | hard | {
"lang": "python",
"repo": "mvdwerve/price-representation-research",
"path": "/convert_targets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mvdwerve/price-representation-research path: /convert_targets.py
import torch
import numpy as np
import dataset
# own modules
from GreedyInfoMax.stock.arg_parser import arg_parser
from GreedyInfoMax.stock.models.loss_supervised_fn import (
Supervised_Loss,
target_movement,
target_up_... | code_fim | hard | {
"lang": "python",
"repo": "mvdwerve/price-representation-research",
"path": "/convert_targets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(sys.argv) > 1 :
if sys.argv[1] == '-v':
text = ''
for arg in args:
text += str(arg)
print(text)
def colorize(self):
lst = [ [2,2], [2,4], [2,8],
[5,2], [5,4], [5,8],
[8,2], [8,4], [8,8]
]
color = '#e5e5e5'
for e in lst:
nlst = self.box(e[0], e[1])
fo... | code_fim | hard | {
"lang": "python",
"repo": "Scorpio69t/csp-sudoku-solver",
"path": "/CSP Sudoku Solver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Scorpio69t/csp-sudoku-solver path: /CSP Sudoku Solver.py
0)
if i == 0:
tk.Label(table, text=j).grid(row = 0, column = j)
# when i > 0 then create lables
else:
# init matrixa to map it into tkinter entries
self.matrixa[i][j] = tk.StringVar()
# add corespondent enta... | code_fim | hard | {
"lang": "python",
"repo": "Scorpio69t/csp-sudoku-solver",
"path": "/CSP Sudoku Solver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Scorpio69t/csp-sudoku-solver path: /CSP Sudoku Solver.py
t__(self):
# init some empty matrix
# will be mapped to entries
self.matrixa = [[1 for x in range(10)] for y in range(10)]
# contains domain [1,1] = [-1, 1, 1, 0, 1, 0, 0, 0, 0, 0]
self.matrix_domains = [[1 for x in range(10... | code_fim | hard | {
"lang": "python",
"repo": "Scorpio69t/csp-sudoku-solver",
"path": "/CSP Sudoku Solver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 4383/Botanick path: /tests/test_botanick.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
<|fim_suffix|> emails_found = Botanick.search("squad.pro")
assert emails_found != ""
if __name__ == '__main__':
unittest.main()<|fim_middle|>"""
test_botanick
----------------------------------
Tes... | code_fim | hard | {
"lang": "python",
"repo": "4383/Botanick",
"path": "/tests/test_botanick.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: 4383/Botanick path: /tests/test_botanick.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_botanick
----------------------------------
Tests for `botanick` module.
"""
import unittest
from botanick import Botanick
<|fim_middl... | code_fim | medium | {
"lang": "python",
"repo": "4383/Botanick",
"path": "/tests/test_botanick.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if options == '':
if 'kima-showresults' in sys.argv[0]:
args = sys.argv[1:]
else:
args = options
else:
args = options.split()
if '-h' in args or '--help' in args:
print(usage())
sys.exit(0)
if '--version' in args:
ver... | code_fim | hard | {
"lang": "python",
"repo": "j-faria/kima",
"path": "/pykima/showresults.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # save all plots?
save_plots = findpop('--save-plots', args)
# other options
remove_roche = findpop('--remove-roche', args)
remove_crossing = findpop('--remove-crossing', args)
number_options = ['1', '2', '3', '4', '5', '6', '6p', '7', '8']
argstuple = namedtuple('Arguments',... | code_fim | hard | {
"lang": "python",
"repo": "j-faria/kima",
"path": "/pykima/showresults.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-faria/kima path: /pykima/showresults.py
from __future__ import print_function
import __main__
from .classic import postprocess
from .results import KimaResults
from .crossing_orbits import rem_crossing_orbits
from .utils import show_tips
import sys, os, re
from io import StringIO
from contextl... | code_fim | hard | {
"lang": "python",
"repo": "j-faria/kima",
"path": "/pykima/showresults.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># # crash OpenDDS publisher prior to v3.18
opendds_crasher = (
IP(
version=4,
ihl=5,
tos=0,
len=82,
flags=2,
frag=0,
ttl=64,
proto=17,
dst=dst,
)
/ UDP(sport=sport, dport=dport, len=62)
/ RTPS(
protocolVersion=... | code_fim | hard | {
"lang": "python",
"repo": "roizpi/basic_cybersecurity",
"path": "/1_case_studies/3_turtlebot3/exploits/crash.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roizpi/basic_cybersecurity path: /1_case_studies/3_turtlebot3/exploits/crash.py
"""
A simple script to crash OpenDDS prior to 3.18 (e.g. 3.16.1, or 3.17)
"""
from scapy.all import *
from scapy.layers.inet import UDP, IP
from scapy.contrib.rtps import *
bind_layers(UDP, RTPS)
conf.verb = 0
<|f... | code_fim | hard | {
"lang": "python",
"repo": "roizpi/basic_cybersecurity",
"path": "/1_case_studies/3_turtlebot3/exploits/crash.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neineit/NIPS-2018-Adversarial-Vision-Challenge path: /nips-defense/nips_defense/mains/vq_train.py
import tensorflow as tf
from nips_defense.model.parallel_vq_resnet import ParallelVQResNet
from nips_defense.trainer.resnet_trainer import ResNetTrainer
from nips_defense.data.tiny_imagenet_pipeline ... | code_fim | hard | {
"lang": "python",
"repo": "neineit/NIPS-2018-Adversarial-Vision-Challenge",
"path": "/nips-defense/nips_defense/mains/vq_train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # training
trainer = ResNetTrainer(model, pipeline, FLAGS.virtual_batch_size_factor)
trainer.train()
if __name__ == "__main__":
tf.app.run()<|fim_prefix|># repo: neineit/NIPS-2018-Adversarial-Vision-Challenge path: /nips-defense/nips_defense/mains/vq_train.py
import tensorfl... | code_fim | hard | {
"lang": "python",
"repo": "neineit/NIPS-2018-Adversarial-Vision-Challenge",
"path": "/nips-defense/nips_defense/mains/vq_train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def write_off(path: str, shape: Shape):
"""
It saves a Shape object at the specified path in .OFF format.
----------------------------
Args:
path (str): The global path
shape (obj: 'Shape'): The shape to save
"""
verts = shape.get_vertices()
faces = shape.get_... | code_fim | hard | {
"lang": "python",
"repo": "lorenzobini/3D-shape-retrieval-search-engine",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Global features
a3, d1, d2, d3, d4 = [], [], [], [], []
for x in featuresList["A3"][0]:
a3.append(x)
for x in featuresList["D1"][0]:
d1.append(x)
for x in featuresList["D2"][0]:
d2.append(x)
for x in featuresList["D3"][0... | code_fim | hard | {
"lang": "python",
"repo": "lorenzobini/3D-shape-retrieval-search-engine",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lorenzobini/3D-shape-retrieval-search-engine path: /src/utils.py
import numpy as np
import copy
import trimesh as trm
from tkinter import *
from tkinter.filedialog import askopenfilename
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
import matplotlib.patheffects as PathEffects... | code_fim | hard | {
"lang": "python",
"repo": "lorenzobini/3D-shape-retrieval-search-engine",
"path": "/src/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: euconnor/lmctl path: /tests/integration/client/test_behaviour_assembly_configurations.py
from tests.integration.integration_test_base import IntegrationTest
import yaml
import json
class TestBehaviourAssemblyConfigurationsAPI(IntegrationTest):
@classmethod
def before_test_case(cls, test... | code_fim | hard | {
"lang": "python",
"repo": "euconnor/lmctl",
"path": "/tests/integration/client/test_behaviour_assembly_configurations.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tester.default_client.descriptors.delete(cls.test_case_props['dummy_assembly_descriptor_name'])
def test_crud(self):
assembly_configuration = {
'name': 'assembly-config-crud',
'projectId': self.test_case_props['dummy_assembly_descriptor_name'],
'des... | code_fim | hard | {
"lang": "python",
"repo": "euconnor/lmctl",
"path": "/tests/integration/client/test_behaviour_assembly_configurations.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fromant65/AAT path: /tests/test_2ocupadas_seguidas.py
from src.bingo import t_2ocupadas_seguidas
from src.bingo import carton1
<|fim_suffix|> assert t_2ocupadas_seguidas(carton1()) == True<|fim_middle|>#Testea que haya hasta 2 celdas ocupadas seguidas
def test_2ocupadas_seguidas():
| code_fim | medium | {
"lang": "python",
"repo": "fromant65/AAT",
"path": "/tests/test_2ocupadas_seguidas.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert t_2ocupadas_seguidas(carton1()) == True<|fim_prefix|># repo: fromant65/AAT path: /tests/test_2ocupadas_seguidas.py
from src.bingo import t_2ocupadas_seguidas
from src.bingo import carton1
<|fim_middle|>#Testea que haya hasta 2 celdas ocupadas seguidas
def test_2ocupadas_seguidas():
| code_fim | medium | {
"lang": "python",
"repo": "fromant65/AAT",
"path": "/tests/test_2ocupadas_seguidas.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>2 and board[1,1] == 2 and board[2,2] == 2:
Loss = True
elif board[2,0] == 2 and board[1,1] == 2 and board[0,2] == 2:
Loss = True
elif len(zeros[0]) == 0:
Tie = True
else: print("board:",board)
return Win, Loss, Tie<|fim_prefix|># repo: MikeFlanigan/TTT_ai path: /TT... | code_fim | hard | {
"lang": "python",
"repo": "MikeFlanigan/TTT_ai",
"path": "/TTT_referee.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MikeFlanigan/TTT_ai path: /TTT_referee.py
import numpy as np
def CheckScore(board):
Win = Loss = Tie = False
zeros = np.where(board == 0)
if np.all(board[0,0:3] == 1) or np.all(board[1,0:3] == 1) or np.all(board[2,0:3] == 1):
Win = True
elif np.all(board[0:3,0] == 1) or<|... | code_fim | hard | {
"lang": "python",
"repo": "MikeFlanigan/TTT_ai",
"path": "/TTT_referee.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(RuntimeError):
lla: LLA = LLA.vector((95.0, 1.0, 1.0))
# Invalid longitude
with pytest.raises(RuntimeError):
lla: LLA = LLA.vector((1.0, -181.0, 1.0))
# Negative Altitude (Allowed)
lla: LLA = LLA.vector((5.0, 1.0, -1.0))
assert lla is not Non... | code_fim | hard | {
"lang": "python",
"repo": "robinpdm/open-space-toolkit-physics",
"path": "/bindings/python/test/coordinate/spherical/test_lla.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get_longitude
lon = lla.get_longitude()
assert lon is not None
assert isinstance(lon, Angle)
# get_altitude
alt = lla.get_altitude()
assert alt is not None
assert isinstance(alt, Length)
def test_coordinate_spherical_lla_conversions():
# Main Constructor
lati... | code_fim | hard | {
"lang": "python",
"repo": "robinpdm/open-space-toolkit-physics",
"path": "/bindings/python/test/coordinate/spherical/test_lla.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robinpdm/open-space-toolkit-physics path: /bindings/python/test/coordinate/spherical/test_lla.py
# Apache License 2.0
import pytest
import numpy as np
from ostk.core.types import String
import ostk.physics as physics
Angle = physics.units.Angle
Length = physics.units.Length
LLA = physics.coor... | code_fim | hard | {
"lang": "python",
"repo": "robinpdm/open-space-toolkit-physics",
"path": "/bindings/python/test/coordinate/spherical/test_lla.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Commission(models.Model):
agency = models.ForeignKey("user_module.RecrutingAgency",on_delete=models.CASCADE) # many to one realationship
payment = models.OneToOneField(Payment,blank=True,on_delete=models.CASCADE,null=True)
status = models.CharField(max_length=255,default="initiated")
... | code_fim | hard | {
"lang": "python",
"repo": "muhanzi/Django-REST-API",
"path": "/djangoBackend/payment_module/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Invoice(models.Model): # salary of employee
employee = models.ForeignKey("user_module.Employee",on_delete=models.CASCADE) # many to one realationship
employer = models.ForeignKey(to=Employer,on_delete=models.CASCADE) # many to one realationship
payment = models.OneToOneField(Payment,bla... | code_fim | hard | {
"lang": "python",
"repo": "muhanzi/Django-REST-API",
"path": "/djangoBackend/payment_module/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muhanzi/Django-REST-API path: /djangoBackend/payment_module/models.py
# from djangoBackend.user_module.models import Employee,RecrutingAgency,SuperSite
from datetime import datetime
from django.db import models
# Create your models here.
class Employer(models.Model):
name = models.CharField... | code_fim | medium | {
"lang": "python",
"repo": "muhanzi/Django-REST-API",
"path": "/djangoBackend/payment_module/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># ob = collection.find({"$or":[{"marks":{"$gt":40}}, {"marks":{"$lt":50}}]})
# print("And conditions records")
# for record in ob:
# print("records", record)
# sorting
mydoc = collection.find().sort("name")
# for x in mydoc:
# print("sorting..", x)
mydoc = collection.find().sort("name", -1)
for x i... | code_fim | medium | {
"lang": "python",
"repo": "vijayingale/Adv_Python_Trainig",
"path": "/First_Day/first_day.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vijayingale/Adv_Python_Trainig path: /First_Day/first_day.py
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
myclient = MongoClient("mongodb://%s:%s@127.0.0.1" % ('admin', 'admin'))
print("connection successful", myclient)
# list down the databases
list_of_db = mycl... | code_fim | hard | {
"lang": "python",
"repo": "vijayingale/Adv_Python_Trainig",
"path": "/First_Day/first_day.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># ob = collection.find({"$and":[{"marks":{"$gt":40}}, {"marks":{"$lt":50}}]})
# print("And conditions records")
# for record in ob:
# print("records", record)
# ob = collection.find({"$or":[{"marks":{"$gt":40}}, {"marks":{"$lt":50}}]})
# print("And conditions records")
# for record in ob:
# print("... | code_fim | medium | {
"lang": "python",
"repo": "vijayingale/Adv_Python_Trainig",
"path": "/First_Day/first_day.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.client = client
def create(self, type):
return self.PressureI()
def destroy(self):
pass
class TemperatureObjectFactory(Ice.ObjectFactory):
from omero_model_TemperatureI import TemperatureI
def __init__(self, client = None):
self.client = client
... | code_fim | hard | {
"lang": "python",
"repo": "nseyedtalebi/django-uwsgi-nginx",
"path": "/omero_python_libs/omero/ObjectFactoryRegistrar.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def create(self, type):
return self.LabelI()
def destroy(self):
pass
class LaserObjectFactory(Ice.ObjectFactory):
from omero_model_LaserI import LaserI
def create(self, type):
return self.LaserI()
def destroy(self):
pass
class LaserMediumObjectFact... | code_fim | hard | {
"lang": "python",
"repo": "nseyedtalebi/django-uwsgi-nginx",
"path": "/omero_python_libs/omero/ObjectFactoryRegistrar.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nseyedtalebi/django-uwsgi-nginx path: /omero_python_libs/omero/ObjectFactoryRegistrar.py
ate(self, type):
return self.ContrastStretchingContextI()
def destroy(self):
pass
class CorrectionObjectFactory(Ice.ObjectFactory):
from omero_model_CorrectionI import CorrectionI
... | code_fim | hard | {
"lang": "python",
"repo": "nseyedtalebi/django-uwsgi-nginx",
"path": "/omero_python_libs/omero/ObjectFactoryRegistrar.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gykovacs/retina_vessel_segmentation path: /config.py
import os
output_dir= 'output'
figures_dir= os.path.join(output_dir, 'figures')
latex_dir= os.path.join(output_dir, 'latex')
drive_dir= os.path.join('data', 'drive')
<|fim_suffix|>image_level_threshold= 0.5
aggregated_threshold= 0.5
exclude_... | code_fim | hard | {
"lang": "python",
"repo": "gykovacs/retina_vessel_segmentation",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>image_level_threshold= 0.5
aggregated_threshold= 0.5
exclude_stare_training= True<|fim_prefix|># repo: gykovacs/retina_vessel_segmentation path: /config.py
import os
output_dir= 'output'
figures_dir= os.path.join(output_dir, 'figures')
latex_dir= os.path.join(output_dir, 'latex')
drive_dir= os.path.joi... | code_fim | hard | {
"lang": "python",
"repo": "gykovacs/retina_vessel_segmentation",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rtqichen/torchdiffeq path: /torchdiffeq/_impl/solvers.py
import abc
import torch
from .event_handling import find_event
from .misc import _handle_unused_kwargs
class AdaptiveStepsizeODESolver(metaclass=abc.ABCMeta):
def __init__(self, dtype, y0, norm, **unused_kwargs):
_handle_unuse... | code_fim | hard | {
"lang": "python",
"repo": "rtqichen/torchdiffeq",
"path": "/torchdiffeq/_impl/solvers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, func, y0, step_size=None, grid_constructor=None, interp="linear", perturb=False, **unused_kwargs):
self.atol = unused_kwargs.pop('atol')
unused_kwargs.pop('rtol', None)
unused_kwargs.pop('norm', None)
_handle_unused_kwargs(self, unused_kwargs)
... | code_fim | hard | {
"lang": "python",
"repo": "rtqichen/torchdiffeq",
"path": "/torchdiffeq/_impl/solvers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>SEO_ARTICLES_LIMIT = 10
SEO_PAGES_LIMIT = 10<|fim_prefix|># repo: ELCG/elcg.github.io path: /seoconf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
<|fim_middle|>import os
import sys
sys.path.append(os.curdir)
from publishconf import *
PLUGINS = PLUGINS + ["pelican.plugins.seo"]
| code_fim | medium | {
"lang": "python",
"repo": "ELCG/elcg.github.io",
"path": "/seoconf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ELCG/elcg.github.io path: /seoconf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
import os
import sys
sys.path.append(os.curdir)
from publishconf import *
<|fim_suffix|>SEO_ARTICLES_LIMIT = 10
SEO_PAGES_LIMIT = 10<|fim_middle|>PLUGINS = PLUGINS + ["pelican.plugins.seo"]
| code_fim | easy | {
"lang": "python",
"repo": "ELCG/elcg.github.io",
"path": "/seoconf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def suggest_cargo(index, projectDirs=[], cargoTomls=[], specificPackages=[]):
packages = []
for d in projectDirs:
try:
with open("Cargo.toml") as cargo_toml:
cargo_data = toml.load(cargo_toml)
to_parse = [cargo_data]
for obj in t... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/suggest_imports",
"path": "/suggest_imports/Suggest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pombredanne/suggest_imports path: /suggest_imports/Suggest.py
import os
import sys
import json
import math
import toml
import argparse
import urllib.request
from enum import Enum
from tabulate import tabulate
def usage():
print("suggest must be called within a valid project directory")
s... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/suggest_imports",
"path": "/suggest_imports/Suggest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thomasnevolianis/biotite path: /tests/structure/test_box.py
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
from os.path import join
import itertools
import numpy as np
import pytest
import... | code_fim | hard | {
"lang": "python",
"repo": "thomasnevolianis/biotite",
"path": "/tests/structure/test_box.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.parametrize(
"multi_model, translation_vector",
itertools.product(
[False, True],
[(20,30,40), (-11, 33, 22), (-40, -50, -60)]
)
)
def test_remove_pbc_restore(multi_model, translation_vector):
CUTOFF = 5.0
def get_matrices(array):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "thomasnevolianis/biotite",
"path": "/tests/structure/test_box.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return os.path.join(os.path.dirname(__file__), 'results/' + name)
def _compare(file1, file2, **kwargs):
self.assertImageAlmostEqual(_path_from_name(file1), _path_from_name(file2), **kwargs)
# Compare identical images
_compare('white.png', 'white.png')
... | code_fim | medium | {
"lang": "python",
"repo": "Work4Labs/django-short-urls",
"path": "/vendor/pywork4core/django_app/tests/image_test_case_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.assertRaises(AssertionError):
_compare('red.jpg', 'white.png')
# Compare idendical images, threshold 0%
file_path = _path_from_name('white.png')
self.assertImageEqual(file_path, file_path)<|fim_prefix|># repo: Work4Labs/django-short-urls path: /vendo... | code_fim | hard | {
"lang": "python",
"repo": "Work4Labs/django-short-urls",
"path": "/vendor/pywork4core/django_app/tests/image_test_case_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Work4Labs/django-short-urls path: /vendor/pywork4core/django_app/tests/image_test_case_test.py
# coding=utf-8
from __future__ import unicode_literals
import os
from utils.image_test_case import ImageTestCase
from utils import tmp
class ImageTestCaseTestCase(ImageTestCase):
def test(self)... | code_fim | medium | {
"lang": "python",
"repo": "Work4Labs/django-short-urls",
"path": "/vendor/pywork4core/django_app/tests/image_test_case_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dinhkute/Incisive-AIESEC path: /webroot/Pj/mysite/mysite/polls/migrations/0015_auto_20170630_0936.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-30 02:36
from __future__ import unicode_literals
<|fim_suffix|>
dependencies = [
migrations.swappable_dependency(... | code_fim | medium | {
"lang": "python",
"repo": "dinhkute/Incisive-AIESEC",
"path": "/webroot/Pj/mysite/mysite/polls/migrations/0015_auto_20170630_0936.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='registerevent',
name='question',
),
migrations.AddField(
model_name='registerevent',
name='customer',
field=models.ForeignKey(default=1, on_delete=django.db.mo... | code_fim | medium | {
"lang": "python",
"repo": "dinhkute/Incisive-AIESEC",
"path": "/webroot/Pj/mysite/mysite/polls/migrations/0015_auto_20170630_0936.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.