text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> group.task=flight.role parkingHandler=ParkingHandler(mission,template,country) for i, member in enumerate(flight.members): aircraft_type = readAircraftType(member) p = mission.aircraft(member.unitName(), aircraft_type, country) parkingHandler.assign_parking(...
code_fim
hard
{ "lang": "python", "repo": "gronank/MissionGen", "path": "/MissionGen/groupgen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> player_info = self.encode_player_info(player_info) misc_info = self.encode_misc_info(available_actions, last_actions) return np.concatenate([player_info, misc_info], axis=0) # Encodes: minerals, vespene, food_used and food_cap def encode_player_info(self, player_info): ...
code_fim
hard
{ "lang": "python", "repo": "Ricechrispi/sc2_academy", "path": "/sc2_academy/envs/observation_converter.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> entities = [] iter_len = min(len(feature_units), self.MAX_ENTITIES) for unit in feature_units[:iter_len]: unit_type = unit['unit_type'] x = unit['x'] y = unit['y'] is_selected = unit['is_selected'] # 0 for no, 1 for yes ...
code_fim
hard
{ "lang": "python", "repo": "Ricechrispi/sc2_academy", "path": "/sc2_academy/envs/observation_converter.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ricechrispi/sc2_academy path: /sc2_academy/envs/observation_converter.py import tensorflow as tf import numpy as np from gym import spaces from pysc2.env import mock_sc2_env class ObservationConverter: def __init__(self, env_settings, action_converter): super().__init__() ...
code_fim
hard
{ "lang": "python", "repo": "Ricechrispi/sc2_academy", "path": "/sc2_academy/envs/observation_converter.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyre/pyre path: /packages/pyre/calc/Const.py # -*- coding: utf-8 -*- # # michael a.g. aïvázis # orthologue # (c) 1998-2023 all rights reserved # class Const: """ Mix-in class that serves a read-only value that must be set during construction """ <|fim_suffix|> """ Di...
code_fim
medium
{ "lang": "python", "repo": "pyre/pyre", "path": "/packages/pyre/calc/Const.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Mix-in class that serves a read-only value that must be set during construction """ # value management def getValue(self): """ Return my value """ # easy enough return self._value def setValue(self, value): """ Disable ...
code_fim
medium
{ "lang": "python", "repo": "pyre/pyre", "path": "/packages/pyre/calc/Const.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Return my value """ # easy enough return self._value def setValue(self, value): """ Disable value setting """ # disabled raise NotImplementedError("const nodes do not support 'setValue'") # end of file<|fim_prefix|...
code_fim
medium
{ "lang": "python", "repo": "pyre/pyre", "path": "/packages/pyre/calc/Const.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['sled']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_sledding.py #calss header class _SLEDDING(): <|fim_middle|> def __init__(self,): self.name = "SLEDDING" self.definit...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_sledding.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_sledding.py #calss header class _SLEDDING(): def __init__(self,): <|fim_suffix|> self.basic = ['sled']<|fim_middle|> self.name = "SLEDDING" self.definitions = sled self.parents = [] self.childen = [] self.properties = [] self.js...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_sledding.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.basic = ['sled']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_sledding.py #calss header class _SLEDDING(): def __init__(self,): self.name = "SLEDDING" self.definitions = sled <|fim_middle|> self.parents = [] self.childen = [] self.properties = [] self.js...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_sledding.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saminahbab/gen-arg path: /src/genie/scorer.py import os import json import argparse import re from copy import deepcopy from collections import defaultdict from tqdm import tqdm import spacy from utils import load_ontology,find_arg_span, compute_f1, get_entity_span, find_head, WhitespaceT...
code_fim
hard
{ "lang": "python", "repo": "saminahbab/gen-arg", "path": "/src/genie/scorer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> examples = {} doc2ex = defaultdict(list) # a document contains multiple events with open(args.gen_file,'r') as f: for lidx, line in enumerate(f): # this solution relies on keeping the exact same order pred = json.loads(line.strip()) examples[lidx] = { ...
code_fim
hard
{ "lang": "python", "repo": "saminahbab/gen-arg", "path": "/src/genie/scorer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aimdarx/data-structures-and-algorithms path: /solutions/_Patterns for Coding Questions/Sliding Window/maximum_sum_subarray_of_size_k.py """ Maximum Sum Subarray of Size K: Given an array of positive numbers and a positive number ‘k,’ find the maximum sum of any contiguous subarray of size ‘k’....
code_fim
hard
{ "lang": "python", "repo": "aimdarx/data-structures-and-algorithms", "path": "/solutions/_Patterns for Coding Questions/Sliding Window/maximum_sum_subarray_of_size_k.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # first subarray -> create window for idx in range(k): curr_sum += arr[idx] maximum = curr_sum # other subarrays for idx in range(1, len(arr)-(k-1)): curr_sum -= arr[idx-1] # remove from window curr_sum += arr[idx+(k-1)] # add to window maximum = max(...
code_fim
medium
{ "lang": "python", "repo": "aimdarx/data-structures-and-algorithms", "path": "/solutions/_Patterns for Coding Questions/Sliding Window/maximum_sum_subarray_of_size_k.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danieljcrabtree/lrrbot path: /lrrbot/test_cardviewer.py import asyncio import unittest import lrrbot.cardviewer class TestCardViewerExtract(unittest.TestCase): def setUp(self): self.cardviewer = lrrbot.cardviewer.CardViewer(None, asyncio.get_event_loop()) def test_extract_gatherer(self): ...
code_fim
hard
{ "lang": "python", "repo": "danieljcrabtree/lrrbot", "path": "/lrrbot/test_cardviewer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_extract_local_dash_leading_zeroes(self): self.assertEqual(self.cardviewer._extract("http://localhost/cards/SOI-005a.jpg"), ("SOI", "5a")) def test_extract_local_underscore_leading_zeroes(self): self.assertEqual(self.cardviewer._extract("http://localhost/cards/SOI_005a.jpg"), ("SOI", "5a"))...
code_fim
hard
{ "lang": "python", "repo": "danieljcrabtree/lrrbot", "path": "/lrrbot/test_cardviewer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> after_each: del os.environ[self.env_name] it "returns the value from the environment if default_val is set": env = objs.Environment(self.env_name, self.fallback_val, None) self.assertEqual(env.pair, (self.env_name, self.env_val)) ...
code_fim
hard
{ "lang": "python", "repo": "hackerlank/harpoon-2", "path": "/tests/option_spec/objs/test_simple.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hackerlank/harpoon-2 path: /tests/option_spec/objs/test_simple.py # coding: spec from harpoon.option_spec import image_objs as objs from harpoon.errors import HarpoonError from tests.helpers import HarpoonCase from noseOfYeti.tokeniser.support import noy_sup_setUp, noy_sup_tearDown from input_...
code_fim
hard
{ "lang": "python", "repo": "hackerlank/harpoon-2", "path": "/tests/option_spec/objs/test_simple.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>describe HarpoonCase, "Port object": before_each: self.ip = self.unique_val() self.host_port = self.unique_val() self.container_port_str = self.unique_val() self.container_port = mock.Mock(name="container_port", spec=objs.ContainerPort, port_str=self.container_port_str)...
code_fim
hard
{ "lang": "python", "repo": "hackerlank/harpoon-2", "path": "/tests/option_spec/objs/test_simple.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return CONFIG['active_network']['gas_price'] or web3.eth.gasPrice class Account(_AccountBase): '''Class for interacting with an Ethereum account. Attributes: address: Public address of the account. nonce: Current nonce of the account.''' def _console_repr(self): ...
code_fim
hard
{ "lang": "python", "repo": "subos2008/brownie", "path": "/lib/components/account.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _gas_price(self): return CONFIG['active_network']['gas_price'] or web3.eth.gasPrice class Account(_AccountBase): '''Class for interacting with an Ethereum account. Attributes: address: Public address of the account. nonce: Current nonce of the account.''' d...
code_fim
hard
{ "lang": "python", "repo": "subos2008/brownie", "path": "/lib/components/account.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: subos2008/brownie path: /lib/components/account.py #!/usr/bin/python3 import eth_keys from hexbytes import HexBytes import os from lib.components.transaction import TransactionReceipt, raise_or_return_tx from lib.components.eth import web3, wei from lib.services.bip44 import HDPrivateKey, HDKey...
code_fim
hard
{ "lang": "python", "repo": "subos2008/brownie", "path": "/lib/components/account.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sassoftware/python-sasctl path: /src/sasctl/pzmm/zip_model.py # Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import io import zipfile from pathlib import Path from typing import Optional, Union def _filter_files(file_dir: Uni...
code_fim
hard
{ "lang": "python", "repo": "sassoftware/python-sasctl", "path": "/src/sasctl/pzmm/zip_model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> model_files: Union[dict, str, Path], model_prefix: str, is_viya4: Optional[bool] = False, ) -> io.BytesIO: """ Combines all JSON files with the model pickle file and associated score code file into a single archive ZIP file. If the model_files a...
code_fim
hard
{ "lang": "python", "repo": "sassoftware/python-sasctl", "path": "/src/sasctl/pzmm/zip_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class ZipModel: @staticmethod def zip_files( model_files: Union[dict, str, Path], model_prefix: str, is_viya4: Optional[bool] = False, ) -> io.BytesIO: """ Combines all JSON files with the model pickle file and associated score code file into a ...
code_fim
hard
{ "lang": "python", "repo": "sassoftware/python-sasctl", "path": "/src/sasctl/pzmm/zip_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyscaffold/pyscaffold path: /tests/test_templates.py import sys from configparser import ConfigParser from pathlib import Path import pytest from pyscaffold import actions, api from pyscaffold import dependencies as deps from pyscaffold import info, templates def test_get_template(): temp...
code_fim
hard
{ "lang": "python", "repo": "pyscaffold/pyscaffold", "path": "/tests/test_templates.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_setup_cfg(): reqs = ("mydep1>=789.8.1", "mydep3<=90009;python_version>'3.5'", "other") opts = api.bootstrap_options({"project_path": "myproj", "requirements": reqs}) _, opts = actions.get_default_options({}, opts) text = templates.setup_cfg(opts) setup_cfg = ConfigParser() ...
code_fim
hard
{ "lang": "python", "repo": "pyscaffold/pyscaffold", "path": "/tests/test_templates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shashithej/seo-audits-toolkit path: /celery_worker.py from toolkit import celery from toolkit.factory import create_app from toolki<|fim_suffix|>= create_app() init_celery(celery, app)<|fim_middle|>t.celery_utils import init_celery app
code_fim
easy
{ "lang": "python", "repo": "shashithej/seo-audits-toolkit", "path": "/celery_worker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>t.celery_utils import init_celery app = create_app() init_celery(celery, app)<|fim_prefix|># repo: shashithej/seo-audits-toolkit path: /celery_worker.py from toolkit import celery from toolki<|fim_middle|>t.factory import create_app from toolki
code_fim
easy
{ "lang": "python", "repo": "shashithej/seo-audits-toolkit", "path": "/celery_worker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>= create_app() init_celery(celery, app)<|fim_prefix|># repo: shashithej/seo-audits-toolkit path: /celery_worker.py from toolkit import celery from toolkit.factory import create_app from toolki<|fim_middle|>t.celery_utils import init_celery app
code_fim
easy
{ "lang": "python", "repo": "shashithej/seo-audits-toolkit", "path": "/celery_worker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class AdminDepositModelSerializer(serializers.ModelSerializer): class Meta: model = Deposit user = serializers.PrimaryKeyRelatedField(read_only=True, default=serializers.CurrentUserDefault()) fields = ['id', 'user', 'status', ...
code_fim
hard
{ "lang": "python", "repo": "BuildForSDG/team-211-RTRC-ApiBackend", "path": "/api/wallet/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BuildForSDG/team-211-RTRC-ApiBackend path: /api/wallet/serializers.py from rest_framework import serializers from bills_api.users.serializers import UserSerializer from .models import Wallet, Deposit, Transaction from django.contrib.auth import get_user_model import random User = get_user_model()...
code_fim
hard
{ "lang": "python", "repo": "BuildForSDG/team-211-RTRC-ApiBackend", "path": "/api/wallet/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Given this dictionary: dictionary = { "parent": "{\"my_param\": \"Hello!\"}", "other": "other value" } # we can extract from a json string by adding the [json] annotation to parent. response = extract_from_json_example(dictionary) ...
code_fim
hard
{ "lang": "python", "repo": "gridsmartercities/aws-lambda-decorators", "path": "/examples/test_examples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gridsmartercities/aws-lambda-decorators path: /examples/test_examples.py import unittest from unittest.mock import patch, MagicMock, call from botocore.exceptions import ClientError from examples.examples import (extract_example, extract_to_kwargs_example, extract_mandatory_param_example, ...
code_fim
hard
{ "lang": "python", "repo": "gridsmartercities/aws-lambda-decorators", "path": "/examples/test_examples.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DrrDom/rdkit-scripts path: /cansmi.py #!/usr/bin/env python3 #============================================================================== # author : Pavel Polishchuk # date : 26-07-2019 # version : # python_version : # copyright : Pavel Polishchuk 2019 # li...
code_fim
hard
{ "lang": "python", "repo": "DrrDom/rdkit-scripts", "path": "/cansmi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def calc(items): mol, mol_name = items # items is a tuple (mol, mol_name) Chem.AssignStereochemistryFrom3D(mol) smi = Chem.MolToSmiles(mol, isomericSmiles=True) return smi, mol_name def main(): parser = argparse.ArgumentParser(description='Conversion of input file to canonical ...
code_fim
medium
{ "lang": "python", "repo": "DrrDom/rdkit-scripts", "path": "/cansmi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Inserts data into database. :param con: psycopg2 connection object :param items: is an iterable of tuples `(item id, values)` where `values` is either: - A nested dict conforming to the JSON spec - A list (or iterator) of pairs where the first item in the pair...
code_fim
hard
{ "lang": "python", "repo": "better/jsonschema2db", "path": "/jsonschema2db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: better/jsonschema2db path: /jsonschema2db.py acklinks = {} self._postgres_schema = postgres_schema self._item_col_name = item_col_name self._item_col_type = item_col_type self._prefix_col_name = prefix_col_name self._abbreviations = abbreviations se...
code_fim
hard
{ "lang": "python", "repo": "better/jsonschema2db", "path": "/jsonschema2db.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not mutate: for table, row in rows: # Just exhaust the iterator pass elif self._database_flavor == 'redshift' and self._s3_client: with tempfile.TemporaryDirectory() as tmpdirname, con.cursor() as cursor: # Flush t...
code_fim
hard
{ "lang": "python", "repo": "better/jsonschema2db", "path": "/jsonschema2db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("argument size: {}".format(arg_size)) print(x, op, y) print(hex(x), op, hex(y)) if op in ('/', 's/'): print("Test:") print("{") print(" {}_u512,".format(hex(x))) print(" {}_u512,".format(hex(y))) print(" {}_u512,".format(hex(x // y)))...
code_fim
hard
{ "lang": "python", "repo": "microsoft/eEVM", "path": "/3rdparty/intx/test/fuzzer/decode.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/eEVM path: /3rdparty/intx/test/fuzzer/decode.py #!/usr/bin/env python3 import os import sys ops_filter = () ops = ('/', '*', '<<', '>>', '+', '-', 's/') def err(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def decode_file(file): with open(file, 'rb') as f: ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/eEVM", "path": "/3rdparty/intx/test/fuzzer/decode.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: krzysztof-adamski/killrvideo-python path: /killrvideo/uploads/uploads_service_pb2_grpc.py # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc from uploads import uploads_service_pb2 as uploads_dot_uploads__service__pb2 class UploadsServiceStub(object): """Servic...
code_fim
hard
{ "lang": "python", "repo": "krzysztof-adamski/killrvideo-python", "path": "/killrvideo/uploads/uploads_service_pb2_grpc.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Gets an upload destination for a user to upload a video """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def MarkUploadComplete(self, request, context): """Marks an upload a...
code_fim
medium
{ "lang": "python", "repo": "krzysztof-adamski/killrvideo-python", "path": "/killrvideo/uploads/uploads_service_pb2_grpc.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def add_UploadsServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'GetUploadDestination': grpc.unary_unary_rpc_method_handler( servicer.GetUploadDestination, request_deserializer=uploads_dot_uploads__service__pb2.GetUploadDestinationRequest.FromString, ...
code_fim
hard
{ "lang": "python", "repo": "krzysztof-adamski/killrvideo-python", "path": "/killrvideo/uploads/uploads_service_pb2_grpc.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>putTag("hltPhase2L3OIL3Muons"), MuonPtOption = cms.string('Tracker') )<|fim_prefix|># repo: cms-sw/cmssw path: /HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3OIL3MuonCandidates_cfi.py import FWCore.ParameterSet.Config as cms hltPhase2L3OIL3MuonCandidates = cms.EDProducer("L3MuonCandida...
code_fim
medium
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3OIL3MuonCandidates_cfi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3OIL3MuonCandidates_cfi.py import FWCore.ParameterSet.Config as cms hltPhase2L3OIL3MuonCandidates = cms.EDProducer("L3MuonCandidateProducer", InputLinksObjects = cms.In<|fim_suffix|>putTag("hltPhase2L3OIL3Muons"),...
code_fim
medium
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3OIL3MuonCandidates_cfi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DalavanCloud/college-costs path: /paying_for_college/migrations/0014_migrate_url_field_to_notifications.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned def parse_u...
code_fim
medium
{ "lang": "python", "repo": "DalavanCloud/college-costs", "path": "/paying_for_college/migrations/0014_migrate_url_field_to_notifications.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> for feedback in Feedback.objects.using(db_alias).exclude(url=None): try: notification = Notification.objects.using( db_alias).get(oid=parse_url(feedback).get('oid')) notification.url = feedback.url notification.save() except ObjectDoe...
code_fim
hard
{ "lang": "python", "repo": "DalavanCloud/college-costs", "path": "/paying_for_college/migrations/0014_migrate_url_field_to_notifications.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> return os.path.join( 'server', 'workdir', str(uuid) + '.gto', ) def server_bam(self, uuid): return os.path.join( 'server', 'root', str(uuid), str(uuid) + '.bam', ) def make_dummy_c...
code_fim
hard
{ "lang": "python", "repo": "hammer/genetorrent", "path": "/tests/utils/gttestcase.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hammer/genetorrent path: /tests/utils/gttestcase.py f the University of California # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code mus...
code_fim
hard
{ "lang": "python", "repo": "hammer/genetorrent", "path": "/tests/utils/gttestcase.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def data_download_test_xml(self, xml_file_name, uuids, client_options='', server_options='', check_sha1=True): server = None # delete the bams so we can download them for uuid in uuids: if os.path.isfile(self.client_bam(uuid)): os.remove(self...
code_fim
hard
{ "lang": "python", "repo": "hammer/genetorrent", "path": "/tests/utils/gttestcase.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return self.name class Event: def __init__(self, user, timestamp, group=None, command=None): self.user_name = user.name self.user_id = user.user_id self.timestamp = datetime.strptime( timestamp[:-3] + timestamp[-2:], '%Y-%m-%d %H:%M:%S.%f%z' ) self.group_name = gr...
code_fim
hard
{ "lang": "python", "repo": "IshanManchanda/DankBot-Stats", "path": "/dbstats/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IshanManchanda/DankBot-Stats path: /dbstats/utils.py from datetime import datetime from dbstats import globals class User: def __init__(self, name, user_id): self.name = name self.user_id = user_id def __eq__(self, other): return type(self) == type(other) and self.user_id == other.use...
code_fim
hard
{ "lang": "python", "repo": "IshanManchanda/DankBot-Stats", "path": "/dbstats/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, name): self.name = name def __eq__(self, other): return type(self) == type(other) and self.name == other.name def __str__(self): return self.name class Event: def __init__(self, user, timestamp, group=None, command=None): self.user_name = user.name self.user_id = user....
code_fim
hard
{ "lang": "python", "repo": "IshanManchanda/DankBot-Stats", "path": "/dbstats/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zunzhuowei/python-study path: /demo02/for_demo.py #!/usr/bin/env python # -*- coding: UTF-8 -*- s = "my python" for a in s: print a, else: print fruits = ['banana', 'apple', 'mango'] for index in range(len(fruits)): print '当前水果 :', fruits[index] <|fim_suffix|>print range(5) print "...
code_fim
medium
{ "lang": "python", "repo": "zunzhuowei/python-study", "path": "/demo02/for_demo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>sequence = [12, 34, 34, 23, 45, 76, 89] for i, j in enumerate(sequence): print i, j print "My name is %s and weight is %d kg!" % ('Zara', 21)<|fim_prefix|># repo: zunzhuowei/python-study path: /demo02/for_demo.py #!/usr/bin/env python # -*- coding: UTF-8 -*- s = "my python" for a in s: print a,...
code_fim
hard
{ "lang": "python", "repo": "zunzhuowei/python-study", "path": "/demo02/for_demo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: huanghyw/akshare path: /akshare/stock_feature/stock_em_yzxdr.py # -*- coding:utf-8 -*- # /usr/bin/env python """ Date: 2021/1/28 17:18 Desc: 东方财富网-数据中心-特色数据-一致行动人 http://data.eastmoney.com/yzxdr/ """ import demjson import pandas as pd import requests def stock_em_yzxdr(date: str = "20200930") -...
code_fim
hard
{ "lang": "python", "repo": "huanghyw/akshare", "path": "/akshare/stock_feature/stock_em_yzxdr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>"持股数量", "持股比例", "_", "_", "行业", "_", "_", "数据日期", "股票市场", ] big_df['数据日期'] = pd.to_datetime(big_df['数据日期']) big_df['公告日期'] = pd.to_datetime(big_df['公告日期']) big_df = big_df[ [ "序号", "一致行动人", ...
code_fim
hard
{ "lang": "python", "repo": "huanghyw/akshare", "path": "/akshare/stock_feature/stock_em_yzxdr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HylandSoftware/DocumentFilters path: /samples/python/DocumentFilters/__init__.py # (c) 2022 Hyland Software, Inc. and its affiliates. All rights reserved. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIM...
code_fim
hard
{ "lang": "python", "repo": "HylandSoftware/DocumentFilters", "path": "/samples/python/DocumentFilters/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from . DocumentFiltersAPI import * from . DocumentFilters import *<|fim_prefix|># repo: HylandSoftware/DocumentFilters path: /samples/python/...
code_fim
hard
{ "lang": "python", "repo": "HylandSoftware/DocumentFilters", "path": "/samples/python/DocumentFilters/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hyperledger/indy-plenum path: /plenum/test/checkpoints/test_lagged_checkpoint_completion.py from plenum.test import waits from plenum.test.checkpoints.helper import check_num_received_checkpoints, \ check_received_checkpoint_votes, check_stable_checkpoint, check_num_unstable_checkpoints from ...
code_fim
hard
{ "lang": "python", "repo": "hyperledger/indy-plenum", "path": "/plenum/test/checkpoints/test_lagged_checkpoint_completion.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # All the other nodes complete the checkpoint and send Checkpoint messages # to others. The slow node receives and stashes these messages because it # has not completed the checkpoint. def check(): for replica in slow_node.replicas.values(): check_stable_checkpoint(repl...
code_fim
hard
{ "lang": "python", "repo": "hyperledger/indy-plenum", "path": "/plenum/test/checkpoints/test_lagged_checkpoint_completion.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] # TODO: to remove in conan v2 if Version(conan_version).major < 2: self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) self.env_info.CONAN_CMAKE_GENERATOR = "Ninja"<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/ninja/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: conan-io/conan-center-index path: /recipes/ninja/all/conanfile.py from conan import ConanFile, conan_version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get from conan.tools.scm import Version import os required_conan_version = ">=1.52.0"...
code_fim
medium
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/ninja/all/conanfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.basic = ['derive']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_deriving.py #calss header class _DERIVING(): def __init__(self,): <|fim_middle|> self.name = "DERIVING" self.definitions = derive self.parents = [] self.childen = [] self.properties = [] self...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_deriving.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_deriving.py #calss header class _DERIVING(): <|fim_suffix|> self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['derive']<|fim_middle|> def __init__(self,): self.name = "DERIVING" self.defin...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_deriving.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.fixture(scope='module') def table_ac1024(): dwg = ezdxf.new('R2010') entities = load_section(AC1024TABLE, 'TABLES', dwg.entitydb) return Table(entities[1:-1], dwg) # without SECTION tags and ENDTAB def test_ac1024table_setup(table_ac1024): assert 10 == len(table_ac1024) def te...
code_fim
hard
{ "lang": "python", "repo": "ols3er/ezdxf", "path": "/tests/test_table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ols3er/ezdxf path: /tests/test_table.py # Created: 13.03.2011, 2018 rewritten for pytest # Copyright (C) 2011-2018, Manfred Moitzi # License: MIT License from __future__ import unicode_literals import pytest from io import StringIO import ezdxf from ezdxf.tools.test import compile_tags_without_h...
code_fim
hard
{ "lang": "python", "repo": "ols3er/ezdxf", "path": "/tests/test_table.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.fixture(scope='module') def table_ac1024(): dwg = ezdxf.new('R2010') entities = load_section(AC1024TABLE, 'TABLES', dwg.entitydb) return Table(entities[1:-1], dwg) # without SECTION tags and ENDTAB def test_ac1024table_setup(table_ac1024): assert 10 == len(table_ac1024) def t...
code_fim
hard
{ "lang": "python", "repo": "ols3er/ezdxf", "path": "/tests/test_table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> }, ), migrations.CreateModel( name='Timings', fields=[ ('id', models.AutoField(primary_key=True, auto_created=True, serialize=False, verbose_name='ID')), ('start_time', models.DateField()), ('end_time', mode...
code_fim
hard
{ "lang": "python", "repo": "kunal-exuberant/search-directory", "path": "/DjangoServer/cookxplor/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kunal-exuberant/search-directory path: /DjangoServer/cookxplor/migrations/0001_initial.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migr...
code_fim
hard
{ "lang": "python", "repo": "kunal-exuberant/search-directory", "path": "/DjangoServer/cookxplor/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Call this method to stop all subscriptions in the group. This method can be called from both synchronous and asynchronous contexts. If you call it from the asynchronous context then you have to `await`. Args: group: Name of the subscription group wh...
code_fim
hard
{ "lang": "python", "repo": "datadvance/DjangoChannelsGraphqlWs", "path": "/channels_graphql_ws/subscription.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datadvance/DjangoChannelsGraphqlWs path: /channels_graphql_ws/subscription.py deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom th...
code_fim
hard
{ "lang": "python", "repo": "datadvance/DjangoChannelsGraphqlWs", "path": "/channels_graphql_ws/subscription.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Get `publish`, `subscribe`, and `unsubscribe` handlers. subscribe = subscribe or getattr(cls, "subscribe", None) publish = publish or getattr(cls, "publish", None) unsubscribed = unsubscribed or getattr(cls, "unsubscribed", None) assert publish is not None, ( ...
code_fim
hard
{ "lang": "python", "repo": "datadvance/DjangoChannelsGraphqlWs", "path": "/channels_graphql_ws/subscription.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import cv2 import numpy as np img = cv2.imread('sudoku.png') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray, 50, 150, apertureSize=3) cv2.imshow('edges', edges) lines = cv2.HoughLines(edges, 1, np.pi / 180, 200) for line in lines: rho,theta = line[0] a = np.cos(th...
code_fim
hard
{ "lang": "python", "repo": "Mohit-007/DIGITAL-IMAGE-PROCESSING-COMPUTER-VISION", "path": "/COMPUTER VISION/HISTOGRAM.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mohit-007/DIGITAL-IMAGE-PROCESSING-COMPUTER-VISION path: /COMPUTER VISION/HISTOGRAM.py # -*- coding: utf-8 -*- """ Created on Thu Dec 12 21:18:12 2019 @author: RAMESHWAR LAL JI """ # HISTOGRAM import numpy as np import cv2 as cv from matplotlib import pyplot as plt img = cv.imr...
code_fim
hard
{ "lang": "python", "repo": "Mohit-007/DIGITAL-IMAGE-PROCESSING-COMPUTER-VISION", "path": "/COMPUTER VISION/HISTOGRAM.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import cv2 import numpy as np img = cv2.imread('road.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray,50,150,apertureSize = 3) cv2.imshow('edges', edges) lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength=100,maxLineGap=10) for line in lines: x1,y1,x2,y2 = lin...
code_fim
hard
{ "lang": "python", "repo": "Mohit-007/DIGITAL-IMAGE-PROCESSING-COMPUTER-VISION", "path": "/COMPUTER VISION/HISTOGRAM.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.cli.command() def doc(): with app.app_context(), app.test_request_context(): urlvars = False # Build query strings in URLs swagger = True # Export Swagger specifications data = api.as_postman(urlvars=urlvars, swagger=swagger) with open("api.json", 'w') as file: ...
code_fim
hard
{ "lang": "python", "repo": "icrdr/1-mu-server", "path": "/app/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: icrdr/1-mu-server path: /app/__init__.py from flask import Flask, json from flask_restplus import Api from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS from flask_socketio import SocketIO, send from celery import Celery from flask_migrate import Migrate, init as db_init, migrate...
code_fim
hard
{ "lang": "python", "repo": "icrdr/1-mu-server", "path": "/app/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Usage:: await User.objects.filter(first_name="Bernardo").filter(last_name="Bernardo").find_all() # or await User.objects.filter(first_name="Bernardo", starting_year__gt=2010).find_all() The available filter options are the same as used in MongoEngine. ...
code_fim
hard
{ "lang": "python", "repo": "maxims94/jetengine", "path": "/jetengine/queryset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: maxims94/jetengine path: /jetengine/queryset.py return document async def save(self, document, alias=None, upsert=False): if document.is_partly_loaded: msg = ( "Partly loaded document {0} can't be saved. Document should " "be loaded withou...
code_fim
hard
{ "lang": "python", "repo": "maxims94/jetengine", "path": "/jetengine/queryset.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return res["n"] def _check_valid_field_name_to_project(self, field_name, value): """Determine a presence of the field_name in the document. Helper method that determines a presence of the field_name in document including embedded documents' fields, lists of embedded d...
code_fim
hard
{ "lang": "python", "repo": "maxims94/jetengine", "path": "/jetengine/queryset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Wishlist(models.Model): buyer=models.OneToOneField("neighbourhood.Profile", related_name="my_wishlist", on_delete=models.CASCADE,null=True ) created_at = models.DateTimeField(auto_now_add=True) inserted_at = models.DateTimeField(auto_now=True) class W...
code_fim
hard
{ "lang": "python", "repo": "lydiah2015/neighbourhood-sales", "path": "/neighbourhood/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lydiah2015/neighbourhood-sales path: /neighbourhood/models.py from django.db import models from django.contrib.auth.models import User class Profile(models.Model): user=models.OneToOneField(User, related_name="profile", on_delete=models.CASCADE,null=True )...
code_fim
hard
{ "lang": "python", "repo": "lydiah2015/neighbourhood-sales", "path": "/neighbourhood/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmwendwa/CP1 path: /src/amity.py te_room(new_fellow) return new_fellow else: return "Email already used!" elif typ == "STAFF": if not email in self.all_persons.keys(): new_staff = Staff(name, email) se...
code_fim
hard
{ "lang": "python", "repo": "cmwendwa/CP1", "path": "/src/amity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmwendwa/CP1 path: /src/amity.py ]} return "Room created succesfully" else: return "Room could not be created: Room exists!" elif typ == "L": if not name in self.all_rooms.keys(): new_room = LivingSpace(name) ...
code_fim
hard
{ "lang": "python", "repo": "cmwendwa/CP1", "path": "/src/amity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return presentation def save_state_to_db(self, db_name=None): """ Saves application's current state to an sqlite database """ if os.path.exists('amity_db.sqlite'): os.remove('amity_db.sqlite') if db_name == None: amity_db = DbMan...
code_fim
hard
{ "lang": "python", "repo": "cmwendwa/CP1", "path": "/src/amity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CarsonSlovoka/typing-game path: /typing_game/api/utils.py __all__ = ( 'SafeMember', 'ABCSafeMember', 'ShowTestDescription', 'cached_property', 'after_end', ) from unittest import TestCase import abc from contextlib import contextmanager from typing import Callable import sys class ...
code_fim
hard
{ "lang": "python", "repo": "CarsonSlovoka/typing-game", "path": "/typing_game/api/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> __slots__ = () def __getattribute__(self, item): """ is just for IDE recognize. """ return super().__getattribute__(item) class ShowTestDescription(TestCase): def setUp(self) -> None: print('\n' + str(self)) document = self._testMethodDoc if s...
code_fim
hard
{ "lang": "python", "repo": "CarsonSlovoka/typing-game", "path": "/typing_game/api/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ is just for IDE recognize. """ return super().__getattribute__(item) class ChainMeta(abc.ABCMeta, MetaMemberControl): def __new__(cls, name, bases, attr): instance = MetaMemberControl.__new__(cls, name, bases, attr) instance = abc.ABCMeta.__new__(c...
code_fim
hard
{ "lang": "python", "repo": "CarsonSlovoka/typing-game", "path": "/typing_game/api/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: taiyeeka/aind2-rnn path: /RNN_project.py ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') from my_answers import * get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') from my_answers import * ### load in and normalize the d...
code_fim
hard
{ "lang": "python", "repo": "taiyeeka/aind2-rnn", "path": "/RNN_project.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # run your text window-ing function window_size = 100 step_size = 5 inputs, outputs = window_transform_text(text,window_size,step_size) # Lets print out a few input/output pairs to verify that we have made the right sort of stuff! # In[23]: # print out a few of the input/output pairs to verify that...
code_fim
hard
{ "lang": "python", "repo": "taiyeeka/aind2-rnn", "path": "/RNN_project.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: taiyeeka/aind2-rnn path: /RNN_project.py build neural network models. Make sure you are initializing your optimizer given the [keras-recommended approach for RNNs](https://keras.io/optimizers/) # # (given in the cell below). (remember to copy your completed function into the script *my_answer...
code_fim
hard
{ "lang": "python", "repo": "taiyeeka/aind2-rnn", "path": "/RNN_project.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Initialize the list_display attribute for displaying the fields we want on admin list interface list_display = ["title", "article", "date_and_time", "source", "url"]<|fim_prefix|># repo: soheil-mp/Trading-Research-Dashboard path: /data_gathering_app/admin.py # Import the libraries from dj...
code_fim
medium
{ "lang": "python", "repo": "soheil-mp/Trading-Research-Dashboard", "path": "/data_gathering_app/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: soheil-mp/Trading-Research-Dashboard path: /data_gathering_app/admin.py # Import the libraries from django.contrib import admin from .models import News <|fim_suffix|> # Initialize the list_display attribute for displaying the fields we want on admin list interface list_display = ["title...
code_fim
medium
{ "lang": "python", "repo": "soheil-mp/Trading-Research-Dashboard", "path": "/data_gathering_app/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mturja-vf-ic-bd/self-driving-car_Robotics-Project path: /pymunk-5.4.2/examples/index_video.py """Program used to generate the logo animation on the pymunk main page. This program will showcase several features of Pymunk, such as collisions, debug drawing, automatic generation of shapes from ...
code_fim
hard
{ "lang": "python", "repo": "mturja-vf-ic-bd/self-driving-car_Robotics-Project", "path": "/pymunk-5.4.2/examples/index_video.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>events = [] events.append((0.1, big_ball)) events.append((2, big_ball)) events.append((3.5, boxfloor)) for x in range(8): events.append((4+x*.2, box)) events.append((6.5, car)) events.append((8.5, cannon)) events.sort(key=lambda x:x[0]) SMALLBALL = pygame.USEREVENT +1 pygame.time.set...
code_fim
hard
{ "lang": "python", "repo": "mturja-vf-ic-bd/self-driving-car_Robotics-Project", "path": "/pymunk-5.4.2/examples/index_video.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pos = Vec2d(100,200) wheel_color = 52,219,119 shovel_color = 219,119,52 mass = 100 radius = 25 moment = pymunk.moment_for_circle(mass, 20, radius) wheel1_b = pymunk.Body(mass, moment) wheel1_s = pymunk.Circle(wheel1_b, radius) wheel1_s.friction = 1.5 whee...
code_fim
hard
{ "lang": "python", "repo": "mturja-vf-ic-bd/self-driving-car_Robotics-Project", "path": "/pymunk-5.4.2/examples/index_video.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a[0] ^ b[1] a[1] ^ c[2] b[2] ^ c[0] edge_order = [a[2], c[1], b[0]] node_dict, edge_dict = tn.copy({a, b, c}) tn.check_correct({a, b, c}) res = a @ b @ c res.reorder_edges(edge_order) res_copy = node_dict[a] @ node_dict[b] @ node_dict[c] res_copy.reorder_edges([edge_dict[e] for e in ...
code_fim
hard
{ "lang": "python", "repo": "doc22940/TensorNetwork", "path": "/tensornetwork/tests/tensornetwork_symmetric_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: doc22940/TensorNetwork path: /tensornetwork/tests/tensornetwork_symmetric_test.py # Copyright 2019 The TensorNetwork Authors # # 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 Licens...
code_fim
hard
{ "lang": "python", "repo": "doc22940/TensorNetwork", "path": "/tensornetwork/tests/tensornetwork_symmetric_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }