text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: vvives/metaplasticity-rest-api path: /src/app/main/controllers/mnist_controller.py """ MIT License Copyright (c) 2021 Víctor Vives Boix Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in t...
code_fim
hard
{ "lang": "python", "repo": "vvives/metaplasticity-rest-api", "path": "/src/app/main/controllers/mnist_controller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ MNIST image classification using AlexNet with synaptic metaplasticity. """ prediction = mnist_service.alexnet(json.dumps(api.payload)) return prediction, 201 @api.route('/lenet') @api.expect(request_dto, validate=True) class LeNetController(Resource): ""...
code_fim
hard
{ "lang": "python", "repo": "vvives/metaplasticity-rest-api", "path": "/src/app/main/controllers/mnist_controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> reads = list() start, end = None, None for aln in sam.fetch(contig=contig): if aln.is_unmapped or aln.is_supplementary or aln.is_secondary or aln.reference_name == None: continue assert aln.reference_name == contig, '{} : {}'.format( aln.reference_name, ...
code_fim
hard
{ "lang": "python", "repo": "seifudd/freddie", "path": "/py/freddie_split.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: seifudd/freddie path: /py/freddie_split.py #!/usr/bin/env python3 import argparse import os import re from operator import itemgetter from collections import deque from multiprocessing import Pool import pysam cigar_re = re.compile(r'(\d+)([M|I|D|N|S|H|P|=|X]{1})') query_consuming = [ pysa...
code_fim
hard
{ "lang": "python", "repo": "seifudd/freddie", "path": "/py/freddie_split.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def parse_interval_field(interval): return '{}-{}:{}-{}:{}'.format(interval[0], interval[1], interval[2], interval[3], ''.join(('{}{}'.format(c, cop_to_str[t]) for t, c in interval[4]))) def main(): args = parse_args() args.outdir = args.outdir.rstrip('/') os.makedirs(args.outdir, exist...
code_fim
hard
{ "lang": "python", "repo": "seifudd/freddie", "path": "/py/freddie_split.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Build list of all routes in the app. routes = Blog.get_routes() routes += Auth.get_routes() routes += [ webapp2.Route(r'/', handler='app.index.Index', name='index') ] app = webapp2.WSGIApplication(routes = routes, debug=True, config=config)<|fim_prefix|># repo: quiaro/safe-blog path: /app/main.py impo...
code_fim
hard
{ "lang": "python", "repo": "quiaro/safe-blog", "path": "/app/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: quiaro/safe-blog path: /app/main.py import webapp2 from google.appengine.api import namespace_manager from app.auth.auth import Auth from app.blog.blog import Blog import app.auth.constants as AuthConst import app.blog.constants as BlogConst <|fim_suffix|>config = dict( default_rout...
code_fim
hard
{ "lang": "python", "repo": "quiaro/safe-blog", "path": "/app/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def shift(audio, max_shift=None): max_shift = max_shift if max_shift else int(0.01 * len(audio)) shift = np.random.randint(low=1, high=max_shift) return audio[shift:] def distort(audio, rate, tempo=False, pitch=False): audio = audio.astype(np.float32) distorted = audio if tempo:...
code_fim
hard
{ "lang": "python", "repo": "mbencherif/forced-alignment", "path": "/src/util/audio_util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mbencherif/forced-alignment path: /src/util/audio_util.py """ Utility functions for audio manipulation """ import logging import random import wave import librosa import numpy as np from librosa.effects import time_stretch, pitch_shift from pydub import AudioSegment log = logging.getLogger(__na...
code_fim
hard
{ "lang": "python", "repo": "mbencherif/forced-alignment", "path": "/src/util/audio_util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def seconds_to_frame(time_s, sampling_rate=16000): return int(float(time_s) * sampling_rate) def ms_to_frames(val_ms, sample_rate): return int(round(val_ms * sample_rate / 1e3)) def frame_to_ms(val_frame, sample_rate): return float(val_frame / sample_rate) def shift(audio, max_shift=None...
code_fim
hard
{ "lang": "python", "repo": "mbencherif/forced-alignment", "path": "/src/util/audio_util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>='migrate_repo', url='sqlite:///spade.db')<|fim_prefix|># repo: sam-xif/Spade path: /manage.py #!/usr/bin/env python from migrate.versioning.shell import main if __name__ == '__m<|fim_middle|>ain__': main(debug='False', repository
code_fim
easy
{ "lang": "python", "repo": "sam-xif/Spade", "path": "/manage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sam-xif/Spade path: /manage.py #!/usr/bin/env python from migrate.version<|fim_suffix|>ain__': main(debug='False', repository='migrate_repo', url='sqlite:///spade.db')<|fim_middle|>ing.shell import main if __name__ == '__m
code_fim
easy
{ "lang": "python", "repo": "sam-xif/Spade", "path": "/manage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.queue = self.sqs.get_queue_by_name(QueueName=self.QueueName) def pushMessage(self, msg): jMsg = json.dumps(msg) self.queue.send_message(MessageBody=jMsg)<|fim_prefix|># repo: pmaxit/DJANGO_IOT path: /django_iot/apps/devices/queue.py import boto3 import time import json ...
code_fim
medium
{ "lang": "python", "repo": "pmaxit/DJANGO_IOT", "path": "/django_iot/apps/devices/queue.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmaxit/DJANGO_IOT path: /django_iot/apps/devices/queue.py import boto3 import time import json class Queue: def __init__(self): self.QueueName = 'command' self.sqs = boto3.resource('sqs') self.getQueue() def create(self): <|fim_suffix|> def getQueue(self): ...
code_fim
medium
{ "lang": "python", "repo": "pmaxit/DJANGO_IOT", "path": "/django_iot/apps/devices/queue.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: City-of-Helsinki/mvj path: /leasing/models/__init__.py from .area import Area, AreaSource from .area_note import AreaNote from .basis_of_rent import ( BasisOfRent, BasisOfRentBuildPermissionType, BasisOfRentDecision, BasisOfRentPlotType, BasisOfRentPropertyIdentifier, Basi...
code_fim
hard
{ "lang": "python", "repo": "City-of-Helsinki/mvj", "path": "/leasing/models/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ndedUse, ) from .tenant import Tenant, TenantContact from .ui_data import UiData from .vat import Vat __all__ = [ "Area", "AreaNote", "AreaSource", "BankHoliday", "BasisOfRent", "BasisOfRentBuildPermissionType", "BasisOfRentDecision", "BasisOfRentPlotType", "BasisOfRen...
code_fim
hard
{ "lang": "python", "repo": "City-of-Helsinki/mvj", "path": "/leasing/models/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod @ndb.transactional def get_or_create(cls, key, urlsafe=False, **kwargs): """Get or create a ndb DB. It returns a list, first is the entity, second a boolean which tells you if it was created or not. For this function the key needs to be set! ...
code_fim
hard
{ "lang": "python", "repo": "jajberni/pcse_web", "path": "/main/model/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jajberni/pcse_web path: /main/model/base.py # coding: utf-8 """Provides implementation of Base model and BaseValidator""" from __future__ import absolute_import from google.appengine.ext import ndb import config #from datetime import date import datetime from pydash import _ import util class...
code_fim
hard
{ "lang": "python", "repo": "jajberni/pcse_web", "path": "/main/model/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # We add the footer which includes the latest formatted date. message += "*****\n^Última ^sincronización: ^{:%d-%m-%Y ^a ^las ^%H:%M:%S}".format( NOW) # Finally, we send it all to a Reddit post. reddit.update_post(message) if __name__ == "__main__": # Feel free to remove th...
code_fim
hard
{ "lang": "python", "repo": "PhantomInsights/prep-2018", "path": "/bot/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PhantomInsights/prep-2018 path: /bot/main.py """A bot that synchronizes with the PREP, generates a table, a figure and posts them to Reddit.""" import os from datetime import datetime, timedelta # Uncomment the following 2 lines if you are running this bot on a VPS. # import matplotlib # matplo...
code_fim
hard
{ "lang": "python", "repo": "PhantomInsights/prep-2018", "path": "/bot/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> candidate_votes = prep_data["votes"][index] candidate_percentage = prep_data["percentages"][index] # We check if the current candidate has the most votes. If so we format it in bold letters. if candidate_votes == max(prep_data["votes"]): explodes.append(0.1) ...
code_fim
hard
{ "lang": "python", "repo": "PhantomInsights/prep-2018", "path": "/bot/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check within 9 places of fragmentation accuracy for order, expected in enumerate(dma_frag): free_pages, frag_pct = expected self.assertEqual(dma_dict[order][0], free_pages) self.assertAlmostEqual(dma_dict[order][1], frag_pct, 9) ...
code_fim
hard
{ "lang": "python", "repo": "CrazyLionHeart/scripts", "path": "/fraglevelinfo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CrazyLionHeart/scripts path: /fraglevelinfo.py """ Calculates fragmentation from /proc/buddyinfo and populates a dict Returned dict is a nested dict describing the fragmentation. The first set of keys are by node (e.g. Node 0, Node 1), and the second is by zone (e.g. DMA, DMA...
code_fim
hard
{ "lang": "python", "repo": "CrazyLionHeart/scripts", "path": "/fraglevelinfo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CrazyLionHeart/scripts path: /fraglevelinfo.py atable pages) which can not be derived from /proc/buddyinfo """ frag_dict = calculate_fragmentation() _print_fragmentation(frag_dict, sys.stdout) def _print_fragmentation(frag_dict, out): """ Internal version of print_...
code_fim
hard
{ "lang": "python", "repo": "CrazyLionHeart/scripts", "path": "/fraglevelinfo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return {"success": True, "data": response.data} @teams_namespace.route("/me/fails") class TeamPrivateFails(Resource): @authed_only @require_team def get(self): team = get_current_team() fails = team.get_fails(admin=True) view = "admin" if is_admin() else "use...
code_fim
hard
{ "lang": "python", "repo": "kyprizel/CTFd", "path": "/CTFd/api/v1/teams.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyprizel/CTFd path: /CTFd/api/v1/teams.py import copy from flask import abort, request, session from flask_restplus import Namespace, Resource from CTFd.cache import clear_standings from CTFd.models import Awards, Submissions, Teams, Unlocks, Users, db from CTFd.schemas.awards import AwardSchem...
code_fim
hard
{ "lang": "python", "repo": "kyprizel/CTFd", "path": "/CTFd/api/v1/teams.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@teams_namespace.route("/<team_id>/members") @teams_namespace.param("team_id", "Team ID") class TeamMembers(Resource): @admins_only def get(self, team_id): team = Teams.query.filter_by(id=team_id).first_or_404() view = "admin" if is_admin() else "user" schema = TeamSchema(...
code_fim
hard
{ "lang": "python", "repo": "kyprizel/CTFd", "path": "/CTFd/api/v1/teams.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def change_date_to_unix(date): ''' funkcja zmieniająca zapis daty ''' unix_date = int(time.mktime(datetime.strptime(date, '%d-%m-%Y'). timetuple())) if date[2] == '-' else int(time.mktime( datetime.strptime(date, '%Y-%m-%d').timetuple())) return unix_date def change_unix_to_d...
code_fim
hard
{ "lang": "python", "repo": "marcin-se/python-learn", "path": "/py07api/weatherapi-Python-CodeGen-PY/weather.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># WEATHER PARAMETERS : url_current = 'https://api.weatherapi.com/v1/current.json' url_forecast = 'https://api.weatherapi.com/v1/forecast.json' url_history = 'https://api.weatherapi.com/v1/history.json' key = read_apikey(key_file) q = 'Katowice,pl' lang = 'pl' dt = '' # format: dt = yyyy-MM-dd...
code_fim
hard
{ "lang": "python", "repo": "marcin-se/python-learn", "path": "/py07api/weatherapi-Python-CodeGen-PY/weather.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcin-se/python-learn path: /py07api/weatherapi-Python-CodeGen-PY/weather.py # WEATHER v1.4 (R) Powered by WeatherAPI.com # -*- coding: UTF-8 -*- https://www.weatherapi.com/ # Skrypt z odczytu danych pogodowych z serwera API ...
code_fim
hard
{ "lang": "python", "repo": "marcin-se/python-learn", "path": "/py07api/weatherapi-Python-CodeGen-PY/weather.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 4dn-dcic/tibanna_ff path: /tibanna_cgap/cw_utils.py from tibanna.utils import ( upload, read_s3 ) from tibanna.cw_utils import TibannaResource as TibannaResource_ <|fim_suffix|>class TibannaResource(TibannaResource_): report_title = 'Pipeline Run Metrics'<|fim_middle|># instance_id =...
code_fim
medium
{ "lang": "python", "repo": "4dn-dcic/tibanna_ff", "path": "/tibanna_cgap/cw_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> report_title = 'Pipeline Run Metrics'<|fim_prefix|># repo: 4dn-dcic/tibanna_ff path: /tibanna_cgap/cw_utils.py from tibanna.utils import ( upload, read_s3 ) from tibanna.cw_utils import TibannaResource as TibannaResource_ # instance_id = 'i-0167a6c2d25ce5822' # filesystem = "/dev/xvdb" # fil...
code_fim
easy
{ "lang": "python", "repo": "4dn-dcic/tibanna_ff", "path": "/tibanna_cgap/cw_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: if url is None: raise ValueError('Need some value') data = qrcode(url, mode='raw', version=version, error_correction=correct, box_size=box_size, border=border, fill_color=fcolor, back_color=bcolor, factor=factor, icon_img=ico...
code_fim
hard
{ "lang": "python", "repo": "1dot75cm/flasky", "path": "/app/api_1_0/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1dot75cm/flasky path: /app/api_1_0/main.py # coding: utf-8 from flask import jsonify, url_for, request, send_file from . import api from .errors import bad_request from .. import cache, qrcode @api.route('/') def main(): '''API列表''' return jsonify({ 'message': 'Hello, Fedora.', ...
code_fim
hard
{ "lang": "python", "repo": "1dot75cm/flasky", "path": "/app/api_1_0/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Changing field 'Pin.url' db.alter_column('pins_pin', 'url', self.gf('django.db.models.fields.TextField')(null=True)) def backwards(self, orm): # User chose to not deal with backwards NULL issues for 'Pin.url' raise RuntimeError("Cannot reverse this migration. 'Pin.u...
code_fim
medium
{ "lang": "python", "repo": "svenity/pinry", "path": "/pinry/pins/migrations/0003_auto__chg_field_pin_url.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: svenity/pinry path: /pinry/pins/migrations/0003_auto__chg_field_pin_url.py # -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models <|fim_suffix|> # Changing field 'Pin.url' db.alter_column('pins_pin', 'url...
code_fim
medium
{ "lang": "python", "repo": "svenity/pinry", "path": "/pinry/pins/migrations/0003_auto__chg_field_pin_url.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize("degree", [1, 3]) @pytest.mark.parametrize("with_intercept", [True, False]) def test_trend(degree, with_intercept): _test_trend(degree, with_intercept) # zero trend does not work without intercept def test_zero_trend(): _test_trend(degree=0, with_intercept=True) def te...
code_fim
hard
{ "lang": "python", "repo": "earthinversion/sktime", "path": "/sktime/forecasting/tests/test_trend.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: earthinversion/sktime path: /sktime/forecasting/tests/test_trend.py #!/usr/bin/env python3 -u # -*- coding: utf-8 -*- # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) __author__ = ["Markus Löning"] __all__ = ["get_expected_polynomial_coefs"] import numpy as np import pand...
code_fim
hard
{ "lang": "python", "repo": "earthinversion/sktime", "path": "/sktime/forecasting/tests/test_trend.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: JustMJ/ksp_rtls_launch_to_rendezvous path: /PlannerUiPanel.py import sys import subprocess import time from MainUiPanel import panel_x_offset class PlannerUiPanel: def __init__(self, connection, get_checklist_callback, ui_config): self.canvas = connection.ui.stock_canvas self...
code_fim
hard
{ "lang": "python", "repo": "JustMJ/ksp_rtls_launch_to_rendezvous", "path": "/PlannerUiPanel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with open("stdout.txt","wb") as out: self.optimizer_process = subprocess.Popen((sys.executable, "optimizer.py"), stdout=out, stderr=out) else: self.connection.ui.message('Error: Checklist not complete.', duration=3.0) ...
code_fim
hard
{ "lang": "python", "repo": "JustMJ/ksp_rtls_launch_to_rendezvous", "path": "/PlannerUiPanel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gharib85/Pibronic path: /tests/stats/test_jackknife.py """ """ # system imports import inspect import math import os from os.path import dirname, join # local imports from ..context import pibronic import pibronic.stats as st import pibronic.stats.jackknife as jk import pibronic.data.file_stru...
code_fim
hard
{ "lang": "python", "repo": "gharib85/Pibronic", "path": "/tests/stats/test_jackknife.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert ret["E"] == -1.0 assert ret["E error"] == 0.0 assert math.isclose(ret["Cv"], 1.0 / kBT) assert math.isclose(ret["Cv error"], 2.7755575615628914e-16) return @pytest.fixture() def path(): # does this work when deployed? return join(dirname(dirname(inspect.getfile(pibroni...
code_fim
hard
{ "lang": "python", "repo": "gharib85/Pibronic", "path": "/tests/stats/test_jackknife.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lenoxys/virtuaplant path: /plants/bottle-filling/attacks/stop_all.py #!/usr/bin/env python from pymodbus.client.sync import ModbusTcpClient as ModbusClient from pymodbus.exceptions import ConnectionException import logging <|fim_suffix|>##################################### # Code #############...
code_fim
medium
{ "lang": "python", "repo": "lenoxys/virtuaplant", "path": "/plants/bottle-filling/attacks/stop_all.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>try: client.connect() while True: rq = client.write_register(0x01, 1) # Run Plant, Run! rq = client.write_register(0x1, 0) # Level Sensor rq = client.write_register(0x2, 1) # Limit Switch rq = client.write_register(0x3, 0) # Motor rq = client.write_register(...
code_fim
hard
{ "lang": "python", "repo": "lenoxys/virtuaplant", "path": "/plants/bottle-filling/attacks/stop_all.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidSooky/Django-Twitter-Clone path: /user/migrations/0001_initial.py # Generated by Django 3.1 on 2021-02-04 18:04 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import user.models class Migration(migrations.Migration): initial...
code_fim
hard
{ "lang": "python", "repo": "davidSooky/Django-Twitter-Clone", "path": "/user/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Profile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('profile_pic', models.ImageField(default='images/default_profile.jpg', upl...
code_fim
hard
{ "lang": "python", "repo": "davidSooky/Django-Twitter-Clone", "path": "/user/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nikon-petr/kohonen path: /core/net_normalization_functions.py from math import sqrt <|fim_suffix|>normalization_functions = { 'normalization_1': lambda x: x / sqrt(np.sum(x ** 2)), 'normalization_2': lambda x: x / np.abs(x) }<|fim_middle|>import numpy as np
code_fim
easy
{ "lang": "python", "repo": "nikon-petr/kohonen", "path": "/core/net_normalization_functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>normalization_functions = { 'normalization_1': lambda x: x / sqrt(np.sum(x ** 2)), 'normalization_2': lambda x: x / np.abs(x) }<|fim_prefix|># repo: nikon-petr/kohonen path: /core/net_normalization_functions.py from math import sqrt <|fim_middle|>import numpy as np
code_fim
easy
{ "lang": "python", "repo": "nikon-petr/kohonen", "path": "/core/net_normalization_functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser() # parser.add_argument('--dataset_config', default='', type=str, nargs='?', help='Requires 2 args identifying datasets by name in order of input to the pipeline. Stage 1: train + validate, Stage 2: finetune + validate + test') # parser.add_argument('-m', '--mo...
code_fim
hard
{ "lang": "python", "repo": "JacobARose/pyleaves", "path": "/pyleaves/train/csv_datasets_train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JacobARose/pyleaves path: /pyleaves/train/csv_datasets_train.py """ Created on Tue Mar 17 03:23:32 2019 script: /pyleaves/pyleaves/train/csv_datasets_train.py @author: JacobARose """ def main(experiment_config, experiment_results_dir): ############################################ #T...
code_fim
hard
{ "lang": "python", "repo": "JacobARose/pyleaves", "path": "/pyleaves/train/csv_datasets_train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Accept a new candidate? :param old_cost: old cost value :param new_cost: new cost value :param T: temp param :param verbose: print stuff :return: bool for acceptance """ if new_cost <= old_cost: return True else: delta = new_cost - old_cost ...
code_fim
hard
{ "lang": "python", "repo": "afcarl/seetd", "path": "/funcs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: afcarl/seetd path: /funcs.py (drop=True).iterrows()} return names, names_seats_dict, names_teams_dict def create_seating_graph(seats_arr, excludes=('nan',0), inc_self=True): """ Create the graph of seats from the layout. :param seats_arr: np array of physical seating arrangemen...
code_fim
hard
{ "lang": "python", "repo": "afcarl/seetd", "path": "/funcs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ 处理超过一个星期开启boss """ week_time = common.week_time(1, zero=1, delta=0) if week_time > self.data.st: self.data.st = int(time.time()) self.data.c = 0 self.save(Game.rpc_store, forced=True) return True return False def set_...
code_fim
hard
{ "lang": "python", "repo": "hw233/twisted_zdzl", "path": "/server/code/game/boss/ally_boss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hw233/twisted_zdzl path: /server/code/game/boss/ally_boss.py #!/usr/bin/env python # -*- coding:utf-8 -*- import time from corelib import spawn, sleep, log from game import Game, pack_msg from game.base import common from game.player.player import PlayerData from game.base.errcode import EC_BO...
code_fim
hard
{ "lang": "python", "repo": "hw233/twisted_zdzl", "path": "/server/code/game/boss/ally_boss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dorga/PythonTutorial path: /10Functions.py __author__ = 'jbowman' # https://pythonspot.com/functions/ def f(x): return x * x print(f(3)) def f(x, y): <|fim_suffix|>def kwargs2(a=None, b=None): return a - b print(str(kwargs())) print(str(kwargs(a=1))) print(str(kwargs(b=1))) print(...
code_fim
hard
{ "lang": "python", "repo": "Dorga/PythonTutorial", "path": "/10Functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(str(kwargs())) print(str(kwargs(a=1))) print(str(kwargs(b=1))) print(str(kwargs(a=3, b=1))) print(str(kwargs(b=3, a=1)))<|fim_prefix|># repo: Dorga/PythonTutorial path: /10Functions.py __author__ = 'jbowman' # https://pythonspot.com/functions/ def f(x): return x * x <|fim_middle|> print(f(3...
code_fim
hard
{ "lang": "python", "repo": "Dorga/PythonTutorial", "path": "/10Functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chishu-amenomoriS/wiktionary-tools path: /python/en-verb/en-verb-2.py import re, sys pattern1 = re.compile(r"\[\[(.+?)\]\]") pattern2 = re.com<|fim_suffix|> + data[-1] + line[m.end():] sys.stdout.write(pattern2.sub("", line))<|fim_middle|>pile("<!--.*?-->") for line in sys.stdin: while (m...
code_fim
medium
{ "lang": "python", "repo": "chishu-amenomoriS/wiktionary-tools", "path": "/python/en-verb/en-verb-2.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>h(line)): data = m[1].split("|") line = line[:m.start()] + data[-1] + line[m.end():] sys.stdout.write(pattern2.sub("", line))<|fim_prefix|># repo: chishu-amenomoriS/wiktionary-tools path: /python/en-verb/en-verb-2.py import re, sys pattern1 = re.compile(r"\[\[(.+?)\]\]") pattern2 = re...
code_fim
medium
{ "lang": "python", "repo": "chishu-amenomoriS/wiktionary-tools", "path": "/python/en-verb/en-verb-2.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zju3dv/mvpose path: /backend/tf_cpn/lib/nets/basemodel.py import tensorflow as tf import tensorflow.contrib.slim as slim from . import resnet_v1, resnet_utils from tensorflow.contrib.slim import arg_scope from tensorflow.python.framework import ops from tensorflow.python.ops import nn_ops from te...
code_fim
hard
{ "lang": "python", "repo": "zju3dv/mvpose", "path": "/backend/tf_cpn/lib/nets/basemodel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with slim.arg_scope(resnet_arg_scope(bn_is_training=bn_is_training, bn_trainable=bn_trainable)): net2, _ = resnet_v1.resnet_v1( net, blocks[1:2], global_pool=False, include_root_block=False, scope='resnet_v1_101') with slim.arg_scope(resnet_arg_scope(bn_...
code_fim
hard
{ "lang": "python", "repo": "zju3dv/mvpose", "path": "/backend/tf_cpn/lib/nets/basemodel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: laowantong/algo_magic path: /algo_magic/truth.py from IPython.core.magic import (Magics, magics_class, line_cell_magic) from itertools import product import re def truth(*tests, **kwargs): bools = kwargs.get("bools", ("False", "True")) width = max(len(bools[0]), len(bools[1])) (off, ...
code_fim
hard
{ "lang": "python", "repo": "laowantong/algo_magic", "path": "/algo_magic/truth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> %truth bool_expr_1, bool_expr_2, ..., bool_expr_n %truth bool_expr_1, ? bool_expr_2, ..., bool_expr_n %%truth bool_expr_1 bool_expr_2 ... bool_expr_n %%truth bool_expr_1 ? bool_expr_2...
code_fim
hard
{ "lang": "python", "repo": "laowantong/algo_magic", "path": "/algo_magic/truth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: memsharded/conan path: /conans/client/build/cppstd_flags.py import warnings from conans.errors import ConanException from conans.model.version import Version def cppstd_from_settings(settings): cppstd = settings.get_safe("cppstd") compiler_cppstd = settings.get_safe("compiler.cppstd") ...
code_fim
hard
{ "lang": "python", "repo": "memsharded/conan", "path": "/conans/client/build/cppstd_flags.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Official docs are wrong, in 6.0 the default is gnu14 to follow gcc's choice return "gnu98" if Version(compiler_version) < "6" else "gnu14" def _gcc_cppstd_default(compiler_version): return "gnu98" if Version(compiler_version) < "6" else "gnu14" def _visual_cppstd_default(compiler_version...
code_fim
hard
{ "lang": "python", "repo": "memsharded/conan", "path": "/conans/client/build/cppstd_flags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import pyre executive = pyre.executive # retrieve a component descriptor from the python path try: a, = executive.resolve(uri="file:sample_syntaxerror.py/factory") assert False except SyntaxError as error: pass # all done return executive # main if _...
code_fim
medium
{ "lang": "python", "repo": "pyre/pyre", "path": "/tests/pyre.pkg/framework/executive_resolve_syntaxError.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyre/pyre path: /tests/pyre.pkg/framework/executive_resolve_syntaxError.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # michael a.g. aïvázis # orthologue # (c) 1998-2023 all rights reserved # """ Verify that bad component descriptors raise the correct exceptions """ <|fim_suffix|> im...
code_fim
medium
{ "lang": "python", "repo": "pyre/pyre", "path": "/tests/pyre.pkg/framework/executive_resolve_syntaxError.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # retrieve a component descriptor from the python path try: a, = executive.resolve(uri="file:sample_syntaxerror.py/factory") assert False except SyntaxError as error: pass # all done return executive # main if __name__ == "__main__": test() # end of file...
code_fim
medium
{ "lang": "python", "repo": "pyre/pyre", "path": "/tests/pyre.pkg/framework/executive_resolve_syntaxError.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dwabece/roksa_scrapper path: /tasks.py """ Scrapper celery tasks """ import requests from celery import Celery import config from libs import advert, page from logmodule import get_logger LOGGER = get_logger(__name__) APP = Celery('tasks', broker=config.RABBIT_URL) <|fim_suffix|> @APP.task(ra...
code_fim
hard
{ "lang": "python", "repo": "dwabece/roksa_scrapper", "path": "/tasks.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> """ Going through pagination results """ LOGGER.info('fetching page %s', page_num) try: page_body = page.get_sresults_page(page_num) except requests.exceptions.HTTPError as exc: if exc.response.status_code == 403: # self.retry() return s...
code_fim
hard
{ "lang": "python", "repo": "dwabece/roksa_scrapper", "path": "/tasks.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>'''desperate EVT_LBL feature''' # train_log = train_log.merge(train_flg, on='USRID', how='left') # # log_evt_lbl = pd.pivot_table(train_log, index='USRID', values='EVT_LBL', aggfunc=return_list).reset_index() # # log_evt_lbl_test = pd.pivot_table(test_log, index='USRID', values='EVT_LBL', aggfunc=retur...
code_fim
hard
{ "lang": "python", "repo": "rogeroyer/df_singularity_plan_zhaoshang", "path": "/pre_deal.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>'''111''' # log_table = pd.pivot_table(train_log, index='USRID', values='TCH_TYP', aggfunc='count').reset_index().rename(columns={'TCH_TYP': 'log_table'}) # log_table = log_table.merge(train_flg, on='USRID', how='left') # true_log = log_table[log_table['FLAG'] == 1].sort_values(by=['log_table'], ascend...
code_fim
hard
{ "lang": "python", "repo": "rogeroyer/df_singularity_plan_zhaoshang", "path": "/pre_deal.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rogeroyer/df_singularity_plan_zhaoshang path: /pre_deal.py # -*- coding:utf-8 -*- import time import numpy as np import pandas as pd from scipy.stats import mode import matplotlib.pyplot as plt import lightgbm as lgb from sklearn.metrics import roc_auc_score from sklearn.preprocessing i...
code_fim
hard
{ "lang": "python", "repo": "rogeroyer/df_singularity_plan_zhaoshang", "path": "/pre_deal.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Message(models.Model): user = models.ForeignKey('User', on_delete=models.CASCADE, editable=False) content = models.TextField(editable=False) keysafe = models.TextField(editable=False) attachments = models.BinaryField(editable=False) class KulloMeta: db_name = 'kulloserv...
code_fim
hard
{ "lang": "python", "repo": "kullo/webconfig", "path": "/src/account/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kullo/webconfig path: /src/account/models.py # Copyright 2015–2020 Kullo GmbH # # This source code is licensed under the 3-clause BSD license. See LICENSE.txt # in the root directory of this source tree for details. from django.db import connections, models from django.db.models.functions import ...
code_fim
hard
{ "lang": "python", "repo": "kullo/webconfig", "path": "/src/account/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: modoboa/modoboa path: /modoboa/admin/apps.py """AppConfig for admin.""" from django.apps import AppConfig from .app_settings import load_admin_settings <|fim_suffix|> name = "modoboa.admin" verbose_name = "Modoboa admin console" def ready(self): load_admin_settings() ...
code_fim
medium
{ "lang": "python", "repo": "modoboa/modoboa", "path": "/modoboa/admin/apps.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> def ready(self): load_admin_settings() from . import handlers # NOQA:F401<|fim_prefix|># repo: modoboa/modoboa path: /modoboa/admin/apps.py """AppConfig for admin.""" from django.apps import AppConfig from .app_settings import load_admin_settings class AdminConfig(AppConfig): ...
code_fim
medium
{ "lang": "python", "repo": "modoboa/modoboa", "path": "/modoboa/admin/apps.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> name = "modoboa.admin" verbose_name = "Modoboa admin console" def ready(self): load_admin_settings() from . import handlers # NOQA:F401<|fim_prefix|># repo: modoboa/modoboa path: /modoboa/admin/apps.py """AppConfig for admin.""" from django.apps import AppConfig from .app...
code_fim
medium
{ "lang": "python", "repo": "modoboa/modoboa", "path": "/modoboa/admin/apps.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>lank", False), ("consent_request_id__isnull_or_blank", False), ("remote_constent_method", "SMS"), ("additional_information__isnull_or_blank", False), ), _connector="OR", ), ...
code_fim
hard
{ "lang": "python", "repo": "betagouv/Aidants_Connect", "path": "/aidants_connect_web/migrations/0018_remove_journal_infos_set_remote_mandate_by_sms_and_more.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: betagouv/Aidants_Connect path: /aidants_connect_web/migrations/0018_remove_journal_infos_set_remote_mandate_by_sms_and_more.py # Generated by Django 4.0.9 on 2023-02-09 14:35 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("aidants...
code_fim
hard
{ "lang": "python", "repo": "betagouv/Aidants_Connect", "path": "/aidants_connect_web/migrations/0018_remove_journal_infos_set_remote_mandate_by_sms_and_more.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tables = [_history_table, _history_stats_table] columns = [_history_stats_table[stat]] join_clause = BinaryOperation(_history_table['id'], _history_stats_table['benchmark'], '==') benchmark_id_clause = BinaryOperation(_history_table['benchmark_id'], benchmark_id, '==') ...
code_fim
hard
{ "lang": "python", "repo": "rackerlabs/trial-by-combat", "path": "/TBC/core/Historian.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # gather all benchmarks that are too old id_clause = BinaryOperation(_history_table['benchmark_id'], str(benchmark_id), '==') max_age_clause = BinaryOperation(_history_table['timestamp'], time.time() - max_age, '<=') where = BinaryOperation(id_clause, max_age_clause, 'and')...
code_fim
hard
{ "lang": "python", "repo": "rackerlabs/trial-by-combat", "path": "/TBC/core/Historian.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rackerlabs/trial-by-combat path: /TBC/core/Historian.py import time from TBC.types.Table import * from TBC.types.AST import * from TBC.types.Column import * from TBC.types.DataType import * _stats = ['average_latency', 'average_throughput', '50.0th_percentile_latency', ...
code_fim
hard
{ "lang": "python", "repo": "rackerlabs/trial-by-combat", "path": "/TBC/core/Historian.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Returns the player that has won the game in the current state. Returns None if the state is not terminal. Returns: int or None: Player that has won the game: WHITE=1, BLACK=-1, DRAW=0 and None if the game has not ended yet. """ raise...
code_fim
medium
{ "lang": "python", "repo": "Soy-yo/Implementacion-TFG", "path": "/tfg/games.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Returns a list of all legal actions in the current state. Returns: list of object: List of all legal actions, a subset of action_space. """ raise NotImplementedError def winner(self): """Returns the player that has won the game in the current s...
code_fim
medium
{ "lang": "python", "repo": "Soy-yo/Implementacion-TFG", "path": "/tfg/games.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Soy-yo/Implementacion-TFG path: /tfg/games.py import abc import gym WHITE = 1 """Constant representing first player in a two players game.""" BLACK = -1 """Constant representing second player in a two players game.""" <|fim_suffix|> """ metadata = {'render.modes': ['human']} reward_...
code_fim
hard
{ "lang": "python", "repo": "Soy-yo/Implementacion-TFG", "path": "/tfg/games.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class A(SalesforceModel): email = models.EmailField(custom=True) class Meta: db_table = 'A__c' class B(SalesforceModel): class Meta: db_table = 'B__c' class AtoB(SalesforceModel): a = models.ForeignKey(A, models.DO_NOTHING, custom=True) b = models.ForeignKey(B, mo...
code_fim
hard
{ "lang": "python", "repo": "sureshannapureddy/django-salesforce", "path": "/tests/test_compatibility/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class AtoB(SalesforceModel): a = models.ForeignKey(A, models.DO_NOTHING, custom=True) b = models.ForeignKey(B, models.DO_NOTHING, custom=True) class Meta: db_table = 'AtoB__c'<|fim_prefix|># repo: sureshannapureddy/django-salesforce path: /tests/test_compatibility/models.py """Backwa...
code_fim
medium
{ "lang": "python", "repo": "sureshannapureddy/django-salesforce", "path": "/tests/test_compatibility/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sureshannapureddy/django-salesforce path: /tests/test_compatibility/models.py """Backward compatible behaviour with primary key 'Id' and upper-case field names""" from salesforce import models from salesforce.models import SalesforceModel class User(SalesforceModel): Username = models.Char...
code_fim
medium
{ "lang": "python", "repo": "sureshannapureddy/django-salesforce", "path": "/tests/test_compatibility/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(typ, Bits): return cls.HdlType_bits(typ, createTmpVarFn, declaration=declaration) elif isinstance(typ, Enum): return cls.HdlType_enum(typ, scope, declaration=declaration) elif isinstance(typ, Array): return cls.HdlType_array(typ, cr...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/HWToolkit", "path": "/hwt/serializer/vhdl/types.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python3pkg/HWToolkit path: /hwt/serializer/vhdl/types.py from hwt.hdlObjects.constants import Unconstrained from hwt.hdlObjects.types.hdlType import HdlType from hwt.hdlObjects.types.array import Array from hwt.hdlObjects.types.bits import Bits from hwt.hdlObjects.types.enum import Enum from hwt....
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/HWToolkit", "path": "/hwt/serializer/vhdl/types.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ma = typ.max mi = typ.min noMax = ma is None noMin = mi is None if noMin: if noMax: return "INTEGER" else: raise SerializerException("If max is specified min has to be specified as well") else: ...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/HWToolkit", "path": "/hwt/serializer/vhdl/types.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: plcrodrigues/py.PHMDML.EEG.2017-GIPSA path: /headmounted/dataset.py #!/usr/bin/env python # -*- coding: UTF-8 -*- import mne import numpy as np from . import download as dl from scipy.io import loadmat HEADMOUNTED_URL = 'https://zenodo.org/record/2617085/files/' class HeadMountedDisplay(): ...
code_fim
hard
{ "lang": "python", "repo": "plcrodrigues/py.PHMDML.EEG.2017-GIPSA", "path": "/headmounted/dataset.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> update_path=None, verbose=None): if subject not in self.subject_list: raise(ValueError("Invalid subject number")) url = '{:s}subject_{:02d}.mat'.format(HEADMOUNTED_URL, subject) file_path = dl.data_path(url, 'HEADMOUNTED') return [file_path]...
code_fim
hard
{ "lang": "python", "repo": "plcrodrigues/py.PHMDML.EEG.2017-GIPSA", "path": "/headmounted/dataset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hokiegeek2/arkouda path: /examples/ak_rmat.py #!/usr/bin/env python3 import arkouda as ak def gen_rmat_edges(lgNv, Ne_per_v, p, perm=False): # number of vertices Nv = 2**lgNv # number of edges Ne = Ne_per_v * Nv # probabilities a = p b = (1.0 - a)/ 3.0 c = b ...
code_fim
hard
{ "lang": "python", "repo": "hokiegeek2/arkouda", "path": "/examples/ak_rmat.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ak.v = False ak.connect(server=args.hostname, port=args.port) print((args.lgNv, args.Ne_per_v, args.prob, args.perm)) (ii,jj) = gen_rmat_edges(args.lgNv, args.Ne_per_v, args.prob, perm=args.perm) print("ii = ", (ii.size, ii)) print("ii(min,max) = ", (ii.min(), ii.max())) ...
code_fim
hard
{ "lang": "python", "repo": "hokiegeek2/arkouda", "path": "/examples/ak_rmat.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: netsak/AdventOfCode2020 path: /day-04.py #!/usr/bin/env python from re import compile token_regex = compile(r"(\w+):(\S+)") color_regex = compile(r"^#[0-9a-fA-F]{6}$") height_regex = compile(r"(?P<value>\d+)(?P<unit>cm|in)") pid_regex = compile(r"^\d{9}$") def get_passports(filename): """L...
code_fim
medium
{ "lang": "python", "repo": "netsak/AdventOfCode2020", "path": "/day-04.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def complex_validator(passport): """Checks if a passport is valid according to a rule set""" if not 1920 <= int(passport.get("byr", 0)) <= 2002: return False if not 2010 <= int(passport.get("iyr", 0)) <= 2020: return False if not 2020 <= int(passport.get("eyr", 0)) <= 2030:...
code_fim
hard
{ "lang": "python", "repo": "netsak/AdventOfCode2020", "path": "/day-04.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> active_task_ids = [task['id'] for task in app.get_active_and_reserved_tasks()] channel_changes = Change.objects.filter(channel_id__isnull=False, applied=False, errored=False) \ .order_by('channel_id', 'created_by_id') \ .values('channel_id', 'created_by_id') \ ...
code_fim
hard
{ "lang": "python", "repo": "learningequality/studio", "path": "/contentcuration/contentcuration/management/commands/reconcile_change_tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: learningequality/studio path: /contentcuration/contentcuration/management/commands/reconcile_change_tasks.py import logging from django.core.management.base import BaseCommand from contentcuration.celery import app from contentcuration.models import Change from contentcuration.models import Use...
code_fim
hard
{ "lang": "python", "repo": "learningequality/studio", "path": "/contentcuration/contentcuration/management/commands/reconcile_change_tasks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenRoberta/robertalab-naoprogram path: /OpenRobertaNAO/src/main/resources/originalHal.py , 42.2, 44.4, 46.2, 50]) keys.append([1.00403e-07, 0, 0, 0, 0, -0.698132, -0.174533, 0, 0, 1.00403e-07, 0.523599, 1.00403e-07, - 0.741765, -0.872665, -1.0472, -1.0472, -1.0472, -...
code_fim
hard
{ "lang": "python", "repo": "OpenRoberta/robertalab-naoprogram", "path": "/OpenRobertaNAO/src/main/resources/originalHal.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }