text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('polls', '0014_recruitment_local_committee'), ] operations = [ migrations.RemoveField( model_name='registerevent', name='question', ), migrati...
code_fim
medium
{ "lang": "python", "repo": "dinhkute/Incisive-AIESEC", "path": "/webroot/Pj/mysite/mysite/polls/migrations/0015_auto_20170630_0936.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>cell = flagwidth / 2 / 15 rbig = cell * 3 rsmall = cell * 1 draw_star((-10*cell,5*cell),rbig) draw_star((-5*cell,8*cell),rsmall,-math.tanh(3/5)*180) draw_star((-3*cell,6*cell),rsmall,-math.tanh(1/7)*180) draw_star((-3*cell,3*cell),rsmall,math.tanh(2/7)*180) draw_star((-5*cell,cell),rsmall,math.tanh(4/5)*...
code_fim
hard
{ "lang": "python", "repo": "neo20/pystudy", "path": "/national_flag_of_China/draw.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neo20/pystudy path: /national_flag_of_China/draw.py from turtle import * import math flagwidth = 1200 setup(width=flagwidth, height=2/3*flagwidth, startx=None, starty=None) bgcolor("red") def draw_star(point,radius,angle=0): <|fim_suffix|>draw_star((-10*cell,5*cell),rbig) draw_star((-5*cell,8*c...
code_fim
hard
{ "lang": "python", "repo": "neo20/pystudy", "path": "/national_flag_of_China/draw.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmoretz/Python-Playground path: /src/DoingMathInPython/ch_01/factors.py ''' Find the factors of an integer ''' <|fim_suffix|> b = input( 'Your Number Please:' ) b = float( b ) if( b > 0 ) and b.is_integer() : factors( int( b ) ) else: print( 'Please enter a positive integer' )<|fi...
code_fim
medium
{ "lang": "python", "repo": "bmoretz/Python-Playground", "path": "/src/DoingMathInPython/ch_01/factors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if( b > 0 ) and b.is_integer() : factors( int( b ) ) else: print( 'Please enter a positive integer' )<|fim_prefix|># repo: bmoretz/Python-Playground path: /src/DoingMathInPython/ch_01/factors.py ''' Find the factors of an integer ''' def factors( b ) : for i in range( 1, b + 1 ): if b % ...
code_fim
medium
{ "lang": "python", "repo": "bmoretz/Python-Playground", "path": "/src/DoingMathInPython/ch_01/factors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ If gameid does not exist in the DB, pull match from API and insert into DB. Otherwise do nothing. :param gameid: gameid for the match to insert """ if Match.query.filter(Match.gameid == gameid).first(): self.logger.info("Match {} already exists in th...
code_fim
hard
{ "lang": "python", "repo": "ematysek/Riot-API-Webapp", "path": "/app/util/request_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def update_leagues(self, summonerid: int): """ Get most recent leagues info from API for summonerid and update user_leagues table accordingly :param summonerid: summonerid for the Summoner we want to grab updated league info for """ self.logger.info("Update leag...
code_fim
hard
{ "lang": "python", "repo": "ematysek/Riot-API-Webapp", "path": "/app/util/request_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ematysek/Riot-API-Webapp path: /app/util/request_handler.py import logging from typing import Optional from datetime import datetime from app.flask_models import Summoner, UserMatch, UserLeague, Match from app.wrappers import RiotConnector class RequestHandler: def __init__(self, db, api_e...
code_fim
hard
{ "lang": "python", "repo": "ematysek/Riot-API-Webapp", "path": "/app/util/request_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> run, runsub = run_setup( nfa_name=NFA_NAME_A, pattern=stub_pattern) self.assertFalse(run.is_halted()) run.set_halt() self.assertTrue(run.is_halted()) self.assertEqual(1, len(runsub.halt)) with self.assertRaises(RuntimeError): ...
code_fim
hard
{ "lang": "python", "repo": "magents-ai/bobocep", "path": "/tests/test_bobocep/test_decider/test_runs/test_bobo_run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: magents-ai/bobocep path: /tests/test_bobocep/test_decider/test_runs/test_bobo_run.py import unittest from bobocep.decider.buffers.shared_versioned_match_buffer import \ SharedVersionedMatchBuffer from bobocep.decider.runs.bobo_run import BoboRun from bobocep.decider.runs.run_subscriber impor...
code_fim
hard
{ "lang": "python", "repo": "magents-ai/bobocep", "path": "/tests/test_bobocep/test_decider/test_runs/test_bobo_run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> emo_folder = 'data/HCP.zips/' emo_LR_nii = 'data/timeseries/raw/face/LR' emo_RL_nii = 'data/timeseries/raw/face/RL' emo_both = 'data/timeseries/raw/face/both' # unpack_HCP_zips(emo_folder, LR_path=emo_LR_nii, RL_path=emo_RL_nii) # read in and concatenate LR-RL NIFTI files def read_NIFTI(): global...
code_fim
hard
{ "lang": "python", "repo": "furtherAdu/brainnetcnnVis_pytorch", "path": "/scrap.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: furtherAdu/brainnetcnnVis_pytorch path: /scrap.py import os import zipfile from os import listdir import nibabel as nib import numpy as np float_formatter = "{:.3f}".format np.set_printoptions(formatter={'float_kind': float_formatter}) # reading HCP subject-specific CIFTI files def read_CIFTI...
code_fim
hard
{ "lang": "python", "repo": "furtherAdu/brainnetcnnVis_pytorch", "path": "/scrap.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Unpacks HCP emotion_face NIFTI files to new folders for each scan gradient, for each subject in zipsfolder. :param zipsfolder: folder containing zipped HCP task data :param LR_path: path to save LR gradient data :param RL_path: path to save RL gradient data :return: """ ...
code_fim
hard
{ "lang": "python", "repo": "furtherAdu/brainnetcnnVis_pytorch", "path": "/scrap.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JetBrains/intellij-community path: /python/helpers/coveragepy_new/coverage/templite.py # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """A simple Python template renderer, for a nano-subse...
code_fim
hard
{ "lang": "python", "repo": "JetBrains/intellij-community", "path": "/python/helpers/coveragepy_new/coverage/templite.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Supported constructs are extended variable access:: {{var.modifier.modifier|filter|filter}} loops:: {% for var in list %}...{% endfor %} and ifs:: {% if var %}...{% endif %} Comments are within curly-hash markers:: {# This will be ignored #} Line...
code_fim
hard
{ "lang": "python", "repo": "JetBrains/intellij-community", "path": "/python/helpers/coveragepy_new/coverage/templite.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dataplumber/nexus path: /analysis/webservice/algorithms/TileSearch.py """ Copyright (c) 2016 Jet Propulsion Laboratory, California Institute of Technology. All rights reserved """ from webservice.NexusHandler import NexusHandler, nexus_handler from webservice.webmodel import NexusResults # @ne...
code_fim
hard
{ "lang": "python", "repo": "dataplumber/nexus", "path": "/analysis/webservice/algorithms/TileSearch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def calc(self, computeOptions, **args): minLat = computeOptions.get_min_lat() maxLat = computeOptions.get_max_lat() minLon = computeOptions.get_min_lon() maxLon = computeOptions.get_max_lon() ds = computeOptions.get_dataset()[0] startTime = computeOption...
code_fim
hard
{ "lang": "python", "repo": "dataplumber/nexus", "path": "/analysis/webservice/algorithms/TileSearch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == 'POST': print("POST method") form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): result = open_image2(request.FILES['file'].read()) # user = CustomUser.objects.get(username=request.user.username) return ...
code_fim
hard
{ "lang": "python", "repo": "Zhalkhas/HMD", "path": "/xray/views.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: Zhalkhas/HMD path: /xray/views.py from django.shortcuts import render from .forms import UploadFileForm from .model import open_image from .model2 import open_image2 from accounts.models import CustomUser def upload_file(request): <|fim_suffix|>def upload_pneumonia(request): if request.method...
code_fim
hard
{ "lang": "python", "repo": "Zhalkhas/HMD", "path": "/xray/views.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|>ath('registration_success/', views.registration_success, name='registration success') ]<|fim_prefix|># repo: 33du/blogging-with-django path: /users/urls.py from django.urls import path from . import views app_name = 'users' urlpatterns = [ <|fim_middle|> path('login/', views.log_in, name='login'), ...
code_fim
medium
{ "lang": "python", "repo": "33du/blogging-with-django", "path": "/users/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 33du/blogging-with-django path: /users/urls.py from django.urls import path from . import views app_name = 'users' urlpatterns = [ <|fim_suffix|>ath('registration_success/', views.registration_success, name='registration success') ]<|fim_middle|> path('login/', views.log_in, name='login'), ...
code_fim
medium
{ "lang": "python", "repo": "33du/blogging-with-django", "path": "/users/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Real-time evolution alldata = [] for step in range(nsteps): alldata.append([step * dt * U] + np.array(G.density).tolist()) G.many_time_steps(dt, nsteps=1, normalize_at_each_step=0, update_variables=1) alldata.append([nsteps * dt * U] + np.array(G.density).tolist()) # Print some output and save ...
code_fim
hard
{ "lang": "python", "repo": "tcompa/GutzwillerDynamics", "path": "/Examples/example_3_real_time_evolution_with_fixed_parameters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tcompa/GutzwillerDynamics path: /Examples/example_3_real_time_evolution_with_fixed_parameters.py #!/usr/bin/env python from __future__ import print_function # Comment these lines if you want to use more than one core import os os.environ['MKL_NUM_THREADS'] = '1' os.environ['NUMEXPR_NUM_THREADS'...
code_fim
hard
{ "lang": "python", "repo": "tcompa/GutzwillerDynamics", "path": "/Examples/example_3_real_time_evolution_with_fixed_parameters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Do plot of densities alldata = np.array(alldata).T for i in range(L): plt.plot(alldata[0], alldata[i + 1], alpha=0.8, label='Site %i' % i) plt.plot(alldata[0], alldata[1:].mean(axis=0), ls='--', c='k', lw=2) plt.xlabel('Time $t \\qquad [1/U]$', fontsize=14) plt.ylabel('Local density $n_i(t)$', fonts...
code_fim
hard
{ "lang": "python", "repo": "tcompa/GutzwillerDynamics", "path": "/Examples/example_3_real_time_evolution_with_fixed_parameters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def f3(series): return series.kurtosis() def f4(series): return series[series.notna()].kurtosis() """ print(timeit.timeit("f1(series)", number=10, setup=testcode)) print(timeit.timeit("f2(series)", number=10, setup=testcode)) print(timeit.timeit("f3(series)", number=10, setup=testcode)) print(...
code_fim
hard
{ "lang": "python", "repo": "chanedwin/pandas-profiling", "path": "/tests/performance/time_kurtosis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chanedwin/pandas-profiling path: /tests/performance/time_kurtosis.py import timeit testcode = """ import numpy as np import pandas as pd import scipy.stats np.random.seed(12) vals = np.random.random(1000) series = pd.Series(vals) series[series < 0.2] = pd.NA def f1(series): arr = series.va...
code_fim
medium
{ "lang": "python", "repo": "chanedwin/pandas-profiling", "path": "/tests/performance/time_kurtosis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(timeit.timeit("f1(series)", number=10, setup=testcode)) print(timeit.timeit("f2(series)", number=10, setup=testcode)) print(timeit.timeit("f3(series)", number=10, setup=testcode)) print(timeit.timeit("f4(series)", number=10, setup=testcode))<|fim_prefix|># repo: chanedwin/pandas-profiling path: /te...
code_fim
hard
{ "lang": "python", "repo": "chanedwin/pandas-profiling", "path": "/tests/performance/time_kurtosis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>tput_gp import MetaSingleOutputGPOngrid<|fim_prefix|># repo: janvanrijn/openml-multitask path: /multitask/models_ongrid/__init__.py from .multioutput_gp import MetaMultiO<|fim_middle|>utputGPOngrid from .randomforest import MetaRandomForestOngrid from .sinlgeou
code_fim
medium
{ "lang": "python", "repo": "janvanrijn/openml-multitask", "path": "/multitask/models_ongrid/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: janvanrijn/openml-multitask path: /multitask/models_ongrid/__init__.py from .multioutput_gp import MetaMultiO<|fim_suffix|>tput_gp import MetaSingleOutputGPOngrid<|fim_middle|>utputGPOngrid from .randomforest import MetaRandomForestOngrid from .sinlgeou
code_fim
medium
{ "lang": "python", "repo": "janvanrijn/openml-multitask", "path": "/multitask/models_ongrid/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # type: int ENOBUFS = 105 # type: int ENODEV = 19 # type: int ENOENT = 2 # type: int ENOMEM = 12 # type: int ENOTCONN = 128 # type: int EOPNOTSUPP = 95 # type: int EPERM = 1 # type: int ETIMEDOUT = 116 # type: int errorcode = {} # type: dict<|fim_prefix|># repo: Josverl/micropython-stubber path...
code_fim
hard
{ "lang": "python", "repo": "Josverl/micropython-stubber", "path": "/tests/data/stub_merge/micropython-v1_18-esp32/uerrno.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Josverl/micropython-stubber path: /tests/data/stub_merge/micropython-v1_18-esp32/uerrno.py """ Module: 'uerrno' on micropython-v1.18-esp32 """ # MCU: {'ver': 'v1.18', 'port': 'esp32', 'arch': 'xtensawin', 'sysname': 'esp32', 'release': '1.18.0', 'name': 'micropython', 'mpy': 10757, 'version': '1....
code_fim
hard
{ "lang": "python", "repo": "Josverl/micropython-stubber", "path": "/tests/data/stub_merge/micropython-v1_18-esp32/uerrno.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> line = " Mask Flags: " if (nMaskFlags & gdal.GMF_PER_DATASET) != 0: line = line + "PER_DATASET " if (nMaskFlags & gdal.GMF_ALPHA) != 0: line = line + "ALPHA " ...
code_fim
hard
{ "lang": "python", "repo": "nmanaud/GDAL_scripts", "path": "/gdal2ISIS3/LMMP_gdal2PDS.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: nmanaud/GDAL_scripts path: /gdal2ISIS3/LMMP_gdal2PDS.py if dfMin is not None: line = line + ("Min=%.3f " % dfMin) if dfMax is not None: line = line + ("Max=%.3f " % dfMax) ...
code_fim
hard
{ "lang": "python", "repo": "nmanaud/GDAL_scripts", "path": "/gdal2ISIS3/LMMP_gdal2PDS.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> if bShowMetadata: for extra_domain in papszExtraMDDomains: papszMetadata = hDataset.GetMetadata_List(extra_domain) if papszMetadata is not None and len(papszMetadata) > 0 : print( "Metadata (%s):" % extra_domain) f...
code_fim
hard
{ "lang": "python", "repo": "nmanaud/GDAL_scripts", "path": "/gdal2ISIS3/LMMP_gdal2PDS.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: danielnaab/ngwmn-ui path: /server/ngwmn/__init__.py """ Initialize the NGWMN UI application """ from flask import Flask <|fim_suffix|>app = Flask(__name__.split()[0], instance_relative_config=True) # load configurations app.config.from_object('config') try: app.config.from_pyfile('config.p...
code_fim
easy
{ "lang": "python", "repo": "danielnaab/ngwmn-ui", "path": "/server/ngwmn/__init__.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>app = Flask(__name__.split()[0], instance_relative_config=True) # load configurations app.config.from_object('config') try: app.config.from_pyfile('config.py') except FileNotFoundError: pass from . import views<|fim_prefix|># repo: danielnaab/ngwmn-ui path: /server/ngwmn/__init__.py """ Initial...
code_fim
easy
{ "lang": "python", "repo": "danielnaab/ngwmn-ui", "path": "/server/ngwmn/__init__.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marian-code/wikipedia-music-tags path: /wiki_music/gui_lib/custom_classes/lists.py """Module providing custom Qt tables, their models and views.""" import logging from typing import List, Optional from wiki_music.gui_lib.qt_importer import (QStandardItem, QStandardItemModel, ...
code_fim
hard
{ "lang": "python", "repo": "marian-code/wikipedia-music-tags", "path": "/wiki_music/gui_lib/custom_classes/lists.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- List[int] list with checked indices """ checked = list() for i in range(self.rowCount()): if bool(self.item(i, 0).checkState()): checked.append(i) return checked<|fim_prefix|># repo: marian-cod...
code_fim
hard
{ "lang": "python", "repo": "marian-code/wikipedia-music-tags", "path": "/wiki_music/gui_lib/custom_classes/lists.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Merge these two dictionaries together so the contents are in numerical order: dict1 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30} dict2 = {'Thirty': 30, 'Fourty': 40, 'Fifty': 50} # add code here dict1.update(dict2) return dict1 # return new dictionary def access_key(): # retu...
code_fim
medium
{ "lang": "python", "repo": "Athenian-ComputerScience-Fall2020/dictionary-practice-Milan938", "path": "/my_code.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Athenian-ComputerScience-Fall2020/dictionary-practice-Milan938 path: /my_code.py # Collaborators (including web sites where you got help: (enter none if you didn't need help) # geeksforgeeks.org def make_dict(): ''' use the following information to create a dictionary called currency: ...
code_fim
medium
{ "lang": "python", "repo": "Athenian-ComputerScience-Fall2020/dictionary-practice-Milan938", "path": "/my_code.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def access_key(): # return the value of the key 'Twenty' currency = {'Ten': 10, 'Twenty': 20, 'Thirty': 30} val = currency.get('Twenty') # add code to assign the desired value to 'val' return val if __name__ == '__main__': # Test your code with this first # Change t...
code_fim
hard
{ "lang": "python", "repo": "Athenian-ComputerScience-Fall2020/dictionary-practice-Milan938", "path": "/my_code.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>log.info("running on {} processors".format(ns.numproc)) write_gaia_matches(infiles, numproc=ns.numproc, outdir=ns.dest) log.info('Wrote sweeps files matched to Gaia to {}...t={:.1f}s'.format(ns.dest, time()-start))<|fim_prefix|># repo: rongpu/desitarget path: /bin/write_gaia_matches #!/usr/bin/env pyth...
code_fim
hard
{ "lang": "python", "repo": "rongpu/desitarget", "path": "/bin/write_gaia_matches", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>from desiutil.log import get_logger log = get_logger() from argparse import ArgumentParser ap = ArgumentParser(description='Match sweeps files to Gaia and rewrite files with the Gaia columns added') ap.add_argument("src", help="Sweeps file or root directory with sweeps files") ap.add_arg...
code_fim
medium
{ "lang": "python", "repo": "rongpu/desitarget", "path": "/bin/write_gaia_matches", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rongpu/desitarget path: /bin/write_gaia_matches #!/usr/bin/env python import sys from desitarget import io from desitarget.gaiamatch import write_gaia_matches from time import time start = time() #import warnings #warnings.simplefilter('error') import multiprocessing nproc = multiprocessing.cp...
code_fim
hard
{ "lang": "python", "repo": "rongpu/desitarget", "path": "/bin/write_gaia_matches", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cjopengler/easybook path: /daily/bernoulli_distribution/loop_show.py #!/usr/bin/env python 3 # -*- coding: utf-8 -*- # # Copyright (c) 2020 PanXu, Inc. All Rights Reserved # """ brief <|fim_suffix|> for i in range(10): print(f"{i}: {m.sample()}") def masked_sequence(length: int, pr...
code_fim
hard
{ "lang": "python", "repo": "cjopengler/easybook", "path": "/daily/bernoulli_distribution/loop_show.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def loop_by_class(): x = torch.tensor([0.3]) m = torch.distributions.Bernoulli() for i in range(10): print(f"{i}: {m.sample()}") def masked_sequence(length: int, prob: float): probs = torch.full((length,), prob) masked = torch.bernoulli(probs) print(f"mask=1的数量: {mask...
code_fim
medium
{ "lang": "python", "repo": "cjopengler/easybook", "path": "/daily/bernoulli_distribution/loop_show.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rodrigoieh/template-generator path: /onlinejudge_template_resources/template/generate.py <%! import onlinejudge_template.generator.python as python import onlinejudge_template.generator.about as about %>\ #!/usr/bin/env python3 # usage: $ oj generate-input 'python3 generate.py' import ran...
code_fim
medium
{ "lang": "python", "repo": "rodrigoieh/template-generator", "path": "/onlinejudge_template_resources/template/generate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>${python.generate_input(data)} ${python.write_input(data)} if __name__ == "__main__": main()<|fim_prefix|># repo: rodrigoieh/template-generator path: /onlinejudge_template_resources/template/generate.py <%! import onlinejudge_template.generator.python as python import onlinejudge_template.ge...
code_fim
medium
{ "lang": "python", "repo": "rodrigoieh/template-generator", "path": "/onlinejudge_template_resources/template/generate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stringertheory/names path: /poem_ids.py EARLY = "10" CHICAGO = "2043" TRW = "174770" WOODS = "171621" ROAD = "173536" SHAKE18 = 45<|fim_suffix|>RUS = "175887" PLATH = "178960" PRELUTSKY = "177537" TENNYSON = "174586" WORDSWORTH = "174790" BLANK = "248540" RHYMES = "174972" SYLLABIC = "248426" ROB...
code_fim
medium
{ "lang": "python", "repo": "stringertheory/names", "path": "/poem_ids.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>90" BLANK = "248540" RHYMES = "174972" SYLLABIC = "248426" ROBOTS = "250556" POEM_ID = SHEL<|fim_prefix|># repo: stringertheory/names path: /poem_ids.py EARLY = "10" CHICAGO = "2043" TRW = "174770" WOODS = "171621" ROAD = "173536" SHAKE18 = 45<|fim_middle|>087 SHAKE33 = "174360" STATS = 42724 LONG = "174...
code_fim
medium
{ "lang": "python", "repo": "stringertheory/names", "path": "/poem_ids.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paulfitz/sheetsite path: /sheetsite/destination/ftp.py import os import subprocess def write_destination_ftp(params, state): out<|fim_suffix|>, '--binary', '-u', '-nc', output_file, url] print(' '.join(cmd)) out = subprocess.check_output(cmd) print("ftp: {}".format(out)) retu...
code_fim
medium
{ "lang": "python", "repo": "paulfitz/sheetsite", "path": "/sheetsite/destination/ftp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>= subprocess.check_output(cmd) print("ftp: {}".format(out)) return True<|fim_prefix|># repo: paulfitz/sheetsite path: /sheetsite/destination/ftp.py import os import subprocess def write_destination_ftp(params, state): out<|fim_middle|>put_file = state['output_file'] url = params['url'] ...
code_fim
medium
{ "lang": "python", "repo": "paulfitz/sheetsite", "path": "/sheetsite/destination/ftp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: victor3rc/lux path: /lux/extensions/rest/backends/browser.py from pulsar.utils.httpurl import is_absolute_uri from lux import Parameter from lux.extensions.angular import add_ng_modules from .. import AuthBackend, luxrest from ..views import Login, SignUp, ForgotPassword class BrowserBackend(...
code_fim
hard
{ "lang": "python", "repo": "victor3rc/lux", "path": "/lux/extensions/rest/backends/browser.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def on_html_document(self, app, request, doc): if is_absolute_uri(app.config['API_URL']): add_ng_modules(doc, ('lux.restapi', 'lux.users')) else: add_ng_modules(doc, ('lux.webapi', 'lux.users'))<|fim_prefix|># repo: victor3rc/lux path: /lux/extensions/rest/back...
code_fim
hard
{ "lang": "python", "repo": "victor3rc/lux", "path": "/lux/extensions/rest/backends/browser.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fogstream/fs-pochta-api path: /pochta/api/orders.py from __future__ import annotations from typing import TYPE_CHECKING, List from pochta.helpers import Order from pochta.utils import HTTPMethod if TYPE_CHECKING: from pochta import Delivery class Orders: """ Методы API Заказов. ...
code_fim
hard
{ "lang": "python", "repo": "fogstream/fs-pochta-api", "path": "/pochta/api/orders.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> https://otpravka.pochta.ru/specification#/orders-search_order_byid :param order_id: Внутренний идентификатор отправления :return: Результат операции """ url = f'/1.0/backlog/{order_id}' res = self._client.request(HTTPMethod.GET, url) return res.jso...
code_fim
hard
{ "lang": "python", "repo": "fogstream/fs-pochta-api", "path": "/pochta/api/orders.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xius666/email-management-system path: /phase1.py import sys import re def cut(line, key): array=line.split('</'+key+'>')[0].split('<'+key+'>')[1] return array def phase1(file,terms,emails,dates,recs): for x in range(2): file.readline() while True: line=file.readline() if line.strip()=='...
code_fim
hard
{ "lang": "python", "repo": "xius666/email-management-system", "path": "/phase1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return returnl def main(path): path='./'+path file=open(path,'r') #open all the files with write mode terms = open('terms.txt', 'w') emails = open('emails.txt', 'w') dates = open('dates.txt', 'w') recs = open('recs.txt', 'w') phase1(file,terms,emails,dates,recs) terms.close() emails.close() da...
code_fim
hard
{ "lang": "python", "repo": "xius666/email-management-system", "path": "/phase1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #replace all the specail char with space term = term.replace('&apos;', ' ').replace('&quot;', ' ').replace('&amp;', ' ').replace('&lt;',' ').replace('&gt;',' ').replace('&#10',' ') term = re.sub(r'[&][#][0-9]+[;]','', term) correct='0123456789abcdefghijklmnopqrstuvwxyz-_' term=term.lower() for a i...
code_fim
hard
{ "lang": "python", "repo": "xius666/email-management-system", "path": "/phase1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: luungoc2005/chatbot_test path: /testbot/transform.py from .NLTKPreprocessor import NLTKPreprocessor from .entities.Stanford_NER import Stanford_NER_Chunker, load_stanford_tagger from .entities.NLTK_NER import NLTK_NER_Chunker from sklearn.feature_extraction.text import TfidfVectorizer from recurr...
code_fim
hard
{ "lang": "python", "repo": "luungoc2005/chatbot_test", "path": "/testbot/transform.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # preprocessed = preprocessor.transform([text]) chunked = chunker.transform([text]) named_entities = [] for sentence in chunked: for (text, tag) in sentence: item = { 'text': text, 'entity': tag, } if tag in [...
code_fim
hard
{ "lang": "python", "repo": "luungoc2005/chatbot_test", "path": "/testbot/transform.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def tokenize_text(text): global STOPWORDS r = RecurringEvent(now_date=datetime.now(pytz.utc)) load_stanford_tagger() chunker = Stanford_NER_Chunker() # chunker = NLTK_NER_Chunker() # preprocessor = NLTKPreprocessor() # default stopwords if len(STOPWORDS) == 0: STOPWORDS...
code_fim
medium
{ "lang": "python", "repo": "luungoc2005/chatbot_test", "path": "/testbot/transform.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Get all co-authors contributors = git( "log", f"{base}..{head}", "--format=%(trailers:key=Co-authored-by)" ) coauthors = [] for coauthor in contributors: if coauthor and not re.search("@google.com", coauthor): coauthors.append( " ".join(re.sub(r"Co-authored-by: |<.*?...
code_fim
hard
{ "lang": "python", "repo": "bazelbuild/bazel", "path": "/scripts/release/relnotes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Assuming HEAD is on the current (to-be-released) release, find the merge # base with the last release so that we know which commits to generate notes # for. merge_base = git("merge-base", "HEAD", last_release)[0] print("Baseline: ", merge_base) # Generate notes for all commits from last bra...
code_fim
hard
{ "lang": "python", "repo": "bazelbuild/bazel", "path": "/scripts/release/relnotes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bazelbuild/bazel path: /scripts/release/relnotes.py # Copyright 2022 The Bazel 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": "bazelbuild/bazel", "path": "/scripts/release/relnotes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OsodracPT/Python-Facial-Recognition path: /identify.py import face_recognition from PIL import Image, ImageDraw image_of_bill = face_recognition.load_image_file('./img/known/Bill Gates.jpg') bill_face_encoding = face_recognition.face_encodings(image_of_bill)[0] image_of_steve = face_recognition...
code_fim
hard
{ "lang": "python", "repo": "OsodracPT/Python-Facial-Recognition", "path": "/identify.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Draw the box draw.rectangle(((left, top), (rigth, bottom)), outline=(0, 0, 0)) # Draw the label text_width, text_heigth = draw.textsize(name) draw.rectangle(((left, bottom - text_heigth - 10), (rigth, bottom)), fill=(0, 0, 0), outline=(0, 0, 0)) draw.text((le...
code_fim
hard
{ "lang": "python", "repo": "OsodracPT/Python-Facial-Recognition", "path": "/identify.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> image1 = sb.training.Image(400, 400) image1.ctx.set_source_rgb(0, 0, 0) image1.ctx.rectangle(0, 0, 100, 100) image1.ctx.fill() image2 = sb.training.Image(400, 400) image2.copy_image(image1) arr1 = image1.to_array() arr2 = image2.to_array() ...
code_fim
medium
{ "lang": "python", "repo": "ahmedkhalf/Shape-Bruteforce", "path": "/tests/test_training.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahmedkhalf/Shape-Bruteforce path: /tests/test_training.py import shape_bruteforce as sb import unittest import numpy as np class TestImage(unittest.TestCase): <|fim_suffix|> image1 = sb.training.Image(400, 400) image1.ctx.set_source_rgb(0, 0, 0) image1.ctx.rectangle(0, 0,...
code_fim
hard
{ "lang": "python", "repo": "ahmedkhalf/Shape-Bruteforce", "path": "/tests/test_training.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tamjankowska/jets path: /library/migrations/0007_location_continent.py # Generated by Django 3.1.4 on 2020-12-01 16:13 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('library', '0006_auto_20201201_1413'), ] operations = [ migrations.AddFie...
code_fim
easy
{ "lang": "python", "repo": "tamjankowska/jets", "path": "/library/migrations/0007_location_continent.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('library', '0006_auto_20201201_1413'), ] operations = [ migrations.AddField( model_name='location', name='continent', field=models.CharField(default='', max_length=16), preserve_default=False, ), ]<...
code_fim
medium
{ "lang": "python", "repo": "tamjankowska/jets", "path": "/library/migrations/0007_location_continent.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> for region in ACCOUNTS.keys(): result = get_stabilityai_image_uri(region=region, version=version) expected = expected_uris.stabilityai_framework_uri( "stabilityai-pytorch-inference", ACCOUNTS[region], SAI_VERSIONS_MAPPING[version], region...
code_fim
hard
{ "lang": "python", "repo": "aws/sagemaker-python-sdk", "path": "/tests/unit/sagemaker/image_uris/test_stabilityai.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize("version", SAI_VERSIONS) def test_stabilityai_image_uris(version): for region in ACCOUNTS.keys(): result = get_stabilityai_image_uri(region=region, version=version) expected = expected_uris.stabilityai_framework_uri( "stabilityai-pytorch-inference",...
code_fim
hard
{ "lang": "python", "repo": "aws/sagemaker-python-sdk", "path": "/tests/unit/sagemaker/image_uris/test_stabilityai.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aws/sagemaker-python-sdk path: /tests/unit/sagemaker/image_uris/test_stabilityai.py # Copyright Amazon.com, Inc. or its affiliates. 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. A copy of...
code_fim
hard
{ "lang": "python", "repo": "aws/sagemaker-python-sdk", "path": "/tests/unit/sagemaker/image_uris/test_stabilityai.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class QueryNeedyStudyRoomHandling(ErrorResponseBase): class Config: schema_extra = { 'example': { "detail": [ { "loc": [ "query", "skip" ], ...
code_fim
hard
{ "lang": "python", "repo": "YAPP-18th/ML-Team-Backend", "path": "/app/schemas/study_rooms/handling.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: YAPP-18th/ML-Team-Backend path: /app/schemas/study_rooms/handling.py from app.schemas.responses import ErrorResponseBase class NotFoundStudyRoomHandling(ErrorResponseBase): class Config: schema_extra = { 'example': { "detail": [ { ...
code_fim
hard
{ "lang": "python", "repo": "YAPP-18th/ML-Team-Backend", "path": "/app/schemas/study_rooms/handling.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewmcnaught1/duedilv3 path: /duedil/resources/pro/company/accounts/financial.py from __future__ import unicode_literals from .... import ProResource class AccountDetailsFinancial(ProResource): full_endpoint = True attribute_names = [ 'id', # string Accounts ID ...
code_fim
hard
{ "lang": "python", "repo": "andrewmcnaught1/duedilv3", "path": "/duedil/resources/pro/company/accounts/financial.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>liabilities', # integer Miscellaneous liabilities 'months', # integer Months included in accounts 'net_cashflow_from_financing', # integer Net cashflow from financing 'net_change_in_cash', # integer Net change in cash 'net_fees_and_commission...
code_fim
hard
{ "lang": "python", "repo": "andrewmcnaught1/duedilv3", "path": "/duedil/resources/pro/company/accounts/financial.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pancodia/django-ckeditor5 path: /ckeditor5/__init__.py # -*- coding: utf-8 -*- # @Author: panc25 # @Date: <|fim_suffix|> @Last Modified time: 2018-09-06 15:08:56 VERSION = (0, 0, 1) __version__ = '.'.join(map(str, VERSION))<|fim_middle|> 2018-09-05 13:49:43 # @Last Modified by: panc25 #
code_fim
easy
{ "lang": "python", "repo": "pancodia/django-ckeditor5", "path": "/ckeditor5/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> (0, 0, 1) __version__ = '.'.join(map(str, VERSION))<|fim_prefix|># repo: pancodia/django-ckeditor5 path: /ckeditor5/__init__.py # -*- coding: utf-8 -*- # @Author: panc25 # @Date: <|fim_middle|> 2018-09-05 13:49:43 # @Last Modified by: panc25 # @Last Modified time: 2018-09-06 15:08:56 VERSION =
code_fim
medium
{ "lang": "python", "repo": "pancodia/django-ckeditor5", "path": "/ckeditor5/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pdales/xseis path: /pyinclude/xseis/xplot3d.py """ utils.""" import numpy as np # import math # from scipy.fftpack import fft, ifft, fftfreq # import os # import pickle import matplotlib.pyplot as plt from mayavi import mlab # import matplotlib.gridspec as gridspec # import subprocess # import h...
code_fim
hard
{ "lang": "python", "repo": "pdales/xseis", "path": "/pyinclude/xseis/xplot3d.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> shape, origin, spacing = gdef[:3], gdef[3:6], gdef[6] grid = output.reshape(shape) lims = np.zeros((3, 2)) lims[:, 0] = origin lims[:, 1] = origin + shape * spacing lims[0] -= lims[0, 0] lims[1] -= lims[1, 0] fig = mlab.figure(size=(1000, 901)) ranges = list(lims.flatten()) src = mlab_contour...
code_fim
hard
{ "lang": "python", "repo": "pdales/xseis", "path": "/pyinclude/xseis/xplot3d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not self.moving: return # compute next position of ball at current velocity newx = self.x + self.vx newy = self.y + self.vy #detect vertical bounce if newy + Ball.RADIUS > HEIGHT - BORDER \ or newy - Ball.RADIUS < BORDER: ...
code_fim
hard
{ "lang": "python", "repo": "agryman/sean", "path": "/pong/pong722.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: agryman/sean path: /pong/pong722.py # 7.2.2 The Paddle class import pygame pygame.init() BORDER = 10 WIDTH = 800 HEIGHT = 400 VELOCITY = 4 BLACK = pygame.Color('black') WHITE = pygame.Color('white') screen = pygame.display.set_mode((WIDTH, HEIGHT)) screen.fill(BLACK) pygame.draw.rect(screen...
code_fim
hard
{ "lang": "python", "repo": "agryman/sean", "path": "/pong/pong722.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def rightStripCurlyBraces(line): """ Returns line but with curly braces right stripped off. """ match = rstrip_regex.match(line) if not match: return line return match.groups()[0] if __name__ == "__main__": test_lines = """ 36 1001 {NLHEAD...
code_fim
medium
{ "lang": "python", "repo": "cedadev/nappy", "path": "/nappy/utils/right_strip.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cedadev/nappy path: /nappy/utils/right_strip.py #!/usr/bin/env python """ right_strip.py ============== Holds the rightStripCurlyBraces() function used to right strip any curly braces annotations from lines in a text file. <|fim_suffix|> if __name__ == "__main__": test_lines = """ 36...
code_fim
hard
{ "lang": "python", "repo": "cedadev/nappy", "path": "/nappy/utils/right_strip.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Returns line but with curly braces right stripped off. """ match = rstrip_regex.match(line) if not match: return line return match.groups()[0] if __name__ == "__main__": test_lines = """ 36 1001 {NLHEAD FFI} MDB {remove me} 34...
code_fim
medium
{ "lang": "python", "repo": "cedadev/nappy", "path": "/nappy/utils/right_strip.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>arange(-n/2, 0), data[:,2][int(n/2):]/data[:,2].max(), 'bx') plt.plot(np.arange(-n/2, 0), np.flip(data[:,0][:int(n/2)]/data[:,0].max(), 0), 'ko') plt.legend(loc='best') plt.show()<|fim_prefix|># repo: PacktPublishing/High-Performance-Scientific-Computing-With-C path: /Section 2/video3/plot_ft...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/High-Performance-Scientific-Computing-With-C", "path": "/Section 2/video3/plot_ft.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>t') plt.plot(np.arange(0, n/2), data[:,0][:int(n/2)]/data[:,0].max(), 'ko', label='Function') plt.plot(np.arange(-n/2, 0), data[:,1][int(n/2):]/data[:,1].max(), 'rx') plt.plot(np.arange(-n/2, 0), data[:,2][int(n/2):]/data[:,2].max(), 'bx') plt.plot(np.arange(-n/2, 0), np.flip(data[:,0][:in...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/High-Performance-Scientific-Computing-With-C", "path": "/Section 2/video3/plot_ft.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/High-Performance-Scientific-Computing-With-C path: /Section 2/video3/plot_ft.py #!/usr/bin/env python3 from sys import argv import numpy as np import matplotlib.pyplot as plt if __name__ == "__main__": data = np.genfromtxt(argv[1]) n = data.shape[0] plt.plo<|fim_suffi...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/High-Performance-Scientific-Computing-With-C", "path": "/Section 2/video3/plot_ft.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not nums: return [[]] else: res = [] for i, c in enumerate(nums): if c in d: continue else: d[c] = True rest_perms = self.permuteUnique(nums[:i] + nums[i + 1:]) ...
code_fim
hard
{ "lang": "python", "repo": "mahimadubey/leetcode-python", "path": "/permutations_ii/solution.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mahimadubey/leetcode-python path: /permutations_ii/solution.py """ Given a collection of numbers that might contain duplicates, return all possible unique permutations. <|fim_suffix|> def permuteUnique(self, nums): """ :type nums: List[int] :rtype: List[List[int]] ...
code_fim
hard
{ "lang": "python", "repo": "mahimadubey/leetcode-python", "path": "/permutations_ii/solution.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DedSecInside/Awesome-Scripts path: /Misc/Get_Location_Info/script.py #!/usr/bin/env python3 # Created by `Fenil Gandhi` # 20 October, 2018 """ A simple script that prints location of user based on active internet connection """ import requests def getLocationInfo(): """ Returns the lo...
code_fim
medium
{ "lang": "python", "repo": "DedSecInside/Awesome-Scripts", "path": "/Misc/Get_Location_Info/script.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Main function. Args: """ print('Fetching your location details based on your isp.') data = getLocationInfo() print( '', '-----------------------------------------------------------------------', '%-12s : %24s' % ("GLOBAL IP", data.get("query")), ...
code_fim
medium
{ "lang": "python", "repo": "DedSecInside/Awesome-Scripts", "path": "/Misc/Get_Location_Info/script.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hridoy-31/Python-Programming-University-of-Michigan path: /Getting Started With Python/Assignment 3-1.py hrs = input("Enter Hours:") hrs = float(hrs) <|fim_suffix|>if (hrs <= 40): pay = hrs*rph print(pay) else: extrahour = (hrs - 40) pay = (40 * rph) + (extrahour * 1.5 * rph) ...
code_fim
easy
{ "lang": "python", "repo": "Hridoy-31/Python-Programming-University-of-Michigan", "path": "/Getting Started With Python/Assignment 3-1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if (hrs <= 40): pay = hrs*rph print(pay) else: extrahour = (hrs - 40) pay = (40 * rph) + (extrahour * 1.5 * rph) print(pay)<|fim_prefix|># repo: Hridoy-31/Python-Programming-University-of-Michigan path: /Getting Started With Python/Assignment 3-1.py hrs = input("Enter Hours:") hrs = f...
code_fim
easy
{ "lang": "python", "repo": "Hridoy-31/Python-Programming-University-of-Michigan", "path": "/Getting Started With Python/Assignment 3-1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cephdon/TikiBot path: /TikiBot/dispensing_screen.py try: # Python 2 from Tkinter import * # noqa except ImportError: # Python 3 from tkinter import * # noqa import time from rectbutton import RectButton UPDATE_MS = 20 DISPLAY_MS = 125 class DispensingScreen(Frame): def __init...
code_fim
hard
{ "lang": "python", "repo": "cephdon/TikiBot", "path": "/TikiBot/dispensing_screen.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1) recipe.startDispensing(amount) self.pid = self.after(UPDATE_MS, self.update_screen) def update_screen(self): self.pid = None recipe = self.recipe recipe.updateDispensing(...
code_fim
hard
{ "lang": "python", "repo": "cephdon/TikiBot", "path": "/TikiBot/dispensing_screen.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: typemytype/booleanOperations path: /Lib/booleanOperations/flatten.py one, I use the original logic. if fp is None: fp = flatSegment[-1] # flat segment only contains two intersection points or one intersection point and on...
code_fim
hard
{ "lang": "python", "repo": "typemytype/booleanOperations", "path": "/Lib/booleanOperations/flatten.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Reverse the points. This differs from the reversal point pen in RoboFab in that it doesn't worry about maintaing the start point position. That has no benefit within the context of this module. """ # copy the points points = _copyPoints(points) # find the first on c...
code_fim
hard
{ "lang": "python", "repo": "typemytype/booleanOperations", "path": "/Lib/booleanOperations/flatten.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }