text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: mark14wu/Fashion-MNIST_Contest path: /fashion-mnist.py """Train a convnet on the MNIST database with ResNets. ResNets are a bit overkill for this problem, but this illustrates how to use the Residual wrapper on ConvNets. See: https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py "...
code_fim
hard
{ "lang": "python", "repo": "mark14wu/Fashion-MNIST_Contest", "path": "/fashion-mnist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># convert class vectors to binary class matrices Y_train = np_utils.to_categorical(y_train, nb_classes) Y_test = np_utils.to_categorical(y_test, nb_classes) # Model input_var = Input(shape=input_shape) conv1 = Convolution2D(64, kernel_size[0], kernel_size[1], border_mode='same', ac...
code_fim
hard
{ "lang": "python", "repo": "mark14wu/Fashion-MNIST_Contest", "path": "/fashion-mnist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: radon-h2020/xopera-opera path: /tests/unit/opera/parser/utils/test_location.py from opera.parser.utils.location import Location <|fim_suffix|> def test_str(self): assert str(Location("stream", 1, 2)) == "stream:1:2"<|fim_middle|> class TestStr:
code_fim
easy
{ "lang": "python", "repo": "radon-h2020/xopera-opera", "path": "/tests/unit/opera/parser/utils/test_location.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert str(Location("stream", 1, 2)) == "stream:1:2"<|fim_prefix|># repo: radon-h2020/xopera-opera path: /tests/unit/opera/parser/utils/test_location.py from opera.parser.utils.location import Location <|fim_middle|> class TestStr: def test_str(self):
code_fim
easy
{ "lang": "python", "repo": "radon-h2020/xopera-opera", "path": "/tests/unit/opera/parser/utils/test_location.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/snuba path: /snuba/subscriptions/scheduler.py import math from abc import ABC, abstractmethod from datetime import datetime, timedelta from enum import Enum from typing import ( Generic, Iterator, List, Mapping, MutableMapping, Optional, Sequence, Tuple...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/snuba", "path": "/snuba/subscriptions/scheduler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> general_mode = TaskBuilderMode( state.get_config( "subscription_primary_task_builder", TaskBuilderMode.JITTERED ) ) if ( general_mode == TaskBuilderMode.IMMEDIATE or general_mode == TaskBuilderMode.JITTERED ):...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/snuba", "path": "/snuba/subscriptions/scheduler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class SubscriptionScheduler(Scheduler[Subscription]): def __init__( self, store: SubscriptionDataStore, partition_id: PartitionId, cache_ttl: timedelta, metrics: MetricsBackend, ) -> None: self.__store = store self.__cache_ttl = cache_ttl ...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/snuba", "path": "/snuba/subscriptions/scheduler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nvdv/atq path: /atq/atqserver.py """atq server module.""" import asyncio import cloudpickle import logging import pickle import signal from atq import executor logging.basicConfig( format='%(asctime)s.%(msecs)03d %(levelname)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.I...
code_fim
hard
{ "lang": "python", "repo": "nvdv/atq", "path": "/atq/atqserver.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def run_forever(self): """Starts server.""" logging.info('Starting server on %s:%s', self.host, self.port) self.loop.run_until_complete( asyncio.start_server( self.handle_task, host=self.host, port=self.port)) self.loop.run_forever() def...
code_fim
hard
{ "lang": "python", "repo": "nvdv/atq", "path": "/atq/atqserver.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kozakusek/ipp-2020-testy path: /z2/part2/batch/jm/parser_errors_2/868306319.py from part1 import ( gamma_board, gamma_busy_fields, gamma_delete, gamma_free_fields, gamma_golden_move, gamma_golden_possible, gamma_move, gamma_new, ) """ scenario: test_random_actions...
code_fim
hard
{ "lang": "python", "repo": "kozakusek/ipp-2020-testy", "path": "/z2/part2/batch/jm/parser_errors_2/868306319.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>board197900215 = gamma_board(board) assert board197900215 is not None assert board197900215 == ("2111\n" "2..1\n" "1111\n" "12.2\n" "2121\n") del board197900215 board197900215 = None assert gamma_move(board, 1, 1, 2) == 0 assert gamma_move(board, 1, 3, 4) == 0 assert gamma_move(board, 2, 3, 1) == 0 ass...
code_fim
hard
{ "lang": "python", "repo": "kozakusek/ipp-2020-testy", "path": "/z2/part2/batch/jm/parser_errors_2/868306319.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: # Block until any key pressed sys.stdin.read() finally: trace.info('Shutting down.') app.set() if __name__ == '__main__': run()<|fim_prefix|># repo: eboladev/corpora path: /server/main.py #!/usr/bin/python import config import threading import trace impor...
code_fim
hard
{ "lang": "python", "repo": "eboladev/corpora", "path": "/server/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eboladev/corpora path: /server/main.py #!/usr/bin/python import config import threading import trace import sys def run(): threading.current_thread().name = 'main' trace.info('Starting Corpora.') app = threading.Event() def alive(): <|fim_suffix|> try: # Block until a...
code_fim
medium
{ "lang": "python", "repo": "eboladev/corpora", "path": "/server/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_winner_vert(self): winner = 'X' for col in range(3): self.field.place(0, col, winner) self.assertEqual(winner, self.field.get_winner()) def test_get_winner_diag_from_top_left(self): winner = 'X' for i in range(3): sel...
code_fim
medium
{ "lang": "python", "repo": "AndreasHae/tictactoe-py", "path": "/model/test_field.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndreasHae/tictactoe-py path: /model/test_field.py import unittest from model.field import Field class FieldTest(unittest.TestCase): def setUp(self): self.field = Field() <|fim_suffix|> for col in range(3): self.field.place(0, col, winner) self.assertEqu...
code_fim
hard
{ "lang": "python", "repo": "AndreasHae/tictactoe-py", "path": "/model/test_field.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # End of cycle tick += 1 if exe[0] == 0: # Complete action if exe[1] == "noop": cycle.append(cycle[-1]) sprite = [cycle[-1] - 1, cycle[-1], cycle[-1] + 1] elif exe[1] == "addx": cycle.append(cycle[-...
code_fim
hard
{ "lang": "python", "repo": "resb53/advent", "path": "/2022/src/day-10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: resb53/advent path: /2022/src/day-10.py #!/usr/bin/env python3 import argparse import sys # Check correct usage parser = argparse.ArgumentParser(description="Parse some data.") parser.add_argument('input', metavar='input', type=str, help='Input data file.') args = parser.par...
code_fim
hard
{ "lang": "python", "repo": "resb53/advent", "path": "/2022/src/day-10.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tick = 0 ptr = 0 exe = None dur = { "noop": 1, "addx": 2 } cycle = [1] sprite = [0, 1, 2] while ptr < len(instr) or exe is not None: if exe is None: exe = instr[ptr] exe.insert(0, dur[exe[0]]) ptr += 1 exe...
code_fim
hard
{ "lang": "python", "repo": "resb53/advent", "path": "/2022/src/day-10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mackorone/euler path: /src/067.py from path import max_sum_through_triangle <|fim_suffix|>if __name__ == '__main__': print(ans())<|fim_middle|>def ans(): return max_sum_through_triangle('067.txt')
code_fim
medium
{ "lang": "python", "repo": "mackorone/euler", "path": "/src/067.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': print(ans())<|fim_prefix|># repo: mackorone/euler path: /src/067.py from path import max_sum_through_triangle <|fim_middle|>def ans(): return max_sum_through_triangle('067.txt')
code_fim
medium
{ "lang": "python", "repo": "mackorone/euler", "path": "/src/067.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mackorone/euler path: /src/067.py from path import max_sum_through_triangle def ans(): <|fim_suffix|>if __name__ == '__main__': print(ans())<|fim_middle|> return max_sum_through_triangle('067.txt')
code_fim
easy
{ "lang": "python", "repo": "mackorone/euler", "path": "/src/067.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: genesofeve/DeepGMAP path: /deepgmap/post_train_tools/ROC_space_writer.py import sys import gzip import cPickle import tensorflow as tf import numpy as np import time import math import os from natsort import natsorted, ns import network_constructors.network_constructor_deepsea_1d3 as nc import su...
code_fim
hard
{ "lang": "python", "repo": "genesofeve/DeepGMAP", "path": "/deepgmap/post_train_tools/ROC_space_writer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return fpr, tpr, roc_auc file_list=['/home/fast/onimaru/data/prediction/\ network_constructor_deepsea_1d3_Wed_Aug_16_072343_2017_step7923.ckpt-7923_label_prediction.npz', '/home/fast/onimaru/data/prediction/\ network_constructor_deepsea_1d_Wed_Aug_16_101507_2017_step6348.ckpt-6348_label_prediction.n...
code_fim
hard
{ "lang": "python", "repo": "genesofeve/DeepGMAP", "path": "/deepgmap/post_train_tools/ROC_space_writer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return (filename, specification.entity_name) def _write_fetcher(self, specification, specification_set, output_directory, package_name): """ Write fetcher """ template_file = "o11nplugin-core/fetcher.java.tpl" destination = "%s%s" % (output_directory, self.fet...
code_fim
hard
{ "lang": "python", "repo": "pdumais/monolithe", "path": "/monolithe/generators/lang/vro/writers/apiversionwriter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> entity_includes = self._get_entity_list_filter(self.inventory_entities, section, "includes") entity_excludes = self._get_entity_list_filter(self.inventory_entities, section, "excludes") entity_name_attr = "id" if self.inventory_entities.has_section(section): if ...
code_fim
hard
{ "lang": "python", "repo": "pdumais/monolithe", "path": "/monolithe/generators/lang/vro/writers/apiversionwriter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pdumais/monolithe path: /monolithe/generators/lang/vro/writers/apiversionwriter.py accronym=self._product_accronym, class_prefix=self._class_prefix, root_api=self.api_root, name=self._name, api_prefix=self.api_prefix, ...
code_fim
hard
{ "lang": "python", "repo": "pdumais/monolithe", "path": "/monolithe/generators/lang/vro/writers/apiversionwriter.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> SecretSourceId: int = None, User: str = None, Password: str = None, SecretSource = None, *args, **kwargs): super().__init__(*args, **kwargs) self.SecretSourceId: int = SecretSourceId self.User: str...
code_fim
hard
{ "lang": "python", "repo": "jedicontributors/pythondataintegrator", "path": "/src/process/models/base/secret/SecretSourceBasicAuthenticationBase.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jedicontributors/pythondataintegrator path: /src/process/models/base/secret/SecretSourceBasicAuthenticationBase.py from models.base.EntityBase import EntityBase from infrastructor.json.BaseConverter import BaseConverter <|fim_suffix|> SecretSourceId: int = None, ...
code_fim
hard
{ "lang": "python", "repo": "jedicontributors/pythondataintegrator", "path": "/src/process/models/base/secret/SecretSourceBasicAuthenticationBase.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucasca95/harvard_flask_python_course path: /lesson2/5-secuences.py # un string es un arreglo de caracteres # el primer caracter esta en la posicion 0 name = "Alice" <|fim_suffix|># lista # python nos deja acceder a posiciones de una lista # utilizando indices negativos. Un indice negativo recor...
code_fim
easy
{ "lang": "python", "repo": "lucasca95/harvard_flask_python_course", "path": "/lesson2/5-secuences.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Una lista podria contener elementos de distintos tipos names = ["Alice", "Bob", "Charlie"]<|fim_prefix|># repo: lucasca95/harvard_flask_python_course path: /lesson2/5-secuences.py # un string es un arreglo de caracteres # el primer caracter esta en la posicion 0 name = "Alice" # tupla # son inalterab...
code_fim
medium
{ "lang": "python", "repo": "lucasca95/harvard_flask_python_course", "path": "/lesson2/5-secuences.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def is_configured(self): if self.handler: return self.handler.validate_configuration(self.config, False) return False def clean(self): if not self.handler and self.enabled: raise ValidationError('Cannot enable Channel without handler')...
code_fim
hard
{ "lang": "python", "repo": "bitcaster-io/bitcaster", "path": "/src/bitcaster/models/channel.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bitcaster-io/bitcaster path: /src/bitcaster/models/channel.py import logging from django.core.exceptions import ValidationError from django.core.validators import MinValueValidator from django.db import models from django.db.models import Q from django.utils.translation import gettext_lazy as _ ...
code_fim
hard
{ "lang": "python", "repo": "bitcaster-io/bitcaster", "path": "/src/bitcaster/models/channel.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.metadata = DispatcherMetaData.objects.get_or_create(handler=self.handler)[0] super().save(force_insert, force_update, using, update_fields) def validate_address(self, address): return self.handler.validate_address(address) def validate_message(self, message, **kwargs...
code_fim
hard
{ "lang": "python", "repo": "bitcaster-io/bitcaster", "path": "/src/bitcaster/models/channel.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if num_polygons >= 5000: flagged = True polygons_result = "Polygons: NG. Max 5000. You have "+str(num_polygons) else: polygons_result = "Polygons: OK" if num_ngons > 0: flagged = True ngons_result = "N-gons: N...
code_fim
hard
{ "lang": "python", "repo": "hsaito/blender_megu_check", "path": "/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hsaito/blender_megu_check path: /__init__.py bl_info = { "name": "Megu Shinonome Accessory Checker", "description": "Checks the correctness of the objects in the scene for Megu Shinonome submission.", "author": "Hideki Saito", "version": (0, 0, 3), "blender": (2, 80, 0), "...
code_fim
hard
{ "lang": "python", "repo": "hsaito/blender_megu_check", "path": "/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for full_path in utils.iterate_over_folder(self.folder): try: filename = full_path.replace(self.folder + '/', '') with open(full_path, 'r') as f: self.logger.info(f'opening {filename}') self.add_template_from_text(...
code_fim
hard
{ "lang": "python", "repo": "Plawn/petit_mail", "path": "/petit_mail/template_db/local_implem.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Plawn/petit_mail path: /petit_mail/template_db/local_implem.py from dataclasses import dataclass from . import utils from .interface import TemplateDB @dataclass class LocalInfos: <|fim_suffix|>class LocalTemplateDB(TemplateDB): def __init__(self, infos: LocalInfos, logger=None): s...
code_fim
hard
{ "lang": "python", "repo": "Plawn/petit_mail", "path": "/petit_mail/template_db/local_implem.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def get_creds_form() -> LocalInfos: return LocalInfos def init(self): for full_path in utils.iterate_over_folder(self.folder): try: filename = full_path.replace(self.folder + '/', '') with open(full_path, 'r') as f: ...
code_fim
hard
{ "lang": "python", "repo": "Plawn/petit_mail", "path": "/petit_mail/template_db/local_implem.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: val (pandas.DataFrame, int or datetime): Input to evaluate. Returns: bool: True if the input is a datetime type, False if not. """ return ( pd.api.types.is_datetime64_any_dtype(val) or isinstance(val, pd.Timestamp) or i...
code_fim
medium
{ "lang": "python", "repo": "sunchang0124/dp_cgans", "path": "/src/dp_cgans/constraints/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunchang0124/dp_cgans path: /src/dp_cgans/constraints/utils.py """Constraint utility functions.""" from datetime import datetime import pandas as pd <|fim_suffix|> Returns: bool: True if the input is a datetime type, False if not. """ return ( pd.api.typ...
code_fim
medium
{ "lang": "python", "repo": "sunchang0124/dp_cgans", "path": "/src/dp_cgans/constraints/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = urllib2.urlopen(request) result = {'code':response.getcode(),'content':response.read()} logger.debug("调用[%s]返回结果:%r",apiUrl,result) return result except Exception as e: #traceback.print_stack() logger.exception(e,"调用内部系统[%s],data[%r],发生错误[%r]"...
code_fim
hard
{ "lang": "python", "repo": "liulinsp/ns4_chatbot", "path": "/common/web_client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: liulinsp/ns4_chatbot path: /common/web_client.py # -*- coding=utf-8 -*- import urllib2 import json import logger import traceback def send(apiUrl,data,method=None): <|fim_suffix|> response = urllib2.urlopen(request) result = {'code':response.getcode(),'content':response.read()} ...
code_fim
hard
{ "lang": "python", "repo": "liulinsp/ns4_chatbot", "path": "/common/web_client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ The class offers methods for general usage thorough the program. """ @staticmethod def apply_config(filename): """ Load the supplied configuration and apply it to the EngineConfig class. :param filename: Path to a json formatted cardvault config file. """ ...
code_fim
hard
{ "lang": "python", "repo": "luxick/cardvault", "path": "/cardvault/cv_core/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: luxick/cardvault path: /cardvault/cv_core/util.py import json import os from cv_core.models import Card class CoreConfig: """ Configuration class for the Cardvault engine Defines default values for all settings Should be changed at runtime to load customized settings """ # ...
code_fim
hard
{ "lang": "python", "repo": "luxick/cardvault", "path": "/cardvault/cv_core/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Load the supplied configuration and apply it to the EngineConfig class. :param filename: Path to a json formatted cardvault config file. """ with open(filename) as config_file: config = json.load(config_file) for setting, value in config....
code_fim
hard
{ "lang": "python", "repo": "luxick/cardvault", "path": "/cardvault/cv_core/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class TestGetOutputFilenamesForNames: def test_should_add_name_and_ext_with_path_sep_if_out_ends_with_slash(self): assert output_filenames_for_names( ['train', 'test'], 'out/', '.tsv' ) == ['out/train.tsv', 'out/test.tsv'] def test_should_add_name_and_ext_with_hyphen_...
code_fim
hard
{ "lang": "python", "repo": "elifesciences/sciencebeam-utils", "path": "/tests/tools/split_csv_dataset_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TestRun: def test_should_split_train_test(self, tmpdir): file_list = tmpdir.join('file-list.tsv') train_file_list = tmpdir.join('file-list-train.tsv') test_file_list = tmpdir.join('file-list-test.tsv') file_list.write('\n'.join(['header', 'row1', 'row2', 'row3', '...
code_fim
hard
{ "lang": "python", "repo": "elifesciences/sciencebeam-utils", "path": "/tests/tools/split_csv_dataset_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: elifesciences/sciencebeam-utils path: /tests/tools/split_csv_dataset_test.py from collections import namedtuple from datetime import datetime from unittest.mock import patch import pytest from sciencebeam_utils.tools import split_csv_dataset as split_csv_dataset_module from sciencebeam_utils.t...
code_fim
hard
{ "lang": "python", "repo": "elifesciences/sciencebeam-utils", "path": "/tests/tools/split_csv_dataset_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mfkiwl/drivers path: /HSTB/drivers/pos_mv/PCSClassBuilder.py # if m: # bitfield = int(m.groups()[0]) bFound = True if not bFound: if _dHSTP: print("failed to find type for:", descr) print(bytes_str, datat...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/drivers", "path": "/HSTB/drivers/pos_mv/PCSClassBuilder.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mfkiwl/drivers path: /HSTB/drivers/pos_mv/PCSClassBuilder.py ********") raise Exception("Didn't find byte count for " + variable + " at " + last_field) variable = None else: last_field = subname except Excepti...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/drivers", "path": "/HSTB/drivers/pos_mv/PCSClassBuilder.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(self._arraytypes) > 1: padkey, dtype = list(self._arraytypes.items())[1] # the fieldname and type of data expected self.__setattr__(padkey, numpy.fromstring(remaining_data[self.predata_len + self.postdata_len + variable_len:-self.postpad_len], dtype)) #...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/drivers", "path": "/HSTB/drivers/pos_mv/PCSClassBuilder.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> elif inpLs[mid] > ele: ei = mid - 1 elif inpLs[mid] < ele: si = mid + 1 return -1 print(binarySearch([1, 2, 3, 4, 5], 4)) print(binarySearch([1, 2, 3, 4, 5], 1)) print(binarySearch([1, 2, 3, 4, 5], 2)) print(binarySearch([1, 2, 3, 4, 5], 3)) print(binarySear...
code_fim
medium
{ "lang": "python", "repo": "vicchu/leetcode-101", "path": "/05 Searching/Learn/01_binary_search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return -1 print(binarySearch([1, 2, 3, 4, 5], 4)) print(binarySearch([1, 2, 3, 4, 5], 1)) print(binarySearch([1, 2, 3, 4, 5], 2)) print(binarySearch([1, 2, 3, 4, 5], 3)) print(binarySearch([1, 2, 3, 4, 5], 5)) print(binarySearch([1, 2, 3, 4, 5, 6], 2)) print(binarySearch([5, 15, 25], 25)) print(bina...
code_fim
hard
{ "lang": "python", "repo": "vicchu/leetcode-101", "path": "/05 Searching/Learn/01_binary_search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vicchu/leetcode-101 path: /05 Searching/Learn/01_binary_search.py from typing import List def binarySearch(inpLs: List[int], ele: int) -> int: if len(inpLs) == 0: return -1 si = 0 ei = len(inpLs) - 1 while si <= ei: mid = (si + ei) // 2 if inpLs[mid] ==...
code_fim
medium
{ "lang": "python", "repo": "vicchu/leetcode-101", "path": "/05 Searching/Learn/01_binary_search.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maaadc/meechant path: /meechant/strategies/benchmarks.py from . import TradingStrategy, Transaction import pandas as pd import numpy as np class KeepTheCash(TradingStrategy): '''Strategy which does exactly nothing.''' name = 'KeepTheCash' symbols = [] weights = [] cash_buff...
code_fim
hard
{ "lang": "python", "repo": "maaadc/meechant", "path": "/meechant/strategies/benchmarks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Simple trend following strategy based on an exponential moving average.''' name = 'MovingAverageCrossover SPY' symbols = ['SPY'] weights = [1.0] cash_buffer = 0.0 frequency = pd.tseries.offsets.Week(weekday=2) # every Wednesday (Monday=0) data_span = pd.Timedelta('2Y') ...
code_fim
hard
{ "lang": "python", "repo": "maaadc/meechant", "path": "/meechant/strategies/benchmarks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def compileLet(self): state = 'keyword' self.vmfile.write(' ' * self.indent_num + '<letStatement>' + self.lfcode) self.indent_inc() while state != 'finish': if not self.Tokenizer.hasMoreTokens(): self.exit('Error : compileLet terminate') ...
code_fim
hard
{ "lang": "python", "repo": "HideyukiFUKUHARA/nand2tetris", "path": "/projects/JackAnalyzer/CompilationEngine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> state = 'keyword' self.vmfile.write(' ' * self.indent_num + '<letStatement>' + self.lfcode) self.indent_inc() while state != 'finish': if not self.Tokenizer.hasMoreTokens(): self.exit('Error : compileLet terminate') self.Tokenizer.advance() ...
code_fim
hard
{ "lang": "python", "repo": "HideyukiFUKUHARA/nand2tetris", "path": "/projects/JackAnalyzer/CompilationEngine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HideyukiFUKUHARA/nand2tetris path: /projects/JackAnalyzer/CompilationEngine.py else: self.exit('Error : compileClass end_sym') def compileClassVarDec(self): state = 'idle' self.vmfile.write(' ' * self.indent_num + '<classVarDec>' + self.lfcode) self.in...
code_fim
hard
{ "lang": "python", "repo": "HideyukiFUKUHARA/nand2tetris", "path": "/projects/JackAnalyzer/CompilationEngine.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dungeonmaster51/commcare-hq path: /corehq/apps/commtrack/dbaccessors.py def get_supply_point_ids_in_domain_by_location(domain): """ Returns a dict that maps from associated location<|fim_suffix|>ck.models import SupplyPointCase return { row['key'][1]: row['id'] for row in Su...
code_fim
medium
{ "lang": "python", "repo": "dungeonmaster51/commcare-hq", "path": "/corehq/apps/commtrack/dbaccessors.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> 'supply_point_by_loc/view', startkey=[domain], endkey=[domain, {}], ) }<|fim_prefix|># repo: dungeonmaster51/commcare-hq path: /corehq/apps/commtrack/dbaccessors.py def get_supply_point_ids_in_domain_by_location(domain): """ Returns a dict that m...
code_fim
hard
{ "lang": "python", "repo": "dungeonmaster51/commcare-hq", "path": "/corehq/apps/commtrack/dbaccessors.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # ------------------------------------------------------------------------------------- serialize def serialize(self): data = {} if self.port: data["Port"] = self.port return data<|fim_prefix|># repo: mnubo/kubernetes-py path: /kubernetes_py/models/v1/DaemonEn...
code_fim
hard
{ "lang": "python", "repo": "mnubo/kubernetes-py", "path": "/kubernetes_py/models/v1/DaemonEndpoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mnubo/kubernetes-py path: /kubernetes_py/models/v1/DaemonEndpoint.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is subject to the terms and conditions defined in # file 'LICENSE.md', which is part of this source code package. # from kubernetes_py.utils import filter_model <|fim...
code_fim
hard
{ "lang": "python", "repo": "mnubo/kubernetes-py", "path": "/kubernetes_py/models/v1/DaemonEndpoint.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _build_with_model(self, model=None): if "Port" in model: self.port = model["Port"] # ------------------------------------------------------------------------------------- port @property def port(self): return self._port @port.setter def port(self,...
code_fim
medium
{ "lang": "python", "repo": "mnubo/kubernetes-py", "path": "/kubernetes_py/models/v1/DaemonEndpoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Evertcolombia/Deploy_cli path: /deploy_pkg/commands/command_docker_swarm.py #!/usr/bin/python3 import os from commands.controllers.create_connection import create_connection from commands.controllers.init_service import init_service from commands.controllers.init_swarm import init_swarm from com...
code_fim
hard
{ "lang": "python", "repo": "Evertcolombia/Deploy_cli", "path": "/deploy_pkg/commands/command_docker_swarm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> key_ssh: str= Argument(..., help="Path to ssh key file"), user_ssh: str = Argument(..., help="User in the server"), hostname: str = Argument(..., help="Ex: ws01.example.com"), mannager_ip: str = Argument(..., help="Mannager cluster IP")): """Add Worker to Manager Node""...
code_fim
hard
{ "lang": "python", "repo": "Evertcolombia/Deploy_cli", "path": "/deploy_pkg/commands/command_docker_swarm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: richardbarran/django-photologue path: /photologue/migrations/0010_auto_20160105_1307.py # Generated by Django 1.9 on 2016-01-05 13:07 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( mode...
code_fim
hard
{ "lang": "python", "repo": "richardbarran/django-photologue", "path": "/photologue/migrations/0010_auto_20160105_1307.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='gallery', name='slug', field=models.SlugField(help_text='A "slug" is a unique URL-friendly title for an object.', max_length=250, unique=True, verbose_name='title slug'), ), migrations.AlterFi...
code_fim
hard
{ "lang": "python", "repo": "richardbarran/django-photologue", "path": "/photologue/migrations/0010_auto_20160105_1307.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fd.write(json.dumps(setName) + '\n') fd.flush() ret = fd.readline() ret = json.loads(ret) if ret['errcode'] != 0: print(ret['data']) return fd.write(json.dumps(subscription) + '\n') fd.flush() ret = fd.readline() ret = json.loads(ret) if ret['errcod...
code_fim
medium
{ "lang": "python", "repo": "lkwq007/iot-smart", "path": "/gateway/device-test/quest_sensors.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def run(): print("monitoring sensors...") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((IP, PORT)) fd = s.makefile('rw'); initClient(fd) while (True): line = fd.readline() cmd = json.loads(line) if cmd['cmd'] == 'updateDevice': ...
code_fim
hard
{ "lang": "python", "repo": "lkwq007/iot-smart", "path": "/gateway/device-test/quest_sensors.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lkwq007/iot-smart path: /gateway/device-test/quest_sensors.py import socket, json IP = '127.0.0.1' PORT = 51001 def getGwId(): return "gw19" def initClient(fd): <|fim_suffix|> fd.write(json.dumps(setName) + '\n') fd.flush() ret = fd.readline() ret = json.loads(ret) if ...
code_fim
medium
{ "lang": "python", "repo": "lkwq007/iot-smart", "path": "/gateway/device-test/quest_sensors.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># `audio_stream.rate` is 48000 -- 48kHz sampling rate sample_length = audio_stream.rate * duration sample = np.zeros(sample_length, dtype='float32') i = 0 # sample2_length = 48000 * 1 # 1 second worth of samples # sample2 = np.zeros(sample2_length, dtype='float32') # j = 0 if args.play: import pyaud...
code_fim
hard
{ "lang": "python", "repo": "malthejorgensen/31c3-bottle-topple-supercut", "path": "/detector.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: malthejorgensen/31c3-bottle-topple-supercut path: /detector.py import subprocess import argparse import re import av import numpy as np import matplotlib.pyplot as plt parser = argparse.ArgumentParser(description='Detect the sound of toppled over Club Mate bottles at 31c3 talks.') parser.add_ar...
code_fim
hard
{ "lang": "python", "repo": "malthejorgensen/31c3-bottle-topple-supercut", "path": "/detector.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: MonsterDove/PaddleRec path: /datasets/AmazonBook/preprocess.py # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Lice...
code_fim
medium
{ "lang": "python", "repo": "MonsterDove/PaddleRec", "path": "/datasets/AmazonBook/preprocess.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> graph = {} with open(source) as fr: for line in fr: conts = line.strip().split(',') user_id = int(conts[0]) item_id = int(conts[1]) time_stamp = int(conts[2]) if user_id not in graph: graph[user_id] = [] ...
code_fim
medium
{ "lang": "python", "repo": "MonsterDove/PaddleRec", "path": "/datasets/AmazonBook/preprocess.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gistable/gistable path: /dockerized-gists/45c118a2be815009ba00/snippet.py def test_something(now): # now is a mock returned by a custom pytest fixture with TimeTravel(now, datetime(2010, 1, 1)): do_something_in_the_past() do_something_at_the_regular_mocked_time() class Tim...
code_fim
medium
{ "lang": "python", "repo": "gistable/gistable", "path": "/dockerized-gists/45c118a2be815009ba00/snippet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __exit__(self, exc_type, exc_value, exc_tb): self.mock.return_value = self.old<|fim_prefix|># repo: gistable/gistable path: /dockerized-gists/45c118a2be815009ba00/snippet.py def test_something(now): # now is a mock returned by a custom pytest fixture with TimeTravel(now, datetime...
code_fim
medium
{ "lang": "python", "repo": "gistable/gistable", "path": "/dockerized-gists/45c118a2be815009ba00/snippet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: staff19/homeassistant-vorwerk path: /config_flow.py """Config flow to configure Vorwerk integration.""" from __future__ import annotations import logging from typing import Any import pybotvac from pybotvac.exceptions import NeatoException from requests.models import HTTPError import voluptuous...
code_fim
hard
{ "lang": "python", "repo": "staff19/homeassistant-vorwerk", "path": "/config_flow.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async def async_step_import(self, user_input): """Import a config flow from configuration.""" unique_id = "from configuration" data = {VORWERK_ROBOTS: user_input} await self.async_set_unique_id(unique_id) self._abort_if_unique_id_configured(data) _LOGG...
code_fim
hard
{ "lang": "python", "repo": "staff19/homeassistant-vorwerk", "path": "/config_flow.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jihoonerd/rviz-python-tutorial path: /interactive_marker_tutorials/src/cube.py #!/usr/bin/python """ Copyright (c) 2011, Willow Garage, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions...
code_fim
hard
{ "lang": "python", "repo": "jihoonerd/rviz-python-tutorial", "path": "/interactive_marker_tutorials/src/cube.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> marker.type = Marker.CUBE marker.scale.x = msg.scale marker.scale.y = msg.scale marker.scale.z = msg.scale marker.color.r = 0.65+0.7*msg.pose.position.x marker.color.g = 0.65+0.7*msg.pose.position.y marker.color.b = 0.65+0.7*msg.pose.position.z marker.color.a = 1.0 con...
code_fim
hard
{ "lang": "python", "repo": "jihoonerd/rviz-python-tutorial", "path": "/interactive_marker_tutorials/src/cube.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: neuml/paperai path: /test/python/testindex.py """ Index module tests """ import os import tempfile import unittest from paperai.index import Index # pylint: disable=C0411 from utils import Utils <|fim_suffix|> self.assertEqual( Index.config(config), {"path": "sentence-tran...
code_fim
hard
{ "lang": "python", "repo": "neuml/paperai", "path": "/test/python/testindex.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Full index stream self.assertEqual(len(list(Index.stream(Utils.DBFILE, 0, True))), 29218) # Partial index stream - top n documents by entry date self.assertEqual(len(list(Index.stream(Utils.DBFILE, 10, True))), 287)<|fim_prefix|># repo: neuml/paperai path: /test/python/...
code_fim
medium
{ "lang": "python", "repo": "neuml/paperai", "path": "/test/python/testindex.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tps = "x3,12,2S/x,22S,22C,11,21/121,212,12,1121C,1212S/21S,1,21,211S,12S/x,21S,2,x2 1 26" p = tak.ptn.parse_tps(tps) assert p.ply == 50 assert p.size == 5 def test_format_tps(self): tps = "x3,12,2S/x,22S,22C,11,21/121,212,12,1121C,1212S/21S,1,21,211S,12S/x,21S,...
code_fim
hard
{ "lang": "python", "repo": "nelhage/taktician", "path": "/python/test/ptn/test_ptn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nelhage/taktician path: /python/test/ptn/test_ptn.py import pytest import tak import tak.ptn class TestParseMove(object): def test_valid(self): cases = [ ( "a1", tak.Move(0, 0, tak.MoveType.PLACE_FLAT), "a1", )...
code_fim
hard
{ "lang": "python", "repo": "nelhage/taktician", "path": "/python/test/ptn/test_ptn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def const_f(x): return lambda *args: x def id_f(x): return x def cons(first, rest): return [first] + rest def replicate(count, item): return [item for _ in range(count)] def flipApply(x, f): return f(x) def updatePosition(char, position): """ only treats `\n` as newline ...
code_fim
medium
{ "lang": "python", "repo": "mattfenwick/UnParse", "path": "/unparse/functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mattfenwick/UnParse path: /unparse/functions.py import functools def compose(f, g): return lambda x: f(g(x)) def first(x, _): return x def second(_, y): return y def pair(x, y): <|fim_suffix|>def const_f(x): return lambda *args: x def id_f(x): return x def cons(first, r...
code_fim
medium
{ "lang": "python", "repo": "mattfenwick/UnParse", "path": "/unparse/functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def id_f(x): return x def cons(first, rest): return [first] + rest def replicate(count, item): return [item for _ in range(count)] def flipApply(x, f): return f(x) def updatePosition(char, position): """ only treats `\n` as newline """ line, col = position return (l...
code_fim
medium
{ "lang": "python", "repo": "mattfenwick/UnParse", "path": "/unparse/functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: marrow/mongo path: /test/conftest.py # encoding: utf-8 from functools import partial import pymongo import pytest <|fim_suffix|> request.addfinalizer(partial(connection.drop_database, 'test')) return connection<|fim_middle|>@pytest.fixture(scope="module", autouse=True) def connection(request...
code_fim
hard
{ "lang": "python", "repo": "marrow/mongo", "path": "/test/conftest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> request.addfinalizer(partial(connection.drop_database, 'test')) return connection<|fim_prefix|># repo: marrow/mongo path: /test/conftest.py # encoding: utf-8 from functools import partial <|fim_middle|>import pymongo import pytest @pytest.fixture(scope="module", autouse=True) def connection(request...
code_fim
hard
{ "lang": "python", "repo": "marrow/mongo", "path": "/test/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def list_length_validator(v: "List", field: "Field") -> "List": field_type: ConstrainedList = field.type_ # type: ignore if field_type.len_gt is not None and not len(v) > field_type.len_gt: raise errors.NumberNotGtError(limit_value=field_type.len_gt) elif field_type.len_ge is not None...
code_fim
hard
{ "lang": "python", "repo": "tachyontraveler/optimade-python-tools", "path": "/optimade/server/models/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> yield list_validator yield list_length_validator def conlist( *, len_gt: int = None, len_ge: int = None, len_lt: int = None, len_le: int = None, len_eq: int = None ) -> Type[list]: # use kwargs then define conf in a dict to aid with IDE type hinting namesp...
code_fim
hard
{ "lang": "python", "repo": "tachyontraveler/optimade-python-tools", "path": "/optimade/server/models/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tachyontraveler/optimade-python-tools path: /optimade/server/models/util.py from typing import cast, Any, Dict, Type from pydantic import ConstrainedInt, errors from pydantic.types import OptionalInt from pydantic.validators import list_validator class NonnegativeInt(ConstrainedInt): ge = ...
code_fim
medium
{ "lang": "python", "repo": "tachyontraveler/optimade-python-tools", "path": "/optimade/server/models/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Justintime50/github-archive path: /github_archive/logger.py import os import woodchips from github_archive.constants import LOGGER_NAME <|fim_suffix|> - Logging can be called with the `logger` property - Files will automatically roll over """ logger = woodchips.Logger( ...
code_fim
medium
{ "lang": "python", "repo": "Justintime50/github-archive", "path": "/github_archive/logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Logs an error message, then raises it.""" logger.critical(message) raise ValueError(message)<|fim_prefix|># repo: Justintime50/github-archive path: /github_archive/logger.py import os import woodchips from github_archive.constants import LOGGER_NAME def setup_logger(github_archive): ...
code_fim
medium
{ "lang": "python", "repo": "Justintime50/github-archive", "path": "/github_archive/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def perfrom_test(points, tolerance=0.1, high_quality=True): rprint("") rprint("Raw points: {}".format(points.shape)) points_mat = MatrixDouble(points) t0 = time.perf_counter() simple_mat = simplify_line_2d(points_mat, tolerance, high_quality) t1 = time.perf_counter() rprint(f"...
code_fim
medium
{ "lang": "python", "repo": "JeremyBYU/simplifyline", "path": "/examples/python/example_2d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # points = make_line() points = example_points perfrom_test(points) points = make_saw_wave() perfrom_test(points) points = make_sine_wave() # points = np.concatenate([points, points], axis=1) perfrom_test(points) if __name__ == "__main__": main()<|fim_prefix|># repo...
code_fim
medium
{ "lang": "python", "repo": "JeremyBYU/simplifyline", "path": "/examples/python/example_2d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeremyBYU/simplifyline path: /examples/python/example_2d.py from rich.traceback import install from rich import print as rprint import numpy as np import matplotlib.pyplot as plt import time install() import simplifyline from simplifyline import simplify_line_2d, MatrixDouble example_points = n...
code_fim
hard
{ "lang": "python", "repo": "JeremyBYU/simplifyline", "path": "/examples/python/example_2d.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> address = snippets.Address(type="home", street="college", city="staten") address.put() address2 = snippets.Address(type="home", street="brighton", city="staten") address2.put() snippets.Contact(name="one", addresses=[address, address2]).put() snippets.fetch_sub_properties() def ...
code_fim
medium
{ "lang": "python", "repo": "GoogleCloudPlatform/python-docs-samples", "path": "/appengine/standard/ndb/projection_queries/snippets_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> snippets.fetch_sub_properties() def test_demonstrate_ndb_grouping(testbed): snippets.Article(title="one", author="Two", tags=["three"]).put() snippets.demonstrate_ndb_grouping() def test_declare_multiple_valued_property(testbed): snippets.declare_multiple_valued_property()<|fim_prefix...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/python-docs-samples", "path": "/appengine/standard/ndb/projection_queries/snippets_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }