text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("--input", "-i", type=str, required=True, help="input video file") parser.add_argument("--output", "-o", type=str, required=True, help="output dir") parser.add_argument("--interval"...
code_fim
medium
{ "lang": "python", "repo": "nagadomi/nunif", "path": "/iw3/training/extract_keyframes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagadomi/nunif path: /iw3/training/extract_keyframes.py # tool to extract keyframe images from video import argparse import os from os import path from PIL import Image from nunif.utils.video import process_video_keyframes def main(): <|fim_suffix|> im = frame.to_image() if args....
code_fim
hard
{ "lang": "python", "repo": "nagadomi/nunif", "path": "/iw3/training/extract_keyframes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lanerjo/learning_python path: /working_with_classes.py class Shape: def __init__(self,x,y): self.x = x self.y=y self.description='there is no description yet' self.author='nobody has claimed to make this shape yet' def area(self): ...
code_fim
medium
{ "lang": "python", "repo": "lanerjo/learning_python", "path": "/working_with_classes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def perimeter(self): return 2*self.x +2*self.y def describe(self,text): self.description=text def authorName(self,text): self.author=text def scaleSize(self,scale): self.x=self.x * scale self.y=self.y*scale #let's Defi...
code_fim
medium
{ "lang": "python", "repo": "lanerjo/learning_python", "path": "/working_with_classes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maximka48/XIMG-EMBL path: /examples_public/CTF_tomo.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Nov 22 16:34:02 2019 This is an example of a parallelised script that does: - Flatfield correction with SSIM - 4-distance CTF-reconstruction (incl. correction for shifts) - Str...
code_fim
hard
{ "lang": "python", "repo": "maximka48/XIMG-EMBL", "path": "/examples_public/CTF_tomo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #read image and do ff-retrieval filt = [] for i in np.arange(len(images)): im = tifffile.imread(images[i][j + N_start-1])[ROI[1]:ROI[3], ROI[0]:ROI[2]] im = im/ff[i][LoI[j,i]] filt.append(im) #...
code_fim
hard
{ "lang": "python", "repo": "maximka48/XIMG-EMBL", "path": "/examples_public/CTF_tomo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>testdata = [ Contact(firstname="1", middlename="2", lastname=("lastname_" + str(now_time)), nickname="4", title="6", company="7", address="8", hom...
code_fim
hard
{ "lang": "python", "repo": "maximencia/python_traning", "path": "/data/contact.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: maximencia/python_traning path: /data/contact.py # -*- coding: utf-8 -*- from model.contact import Contact import datetime <|fim_suffix|>testdata = [ Contact(firstname="1", middlename="2", lastname=("lastname_" + str(now_time)), ...
code_fim
hard
{ "lang": "python", "repo": "maximencia/python_traning", "path": "/data/contact.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zzattack/ccmaps-web path: /home/urls.py from django.urls import * from home.views im<|fim_suffix|>r'^contact$(?i)', contact, name='contact'), ]<|fim_middle|>port * urlpatterns = [ re_path(r'^(?:index.*)?$(?i)', index, name='index'), re_path(
code_fim
medium
{ "lang": "python", "repo": "zzattack/ccmaps-web", "path": "/home/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>x.*)?$(?i)', index, name='index'), re_path(r'^contact$(?i)', contact, name='contact'), ]<|fim_prefix|># repo: zzattack/ccmaps-web path: /home/urls.py from django.urls import * from home.views im<|fim_middle|>port * urlpatterns = [ re_path(r'^(?:inde
code_fim
easy
{ "lang": "python", "repo": "zzattack/ccmaps-web", "path": "/home/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def background_setting(self): self.back_color ={ 'gray': "background-color: rgb(229, 229, 229);", 'green': "background-color: rgb(0, 170, 0);", 'yellow': "background-color: rgb(0, 170, 0);", 'orange': "background-color: rgb(255, 85, 0);", ...
code_fim
hard
{ "lang": "python", "repo": "LeeDaeil/PyQt5_study", "path": "/Study_9/Study_9.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.back_color ={ 'gray': "background-color: rgb(229, 229, 229);", 'green': "background-color: rgb(0, 170, 0);", 'yellow': "background-color: rgb(0, 170, 0);", 'orange': "background-color: rgb(255, 85, 0);", 'red': "background-color: rgb...
code_fim
medium
{ "lang": "python", "repo": "LeeDaeil/PyQt5_study", "path": "/Study_9/Study_9.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LeeDaeil/PyQt5_study path: /Study_9/Study_9.py import sys from PyQt5.QtWidgets import QDialog, QApplication from ui_data.gui_study_9 import * import Study_9_re_rc # resource file class MyForm(QDialog): def __init__(self): super().__init__() self.ui = Ui_Dialog() self....
code_fim
medium
{ "lang": "python", "repo": "LeeDaeil/PyQt5_study", "path": "/Study_9/Study_9.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("") print("usage: " + g_script_name + " --user username --pass password --sprint sprintname") print("") sys.exit(1) def unknown_arg(s): print("") print("ERROR: Unknown argument: " + s) print("") usage() def parse_config_file(): global g_user global g_pass...
code_fim
hard
{ "lang": "python", "repo": "mmalohlava/h2o-dev", "path": "/scripts/jira.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mmalohlava/h2o-dev path: /scripts/jira.py #!/usr/bin/python import sys import os import requests import urllib import re g_user = None g_pass = None g_sprint = None g_csv = False g_verbose = False class Person: def __init__(self, name): self.name = name self.resolved_list...
code_fim
hard
{ "lang": "python", "repo": "mmalohlava/h2o-dev", "path": "/scripts/jira.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: runzezhang/MOOCs path: /Udemy/REST-Django-VueJS/C4/04-DRF-LEVEL-TWO/quotesapi/quotes/models.py from django.db import models class Quote(models.Model): <|fim_suffix|> def __str__(self): return self.quote_author<|fim_middle|> quote_author = models.CharField(max_length=50) quote_...
code_fim
hard
{ "lang": "python", "repo": "runzezhang/MOOCs", "path": "/Udemy/REST-Django-VueJS/C4/04-DRF-LEVEL-TWO/quotesapi/quotes/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return self.quote_author<|fim_prefix|># repo: runzezhang/MOOCs path: /Udemy/REST-Django-VueJS/C4/04-DRF-LEVEL-TWO/quotesapi/quotes/models.py from django.db import models class Quote(models.Model): <|fim_middle|> quote_author = models.CharField(max_length=50) quote_...
code_fim
hard
{ "lang": "python", "repo": "runzezhang/MOOCs", "path": "/Udemy/REST-Django-VueJS/C4/04-DRF-LEVEL-TWO/quotesapi/quotes/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Padge91/postgres-web-gui path: /app.py from flask import Flask, jsonify, request from CrudApp.CrudApp import app as crudapp from AuthApp.AuthA<|fim_suffix|>Flask(__name__) app.register_blueprint(crudapp, url_prefix="/") app.register_blueprint(authapp, url_prefix="/auth") app.register_blueprint(co...
code_fim
medium
{ "lang": "python", "repo": "Padge91/postgres-web-gui", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Flask(__name__) app.register_blueprint(crudapp, url_prefix="/") app.register_blueprint(authapp, url_prefix="/auth") app.register_blueprint(commonapp, url_prefix="/static") app.run(host="0.0.0.0", port=8080)<|fim_prefix|># repo: Padge91/postgres-web-gui path: /app.py from flask import Flask, jsonify, re...
code_fim
medium
{ "lang": "python", "repo": "Padge91/postgres-web-gui", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rfong/rc-sandbox path: /crdt/crdt-py/simple/pubsub.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # A simple pub/sub. import logging from collections import namedtuple from typing import Callable <|fim_suffix|> '''Publish an update to all subscribed listeners.''' logger.info(...
code_fim
medium
{ "lang": "python", "repo": "rfong/rc-sandbox", "path": "/crdt/crdt-py/simple/pubsub.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Subscribe a listener function.''' self.listeners.append(listener) if __name__ == "__main__": '''Quick test''' def listener1(x=None): print("#1 received x:", x) def listener2(**kwargs): print("#2 received:", kwargs) pubsub = PubSub() pubsub.publish(...
code_fim
hard
{ "lang": "python", "repo": "rfong/rc-sandbox", "path": "/crdt/crdt-py/simple/pubsub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pubsub.subscribe(listener1) pubsub.publish(x=2) pubsub.subscribe(listener2) pubsub.publish(x=3) pubsub.subscribe(listener2) pubsub.publish(apple="banana") # listener1 can't deal w/ it. that's fine<|fim_prefix|># repo: rfong/rc-sandbox path: /crdt/crdt-py/simple/pubsub.py #!/usr...
code_fim
medium
{ "lang": "python", "repo": "rfong/rc-sandbox", "path": "/crdt/crdt-py/simple/pubsub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: prometheusloong/giraffe-sv-paper path: /scripts/plotting/plot_real_speed.py import json import matplotlib import matplotlib.pyplot as plt import matplotlib.patches as mplpatches from mpl_toolkits.mplot3d import Axes3D import numpy as np from sklearn.linear_model import LinearRegression import arg...
code_fim
hard
{ "lang": "python", "repo": "prometheusloong/giraffe-sv-paper", "path": "/scripts/plotting/plot_real_speed.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #plt.show() plt.savefig(graph_name + "_" + stat_name+"_"+read_name+"_plot.svg", dpi=400) def main(): parser = argparse.ArgumentParser(description="Plot stats from a tsv file (named speed_report_[reads].tsv) that is formatted:\ graph algorithm reads pairing speed total_wall_clo...
code_fim
hard
{ "lang": "python", "repo": "prometheusloong/giraffe-sv-paper", "path": "/scripts/plotting/plot_real_speed.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sideeffects/stats_core path: /stats_main/urls.py import settings try: from django.conf.urls import patterns, include, url except ImportError: from django.conf.urls.defaults import patterns, include, url <|fim_suffix|> # This is the generic view for new-style reports. url(r...
code_fim
hard
{ "lang": "python", "repo": "sideeffects/stats_core", "path": "/stats_main/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if settings.IS_LOGGING_SERVER: urlpatterns += patterns('stats_main.api', # API for non-browser-based interaction. url(r'^api$', 'api_view', name='api'), )<|fim_prefix|># repo: sideeffects/stats_core path: /stats_main/urls.py import settings try: from django.conf.urls import pa...
code_fim
hard
{ "lang": "python", "repo": "sideeffects/stats_core", "path": "/stats_main/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: monotropauniflora/PartSeg path: /package/PartSeg/segmentation_mask/main_window.py AddFiles from ..common_gui.stack_image_view import ColorBar from ..common_gui.universal_gui_part import right_label from ..common_gui.waiting_dialog import ExecuteFunctionDialog from ..segmentation_mask.segmentatio...
code_fim
hard
{ "lang": "python", "repo": "monotropauniflora/PartSeg", "path": "/package/PartSeg/segmentation_mask/main_window.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.settings.set("io.save_components_directory", os.path.dirname(str(res.save_destination))) self.settings.add_path_history(os.path.dirname(str(res.save_destination))) def exception_hook(exception): QMessageBox.critical(self, "Save error", f"Error on disc operation. T...
code_fim
hard
{ "lang": "python", "repo": "monotropauniflora/PartSeg", "path": "/package/PartSeg/segmentation_mask/main_window.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: monotropauniflora/PartSeg path: /package/PartSeg/segmentation_mask/main_window.py self.un_check_all_btn = QPushButton("Unselect all") self.un_check_all_btn.clicked.connect(self.un_check_all) main_layout = QVBoxLayout() btn_layout = QHBoxLayout() btn_layout....
code_fim
hard
{ "lang": "python", "repo": "monotropauniflora/PartSeg", "path": "/package/PartSeg/segmentation_mask/main_window.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gregarendse/adventofcode path: /2022/01/main.py #!/bin/python from sys import argv from typing import List def read_file(file: str) -> List[str]: with open(file, 'r') as file: elves = file.read().split('\n\n') return elves <|fim_suffix|> calories: List[int] = calculate_c...
code_fim
hard
{ "lang": "python", "repo": "gregarendse/adventofcode", "path": "/2022/01/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Part One: {}".format(part_one(argv[1]))) print("Part Two: {}".format(part_two(argv[1]))) if __name__ == '__main__': main()<|fim_prefix|># repo: gregarendse/adventofcode path: /2022/01/main.py #!/bin/python from sys import argv from typing import List def read_file(file: str) -> Lis...
code_fim
medium
{ "lang": "python", "repo": "gregarendse/adventofcode", "path": "/2022/01/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def stealth_connection(self): print 'starting stealth_connection' for port in self.port_list: port = int(port) resp = sr1(IP(dst=self.dst_ip) / TCP(sport=self.src_port, dport=port, flags="S"), timeout=self.timeout, verbose=0) i...
code_fim
hard
{ "lang": "python", "repo": "talp101/Scanning-tool", "path": "/Scanner/Scanner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: talp101/Scanning-tool path: /Scanner/Scanner.py import timeit from scapy.layers.inet import TCP, IP, ICMP, UDP __author__ = 'tal' import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * import socket class Scanner(): def __init__(self, dst_ip, src...
code_fim
hard
{ "lang": "python", "repo": "talp101/Scanning-tool", "path": "/Scanner/Scanner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 9999years/brandeis-classes path: /test/test_brandeis.py from bs4 import BeautifulSoup from brandeis_classes import brandeis def read(fname, mode="r", encoding="utf-8"): with open(fname, mode, encoding=encoding) as f: return f.read() <|fim_suffix|> def test_tr_to_course(): tr =...
code_fim
medium
{ "lang": "python", "repo": "9999years/brandeis-classes", "path": "/test/test_brandeis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tr = tr_to_soup(read("test-data/cosi_119a_1.html")) crs = brandeis.tr_to_course(tr, request_description=False) assert crs.friendly_number == "COSI 119A_1" assert crs.uni_reqs_str == "[sn]" assert crs.name == "Autonomous Robotics Lab" assert crs.class_number == 16905 assert crs....
code_fim
medium
{ "lang": "python", "repo": "9999years/brandeis-classes", "path": "/test/test_brandeis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def self_test(self): print("self_test") # type(名, (父类,), {属性, 方法} TT = type("TT", (object,), {'class_attr': 'test', 'class_test': class_test, 'static_test': static_test, 'self_test': self_test}) help(TT) # TT.class_test() # class_test # TT.static_test() # static_te...
code_fim
medium
{ "lang": "python", "repo": "rehth/test", "path": "/Pycharm/网络通信/python17_07/元类.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rehth/test path: /Pycharm/网络通信/python17_07/元类.py # 元类 type # 使用 元类创建一个类 @classmethod def class_test(cls): print('class_test') @staticmethod def static_test(): <|fim_suffix|>TT = type("TT", (object,), {'class_attr': 'test', 'class_test': class_test, 'static_test': static_test, ...
code_fim
medium
{ "lang": "python", "repo": "rehth/test", "path": "/Pycharm/网络通信/python17_07/元类.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bionicles/neuromax path: /nature/bricks/dense.py import tensorflow as tf import random from tools import pipe import nature L = tf.keras.layers LAYER_FN = [nature.Attention, nature.SWAG, nature.NoiseDrop, nature.Conv1D] UNITS = [1, 2, 4, 8, 16, 32] LAYERS = [1, 2, 3, 4] <|fim_suffix|> @tf.f...
code_fim
hard
{ "lang": "python", "repo": "bionicles/neuromax", "path": "/nature/bricks/dense.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, AI, layer_fn=LAYER_FN): super().__init__() n_layers = AI.pull("dense_n_layers", LAYERS) units = AI.pull("dense_units", UNITS) self.d_increase = units * n_layers self.concat = L.Concatenate(-1) self.layers = [] for n in range(n_...
code_fim
medium
{ "lang": "python", "repo": "bionicles/neuromax", "path": "/nature/bricks/dense.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.mox.StubOutWithMock(utils, 'execute') initiator = 'fake.initiator.iqn' rval = ("junk\nInitiatorName=%s\njunk\n" % initiator, None) utils.execute('cat', '/etc/iscsi/initiatorname.iscsi', run_as_root=True).AndReturn(rval) # Start test ...
code_fim
medium
{ "lang": "python", "repo": "projectcalico/calico-nova", "path": "/nova/tests/unit/virt/test_volumeutils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.mox.StubOutWithMock(utils, 'execute') file_path = '/etc/iscsi/initiatorname.iscsi' utils.execute('cat', file_path, run_as_root=True).AndRaise( exception.FileNotFound(file_path=file_path) ) # Start test self.mox.ReplayAll() result = v...
code_fim
hard
{ "lang": "python", "repo": "projectcalico/calico-nova", "path": "/nova/tests/unit/virt/test_volumeutils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: projectcalico/calico-nova path: /nova/tests/unit/virt/test_volumeutils.py # Copyright 2014 Hewlett-Packard Development Company, L.P. # Copyright 2012 University Of Minho # Copyright 2010 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not u...
code_fim
hard
{ "lang": "python", "repo": "projectcalico/calico-nova", "path": "/nova/tests/unit/virt/test_volumeutils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: petepall/flask_social_network path: /flaskblog/__init__.py import flask import flask_bcrypt import flask_login import flask_mail import flask_sqlalchemy as flask_sqa import flaskblog.config as flaskblog_cf db = flask_sqa.SQLAlchemy() bcrypt = flask_bcrypt.Bcrypt() login_manager = flask_login.Lo...
code_fim
medium
{ "lang": "python", "repo": "petepall/flask_social_network", "path": "/flaskblog/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> app.register_blueprint(flaskblog_user_ctrl.users) app.register_blueprint(flaskblog_post_ctrl.posts) app.register_blueprint(flaskblog_general_ctrl.main) app.register_blueprint(flaskblog_error_ctrl.errors) return app<|fim_prefix|># repo: petepall/flask_social_network path: /flaskblog/_...
code_fim
hard
{ "lang": "python", "repo": "petepall/flask_social_network", "path": "/flaskblog/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MichaelMMeskhi/openml-python path: /openml/tasks/task.py import io import os from .. import datasets from .split import OpenMLSplit import openml._api_calls from ..utils import _create_cache_directory_for_id, _tag_entity class OpenMLTask(object): def __init__(self, task_id, task_type_id, t...
code_fim
hard
{ "lang": "python", "repo": "MichaelMMeskhi/openml-python", "path": "/openml/tasks/task.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> estimation_procedure_type, estimation_parameters, evaluation_measure, target_name, data_splits_url, class_labels=None, cost_matrix=None): super(OpenMLLearningCurveTask, self).__init__( task_id=task_id, task_type_id=task_typ...
code_fim
hard
{ "lang": "python", "repo": "MichaelMMeskhi/openml-python", "path": "/openml/tasks/task.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, task_id, task_type_id, task_type, data_set_id, estimation_procedure_type, estimation_parameters, evaluation_measure, target_name, data_splits_url): super(OpenMLSupervisedTask, self).__init__( task_id=task_id, task_typ...
code_fim
hard
{ "lang": "python", "repo": "MichaelMMeskhi/openml-python", "path": "/openml/tasks/task.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fromsq = Square('b7') self.board = self.board.replace(fromsq, self.pawn) self.assertFalse(self.pawn.attacks(fromsq, Square('b8'), self.board)) self.assertTrue(self.pawn.attacks(fromsq, Square('c8'), self.board)) def test_plmoves(self): fromsq = Square('b7') ...
code_fim
hard
{ "lang": "python", "repo": "megatron0000/ces22-xadrez", "path": "/chessengine_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: megatron0000/ces22-xadrez path: /chessengine_test.py fBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutOfBoundsPiece(), OutO...
code_fim
hard
{ "lang": "python", "repo": "megatron0000/ces22-xadrez", "path": "/chessengine_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_exec(self): self.board = self.board.replace(Square('e1'), King(Side.WHITE)) \ .replace(Square('a1'), Rook(Side.WHITE)) antimove = self.executor.exec( Move(Square('e1'), Square('c1'), MoveKind.CASTLE_QUEEN, None), self.board._movepiece, self....
code_fim
hard
{ "lang": "python", "repo": "megatron0000/ces22-xadrez", "path": "/chessengine_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># 1: A basic bezier path filled with a color pt = BezierPath(fill=(1,0,0)) pt.rect(0, 0, 42, 42) pt.draw() flow() # 2: Using the transform bezier path method should copy color trans = Transform() trans.translate(50, 0) pt2 = trans.transformBezierPath(pt) pt2.draw() flow()<|fim_prefix|># repo: karstenw/no...
code_fim
hard
{ "lang": "python", "repo": "karstenw/nodebox-pyobjc", "path": "/nodebox/tests/graphics/005-path.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: karstenw/nodebox-pyobjc path: /nodebox/tests/graphics/005-path.py # Path semantics size(300, 300) _total_w = 0 _counter = 1 def flow(w=50, h=70): global _total_w global _counter text(_counter, 17, 60, fontsize=12, fill=0) _counter += 1 if _total_w + w*2 >= WIDTH: tra...
code_fim
medium
{ "lang": "python", "repo": "karstenw/nodebox-pyobjc", "path": "/nodebox/tests/graphics/005-path.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if max_size is not None and max_size > 0: query = {'size': max_size, 'query': {'bool': bool_body}} else: query = {'query': {'bool': bool_body}} return query def get_strings( self, size: Union[int, Tuple[int, int]], feature: Union...
code_fim
hard
{ "lang": "python", "repo": "edponce/FACET", "path": "/facet/matcher/elasticsearch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: edponce/FACET path: /facet/matcher/elasticsearch.py from .base import BaseMatcher from .base_simstring import BaseSimstring from ..database import ElasticsearchDatabase from typing import ( Any, List, Dict, Tuple, Union, Iterable, ) __all__ = [ 'ElasticsearchSimstrin...
code_fim
hard
{ "lang": "python", "repo": "edponce/FACET", "path": "/facet/matcher/elasticsearch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> query = {'sort': [{'_score': 'desc'}]} if rank else {} query.update({'query': query_body}) return query def insert(self, string: str): self._db.set({'term': string}) def search( self, string: str, **kwargs, ) -> Union[List[Tuple[str, fl...
code_fim
hard
{ "lang": "python", "repo": "edponce/FACET", "path": "/facet/matcher/elasticsearch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: USEPA/flowsa path: /flowsa/data_source_scripts/Blackhurst_IO.py # Blackhurst_IO.py (scripts) # !/usr/bin/env python3 # coding=utf-8 """ Scrapes data from Blackhurst paper 'Direct and Indirect Water Withdrawals for US Industrial Sectors' (Supplemental info) Includes supporting functions for Blackh...
code_fim
hard
{ "lang": "python", "repo": "USEPA/flowsa", "path": "/flowsa/data_source_scripts/Blackhurst_IO.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return df_wratio def scale_blackhurst_results_to_usgs_values( df_load, attr, download_FBA_if_missing): """ Scale the initial estimates for Blackhurst-based mining estimates to USGS values. Oil-based sectors are allocated a larger percentage of the difference between initial ...
code_fim
hard
{ "lang": "python", "repo": "USEPA/flowsa", "path": "/flowsa/data_source_scripts/Blackhurst_IO.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _location_path = "etf" def __init__(self): super().__init__() self.candle = lib.stocks_helper.display_candle self.compare = lib.etf_stockanalysis_model.compare_etfs self.etf_by_category = lib.etf_financedatabase_model.get_etfs_by_category self.etf_by_name =...
code_fim
hard
{ "lang": "python", "repo": "conrad-strughold/GamestonkTerminal", "path": "/openbb_terminal/core/sdk/models/etf_sdk_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: conrad-strughold/GamestonkTerminal path: /openbb_terminal/core/sdk/models/etf_sdk_model.py # ######### THIS FILE IS AUTO GENERATED - ANY CHANGES WILL BE VOID ######### # # flake8: noqa # pylint: disable=C0301,R0902,R0903 from openbb_terminal.core.sdk.sdk_helpers import Category import openbb_term...
code_fim
hard
{ "lang": "python", "repo": "conrad-strughold/GamestonkTerminal", "path": "/openbb_terminal/core/sdk/models/etf_sdk_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class EtfDiscovery(Category): """Discovery Module. Attributes: `mover`: Scrape data for top etf movers.\n """ _location_path = "etf.disc" def __init__(self): super().__init__() self.mover = lib.etf_disc_wsj_model.etf_movers<|fim_prefix|># repo: conrad-strugh...
code_fim
hard
{ "lang": "python", "repo": "conrad-strughold/GamestonkTerminal", "path": "/openbb_terminal/core/sdk/models/etf_sdk_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> indexes = cv2.dnn.NMSBoxes(boxes, confidences, threshold, nms_threshold) # set font and other settings font = cv2.FONT_HERSHEY_PLAIN rec_width = 1 txt_height = 1 text_width = 1 for i in range(len(boxes)): if i in indexes: x, y, w, h = boxes[i] ...
code_fim
hard
{ "lang": "python", "repo": "Phantomias3782/AutonomousCar", "path": "/main/object_detection/object_detection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Phantomias3782/AutonomousCar path: /main/object_detection/object_detection.py import cv2 import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mping import time import imutils import os focalLength = None def load_custom_names(): "load names of custom text file" ...
code_fim
hard
{ "lang": "python", "repo": "Phantomias3782/AutonomousCar", "path": "/main/object_detection/object_detection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def calculate_distance(image, object_width): "get image and calculate distance to object" # set marker attributes marker_width = 16 marker_distance = 50 # check if calibration is done if focalLength != None: # calcuate distance distance = round((marker_width * fo...
code_fim
hard
{ "lang": "python", "repo": "Phantomias3782/AutonomousCar", "path": "/main/object_detection/object_detection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Name = models.CharField(max_length=40) Phone = models.IntegerField() Lab_Number = models.IntegerField() report = models.FileField(upload_to='LabReport/media/')<|fim_prefix|># repo: dpkrobomad/Covid-19_Lab_Report_Plugin path: /app/models.py from django.db import models from LabReport.setti...
code_fim
easy
{ "lang": "python", "repo": "dpkrobomad/Covid-19_Lab_Report_Plugin", "path": "/app/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dpkrobomad/Covid-19_Lab_Report_Plugin path: /app/models.py from django.db import models from LabReport.settings import BASE_DIR # Create your models here. <|fim_suffix|> Name = models.CharField(max_length=40) Phone = models.IntegerField() Lab_Number = models.IntegerField() repor...
code_fim
easy
{ "lang": "python", "repo": "dpkrobomad/Covid-19_Lab_Report_Plugin", "path": "/app/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1st1/edgedb path: /edb/lang/ir/inference/cardinality.py # # This source file is part of the EdgeDB open source project. # # Copyright 2008-present MagicStack Inc. and the EdgeDB authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in comp...
code_fim
hard
{ "lang": "python", "repo": "1st1/edgedb", "path": "/edb/lang/ir/inference/cardinality.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@_infer_cardinality.register(irast.Statement) def __infer_statement(ir, scope_tree, schema): return infer_cardinality(ir.expr, scope_tree, schema) @_infer_cardinality.register(irast.EmptySet) def __infer_emptyset(ir, scope_tree, schema): return ONE @_infer_cardinality.register(irast.TypeRef) d...
code_fim
hard
{ "lang": "python", "repo": "1st1/edgedb", "path": "/edb/lang/ir/inference/cardinality.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if log_file: log_file.parent.mkdir(parents=True, exist_ok=True) fh = logging.handlers.TimedRotatingFileHandler(log_file, when='D', interval=1, backupCount=30) fh.setLevel(log_level) fh.setFormatter(formatter) self.logger.addHandler(fh) ...
code_fim
hard
{ "lang": "python", "repo": "shanhaiying/MemoryTools", "path": "/memorytools/tools/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>logger = Logger(log_file=Path("log/memorytools.log")).get_logger() if __name__ == '__main__': # logger = Logger().get_logger() logger.debug("debug msg") logger.info('info msg') logger.warning('warn msg') logger.error('error msg') logger.critical('critical msg')<|fim_prefix|># repo...
code_fim
hard
{ "lang": "python", "repo": "shanhaiying/MemoryTools", "path": "/memorytools/tools/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shanhaiying/MemoryTools path: /memorytools/tools/logger.py # -*- coding: utf-8 -*- """ @file: logger @author: Memory @date: 2020/10/11 @description: 自定义一个日志生成器 """ import logging import logging.handlers from sys import stdout from pathlib import Path <|fim_suffix|>logger = Logger(log_file=Path(...
code_fim
hard
{ "lang": "python", "repo": "shanhaiying/MemoryTools", "path": "/memorytools/tools/logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dirkbo/bunq_auto_topdown path: /auto_topdown.py #!/usr/bin/env .venv/bin/python -W ignore import argparse from libs.bunq_lib import BunqLib from share_lib import ShareLib from bunq.sdk.context import ApiEnvironmentType from decimal import Decimal from bunq.sdk.model.generated.endpoint imp...
code_fim
hard
{ "lang": "python", "repo": "dirkbo/bunq_auto_topdown", "path": "/auto_topdown.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if account_a is not None and account_b_id is not None: a_balance = Decimal(account_a.balance.value) print("Balance (%s): %s of Max %s" % (account_a.id_, a_balance, max_value)) if account_a.balance.currency != account_b.balance.currency: print("Auto Top-Down not ...
code_fim
hard
{ "lang": "python", "repo": "dirkbo/bunq_auto_topdown", "path": "/auto_topdown.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lxypeter/price-monitor path: /run.py # -*- coding: utf-8 -*- ''' run the server ''' __author__ = 'CY Lee' <|fim_suffix|>if __name__ == '__main__': APP = create_app() APP.run(use_reloader=False)<|fim_middle|>from price_monitor.factory import create_app
code_fim
easy
{ "lang": "python", "repo": "lxypeter/price-monitor", "path": "/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from price_monitor.factory import create_app if __name__ == '__main__': APP = create_app() APP.run(use_reloader=False)<|fim_prefix|># repo: lxypeter/price-monitor path: /run.py # -*- coding: utf-8 -*- <|fim_middle|>''' run the server ''' __author__ = 'CY Lee'
code_fim
easy
{ "lang": "python", "repo": "lxypeter/price-monitor", "path": "/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lxypeter/price-monitor path: /run.py # -*- coding: utf-8 -*- ''' run the server ''' <|fim_suffix|>if __name__ == '__main__': APP = create_app() APP.run(use_reloader=False)<|fim_middle|>__author__ = 'CY Lee' from price_monitor.factory import create_app
code_fim
medium
{ "lang": "python", "repo": "lxypeter/price-monitor", "path": "/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kim-jane/NuclearManyBody path: /src/tools/display.py import pandas as pd def display_hamiltonian(H): print("Hamiltonian:") for i in range(H.shape[0]): print("[", end="") for j in range(H.shape[1]): print("{: 10.5f}".format(H[i,j]), end="") print("]") ...
code_fim
hard
{ "lang": "python", "repo": "kim-jane/NuclearManyBody", "path": "/src/tools/display.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Many-body states:") print(pd.DataFrame(mb_states, columns=labels)) print("\n")<|fim_prefix|># repo: kim-jane/NuclearManyBody path: /src/tools/display.py import pandas as pd def display_hamiltonian(H): print("Hamiltonian:") for i in range(H.shape[0]): print("[", end="...
code_fim
medium
{ "lang": "python", "repo": "kim-jane/NuclearManyBody", "path": "/src/tools/display.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Many-body states:") print(pd.DataFrame(mb_states, columns=labels)) print("\n")<|fim_prefix|># repo: kim-jane/NuclearManyBody path: /src/tools/display.py import pandas as pd def display_hamiltonian(H): print("Hamiltonian:") for i in range(H.shape[0]): print("[", end=""...
code_fim
hard
{ "lang": "python", "repo": "kim-jane/NuclearManyBody", "path": "/src/tools/display.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BKPrecisionCorp/894-and-895_Series path: /Python 3/894_5_sweep.py import time import visa rm=visa.ResourceManager() li=rm.list_resources() for index in range(len(li)): print(str(index)+" - "+li[index]) choice = input("Which device?: ") vi=rm.open_resource(li[int(choice)]) vi.timeout =...
code_fim
hard
{ "lang": "python", "repo": "BKPrecisionCorp/894-and-895_Series", "path": "/Python 3/894_5_sweep.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print("Function - ",vi.query("func:imp?")) for i in range(int(points)): freq = int(start) + int(step)*i cmd = "freq "+str(freq) vi.write(cmd) resp = str(freq)+","+vi.query("fetch?") print(resp)<|fim_prefix|># repo: BKPrecisionCorp/894-and-895_Series path: /Python 3/894_5_sweep....
code_fim
medium
{ "lang": "python", "repo": "BKPrecisionCorp/894-and-895_Series", "path": "/Python 3/894_5_sweep.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if (start + points*step) > 1000000: print("Frequency step and points too large (start + step*points) > 1000000 - exiting (sorry)") exit() print("Function - ",vi.query("func:imp?")) for i in range(int(points)): freq = int(start) + int(step)*i cmd = "freq "+str(freq) vi.write(cm...
code_fim
hard
{ "lang": "python", "repo": "BKPrecisionCorp/894-and-895_Series", "path": "/Python 3/894_5_sweep.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: isabella232/python-kustomize path: /tests/fixtures/dataclasses_/python/kustomization.py from dataclasses import dataclass from typing import List <|fim_suffix|> kustomization = MyKustomization( commonLabels=CommonLabels(app='hello'), resources=[ 'deployment', 'service', ...
code_fim
medium
{ "lang": "python", "repo": "isabella232/python-kustomize", "path": "/tests/fixtures/dataclasses_/python/kustomization.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>kustomization = MyKustomization( commonLabels=CommonLabels(app='hello'), resources=[ 'deployment', 'service', 'configMap', ], )<|fim_prefix|># repo: isabella232/python-kustomize path: /tests/fixtures/dataclasses_/python/kustomization.py from dataclasses import dataclas...
code_fim
easy
{ "lang": "python", "repo": "isabella232/python-kustomize", "path": "/tests/fixtures/dataclasses_/python/kustomization.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shahjalalh/image_search_layer path: /imagesearch_app/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-09-15 11:22 from __future__ import unicode_literals from django.db import migrations, models <|fim_suffix|> initial = True dependencies = [ ] ...
code_fim
hard
{ "lang": "python", "repo": "shahjalalh/image_search_layer", "path": "/imagesearch_app/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='Image', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('url', models.URLField(max_length=255)), ...
code_fim
hard
{ "lang": "python", "repo": "shahjalalh/image_search_layer", "path": "/imagesearch_app/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: serkanh/uberlearner path: /uberlearner/courses/sitemaps.py from django.contrib.sitemaps import Sitemap class CoursesSitemap(Sitemap): priority = 0.6 def items(self): <|fim_suffix|> def lastmod(self, course): return course.last_modified<|fim_middle|> from courses.models...
code_fim
medium
{ "lang": "python", "repo": "serkanh/uberlearner", "path": "/uberlearner/courses/sitemaps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return course.last_modified<|fim_prefix|># repo: serkanh/uberlearner path: /uberlearner/courses/sitemaps.py from django.contrib.sitemaps import Sitemap class CoursesSitemap(Sitemap): priority = 0.6 def items(self): from courses.models import Course return Course.objects....
code_fim
easy
{ "lang": "python", "repo": "serkanh/uberlearner", "path": "/uberlearner/courses/sitemaps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # This funcion calls the K_Means algorithm multiple times to find the best converged # cluster centers cluster_centers = []; better_mu = {} for _ in range(int(len(X)/2)): # We use this loop to create multiple sets of cluster centers rand_mu = mu_generator(X, K) clu...
code_fim
hard
{ "lang": "python", "repo": "saberzuko/MachineLearningAlgorithms", "path": "/KMeansClustering/clustering.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saberzuko/MachineLearningAlgorithms path: /KMeansClustering/clustering.py import numpy as np from scipy.spatial import distance import random def mu_generator(X, K): # Function to initialize the cluster centers # The input is the training data X and the number of cluster centers mu =...
code_fim
hard
{ "lang": "python", "repo": "saberzuko/MachineLearningAlgorithms", "path": "/KMeansClustering/clustering.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for row in X: least_dist = float("inf"); cluster_idx = None for idx in range(len(mu)): # Computing the eucledian distance between the sample and the cluster centers euclid_dist = distance.euclidean(row, mu[idx]) # Finding the least distance between t...
code_fim
hard
{ "lang": "python", "repo": "saberzuko/MachineLearningAlgorithms", "path": "/KMeansClustering/clustering.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _parse(self): """ The main part of the program. It analyzes the given code-text and returns a tree-like scope. For a more detailed description, see the class description. :param text: The code which should be parsed. :param type: str :raise...
code_fim
hard
{ "lang": "python", "repo": "tobywaite/dotfiles", "path": "/home/.config/nvim/bundle/jedi-vim/jedi/jedi/parsing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tobywaite/dotfiles path: /home/.config/nvim/bundle/jedi-vim/jedi/jedi/parsing.py token_type, tok = self.next() if token_type != tokenize.NAME and tok != '*': return [], token_type, tok else: token_type, tok = pre_used_token if to...
code_fim
hard
{ "lang": "python", "repo": "tobywaite/dotfiles", "path": "/home/.config/nvim/bundle/jedi-vim/jedi/jedi/parsing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ukaana99/nhk2015_back_ros path: /robominton/scripts/third.py #!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 2015/02/11 @author: spiralray ''' import shuttle import numpy as np import copy import sys import roslib import rospy import std_msgs.msg from geometry_msgs.msg import P...
code_fim
hard
{ "lang": "python", "repo": "ukaana99/nhk2015_back_ros", "path": "/robominton/scripts/third.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pointPub.publish(msg) #print msg.header.stamp.to_sec() return k.predict(0.01) publishHome() def poseCallback(msg): global pose pose = msg.pose def modeCallback(msg): global mode mode = msg.data def shuttleCallback(msg): global time ...
code_fim
hard
{ "lang": "python", "repo": "ukaana99/nhk2015_back_ros", "path": "/robominton/scripts/third.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LibreOffice/impress_remote path: /pebble/libpebble/pebble.py #!/usr/bin/env python import binascii import glob import itertools import json import logging import os import serial import signal import stm32_crc import struct import threading import time import traceback import uuid import zipfile...
code_fim
hard
{ "lang": "python", "repo": "LibreOffice/impress_remote", "path": "/pebble/libpebble/pebble.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _application_message_response(self, endpoint, data): app_messages = { b'\x01': "PUSH", b'\x02': "REQUEST", b'\xFF': "ACK", b'\x7F': "NACK" } if len(data) > 1: rest = data[1:] else: rest = '' if data[0] in app_messages: return app_messages[data[0]] + rest def _phone_...
code_fim
hard
{ "lang": "python", "repo": "LibreOffice/impress_remote", "path": "/pebble/libpebble/pebble.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = pack("!bIbb", 1, len(self._buffer), self._transfer_type, self._index) self._pebble._send_message("PUTBYTES", data) self._state = self.states["WAIT_FOR_TOKEN"] def wait_for_token(self, resp): res, = unpack("!b", resp[0]) if res != 1: log.error("init failed with code %d" % res) self...
code_fim
hard
{ "lang": "python", "repo": "LibreOffice/impress_remote", "path": "/pebble/libpebble/pebble.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: luminousflux/lflux path: /lfluxproject/tests/test_basics.py from django.test.client import Client from django.test import TestCase from lstory.models import Story from datetime import datetime import reversion <|fim_suffix|> def test_story_creation(self): client = Client() wi...
code_fim
medium
{ "lang": "python", "repo": "luminousflux/lflux", "path": "/lfluxproject/tests/test_basics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> client = Client() with reversion.create_revision(): Story.objects.create(published=datetime.now(), body='roflcopter', summary='roflcopter', title='roflcopter',slug='roflcopter',name='roflcopter') responses = [client.get('/roflcopter/'),client.get('/roflcopter/embed/')] ...
code_fim
medium
{ "lang": "python", "repo": "luminousflux/lflux", "path": "/lfluxproject/tests/test_basics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Shelf = enum_type_wrapper.EnumTypeWrapper(_SHELF) GENERIC_SHELF = 0 ECONOMY = 1 MIDSHELF = 2 TOPSHELF = 3 DESCRIPTOR.enum_types_by_name['Shelf'] = _SHELF _sym_db.RegisterFileDescriptor(DESCRIPTOR) DESCRIPTOR.has_options = True DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(...
code_fim
hard
{ "lang": "python", "repo": "fagan2888/Python", "path": "/src/bloombox/schema/structs/Shelf_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }