text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super().get_context_data(**kwargs) context['available'] = self.request.user.userprofile.get_verified_phone_number() context['enabled'] = SMSBackend().is_enabled(self.r...
code_fim
hard
{ "lang": "python", "repo": "thinkwelltwd/vmi", "path": "/apps/accounts/mfa_views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thinkwelltwd/vmi path: /apps/accounts/mfa_views.py from django.views.generic import TemplateView from django.views.generic.base import View from django.contrib.auth.mixins import LoginRequiredMixin from apps.mfa.backends.sms.backend import SMSBackend from apps.mfa.backends.sms.models import SMSDe...
code_fim
hard
{ "lang": "python", "repo": "thinkwelltwd/vmi", "path": "/apps/accounts/mfa_views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> context['available'] = self.request.user.userprofile.get_verified_phone_number() context['enabled'] = SMSBackend().is_enabled(self.request.user) return context<|fim_prefix|># repo: thinkwelltwd/vmi path: /apps/accounts/mfa_views.py from django.views.generic import TemplateView fro...
code_fim
hard
{ "lang": "python", "repo": "thinkwelltwd/vmi", "path": "/apps/accounts/mfa_views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: misty0729/shopee path: /experiment_runner.py import subprocess import random from train_utils import * import inspect def draw_hypers(): class CONF(ConfigClass): <|fim_suffix|> for exp_id in range(100, 200): hypers = draw_hypers() print(hypers) print('============= exp', exp...
code_fim
hard
{ "lang": "python", "repo": "misty0729/shopee", "path": "/experiment_runner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for exp_id in range(100, 200): hypers = draw_hypers() print(hypers) print('============= exp', exp_id, '\n', flush=True) com = ['python', '-W', 'ignore', 'train_bert.py', f'--experiment_id={exp_id}'] for name,value in hypers.items(): com.append(f'--{name}={value}') #c...
code_fim
hard
{ "lang": "python", "repo": "misty0729/shopee", "path": "/experiment_runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> com = ['python', '-W', 'ignore', 'train_bert.py', f'--experiment_id={exp_id}'] for name,value in hypers.items(): com.append(f'--{name}={value}') #com.append('--run_without_valid') subprocess.run(com)<|fim_prefix|># repo: misty0729/shopee path: /experiment_runner.py import subproc...
code_fim
medium
{ "lang": "python", "repo": "misty0729/shopee", "path": "/experiment_runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PzanettiD/oeis path: /A000040/A000040.py #The prime numbers. #https://oeis.org/A000040 # Using the Sieve of Eratosthenes <|fim_suffix|> A = [True] * (n*n) A[0] = False A[1] = False for i in range(2, n): if A[i] == True: for j in range(i*i, n, i): ...
code_fim
medium
{ "lang": "python", "repo": "PzanettiD/oeis", "path": "/A000040/A000040.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for p in range(0, n): if A[p] == True: print(p, end=" ") print() #Prints the primes amongst the first 100 natural numbers Sieve_of_Eratosthenes(100)<|fim_prefix|># repo: PzanettiD/oeis path: /A000040/A000040.py #The prime numbers. #https://oeis.org/A000040 # Using th...
code_fim
hard
{ "lang": "python", "repo": "PzanettiD/oeis", "path": "/A000040/A000040.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Prints the primes amongst the first 100 natural numbers Sieve_of_Eratosthenes(100)<|fim_prefix|># repo: PzanettiD/oeis path: /A000040/A000040.py #The prime numbers. #https://oeis.org/A000040 # Using the Sieve of Eratosthenes <|fim_middle|># Algorithm that generates and prints list of prime numbers...
code_fim
hard
{ "lang": "python", "repo": "PzanettiD/oeis", "path": "/A000040/A000040.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>der # noqa from .styles import Style # noqa from .yeasts import Yeast # noqa<|fim_prefix|># repo: weldon0405/brewday path: /brew/__init__.py # -*- coding: utf-8 -*- from .grains import Grain # noqa from .grains import <|fim_middle|>GrainAddition # noqa from .hops import Hop # noqa from .hops import...
code_fim
medium
{ "lang": "python", "repo": "weldon0405/brewday", "path": "/brew/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: weldon0405/brewday path: /brew/__init__.py # -*- coding: utf-8 -*- from .grains import Grain # noqa from .grains import <|fim_suffix|>on # noqa from .recipes import Recipe # noqa from .recipes import RecipeBuilder # noqa from .styles import Style # noqa from .yeasts import Yeast # noqa<|fim...
code_fim
medium
{ "lang": "python", "repo": "weldon0405/brewday", "path": "/brew/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(chunk) and chunk[-1].is_string(): last_concat = True else: if Chunk.multiline or len(chunk) > 0: last_concat = False<|fim_prefix|># repo: admdev8/flynt path: /src/flynt/lexer/split.py import io import tokenize import traceback from typing imp...
code_fim
hard
{ "lang": "python", "repo": "admdev8/flynt", "path": "/src/flynt/lexer/split.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: admdev8/flynt path: /src/flynt/lexer/split.py import io import tokenize import traceback from typing import Generator from flynt import state from flynt.lexer.Chunk import Chunk from flynt.lexer.PyToken import PyToken def get_chunks(code) -> Generator[Chunk, None, None]: g = tokenize.token...
code_fim
hard
{ "lang": "python", "repo": "admdev8/flynt", "path": "/src/flynt/lexer/split.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tool = analyze.get_analyze_tool(extension) if not tool: raise image, parameters = tool(path) meta.update(parameters) actual_path_to_content = utils_filesystem.join(settings.BASE_PATH, meta['path_to_content']) actual_path_...
code_fim
hard
{ "lang": "python", "repo": "IgorZyktin/MediaStorageSystem", "path": "/ad_hoc_scripts/old/mss_register_remote/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> meta['path_to_content'] = utils_filesystem.join('example', sub_path, new_name) meta['path_to_preview'] = utils_filesystem.join('example', 'previews', sub_path, new_name) meta['path_to_thumbnail'] = utils_filesystem.join('example', 'thumbnails...
code_fim
hard
{ "lang": "python", "repo": "IgorZyktin/MediaStorageSystem", "path": "/ad_hoc_scripts/old/mss_register_remote/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IgorZyktin/MediaStorageSystem path: /ad_hoc_scripts/old/mss_register_remote/__main__.py # -*- coding: utf-8 -*- """Main file. """ import json import os import shutil from typing import Set from ad_hoc_scripts.common import utils_filesystem from ad_hoc_scripts.old.mss_register_remote import sett...
code_fim
hard
{ "lang": "python", "repo": "IgorZyktin/MediaStorageSystem", "path": "/ad_hoc_scripts/old/mss_register_remote/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: path (str): File path ondisk of the ada protocol buffer object. Returns: ada_pb2.Context: A rich python ada context object. """ context = ada_pb2.Context() if not os.path.exists(path): getLog().error("Missing ada file: {}".format(path)) return ...
code_fim
medium
{ "lang": "python", "repo": "dveight/ada", "path": "/src/ada/core/io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dveight/ada path: /src/ada/core/io.py import os import ada_pb2 import graph_pb2 from common import getLog def write_proto_file(data, directory, name, ext): """ Simple write function to be used in all applications to serialise a rich object to binary strings. Args: data (pr...
code_fim
medium
{ "lang": "python", "repo": "dveight/ada", "path": "/src/ada/core/io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def mock_gradings_intercepting_same_grade(): # intersects a_3_polygon of same grade grade_a_2 = _create_grading(StopGrade.A, a_2_polygon, 300) # intersects a_2_polygon of same grade grade_a_3 = _create_grading(StopGrade.A, a_3_polygon, 300) return { 2: [grade_a_2], 3: ...
code_fim
hard
{ "lang": "python", "repo": "public-transport-quality-grades/oevgk18-generator", "path": "/tests/output/mock/mock_gradings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>d_8_polygon = [ [ 9.509224891662598, 46.852149967540875 ], [ 9.506950378417969, 46.85062379326795 ], [ 9.509224891662598, 46.849126926374936 ], [ 9.51265811920166, 46.85091729168854 ], [ 9.509224891...
code_fim
hard
{ "lang": "python", "repo": "public-transport-quality-grades/oevgk18-generator", "path": "/tests/output/mock/mock_gradings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: public-transport-quality-grades/oevgk18-generator path: /tests/output/mock/mock_gradings.py from typing import List from shapely.geometry import Polygon from generator.business.model.grading import Grading from generator.business.model.isochrone import Isochrone from generator.business.model.st...
code_fim
hard
{ "lang": "python", "repo": "public-transport-quality-grades/oevgk18-generator", "path": "/tests/output/mock/mock_gradings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> DATABASE_URI = get_conn_str() API_PORT = os.getenv('API_PORT')<|fim_prefix|># repo: barrettotte/Pokemon-Teams path: /api/src/config.py import os def get_conn_str(): return ''.join([ 'DRIVER={PostgreSQL Unicode};', 'DATABASE={};'.format(os.getenv('DB_NAME')), 'UID={};'.format(os.getenv(...
code_fim
easy
{ "lang": "python", "repo": "barrettotte/Pokemon-Teams", "path": "/api/src/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: barrettotte/Pokemon-Teams path: /api/src/config.py import os def get_conn_str(): return ''.join([ 'DRIVER={PostgreSQL Unicode};', 'DATABASE={};'.format(os.getenv('DB_NAME')), 'UID={};'.format(os.getenv('DB_USER')), 'PWD={};'.format(os.getenv('DB_PWD')), 'SERVER={};'.format(...
code_fim
easy
{ "lang": "python", "repo": "barrettotte/Pokemon-Teams", "path": "/api/src/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/taskflow path: /taskflow/examples/resume_vm_boot.py # -*- coding: utf-8 -*- # Copyright (C) 2013 Yahoo! Inc. 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 obta...
code_fim
hard
{ "lang": "python", "repo": "openstack/taskflow", "path": "/taskflow/examples/resume_vm_boot.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def create_flow(): # Setup the set of things to do (mini-nova). flow = lf.Flow("root").add( PrintText("Starting vm creation.", no_slow=True), lf.Flow('vm-maker').add( # First create a specification for the final vm to-be. DefineVMSpec("define_spec"), ...
code_fim
hard
{ "lang": "python", "repo": "openstack/taskflow", "path": "/taskflow/examples/resume_vm_boot.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jespino/cligh path: /cligh/repos.py #!/usr/bin/python # Repository-related commands. from cligh.utils import read_user_input def create(client, args): """Create a new repository.""" def validate_description(text): if len(text) == 0: print 'Description may not be empty. Try again.' r...
code_fim
hard
{ "lang": "python", "repo": "jespino/cligh", "path": "/cligh/repos.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Fork a repository.""" print client.repos.fork(args.repository) def do_list(client, args): """Command to list the repos for a given user.""" repos = client.repos.list(args.user) print '%s has the following repositories:' % args.user print 'Name - Description' for repo in repos: print '%s - %s'...
code_fim
hard
{ "lang": "python", "repo": "jespino/cligh", "path": "/cligh/repos.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> repo = subparsers.add_parser('repo', help='Manage and query repositories.') subparsers = repo.add_subparsers(title='Repository-related Subcommands') repo_list = subparsers.add_parser('list', help='List repositories belonging to a given user.') repo_list.set_defaults(func=do_list) repo_list.add_argume...
code_fim
hard
{ "lang": "python", "repo": "jespino/cligh", "path": "/cligh/repos.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self, wgt, length, height, start_width=None, end_width=None, port=(0, 0), direction="EAST", ): tk.Component.__init__(self, "EulerSBend", locals()) # Protected variables self.port = port self.portlist = {} ...
code_fim
hard
{ "lang": "python", "repo": "gvnwst/PICwriter", "path": "/picwriter/components/ebend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if start_width != None: self.start_width = start_width else: self.start_width = wgt.wg_width if end_width != None: self.end_width = end_width else: self.end_width = wgt.wg_width if length < 0: raise ValueE...
code_fim
hard
{ "lang": "python", "repo": "gvnwst/PICwriter", "path": "/picwriter/components/ebend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gvnwst/PICwriter path: /picwriter/components/ebend.py np.pi - abs(self.turnby)) / 2) ) self.output_port = ( self.dist_to_vertex - self.dist_to_vertex * np.cos(np.pi - abs(self.turnby)), self.sign * self.dist_to_vertex * np.s...
code_fim
hard
{ "lang": "python", "repo": "gvnwst/PICwriter", "path": "/picwriter/components/ebend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def sort(self, A, index, p, r, rc_arr): """Function to Divide the input Array into equal sub-arrays""" if p < r: q = (p + r) // 2 self.sort(A, index, p, q, rc_arr) self.sort(A, index, q + 1, r, rc_arr) self.merge(A, index, p, q, r, rc_a...
code_fim
hard
{ "lang": "python", "repo": "vinayakasg18/algorithms", "path": "/InversionCount.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vinayakasg18/algorithms path: /InversionCount.py """ Class to count the inversion count using merge sort""" class InversionCount: def count(self, A: [int]) -> [int]: """ Count and return the array containing the count of each element """ index_array = [] rc_arr = []...
code_fim
hard
{ "lang": "python", "repo": "vinayakasg18/algorithms", "path": "/InversionCount.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dair-iitd/TourismQA path: /src/custom/fetch/posts/getPostsURLs.py import re import sys import bs4 import math import time import tqdm import logging import argparse import urllib.request from pathlib import Path from bs4 import BeautifulSoup from urllib.parse import urljoin from collections impor...
code_fim
hard
{ "lang": "python", "repo": "dair-iitd/TourismQA", "path": "/src/custom/fetch/posts/getPostsURLs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> city_post_urls[city] = {} city_post_urls[city]["city_url"] = city_url city_post_urls[city]["post_urls"] = post_urls bar.update() bar.close() common.dumpJSON(city_post_urls, posts_urls_file_path) if(__name__ == "__main__"): project_root...
code_fim
hard
{ "lang": "python", "repo": "dair-iitd/TourismQA", "path": "/src/custom/fetch/posts/getPostsURLs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kekelele/python-udsoncan path: /J2534/__init__.py from .wrapper import j2534lib SetErrorLog = j2534lib.SetErrorLog getDevices = j2534lib.getDevices setDevice = j2534lib.setDevice <|fim_suffix|>from .wrapper import ptData, ptTxMsg, ptRxMsg, ptMskMsg, ptPatternMsg from .wrapper import ptOpen, ...
code_fim
medium
{ "lang": "python", "repo": "kekelele/python-udsoncan", "path": "/J2534/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from .wrapper import ptData, ptTxMsg, ptRxMsg, ptMskMsg, ptPatternMsg from .wrapper import ptOpen, ptClose from .wrapper import ptConnect, ptDisconnect from .wrapper import ptReadMsgs, ptWtiteMsgs from .wrapper import ptStartPeriodicMsg, ptStopPeriodicMsg from .wrapper import ptStartMsgFilter, ptStopMsgFi...
code_fim
medium
{ "lang": "python", "repo": "kekelele/python-udsoncan", "path": "/J2534/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> count = 0 for ste_file in Path(l2l.get_l2root_base_dirs("taskinfo")).glob("*.pickle"): os.remove(ste_file) logger.info(f"Deleted {ste_file}") count += 1 logger.info(f"Done! Deleted {count} STE files") if __name__ == "__main__": # Configure logger logging.basic...
code_fim
medium
{ "lang": "python", "repo": "lifelong-learning-systems/l2metrics", "path": "/l2metrics/clear_ste.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILIT...
code_fim
medium
{ "lang": "python", "repo": "lifelong-learning-systems/l2metrics", "path": "/l2metrics/clear_ste.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lifelong-learning-systems/l2metrics path: /l2metrics/clear_ste.py """ Copyright © 2021-2022 The Johns Hopkins University Applied Physics Laboratory LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software...
code_fim
medium
{ "lang": "python", "repo": "lifelong-learning-systems/l2metrics", "path": "/l2metrics/clear_ste.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_date": "Due date", "task_status_short_name": "Status", } else: from collections import OrderedDict tab_columns = OrderedDict( [ ("project_name", "Prod"), ("task_type_name", "Type"), ("entity_name", "Entity"), ("task_estimation", ...
code_fim
hard
{ "lang": "python", "repo": "LedruRollin/gazu-publisher", "path": "/kitsupublisher/ui_data/table_headers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LedruRollin/gazu-publisher path: /kitsupublisher/ui_data/table_headers.py """ Module with the header names of the table. The keys are the task attributes we want to display, the values are the names the columns will have in the table. """ from kitsupublisher.utils.pyversion import python_version ...
code_fim
hard
{ "lang": "python", "repo": "LedruRollin/gazu-publisher", "path": "/kitsupublisher/ui_data/table_headers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Keypoint AP degrades (though box AP improves) when using plain L1 loss model.roi_heads.box_predictor.smooth_l1_beta = 0.5<|fim_prefix|># repo: facebookresearch/detectron2 path: /configs/common/models/keypoint_rcnn_fpn.py from detectron2.config import LazyCall as L from detectron2.layers import ShapeSpe...
code_fim
hard
{ "lang": "python", "repo": "facebookresearch/detectron2", "path": "/configs/common/models/keypoint_rcnn_fpn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebookresearch/detectron2 path: /configs/common/models/keypoint_rcnn_fpn.py from detectron2.config import LazyCall as L from detectron2.layers import ShapeSpec from detectron2.modeling.poolers import ROIPooler from detectron2.modeling.roi_heads import KRCNNConvDeconvUpsampleHead from .mask_rcn...
code_fim
medium
{ "lang": "python", "repo": "facebookresearch/detectron2", "path": "/configs/common/models/keypoint_rcnn_fpn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> chrom_name = fields[0] chrom_length = int(fields[1]) region_start = 0 while region_start < chrom_length: start = region_start end = region_start + region_size if end > chrom_length: end = chrom_length print(chrom_name + ":" + str(region_start) +...
code_fim
medium
{ "lang": "python", "repo": "kylewellband/CT-poly-wgbs", "path": "/01_scripts/util/fasta_generate_regions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while region_start < chrom_length: start = region_start end = region_start + region_size if end > chrom_length: end = chrom_length print(chrom_name + ":" + str(region_start) + "-" + str(end)) region_start = end<|fim_prefix|># repo: kylewellband/CT-po...
code_fim
medium
{ "lang": "python", "repo": "kylewellband/CT-poly-wgbs", "path": "/01_scripts/util/fasta_generate_regions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kylewellband/CT-poly-wgbs path: /01_scripts/util/fasta_generate_regions.py #!/usr/bin/env python import sys if len(sys.argv) == 1: print("usage: ", sys.argv[0], " <fasta file or index file> <region size>") print("generates a list of freebayes/bamtools region specifiers on stdout") ...
code_fim
hard
{ "lang": "python", "repo": "kylewellband/CT-poly-wgbs", "path": "/01_scripts/util/fasta_generate_regions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='device', name='callsign', field=models.CharField(blank=True, max_length=50, null=True), ), ]<|fim_prefix|># repo: dbca-wa/resource_tracking path: /tracking/migrations/0016_alter_device_callsign.p...
code_fim
medium
{ "lang": "python", "repo": "dbca-wa/resource_tracking", "path": "/tracking/migrations/0016_alter_device_callsign.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dbca-wa/resource_tracking path: /tracking/migrations/0016_alter_device_callsign.py # Generated by Django 3.2.5 on 2021-10-19 05:47 <|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('tracking', '0015_alter_device_internal_only'), ] operations = [ ...
code_fim
easy
{ "lang": "python", "repo": "dbca-wa/resource_tracking", "path": "/tracking/migrations/0016_alter_device_callsign.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: luminescence/PolyLibScan path: /Analysis/visualize.py import matplotlib.pyplot as plt import numpy as np import PolyLibScan.Tools.lmp_helpers from lightning import Lightning from IPython.display import display, HTML class Visualize(object): def __init__(self, parent): self.parent = ...
code_fim
hard
{ "lang": "python", "repo": "luminescence/PolyLibScan", "path": "/Analysis/visualize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> group = np.zeros(points.shape, np.int) for i,at in enumerate(points['atom_type']): if at in run.job.particle_ids['polymer']: group[i] = 1 else: group[i] = 2 group[run.job.active_site['xyz']+1] = 3 return group<|fim_pre...
code_fim
hard
{ "lang": "python", "repo": "luminescence/PolyLibScan", "path": "/Analysis/visualize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lenck/vlb path: /python/test/test_ms_bench.py #!/usr/bin/python # -*- coding: utf-8 -*- # =========================================================== # File Name: test_ms_bench.py # Author: Xu Zhang, Columbia University # Creation Date: 01-25-2019 # Last Modified: Mon Apr 15 14:57:08 2019 # #...
code_fim
hard
{ "lang": "python", "repo": "lenck/vlb", "path": "/python/test/test_ms_bench.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ms_result_cv_brisk = ms_bench.evaluate( vggh, cv_brisk, use_cache=True, save_result=True) ms_result_cv_kaze = ms_bench.evaluate( vggh, cv_kaze, use_cache=True, save_result=True) ms_result_cv_akaze = ms_bench.evaluate( vggh, cv_akaze, use_cache=True, save_result=True) ...
code_fim
hard
{ "lang": "python", "repo": "lenck/vlb", "path": "/python/test/test_ms_bench.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: serashioda/code-katas path: /src/tests/test_count_bits.py """Tests for count_bits module.""" import pytest <|fim_suffix|>@pytest.mark.parametrize("n, result", BITS_TABLE) def test_count_bits(n, result): """Test the count_bits function.""" from count_bits import count_bits assert coun...
code_fim
medium
{ "lang": "python", "repo": "serashioda/code-katas", "path": "/src/tests/test_count_bits.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("n, result", BITS_TABLE) def test_count_bits(n, result): """Test the count_bits function.""" from count_bits import count_bits assert count_bits(n) == result<|fim_prefix|># repo: serashioda/code-katas path: /src/tests/test_count_bits.py """Tests for count_bits module...
code_fim
medium
{ "lang": "python", "repo": "serashioda/code-katas", "path": "/src/tests/test_count_bits.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Test the count_bits function.""" from count_bits import count_bits assert count_bits(n) == result<|fim_prefix|># repo: serashioda/code-katas path: /src/tests/test_count_bits.py """Tests for count_bits module.""" import pytest BITS_TABLE = [ [0, 0], [4, 1], [7, 3], [9, 2], ...
code_fim
medium
{ "lang": "python", "repo": "serashioda/code-katas", "path": "/src/tests/test_count_bits.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response_xml = auth.get_last_response_xml() tree = etree.fromstring(response_xml) username = tree.xpath(self.xpath_username_location, namespaces=self.saml_namespace)[0] if not username: return None app = self.parent username = self.normalize_us...
code_fim
hard
{ "lang": "python", "repo": "darden-data-science/SAMLAuthenticator", "path": "/SAMLAuthenticator/SAMLAuthenticator.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__(**kwargs) if self.auto_IdP_metadata: idp_data = OneLogin_Saml2_IdPMetadataParser.parse_remote(self.auto_IdP_metadata) self.saml_settings = OneLogin_Saml2_IdPMetadataParser.merge_settings(self.saml_settings, idp_data) def login_url(self, base_u...
code_fim
hard
{ "lang": "python", "repo": "darden-data-science/SAMLAuthenticator", "path": "/SAMLAuthenticator/SAMLAuthenticator.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: darden-data-science/SAMLAuthenticator path: /SAMLAuthenticator/SAMLAuthenticator.py from jupyterhub.handlers import BaseHandler from jupyterhub.auth import Authenticator from jupyterhub.utils import url_path_join from traitlets import Dict, Unicode, Bool import time import tornado.httputil fro...
code_fim
hard
{ "lang": "python", "repo": "darden-data-science/SAMLAuthenticator", "path": "/SAMLAuthenticator/SAMLAuthenticator.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: conversationai/wikidetox path: /experimental/conversation_go_awry/feature_extraction/utils/politeness_with_spacy/test_documents.py TEST_DOCUMENTS = [ {'text' : "Have you found the answer for your question? If yes would you <|fim_suffix|>ay?"}, {'text' : "What are you trying to do? Why can't you...
code_fim
medium
{ "lang": "python", "repo": "conversationai/wikidetox", "path": "/experimental/conversation_go_awry/feature_extraction/utils/politeness_with_spacy/test_documents.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ay?"}, {'text' : "What are you trying to do? Why can't you just store the \"Range\"?"}, {'text' : "This was supposed to have been moved to &lt;url&gt; per the cfd. why wasn't it moved?"}]<|fim_prefix|># repo: conversationai/wikidetox path: /experimental/conversation_go_awry/feature_extraction/utils/poli...
code_fim
medium
{ "lang": "python", "repo": "conversationai/wikidetox", "path": "/experimental/conversation_go_awry/feature_extraction/utils/politeness_with_spacy/test_documents.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #---synthesize G(z)---# _G_z = sess.run(G_z, feed_dict) # Show shape print('z shape: ', np.shape(_z)) print('G_z shape: ', np.shape(_G_z)) if cond: print('w_input_shape: ', np.shape(label)) # Visualize generated wavefrom visualize_list = _G_z[:args.generate_visualize_num] for i, v in enumerate...
code_fim
hard
{ "lang": "python", "repo": "ligaoliang/Conditional-SpecGAN-Tensorflow", "path": "/src/generate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ligaoliang/Conditional-SpecGAN-Tensorflow path: /src/generate.py # -*- coding: utf-8 -*- # """*********************************************************************************************""" # FileName [ generate.py ] # Synopsis [ Generate wavefroms from trained model as .jpeg images ...
code_fim
hard
{ "lang": "python", "repo": "ligaoliang/Conditional-SpecGAN-Tensorflow", "path": "/src/generate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #---get model name---# mdls = glob.glob(os.path.join(args.train_dir, '*.meta')) mdl_name = sorted(mdls)[-1].split('-')[-1].split('.')[0] mdl_name = 'cond_SpecGAN_' + mdl_name if args.conditional else 'SpecGAN_' + mdl_name if args.conditional: args.generate_dir = args.generate_dir + '_cond' mdl_dir...
code_fim
hard
{ "lang": "python", "repo": "ligaoliang/Conditional-SpecGAN-Tensorflow", "path": "/src/generate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># X''Y''Z'' lcs_2 = LocalCoordinateSystem(location=P3(8,8,0), x_direction=P3( math.cos(BaseUtils.angle_to_radian(30)), math.sin(BaseUtils.angle_to_radian(30)), 0 )) p = P3(10,16,0) p1 = lcs_1.point_to_local_coordinate(p) p2 = lcs_2.point_to_local_coordinate(p) print(p1) # (16.6602540378...
code_fim
hard
{ "lang": "python", "repo": "madokast/cctpy", "path": "/final_code/demos/B03坐标系平移旋转.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: madokast/cctpy path: /final_code/demos/B03坐标系平移旋转.py """ CCT 建模优化代码 坐标系平移旋转 作者:赵润晓 日期:2021年5月4日 """ # 因为要使用父目录的 cctpy 所以加入 from os import error, path import sys sys.path.append(path.dirname(path.abspath(path.dirname(__file__)))) from cctpy import * # X'Y'Z' 局部坐标系,因为相对于全局坐标系只有原点 location 不同,坐标轴...
code_fim
hard
{ "lang": "python", "repo": "madokast/cctpy", "path": "/final_code/demos/B03坐标系平移旋转.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return jnp.argmax(expected_rates(distance)) @jax.jit def ideal_mcs_log_distance(distance: Scalar) -> jnp.int32: return jnp.argmax(expected_rates_log_distance(distance)) # FTM distance measurement noise model (fig. 3): # https://www2.tkn.tu-berlin.de/bib/zubow2022ftm-ns3/zubow2022ftm-ns3.pdf RT...
code_fim
hard
{ "lang": "python", "repo": "ml4wifi-devs/ftmrate", "path": "/ml4wifi/utils/wifi_specs.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ml4wifi-devs/ftmrate path: /ml4wifi/utils/wifi_specs.py import jax import jax.numpy as jnp import tensorflow_probability.substrates.jax as tfp from chex import Scalar tfb = tfp.bijectors tfd = tfp.distributions # LogDistance channel model # https://www.nsnam.org/docs/models/html/wifi-testing.h...
code_fim
hard
{ "lang": "python", "repo": "ml4wifi-devs/ftmrate", "path": "/ml4wifi/utils/wifi_specs.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> client_index = runner_args.index('--client') if '--client' in runner_args else -1 client_ip = runner_args[client_index + 1] if client_index >= 0 else '127.0.0.1' port_index = runner_args.index('--port') if '--port' in runner_args else -1 client_port = runner_args[port_index + 1] if port_i...
code_fim
medium
{ "lang": "python", "repo": "basilevs/RED", "path": "/src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/main/python/scripts/red_pydevd_package/redpydevd/redpydevd.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def find_robot_run_path(): try: # try to get path from local Python interpreter import robot path = os.path.join(os.path.dirname(inspect.getfile(robot)), 'run.py') except: raise RuntimeError('Unable to find robot.run module') if not os.path.isfile(path): ...
code_fim
hard
{ "lang": "python", "repo": "basilevs/RED", "path": "/src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/main/python/scripts/red_pydevd_package/redpydevd/redpydevd.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: basilevs/RED path: /src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/main/python/scripts/red_pydevd_package/redpydevd/redpydevd.py # # Copyright 2019 Nokia Solutions and Networks # Licensed under the Apache License, Version 2.0, # see license.txt file for details. # import os imp...
code_fim
hard
{ "lang": "python", "repo": "basilevs/RED", "path": "/src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/main/python/scripts/red_pydevd_package/redpydevd/redpydevd.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hiroaki-yamamoto/django-good-otp path: /example/example/urls.py #!/usr/bin/env python # coding=utf-8 """example URL Configuration. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views ...
code_fim
medium
{ "lang": "python", "repo": "hiroaki-yamamoto/django-good-otp", "path": "/example/example/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class TestAdminSite(admin.AdminSite): """test admin site.""" login_form = AdminSite.login_form login_template = AdminSite.login_template def __init__(self, *args, **kwargs): """Init.""" super(TestAdminSite, self).__init__(*args, **kwargs) self._registry = admin.s...
code_fim
medium
{ "lang": "python", "repo": "hiroaki-yamamoto/django-good-otp", "path": "/example/example/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bGN4/poweredsites path: /poweredsites/forms/profile.py # -*- coding: utf-8 -*- # # Copyright(c) 2010 poweredsites.org # # 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...
code_fim
hard
{ "lang": "python", "repo": "bGN4/poweredsites", "path": "/poweredsites/forms/profile.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._handler.db.execute( "UPDATE user SET username = %s, email = %s, status_ = %s, \ blog_name = %s, blog_url = %s WHERE id = %s", v['username'].lower(), v['email'], const.Status.ACTIVE, \ ...
code_fim
hard
{ "lang": "python", "repo": "bGN4/poweredsites", "path": "/poweredsites/forms/profile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #Place (city, stateAbbreviation) tuples in a list that you would like to be scraped locations = [["austin","tx"], ["san-antonio", "tx"], ["dallas", "tx"], ["houston", "tx"], ["fort-worth","tx"], ["el-paso", "tx"], ["arlington", "tx"]] for city, state in locations: generate_urls(cit...
code_fim
hard
{ "lang": "python", "repo": "hbrinsko/GoFundMeScraper", "path": "/scraping.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c = Campaign(url, ctitle, cgoal, cShareCount, cDesc, donor, time) cData = { "url": c.url, "title": c.campaignTitle.body, "title-length": c.campaignTitle.calculate_length(), "title-sentiment": c.campaignTitle.calculate_sentiment(analyzer), ...
code_fim
hard
{ "lang": "python", "repo": "hbrinsko/GoFundMeScraper", "path": "/scraping.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hbrinsko/GoFundMeScraper path: /scraping.py import requests import pyexcel as pe from bs4 import BeautifulSoup from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer import csv import re from datetime import datetime class Text: def __init__(self, body): self.body = bod...
code_fim
hard
{ "lang": "python", "repo": "hbrinsko/GoFundMeScraper", "path": "/scraping.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Print out the input libraries. Utility.PrintBuildArguments(sofiaImsName, 'libraries', sofiaImsEnv['LIBS']) # For Windows, suppress the following warnings. # (1) C4100: unreferenced formal parameter. # (2) C4127: conditional expression is constant. # (3) C4189: local variable is initialized but not refe...
code_fim
hard
{ "lang": "python", "repo": "smart-conn/ajsipe2e", "path": "/Src/CloudCommEngine/IMSTransport/Sofia/SConscript", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|># Build the shared library. targetLibName = 'SofiaIms' sourceFileList = Glob('*.cc') Utility.PrintBuildArguments(sofiaImsName, 'source files', sourceFileList) sofiaImsLib = sofiaImsEnv.SharedLibrary(targetLibName, sourceFileList) sofiaImsEnv.Install(['$DISTDIR/cpp/lib', '$DISTDIR/cpp/bin'], sofiaImsLib)...
code_fim
hard
{ "lang": "python", "repo": "smart-conn/ajsipe2e", "path": "/Src/CloudCommEngine/IMSTransport/Sofia/SConscript", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: smart-conn/ajsipe2e path: /Src/CloudCommEngine/IMSTransport/Sofia/SConscript # Copyright AllSeen Alliance. All rights reserved. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyrigh...
code_fim
hard
{ "lang": "python", "repo": "smart-conn/ajsipe2e", "path": "/Src/CloudCommEngine/IMSTransport/Sofia/SConscript", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>if __name__=="__main__": if (len(sys.argv) < 3 ): print USAGE else: examples = [line.strip() for line in open(sys.argv[1]).readlines() ] positive = [e for e in examples if e[0] =='1' ] negative = [e for e in examples if e[0] == '-' ] numfolds = int(sys.argv[...
code_fim
hard
{ "lang": "python", "repo": "Najah-lshanableh/machine_learning_legislation", "path": "/src/python/classification/generate_cv_files.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> folds = [] for i in range(nfolds): folds.append([]) if len(positive_examples) < len(negative_examples): smaller = positive_examples bigger = negative_examples else: smaller = negative_examples bigger = positive_examples random.shuffle(smaller) ...
code_fim
medium
{ "lang": "python", "repo": "Najah-lshanableh/machine_learning_legislation", "path": "/src/python/classification/generate_cv_files.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Najah-lshanableh/machine_learning_legislation path: /src/python/classification/generate_cv_files.py # generates cross validation files for svm_light dataset with stratification import os, sys import random USAGE = "python %s <input-svm-light-file> <output-folder> <num-folds>" %(sys.argv[0]) def...
code_fim
hard
{ "lang": "python", "repo": "Najah-lshanableh/machine_learning_legislation", "path": "/src/python/classification/generate_cv_files.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('appointment', 'is_accepted') # ### end Alembic commands ###<|fim_prefix|># repo: mrfade/uas-backend path: /migrations/versions/dcd7be474216_.py """empty message Revision ID: dcd7be474216 Revises: 0...
code_fim
medium
{ "lang": "python", "repo": "mrfade/uas-backend", "path": "/migrations/versions/dcd7be474216_.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrfade/uas-backend path: /migrations/versions/dcd7be474216_.py """empty message Revision ID: dcd7be474216 Revises: 0f709f68fae3 Create Date: 2021-01-10 16:09:42.089254 """ from alembic import op import sqlalchemy as sa <|fim_suffix|> def downgrade(): # ### commands auto generated by Alemb...
code_fim
hard
{ "lang": "python", "repo": "mrfade/uas-backend", "path": "/migrations/versions/dcd7be474216_.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # this tests the angular momentum conversion ds.add_virtual_columns_cartesian_angular_momenta(Lx='Lx_', Ly='Ly_', Lz='Lz_') ds['L_'] = np.sqrt(ds.Lx_**2. + ds.Ly_**2. + ds.Lz_**2.) np.testing.assert_almost_equal(ds.Lz.values, ds.Lz_.values, err_msg='error when calculating Lz', decimal=3) ...
code_fim
hard
{ "lang": "python", "repo": "heyuqi1970/vaex", "path": "/tests/virtual_columns_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: heyuqi1970/vaex path: /tests/virtual_columns_test.py from common import * def test_add_virtual_columns_polar_velocities_to_cartesian(): ds = vaex.example() ds.add_virtual_columns_cartesian_velocities_to_polar() ds.add_virtual_columns_cartesian_to_polar() # With azimuth = None ...
code_fim
hard
{ "lang": "python", "repo": "heyuqi1970/vaex", "path": "/tests/virtual_columns_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> kfNumpy = KFBlock() gtSignal, dt, pSignal, mSignal, mCov = prepData(seqLocal=seq) posGT = np.cumsum(gtSignal, axis=0) gnet = GuessNet() if not isTrain: gnet.train() checkPoint = torch.load(wName + '.pt') gnet.load_state_dict(checkPoint['model_state_dict...
code_fim
hard
{ "lang": "python", "repo": "kuui24/Deep_Visual_Inertial_Odometry", "path": "/main_KF.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kuui24/Deep_Visual_Inertial_Odometry path: /main_KF.py from src.DataReader.KF_Data.KF_PrepData import DataManager from scipy import signal from src.Params import * from src.Models.KF_Model.KF_BLock import * from src.Models.KF_Model.KF_Model import * import torch.optim as optim import matplo...
code_fim
hard
{ "lang": "python", "repo": "kuui24/Deep_Visual_Inertial_Odometry", "path": "/main_KF.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> m = begin_patten.match(line) if m != None: meet_begin_patten = True tmp_file.write(m.group(1) + "\n") continue if end_patten.match(line): meet_begin_patten = False continue elif meet_be...
code_fim
hard
{ "lang": "python", "repo": "SFU-HiAccel/merlin-compiler", "path": "/trunk/mars-gen/scripts/merlin_flow/preprocess_remove_directive.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SFU-HiAccel/merlin-compiler path: /trunk/mars-gen/scripts/merlin_flow/preprocess_remove_directive.py # (C) Copyright 2016-2021 Xilinx, Inc. # All Rights Reserved. # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distri...
code_fim
hard
{ "lang": "python", "repo": "SFU-HiAccel/merlin-compiler", "path": "/trunk/mars-gen/scripts/merlin_flow/preprocess_remove_directive.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ## Required parameters parser.add_argument("--topic", default=None, type=str, required=True, help="Topic to train LM task on on") parser.add_argument("--epochs", default=None, type=str, required=True, help="No of epochs to run this lm task on") ...
code_fim
medium
{ "lang": "python", "repo": "abdullahmitkar/deep-reading-of-a-topic", "path": "/lm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abdullahmitkar/deep-reading-of-a-topic path: /lm.py """ Finetuning the library models for question-answering on SQuAD (DistilBERT, Bert, XLM, XLNet).""" from pytorch_pretrained_bert import BertTokenizer, BertModel, BertForMaskedLM from transformers import BertModel, BertTokenizer from pytorch_p...
code_fim
hard
{ "lang": "python", "repo": "abdullahmitkar/deep-reading-of-a-topic", "path": "/lm.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def _assert_equal(d_0, d_1): """Check that two objects are equal.""" # Compare arrays. if _is_array_like(d_0): try: ae(d_0, d_1) except AssertionError: ac(d_0, d_1) # Compare dicts recursively. elif isinstance(d_0, dict): assert set(d_0) ...
code_fim
hard
{ "lang": "python", "repo": "cortex-lab/phylib", "path": "/phylib/utils/testing.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cortex-lab/phylib path: /phylib/utils/testing.py # -*- coding: utf-8 -*- """Utility functions used for tests.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ from contex...
code_fim
hard
{ "lang": "python", "repo": "cortex-lab/phylib", "path": "/phylib/utils/testing.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Move the picture into cache folder output_path = '{}/{}{}.{}'.format(cache_folder_path, folder_name, i, file_type) os.rename(image_path, output_path) # Print new image's path print('%s was saved.' % output_path) if __nam...
code_fim
hard
{ "lang": "python", "repo": "BriceChou/aispider", "path": "/training/move_picture_into_cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Get data folder and cache folder path data_folder_path = os.path.abspath(project_path + 'data') cache_folder_path = os.path.abspath(project_path + 'cache') # Store the all pictures pictures_list = [] lib.get_image_path_from_folder(data_folder_path, pictures_list) i = lib.ge...
code_fim
medium
{ "lang": "python", "repo": "BriceChou/aispider", "path": "/training/move_picture_into_cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BriceChou/aispider path: /training/move_picture_into_cache.py __author__ = 'Brice Chou' import os import sys # Extend on our system's path and can load the other folder's file sys.path.append('..') import lib # Use the utf-8 coded format reload(sys) sys.setdefaultencoding('utf-8') def move(p...
code_fim
hard
{ "lang": "python", "repo": "BriceChou/aispider", "path": "/training/move_picture_into_cache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> expect = [ ('GET', '/v1/containers/?sort_key=uuid', {}, None), ] self._test_containers_list_with_filters( sort_key='uuid', expect=expect) def test_container_list_with_sort_key_dir(self): expect = [ ('GET', '/v1/containers...
code_fim
hard
{ "lang": "python", "repo": "openstack/python-zunclient", "path": "/zunclient/tests/unit/v1/test_containers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }