text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> @pytest.mark.xfail(iteration_utilities.EQ_PY2, reason='pickle does not work on Python 2') @memory_leak_decorator(offset=1) def test_roundrobin_pickle2(): rr2 = roundrobin([T(1)], [T(1), T(2), T(3)]) assert next(rr2) == T(1) assert next(rr2) == T(1) assert next(rr2) == T...
code_fim
hard
{ "lang": "python", "repo": "sollyucko/iteration_utilities", "path": "/tests/test_roundrobin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with pytest.raises(_hf.FailIter.EXC_TYP) as exc: roundrobin([T(1)], _hf.FailIter()) assert _hf.FailIter.EXC_MSG in str(exc) @memory_leak_decorator(collect=True) def test_roundrobin_failure3(): # Test that a failing iterator doesn't raise a SystemError with pytest.raises(_hf.FailN...
code_fim
hard
{ "lang": "python", "repo": "sollyucko/iteration_utilities", "path": "/tests/test_roundrobin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sollyucko/iteration_utilities path: /tests/test_roundrobin.py # Licensed under Apache License Version 2.0 - see LICENSE # Built-ins from __future__ import absolute_import, division, print_function import itertools import operator import pickle import sys # 3rd party import pytest # This module...
code_fim
hard
{ "lang": "python", "repo": "sollyucko/iteration_utilities", "path": "/tests/test_roundrobin.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> regex = "\?$" if not re.search(regex, text, re.I): return reply = random.choice(self.replies) event.raw.nreply(reply.upper()) return 'NO MORE'<|fim_prefix|># repo: pteichman/kibot-modules path: /kibot/modules/eightball.py import kibot.BaseModule impo...
code_fim
hard
{ "lang": "python", "repo": "pteichman/kibot-modules", "path": "/kibot/modules/eightball.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pteichman/kibot-modules path: /kibot/modules/eightball.py import kibot.BaseModule import random import re class eightball(kibot.BaseModule.BaseModule): """Magic 8-Ball""" def __init__(self, bot): self.affirmative = [ "As I see it, yes", "It is certain", ...
code_fim
hard
{ "lang": "python", "repo": "pteichman/kibot-modules", "path": "/kibot/modules/eightball.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fimion/pydak path: /examples/dakexample.py from daktronics import DakUDP, Daktronics if __name__ == '__main__': print("UDP MULTICAST 21000") dak_data = DakUDP(21000) da<|fim_suffix|>-------------------") print(dak['Main Clock Time (mm:ss/ss.t )']) print(dak['Home Team...
code_fim
medium
{ "lang": "python", "repo": "fimion/pydak", "path": "/examples/dakexample.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(dak['Guest Team Name'], dak['Guest Team Score']) print("--------------------------------------------------------------")<|fim_prefix|># repo: fimion/pydak path: /examples/dakexample.py from daktronics import DakUDP, Daktronics if __name__ == '__main__': print("UDP MULTICAST 21000"...
code_fim
hard
{ "lang": "python", "repo": "fimion/pydak", "path": "/examples/dakexample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if '__main__' == __name__: channel = 1 i2cIface = i2c.I2CIface(channel) temperature = [ (0x5a, mlx90614.MLX90614(i2cIface, 'reactive1_temperature', 0x5a)), (0x5b, mlx90614.MLX90614(i2cIface, 'reactive1_temperature', 0x5b)), (0x5c, mlx90614.MLX90614(i2cIface, 'reactive1_temperature', 0x5c))] whil...
code_fim
medium
{ "lang": "python", "repo": "en-medina/RPI_REACTOR_CSTR_TOG", "path": "/app/_test/i2c_temperature_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: en-medina/RPI_REACTOR_CSTR_TOG path: /app/_test/i2c_temperature_test.py import importlib.util from time import sleep spec = importlib.util.spec_from_file_location("i2c", "../i2c_service/i2c.py") i2c = importlib.util.module_from_spec(spec) spec.loader.exec_module(i2c) <|fim_suffix|>if '__main__' ...
code_fim
medium
{ "lang": "python", "repo": "en-medina/RPI_REACTOR_CSTR_TOG", "path": "/app/_test/i2c_temperature_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if cell['cell_type'] == 'code': markdownResult += '\n```' debugPrint(markdownResult) markdownResult += '\n\n' return markdownResult if __name__ == "__main__": parser = ArgumentParser(description="Jupyter Notebook to Markdown Converter (v{})".format(VERSION))...
code_fim
hard
{ "lang": "python", "repo": "mdailous/jupyter2markdown", "path": "/jn2md.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdailous/jupyter2markdown path: /jn2md.py #!/usr/local/bin/env python3 """Jupyter Notebook to Markdown Converter. Converts Jupyter notebooks to markdown format. The resulting markdown file is saved in the same directory with the same base name as the Jupyter Notebook. Copyright 2021 Michae...
code_fim
hard
{ "lang": "python", "repo": "mdailous/jupyter2markdown", "path": "/jn2md.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": parser = ArgumentParser(description="Jupyter Notebook to Markdown Converter (v{})".format(VERSION)) parser.add_argument('notebookFile', metavar='NOTEBOOK', help='The Jupyter Notebook to convert. Specify the full path if the file is not in the current directory') p...
code_fim
hard
{ "lang": "python", "repo": "mdailous/jupyter2markdown", "path": "/jn2md.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tengyu-liu/Part-GPNN path: /src/python/datasets/HICO/roi_feature_model.py """ Created on Feb 26, 2018 @author: Siyuan Qi Description of the file. """ import os import random import copy import numpy as np import scipy.misc import imageio import torch import torchvision import cv2 import scip...
code_fim
hard
{ "lang": "python", "repo": "tengyu-liu/Part-GPNN", "path": "/src/python/datasets/HICO/roi_feature_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Vgg16(torch.nn.Module): def __init__(self, num_classes=1000): super(Vgg16, self).__init__() self.features = torchvision.models.vgg16(pretrained=True).features self.classifier = torch.nn.Sequential( torch.nn.Linear(512 * 7 * 7, 4096), torch.nn.ReLU...
code_fim
hard
{ "lang": "python", "repo": "tengyu-liu/Part-GPNN", "path": "/src/python/datasets/HICO/roi_feature_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for m in self.modules(): if isinstance(m, torch.nn.BatchNorm2d): m.weight.data.fill_(1) m.bias.data.zero_() elif isinstance(m, torch.nn.Linear): m.weight.data.normal_(0, 0.01) m.bias.data.zero_() class Resnet...
code_fim
hard
{ "lang": "python", "repo": "tengyu-liu/Part-GPNN", "path": "/src/python/datasets/HICO/roi_feature_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tornadoyi/gymgame path: /gymgame/tinyrpg/framework/render.py import numpy as np from easydict import EasyDict as edict from bokeh.plotting import figure, curdoc from bokeh.layouts import gridplot from gymgame.tinyrpg.framework import config import colorsys import warnings from gymgame import fram...
code_fim
hard
{ "lang": "python", "repo": "tornadoyi/gymgame", "path": "/gymgame/tinyrpg/framework/render.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class PlayerRenderer(CharacterRenderer): def _get_characters(self): return self.game.map.players class BulletRenderer(ObjectRenderer): def initialize(self, *args, **kwargs): super(BulletRenderer, self).initialize(*args, **kwargs) bullet_num = len(self.game.map.bullets) ...
code_fim
hard
{ "lang": "python", "repo": "tornadoyi/gymgame", "path": "/gymgame/tinyrpg/framework/render.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chetan-rns/ML-LAB path: /prog/9.py from sklearn.datasets import load_iris from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier iris_dataset=load_iris() X_train, X_test, y_train, y_test = train_test_spli...
code_fim
medium
{ "lang": "python", "repo": "chetan-rns/ML-LAB", "path": "/prog/9.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>classifier = KNeighborsClassifier(n_neighbors = 5) classifier.fit(X_train, y_train) y_pred = classifier.predict(X_test) print(accuracy_score(y_test, y_pred))<|fim_prefix|># repo: chetan-rns/ML-LAB path: /prog/9.py from sklearn.datasets import load_iris from sklearn.metrics import accuracy_score from skl...
code_fim
medium
{ "lang": "python", "repo": "chetan-rns/ML-LAB", "path": "/prog/9.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>y_pred = classifier.predict(X_test) print(accuracy_score(y_test, y_pred))<|fim_prefix|># repo: chetan-rns/ML-LAB path: /prog/9.py from sklearn.datasets import load_iris from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighbors...
code_fim
hard
{ "lang": "python", "repo": "chetan-rns/ML-LAB", "path": "/prog/9.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for _ in range(tcs): exp=input() print(minReverse(exp))<|fim_prefix|># repo: LetsUpgrade/Algorithmic-Treasure path: /AfraMP/CountReversal/CountReversal.py def minReverse(exp): if len(exp)%2!=0: return -1 c=0 op=0 for e in exp: if e=='}' and op==0: ...
code_fim
medium
{ "lang": "python", "repo": "LetsUpgrade/Algorithmic-Treasure", "path": "/AfraMP/CountReversal/CountReversal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LetsUpgrade/Algorithmic-Treasure path: /AfraMP/CountReversal/CountReversal.py def minReverse(exp): if len(exp)%2!=0: return -1 c=0 op=0 for e in exp: if e=='}' and op==0: op=1 c+=1 elif e=='}': op-=1 else: ...
code_fim
medium
{ "lang": "python", "repo": "LetsUpgrade/Algorithmic-Treasure", "path": "/AfraMP/CountReversal/CountReversal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': tcs=int(input()) for _ in range(tcs): exp=input() print(minReverse(exp))<|fim_prefix|># repo: LetsUpgrade/Algorithmic-Treasure path: /AfraMP/CountReversal/CountReversal.py def minReverse(exp): if len(exp)%2!=0: return -1 c=0 op=0 ...
code_fim
medium
{ "lang": "python", "repo": "LetsUpgrade/Algorithmic-Treasure", "path": "/AfraMP/CountReversal/CountReversal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ), ), ( "net_artif", models.DecimalField( blank=True, decimal_places=4, max_digits=15, null=True, ve...
code_fim
hard
{ "lang": "python", "repo": "MTES-MCT/sparte", "path": "/public_data/migrations/0055_communediff.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>e="Nouvelle année", ), ), ( "new_artif", models.DecimalField( blank=True, decimal_places=4, max_digits=15, null=True, ...
code_fim
hard
{ "lang": "python", "repo": "MTES-MCT/sparte", "path": "/public_data/migrations/0055_communediff.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MTES-MCT/sparte path: /public_data/migrations/0055_communediff.py # Generated by Django 3.2.13 on 2022-05-10 12:26 import django.core.validators import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("publi...
code_fim
hard
{ "lang": "python", "repo": "MTES-MCT/sparte", "path": "/public_data/migrations/0055_communediff.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: exzhawk/dl_rename_byrj path: /offline2db.py # -*- encoding: utf-8 -*- # Author: Epix import codecs import os import pickle import re from lxml import etree if __name__ == '__main__': rj_re = re.compile(r'/(RJ\d*)\.html') offline_dir = 'offline' files = os.listdir(offline_dir) re...
code_fim
medium
{ "lang": "python", "repo": "exzhawk/dl_rename_byrj", "path": "/offline2db.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # with codecs.open('rj.jl', 'w', 'utf8') as f_out: # for p in result: # f_out.write(json.dumps(p, ensure_ascii=False) + '\n')<|fim_prefix|># repo: exzhawk/dl_rename_byrj path: /offline2db.py # -*- encoding: utf-8 -*- # Author: Epix import codecs import os import pickle import re ...
code_fim
medium
{ "lang": "python", "repo": "exzhawk/dl_rename_byrj", "path": "/offline2db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if msrp is None: msrp = response.css( "div#price span.priceBlockStrikePriceString::text").get() sale_price = response.css( "div#price span#priceblock_pospromoprice::text").get() yield { "product_name": response.css...
code_fim
hard
{ "lang": "python", "repo": "hannahfolk/hearful_spider", "path": "/hearful_spider/spiders/product_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hannahfolk/hearful_spider path: /hearful_spider/spiders/product_data.py import scrapy class ProductDataSpider(scrapy.Spider): """ This spider scrapes the GoPro Fusion Waterproof Digital Spherical Amazon page for pertinent product information. """ name = "product_data" custom_setting...
code_fim
hard
{ "lang": "python", "repo": "hannahfolk/hearful_spider", "path": "/hearful_spider/spiders/product_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xiangyann/SDCND-Semantic-Segmentation path: /helper.py ''' You should not edit helper.py as part of your submission. This file is used primarily to download vgg if it has not yet been, give you the progress of the download, get batches for your training, as well as around generating and saving t...
code_fim
hard
{ "lang": "python", "repo": "xiangyann/SDCND-Semantic-Segmentation", "path": "/helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Generate test output using the test images :param sess: TF session :param logits: TF Tensor for the logits :param keep_prob: TF Placeholder for the dropout keep probability :param image_pl: TF Placeholder for the image placeholder :param data_folder: Path to the folder that contains the data...
code_fim
hard
{ "lang": "python", "repo": "xiangyann/SDCND-Semantic-Segmentation", "path": "/helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: imayuyu/KALMUS path: /kalmus/tkinter_windows/time_points_windows/DisplaySavedFramesWindow.py """ DisplaySavedFramesWindow Class """ import tkinter from kalmus.tkinter_windows.gui_utils import resource_path import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import (FigureCanv...
code_fim
hard
{ "lang": "python", "repo": "imayuyu/KALMUS", "path": "/kalmus/tkinter_windows/time_points_windows/DisplaySavedFramesWindow.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.barcode = barcode # Initialize the window self.window = tkinter.Tk() self.window.wm_title("Display frames") self.window.iconbitmap(resource_path("kalmus_icon.ico")) # Set up the plotted figure self.fig = plt.figure(figsize=figsize, dpi=dpi) ...
code_fim
hard
{ "lang": "python", "repo": "imayuyu/KALMUS", "path": "/kalmus/tkinter_windows/time_points_windows/DisplaySavedFramesWindow.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SMISC/logging path: /provision/src/service/backup.py import logging import base64 import time from model import Model class BackupService(Model): <|fim_suffix|> self.db.execute('insert into backups ("table", timestamp, ref_start, ref_end, glacier_id) values (%s, %s, %s, %s, %s)', (table,...
code_fim
hard
{ "lang": "python", "repo": "SMISC/logging", "path": "/provision/src/service/backup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.db.execute('insert into backups ("table", timestamp, ref_start, ref_end, glacier_id) values (%s, %s, %s, %s, %s)', (table, timestamp, ref_start, ref_end, glacier_id))<|fim_prefix|># repo: SMISC/logging path: /provision/src/service/backup.py import logging import base64 import time from mode...
code_fim
hard
{ "lang": "python", "repo": "SMISC/logging", "path": "/provision/src/service/backup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JaronrH/RF path: /RF/app/application.py from components import featureBroker from commands import * import sys import time from components.daemon import Daemon import os import json import logging.config from ConfigParser import SafeConfigParser from flask import Flask from controllers import * ...
code_fim
hard
{ "lang": "python", "repo": "JaronrH/RF", "path": "/RF/app/application.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Set secret Key app.web.secret_key = 'A0ew:DE~7/T6yA^8vqNgjVB5tZr98j/3yX R~XHH!jmew:DE~7/T6yA^8vqNgjVB5tN]LWX/,?RT' # Flask-SQLAlchemy app.web.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+featureBroker.RequiredFeature('conf_DB').result['rf'] app.db = SQLAlchem...
code_fim
hard
{ "lang": "python", "repo": "JaronrH/RF", "path": "/RF/app/application.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ynasida/KazooCommission path: /kazoocommission/controllers.py from flask import abort, Flask, make_response, render_template, request from functools import wraps from jinja2.exceptions import TemplateNotFound from kazoocommission import config from kazoocommission.services import KazooAccountServ...
code_fim
hard
{ "lang": "python", "repo": "ynasida/KazooCommission", "path": "/kazoocommission/controllers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not config.DISABLE_SSL_CLIENT_SUBJECT_VALIDATION: ssl_subject = request.headers.get('X-SSL-Subject') if not ssl_subject: abort(403) if not kwargs['mac_address'] in ssl_subject: abort(403) return fn(*args, **kwargs) ...
code_fim
hard
{ "lang": "python", "repo": "ynasida/KazooCommission", "path": "/kazoocommission/controllers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TeddTech/NLP_Firm_Prediction path: /src/scripts/create_financial_features_script.py #!/usr/bin/python """ Creates differences in each year within a specified column in labeled the subset compustat data Sample usage from terminal: ``` python create_financial_featur...
code_fim
hard
{ "lang": "python", "repo": "TeddTech/NLP_Firm_Prediction", "path": "/src/scripts/create_financial_features_script.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Read in all necessary files for creating features: if args['toDifference']: logger.info("Reading in toDifference file at: {}".format(args['toDifference'])) with open(args['toDifference'], "r") as f: args['toDifference'] = f.read() args['toDifference'] = args['...
code_fim
hard
{ "lang": "python", "repo": "TeddTech/NLP_Firm_Prediction", "path": "/src/scripts/create_financial_features_script.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ======== C:\D\Exercise\helloworld\python\Qt>40.3_1Layer_decorator.py calling time : 1609127072.3361893 running function1 calling time : 1609127072.3370233 running function2 '''<|fim_prefix|># repo: seekindark/helloworld path: /python/py-study/40.3_1Layer_decorator.py #coding=UTF-8 import tim...
code_fim
hard
{ "lang": "python", "repo": "seekindark/helloworld", "path": "/python/py-study/40.3_1Layer_decorator.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ''' 这样的修饰函数,当碰到@,是可以直接运行的, 其实是直接执行了修饰函数 1. showTime(funciton1) 2. showTime(function2) 这样的写法是不满足要求的,没有起到修饰的作用。 修饰函数的作用是用来 辅助增加LOG,或是查问题时,写一个调式函数作为 目标函数的 修饰函数, 这样所有的目标函数被调用时可以 运行修饰函数,以达到调式的目的 ======== C:\D\Exercise\helloworld\python\Qt>40.3_1Layer_decorator.py calling time : 1609127072.3361...
code_fim
medium
{ "lang": "python", "repo": "seekindark/helloworld", "path": "/python/py-study/40.3_1Layer_decorator.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: seekindark/helloworld path: /python/py-study/40.3_1Layer_decorator.py #coding=UTF-8 import time def showTime(fn): print('calling time : ', time.time()) fn() #调用传入的参数 @showTime def function1(): print('running function1 ') @showTime def function2(): print('running fu...
code_fim
hard
{ "lang": "python", "repo": "seekindark/helloworld", "path": "/python/py-study/40.3_1Layer_decorator.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>nductivity", mobility * electron_conc * ELECTRON_CHARGE, ) elif electron_conc == 0: return ( "electron_conc", conductivity / (mobility * ELECTRON_CHARGE), ) else: return ( "mobility", conductivity / (electr...
code_fim
hard
{ "lang": "python", "repo": "TheAlgorithms/Python", "path": "/electronics/electric_conductivity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheAlgorithms/Python path: /electronics/electric_conductivity.py from __future__ import annotations ELECTRON_CHARGE = 1.6021e-19 # units = C def electric_conductivity( conductivity: float, electron_conc: float, mobility: float, ) -> tuple[str, float]: """ This function can...
code_fim
hard
{ "lang": "python", "repo": "TheAlgorithms/Python", "path": "/electronics/electric_conductivity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hapygallagher/diesel path: /diesel/client.py # vim:ts=4:sw=4:expandtab import errno from diesel import log import ipdb import socket class Client(object): '''An agent that connects to an external host and provides an API to return data based on a protocol across that host. ''' de...
code_fim
hard
{ "lang": "python", "repo": "hapygallagher/diesel", "path": "/diesel/client.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def _resolve(self, addr): return addr class remote_addr(object): def __get__(self, inst, other): return (inst.addr, inst.port) def __set__(self, inst, value): inst.addr, inst.port = value remote_addr = remote_addr() class UDPConnectionClient(U...
code_fim
hard
{ "lang": "python", "repo": "hapygallagher/diesel", "path": "/diesel/client.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def eval_expression(self, input_string, image_author, image_name, image_tag): allowed_names = {"format": format, "image_author": image_author, "image_name": image_name, "image_tag": image_tag} code = compile(input_string, "<string>", "e...
code_fim
hard
{ "lang": "python", "repo": "epleterte/docker-multiscan", "path": "/scanner_plugin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: epleterte/docker-multiscan path: /scanner_plugin.py import json import os import re import subprocess import datetime import pandas as pd import requests from nvd_cache import NvdCache import logging def safe_get_key(dict, key): if key in dict: return dict[key] else: ret...
code_fim
hard
{ "lang": "python", "repo": "epleterte/docker-multiscan", "path": "/scanner_plugin.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: commonlims/commonlims path: /src/clims/api/serializers/models/workunit.py from __future__ import absolute_import from rest_framework import serializers from clims.api.serializers.models.substance import SubstanceSerializer <|fim_suffix|> def get_tracked_object(self, obj): return Subs...
code_fim
hard
{ "lang": "python", "repo": "commonlims/commonlims", "path": "/src/clims/api/serializers/models/workunit.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_tracked_object(self, obj): return SubstanceSerializer(obj.tracked_object).data<|fim_prefix|># repo: commonlims/commonlims path: /src/clims/api/serializers/models/workunit.py from __future__ import absolute_import from rest_framework import serializers from clims.api.serializers.model...
code_fim
hard
{ "lang": "python", "repo": "commonlims/commonlims", "path": "/src/clims/api/serializers/models/workunit.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MikeFez/BrowserWrapper path: /BrowserWrapper/browserwrapper.py url} contains {url_portion} within {timeout} seconds") except SeleniumExceptions.TimeoutException: self.log_warning(f"Browser.waitForURLToContain: {self.CORE.current_url} does not contain {url_portion} after {timeo...
code_fim
hard
{ "lang": "python", "repo": "MikeFez/BrowserWrapper", "path": "/BrowserWrapper/browserwrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MikeFez/BrowserWrapper path: /BrowserWrapper/browserwrapper.py t} seconds") return True except SeleniumExceptions.TimeoutException: self.log_warning(f"Browser.waitForElementNotPresent: {element_tuple} did not become not present after {timeout} seconds") ...
code_fim
hard
{ "lang": "python", "repo": "MikeFez/BrowserWrapper", "path": "/BrowserWrapper/browserwrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setText(self, element_tuple, text): """Clear an element, then sends keys to it. Typically used for form inputs. Arguments: element_tuple {PageObject Element} -- Tuple representation of element typically defined on PageObjects used for locating the element. ...
code_fim
hard
{ "lang": "python", "repo": "MikeFez/BrowserWrapper", "path": "/BrowserWrapper/browserwrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sporteasy/python-facebook path: /python_facebook/sdk/http/graph_raw_response.py # -*- coding: utf-8 -*- from __future__ import unicode_literals import re from requests.structures import CaseInsensitiveDict class GraphRawResponse(object): def __init__(self, headers, body, http_status_code...
code_fim
hard
{ "lang": "python", "repo": "sporteasy/python-facebook", "path": "/python_facebook/sdk/http/graph_raw_response.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_http_response_code(self): return self.http_response_code def set_http_response_code_from_header(self, raw_response_header): # ex: HTTP/1.1 200 OK pattern = r'^HTTP/\d\.\d\s+(\d+)\s+.*' result = re.match(pattern, raw_response_header) self.http_respo...
code_fim
hard
{ "lang": "python", "repo": "sporteasy/python-facebook", "path": "/python_facebook/sdk/http/graph_raw_response.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ews import ( tickets_admin_batch_view, tickets_admin_batches_view, tickets_admin_menu_items, tickets_admin_order_view, tickets_admin_orders_view, tickets_admin_stats_by_date_view, tickets_admin_stats_view, tickets_admin_tools_view, )<|fim_prefix|># repo: wyrmiyu/kompassi p...
code_fim
medium
{ "lang": "python", "repo": "wyrmiyu/kompassi", "path": "/tickets/views/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wyrmiyu/kompassi path: /tickets/views/__init__.py # encoding: utf-8 from .public_views import ( ALL_PHASES, tickets_address_view, tickets_closed_view, tickets_confirm_view, tickets_thanks_view, tickets_tickets_view, tickets_welcome_view, tickets_event_box_context,...
code_fim
medium
{ "lang": "python", "repo": "wyrmiyu/kompassi", "path": "/tickets/views/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": mp.set_start_method("spawn", force=True) args = get_parser().parse_args() logger = setup_logger() logger.info("Arguments: " + str(args)) cfg = setup_cfg(args) #inference_model = VisualizationDemo(cfg) inference_model = Visualizationinference_model(...
code_fim
hard
{ "lang": "python", "repo": "SyedShaQutub/Mask_RCNN-Detectron2", "path": "/inference/inference_trainedModel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SyedShaQutub/Mask_RCNN-Detectron2 path: /inference/inference_trainedModel.py import argparse import glob import multiprocessing as mp from collections import deque import cv2 import torch import time import tqdm import torch.multiprocessing as mp from detectron2.modeling import build_model from ...
code_fim
hard
{ "lang": "python", "repo": "SyedShaQutub/Mask_RCNN-Detectron2", "path": "/inference/inference_trainedModel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Args: image (np.ndarray): an image of shape (H, W, C) (in BGR order). This is the format used by OpenCV. Returns: predictions (dict): the output of the model. vis_output (VisImage): the visualized image output. """ ...
code_fim
hard
{ "lang": "python", "repo": "SyedShaQutub/Mask_RCNN-Detectron2", "path": "/inference/inference_trainedModel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WikiCommunityHealth/user-metrics path: /main.py import bz2 import math import pymongo from pymongo import MongoClient, UpdateOne from collections import Counter from sys import argv from joblib import Parallel, delayed import multiprocessing from utils import scraper from utils.dump import KEY...
code_fim
hard
{ "lang": "python", "repo": "WikiCommunityHealth/user-metrics", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def update_db(year: str, month: str): log(f'Uploading {year}/{month}') user_updates = [] inserts = [] updates = [] alters = [] def calc_entropy(counter: Counter, count: int) -> float: values = counter.values() sum_of_numbers = s...
code_fim
hard
{ "lang": "python", "repo": "WikiCommunityHealth/user-metrics", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LucidtechAI/las-cli path: /lascli/util.py import collections import contextlib import json from pathlib import Path class NotProvided: pass def nullable(_type=str): def _nullable(value): if isinstance(value, str) and value == 'null': return None return _typ...
code_fim
medium
{ "lang": "python", "repo": "LucidtechAI/las-cli", "path": "/lascli/util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def capture_return(dest: list): def inner(f): @contextlib.wraps(f) def wrapper(*args, **kwargs): nonlocal dest val = f(*args, **kwargs) dest += val if isinstance(val, (list, tuple)) else [val] return val return wrapper ret...
code_fim
hard
{ "lang": "python", "repo": "LucidtechAI/las-cli", "path": "/lascli/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def json_or_json_path(value): if not value: return try: return json.loads(value) except json.JSONDecodeError: pass try: return json.loads(Path(value).read_text()) except (json.JSONDecodeError, FileNotFoundError): pass raise Exception('Coul...
code_fim
hard
{ "lang": "python", "repo": "LucidtechAI/las-cli", "path": "/lascli/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: simone-mangiante/bugs-project path: /api-server/app/main.py from fastapi import FastAPI, Request, HTTPException from fastapi.templating import Jinja2Templates from pydantic import BaseModel from typing import List import time import os import redis import json # model for bug creation from users...
code_fim
hard
{ "lang": "python", "repo": "simone-mangiante/bugs-project", "path": "/api-server/app/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # put the bug object in Redis if not redis_client.set(bug.id, json.dumps(bug.dict())): raise HTTPException(status_code=500, detail="Database not available") # create the response response = OutputPost(bug_id=bug.id) if BUGS_ENV and BUGS_ENV == 'dev': response.en...
code_fim
hard
{ "lang": "python", "repo": "simone-mangiante/bugs-project", "path": "/api-server/app/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kashefy/transform path: /scripts/run_mlpMultiTask.py # -*- coding: utf-8 -*- """ Auto Encoder Example. Using an auto encoder on MNIST handwritten digits. References: Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. "Gradient-based learning applied to document recognition." Proceedings of ...
code_fim
hard
{ "lang": "python", "repo": "kashefy/transform", "path": "/scripts/run_mlpMultiTask.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", action='append', dest="fpath_cfg_list", type=str, required=True, help="Paths to config files") parser.add_argument("--log_dir", dest="log_dir", type=str, ...
code_fim
hard
{ "lang": "python", "repo": "kashefy/transform", "path": "/scripts/run_mlpMultiTask.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> :param info: PlecostResults instance :type info: `PlecostResults` """ root = ET.Element("libs") # Set target target = ET.SubElement(root, "target") target.text = info.target # Set time info time_start = ET.SubElement(root, "start_ti...
code_fim
hard
{ "lang": "python", "repo": "iniqua/plecost", "path": "/plecost_lib/libs/reporters.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> :param content: object with content :type content: object """ raise NotImplemented() # -------------------------------------------------------------------------- # Implementation # -------------------------------------------------------------------------- class ReporterJS...
code_fim
hard
{ "lang": "python", "repo": "iniqua/plecost", "path": "/plecost_lib/libs/reporters.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: iniqua/plecost path: /plecost_lib/libs/reporters.py #!/usr/bin/python # -*- coding: utf-8 -*- # # Plecost: Wordpress vulnerabilities finder # # @url: http://iniqua.com/labs/ # @url: https://github.com/iniqua/plecost # # @author:Francisco J. Gomez aka ffranz (http://iniqua.com/) # @author:Daniel G...
code_fim
hard
{ "lang": "python", "repo": "iniqua/plecost", "path": "/plecost_lib/libs/reporters.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> attrs = attrs or {} if 'placeholder' in attrs: del attrs['placeholder'] date_attrs = dict(attrs) time_attrs = dict(attrs) date_attrs.setdefault('class', 'form-control splitdatetimepart') time_attrs.setdefault('class', 'form-control splitdatetimep...
code_fim
hard
{ "lang": "python", "repo": "mabelticketing/pretix", "path": "/src/pretix/control/forms/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mabelticketing/pretix path: /src/pretix/control/forms/__init__.py import os from django import forms from django.utils.formats import get_format from django.utils.html import conditional_escape from django.utils.timezone import now from django.utils.translation import ugettext_lazy as _ from .....
code_fim
hard
{ "lang": "python", "repo": "mabelticketing/pretix", "path": "/src/pretix/control/forms/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pappasam/jedi-language-server path: /tests/lsp_test_client/defaults.py """Default values for lsp test client.""" import os import tests.lsp_test_client as lsp_client VSCODE_DEFAULT_INITIALIZE = { "processId": os.getpid(), # pylint: disable=no-member "clientInfo": {"name": "vscode", "ve...
code_fim
hard
{ "lang": "python", "repo": "pappasam/jedi-language-server", "path": "/tests/lsp_test_client/defaults.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>"contentFormat": ["markdown", "plaintext"], }, "signatureHelp": { "dynamicRegistration": True, "signatureInformation": { "documentationFormat": ["markdown", "plaintext"], "parameterInformation": {"labelOffsetSu...
code_fim
hard
{ "lang": "python", "repo": "pappasam/jedi-language-server", "path": "/tests/lsp_test_client/defaults.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.tool def setAlg(self): hvFolder = "/PIXEL/DCS/HV" tempFolder = "/PIXEL/DCS/TEMPERATURE" dbInstance = "DCS_OFL" from AthenaCommon.AthenaCommonFlags import athenaCommonFlags if athenaCommonFlags.isOnline(): hvFolder = "/PIXEL/HLT/DCS/HV" tempFolder = "/PIX...
code_fim
medium
{ "lang": "python", "repo": "strigazi/athena", "path": "/InnerDetector/InDetConditions/SiPropertiesTool/python/PixelSiPropertiesToolSetup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.toolName def setToolName(self, toolName): self.toolName = toolName def getTool(self): return self.tool def setAlg(self): hvFolder = "/PIXEL/DCS/HV" tempFolder = "/PIXEL/DCS/TEMPERATURE" dbInstance = "DCS_OFL" from AthenaCommon.AthenaCommonFlags import athe...
code_fim
medium
{ "lang": "python", "repo": "strigazi/athena", "path": "/InnerDetector/InDetConditions/SiPropertiesTool/python/PixelSiPropertiesToolSetup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: strigazi/athena path: /InnerDetector/InDetConditions/SiPropertiesTool/python/PixelSiPropertiesToolSetup.py # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration class PixelSiPropertiesToolSetup: "Class to simplify setup of PixelSiPropertiesTool and required conditions algor...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/InnerDetector/InDetConditions/SiPropertiesTool/python/PixelSiPropertiesToolSetup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CHESyrian/Syrians path: /My_Account/migrations/0004_auto_20200423_0039.py # Generated by Django 3.0.3 on 2020-04-22 21:39 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('My_Account', '0003_auto_20200423_0036'), ] operations = [ migrations...
code_fim
easy
{ "lang": "python", "repo": "CHESyrian/Syrians", "path": "/My_Account/migrations/0004_auto_20200423_0039.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('My_Account', '0003_auto_20200423_0036'), ] operations = [ migrations.AlterField( model_name='profile_model', name='Bio', field=models.TextField(default='BIO'), ), ]<|fim_...
code_fim
easy
{ "lang": "python", "repo": "CHESyrian/Syrians", "path": "/My_Account/migrations/0004_auto_20200423_0039.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('My_Account', '0003_auto_20200423_0036'), ] operations = [ migrations.AlterField( model_name='profile_model', name='Bio', field=models.TextField(default='BIO'), ), ]<|fim_prefix|># repo: CHESyrian/Syrians path:...
code_fim
easy
{ "lang": "python", "repo": "CHESyrian/Syrians", "path": "/My_Account/migrations/0004_auto_20200423_0039.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Quer-io/Quer.io path: /tests/service/test_utils.py import unittest import pandas as pd import querio.service.utils as ut from querio.service.exceptions.querio_file_error import QuerioFileError from querio.ml.model import Model class UtilstTest(unittest.TestCase): def setUp(self): a...
code_fim
hard
{ "lang": "python", "repo": "Quer-io/Quer.io", "path": "/tests/service/test_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_freq_count_for_float(self): values_list = self.data['income'].values.tolist() self.assertEqual(type(values_list[0]), float) dict = ut.get_frequency_count_int(values_list, 'income') self.assertDictEqual(dict, {'income frequencies': {int(11*301.2): 1, int(22*301....
code_fim
hard
{ "lang": "python", "repo": "Quer-io/Quer.io", "path": "/tests/service/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>on.declare(cython.int[:], a) print(ca[0])<|fim_prefix|># repo: cython/cython path: /docs/examples/tutorial/array/safe_usage.py from cython.cimports.cpython import array import array a = cython.declare(array.arr<|fim_middle|>ay, array.array('i', [1, 2, 3])) ca = cyth
code_fim
easy
{ "lang": "python", "repo": "cython/cython", "path": "/docs/examples/tutorial/array/safe_usage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cython/cython path: /docs/examples/tutorial/array/safe_usage.py from cython.cimports.cpython import array<|fim_suffix|>on.declare(cython.int[:], a) print(ca[0])<|fim_middle|> import array a = cython.declare(array.array, array.array('i', [1, 2, 3])) ca = cyth
code_fim
medium
{ "lang": "python", "repo": "cython/cython", "path": "/docs/examples/tutorial/array/safe_usage.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cudeso/tools path: /ceds.py #!/usr/bin/python # # Check Expiration Date of SSL certificates # # Koen Van Impe # # Uses the file ceds.checks as input ; one entry per line, format <host>:<port> # # ceds.checks : www.google.com:443 # imap.mydomain.tld:993 # im...
code_fim
hard
{ "lang": "python", "repo": "cudeso/tools", "path": "/ceds.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>servers_to_check = "ceds.checks" alert_days = 5 mail_rcpt = "<>" mail_from = "<>" mail_server = "127.0.0.1" socket.setdefaulttimeout(300) servers = open(servers_to_check, "r") cur_date = datetime.datetime.utcnow() response = "" cert_tested = 0 context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)...
code_fim
hard
{ "lang": "python", "repo": "cudeso/tools", "path": "/ceds.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: simplifies/Oblivion path: /Linux/schedule.py ckState.Checked' in script_c: json_f = 'PySide2.QtCore.Qt.CheckState.Checked' else: json_f = 'PySide2.QtCore.Qt.CheckState.Unchecked' if 'agenda_gerar_copia_json_ocult=PySide2.QtCore.Qt.CheckState.Checked' in script_c: json_ocult = 'PySide...
code_fim
hard
{ "lang": "python", "repo": "simplifies/Oblivion", "path": "/Linux/schedule.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> elif '00SHSTRx00' in i: i = i.replace(':00SHSTRx00', '') # Have I Been Pwned/senha if situacaoHaveIPwned == True: listaf_haveipwned = check_breach(i) for ex3 in listaf_haveipwned: if i in ex3: ...
code_fim
hard
{ "lang": "python", "repo": "simplifies/Oblivion", "path": "/Linux/schedule.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if '00EMSTRx00' in i: i = i.replace(':00EMSTRx00', '') i = str(i) if formatos_copia_dadobruto: puxar_pbdb = verificar_ultimos_pb(credencial=i, dadobruto=True, gdr=str(gdrive)) exportar_dados_pbdb.append(puxar_pbdb) el...
code_fim
hard
{ "lang": "python", "repo": "simplifies/Oblivion", "path": "/Linux/schedule.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class PraseSvnTree(ThreadFunObj): def __init__(self,tree, parentNode, url, rootParent, inFilter=None): self.tree = tree self.parentNode = parentNode self.url = url self.rootParent = rootParent self.filter = inFilter self.running_flag = False ...
code_fim
hard
{ "lang": "python", "repo": "w2h/compare", "path": "/sorttreectrl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: w2h/compare path: /sorttreectrl.py #coding=utf-8 import wx import os from pathutils import * import svn.remote as remote from threadctrl import * from event import * from data import * class TreeItemData(object): FILE = 1 DIR = 0 CONFLICT_BACK_COLOR = wx.Colour(255, 227...
code_fim
hard
{ "lang": "python", "repo": "w2h/compare", "path": "/sorttreectrl.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # 获取Item的相对路径 def _get_tree_label(self, tree, itemId): resultStr = tree.GetItemText(itemId) curItemId = itemId while (tree.GetRootItem() != curItemId): curItemId = tree.GetItemParent(curItemId) resultStr = resultStr + "/" + tree.GetItemText(c...
code_fim
hard
{ "lang": "python", "repo": "w2h/compare", "path": "/sorttreectrl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aashishyadavally/chomskIE path: /chomskIE/utils.py import subprocess from collections import Counter import spacy def retrieve_spacy_language(lang): """Retrieves trained language pipeline from within SpaCy. If not available, it is downloaded. Arguments: lang (str): ...
code_fim
hard
{ "lang": "python", "repo": "aashishyadavally/chomskIE", "path": "/chomskIE/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Based on the instantiated preprocessing steps, can be used to access sentences and their components such as tokens, named entities, parts of speech, dependency graphs, etc. within the document. Parameters: name (str): Name of .txt file. text (str): ...
code_fim
hard
{ "lang": "python", "repo": "aashishyadavally/chomskIE", "path": "/chomskIE/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Helps filter invalid sentences in document which are incomplete and do not express complete thought such as bullet points. Arguments: doc (chomskIE.utils.Document): Document. Returns: doc (chomskIE.utils.Document): Filtered document. Notes:...
code_fim
hard
{ "lang": "python", "repo": "aashishyadavally/chomskIE", "path": "/chomskIE/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }