text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: gvx/generate-html path: /tests/test_comments.py from generate_html import comment, fragment, render_html, tag from typing import Iterator <|fim_suffix|> assert render_html(simple_comment()) == '<!-- hi -->' def test_comment_doesnt_escape() -> None: assert render_html(comment_doesnt_esc...
code_fim
hard
{ "lang": "python", "repo": "gvx/generate-html", "path": "/tests/test_comments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @keyword def foo(self): self.info('foo') @keyword def bar(self, arg): self.info(arg)<|fim_prefix|># repo: HelioGuilherme66/robotframework-seleniumlibrary path: /utest/test/api/my_lib.py from SeleniumLibrary.base import LibraryComponent, keyword <|fim_middle|>class my_li...
code_fim
easy
{ "lang": "python", "repo": "HelioGuilherme66/robotframework-seleniumlibrary", "path": "/utest/test/api/my_lib.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HelioGuilherme66/robotframework-seleniumlibrary path: /utest/test/api/my_lib.py from SeleniumLibrary.base import LibraryComponent, keyword <|fim_suffix|> @keyword def foo(self): self.info('foo') @keyword def bar(self, arg): self.info(arg)<|fim_middle|> class my_l...
code_fim
easy
{ "lang": "python", "repo": "HelioGuilherme66/robotframework-seleniumlibrary", "path": "/utest/test/api/my_lib.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.info(arg)<|fim_prefix|># repo: HelioGuilherme66/robotframework-seleniumlibrary path: /utest/test/api/my_lib.py from SeleniumLibrary.base import LibraryComponent, keyword <|fim_middle|> class my_lib(LibraryComponent): @keyword def foo(self): self.info('foo') @keyword ...
code_fim
medium
{ "lang": "python", "repo": "HelioGuilherme66/robotframework-seleniumlibrary", "path": "/utest/test/api/my_lib.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Network size Kappa : float Mean degree of the ensemble Returns ---------- Mu2 : float Expected algebraic connectivity of the ensemble. """ Mu2 = Kappa - ( 2*Kappa*(1.0 - (Kappa/N))*math.log(N) )**0.5 + (( (Kappa*(1.0 - (Kappa/N)))/math.log(N) )**0.5)*( math.log( (2*math.pi*math.l...
code_fim
hard
{ "lang": "python", "repo": "MGarrod1/rgg_ensemble_analysis", "path": "/rgg_ensemble_analysis/Analytic_Functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ----------- N : int Network size Kappa : float Mean degree of the ensemble d: int Dimension of the embedding space Returns --------- Mu2 : float Approximate value of the algebraic connectivity. """ Mu2 = (1.0/6.0)*( (math.pi/(N**(1.0/d)) )**2 )*( ( Kappa ...
code_fim
hard
{ "lang": "python", "repo": "MGarrod1/rgg_ensemble_analysis", "path": "/rgg_ensemble_analysis/Analytic_Functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MGarrod1/rgg_ensemble_analysis path: /rgg_ensemble_analysis/Analytic_Functions.py """ Contains functions which evaluate the analytic approximation of the algebraic connectivity of graphs. """ #Import standard python modules: import numpy as np import itertools import math import scipy from s...
code_fim
hard
{ "lang": "python", "repo": "MGarrod1/rgg_ensemble_analysis", "path": "/rgg_ensemble_analysis/Analytic_Functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: healthwhale/streamlit-quill path: /streamlit_quill/__init__.py import os import streamlit.components.v1 as components _RELEASE = True if not _RELEASE: _st_quill = components.declare_component("streamlit_quill", url="http://localhost:3001") else: parent_dir = os.path.dirname(os.path.absp...
code_fim
hard
{ "lang": "python", "repo": "healthwhale/streamlit-quill", "path": "/streamlit_quill/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not _RELEASE: import streamlit as st st.sidebar.title(":computer: Quill Editor") placeholder = st.sidebar.text_input("Placeholder", "Some placeholder text") html = st.sidebar.checkbox("Return HTML", False) read_only = st.sidebar.checkbox("Read only", False) content = st_quill...
code_fim
hard
{ "lang": "python", "repo": "healthwhale/streamlit-quill", "path": "/streamlit_quill/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: robsonzagrejr/random_prime_number path: /prng/blum_blum_shub.py # Implementation of Blum Blum Shub # Copyright (c) 2021 Robson Zagre Júnior from src.utils import ( _random_int ) # x(i+1) = x(i)² Mod M # coprime are values that factorized in primes dont shared a same divisor # (If p and q ar...
code_fim
hard
{ "lang": "python", "repo": "robsonzagrejr/random_prime_number", "path": "/prng/blum_blum_shub.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> random_number = 0 while random_number.bit_length() < n_bits: # Generate next value in serie x = pow(x,2,M) # Join least significant bit of serie with random_number random_number <<= 1 random_number |= (x & 1) return random_number # Generate a ranfom ...
code_fim
hard
{ "lang": "python", "repo": "robsonzagrejr/random_prime_number", "path": "/prng/blum_blum_shub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return random_number # Generate a ranfom integer with 32 bits def gen_int(size=32): global random_seed, x, M if random_seed: _set_random_seed() random_number = 0 # Execute just by size of int (not garantee that number will have size bits) for _ in range(0, size): ...
code_fim
hard
{ "lang": "python", "repo": "robsonzagrejr/random_prime_number", "path": "/prng/blum_blum_shub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rustytwilight/sandypi path: /server/utils/buffered_timeout.py from threading import Thread, Lock import time # this thread calls a function after a timeout but only if the "update" method is not called before that timeout expires class BufferTimeout(Thread): def __init__(self, timeout_delta...
code_fim
hard
{ "lang": "python", "repo": "rustytwilight/sandypi", "path": "/server/utils/buffered_timeout.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, timeout_delta, function, group=None, target=None, name=None, args=(), kwargs=None): super(BufferTimeout, self).__init__(group=group, target=target, name=name) self.name = "buffered_timeout" self.timeout_delta = timeout_delta self.callback = function ...
code_fim
hard
{ "lang": "python", "repo": "rustytwilight/sandypi", "path": "/server/utils/buffered_timeout.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ii_dist = final_mesh[:len(ii)] jj_dist = final_mesh[len(jj):] sources = np.stack([ii, jj]).transpose().astype(np.int32) targets = np.stack([ii_dist, jj_dist]).transpose().astype(np.int32) # Define path to save results out_distord = '{out_dir}/ebsd_distord.{index}.png'.format(out_d...
code_fim
hard
{ "lang": "python", "repo": "MLmicroscopy/distortions", "path": "/src/distord.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # turn floating mesh into integer one (pixels are integer!) mesh_int = np.array(solutions, dtype=np.int32) # prepare data for multi-threading scores = [] for s in mesh_int: ii_dist = s[:len(ii)] jj_dist = s[len(jj):] sources = ...
code_fim
hard
{ "lang": "python", "repo": "MLmicroscopy/distortions", "path": "/src/distord.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MLmicroscopy/distortions path: /src/distord.py import numpy as np import os import cv2 from distutils.util import strtobool from matplotlib import pyplot as plt, cm import argparse from misc.tools import compute_score, apply_distortion from ang.write_core_ang import Ang from ang.phase import P...
code_fim
hard
{ "lang": "python", "repo": "MLmicroscopy/distortions", "path": "/src/distord.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>server_msg, address = sock.recvfrom(1024) print('收到服务端消息',server_msg.decode()) sock.close()<|fim_prefix|># repo: panshen083/RUN path: /install/Hardware control.hcl #!/usr/bin/env python # -*- coding:utf-8 -*- import socket import time sock = socket.socket(type=socket.SOCK_DGRAM) ...
code_fim
hard
{ "lang": "python", "repo": "panshen083/RUN", "path": "/install/Hardware control.hcl", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: panshen083/RUN path: /install/Hardware control.hcl #!/usr/bin/env python # -*- coding:utf-8 -*- import socket import time sock = socket.socket(type=socket.SOCK_DGRAM) #创建Socket接口 sock.sendto('RELAY-SCAN_DEVICE-NOW'.encode(),('192.168.1.210', 4196)) #发送初始化命令1 <|fim_s...
code_fim
medium
{ "lang": "python", "repo": "panshen083/RUN", "path": "/install/Hardware control.hcl", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wen-Tian-Pineapple/RL-template path: /run_breakout.py """ Example of an efficiently implemented RL model in a 2D environment. This example uses the Atari game breakout. """ import numpy as np import gym import time from mpi4py import MPI import heapq import tensorflow as tf from models import T...
code_fim
hard
{ "lang": "python", "repo": "Wen-Tian-Pineapple/RL-template", "path": "/run_breakout.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> batch_train_data = [datum[0] for datum in batch_data] batch_reward_data = [datum[1] for datum in batch_data] train_data.extend(batch_train_data) all_rewards.extend(batch_reward_data) else: comm.gather(worker(model...
code_fim
hard
{ "lang": "python", "repo": "Wen-Tian-Pineapple/RL-template", "path": "/run_breakout.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skyhigh8591/VocationalTraining_LearningCode path: /Program_RPI_IOT_code/Python/1750.py #!/home/pi/RPI_IOT/Python #-*- coding: UTF-8 -*- import smbus import time DEVICE =0x23 POWER_DOWN =0x00 POWER_ON =0x01 RESET =0x07 <|fim_suffix|> return((data[1]+(256*data[0]))/1.2) def readLight(...
code_fim
hard
{ "lang": "python", "repo": "skyhigh8591/VocationalTraining_LearningCode", "path": "/Program_RPI_IOT_code/Python/1750.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def readLight(addr=DEVICE): data=bus.read_i2c_block_data(addr,ONE_TIME_HIGH_RES_MODE_1) return convertToNumber(data) def main(): while True: print "Light Level :"+str(readLight())+" 1x" time.sleep(1) if __name__=="__name__": main()<|fim_prefix|># repo: skyhigh8591/VocationalTraining_LearningCode...
code_fim
hard
{ "lang": "python", "repo": "skyhigh8591/VocationalTraining_LearningCode", "path": "/Program_RPI_IOT_code/Python/1750.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sydnimeyer/PFCH-Final-2021 path: /GlobKwdArticle.py import xml.etree.ElementTree as etree import glob import pandas as pd keywords = [] #creating structure for Pandas dataframe df_cols = ['Keywords'] rows = [] <|fim_suffix|># # creating rows for data for Pandas DataFrame rows.append({'Keywords...
code_fim
hard
{ "lang": "python", "repo": "sydnimeyer/PFCH-Final-2021", "path": "/GlobKwdArticle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># # creating rows for data for Pandas DataFrame rows.append({'Keywords': keywords}) out_df = pd.DataFrame(rows, columns=df_cols) out_df.to_csv('kwdglob_keywords.csv', index=False)<|fim_prefix|># repo: sydnimeyer/PFCH-Final-2021 path: /GlobKwdArticle.py import xml.etree.ElementTree as etree import glob ...
code_fim
hard
{ "lang": "python", "repo": "sydnimeyer/PFCH-Final-2021", "path": "/GlobKwdArticle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(file) as xmlfile: tree = etree.parse(file) root = tree.getroot() # #defining tree structure article_meta = tree.find('front').find('article-meta') # #setting keywords text for keyword in article_meta.findall('.//kwd-group/kwd'): keywords.append(...
code_fim
medium
{ "lang": "python", "repo": "sydnimeyer/PFCH-Final-2021", "path": "/GlobKwdArticle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /L1Trigger/Configuration/python/customise_l1GtEmulatorFromRaw.py # # customization fragment to run L1 GT emulator starting from a RAW file # # V.M. Ghete 2010-06-09 import FWCore.ParameterSet.Config as cms def customise(process): <|fim_suffix|> # # customization o...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/L1Trigger/Configuration/python/customise_l1GtEmulatorFromRaw.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if printL1TriggerReport == True : from L1Trigger.Configuration.L1Trigger_custom import customiseL1TriggerReport process=customiseL1TriggerReport(process) process.SimL1Emulator_L1TriggerReport = cms.Sequence(process.SimL1Emulator*process.l1GtTrigReport) process....
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/L1Trigger/Configuration/python/customise_l1GtEmulatorFromRaw.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>router = routers.SimpleRouter() router.register('plan-tags', PlanTagViewSet, basename='plan-tags') router.register('plan-costs', PlanCostViewSet, basename='plan-costs') router.register('planlist-details', PlanListDetailViewSet, basename='planlist-details') router.register('planlist', PlanListViewSet, base...
code_fim
medium
{ "lang": "python", "repo": "ydaniels/drf-django-flexible-subscriptions", "path": "/subscriptions_api/urls.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: ydaniels/drf-django-flexible-subscriptions path: /subscriptions_api/urls.py from rest_framework import routers from .views import PlanTagViewSet, PlanCostViewSet, PlanListDetailViewSet, \ PlanListViewSet, SubscriptionPlanViewSet, SubscriptionTransactionViewSet, \ UserSubscriptionViewSet ...
code_fim
medium
{ "lang": "python", "repo": "ydaniels/drf-django-flexible-subscriptions", "path": "/subscriptions_api/urls.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> initial = True dependencies = [ ('playlist', '0010_playlist_type'), ] operations = [ migrations.CreateModel( name='Weekly', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
code_fim
medium
{ "lang": "python", "repo": "gasbarroni8/best-channels", "path": "/django_base/weekly_channels/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gasbarroni8/best-channels path: /django_base/weekly_channels/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-08-10 04:02 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> i...
code_fim
medium
{ "lang": "python", "repo": "gasbarroni8/best-channels", "path": "/django_base/weekly_channels/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def teardown_function(): """Executed at the end of the current test suite""" # Force module reload as the default test settings have been restored importlib.reload(defaults)<|fim_prefix|># repo: openfun/marion path: /src/marion/marion/tests/test_defaults.py """Tests for the marion applicatio...
code_fim
hard
{ "lang": "python", "repo": "openfun/marion", "path": "/src/marion/marion/tests/test_defaults.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Executed at the end of the current test suite""" # Force module reload as the default test settings have been restored importlib.reload(defaults)<|fim_prefix|># repo: openfun/marion path: /src/marion/marion/tests/test_defaults.py """Tests for the marion application defaults""" import imp...
code_fim
hard
{ "lang": "python", "repo": "openfun/marion", "path": "/src/marion/marion/tests/test_defaults.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openfun/marion path: /src/marion/marion/tests/test_defaults.py """Tests for the marion application defaults""" import importlib from pathlib import Path from marion import defaults <|fim_suffix|> """Test marion.defaults overrides with settings definition""" settings.MARION_DOCUMENT_IS...
code_fim
medium
{ "lang": "python", "repo": "openfun/marion", "path": "/src/marion/marion/tests/test_defaults.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def from_pretrained(cls, *args, **kw): kw["_fast_init"] = False return super().from_pretrained(*args, **kw) @classmethod def from_pretrained_question_encoder_generator( cls, question_encoder_pretrained_model_name_or_path=None, generator...
code_fim
hard
{ "lang": "python", "repo": "quantapix/qnarre", "path": "/qnarre/prep/config/rag.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if "config" not in kw_question_encoder: from ..auto.configuration_auto import AutoConfig question_encoder_config, kw_question_encoder = AutoConfig.from_pretrained( question_encoder_pretrained_model_name_or_path, **kw_ques...
code_fim
hard
{ "lang": "python", "repo": "quantapix/qnarre", "path": "/qnarre/prep/config/rag.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: quantapix/qnarre path: /qnarre/prep/config/rag.py # Copyright 2022 Quantapix Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:...
code_fim
hard
{ "lang": "python", "repo": "quantapix/qnarre", "path": "/qnarre/prep/config/rag.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def sanitize_webscrape_name(name): """ Sanitizes webscrape powerplant names by removing unwanted strings (listed in blacklist), applying lower case, and deleting trailing whitespace. Parameters ---------- name: str webscrape plant name Returns ------- name: s...
code_fim
hard
{ "lang": "python", "repo": "arfc/transition-scenarios", "path": "/scripts/merge_coordinates.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: arfc/transition-scenarios path: /scripts/merge_coordinates.py from fuzzywuzzy import fuzz import numpy as np import pandas as pd import sqlite3 as sql import sys if len(sys.argv) < 3: print('Usage: python merge_coordinates.py [pris_link] [webscrape_link]') def cursor(file_name): """ Co...
code_fim
hard
{ "lang": "python", "repo": "arfc/transition-scenarios", "path": "/scripts/merge_coordinates.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def save_output(pris): """ Saves updated PRIS database as 'reactors_pris_2016.csv' Parameters ---------- pris: pd.DataFrame updated PRIS database with latitude and longitude info Returns ------- """ pris.to_csv('reactors_pris_2016.csv', index=Fals...
code_fim
hard
{ "lang": "python", "repo": "arfc/transition-scenarios", "path": "/scripts/merge_coordinates.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.eval() self.define_extras(self.args.batch_size) test_loss = 0 correct = 0 for data, target in test_loader: if self.args.cuda: data, target = data.cuda(), target.cuda() target = Variable(target) target_ = targe...
code_fim
hard
{ "lang": "python", "repo": "BalintMagyar4/soft-decision-tree", "path": "/model.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def train_(self, train_loader, epoch): t = time.time() self.train() self.define_extras(self.args.batch_size) for batch_idx, (data, target) in enumerate(train_loader): correct = 0 if self.args.cuda: data, target = data.cuda(), tar...
code_fim
hard
{ "lang": "python", "repo": "BalintMagyar4/soft-decision-tree", "path": "/model.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: BalintMagyar4/soft-decision-tree path: /model.py import os import time import scipy.misc import numpy as np import pickle import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable import time class InnerNode(): def...
code_fim
hard
{ "lang": "python", "repo": "BalintMagyar4/soft-decision-tree", "path": "/model.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self.times = [] self.values = [] def clear(self): self.times = [] self.values = [] def to_dict(self): # Ensure times are a python list times = self.times if type(self.times) is list else list(self.times) ...
code_fim
medium
{ "lang": "python", "repo": "gjfelix/BlenderNEURON", "path": "/blenderneuron/activity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gjfelix/BlenderNEURON path: /blenderneuron/activity.py try: import numpy as np numpy_available = True from blenderneuron.blender.utils import rdp except: numpy_available = False class Activity: def __init__(self): <|fim_suffix|> def to_dict(self): # E...
code_fim
medium
{ "lang": "python", "repo": "gjfelix/BlenderNEURON", "path": "/blenderneuron/activity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print('Loading gitGrab.json...') with open(basedir+'/gitGrab.json', 'rt') as fd: gitgrabs = sorted(json.loads(fd.read()), key=lambda x:-x['stars']) ngrabs = len(gitgrabs) lastds = 0 downfd = None for i, gitgrab in enumerate(gitgrabs): ds = 1 + i//maxprojects if...
code_fim
hard
{ "lang": "python", "repo": "nokia/code-compass", "path": "/scripts/create_crawl_scripts.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nokia/code-compass path: /scripts/create_crawl_scripts.py #!/usr/bin/env python # Copyright (C) 2019, Nokia # Licensed under the BSD 3-Clause License import json import os import sys basedir = sys.argv[1] if len(sys.argv) > 1 else '../datasets/python' maxprojects=10000 gitclone = False wit...
code_fim
hard
{ "lang": "python", "repo": "nokia/code-compass", "path": "/scripts/create_crawl_scripts.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TrendingTechnology/pyZscaler path: /pyzscaler/zpa/posture_profiles.py from box import BoxList from restfly.endpoint import APIEndpoint class PostureProfilesAPI(APIEndpoint): def list_profiles(self): """ Returns a list of all configured posture profiles. Returns: ...
code_fim
medium
{ "lang": "python", "repo": "TrendingTechnology/pyZscaler", "path": "/pyzscaler/zpa/posture_profiles.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_profile(self, profile_id: str): """ Returns information on the specified posture profiles. Args: profile_id (str): The unique identifier for the posture profiles. Returns: :obj:`dict`: The resource record for the posture...
code_fim
hard
{ "lang": "python", "repo": "TrendingTechnology/pyZscaler", "path": "/pyzscaler/zpa/posture_profiles.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: :obj:`dict`: The resource record for the posture profiles. Examples: >>> pprint(zpa.posture_profiles.get_profile('2342342342344433')) """ return self._get(f"posture/{profile_id}")<|fim_prefix|># repo: TrendingTechnology/pyZscaler path: /...
code_fim
medium
{ "lang": "python", "repo": "TrendingTechnology/pyZscaler", "path": "/pyzscaler/zpa/posture_profiles.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if help_ or len(argv) == 1: dalton_help() if version: # :todo: displays version number pass if license_: click.echo(mit_license())<|fim_prefix|># repo: periodicaidan/dalton-cli path: /dalton.py """ File: dalton.py Purpose: The root-command for the program, shows app i...
code_fim
hard
{ "lang": "python", "repo": "periodicaidan/dalton-cli", "path": "/dalton.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: periodicaidan/dalton-cli path: /dalton.py """ File: dalton.py Purpose: The root-command for the program, shows app information """ from sys import argv import click from app_info import mit_license from help_menus import dalton_help <|fim_suffix|> if help_ or len(argv) == 1: dalto...
code_fim
hard
{ "lang": "python", "repo": "periodicaidan/dalton-cli", "path": "/dalton.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @click.group("dalton", invoke_without_command=True) @click.option("--version", is_flag=True, default=False) @click.option("--license", "license_", is_flag=True, default=False) @click.option("--help", "-h", "help_", is_flag=True, default=False) def dalton(help_, version, license_): if help_ or len(arg...
code_fim
medium
{ "lang": "python", "repo": "periodicaidan/dalton-cli", "path": "/dalton.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: henrikmidtiby/PorpoiseTracker path: /tracked_object.py class MarkObject: def __init__(self, name, color, marking, data, from_video, log_file, fov_file): self.video = from_video self.log_file = log_file<|fim_suffix|>or self.marking = marking self.data = data ...
code_fim
medium
{ "lang": "python", "repo": "henrikmidtiby/PorpoiseTracker", "path": "/tracked_object.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>or self.marking = marking self.data = data self.hide = False<|fim_prefix|># repo: henrikmidtiby/PorpoiseTracker path: /tracked_object.py class MarkObject: def __init__(self, name, color, marking, data, from_video, lo<|fim_middle|>g_file, fov_file): self.video = from_vi...
code_fim
medium
{ "lang": "python", "repo": "henrikmidtiby/PorpoiseTracker", "path": "/tracked_object.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuenliou/leetcode path: /40-combination-sum-ii.py #!/usr/local/bin/python3.7 # -*- coding: utf-8 -*- from typing import List class Solution: def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]: """ 什么时候使用 used 数组,什么时候使用 begin 变量 有些朋友可能会疑惑什...
code_fim
hard
{ "lang": "python", "repo": "yuenliou/leetcode", "path": "/40-combination-sum-ii.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>所有数字(包括目标数)都是正整数。 解集不能包含重复的组合。  示例 1: 输入: candidates = [10,1,2,7,6,1,5], target = 8, 所求解集为: [ [1, 7], [1, 2, 5], [2, 6], [1, 1, 6] ] 示例 2: 输入: candidates = [2,5,2,1,2], target = 5, 所求解集为: [   [1,2,2],   [5] ] 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/combination-sum-ii 著作权归领扣网络所有。商业转...
code_fim
hard
{ "lang": "python", "repo": "yuenliou/leetcode", "path": "/40-combination-sum-ii.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alaindet/learn-python path: /courses/complete-python/web-scraping/books-scraper/pages/all_books_page.py from bs4 import BeautifulSoup from re import search from locators.all_books_page import AllBooksPageLocators from parsers.book import BookParser class AllBooksPage: def __init__(self, pag...
code_fim
medium
{ "lang": "python", "repo": "alaindet/learn-python", "path": "/courses/complete-python/web-scraping/books-scraper/pages/all_books_page.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pager_content = self.soup.select_one(AllBooksPageLocators.PAGER).string pattern = 'Page [0-9]+ of ([0-9]+)' matches = search(pattern, pager_content) pages = int(matches.group(1)) return pages<|fim_prefix|># repo: alaindet/learn-python path: /courses/complete-python...
code_fim
medium
{ "lang": "python", "repo": "alaindet/learn-python", "path": "/courses/complete-python/web-scraping/books-scraper/pages/all_books_page.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>file = open('travel_plans.txt', 'r') first_chars = file.read(33) print(first_chars) # 8. Challenge: Using the file school_prompt.txt, if the character ‘p’ is in a word, then add the word to a list called p_words. file = open('school_prompt.txt', 'r') p_words = [] for line in file: words = line.split...
code_fim
hard
{ "lang": "python", "repo": "Salman42Sabir/Python3-Programming-Specialization", "path": "/course_2_assessment_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Salman42Sabir/Python3-Programming-Specialization path: /course_2_assessment_1.py # 1. The textfile, travel_plans.txt, contains the summer travel plans for someone with some commentary. # Find the total number of characters in the file and save to the variable num. file = open("travel_plans.txt")...
code_fim
hard
{ "lang": "python", "repo": "Salman42Sabir/Python3-Programming-Specialization", "path": "/course_2_assessment_1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>file = open('school_prompt.txt', 'r') p_words = [] for line in file: words = line.split() for word in words: if "p" not in word: continue p_words.append(word) print(p_words)<|fim_prefix|># repo: Salman42Sabir/Python3-Programming-Specialization path: /course_2_assessmen...
code_fim
hard
{ "lang": "python", "repo": "Salman42Sabir/Python3-Programming-Specialization", "path": "/course_2_assessment_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ioannispapadogeo/Flood_protection path: /Model/problem_formulation_2.py # -*- coding: utf-8 -*- """ Created on Wed Mar 21 17:34:11 2018 @author: ciullo """ from __future__ import (unicode_literals, print_function, absolute_import, division) from ema_workbench import (Mo...
code_fim
hard
{ "lang": "python", "repo": "ioannispapadogeo/Flood_protection", "path": "/Model/problem_formulation_2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> outcomes.append(ScalarOutcome('Total Investment Costs', variable_name=['{}_Dike Investment Costs'.format(dike) for dike in function.dikelist] + ['RfR Total Costs'] + ['Expected Evacuation Costs'], function...
code_fim
hard
{ "lang": "python", "repo": "ioannispapadogeo/Flood_protection", "path": "/Model/problem_formulation_2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Override to print a readable string presentation of your object # below is a dynamic way of doing this without explicity constructing the string manually return ', '.join(['{key}={value}'.format(key=key, value=self.__dict__.get(key)) for key in self.__dict__]) class Order(...
code_fim
hard
{ "lang": "python", "repo": "dutraa/alpaca1", "path": "/data/alpaca_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dutraa/alpaca1 path: /data/alpaca_data.py user boolean User setting. If true, the account is not allowed to place orders. trading_blocked boolean If true, the account is not allowed to place orders. transfers_blocked boolean If true,...
code_fim
hard
{ "lang": "python", "repo": "dutraa/alpaca1", "path": "/data/alpaca_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> now = pd.Timestamp.now(tz=timezone) nextOpen = self.next_open if( now.day == nextOpen.day and now.hour == nextOpen.hour - hour and now.minute == nextOpen.minute - minute and now.second == nextOpen.second - second): return True...
code_fim
hard
{ "lang": "python", "repo": "dutraa/alpaca1", "path": "/data/alpaca_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ApiResponse """ return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs) @sp_endpoint('/v2/sp/campaigns/{}', method='DELETE') def delete_campaign(self, campaignId, **kwargs) -> ApiResponse: r""" delete_campaign(self, camp...
code_fim
hard
{ "lang": "python", "repo": "saleweaver/python-amazon-ad-api", "path": "/ad_api/api/sp/campaigns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saleweaver/python-amazon-ad-api path: /ad_api/api/sp/campaigns.py from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse class Campaigns(Client): @sp_endpoint('/v2/sp/campaigns', method='POST') def create_campaigns(self, **kwargs) -> ApiResponse: r""" ...
code_fim
hard
{ "lang": "python", "repo": "saleweaver/python-amazon-ad-api", "path": "/ad_api/api/sp/campaigns.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ return self._request(kwargs.pop('path'), params=kwargs) @sp_endpoint('/v2/sp/campaigns/{}', method='GET') def get_campaign(self, campaignId, **kwargs) -> ApiResponse: r""" get_campaign(self, campaignId, **kwargs) -> ApiResponse Gets a campaign specif...
code_fim
hard
{ "lang": "python", "repo": "saleweaver/python-amazon-ad-api", "path": "/ad_api/api/sp/campaigns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thatdeep/urnn path: /utils/optimizations.py import theano import lasagne import theano.tensor as T import numpy as np from collections import OrderedDict def clipped_gradients(gradients, gradient_clipping): clipped_grads = [T.clip(g, -gradient_clipping, gradient_clipping) ...
code_fim
hard
{ "lang": "python", "repo": "thatdeep/urnn", "path": "/utils/optimizations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Stochastic Gradient Descent (SGD) updates Generates update expressions of the form: * ``param := param - learning_rate * gradient`` Parameters ---------- loss_or_grads : symbolic expression or list of expressions A scalar loss expression, or a list of gradient expression...
code_fim
hard
{ "lang": "python", "repo": "thatdeep/urnn", "path": "/utils/optimizations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CyberZHG/keras-adaptive-softmax path: /keras_adaptive_softmax/softmax.py from tensorflow import keras from tensorflow.keras import backend as K __all__ = ['AdaptiveSoftmax'] class AdaptiveSoftmax(keras.layers.Layer): """Turns dense vectors into probabilities. # Arguments input...
code_fim
hard
{ "lang": "python", "repo": "CyberZHG/keras-adaptive-softmax", "path": "/keras_adaptive_softmax/softmax.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return input_shape[0][:-1] + (self.output_dim,) def call(self, inputs, **kwargs): embeddings = inputs[1:1 + (self.cluster_num + 1)] projections = inputs[1 + (self.cluster_num + 1):] inputs = inputs[0] if self.div_val == 1: if self.embed_dim != self....
code_fim
hard
{ "lang": "python", "repo": "CyberZHG/keras-adaptive-softmax", "path": "/keras_adaptive_softmax/softmax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Ident(ctypes.Structure): _fields_ = [ ("nsid", ctypes.c_uint32), ("nst", ctypes.c_uint8), ("type", ctypes.c_uint8), ("_pad0", ctypes.c_uint8), ("be_attr", BackendAttributes), ("_pad", ctypes.c_uint8 * 38), ("uri", ctypes.c_char * 320), ...
code_fim
medium
{ "lang": "python", "repo": "SuhoSon/xNVMe", "path": "/pyxnvme/xnvme/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SuhoSon/xNVMe path: /pyxnvme/xnvme/__init__.py """ xNVMe libraries for Python Wrapping the shared version of xNVMe """ import ctypes import time import sys import os XNVME_SHARED_LIB_FN = "libxnvme-shared.so" CAPI = None if CAPI is None: CAPI = ctypes.cdll.LoadLibrary(XNVME_SHARED_...
code_fim
hard
{ "lang": "python", "repo": "SuhoSon/xNVMe", "path": "/pyxnvme/xnvme/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ['key', 'format_value', 'createtime', 'updatetime'] admin.site.site_title = '数据存储' admin.site.site_header = '数据存储' admin.site.register(Data, AdminData)<|fim_prefix|># repo: Today-to-Lsp/pythonanywhere path: /DataStorage/DataStorage/admin.py from django.contrib import admin from DataS...
code_fim
easy
{ "lang": "python", "repo": "Today-to-Lsp/pythonanywhere", "path": "/DataStorage/DataStorage/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Today-to-Lsp/pythonanywhere path: /DataStorage/DataStorage/admin.py from django.contrib import admin from DataStorage.models import Data # Register your models here. <|fim_suffix|>admin.site.site_title = '数据存储' admin.site.site_header = '数据存储' admin.site.register(Data, AdminData)<|fim_middle|>cl...
code_fim
medium
{ "lang": "python", "repo": "Today-to-Lsp/pythonanywhere", "path": "/DataStorage/DataStorage/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: colibris-framework/colibris path: /colibris/authorization/role.py from .base import AuthorizationBackend # A permission is defined as the role of an account. # # The optional ordering defines a relation between roles; this allows specifying e.g. "admin" as required permission # and assuming th...
code_fim
hard
{ "lang": "python", "repo": "colibris-framework/colibris", "path": "/colibris/authorization/role.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.role_field = role_field self.order = order or [] # lower first, e.g. ["readonly", "regular", "admin"] super().__init__(**kwargs) def get_role(self, account): return getattr(account, self.role_field) def get_actual_permissions(self, account, method, path): ...
code_fim
medium
{ "lang": "python", "repo": "colibris-framework/colibris", "path": "/colibris/authorization/role.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class LeastMedianSquaresResults(NamedTuple): slope: float intercept: float def least_median_squares(x, y, max_iter: int = 100): check_consistent_length(x, y) if x.ndim == 2: if x.shape[1] == 1: x = x.flatten() else: raise ValueError('x must be 1-d...
code_fim
hard
{ "lang": "python", "repo": "EdgarTeixeira/dsul", "path": "/dsul/linear_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EdgarTeixeira/dsul path: /dsul/linear_model.py from typing import NamedTuple from warnings import warn import numpy as np from scipy.optimize import basinhopping, minimize from sklearn.base import BaseEstimator, RegressorMixin from sklearn.utils import check_consistent_length, check_scalar, chec...
code_fim
hard
{ "lang": "python", "repo": "EdgarTeixeira/dsul", "path": "/dsul/linear_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with pytest.raises(TypeError): # pretrained mast be a str or None model = DetectoRS_ResNet( **detectorrs_cfg, pretrained=['Pretrained'], init_cfg=None) model.init_weights()<|fim_prefix|># repo: alldatacenter/alldata path: /ai/mmdetection/tests/test_models/test_back...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/mmdetection/tests/test_models/test_backbones/test_detectors_resnet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alldatacenter/alldata path: /ai/mmdetection/tests/test_models/test_backbones/test_detectors_resnet.py # Copyright (c) OpenMMLab. All rights reserved. import pytest from mmdet.models.backbones import DetectoRS_ResNet def test_detectorrs_resnet_backbone(): detectorrs_cfg = dict( dept...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/mmdetection/tests/test_models/test_backbones/test_detectors_resnet.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with pytest.raises(KeyError): # init_cfg must contain the key `type` DetectoRS_ResNet( **detectorrs_cfg, pretrained=None, init_cfg=dict(checkpoint='Pretrained')) with pytest.raises(AssertionError): # init_cfg only support initialize pret...
code_fim
medium
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/ai/mmdetection/tests/test_models/test_backbones/test_detectors_resnet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertRendered('{% load fiber_tags %}{% fiber_version %}', str(fiber.__version__))<|fim_prefix|># repo: swdreams/django-fiber path: /testproject/fiber_test/tests/test_templatetags/test_fiber_version.py import fiber from django.test import SimpleTestCase from ...test_util import RenderMixin ...
code_fim
medium
{ "lang": "python", "repo": "swdreams/django-fiber", "path": "/testproject/fiber_test/tests/test_templatetags/test_fiber_version.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: swdreams/django-fiber path: /testproject/fiber_test/tests/test_templatetags/test_fiber_version.py import fiber from django.test import SimpleTestCase from ...test_util import RenderMixin <|fim_suffix|> self.assertRendered('{% load fiber_tags %}{% fiber_version %}', str(fiber.__version__))...
code_fim
medium
{ "lang": "python", "repo": "swdreams/django-fiber", "path": "/testproject/fiber_test/tests/test_templatetags/test_fiber_version.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexanderUstinovv/medical_test path: /medical_test/forms.py from typing import List from collections import namedtuple import django.forms as forms from django.forms.fields import Field FLOAT_FILED = 'float_field' STRING_FIELD = 'string_field' INTEGER_FIELD = 'integer_field' field_generators...
code_fim
hard
{ "lang": "python", "repo": "AlexanderUstinovv/medical_test", "path": "/medical_test/forms.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_field(field_description: FormFieldDescription) -> Field: field_function = field_generators.get(field_description.field_type) return field_function(field_description.label, field_description.measurement) def get_form(descriptions: List[FormFieldDescription]) -> ...
code_fim
hard
{ "lang": "python", "repo": "AlexanderUstinovv/medical_test", "path": "/medical_test/forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pass def get_field(field_description: FormFieldDescription) -> Field: field_function = field_generators.get(field_description.field_type) return field_function(field_description.label, field_description.measurement) def get_form(descriptions: List[FormFieldDescrip...
code_fim
hard
{ "lang": "python", "repo": "AlexanderUstinovv/medical_test", "path": "/medical_test/forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: InnoFang/algo-set path: /LeetCode/0442. Find All Duplicates in an Array/solution.py """ 28 / 28 test cases passed. Runtime: 96 ms Memory Usage: 21.1 MB """ class Solution: <|fim_suffix|> ans = [] for num in nums: num = abs(num) if nums[num - 1] < 0: ...
code_fim
medium
{ "lang": "python", "repo": "InnoFang/algo-set", "path": "/LeetCode/0442. Find All Duplicates in an Array/solution.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ans = [] for num in nums: num = abs(num) if nums[num - 1] < 0: ans.append(num) else: nums[num - 1] *= -1 return ans<|fim_prefix|># repo: InnoFang/algo-set path: /LeetCode/0442. Find All Duplicates in an Array/solu...
code_fim
medium
{ "lang": "python", "repo": "InnoFang/algo-set", "path": "/LeetCode/0442. Find All Duplicates in an Array/solution.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>gtail.core.blocks.TextBlock(label='Answer', required=True)), ('bullet_image', wagtail.images.blocks.ImageChooserBlock(label='Bullet image', required=False)), ('more_info_url', wagtail.core.blocks.URLBlock(help_text='A link to be followed for more information on that question, feature or product', label='U...
code_fim
hard
{ "lang": "python", "repo": "thclark/wagtail_site_sections", "path": "/wagtail_site_sections/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thclark/wagtail_site_sections path: /wagtail_site_sections/migrations/0001_initial.py # Generated by Django 2.1.4 on 2019-05-24 17:16 from django.db import migrations, models import django.db.models.deletion import wagtail.core.blocks import wagtail.core.fields import wagtail.embeds.blocks impor...
code_fim
hard
{ "lang": "python", "repo": "thclark/wagtail_site_sections", "path": "/wagtail_site_sections/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: desihub/desispec path: /bin/desi_proc_joint_fit #!/usr/bin/env python # small time jitter so MPI parallel imports don't hit the disk simultaneously import time import random time.sleep(2*random.random()) <|fim_suffix|> args = proc_joint_fit.parse() sys.exit(proc_joint_fit.main(args))<|fi...
code_fim
medium
{ "lang": "python", "repo": "desihub/desispec", "path": "/bin/desi_proc_joint_fit", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> args = proc_joint_fit.parse() sys.exit(proc_joint_fit.main(args))<|fim_prefix|># repo: desihub/desispec path: /bin/desi_proc_joint_fit #!/usr/bin/env python # small time jitter so MPI parallel imports don't hit the disk simultaneously import time import random time.sleep(2*random.random()) <|fi...
code_fim
medium
{ "lang": "python", "repo": "desihub/desispec", "path": "/bin/desi_proc_joint_fit", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if discipline not in self._marks[student]: self._marks[student][discipline] = {} self._marks[student][discipline] = mark return Response(201, 'Created') def send_response(self, conn, resp): wfile = conn.makefile('wb') status_line = f'HTTP/1.1 {res...
code_fim
hard
{ "lang": "python", "repo": "EgorovM/ITMO_ICT_WebDevelopment_2021-2022", "path": "/students/K33402/Prokhorov_Nikolay/LR1/task3/task3_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EgorovM/ITMO_ICT_WebDevelopment_2021-2022 path: /students/K33402/Prokhorov_Nikolay/LR1/task3/task3_server.py import argparse import json import socket from email.parser import Parser from functools import lru_cache from urllib.parse import parse_qs, urlparse class HTTPError(Exception): def ...
code_fim
hard
{ "lang": "python", "repo": "EgorovM/ITMO_ICT_WebDevelopment_2021-2022", "path": "/students/K33402/Prokhorov_Nikolay/LR1/task3/task3_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cbare/Etudes path: /python/big_tree.py import random EMPTY = tuple() NUM_PROJECTS = 1000 class Folder: def __init__(self, id, children=None): <|fim_suffix|> class Sequence: def __init__(self, i=100001): self.starting_value = i self.i = i def __next__(self): t...
code_fim
medium
{ "lang": "python", "repo": "cbare/Etudes", "path": "/python/big_tree.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }