text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def softmax_train(input_size, num_classes, lambda_, data, labels, options={'maxiter': 400, 'disp': True}): #softmaxTrain Train a softmax model with the given parameters on the given # data. Returns softmaxOptTheta, a vector containing the trained parameters # for the model. # # input_...
code_fim
hard
{ "lang": "python", "repo": "akhiyarwaladi/example_tutorial", "path": "/softmax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #softmaxTrain Train a softmax model with the given parameters on the given # data. Returns softmaxOptTheta, a vector containing the trained parameters # for the model. # # input_size: the size of an input vector x^(i) # num_classes: the number of classes # lambda_: weight decay...
code_fim
medium
{ "lang": "python", "repo": "akhiyarwaladi/example_tutorial", "path": "/softmax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: akhiyarwaladi/example_tutorial path: /softmax.py import numpy as np import scipy.sparse import scipy.optimize def softmax_cost(theta, num_classes, input_size, lambda_, data, labels): """ :param theta: :param num_classes: the number of classes :param input_size: the size N of in...
code_fim
hard
{ "lang": "python", "repo": "akhiyarwaladi/example_tutorial", "path": "/softmax.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: heshanpadmasiri/Lite-LPNet path: /show_eval.py from pathlib import Path import argparse import joblib saved_model_path = Path('./saved_models') bbox_path = saved_model_path/'simple_bbox' lp_path = saved_model_path/'lp_seperate' def __get_pickle_files__(base_path:Path): return [each for each...
code_fim
medium
{ "lang": "python", "repo": "heshanpadmasiri/Lite-LPNet", "path": "/show_eval.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": parser = argparse.ArgumentParser(description="train bbox model") parser.add_argument('stage', type=int, help='stage to show eval results') args = parser.parse_args() stage = args.stage if stage == 1: eval_results = get_eval_files(bbox_path) pr...
code_fim
hard
{ "lang": "python", "repo": "heshanpadmasiri/Lite-LPNet", "path": "/show_eval.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 17605272633/ManyBeautifulMall path: /ManyBeautiful/ManyBeautifulMall/apps/carts/serializers.py from rest_framework import serializers from goods.models import SKU # 购物车数据添加序列化器 class AddCartSerializer(serializers.Serializer): """购物车数据添加序列化器""" # 定义属性 sku_id = serializers.IntegerFi...
code_fim
hard
{ "lang": "python", "repo": "17605272633/ManyBeautifulMall", "path": "/ManyBeautiful/ManyBeautifulMall/apps/carts/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 获取商品信息,验证商品是否存在 try: sku = SKU.objects.get(id=value) except SKU.DoesNotExist: raise serializers.ValidationError('商品不存在') return value # 购物车数据全选序列化器 class SelectAllCartSerializer(serializers.Serializer): """购物车数据全选序列化器""" selected = seria...
code_fim
hard
{ "lang": "python", "repo": "17605272633/ManyBeautifulMall", "path": "/ManyBeautiful/ManyBeautifulMall/apps/carts/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PHOENIX26012000/dcase2018_task4 path: /utils/utilities.py import os import numpy as np import soundfile import librosa from sklearn import metrics import logging import matplotlib.pyplot as plt import matplotlib.ticker as ticker import pandas as pd import sed_eval import torch from torch.autogra...
code_fim
hard
{ "lang": "python", "repo": "PHOENIX26012000/dcase2018_task4", "path": "/utils/utilities.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ix_to_lb = config.ix_to_lb estimated_event_list = [] for (n, audio_name) in enumerate(audio_names): for event_index in predictions[n]: bgn_fin_pairs = activity_detection( frame_wise_probs[n, :, event_index], thres=sed_thres, ...
code_fim
hard
{ "lang": "python", "repo": "PHOENIX26012000/dcase2018_task4", "path": "/utils/utilities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Calculate sed_eval event based metric for challenge Parameters ---------- reference_event_list : MetaDataContainer, list of referenced events estimated_event_list : MetaDataContainer, list of estimated events Return ------ event_based_metric ...
code_fim
hard
{ "lang": "python", "repo": "PHOENIX26012000/dcase2018_task4", "path": "/utils/utilities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: catboost/catboost path: /contrib/python/prompt-toolkit/py3/tests/test_formatted_text.py from __future__ import annotations from prompt_toolkit.formatted_text import ( ANSI, HTML, FormattedText, PygmentsTokens, Template, merge_formatted_text, to_formatted_text, ) from ...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/prompt-toolkit/py3/tests/test_formatted_text.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert lines == [ [("class:a", "line1")], [("class:a", "line2")], [("class:a", "line3")], ] def test_split_lines_2(): lines = list( split_lines([("class:a", "line1"), ("class:b", "line2\nline3\nline4")]) ) assert lines == [ [("class:a", "line1...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/prompt-toolkit/py3/tests/test_formatted_text.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hanzckernel/opricer path: /Utils/apps/options.py emoization of scraping data cache = Cache(app.server, config={ 'CACHE_TYPE': 'filesystem', 'CACHE_DIR': 'cache' }) def func_check(string): pass def parse_table(tag): page = requests.get(f"https://www.global-rates.com/intere...
code_fim
hard
{ "lang": "python", "repo": "hanzckernel/opricer", "path": "/Utils/apps/options.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>@app.callback( [Output("option_modal_close", 'n_clicks'), Output('missing_warning', 'children'), Output('missing_warning', 'style'), Output('asset_info', 'data'), Output('clear_all', 'value')], [Input("submit_new_option", "n_clicks"), Input('option-clear', 'n_clicks')], [State('asset_n...
code_fim
hard
{ "lang": "python", "repo": "hanzckernel/opricer", "path": "/Utils/apps/options.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> dcc.ConfirmDialog(id='true-confirm'), ], className='col s12 center-align'), html.Div([ dcc.Input(id='strike', type='number', step=0.001, min = 0.01, className='validate', style={"color":"white"}), html.Label("...
code_fim
hard
{ "lang": "python", "repo": "hanzckernel/opricer", "path": "/Utils/apps/options.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: ianbialo/Cryptography path: /app/keys_generator/prime.py from os import path import random from app.keys_generator.xorshift import XORShift from app.utils.file_manager import read_file, write_file from app.utils.modular_arithmetic import square_and_multiply def _generate_possible_prime(n_bits: ...
code_fim
hard
{ "lang": "python", "repo": "ianbialo/Cryptography", "path": "/app/keys_generator/prime.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, prime_path: path, n_bits: int = 512, with_generator: bool = True): self.__generator = 0 if path.exists(prime_path): # Load existing prime prime_lines = read_file(prime_path).splitlines() self.__prime = int(prime_lines[0]) ...
code_fim
hard
{ "lang": "python", "repo": "ianbialo/Cryptography", "path": "/app/keys_generator/prime.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hemu243/focus-web-crawler path: /focused_scrapy_crawler/spiders/newhouse.py # -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from focused_scrapy_crawler.items import FocusedScrapyCrawlerItem import time import loggi...
code_fim
hard
{ "lang": "python", "repo": "hemu243/focus-web-crawler", "path": "/focused_scrapy_crawler/spiders/newhouse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Get anchor tags for whole page :param response: response object instance :param soup: beautiful soup instance :return: list of urls """ links = [] for anchor in soup.find_all('a'): href = anchor.get('href') # Conve...
code_fim
hard
{ "lang": "python", "repo": "hemu243/focus-web-crawler", "path": "/focused_scrapy_crawler/spiders/newhouse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewp-as-is/django-command-debug.py path: /setup.py from setuptools import setup setup( name='django-command-debug', ver<|fim_suffix|>go_command_debug.admin', 'django_command_debug.management', 'django_command_debug.migrations', 'django_command_debug.models' ...
code_fim
medium
{ "lang": "python", "repo": "andrewp-as-is/django-command-debug.py", "path": "/setup.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>jango_command_debug.migrations', 'django_command_debug.models' ] )<|fim_prefix|># repo: andrewp-as-is/django-command-debug.py path: /setup.py from setuptools import setup setup( name='django-command-debug', ver<|fim_middle|>sion='2021.8.20', packages=[ 'django_command_deb...
code_fim
medium
{ "lang": "python", "repo": "andrewp-as-is/django-command-debug.py", "path": "/setup.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>go_command_debug.admin', 'django_command_debug.management', 'django_command_debug.migrations', 'django_command_debug.models' ] )<|fim_prefix|># repo: andrewp-as-is/django-command-debug.py path: /setup.py from setuptools import setup setup( name='django-command-debug', ...
code_fim
medium
{ "lang": "python", "repo": "andrewp-as-is/django-command-debug.py", "path": "/setup.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> result = service.list_concepts('entity') test_case.assertEqual([conceptA], result) result = service.list_concepts('abuse') test_case.assertEqual([conceptB], result) def list_taxonomies(test_case): result = service.list_taxonomies() test_case.assertEqual(taxonomies, result)<|fim_p...
code_fim
hard
{ "lang": "python", "repo": "bitWeaver-arch/graphsense-REST", "path": "/gsrest/test/tags_service.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bitWeaver-arch/graphsense-REST path: /gsrest/test/tags_service.py from openapi_server.models.address_tag import AddressTag from openapi_server.models.entity_tag import EntityTag from openapi_server.models.tags import Tags from openapi_server.models.taxonomy import Taxonomy from openapi_server.mod...
code_fim
hard
{ "lang": "python", "repo": "bitWeaver-arch/graphsense-REST", "path": "/gsrest/test/tags_service.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: popey0/2020-Tutorials path: /Week 4/solution.py # -*- coding: utf-8 -*- """ Week 4 ICT Session """ import numpy as np from scipy import fft # Import the module, NOT the function import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter, MultipleLocator def mapping(x, xp, fp)...
code_fim
hard
{ "lang": "python", "repo": "popey0/2020-Tutorials", "path": "/Week 4/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> The given function is approximated using a discrete sine transform over the `fit` domain. The result is then shown over a domain of [-2pi, +2pi], using the `plot` number of terms. Parameters ---------- func : callable A single parameter function to be fit fit : tuple, ...
code_fim
hard
{ "lang": "python", "repo": "popey0/2020-Tutorials", "path": "/Week 4/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def check_reply_already_exists(session, reply: models.Reply): reply_class = models.Reply try: session.query(reply_class).filter(reply_class.rpid == reply.rpid).one() return True except NoResultFound: return False except MultipleResultsFound: return True<|fi...
code_fim
hard
{ "lang": "python", "repo": "michaelfyc/ASoulCnki", "path": "/app/spider/reply/reply_spider.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: michaelfyc/ASoulCnki path: /app/spider/reply/reply_spider.py import app.models as models from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound from app import utils from app.config import sqla from app.lib import send_mail from app.utils import Throttle throttle = Throttle(2) def...
code_fim
hard
{ "lang": "python", "repo": "michaelfyc/ASoulCnki", "path": "/app/spider/reply/reply_spider.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return datetime.fromtimestamp(float(bb_server_timestamp_str) / 1000).replace(tzinfo=pytz.utc) def _normalize_user(user): if not user: return None return { 'id': user.get('id', ''), 'login': user.get('name', ''), 'name': user.get('displayName', ''), 'e...
code_fim
hard
{ "lang": "python", "repo": "Jellyfish-AI/jf_agent", "path": "/jf_agent/git/bitbucket_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jellyfish-AI/jf_agent path: /jf_agent/git/bitbucket_server.py import RetryError, ChunkedEncodingError from urllib3.exceptions import MaxRetryError from jf_agent.git import pull_since_date_for_repo from jf_agent.git.utils import get_matching_branches from jf_agent.name_redactor import NameRedactor...
code_fim
hard
{ "lang": "python", "repo": "Jellyfish-AI/jf_agent", "path": "/jf_agent/git/bitbucket_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jellyfish-AI/jf_agent path: /jf_agent/git/bitbucket_server.py config.git_redact_names_and_urls, config.git_verbose, ), item_id_dict_key='hash', ) download_and_write_commits() @diagnostics.capture_timing() @agent_logging.l...
code_fim
hard
{ "lang": "python", "repo": "Jellyfish-AI/jf_agent", "path": "/jf_agent/git/bitbucket_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.plot_surface(s.param[0], s.param[1], s.calculate_gauss_curvature()) plt.xlabel('u') plt.ylabel('v') ax.set_zlabel('K') plt.title('Gauss curvature') plt.show()<|fim_prefix|># repo: yellowshippo/geomulator path: /demo_surface.py import numpy ...
code_fim
hard
{ "lang": "python", "repo": "yellowshippo/geomulator", "path": "/demo_surface.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Shere - {one_point} surface = np.array([ 2 * u, 2 * v, 1 - u**2 - v**2 ]) / (1 + u**2 + v**2) return (surface[0], surface[1], surface[2]) # Generate surface object s = Surface.generate_surface( calc_surface, u_param=(-10., 10., .01), v_param=(-10., 10., .01)...
code_fim
medium
{ "lang": "python", "repo": "yellowshippo/geomulator", "path": "/demo_surface.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yellowshippo/geomulator path: /demo_surface.py import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from geomulator.surface import Surface def calc_surface(u, v): """Calculate surface according to your definition.""" # # Wavy surface # surface...
code_fim
hard
{ "lang": "python", "repo": "yellowshippo/geomulator", "path": "/demo_surface.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>type(np.random.uniform(0, 10, size=(50,)))) print(type(np.random.uniform(0, 10, size=50)))<|fim_prefix|># repo: Judithle98/BachelorThesis path: /test.py import BNQD import gpflow as gpf import numpy as np import util import matplotlib.pyplot a<|fim_middle|>s plt xs, ys = util.linear_dummy_data() cm = BN...
code_fim
medium
{ "lang": "python", "repo": "Judithle98/BachelorThesis", "path": "/test.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Judithle98/BachelorThesis path: /test.py import BNQD import gpflow as gpf import numpy as np import util import matplotlib.pyplot a<|fim_suffix|>type(np.random.uniform(0, 10, size=(50,)))) print(type(np.random.uniform(0, 10, size=50)))<|fim_middle|>s plt xs, ys = util.linear_dummy_data() cm = BN...
code_fim
medium
{ "lang": "python", "repo": "Judithle98/BachelorThesis", "path": "/test.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> slide_masters = context.slide_masters idx = -1 for idx, slide_master in enumerate(slide_masters): assert type(slide_master).__name__ == 'SlideMaster' assert idx == 1 @then('iterating slides produces 3 Slide objects') def then_iterating_slides_produces_3_Slide_objects(context): ...
code_fim
hard
{ "lang": "python", "repo": "dimensions11/python-pptx", "path": "/features/steps/slide.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dimensions11/python-pptx path: /features/steps/slide.py # encoding: utf-8 """Gherkin step implementations for slide-related features.""" from __future__ import ( absolute_import, division, print_function, unicode_literals ) from behave import given, when, then from pptx import Presentatio...
code_fim
hard
{ "lang": "python", "repo": "dimensions11/python-pptx", "path": "/features/steps/slide.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pdghawk/adfraud path: /adfraud/models.py """ Module for ML models """ import numpy as np from sklearn.model_selection import GridSearchCV from sklearn.model_selection import StratifiedShuffleSplit from sklearn.ensemble import RandomForestClassifier from sklearn import metrics from sklearn.metric...
code_fim
hard
{ "lang": "python", "repo": "pdghawk/adfraud", "path": "/adfraud/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ fit the model """ self.model.fit(x_train[self.feats],y_train) def train_CV(self,x_train,y_train,param_grid,n_splits=5): """ train the model with Criss Validation Performs a stratified split of the training data into train and validation partitions (keeping...
code_fim
hard
{ "lang": "python", "repo": "pdghawk/adfraud", "path": "/adfraud/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: majidaldo/yaml_query path: /yaml_query/dict2table.py """ handles nested (1-level) dictionary data (like in the yaml file). """ item_column = 'ITEM_ID' # special def iter_rows(item_dict,columns): """ Iterate through the {'item':{'attrib':'value'}} items as rows in a table. Values f...
code_fim
medium
{ "lang": "python", "repo": "majidaldo/yaml_query", "path": "/yaml_query/dict2table.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def dict2table(*args,**kwargs): return iter_rows(*args,**kwargs) def get_fields(item_dict): d = item_dict fields=set() for item in d: for afield in d[item]: fields.add(afield) return fields<|fim_prefix|># repo: majidaldo/yaml_query path: /yaml_query/dict2table.py ...
code_fim
hard
{ "lang": "python", "repo": "majidaldo/yaml_query", "path": "/yaml_query/dict2table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: allenai/allennlp-models path: /allennlp_models/vision/dataset_readers/vision_reader.py heck_for_gpu, ConfigurationError from allennlp.common.lazy import Lazy from allennlp.common.util import int_to_device from allennlp.common.file_utils import TensorCache from allennlp.data.dataset_readers.datase...
code_fim
hard
{ "lang": "python", "repo": "allenai/allennlp-models", "path": "/allennlp_models/vision/dataset_readers/vision_reader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # store the processed results in memory, so we can complete the batch paths_to_tensors = {} for i, path in enumerate(paths): if class_probs: class_probs_tensor = class_probs[i] else: class_probs_ten...
code_fim
hard
{ "lang": "python", "repo": "allenai/allennlp-models", "path": "/allennlp_models/vision/dataset_readers/vision_reader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: allenai/allennlp-models path: /allennlp_models/vision/dataset_readers/vision_reader.py ta.dataset_readers.dataset_reader import DatasetReader from allennlp.data.image_loader import ImageLoader from allennlp.data.token_indexers import PretrainedTransformerIndexer from allennlp.data.token_indexers ...
code_fim
hard
{ "lang": "python", "repo": "allenai/allennlp-models", "path": "/allennlp_models/vision/dataset_readers/vision_reader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> es = Elasticsearch( [ELASTICSEARCH_HOST], scheme=ELASTICSEARCH_SCHEME, port=ELASTICSEARCH_PORT ) try: generate_logs(LOG_DIR, es) except Exception as e: print('Unexpected exception in execute: {}'.format(str(e))) return ###########################################################...
code_fim
hard
{ "lang": "python", "repo": "exNewbie/cloudtrail-2-ek", "path": "/python-import/import.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: exNewbie/cloudtrail-2-ek path: /python-import/import.py #!/usr/local/bin/python import gzip import sys import os import json import datetime from datetime import datetime from elasticsearch import Elasticsearch from datetime import datetime LOG_DIR = '/mnt' ELASTICSEARCH_HOST = 'elasticsearch' ...
code_fim
hard
{ "lang": "python", "repo": "exNewbie/cloudtrail-2-ek", "path": "/python-import/import.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DecentMark/decentmark path: /demo/student_demo.py from selenium import webdriver from selenium.webdriver.common.keys import Keys <|fim_suffix|>ass_name = "assignment 123" driver.find_element_by_link_text(ass_name).click() driver.find_element_by_link_text("Make a submission").click() solution = ...
code_fim
hard
{ "lang": "python", "repo": "DecentMark/decentmark", "path": "/demo/student_demo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ass_name = "assignment 123" driver.find_element_by_link_text(ass_name).click() driver.find_element_by_link_text("Make a submission").click() solution = "solution 123" driver.find_element_by_id("id_solution").send_keys(solution) driver.find_element_by_xpath("//button").click()<|fim_prefix|># repo: DecentM...
code_fim
hard
{ "lang": "python", "repo": "DecentMark/decentmark", "path": "/demo/student_demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: easyCZ/UoE-Projects path: /EXC/CW1/task8/combiner.py #!/usr/bin/python import sys from ast import literal_eval MARK_SHORT = 'M' last_sid = None marks = [] # Input is sorted by <id> and secondarily by S|M in reverse # so that Student name comes before the marks fot that student # Expected input...
code_fim
hard
{ "lang": "python", "repo": "easyCZ/UoE-Projects", "path": "/EXC/CW1/task8/combiner.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Expected output: # 1 S George # 1 M [('TTS', 80), ('EXC', 70), ('ADBS', 80)] # 2 S Anna # 2 M [('EXC', 65)]<|fim_prefix|># repo: easyCZ/UoE-Projects path: /EXC/CW1/task8/combiner.py #!/usr/bin/python import sys from ast import literal_eval MARK_SHORT = 'M' last_sid = None marks = [] ...
code_fim
hard
{ "lang": "python", "repo": "easyCZ/UoE-Projects", "path": "/EXC/CW1/task8/combiner.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: 515hikaru/essence-of-machine-learning path: /tests/test_softplus.py import numpy as np import pytest from numeric_calc.range_value import softplus def test_softplus_value1(): """ np.exp がオーバーフローしない範囲での計算 log(1+e^{-1}) の計算 """ y = softplus.softplus(-1) assert isinstance...
code_fim
hard
{ "lang": "python", "repo": "515hikaru/essence-of-machine-learning", "path": "/tests/test_softplus.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ np.exp をそのまま計算するとオーバーフローする場合 対策済みなのでこのテストではオーバーフローせず成功する """ y = softplus.softplus2(1000) assert y < 10 ** 4<|fim_prefix|># repo: 515hikaru/essence-of-machine-learning path: /tests/test_softplus.py import numpy as np import pytest from numeric_calc.range_value import sof...
code_fim
medium
{ "lang": "python", "repo": "515hikaru/essence-of-machine-learning", "path": "/tests/test_softplus.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sumitnagal/test-tools path: /chaostoolkit/data/utils.py import json import subprocess import sys import os import time import requests import logging import threading from jinja2 import Environment, FileSystemLoader, select_autoescape import yaml logger = logging.getLogger(__name__) <|fim_suffi...
code_fim
hard
{ "lang": "python", "repo": "sumitnagal/test-tools", "path": "/chaostoolkit/data/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> env_tmpl = Environment(loader = FileSystemLoader('./'), trim_blocks=True, lstrip_blocks=True, autoescape=select_autoescape(['yaml'])) template = env_tmpl.get_template('chaos-result.j2') updated_chaosresult_template = template.render(c_experiment=exp_name, phase=exp_phase, verdict=e...
code_fim
hard
{ "lang": "python", "repo": "sumitnagal/test-tools", "path": "/chaostoolkit/data/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ chaos_result_tracker() creates/patches the litmus chaosresult custom resource in the provided namespace. Typically invoked before and after chaos, and takes the .spec.phase, .spec.verdict & namespace as as args. """ def chaos_result_tracker(self, exp_name, exp_phase, exp_verdict, n...
code_fim
hard
{ "lang": "python", "repo": "sumitnagal/test-tools", "path": "/chaostoolkit/data/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class SharedPrivateLinkResourceStatus(str, Enum): """ Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. """ PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" class SkuName(str, Enum): ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/search/v20220901/_enums.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The larg...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/search/v20220901/_enums.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-azure-native path: /sdk/python/pulumi_azure_native/search/v20220901/_enums.py # coding=utf-8 # *** WARNING: this file was generated by pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** from enum import Enum __all__ = [ 'AadAuthFailure...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/search/v20220901/_enums.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print("Inner: ", inner, flush=True) await inner print("Task 1 End", flush=True) @spawn(outer[1], dependencies=[outer[0]]) async def task3(): print("Task 3", flush=True) print("Inner: ", inner, flush=True) print("Outer: ", o...
code_fim
hard
{ "lang": "python", "repo": "ut-parla/Parla.py", "path": "/tutorial/3_devices_and_architectures/async_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ut-parla/Parla.py path: /tutorial/3_devices_and_architectures/async_test.py import numpy from parla import Parla from parla.array import copy, clone_here from parla.cpu import cpu from parla.tasks import spawn from parla.task_collections import TaskSpace from parla.function_decorators import spec...
code_fim
medium
{ "lang": "python", "repo": "ut-parla/Parla.py", "path": "/tutorial/3_devices_and_architectures/async_test.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jinhao27/w3hacks path: /main/migrations/0001_initial.py # Generated by Django 3.0.4 on 2020-04-07 05:22 import datetime from django.conf import settings import django.contrib.postgres.fields from django.db import migrations, models import django.db.models.deletion import main.models class Migr...
code_fim
hard
{ "lang": "python", "repo": "jinhao27/w3hacks", "path": "/main/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name='ScheduleEvent', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=50)), ('description', models.TextField(max_length=300)), ('ev...
code_fim
hard
{ "lang": "python", "repo": "jinhao27/w3hacks", "path": "/main/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: christina-aigner/midnite path: /src/midnite/uncertainty/modules.py """Custom modules for MC dropout ensembles and uncertainty.""" import logging from abc import ABC from abc import abstractmethod from typing import Tuple from typing import Union import torch import tqdm from torch import Tensor ...
code_fim
hard
{ "lang": "python", "repo": "christina-aigner/midnite", "path": "/src/midnite/uncertainty/modules.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ def measure_uncertainty(self, input_: Tensor) -> Tensor: return func.variation_ratio(input_, inplace=not input_.requires_grad) class PredictionAndUncertainties(Acquisition): """Module to conveniently calculate sampled mean and uncertainties.""" def measure_uncertainty(self,...
code_fim
hard
{ "lang": "python", "repo": "christina-aigner/midnite", "path": "/src/midnite/uncertainty/modules.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kotaimen/awscfncli path: /awscfncli2/__main__.py """Main cli entry point, called when run as a package.""" <|fim_suffix|>from .cli.main import cli def main(): """CLI Entry point when run as module""" cli( auto_envvar_prefix='CFN', prog_name='cfn-cli' ) if __name__...
code_fim
easy
{ "lang": "python", "repo": "Kotaimen/awscfncli", "path": "/awscfncli2/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': main()<|fim_prefix|># repo: Kotaimen/awscfncli path: /awscfncli2/__main__.py """Main cli entry point, called when run as a package.""" __author__ = 'kotaimen' __date__ = '28-Feb-2018' from .cli.main import cli <|fim_middle|> def main(): """CLI Entry point when run as...
code_fim
medium
{ "lang": "python", "repo": "Kotaimen/awscfncli", "path": "/awscfncli2/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': main()<|fim_prefix|># repo: Kotaimen/awscfncli path: /awscfncli2/__main__.py """Main cli entry point, called when run as a package.""" __author__ = 'kotaimen' __date__ = '28-Feb-2018' from .cli.main import cli <|fim_middle|>def main(): """CLI Entry point when run a...
code_fim
medium
{ "lang": "python", "repo": "Kotaimen/awscfncli", "path": "/awscfncli2/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Close observation table row_to_close = observation_table.get_row_to_close() while row_to_close is not None: # First we add new rows to the extended S set. They are added based on the values in the cells of the # rows that is to be closed. Once those rows a...
code_fim
hard
{ "lang": "python", "repo": "Holly-Jiang/AALpy", "path": "/aalpy/learning_algs/non_deterministic/OnfsmLstar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Holly-Jiang/AALpy path: /aalpy/learning_algs/non_deterministic/OnfsmLstar.py import time from aalpy.base import SUL, Oracle from aalpy.learning_algs.non_deterministic.OnfsmObservationTable import NonDetObservationTable from aalpy.learning_algs.non_deterministic.TraceTree import SULWrapper from a...
code_fim
hard
{ "lang": "python", "repo": "Holly-Jiang/AALpy", "path": "/aalpy/learning_algs/non_deterministic/OnfsmLstar.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if print_level == 3: print_observation_table(observation_table, 'non-det') # Find counterexample eq_query_start = time.time() cex = eq_oracle.find_cex(hypothesis) eq_query_time += time.time() - eq_query_start # If no counterexample is found, re...
code_fim
hard
{ "lang": "python", "repo": "Holly-Jiang/AALpy", "path": "/aalpy/learning_algs/non_deterministic/OnfsmLstar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return '\n'.join(rows) def partition(data, indecies): """partitions the data into a list split at every index in indecies""" splitdata = [data[:indecies[0]]] splitdata += [data[indecies[i-1]:indecies[i]] for i in range(1,len(indecies))] splitdata.append(data[indecies[-1]:]) return splitdata def ...
code_fim
hard
{ "lang": "python", "repo": "rootfoo/libctf", "path": "/libctf/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rootfoo/libctf path: /libctf/data.py import struct import string def pack64(num): """struct.pack 64-bit int""" return struct.pack('<Q', num) if (num > 0) else struct.pack('<q', num) def pack32(num): """struct.pack 32-bit int""" return struct.pack('<I', num) if (num > 0) else struct.pack('<...
code_fim
hard
{ "lang": "python", "repo": "rootfoo/libctf", "path": "/libctf/data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rows = [] # row length includes 2 chars for hex and 1 for spaces rowlen = columns*(2*blocksize+1) # printable chars, in this context, dont include whitespace printable = string.digits + string.letters + string.punctuation for i in range(0, row_count): start = i*columns ascii_string = '' row...
code_fim
hard
{ "lang": "python", "repo": "rootfoo/libctf", "path": "/libctf/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Mostrando os valores de cada variavel, o numero de vez que ela aparece print(df['Cabin'].value_counts())<|fim_prefix|># repo: ronaldogomes96/Acelera-Dev-DataScience path: /Modulo 2/imputacaoDeDados.py import pandas as pd import numpy as np df = pd.read_csv('train.csv') <|fim_middle|>#Criando um data ...
code_fim
hard
{ "lang": "python", "repo": "ronaldogomes96/Acelera-Dev-DataScience", "path": "/Modulo 2/imputacaoDeDados.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ronaldogomes96/Acelera-Dev-DataScience path: /Modulo 2/imputacaoDeDados.py import pandas as pd import numpy as np df = pd.read_csv('train.csv') #Criando um data frame auxiliar aux = pd.DataFrame( { 'colunas': df.columns, 'tipos': df.dtypes, 'percentu...
code_fim
medium
{ "lang": "python", "repo": "ronaldogomes96/Acelera-Dev-DataScience", "path": "/Modulo 2/imputacaoDeDados.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Tratando dados categoricos faltantes, Unknown ou moda, ou apaga mesmo df['Cabin'] = df['Cabin'].fillna('Unknown') #Mostrando os valores de cada variavel, o numero de vez que ela aparece print(df['Cabin'].value_counts())<|fim_prefix|># repo: ronaldogomes96/Acelera-Dev-DataScience path: /Modulo 2/imputac...
code_fim
hard
{ "lang": "python", "repo": "ronaldogomes96/Acelera-Dev-DataScience", "path": "/Modulo 2/imputacaoDeDados.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/lua-luaposix/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) <|fim_suffix|...
code_fim
medium
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/lua-luaposix/package.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class LuaLuaposix(LuaPackage): """Lua posix bindings, including ncurses""" homepage = "https://github.com/luaposix/luaposix/" url = "https://github.com/luaposix/luaposix/archive/release-v33.4.0.tar.gz" version( "35.0", sha256="a4edf2f715feff65acb009e8d1689e57ec665eb79bc36...
code_fim
medium
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/lua-luaposix/package.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: texuf/pymonster path: /pymonster/__init__.py from datetime import datetime, timedelta ''' #Event Example: from pymonster import EventBase class Event(EventBase): def log(self, msg): print '[CustomEventLogger][%s] %s' % (self.collection_name,msg) EventBase.log(self, msg) #Con...
code_fim
hard
{ "lang": "python", "repo": "texuf/pymonster", "path": "/pymonster/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def log(self, msg): if verbose: logger( '[Event][%s] %s' % (self.collection_name,msg) ) db[self.collection_name].insert( { '_id':counter.get_next(self.collection_name) , 'createdAt':datetime.now() , 'msg':msg ...
code_fim
hard
{ "lang": "python", "repo": "texuf/pymonster", "path": "/pymonster/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if verbose: logger( '[Event][%s] %s' % (self.collection_name,msg) ) db[self.collection_name].insert( { '_id':counter.get_next(self.collection_name) , 'createdAt':datetime.now() , 'msg':msg , 'co...
code_fim
hard
{ "lang": "python", "repo": "texuf/pymonster", "path": "/pymonster/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': cache = WechatCache() import requests r = requests.session() print(cache.set('1', r)) print(cache.get('1'), type(cache.get('1')))<|fim_prefix|># repo: YongLuoCode/WechatSogou path: /wechatsogou/filecache.py # -*- coding: utf-8 -*- from werkzeug.contrib.cac...
code_fim
hard
{ "lang": "python", "repo": "YongLuoCode/WechatSogou", "path": "/wechatsogou/filecache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YongLuoCode/WechatSogou path: /wechatsogou/filecache.py # -*- coding: utf-8 -*- from werkzeug.contrib.cache import FileSystemCache class WechatCache(object): """基于文件的缓存 """ def __init__(self, cache_dir='cache', default_timeout=300): """初始化 cache_dir是缓存目录 ...
code_fim
hard
{ "lang": "python", "repo": "YongLuoCode/WechatSogou", "path": "/wechatsogou/filecache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def clear(self): """清空缓存 """ return self.cache.clear() def get(self, key): """获取缓存 获取键值key的缓存值 如果没有对应缓存,返回None """ return self.cache.get(key) def add(self, key, value, timeout=None): """增加缓存 如果键值key对应的缓存不存在,那么增...
code_fim
medium
{ "lang": "python", "repo": "YongLuoCode/WechatSogou", "path": "/wechatsogou/filecache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/DOCS-BPI-MIB.py on(SingleValueConstraint(1, 2, 4))).clone(namedValues=NamedValues(("none", 1), ("unknown", 2), ("unauthorizedSid", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: docsBpiCmTEKKeyRejectErrorCode.setStatus('current') docsBpiCmTEKK...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/DOCS-BPI-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/DOCS-BPI-MIB.py current') docsBpiCmAuthExpires = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 127, 5, 1, 1, 1, 1, 5), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: docsBpiCmAuthExpires.setStatus('current') docsBpiCmAuthReset = MibTableColum...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/DOCS-BPI-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ueRangeConstraint(1, 6048000))).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: docsBpiCmtsDefaultAuthLifetime.setStatus('current') docsBpiCmtsDefaultTEKLifetime = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 127, 5, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 6...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/DOCS-BPI-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> == "": break input1.append(x) table = tt.make_table(input1) tt.print_table(table) tt.table_to_csv(path,table)<|fim_prefix|># repo: jacklin1218/boolean-algebra-to-truth-table path: /hand_input.py import csv import sys import truth_table as tt path = "table<|fim_middle|>.csv" input1 = [] x = ...
code_fim
medium
{ "lang": "python", "repo": "jacklin1218/boolean-algebra-to-truth-table", "path": "/hand_input.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jacklin1218/boolean-algebra-to-truth-table path: /hand_input.py import csv import sys import truth_table as tt path = "table.csv" input1 = [] x = "" while True: x = input() if x<|fim_suffix|>ble(input1) tt.print_table(table) tt.table_to_csv(path,table)<|fim_middle|> == "": break ...
code_fim
medium
{ "lang": "python", "repo": "jacklin1218/boolean-algebra-to-truth-table", "path": "/hand_input.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bigquery(config, { 'description':'', 'hour':[ 8 ], 'auth':auth_write, 'from':{ 'legacy':False, 'query':''' WITH profile_counts AS ( SELECT userRoleId, COUNT(profileId) as profile_count FROM `{dataset}.CM_Profiles` GROUP BY 1 ), permission_fingerprints AS ( SELEC...
code_fim
hard
{ "lang": "python", "repo": "google/starthinker", "path": "/examples/barnacle_example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: google/starthinker path: /examples/barnacle_example.py th the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS...
code_fim
hard
{ "lang": "python", "repo": "google/starthinker", "path": "/examples/barnacle_example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: google/starthinker path: /examples/barnacle_example.py RRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ########################################################################...
code_fim
hard
{ "lang": "python", "repo": "google/starthinker", "path": "/examples/barnacle_example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: busybox11/Discorn path: /tests/test_blockchain.py import blockchain def test_Signature(): sk1 = blockchain.SK() sk2 = blockchain.SK() signature = blockchain.Signature.from_raw(sk1.sign(b"This is a test.").raw) wrong_sig = blockchain.Signature(signature<|fim_suffix|>a test") ...
code_fim
medium
{ "lang": "python", "repo": "busybox11/Discorn", "path": "/tests/test_blockchain.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.signature, sk2.vk) assert signature.verify(b"This is a test.") assert not signature.verify(b"This is a test") assert not wrong_sig.verify(b"This is a test.") assert not wrong_sig.verify(b"This is a test")<|fim_prefix|># repo: busybox11/Discorn path: /tests/test_blockchain.py import block...
code_fim
medium
{ "lang": "python", "repo": "busybox11/Discorn", "path": "/tests/test_blockchain.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ("nautobot_golden_config", "0004_auto_20210616_2234"), ] operations = [ migrations.RunPython(code=jsonify), migrations.AlterField( model_name="compliancerule", name="match_config", field=models.TextField(blank=True, ...
code_fim
hard
{ "lang": "python", "repo": "nniehoff/nautobot-plugin-golden-config", "path": "/nautobot_golden_config/migrations/0005_json_compliance_rule.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nniehoff/nautobot-plugin-golden-config path: /nautobot_golden_config/migrations/0005_json_compliance_rule.py from django.db import migrations, models import json from nautobot_golden_config.models import ConfigCompliance def jsonify(apps, schedma_editor): """Converts textfield to json in p...
code_fim
hard
{ "lang": "python", "repo": "nniehoff/nautobot-plugin-golden-config", "path": "/nautobot_golden_config/migrations/0005_json_compliance_rule.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MrZhihao/CDatabass path: /databass/ops/limit.py from ..baseops import * from ..exprs import * from ..db import Database from ..schema import * from ..tuples import * from ..util import cache, OBTuple from itertools import chain from ..columns import ListColumns from pyarrow import compute class ...
code_fim
medium
{ "lang": "python", "repo": "MrZhihao/CDatabass", "path": "/databass/ops/limit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_col_up_needed(self, info=None): return self.p.get_col_up_needed() def hand_in_result(self): handin_res = self.c.hand_in_result() if handin_res.is_terminate() or self._limit == 0: return ListColumns(self.schema, None) return ListColumns(self.schema, [col.slice(offset=self...
code_fim
hard
{ "lang": "python", "repo": "MrZhihao/CDatabass", "path": "/databass/ops/limit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.p.get_col_up_needed() def hand_in_result(self): handin_res = self.c.hand_in_result() if handin_res.is_terminate() or self._limit == 0: return ListColumns(self.schema, None) return ListColumns(self.schema, [col.slice(offset=self._offset,length=self._limit) for col in ha...
code_fim
hard
{ "lang": "python", "repo": "MrZhihao/CDatabass", "path": "/databass/ops/limit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }