text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: bird-house/OWSLib path: /examples/wps-ceda-script.py # Example script that performs a set of (small) live requests versus the live CEDA WPS service from owslib.wps import WebProcessingService, WPSExecution, WFSFeatureCollection, WFSQuery, GMLMultiPolygonFeatureCollection, monitorExecution, Compl...
code_fim
hard
{ "lang": "python", "repo": "bird-house/OWSLib", "path": "/examples/wps-ceda-script.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># 2) DescribeProcess # GET request: http://ceda-wps2.badc.rl.ac.uk/wps?identifier=DoubleIt&version=1.0.0&request=DescribeProcess&service=WPS process = wps.describeprocess('DoubleIt') print('WPS Process: identifier=%s' % process.identifier) print('WPS Process: title=%s' % process.title) print('WPS Process:...
code_fim
hard
{ "lang": "python", "repo": "bird-house/OWSLib", "path": "/examples/wps-ceda-script.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rehive/drf-request-logging path: /drf_request_logging/migrations/0001_initial.py # Generated by Django 2.2.2 on 2020-12-19 19:29 from django.conf import settings import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion from drf_reques...
code_fim
hard
{ "lang": "python", "repo": "rehive/drf-request-logging", "path": "/drf_request_logging/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Request', fields=[ ('id', models.AutoField(auto_created...
code_fim
hard
{ "lang": "python", "repo": "rehive/drf-request-logging", "path": "/drf_request_logging/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cbare/Etudes path: /python/the_sultans_riddle.py """ The Sultan's Riddle source: https://explainextended.com/2016/12/31/happy-new-year-8/ Once upon a time there was a Sultan who was looking for a vizier to help him rule his country. It became known to him that among the multitudes of his loyal ...
code_fim
hard
{ "lang": "python", "repo": "cbare/Etudes", "path": "/python/the_sultans_riddle.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if n < 2 or n%2==0: return n==2 for m in range(3,int(sqrt(n))+1,2): if n%m==0: return False return True def even(n): return n%2 == 0 def odd(n): return n%2 == 1 def factor(n): for m in range(2, int(sqrt(n))+1): if n%m==0: return [m...
code_fim
hard
{ "lang": "python", "repo": "cbare/Etudes", "path": "/python/the_sultans_riddle.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Given a whole number, return the set of pairs of factors, for example, given 12, return {(2,6), (3,4)} """ seq = factor(n) # indexes into seq i = set(range(len(seq))) # create pairs of subsets indexes into seq and their complements ps = [(ss, i-ss) for ss in powerse...
code_fim
hard
{ "lang": "python", "repo": "cbare/Etudes", "path": "/python/the_sultans_riddle.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # 2d registration theta = 0.1 * np.random.rand() t = 0.005 * np.random.rand(3,1) t[2] = 0 R = np.array([[np.cos(theta), -np.sin(theta), 0], [np.sin(theta), np.cos(theta), 0], [0, 0, 1]]) tf = RigidTransform(R, t, f...
code_fim
hard
{ "lang": "python", "repo": "pyni/perception", "path": "/tests/test_registration.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.assertTrue(np.allclose(tf.matrix, result.T_source_target.matrix, atol=1e-3)) if __name__ == '__main__': logging.getLogger().setLevel(logging.INFO) test_suite = unittest.TestSuite() test_suite.addTest(TestRegistration('test_registration')) unittest.TextTestRunner(verbosity=2)....
code_fim
hard
{ "lang": "python", "repo": "pyni/perception", "path": "/tests/test_registration.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyni/perception path: /tests/test_registration.py """ Tests the image class. Author: Jeff Mahler """ import unittest from unittest import TestCase import logging import numpy as np from .constants import * from autolab_core import RigidTransform, PointCloud, NormalCloud from perception import ...
code_fim
hard
{ "lang": "python", "repo": "pyni/perception", "path": "/tests/test_registration.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bachkhoabk47/myblog-django path: /pi/models.py from django.conf import settings #from django.core.urlresolvers import reverse from django.urls import reverse from category.models import Category from django.db import models from django.db.models.signals import pre_save from django.utils.encoding...
code_fim
hard
{ "lang": "python", "repo": "bachkhoabk47/myblog-django", "path": "/pi/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class EntryQuerySet(models.QuerySet): def published(self): return str(self.filter(publish=True)) class Post(models.Model): id_sort = models.IntegerField(default=0) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, default=1) title = models.CharField(max...
code_fim
hard
{ "lang": "python", "repo": "bachkhoabk47/myblog-django", "path": "/pi/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> user = factory.SubFactory(UserFactory) @factory.post_generation def scopes(self, create, extracted, **kwargs): if not create: # Simple build, do nothing. return if extracted: for scope in extracted: self.scopes.add(ScopeFact...
code_fim
medium
{ "lang": "python", "repo": "watchdogpolska/small_eod", "path": "/backend-project/small_eod/authkey/factories.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = factory.Sequence(lambda n: "scope-%04d" % n) class Meta: model = Scope django_get_or_create = ("name",)<|fim_prefix|># repo: watchdogpolska/small_eod path: /backend-project/small_eod/authkey/factories.py import factory.fuzzy from factory.django import DjangoModelFactory f...
code_fim
medium
{ "lang": "python", "repo": "watchdogpolska/small_eod", "path": "/backend-project/small_eod/authkey/factories.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: watchdogpolska/small_eod path: /backend-project/small_eod/authkey/factories.py import factory.fuzzy from factory.django import DjangoModelFactory from ..users.factories import UserFactory from .models import Key, Scope <|fim_suffix|> if not create: # Simple build, do nothing...
code_fim
medium
{ "lang": "python", "repo": "watchdogpolska/small_eod", "path": "/backend-project/small_eod/authkey/factories.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): # this will be the OpenCV version of robot.camera.latest_image global cvImage global cvImageId global trackerImage global puck global ball global camera global vectorMaskImage cvImageId = 0 # open the video window cv.namedWindow('Vector', cv.WINDOW_NORMAL) cv.namedWindow('Tracke...
code_fim
hard
{ "lang": "python", "repo": "robojay/anki_vector_tests", "path": "/OpenCV/ObjectTuning.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: robojay/anki_vector_tests path: /OpenCV/ObjectTuning.py # # This uses the SDK patch provided by @wvenable on the Vector SDK forum. # # Post describing the patch can be found here: # https://forums.anki.com/t/interact-with-vector-without-stopping-built-in-behaviors/21475 # # The patch itself can b...
code_fim
hard
{ "lang": "python", "repo": "robojay/anki_vector_tests", "path": "/OpenCV/ObjectTuning.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Go through the list of extracted pragmas and compile them. """ for next_line_number in pragma_lines.keys(): PragmaExtension.compile_single_pragma( scan_file, next_line_number, pragma_lines, sel...
code_fim
hard
{ "lang": "python", "repo": "ExternalRepositories/pymarkdown", "path": "/pymarkdown/plugin_manager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> extra_info = f" [{extra_error_information}]" if extra_error_information else "" print( "{0}:{1}:{2}: {3}: {4}{5} ({6})".format( scan_file, line_number, column_number, rule_id.upper(), rule_descript...
code_fim
hard
{ "lang": "python", "repo": "ExternalRepositories/pymarkdown", "path": "/pymarkdown/plugin_manager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ExternalRepositories/pymarkdown path: /pymarkdown/plugin_manager.py if file_name: if class_name: if is_constructor: formatted_message = f"Plugin file named '{file_name}' threw an exception in the constructor for the class '{c...
code_fim
hard
{ "lang": "python", "repo": "ExternalRepositories/pymarkdown", "path": "/pymarkdown/plugin_manager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: katharosada/bus-shaming path: /busshaming/models/__init__.py from .agency import Agency from .feed import Feed from .feed_timetable import FeedTimetable from .realtime_entry import RealtimeEntry from .realtime_progress import RealtimeProgress from .route import Route from .route_date import Route...
code_fim
medium
{ "lang": "python", "repo": "katharosada/bus-shaming", "path": "/busshaming/models/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>op from .stop_sequence import StopSequence from .trip import Trip from .trip_date import TripDate from .trip_stop import TripStop<|fim_prefix|># repo: katharosada/bus-shaming path: /busshaming/models/__init__.py from .agency import Agency from .feed import Feed from .feed_timetable import FeedTimetable f...
code_fim
medium
{ "lang": "python", "repo": "katharosada/bus-shaming", "path": "/busshaming/models/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 401-python-joseph-zabaleta/401-python-data-structures-and-algorithms path: /tests/data_structures/--test_hashtable.py import pytest from dsa.data_structures.hashtable.hashtable import Hashmap def test_hash_a_key(): myHash = Hashmap(10) actual = myHash.hash('a') expected = 3 asse...
code_fim
hard
{ "lang": "python", "repo": "401-python-joseph-zabaleta/401-python-data-structures-and-algorithms", "path": "/tests/data_structures/--test_hashtable.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> myHash = Hashmap(100) myHash.add('something', 10) myHash.add('random', 42) myHash.add('code', 99) actual = myHash.get('code') expected = 99 assert actual == expected def test_get_key_invalid(): myHash = Hashmap(100) myHash.add('something', 10) myHash.add('random', ...
code_fim
hard
{ "lang": "python", "repo": "401-python-joseph-zabaleta/401-python-data-structures-and-algorithms", "path": "/tests/data_structures/--test_hashtable.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>plt.title("My Favorite Fruit Salad") plt.tight_layout() plt.show()<|fim_prefix|># repo: Georgitanev/matplotlib path: /03_pie_chart.py from matplotlib import pyplot as plt plt.style.use("fivethirtyeight") <|fim_middle|>labels = ['Watermelon', 'Apples', 'Avocado', 'Melon', 'Strawberries'] slices =...
code_fim
hard
{ "lang": "python", "repo": "Georgitanev/matplotlib", "path": "/03_pie_chart.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Georgitanev/matplotlib path: /03_pie_chart.py from matplotlib import pyplot as plt plt.style.use("fivethirtyeight") <|fim_suffix|>plt.pie(slices, labels=labels, colors=colors, explode=explode, shadow=True, startangle=90, autopct='%1.1f%%', wedgeprops={'edgecolor':...
code_fim
hard
{ "lang": "python", "repo": "Georgitanev/matplotlib", "path": "/03_pie_chart.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def filtrar_idade(pessoa): return pessoa['idade'] < 18 novas_pessoas = list(filter(filtrar_idade, pessoas)) for pessoa in pessoas: print(pessoa) print('######') for pessoa in novas_pessoas: print(pessoa)<|fim_prefix|># repo: axellbrendow/python3-basic-to-advanced path: /aula043-filter/aul...
code_fim
medium
{ "lang": "python", "repo": "axellbrendow/python3-basic-to-advanced", "path": "/aula043-filter/aula43.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print('\nfiltrando idades') def filtrar_idade(pessoa): return pessoa['idade'] < 18 novas_pessoas = list(filter(filtrar_idade, pessoas)) for pessoa in pessoas: print(pessoa) print('######') for pessoa in novas_pessoas: print(pessoa)<|fim_prefix|># repo: axellbrendow/python3-basic-to-advanc...
code_fim
medium
{ "lang": "python", "repo": "axellbrendow/python3-basic-to-advanced", "path": "/aula043-filter/aula43.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: axellbrendow/python3-basic-to-advanced path: /aula043-filter/aula43.py """ Filter(lambda item: boolean, iterable) - Percorre os elementos de um iterável, cria cópias deles e aplica uma função que decide se o elemento deve ou não ir para a nova coleção. """ from dados import carrinho, pessoas, li...
code_fim
medium
{ "lang": "python", "repo": "axellbrendow/python3-basic-to-advanced", "path": "/aula043-filter/aula43.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_read_frame_raises_invalidframetype_for_unregistered_frame_type(self): self.mock(frame, 'Reader') reader = self.mock() payload = self.mock() expect(reader.read_octet).returns(54) # frame type expect(reader.read_short).returns(32) # channel id ...
code_fim
hard
{ "lang": "python", "repo": "guardicore/haigha2", "path": "/tests/unit/frames/frame_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> expect(reader.tell).returns(5) expect(frame.Reader).args(reader, 5, 42).returns('payload') expect(reader.seek).args(42, 1) expect(reader.read_octet).raises(Reader.BufferUnderflow) assert_raises(Reader.BufferUnderflow, Frame._read_frame, reader) def test_read_f...
code_fim
hard
{ "lang": "python", "repo": "guardicore/haigha2", "path": "/tests/unit/frames/frame_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: guardicore/haigha2 path: /tests/unit/frames/frame_test.py ''' Copyright (c) 2011-2017, Agora Games, LLC All rights reserved. https://github.com/agoragames/haigha/blob/master/LICENSE.txt ''' from chai import Chai import struct from collections import deque from haigha2.frames import frame from ...
code_fim
hard
{ "lang": "python", "repo": "guardicore/haigha2", "path": "/tests/unit/frames/frame_test.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: popcornell/lhotse path: /lhotse/augmentation/wpe.py from dataclasses import asdict, dataclass from typing import Optional, Tuple import numpy as np import torch from lhotse.augmentation.transform import AudioTransform from lhotse.utils import Seconds, is_module_available <|fim_suffix|> from...
code_fim
hard
{ "lang": "python", "repo": "popcornell/lhotse", "path": "/lhotse/augmentation/wpe.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> n_fft: int = 512 hop_length: int = 128 taps: int = 10 delay: int = 3 iterations: int = 3 statistics_mode: str = "full" def __call__(self, samples: np.ndarray, *args, **kwargs) -> np.ndarray: if isinstance(samples, np.ndarray): samples = torch.from_numpy(sam...
code_fim
hard
{ "lang": "python", "repo": "popcornell/lhotse", "path": "/lhotse/augmentation/wpe.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def do_shift(self): self.fft_shift = np.fft.fftshift(self.fft) return np.log(np.abs(self.fft_shift)) def get_fft(self): return self.fft<|fim_prefix|># repo: Chrysochrome/FTImg path: /libs/funcs/fft_basic.py import numpy as np from numpy import shape <|fim_middle|>class ...
code_fim
hard
{ "lang": "python", "repo": "Chrysochrome/FTImg", "path": "/libs/funcs/fft_basic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_fft(self): return self.fft<|fim_prefix|># repo: Chrysochrome/FTImg path: /libs/funcs/fft_basic.py import numpy as np from numpy import shape class fft_basic: ''' 基础离散傅立叶变换类 ''' def __init__(self, matrix): self.matrix = matrix def do_fft(self): s...
code_fim
medium
{ "lang": "python", "repo": "Chrysochrome/FTImg", "path": "/libs/funcs/fft_basic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chrysochrome/FTImg path: /libs/funcs/fft_basic.py import numpy as np from numpy import shape class fft_basic: <|fim_suffix|> self.fft_shift = np.fft.fftshift(self.fft) return np.log(np.abs(self.fft_shift)) def get_fft(self): return self.fft<|fim_middle|> ''' 基...
code_fim
hard
{ "lang": "python", "repo": "Chrysochrome/FTImg", "path": "/libs/funcs/fft_basic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: morganuoft/python-sonarqube-api path: /sonarqube/project_branches.py #!/usr/bin/env python # -*- coding:utf-8 -*- # @Author: Jialiang Shi from sonarqube.config import ( API_PROJECT_BRANCHES_LIST_ENDPOINT, API_PROJECT_BRANCHES_DELETE_ENDPOINT, API_PROJECT_BRANCHES_RENAME_ENDPOINT ) c...
code_fim
hard
{ "lang": "python", "repo": "morganuoft/python-sonarqube-api", "path": "/sonarqube/project_branches.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def delete_project_branch(self, project, branch): """ Delete a non-main branch of a project. :param project: Project key :param branch: Name of the branch :return: """ params = { 'project': project, 'branch': branch ...
code_fim
hard
{ "lang": "python", "repo": "morganuoft/python-sonarqube-api", "path": "/sonarqube/project_branches.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sebastianludwig/SensationDriver path: /test/test_pattern.py from utils import * from sensationdriver.pattern import BezierPath from sensationdriver.pattern import Track class Point(object): def __init__(self, time, value): self.time = time self.value = value class Keyfram...
code_fim
hard
{ "lang": "python", "repo": "sebastianludwig/SensationDriver", "path": "/test/test_pattern.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class TestTrack(unittest.TestCase): def setUp(self): # 0 - 0.3 # 0.1325325 - 0.3 # 0.2650649 - 1.161977 # 0.3975974 - 1.333954 # 0.8650649 - 1.940549 # 1.332533 - -0.5553294 # 1.8 - 2 p0 = Point(0, 0.3) c1 = Point(0.13253...
code_fim
hard
{ "lang": "python", "repo": "sebastianludwig/SensationDriver", "path": "/test/test_pattern.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @actions_step_required def add_action_error(self, action, error): self.step[action].status = settings.ACTION.STATUS.ERROR self.step[action].error = error @actions_step_required def skip_all_step_actions(self, actions, reason): for action in actions: res...
code_fim
hard
{ "lang": "python", "repo": "scrapinghub/spidermon", "path": "/spidermon/results/monitor.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: scrapinghub/spidermon path: /spidermon/results/monitor.py from collections import OrderedDict import unittest from spidermon import settings from .steps import MonitorStep, ActionsStep def step_required_decorator(allowed_steps): def _step_required_decorator(fn): def decorator(self...
code_fim
hard
{ "lang": "python", "repo": "scrapinghub/spidermon", "path": "/spidermon/results/monitor.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for action in actions: result = self.step.add_item(action) result.status = settings.ACTION.STATUS.SKIPPED result.reason = reason @property def _step_monitors(self): return self._steps[settings.STEPS.MONITORS] @property def _step_monitor...
code_fim
hard
{ "lang": "python", "repo": "scrapinghub/spidermon", "path": "/spidermon/results/monitor.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ generated source for method toData """ if particle.getDataType() == Void.__class__: return [None] * 0 if particle.getDataType() == ItemStack.__class__: if obj == None: return [None] * itemStack = obj return [None]...
code_fim
hard
{ "lang": "python", "repo": "tetratec/speedbukkit", "path": "/src/org/speedbukkit/CraftParticle.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tetratec/speedbukkit path: /src/org/speedbukkit/CraftParticle.py #!/usr/bin/env python """ generated source for module CraftParticle """ from __future__ import print_function # package: org.bukkit.craftbukkit class CraftParticle(object): <|fim_suffix|> """ generated source for method toNMS...
code_fim
medium
{ "lang": "python", "repo": "tetratec/speedbukkit", "path": "/src/org/speedbukkit/CraftParticle.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ytyaru/Python.FileSize.201702071138 path: /TestFileSize1000_4.py import unittest import FileSize from decimal import Decimal class TestFileSize1000_4(unittest.TestCase): def test_999(self): self.__target = FileSize.FileSize(byte_size_of_unit=1000, integral_figure_num=4) actual...
code_fim
hard
{ "lang": "python", "repo": "ytyaru/Python.FileSize.201702071138", "path": "/TestFileSize1000_4.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> self.__target = FileSize.FileSize(byte_size_of_unit=1000, integral_figure_num=4) actual = (1000 ** 2 * 10) - 1 self.assertEqual(self.__target.Get(actual), "9999.99 KB") def test_10MB(self): self.__target = FileSize.FileSize(byte_size_of_unit=1000, integral_figure_num=4)...
code_fim
hard
{ "lang": "python", "repo": "ytyaru/Python.FileSize.201702071138", "path": "/TestFileSize1000_4.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lanfis/Spider path: /test_sniffer.py #!/usr/bin/env python # license removed for brevity import requests from scapy.all import * <|fim_suffix|>print("sniffer starting ...") sniffer = Sniffer(count=-1, filter="arp", use_show=True, use_logger=False)#, filter="arp")#, filter="tcp and ( port...
code_fim
medium
{ "lang": "python", "repo": "lanfis/Spider", "path": "/test_sniffer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("sniffer starting ...") sniffer = Sniffer(count=-1, filter="arp", use_show=True, use_logger=False)#, filter="arp")#, filter="tcp and ( port 80 or port 443 )") pkts = sniffer.run()<|fim_prefix|># repo: lanfis/Spider path: /test_sniffer.py #!/usr/bin/env python # license removed for brevity i...
code_fim
medium
{ "lang": "python", "repo": "lanfis/Spider", "path": "/test_sniffer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def crossunder(x, y): """ Last two values of X serie under over Y serie. """ return x[-1] < y[-1] and x[-2] > y[-2] def divergence(a, b): """ Check if sign(a) != sign(b) """ return np.sign(a) != np.sign(b) and a != 0 and b != 0 def average(data): """ Return the ...
code_fim
hard
{ "lang": "python", "repo": "cal97g/siis", "path": "/strategy/indicator/utils.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: cal97g/siis path: /strategy/indicator/utils.py # @date 2018-09-02 # @author Frederic SCHERMA # @author Xavier BONNIN # @license Copyright (c) 2018 Dream Overflow # Indicator utils import numpy as np import scipy.signal as signal def down_sample(data, factor, n=4, ftype='iir'): return signa...
code_fim
hard
{ "lang": "python", "repo": "cal97g/siis", "path": "/strategy/indicator/utils.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: itsrohanvj/Data-Structures-Algorithms-in-Python path: /Data Structures/Stack using Linked List.py class Node: # constructor def __init__(self): self.data = None self.next = None # method for setting the data field of the node def set_data(self, data): ...
code_fim
hard
{ "lang": "python", "repo": "itsrohanvj/Data-Structures-Algorithms-in-Python", "path": "/Data Structures/Stack using Linked List.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.head = None if data: for data in data: self.push(data) # each element gets inserted into the beginning. def push(self, data): temp = Node() temp.set_data(data) temp.set_next(self.head) self.head = temp # each el...
code_fim
medium
{ "lang": "python", "repo": "itsrohanvj/Data-Structures-Algorithms-in-Python", "path": "/Data Structures/Stack using Linked List.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def writeJSON(filename): """ opens json file with name filename and writes numRows rows of random quiz data """ if not filename.endswith('.json'): filename += '.json' with open(filename, 'w') as f: for x in range(numRows): scores = quizScores() type...
code_fim
hard
{ "lang": "python", "repo": "Hmc-cs-tdubno/C_Scores", "path": "/TestDataScript.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hmc-cs-tdubno/C_Scores path: /TestDataScript.py # Test Data Generator import csv import json import random numRows = 25 #desired number of rows in test data set def questionScores(): """ randomly orders the numbers 1 through 4 in an array return array that represents the rank student ga...
code_fim
hard
{ "lang": "python", "repo": "Hmc-cs-tdubno/C_Scores", "path": "/TestDataScript.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MatthewTe/velkoz_backend_applications path: /velkoz_web_application_django/velkoz_web_application/urls.py from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), <|fim_suffix|> # Url Paths for the dashboard core application...
code_fim
medium
{ "lang": "python", "repo": "MatthewTe/velkoz_backend_applications", "path": "/velkoz_web_application_django/velkoz_web_application/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Url Paths for the Stock Data Dashboard: path('stock_data_db/', include('stock_dashboard.urls')) ]<|fim_prefix|># repo: MatthewTe/velkoz_backend_applications path: /velkoz_web_application_django/velkoz_web_application/urls.py from django.contrib import admin from django.urls import path, include...
code_fim
hard
{ "lang": "python", "repo": "MatthewTe/velkoz_backend_applications", "path": "/velkoz_web_application_django/velkoz_web_application/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Url Paths for User Authentication system: path('auth/', include('user_management.urls')), # Url Paths for the dashboard core application: path('', include('dashboard_core.urls')), # Url Paths for the Stock Data Dashboard: path('stock_data_db/', include('stock_dashboard.urls')) ...
code_fim
easy
{ "lang": "python", "repo": "MatthewTe/velkoz_backend_applications", "path": "/velkoz_web_application_django/velkoz_web_application/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': hello_world() print('Prints only here')<|fim_prefix|># repo: laminsawo/python-365-days path: /python-fundamentals/day-9-modules/hello_one.py # hello_one.py def hello_world(): print('Hello!, world') <|fim_middle|>def good_morning(x): print(x) msg...
code_fim
medium
{ "lang": "python", "repo": "laminsawo/python-365-days", "path": "/python-fundamentals/day-9-modules/hello_one.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: laminsawo/python-365-days path: /python-fundamentals/day-9-modules/hello_one.py # hello_one.py def hello_world(): <|fim_suffix|> def good_morning(x): print(x) msg = str(input('Type here: ')) print('We say : \' %s \'' % msg) if __name__ == '__main__': hello_world() ...
code_fim
easy
{ "lang": "python", "repo": "laminsawo/python-365-days", "path": "/python-fundamentals/day-9-modules/hello_one.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(x) msg = str(input('Type here: ')) print('We say : \' %s \'' % msg) if __name__ == '__main__': hello_world() print('Prints only here')<|fim_prefix|># repo: laminsawo/python-365-days path: /python-fundamentals/day-9-modules/hello_one.py # hello_one.py def hello_world(...
code_fim
easy
{ "lang": "python", "repo": "laminsawo/python-365-days", "path": "/python-fundamentals/day-9-modules/hello_one.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adamamiller/NUREU17 path: /LSST/SearchOpSim/searchOpSim.py #schema: https://www.lsst.org/scientists/simulations/opsim/summary-table-column-descriptions-v335 #http://ops2.lsst.org/docs/current/architecture.html #we need to take an input RA, DEC and find the fieldid that it corresponds to in the "...
code_fim
medium
{ "lang": "python", "repo": "adamamiller/NUREU17", "path": "/LSST/SearchOpSim/searchOpSim.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #field-of-view == 3.5-degree diameter (also returned with fieldFov key) cursor = db.cursor() cursor.execute("SELECT fieldid, fieldra, fielddec FROM field") c = np.array(cursor.fetchall()) RA = c[:,1] Dec = c[:,2] dbCoord = SkyCoord(ra = RA*units.degree, dec = Dec*units.degree, frame='icrs') inCoo...
code_fim
medium
{ "lang": "python", "repo": "adamamiller/NUREU17", "path": "/LSST/SearchOpSim/searchOpSim.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #this check apparently isn't necessary because it looks like the entire sky is covered with fieldIDs, but I suppose some of these fieldIDs don't have any observation dates (in the northern hemisphere) if (len(mask[0]) > 0): print("WARNING: coordinate outside LSST FOV", inRA[mask], inDec[mask]) dbID[...
code_fim
hard
{ "lang": "python", "repo": "adamamiller/NUREU17", "path": "/LSST/SearchOpSim/searchOpSim.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #link = unapy.Link(opts.device) link = cli.get_link( ) print link device = models.Device(link) for func in [ model, sim, sms ]: M = func(device)<|fim_prefix|># repo: bewest/unapy path: /src/python/models.py import logging import sys import unapy import time logging.basicConfig(stream=sys.s...
code_fim
hard
{ "lang": "python", "repo": "bewest/unapy", "path": "/src/python/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bewest/unapy path: /src/python/models.py import logging import sys import unapy import time logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) from pprint import pprint <|fim_suffix|>def model(device): model = device.model print "device: %s" % device def sim(device): sim = device...
code_fim
medium
{ "lang": "python", "repo": "bewest/unapy", "path": "/src/python/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class UserInGroup(models.Model): ''' A user's actual involvement in a group. ''' user = models.ForeignKey(User, related_name="what_groups") #Related name can't be 'groups' because that will conflict with the "groups" field on auth.User role = models.ForeignKey(RoleInGroup, related_nam...
code_fim
hard
{ "lang": "python", "repo": "jMyles/WHAT", "path": "/what_apps/people/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jMyles/WHAT path: /what_apps/people/models.py from django.db import models from django.db.models.signals import post_save from django.db.models.query_utils import Q from django.db.utils import DatabaseError from django.core.exceptions import ValidationError from django.contrib.contenttypes impor...
code_fim
hard
{ "lang": "python", "repo": "jMyles/WHAT", "path": "/what_apps/people/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VALIS-software/valis-python-client path: /valis/Gene.py from .Dataset import Dataset class Gene: <|fim_suffix|> def query(self, names=None): return (self.api.genomeQuery() .filterSource(Dataset.ENSEMBL) .filterType(GenomeType.GENE) .filterName(names))<|fim_middle|> def __...
code_fim
medium
{ "lang": "python", "repo": "VALIS-software/valis-python-client", "path": "/valis/Gene.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.api = api def datasets(self): """ Returns the list of annotation datasets available e.g ENCODE, ENSEMBL, ROADMAP """ return [Dataset.ENSEMBL] def query(self, names=None): return (self.api.genomeQuery() .filterSource(Dataset.ENSEMBL) .filterType(GenomeType.GENE) ...
code_fim
easy
{ "lang": "python", "repo": "VALIS-software/valis-python-client", "path": "/valis/Gene.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return (self.api.genomeQuery() .filterSource(Dataset.ENSEMBL) .filterType(GenomeType.GENE) .filterName(names))<|fim_prefix|># repo: VALIS-software/valis-python-client path: /valis/Gene.py from .Dataset import Dataset class Gene: def __init__(self, api): self.api = api def ...
code_fim
medium
{ "lang": "python", "repo": "VALIS-software/valis-python-client", "path": "/valis/Gene.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> device = vertex_feat.device feat = [index_select(vertex_feat, torch.from_numpy(imgcoord[i]).to(device)) for i in range(5)] feat_row = [index_select(vertex_feat, torch.from_numpy(imgcoord_row[i]).to(device)) for i in range(5)] if return_list: return feat, feat_row else: ...
code_fim
hard
{ "lang": "python", "repo": "swipswaps/crownconv360depth", "path": "/utils/feature_integration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: swipswaps/crownconv360depth path: /utils/feature_integration.py import math from functools import lru_cache import numpy as np import torch from numpy.linalg import norm from utils.geometry_helper import get_unfold_imgcoord, get_unfold_imgcoord_row, get_icosahedron @lru_cache() def get_count_...
code_fim
hard
{ "lang": "python", "repo": "swipswaps/crownconv360depth", "path": "/utils/feature_integration.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def vertex_feat_to_unfold_feat(vertex_feat, return_list=True): if vertex_feat.size(-2) != 1: # size must be b x c x 1 x vertex_num or # b x c x d x 1 x vertex_num vertex_feat.unsqueeze_(-2) vertex_num = vertex_feat.shape[-1] level = int(math.log((vertex_nu...
code_fim
hard
{ "lang": "python", "repo": "swipswaps/crownconv360depth", "path": "/utils/feature_integration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: demisto/content path: /Packs/CortexXDR/Scripts/XCloudResourcesPieWidget/XCloudResourcesPieWidget.py import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 import collections import random from typing import Counter def parse_data(resources_name): resource...
code_fim
hard
{ "lang": "python", "repo": "demisto/content", "path": "/Packs/CortexXDR/Scripts/XCloudResourcesPieWidget/XCloudResourcesPieWidget.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): incident = demisto.incidents() resources_name = incident[0].get('CustomFields', {}).get('cloudresourcelist', "0") if resources_name: data = parse_data(resources_name) else: data = { "Type": 17, "ContentsFormat": "bar", "Cont...
code_fim
hard
{ "lang": "python", "repo": "demisto/content", "path": "/Packs/CortexXDR/Scripts/XCloudResourcesPieWidget/XCloudResourcesPieWidget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: data = { "Type": 17, "ContentsFormat": "bar", "Contents": { "stats": [ { "data": [ 0 ], "groups": None, ...
code_fim
hard
{ "lang": "python", "repo": "demisto/content", "path": "/Packs/CortexXDR/Scripts/XCloudResourcesPieWidget/XCloudResourcesPieWidget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hwengineer/rf_linkbudget path: /docs/code/example1.py import rf_linkbudget as rf import matplotlib.pyplot as plt import numpy as np cr = rf.Circuit('SimpleEx') lna = rf.Amplifier("LNA TQL9066", Gain=[(0, 18.2)], NF=0.7, OP1dB=21.5, ...
code_fim
hard
{ "lang": "python", "repo": "hwengineer/rf_linkbudget", "path": "/docs/code/example1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> src['out'].regCallback(cb_src) # connect callback to Port cr.finalise() sim = cr.simulate(network=cr.net, start=cr['Source'], end=cr['Sink'], freq=[100e6], power=np.arange(-50, -10, 1.0)) h = sim.plot_chain(['p']) plt.show()<|f...
code_fim
medium
{ "lang": "python", "repo": "hwengineer/rf_linkbudget", "path": "/docs/code/example1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_secrets(request): """Get SecretValues, with options from the API request. If `send_email=false` is in the request query string, the mandrill key will be omitted, which causes RServe to not sent any email notifications. """ secret_keys = ( 'neptune_sql_credentials', ...
code_fim
hard
{ "lang": "python", "repo": "Stanford-PERTS/triton", "path": "/app/cron_rserve.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Stanford-PERTS/triton path: /app/cron_rserve.py """Helpers for RServe-related cron jobs.""" import json import logging import os from google.appengine.api import urlfetch from gae_handlers import rserve_jwt from gae_models import DatastoreModel from model import Classroom, Organization, Report,...
code_fim
hard
{ "lang": "python", "repo": "Stanford-PERTS/triton", "path": "/app/cron_rserve.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> return handle_manage_user( self, request, form, UserManagementLayout(self, request)) @TownApp.form(model=UserCollection, template='newuser.pt', form=NewUserForm, name='new', permission=Secret) def town_handle_new_user(self, request, form): return handle_new_user( se...
code_fim
hard
{ "lang": "python", "repo": "OneGov/onegov-cloud", "path": "/src/onegov/town6/views/usermanagement.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OneGov/onegov-cloud path: /src/onegov/town6/views/usermanagement.py from onegov.core.security import Secret from onegov.org.views.usermanagement import view_usermanagement, \ handle_create_signup_link, view_user, handle_manage_user, \ get_manage_user_form, handle_new_user from onegov.tow...
code_fim
hard
{ "lang": "python", "repo": "OneGov/onegov-cloud", "path": "/src/onegov/town6/views/usermanagement.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if weight: tupleArray = rnp.tree2array(tree,branches=formulae,selection=cut,include_weight=True,weight_name=weight) else: tupleArray = rnp.tree2array(tree,branches=formulae,selection=cut) return tupleArray<|fim_prefix|># repo: LPC-DM/PandaCore path: /Statistics/python/numpyUtils.py #!/usr/b...
code_fim
easy
{ "lang": "python", "repo": "LPC-DM/PandaCore", "path": "/Statistics/python/numpyUtils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LPC-DM/PandaCore path: /Statistics/python/numpyUtils.py #!/usr/bin/env python import ROOT as root #import root_numpy as rnp import numpy as np from PandaCore.Tools.Misc import * <|fim_suffix|> if weight: tupleArray = rnp.tree2array(tree,branches=formulae,selection=cut,include_weight=True,w...
code_fim
easy
{ "lang": "python", "repo": "LPC-DM/PandaCore", "path": "/Statistics/python/numpyUtils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: awitwicki/tobinary_bot path: /logs.py def init_logger(): import logging logger = logging.getLogger("bot_logger") logger.setLevel(logging.DEBUG) file_handler = logging.FileHandler('log.txt', 'a', 'utf-8') file_handler.setLevel(logging.DEBUG) console_handler = logging.Stre...
code_fim
hard
{ "lang": "python", "repo": "awitwicki/tobinary_bot", "path": "/logs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logger.addHandler(console_handler) logger.addHandler(file_handler) return logger logger = init_logger()<|fim_prefix|># repo: awitwicki/tobinary_bot path: /logs.py def init_logger(): import logging logger = logging.getLogger("bot_logger") logger.setLevel(logging.DEBUG) file_...
code_fim
hard
{ "lang": "python", "repo": "awitwicki/tobinary_bot", "path": "/logs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mmmaaaggg/RefUtils path: /src/fh_tools/language_test/base_test/class_test/class_field_test.py # -*- coding: utf-8 -*- """ Created on 2017/6/18 @author: MG """ from collections import OrderedDict class ClassFoo(object): def __init__(self): <|fim_suffix|> def print_c(self): print(se...
code_fim
medium
{ "lang": "python", "repo": "mmmaaaggg/RefUtils", "path": "/src/fh_tools/language_test/base_test/class_test/class_field_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(self.__dict__) cf = ClassFoo() cf.print_c()<|fim_prefix|># repo: mmmaaaggg/RefUtils path: /src/fh_tools/language_test/base_test/class_test/class_field_test.py # -*- coding: utf-8 -*- """ Created on 2017/6/18 @author: MG """ from collections import OrderedDict class ClassFoo(object): d...
code_fim
medium
{ "lang": "python", "repo": "mmmaaaggg/RefUtils", "path": "/src/fh_tools/language_test/base_test/class_test/class_field_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.field1 = 1 self.field2 = '2' self.field3 = '3' self.field4 = 4 def print_c(self): print(self.__dict__) cf = ClassFoo() cf.print_c()<|fim_prefix|># repo: mmmaaaggg/RefUtils path: /src/fh_tools/language_test/base_test/class_test/class_field_test.py # -*- c...
code_fim
easy
{ "lang": "python", "repo": "mmmaaaggg/RefUtils", "path": "/src/fh_tools/language_test/base_test/class_test/class_field_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: priv-kweihmann/oelint-adv path: /tests/test_class_oelint_file_reqinc_relpaths.py import pytest # noqa: I900 from .base import TestBaseClass class TestClassOelintFileRequireIncludeRelPaths(TestBaseClass): @pytest.mark.parametrize('id_', ['oelint.file.includerelpath']) @pytest.mark.par...
code_fim
hard
{ "lang": "python", "repo": "priv-kweihmann/oelint-adv", "path": "/tests/test_class_oelint_file_reqinc_relpaths.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize('id_', ['oelint.file.includerelpath']) @pytest.mark.parametrize('occurrence', [0]) @pytest.mark.parametrize('input_', [ { 'oelint_adv_test.bb': ...
code_fim
hard
{ "lang": "python", "repo": "priv-kweihmann/oelint-adv", "path": "/tests/test_class_oelint_file_reqinc_relpaths.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DanPopa46/neo3-boa path: /boa3/model/type/collection/mapping/mappingtype.py from abc import ABC from typing import Any, Iterable, Set, Sized from boa3.model.type.collection.icollection import ICollectionType from boa3.model.type.itype import IType from boa3.neo.vm.type.AbiType import AbiType fro...
code_fim
hard
{ "lang": "python", "repo": "DanPopa46/neo3-boa", "path": "/boa3/model/type/collection/mapping/mappingtype.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def is_type_of(self, value: Any) -> bool: if self._is_type_of(value): if isinstance(value, MappingType): return (self.key_type.is_type_of(value.key_type) and self.value_type.is_type_of(value.value_type)) return True return...
code_fim
hard
{ "lang": "python", "repo": "DanPopa46/neo3-boa", "path": "/boa3/model/type/collection/mapping/mappingtype.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.valid_key.is_type_of(key_type) @property def valid_key(self) -> IType: return self.key_type @classmethod def filter_types(cls, values_type) -> Set[IType]: if values_type is None: values_type = set() elif not isinstance(values_type, ...
code_fim
hard
{ "lang": "python", "repo": "DanPopa46/neo3-boa", "path": "/boa3/model/type/collection/mapping/mappingtype.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for led_id, led_value in self.param_lights_to_set_colors: cmd += bytes([led_id, led_value]) cmd += Mk2.CMD_END # Now deal with the display if self.param_display_updates: # Keylab 61 only has 1 display, so just fetch the last update. ...
code_fim
hard
{ "lang": "python", "repo": "rjuang/rum", "path": "/device_profile/arturia/keylab.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Now deal with the display if self.param_display_updates: # Keylab 61 only has 1 display, so just fetch the last update. lines = self.param_display_updates[-1] cmd += Mk2.CMD_BEGIN cmd += Mk2.CMD_SET_DISPLAY cmd += bytes([0x1]) +...
code_fim
hard
{ "lang": "python", "repo": "rjuang/rum", "path": "/device_profile/arturia/keylab.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rjuang/rum path: /device_profile/arturia/keylab.py from device_profile.abstract import MidiCommandBuilder class Mk2(MidiCommandBuilder): """ MIDI Command structure for Arturia Keylab 61 mk2. """ CMD_BEGIN = bytes([0xF0, 0x00, 0x20, 0x6B, 0x7F, 0x42]) CMD_END = bytes([0xF7]) # L...
code_fim
hard
{ "lang": "python", "repo": "rjuang/rum", "path": "/device_profile/arturia/keylab.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> regex = "(?<!\w\.\w.)(?<![A-Z][a-z]\.)(?<=\.|\?)\s" return [ sentence.strip() for sentence in re.split(regex, text) if sentence] def main(): text = "there's something i need to know. my name is Paradox. I am Mr. Paradox." sentences = tokenize_into_sentences(text) print(sentences) ...
code_fim
medium
{ "lang": "python", "repo": "monkidea/naive-text-summarizer", "path": "/preprocessor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }