text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> snapshot_verifier = SnapshotVerifier( self, self.BRIDGE, self.service_manager, ) with snapshot_verifier: pass def test_remove_paging_flow(self): """ Delete the paging flow from table 0 """ ue_ip_addr = "192...
code_fim
hard
{ "lang": "python", "repo": "magma/magma", "path": "/lte/gateway/python/magma/pipelined/tests/test_paging.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/Mastering-OpenCV-4-with-Python path: /Chapter11/01-chapter-content/face_recognition/encode_face_fr.py """ This script makes used of face_recognition library to calculate the 128D descriptor to be used for face recognition. """ <|fim_suffix|># Calculate the encodings for every fac...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Mastering-OpenCV-4-with-Python", "path": "/Chapter11/01-chapter-content/face_recognition/encode_face_fr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Calculate the encodings for every face of the image: encodings = face_recognition.face_encodings(image) # Show the first encoding: print(encodings[0])<|fim_prefix|># repo: PacktPublishing/Mastering-OpenCV-4-with-Python path: /Chapter11/01-chapter-content/face_recognition/encode_face_fr.py """ This scr...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Mastering-OpenCV-4-with-Python", "path": "/Chapter11/01-chapter-content/face_recognition/encode_face_fr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ARM-software/bob-build path: /config_system/generate_config_json.py #!/usr/bin/env python3 import argparse import logging import sys import config_system import config_system.log_handlers import config_system.config_json root_logger = logging.getLogger() root_logger.setLevel(logging.WARNING) ...
code_fim
hard
{ "lang": "python", "repo": "ARM-software/bob-build", "path": "/config_system/generate_config_json.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> args = parse_args() config_system.read_config(args.database, args.config, args.ignore_missing) config_system.config_json.write_config(args.json) return counter.errors() + counter.criticals() if __name__ == "__main__": sys.exit(main())<|fim_prefix|># repo: ARM-software/bob-build p...
code_fim
hard
{ "lang": "python", "repo": "ARM-software/bob-build", "path": "/config_system/generate_config_json.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SysSynBio/dynamo-release path: /dynamo/vectorfield/least_action_path.py import numpy as np from scipy.optimize import minimize def action(path, vf_func, D=1, dt=1): # centers x = (path[:-1] + path[1:]) * 0.5 v = np.diff(path, axis=0) / dt s = (v - vf_func(x)).flatten() s = ...
code_fim
hard
{ "lang": "python", "repo": "SysSynBio/dynamo-release", "path": "/dynamo/vectorfield/least_action_path.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> dim = len(start) if init_path is None: path_0 = ( np.tile(start, (n_points + 1, 1)) + (np.linspace(0, 1, n_points + 1, endpoint=True) * np.tile(end - start, (n_points + 1, 1)).T).T ) else: path_0 = init_path fun = lambda x: action_aux(x, vf_f...
code_fim
hard
{ "lang": "python", "repo": "SysSynBio/dynamo-release", "path": "/dynamo/vectorfield/least_action_path.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if target_branch is None and dryrun: target_branch = TMP_BRANCH click.secho( f"Recreating and checking out temporary branch: {target_branch}", fg="cyan", ) os_system(f"git branch -D {target_branch}", raise_on_error=Fal...
code_fim
hard
{ "lang": "python", "repo": "apache-superset/cherrytree", "path": "/cherrytree/branch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if open_cherries: click.echo() click.secho( f"{len(open_cherries)} open PRs that need to be merged:", fg="red", ) for cherry in open_cherries: pr = cherry.pr click.echo(f"#{pr.number} (a...
code_fim
hard
{ "lang": "python", "repo": "apache-superset/cherrytree", "path": "/cherrytree/branch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache-superset/cherrytree path: /cherrytree/branch.py from collections import OrderedDict from datetime import datetime from typing import Dict, List, Optional import click from git import Commit from github.Issue import Issue from cherrytree.github_utils import ( commit_pr_number, ded...
code_fim
hard
{ "lang": "python", "repo": "apache-superset/cherrytree", "path": "/cherrytree/branch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: danielgordon10/dg_util path: /dg_util/python_utils/bb_util.py import numbers import numpy as np LIMIT = 99999999 # BBoxes are [x1, y1, x2, y2] def clip_bbox(bboxes, min_clip, max_x_clip, max_y_clip): bboxes_out = bboxes added_axis = False if len(bboxes_out.shape) == 1: add...
code_fim
hard
{ "lang": "python", "repo": "danielgordon10/dg_util", "path": "/dg_util/python_utils/bb_util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> (d, n) = rects1.shape x1s = np.fmax(rects1[:, 0], rects2[:, 0]) x2s = np.fmin(rects1[:, 2], rects2[:, 2]) y1s = np.fmax(rects1[:, 1], rects2[:, 1]) y2s = np.fmin(rects1[:, 3], rects2[:, 3]) ws = np.fmax(x2s - x1s, 0) hs = np.fmax(y2s - y1s, 0) intersection = ws * hs rec...
code_fim
hard
{ "lang": "python", "repo": "danielgordon10/dg_util", "path": "/dg_util/python_utils/bb_util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def IOU_lists(rects1, rects2): (d, n) = rects1.shape x1s = np.fmax(rects1[:, 0], rects2[:, 0]) x2s = np.fmin(rects1[:, 2], rects2[:, 2]) y1s = np.fmax(rects1[:, 1], rects2[:, 1]) y2s = np.fmin(rects1[:, 3], rects2[:, 3]) ws = np.fmax(x2s - x1s, 0) hs = np.fmax(y2s - y1s, 0) ...
code_fim
hard
{ "lang": "python", "repo": "danielgordon10/dg_util", "path": "/dg_util/python_utils/bb_util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: salkinium/bachelor path: /experiment_control/periodic_timer.py # -*- coding: utf-8 -*- # Copyright (c) 2014, Niklas Hauser # All rights reserved. # # The file is part of my bachelor thesis and is released under the 3-clause BSD # license. See the file `LICENSE` for the full license governing this...
code_fim
medium
{ "lang": "python", "repo": "salkinium/bachelor", "path": "/experiment_control/periodic_timer.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> result = callback(*args, **kwargs) if result: self.thread = threading.Timer(self.interval, self.callback) self.thread.start() self.callback = wrapper def start(self): self.thread = t...
code_fim
medium
{ "lang": "python", "repo": "salkinium/bachelor", "path": "/experiment_control/periodic_timer.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.assertTrue(license_keys.has_key("TESTKEY1")) self.assertEqual("VALUE1", license_keys.get_key("TESTKEY1")) self.assertTrue(license_keys.has_key("TESTKEY2")) self.assertEqual("VERY LONG VALUE 2", license_keys.get_key("TESTKEY2"))<|fim_prefix|># repo: cen-ai/program-y pa...
code_fim
hard
{ "lang": "python", "repo": "cen-ai/program-y", "path": "/test/programytest/storage/stores/file/store/test_license.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cen-ai/program-y path: /test/programytest/storage/stores/file/store/test_license.py import unittest import os import os.path from programy.storage.stores.file.store.licensekeys import FileLicenseStore from programy.storage.stores.file.engine import FileStorageEngine from programy.storage.stores....
code_fim
hard
{ "lang": "python", "repo": "cen-ai/program-y", "path": "/test/programytest/storage/stores/file/store/test_license.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> store.empty() license_keys = LicenseKeys() store.load(license_keys) self.assertTrue(license_keys.has_key("TESTKEY1")) self.assertEqual("VALUE1", license_keys.get_key("TESTKEY1")) self.assertTrue(license_keys.has_key("TESTKEY2")) self.assertEqual("V...
code_fim
hard
{ "lang": "python", "repo": "cen-ai/program-y", "path": "/test/programytest/storage/stores/file/store/test_license.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: silverspace/samsara-sdks path: /apimatic/python_generic_lib/Samsara+API-Python/samsaraapi/models/data.py # -*- coding: utf-8 -*- """ samsaraapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Data(object): """Implementation of ...
code_fim
hard
{ "lang": "python", "repo": "silverspace/samsara-sdks", "path": "/apimatic/python_generic_lib/Samsara+API-Python/samsaraapi/models/data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fgomezotero/ideuy-py path: /src/ideuy/console/download.py # -*- coding: utf-8 -*- """ This is a skeleton file that can serve as a starting point for a Python console script. To run this script uncomment the following lines in the [options.entry_points] section in setup.cfg: console_scripts =...
code_fim
hard
{ "lang": "python", "repo": "fgomezotero/ideuy-py", "path": "/src/ideuy/console/download.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Returns: :obj:`argparse.Namespace`: command line parameters namespace """ parser = argparse.ArgumentParser( description="Downloads image products from IDEuy", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("grid_vector", help="path to gri...
code_fim
hard
{ "lang": "python", "repo": "fgomezotero/ideuy-py", "path": "/src/ideuy/console/download.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: plonsker/plonsker.github.io path: /gallery-script.py def gallery_creator(img_list): for image in img_list: print('\'<a href="http://plonsker.github.io/imgs/' + image + '" target="_blank"><img src="imgs/' + image + '"/></a>\',') img_list = ['00(1).tiff','000008190022.jpg','000012590002.jpg'...
code_fim
hard
{ "lang": "python", "repo": "plonsker/plonsker.github.io", "path": "/gallery-script.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>PG','DSC07029.JPG','DSC07295.JPG','DSC07460.JPG','DSC07810.JPG','DSC07854.JPG','DSC08251.JPG','DSC08368.JPG','DSC08635.JPG','DSC08810.JPG','DSC08811.JPG','DSC08900.JPG','DSC09992.JPG','FH000002.jpg','FH000007.jpg','FH000014.jpg','FH000019.jpg','G-17.tif','R0000108.JPG','R0041708-01.jpeg','R0041713-01.jpeg...
code_fim
hard
{ "lang": "python", "repo": "plonsker/plonsker.github.io", "path": "/gallery-script.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># SHIFT print("001101000 >> 2 = {:09b}".format(0b001101000 >> 2)) # um 2 Positionen nach rechts verschieben print("001101000 << 2 = {:09b}".format(0b001101000 << 2)) # um 2 Positionen nach links verschieben<|fim_prefix|># repo: hobbyelektroniker/Micropython-Grundlagen path: /002_Kommentare, Blöcke und Op...
code_fim
hard
{ "lang": "python", "repo": "hobbyelektroniker/Micropython-Grundlagen", "path": "/002_Kommentare, Blöcke und Operatoren/Code/bitoperatoren.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: hobbyelektroniker/Micropython-Grundlagen path: /002_Kommentare, Blöcke und Operatoren/Code/bitoperatoren.py print("Bitoperatoren") a = 6 b = 7 print("a = {:04b}".format(a)) print("b = {:04b}".format(b)) print() <|fim_suffix|># NOT print("~a = {:04b} (Ausgabe mit Vorzeichen!)".format(~a))...
code_fim
medium
{ "lang": "python", "repo": "hobbyelektroniker/Micropython-Grundlagen", "path": "/002_Kommentare, Blöcke und Operatoren/Code/bitoperatoren.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: cast42/get-popular-tweets-about-deredactie path: /gva.py import twitter import json from collections import Counter from prettytable import PrettyTable from bs4 import BeautifulSoup import requests seen = {} ### https://github.com/edsu/shortpipe/blob/master/shortpipe def unshorten(url): u...
code_fim
hard
{ "lang": "python", "repo": "cast42/get-popular-tweets-about-deredactie", "path": "/gva.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Iterate through 5 more batches of results by following the cursor for _ in range(5): print "Length of statuses", len(statuses) try: next_results = search_results['search_metadata']['next_results'] except KeyError, e: # No more results when next_results doesn't exist break ...
code_fim
hard
{ "lang": "python", "repo": "cast42/get-popular-tweets-about-deredactie", "path": "/gva.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pingziii/plotboss path: /tests/plotlog_test.py import pytest from plotboss.plotlog import PlotLogParser from datetime import datetime import pendulum def test_log_parser(): p = PlotLogParser() p.buffer = 0 p.size = 0 p.buckets = 0 p.num_threads = 0 assert p.size == 0 ...
code_fim
hard
{ "lang": "python", "repo": "pingziii/plotboss", "path": "/tests/plotlog_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>a71f7ca9850bdcb285f26108fb19f610c788d47e4830c4c7abfa7611e00168' assert p.farmer_key == '93222af1a0f7b2ff39f98eb87c1b609fea797798302a60d1f1d6e5152cfdce12c260325d78446e7b8758101b64f43bd5' assert p.size == 32 assert p.buffer == 4000 assert p.buckets == 128 assert p.num...
code_fim
hard
{ "lang": "python", "repo": "pingziii/plotboss", "path": "/tests/plotlog_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yash-goel/SfmLearner-Pytorch path: /exp_mask_test.py import torch from torch.autograd import Variable from scipy.misc import imresize from imageio import imread, imsave import numpy as np from path import Path import argparse from tqdm import tqdm from models import PoseExpNet from inverse_warp...
code_fim
hard
{ "lang": "python", "repo": "yash-goel/SfmLearner-Pytorch", "path": "/exp_mask_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> args.output_disp = True if args.output_disp: # disp_ = exp_mask.data[:,2,:,:].reshape(1,128,416) # print(disp_) # disp = (255*tensor2array(disp_, max_value=10, colormap='bone')).astype(np.uint8) max_value = exp_mask.data.max().item() ...
code_fim
hard
{ "lang": "python", "repo": "yash-goel/SfmLearner-Pytorch", "path": "/exp_mask_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Entry point for all wsgi applications.""" output = [] if environ['REQUEST_METHOD'] == 'GET': return bad_request(start_response) ##### parameters are never safe try: content_length = int(environ['CONTENT_LENGTH']) except ValueError: return bad_request(s...
code_fim
hard
{ "lang": "python", "repo": "pstrinkle/popflip-image-stream", "path": "/backend/api/snapshot/reply.wsgi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pstrinkle/popflip-image-stream path: /backend/api/snapshot/reply.wsgi """Reply API Call handler for snapshots.""" from pymongo import Connection from pymongo.errors import InvalidId from bson.objectid import ObjectId from datetime import datetime from cgi import escape, parse_multipart, parse_he...
code_fim
hard
{ "lang": "python", "repo": "pstrinkle/popflip-image-stream", "path": "/backend/api/snapshot/reply.wsgi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dldinternet/aws-sso path: /src/awssso/console/arg_parser_login.py """Create the login parser.""" from __future__ import annotations import typing from awssso.console.login import login if typing.TYPE_CHECKING: import argparse <|fim_suffix|> subparsers: argparse._SubParsersAction, p...
code_fim
medium
{ "lang": "python", "repo": "dldinternet/aws-sso", "path": "/src/awssso/console/arg_parser_login.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not default_args: default_args = {} default_args.update( { "export": False, "json": False, "shell": False, "renew": False, }, ) return default_args<|fim_prefix|># repo: dldinternet/aws-sso path: /src/awssso/console...
code_fim
hard
{ "lang": "python", "repo": "dldinternet/aws-sso", "path": "/src/awssso/console/arg_parser_login.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Constructionware/GmTools path: /Application/Server/dataBase.py se: return f"GM Tools Default Sqlite Database {self.dbs.get(self.default)}" class Client(AdminBase): __tablename__ = 'client' id = Column(Integer, primary_key=True) client_id = Column(String, nullable=False) ...
code_fim
hard
{ "lang": "python", "repo": "Constructionware/GmTools", "path": "/Application/Server/dataBase.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.db = Database(name='tools') def getTool(self, id:str=None): return BatteryTool.query.all() @property def save(self): self.connect_db self.db.session.add(self) self.db.session.commit() class PowerTool(Base): __tablename__ = 'power_tool' ...
code_fim
hard
{ "lang": "python", "repo": "Constructionware/GmTools", "path": "/Application/Server/dataBase.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def generate_id(self): if self.name: self.tool_id = cnf.keygen.name_id('B', self.name) async def list_tools(self): query = """SELECT * FROM battery_tool""" await self.db.async_connection.connect() results = await self.db.async_connect...
code_fim
hard
{ "lang": "python", "repo": "Constructionware/GmTools", "path": "/Application/Server/dataBase.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: betamaxpy/betamax path: /tests/unit/test_decorator.py try: from unittest import mock except ImportError: import mock import betamax from betamax.decorator import use_cassette @mock.patch('betamax.recorder.Betamax', autospec=True) def test_wraps_session(Betamax): # This needs to be ...
code_fim
hard
{ "lang": "python", "repo": "betamaxpy/betamax", "path": "/tests/unit/test_decorator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @use_cassette('foo', cassette_library_dir='dir') def _test(session): pass _test() assert Session.call_count == 1<|fim_prefix|># repo: betamaxpy/betamax path: /tests/unit/test_decorator.py try: from unittest import mock except ImportError: import mock import betamax from...
code_fim
hard
{ "lang": "python", "repo": "betamaxpy/betamax", "path": "/tests/unit/test_decorator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Piantadosi-Lab/SARS-CoV-2_ATL_Introductions path: /phylogenetic_analysis/scripts/cluster_seqs.py import argparse import pandas as pd from Bio import Phylo import itertools import numpy as np import scipy.sparse def run(): parser = argparse.ArgumentParser() parser.add_argument('--tree'...
code_fim
hard
{ "lang": "python", "repo": "Piantadosi-Lab/SARS-CoV-2_ATL_Introductions", "path": "/phylogenetic_analysis/scripts/cluster_seqs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(f'there are {len(cc_assigned[1].unique())} clusters using a threshold of {args.threshold}') for cc_idx, cc_id in enumerate(np.unique(cc[1])): print(f'there are {np.unique(cc[1], return_counts=True)[1][cc_idx]} sequences in cluster {cc_id}') cc_assigned.to_csv(args.tree.split('.'...
code_fim
hard
{ "lang": "python", "repo": "Piantadosi-Lab/SARS-CoV-2_ATL_Introductions", "path": "/phylogenetic_analysis/scripts/cluster_seqs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from . import discs, filters, particles, sinks, sph, total from .profile import Profile, load_profile __all__ = [ 'Profile', 'discs', 'filters', 'load_profile', 'particles', 'sinks', 'sph', 'total', ]<|fim_prefix|># repo: dmentipl/plonk path: /src/plonk/analysis/__init__....
code_fim
hard
{ "lang": "python", "repo": "dmentipl/plonk", "path": "/src/plonk/analysis/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmentipl/plonk path: /src/plonk/analysis/__init__.py """Analysis of SPH data. The analysis sub-package contains Plonk implementations of typical smoothed particle hydrodynamics post-simulation analysis tasks. Examples -------- Create a radial profile in the xy-plane. >>> p = Profile(snap, cmin...
code_fim
medium
{ "lang": "python", "repo": "dmentipl/plonk", "path": "/src/plonk/analysis/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>>>> p = Profile(snap, cmin=10, cmax=200, n_bins=100) >>> p.plot('radius', 'density') Calculate the angular momentum on the particles. >>> angmom = particles.angular_momentum(snap) Calculate the total angular momentum over all particles. >>> angmom_tot = total.angular_momentum(snap) Calculate the Roch...
code_fim
medium
{ "lang": "python", "repo": "dmentipl/plonk", "path": "/src/plonk/analysis/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jneight/zooz-python path: /zooz/exceptions.py # coding=utf-8 class ZoozException(Exception): <|fim_suffix|> Exception.__init__(self, message) self.status_code = status_code<|fim_middle|> """ Extends Exception class adding: message: error message returned b...
code_fim
hard
{ "lang": "python", "repo": "jneight/zooz-python", "path": "/zooz/exceptions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Exception.__init__(self, message) self.status_code = status_code<|fim_prefix|># repo: jneight/zooz-python path: /zooz/exceptions.py # coding=utf-8 class ZoozException(Exception): <|fim_middle|> """ Extends Exception class adding: message: error message returned b...
code_fim
hard
{ "lang": "python", "repo": "jneight/zooz-python", "path": "/zooz/exceptions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rynmlng/airbrake-django path: /airbrake/middleware.py from django.conf import settings try: # MiddlewareMixin is not available on older versions of Django from django.utils.deprecation import MiddlewareMixin except ImportError: MiddlewareMixin = object from airbrake.utils.client impor...
code_fim
hard
{ "lang": "python", "repo": "rynmlng/airbrake-django", "path": "/airbrake/middleware.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.client = Client() super(AirbrakeNotifierMiddleware, self).__init__(*args, **kwargs) def process_exception(self, request, exception): if (hasattr(settings, 'AIRBRAKE') and not settings.AIRBRAKE.get('DISABLE', False) and not isinstance(excep...
code_fim
medium
{ "lang": "python", "repo": "rynmlng/airbrake-django", "path": "/airbrake/middleware.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if (hasattr(settings, 'AIRBRAKE') and not settings.AIRBRAKE.get('DISABLE', False) and not isinstance(exception, settings.AIRBRAKE.get('FILTERED_EXCEPTIONS', tuple()))): self.client.notify(exception=exception, request=request)<|fim_prefix|># repo: rynmlng...
code_fim
medium
{ "lang": "python", "repo": "rynmlng/airbrake-django", "path": "/airbrake/middleware.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ recompute task count """ for line in self: line.tasks_count = len(line.tasks_ids)<|fim_prefix|># repo: cogitoweb/project_task_projectref_cogitoweb path: /model/order_line.py # -*- coding: utf-8 -*- """ override order line """ import pprint import logging from openerp imp...
code_fim
hard
{ "lang": "python", "repo": "cogitoweb/project_task_projectref_cogitoweb", "path": "/model/order_line.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cogitoweb/project_task_projectref_cogitoweb path: /model/order_line.py # -*- coding: utf-8 -*- """ override order line """ import pprint import logging <|fim_suffix|> """ override order line """ _inherit = 'sale.order.line' project_id = fields.Many2one('project.project', string="Re...
code_fim
medium
{ "lang": "python", "repo": "cogitoweb/project_task_projectref_cogitoweb", "path": "/model/order_line.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ override order line """ _inherit = 'sale.order.line' project_id = fields.Many2one('project.project', string="Related Project") fixed_price = fields.Boolean(default=False) tasks_ids = fields.One2many('project.task', 'direct_sale_line_id', string="Related Tasks") tasks_count = ...
code_fim
medium
{ "lang": "python", "repo": "cogitoweb/project_task_projectref_cogitoweb", "path": "/model/order_line.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> line = bytes() ret = False while True: c = stream.read(1) if c is None: continue if len(c) == 0: try: return ujson.loads(line) except (BaseException, Exception): sys.exit(0) if c.decode() == "...
code_fim
medium
{ "lang": "python", "repo": "paulfelix/fdk-python", "path": "/fdk/parser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: paulfelix/fdk-python path: /fdk/parser.py # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LIC...
code_fim
medium
{ "lang": "python", "repo": "paulfelix/fdk-python", "path": "/fdk/parser.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> raise QueryError(ex, code=400) return query_inner def trace(entity=None, op=u'view'): """Decorator """ def wrapper(fn): @wraps(fn) def decorated(*args, **kwargs): # get start time start = time() args = list(args)...
code_fim
hard
{ "lang": "python", "repo": "fossabot/beehive", "path": "/beehive/common/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fossabot/beehive path: /beehive/common/data.py ''' Created on Jan 31, 2014 @author: darkbk ''' from time import time from functools import wraps import logging from uuid import uuid4 from sqlalchemy.exc import IntegrityError, DBAPIError from beecell.simple import id_gen from beecell.simple impor...
code_fim
hard
{ "lang": "python", "repo": "fossabot/beehive", "path": "/beehive/common/data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @wraps(fn) def decorated(*args, **kwargs): # get start time start = time() args = list(args) inst = args.pop(0) def get_entity(entity): if entity is None: return inst ...
code_fim
hard
{ "lang": "python", "repo": "fossabot/beehive", "path": "/beehive/common/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s.add_json_panel(player, self.config, j) def save(self): self.config.write() self.manager.current = 'menu' players = [ {'name': 'Player1', 'source': 'imgs/DUCK.GIF', #'weapon': 'gun', 'pos': (50, 50), ...
code_fim
hard
{ "lang": "python", "repo": "yfodor/sky_bombers", "path": "/src/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yfodor/sky_bombers path: /src/main.py def __init__(self, game, velocity_x=0.0, velocity_y=0.0, **kwargs): self.game = game attrs = {} for attr in 'rgba': if attr in kwargs: attrs[attr] = kwargs.pop(attr) ...
code_fim
hard
{ "lang": "python", "repo": "yfodor/sky_bombers", "path": "/src/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yfodor/sky_bombers path: /src/main.py self.x += self.velocity_x def distance(self, other): a = (self.center_x - other.center_x) ** 2 b = (self.center_y - other.center_y) ** 2 return math.sqrt(a+b) def collide(self, other, area=...
code_fim
hard
{ "lang": "python", "repo": "yfodor/sky_bombers", "path": "/src/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: flaviofontes29/Machine-Learning-e-Data-Science-com-Python path: /Secao 3 - Pre-processamento com Pandas e scikit-learm/pre_processamento_census.py import pandas as pd base = pd.read_csv('census.csv') previsores = base.iloc[:, 0:14].values classe = base.iloc[:, 14].values from s...
code_fim
medium
{ "lang": "python", "repo": "flaviofontes29/Machine-Learning-e-Data-Science-com-Python", "path": "/Secao 3 - Pre-processamento com Pandas e scikit-learm/pre_processamento_census.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from sklearn.preprocessing import StandardScaler scaler = StandardScaler() previsores = scaler.fit_transform(previsores)<|fim_prefix|># repo: flaviofontes29/Machine-Learning-e-Data-Science-com-Python path: /Secao 3 - Pre-processamento com Pandas e scikit-learm/pre_processamento_census.py import pandas as...
code_fim
hard
{ "lang": "python", "repo": "flaviofontes29/Machine-Learning-e-Data-Science-com-Python", "path": "/Secao 3 - Pre-processamento com Pandas e scikit-learm/pre_processamento_census.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>labelencorder_classe = LabelEncoder() classe = labelencorder_classe.fit_transform(classe) from sklearn.preprocessing import StandardScaler scaler = StandardScaler() previsores = scaler.fit_transform(previsores)<|fim_prefix|># repo: flaviofontes29/Machine-Learning-e-Data-Science-com-Python path: /Secao 3...
code_fim
hard
{ "lang": "python", "repo": "flaviofontes29/Machine-Learning-e-Data-Science-com-Python", "path": "/Secao 3 - Pre-processamento com Pandas e scikit-learm/pre_processamento_census.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: afrigon/fastapi-template path: /tests/conftest.py """ Application fixtures to easily create app instances Examples: $ python -m pytest $ coverage run -m pytest $ coverage report $ coverage html """ import pytest from starlette.testclient import TestClient from app import Applica...
code_fim
medium
{ "lang": "python", "repo": "afrigon/fastapi-template", "path": "/tests/conftest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """application client fixture""" return TestClient(app)<|fim_prefix|># repo: afrigon/fastapi-template path: /tests/conftest.py """ Application fixtures to easily create app instances Examples: $ python -m pytest $ coverage run -m pytest $ coverage report $ coverage html """ <|f...
code_fim
hard
{ "lang": "python", "repo": "afrigon/fastapi-template", "path": "/tests/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.fixture def client(app): """application client fixture""" return TestClient(app)<|fim_prefix|># repo: afrigon/fastapi-template path: /tests/conftest.py """ Application fixtures to easily create app instances Examples: $ python -m pytest $ coverage run -m pytest $ coverage re...
code_fim
medium
{ "lang": "python", "repo": "afrigon/fastapi-template", "path": "/tests/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def predict_instance(self, instance: Instance) -> JsonDict: outputs = super().predict_instance(instance) outputs = self.detect_anomaly(outputs) return outputs def predict_batch_instance(self, instances: List[Instance]) -> List[JsonDict]: outputs = super().predict_b...
code_fim
hard
{ "lang": "python", "repo": "altescy/cvdd", "path": "/cvdd/predictors/anomaly_detector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: altescy/cvdd path: /cvdd/predictors/anomaly_detector.py from typing import List, Optional from allennlp.common.util import JsonDict from allennlp.data import Instance from allennlp.data.dataset_readers import DatasetReader from allennlp.data.tokenizers.spacy_tokenizer import SpacyTokenizer from ...
code_fim
hard
{ "lang": "python", "repo": "altescy/cvdd", "path": "/cvdd/predictors/anomaly_detector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @overrides def _json_to_instance(self, json_dict: JsonDict) -> Instance: text = json_dict["text"] reader_has_tokenizer = ( getattr(self._dataset_reader, "tokenizer", None) is not None or getattr(self._dataset_reader, "_tokenizer", None) is not None )...
code_fim
hard
{ "lang": "python", "repo": "altescy/cvdd", "path": "/cvdd/predictors/anomaly_detector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # dummy event data data = EventData() data.set_event(np.tile(np.arange(5), (2, 2)).T) filtered_data = data.filter_event( [True, False, True, True, False, False, True, True, False, False]) assert_equal(filtered_data.n_events, 5) assert_array_equa...
code_fim
hard
{ "lang": "python", "repo": "RongCao18/kamrecsys", "path": "/kamrecsys/data/tests/test_event.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_array_equal( filtered_data.event[:, 0], [1, 5, 3, 4, 0, 0, 0, 2, 2, 0]) assert_array_equal( filtered_data.event[:, 1], [1, 3, 6, 5, 7, 6, 4, 0, 7, 2]) assert_array_equal( filtered_data.to_eid(0, filtered_data.event[:, 0]), dat...
code_fim
hard
{ "lang": "python", "repo": "RongCao18/kamrecsys", "path": "/kamrecsys/data/tests/test_event.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RongCao18/kamrecsys path: /kamrecsys/data/tests/test_event.py #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import ( print_function, division, absolute_import) from six.moves import xrange # ============================================================================...
code_fim
hard
{ "lang": "python", "repo": "RongCao18/kamrecsys", "path": "/kamrecsys/data/tests/test_event.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: raabuchanan/dont-waste-time path: /faceMatch/faceMatchTest.py import httplib, urllib, base64, json import time headers = { # Request headers. 'Content-Type': 'application/json', # NOTE: Replace the "Ocp-Apim-Subscription-Key" value with a valid subscription key. 'Ocp-Apim-Subsc...
code_fim
hard
{ "lang": "python", "repo": "raabuchanan/dont-waste-time", "path": "/faceMatch/faceMatchTest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>################################################################################# # ADD PICTURE TO PERSON ################################################################################## headers['Content-Type'] = 'application/octet-stream' filename = '/home/raab/russell1.jpg' f = open(fi...
code_fim
hard
{ "lang": "python", "repo": "raabuchanan/dont-waste-time", "path": "/faceMatch/faceMatchTest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def upload_samples(): """Upload the samples identified within the target to the Sandbox API.""" # Retrieve a list of all files and paths within the target paths = Path(Config.target_dir).glob(Config.target_pattern) # Inform the user as to what we're doing logger.info("Assembling %s vol...
code_fim
hard
{ "lang": "python", "repo": "CrowdStrike/falconpy", "path": "/samples/quick_scan/scan_target.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> """Retrieve the scan results for the submitted scan.""" # Loop thru our results, compare to our upload and return the verdict for result in results: for item in Analyzer.files: if result["sha256"] == item[2]: if "no specific threat" in result["verdict"]: ...
code_fim
hard
{ "lang": "python", "repo": "CrowdStrike/falconpy", "path": "/samples/quick_scan/scan_target.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: CrowdStrike/falconpy path: /samples/quick_scan/scan_target.py f coffee. # # ===== NOTES REGARDING THIS SOLUTION ============================================================ # # This is a proof of concept. Extensive performance testing has not been performed at this time. # # A VOLUME is a collect...
code_fim
hard
{ "lang": "python", "repo": "CrowdStrike/falconpy", "path": "/samples/quick_scan/scan_target.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: immacmillan/imranmacpy path: /app/routes.py from flask import render_template, flash, redirect, url_for from app import app from app.forms import ContactMeForm from flask_pymongo import PyMongo mongo = PyMongo(app) @app.route('/') @app.route('/index') def index(): user = {'username': 'Imran...
code_fim
medium
{ "lang": "python", "repo": "immacmillan/imranmacpy", "path": "/app/routes.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> return render_template('index.html') @app.route('/about') def about(): return render_template('about.html') @app.route('/contactme', methods=['GET', 'POST', 'DELETE', 'PATCH']) def contactme(): form = ContactMeForm() if form.validate_on_submit(): contact_collection = mongo.db.cont...
code_fim
hard
{ "lang": "python", "repo": "immacmillan/imranmacpy", "path": "/app/routes.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> def do_tag(tag, tag_msg, dry_run, force): cmd = ["git", "tag", tag, "-s", "-m", tag_msg] if force: cmd.append("--force") cmd_str = format_syscmd(cmd) if dry_run: yield "DRYRUN: %s" % cmd_str else: yield "EXEC: %s" % cmd_str exec_cmd(cmd) def bumpver( ...
code_fim
hard
{ "lang": "python", "repo": "pypiserver/pypiserver", "path": "/bin/bumpver.py", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|># repo: pypiserver/pypiserver path: /bin/bumpver.py #!/usr/bin/env python # # NEED POSIX (i.e. *Cygwin* on Windows). """ Script to bump, commit and tag new versions. USAGE: bumpver bumpver [-n] [-f] [-c] [-a] [-t <message>] <new-ver> Without <new-ver> prints version extracted from current file. Do...
code_fim
hard
{ "lang": "python", "repo": "pypiserver/pypiserver", "path": "/bin/bumpver.py", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|># Answer: # IGF1 is the second most central in terms of betweenness # also very visible from the histogram<|fim_prefix|># repo: msipola/CBM101 path: /D_Network_analysis/solutions/ex2_8.py btws = nx.betweenness_centrality(G) <|fim_middle|>sorted(btws.items(), key=lambda d:d[1], reverse=True) #you've see...
code_fim
medium
{ "lang": "python", "repo": "msipola/CBM101", "path": "/D_Network_analysis/solutions/ex2_8.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msipola/CBM101 path: /D_Network_analysis/solutions/ex2_8.py btws = nx.betweenness_centrality(G) <|fim_suffix|># Answer: # IGF1 is the second most central in terms of betweenness # also very visible from the histogram<|fim_middle|>sorted(btws.items(), key=lambda d:d[1], reverse=True) #you've see...
code_fim
medium
{ "lang": "python", "repo": "msipola/CBM101", "path": "/D_Network_analysis/solutions/ex2_8.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexwitt23/efficientdet path: /src/efficientdet.py """ Main detector module which can be used for training and inferencing. """ from typing import List import collections import torch import efficientnet, bifpn, retinanet_head from third_party import ( postprocess, regression, anch...
code_fim
hard
{ "lang": "python", "repo": "alexwitt23/efficientdet", "path": "/src/efficientdet.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if torch.cuda.is_available(): self.anchors.all_anchors = self.anchors.all_anchors.cuda() self.anchors.anchors_over_all_feature_maps = [ anchors.cuda() for anchors in self.anchors.anchors_over_all_feature_maps ] self.postprocess = postpro...
code_fim
hard
{ "lang": "python", "repo": "alexwitt23/efficientdet", "path": "/src/efficientdet.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Create the BiFPN with the supplied parameter options. self.fpn = bifpn.BiFPN( in_channels=features, out_channels=params[2], num_bifpns=params[3], levels=[3, 4, 5], bifpn_height=5, ) self.anchors = anchors.AnchorG...
code_fim
hard
{ "lang": "python", "repo": "alexwitt23/efficientdet", "path": "/src/efficientdet.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chewvader/django-geonames path: /geonames/admin.py from django.contrib.gis import admin from geonames.models import Geoname, Alternate from django.utils.translation import ugettext_lazy as _ from django.contrib.admin import SimpleListFilter class CityListFilter(SimpleListFilter): # Human-...
code_fim
hard
{ "lang": "python", "repo": "chewvader/django-geonames", "path": "/geonames/admin.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class AlternateInline(admin.TabularInline): model = Alternate class GeonameAdmin(admin.GeoModelAdmin): search_fields = ('name',) list_display = ('name', 'country', 'timezone') list_filter = (CityListFilter, 'country', 'timezone') inlines = (AlternateInline,) admin.site.register(Geo...
code_fim
hard
{ "lang": "python", "repo": "chewvader/django-geonames", "path": "/geonames/admin.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sicara/tf-explain path: /tests/core/test_grad_cam.py import numpy as np import pytest import tensorflow as tf from tf_explain.core.grad_cam import GradCAM def test_should_generate_ponderated_output(mocker): mocker.patch( "tf_explain.core.grad_cam.GradCAM.ponderate_output", ...
code_fim
hard
{ "lang": "python", "repo": "sicara/tf-explain", "path": "/tests/core/test_grad_cam.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize( "model,expected_layer_name", [ ( tf.keras.Sequential( [ tf.keras.layers.Conv2D( 3, 3, input_shape=(28, 28, 1), name="conv_1" ), tf.keras.layers.MaxPooli...
code_fim
hard
{ "lang": "python", "repo": "sicara/tf-explain", "path": "/tests/core/test_grad_cam.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlflow/mlflow path: /examples/sktime/test_sktime_model_export.py m unittest import mock import boto3 import flavor import moto import numpy as np import pandas as pd import pytest from botocore.config import Config from sktime.datasets import load_airline, load_longley from sktime.datatypes impo...
code_fim
hard
{ "lang": "python", "repo": "mlflow/mlflow", "path": "/examples/sktime/test_sktime_model_export.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlflow/mlflow path: /examples/sktime/test_sktime_model_export.py rt pytest from botocore.config import Config from sktime.datasets import load_airline, load_longley from sktime.datatypes import convert from sktime.forecasting.arima import AutoARIMA from sktime.forecasting.model_selection import t...
code_fim
hard
{ "lang": "python", "repo": "mlflow/mlflow", "path": "/examples/sktime/test_sktime_model_export.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> X_test_array = convert(X_test, "pd.DataFrame", "np.ndarray") model_predict = naive_forecaster_model_with_regressor.predict(fh=FH, X=X_test) predict_conf = pd.DataFrame([{"fh": FH, "predict_method": "predict", "X": X_test_array}]) pyfunc_predict = loaded_pyfunc.predict(predict_conf) np...
code_fim
hard
{ "lang": "python", "repo": "mlflow/mlflow", "path": "/examples/sktime/test_sktime_model_export.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lepy/pydpf-core path: /tests/test_checkversion.py from ansys.dpf.core import Model from ansys.dpf.core import check_version from ansys.dpf.core import errors as dpf_errors import pytest def test_get_server_version(multishells): model = Model(multishells) server = model._server # ver...
code_fim
hard
{ "lang": "python", "repo": "lepy/pydpf-core", "path": "/tests/test_checkversion.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_version_tuple(): t1 = "2.0.0" t1_check = 2, 0, 0 t1_get = check_version.version_tuple(t1) assert t1_get == t1_check t2 = "2.0" t2_check = 2, 0, 0 t2_get = check_version.version_tuple(t2) assert t2_get == t2_check def test_meets_version(): # first is server v...
code_fim
hard
{ "lang": "python", "repo": "lepy/pydpf-core", "path": "/tests/test_checkversion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_meets_version(): # first is server version, second is version to meet assert check_version.meets_version("1.32.0", "1.31.0") assert check_version.meets_version("1.32.1", "1.32.0") assert check_version.meets_version("1.32.0", "1.32.0") assert check_version.meets_version("1.32",...
code_fim
hard
{ "lang": "python", "repo": "lepy/pydpf-core", "path": "/tests/test_checkversion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from resources import QAgiResources, \ loadRsc, loadRes<|fim_prefix|># repo: ipa320/airbus_coop path: /airbus_pyqt_extend/src/airbus_pyqt_extend/QtAgiCore/__init__.py from topics import QAgiSubscriber from packages import get_pkg_dir_from_prefix, \ get_ros_work...
code_fim
hard
{ "lang": "python", "repo": "ipa320/airbus_coop", "path": "/airbus_pyqt_extend/src/airbus_pyqt_extend/QtAgiCore/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ipa320/airbus_coop path: /airbus_pyqt_extend/src/airbus_pyqt_extend/QtAgiCore/__init__.py from topics import QAgiSubscriber from packages import get_pkg_dir_from_prefix, \ get_ros_workspace_dir, \ get_ro<|fim_suffix|> from resources import QAgiResources, ...
code_fim
hard
{ "lang": "python", "repo": "ipa320/airbus_coop", "path": "/airbus_pyqt_extend/src/airbus_pyqt_extend/QtAgiCore/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DexterInd/GrovePi path: /Software/Python/grove_barometer_sensors/high_accuracy_hp206c_barometer/high_accuracy_barometer_example.py #!/usr/bin/env python # # GrovePi Example for using the Grove - Barometer (High-Accuracy)(http://www.seeedstudio.com/depot/Grove-Barometer-HighAccuracy-p-1865.html # ...
code_fim
hard
{ "lang": "python", "repo": "DexterInd/GrovePi", "path": "/Software/Python/grove_barometer_sensors/high_accuracy_hp206c_barometer/high_accuracy_barometer_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }