text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>][0]+dp[i-2][0] dp[i][1]=dp[i-1][1]+dp[i-2][1] print(dp[N][0],dp[N][1])<|fim_prefix|># repo: DongHyunByun/algorithm_practice path: /dp/[boj]1003_피보나치함수_dp.py T=int(input()) for t in range(T): N=int(input()) if N==0: print(1,0) elif N==1: print(0,1) ...
code_fim
medium
{ "lang": "python", "repo": "DongHyunByun/algorithm_practice", "path": "/dp/[boj]1003_피보나치함수_dp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DongHyunByun/algorithm_practice path: /dp/[boj]1003_피보나치함수_dp.py T=int(input()) for t in range(T): N=int(input()) if N==0: print(1,0) <|fim_suffix|>][0]+dp[i-2][0] dp[i][1]=dp[i-1][1]+dp[i-2][1] print(dp[N][0],dp[N][1])<|fim_middle|> elif N==1: ...
code_fim
medium
{ "lang": "python", "repo": "DongHyunByun/algorithm_practice", "path": "/dp/[boj]1003_피보나치함수_dp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": strategy = 'reloc_flexi' filename = os.path.join(DATA_DIR, strategy + "_strategy_actions.dill") with open(filename, 'rb') as f: strategy_actions = dill.load(f) surge = strategy_actions['surge'] N = strategy_actions['N'] B = strategy_actions['B'] ...
code_fim
hard
{ "lang": "python", "repo": "vivekanon/uber-driver-strategy", "path": "/src/python/simulator/simulator_driver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vivekanon/uber-driver-strategy path: /src/python/simulator/simulator_driver.py #!/usr/local/bin/python """ Simualtor driver """ from __future__ import division import sys sys.path.insert(1, '..') <|fim_suffix|> surge = strategy_actions['surge'] N = strategy_actions['N'] B = strategy...
code_fim
hard
{ "lang": "python", "repo": "vivekanon/uber-driver-strategy", "path": "/src/python/simulator/simulator_driver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexzanderIvanov/saleor path: /saleor/checkout/views/__init__.py from django.shortcuts import redirect from django.template.response import TemplateResponse from ..forms import ShippingMethodForm from .discount import add_voucher_form from .validators import ( validate_cart, validate_shippin...
code_fim
hard
{ "lang": "python", "repo": "AlexzanderIvanov/saleor", "path": "/saleor/checkout/views/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if checkout.is_shipping_required: view = validate_shipping_address(summary_with_shipping_view) view = validate_shipping_method(view) return view(request, checkout) elif request.user.is_authenticated(): return summary_without_shipping(request, checkout) else: ...
code_fim
hard
{ "lang": "python", "repo": "AlexzanderIvanov/saleor", "path": "/saleor/checkout/views/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> notifier = ResultNotifier() real_ustaw_dyscypline(pole, elements, notifier) return notifier.retbuf<|fim_prefix|># repo: iplweb/bpp path: /src/rozbieznosci_dyscyplin/tasks.py from celery import shared_task from rozbieznosci_dyscyplin.admin import real_ustaw_dyscypline <|fim_middle|>@shared_...
code_fim
medium
{ "lang": "python", "repo": "iplweb/bpp", "path": "/src/rozbieznosci_dyscyplin/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iplweb/bpp path: /src/rozbieznosci_dyscyplin/tasks.py from celery import shared_task from rozbieznosci_dyscyplin.admin import real_ustaw_dyscypline <|fim_suffix|> notifier = ResultNotifier() real_ustaw_dyscypline(pole, elements, notifier) return notifier.retbuf<|fim_middle|>@shared_...
code_fim
medium
{ "lang": "python", "repo": "iplweb/bpp", "path": "/src/rozbieznosci_dyscyplin/tasks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_minted.py from xai.brain.wordbase.verbs._mint import _MINT <|fim_suffix|> _MINT.__init__(self) self.name = "MINTED" self.specie = 'verbs' self.basic = "mint" self.jsondata = {}<|fim_middle|>#calss header class _MINTED(_MINT, ): def __init...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_minted.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _MINT.__init__(self) self.name = "MINTED" self.specie = 'verbs' self.basic = "mint" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_minted.py from xai.brain.wordbase.verbs._mint import _MINT <|fim_middle|>#calss header class _MINTED(_MINT, ): def __init...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_minted.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: endremborza/typegame path: /typegame/core/callbacks.py import json import glob import os import datetime import dash import dash_html_components as html from dash.dependencies import Input, Output, State from typegame.parsing.from_notebook import parse_notebook from typegame.parsing.to_componen...
code_fim
hard
{ "lang": "python", "repo": "endremborza/typegame", "path": "/typegame/core/callbacks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> json.dump( Submission( name=name, answers=answers, correct_answers=correct_num, quiz_name=quiz_name, ).dict(), open( os.path.join( answer_path, f"{name}-{datetime.datetime.now()}.json" ), ...
code_fim
hard
{ "lang": "python", "repo": "endremborza/typegame", "path": "/typegame/core/callbacks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def handle_submission( question_list: List["Question"], answers: list, quiz_name: str, name: str, answer_path: str, ) -> Tuple: correct_num = 0 solutions = [] missed = [] for idx, question in enumerate(question_list): user_answer = answers[idx] if use...
code_fim
hard
{ "lang": "python", "repo": "endremborza/typegame", "path": "/typegame/core/callbacks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: imasyalol/ITMO_ICT_WebProgramming_2020 path: /students/k3340/laboratory_works/Pahmurin_Maksim/laboratiry_work_2/program/migrations/0001_initial.py # Generated by Django 3.0.7 on 2020-06-08 18:55 from django.db import migrations, models import django.db.models.deletion class Migration(migration...
code_fim
hard
{ "lang": "python", "repo": "imasyalol/ITMO_ICT_WebProgramming_2020", "path": "/students/k3340/laboratory_works/Pahmurin_Maksim/laboratiry_work_2/program/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ], options={ 'verbose_name': 'Расписание', 'verbose_name_plural': 'Расписание', }, ), migrations.CreateModel( name='Rating', fields=[ ('id', models.AutoField(auto_created=True, primary_key=...
code_fim
hard
{ "lang": "python", "repo": "imasyalol/ITMO_ICT_WebProgramming_2020", "path": "/students/k3340/laboratory_works/Pahmurin_Maksim/laboratiry_work_2/program/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>, ], options={ 'verbose_name': 'Преподаватель', 'verbose_name_plural': 'Преподаватели', }, ), migrations.CreateModel( name='Shedule', fields=[ ('id', models.AutoField(auto_created=Tr...
code_fim
hard
{ "lang": "python", "repo": "imasyalol/ITMO_ICT_WebProgramming_2020", "path": "/students/k3340/laboratory_works/Pahmurin_Maksim/laboratiry_work_2/program/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wooster/django-topsoil path: /tests/test_provider/testapp/resources.py from django.contrib.auth import logout as logout_auth from django.contrib.auth.decorators import login_required from django.http import HttpResponseForbidden, HttpResponseRedirect from django.middleware.csrf import get_token f...
code_fim
hard
{ "lang": "python", "repo": "wooster/django-topsoil", "path": "/tests/test_provider/testapp/resources.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> metadata = {} data = {} data['places'] = Place.objects.all() data['title'] = 'All Places' if format == 'html': metadata['template'] = 'places/list.html' return (metadata, data) @login_required @resource() def place_add(request, format=None, *args, **kwargs): metadata =...
code_fim
hard
{ "lang": "python", "repo": "wooster/django-topsoil", "path": "/tests/test_provider/testapp/resources.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@login_required @resource() def place_edit(request, format=None, *args, **kwargs): metadata = {} data = {} place_id = kwargs.get('place_id') request_method = request.method.upper() place = Place.objects.get(id=int(place_id)) if format == 'html': metadata['template'] = 'plac...
code_fim
hard
{ "lang": "python", "repo": "wooster/django-topsoil", "path": "/tests/test_provider/testapp/resources.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: brianjstroh/BrawlStars path: /brawl_data.py # -*- coding: utf-8 -*- """ Created on Sat Apr 10 12:22:10 2021 @author: brian """ import os import pandas as pd import numpy as np from statsmodels.stats.proportion import proportion_confint import psycopg2 from sqlalchemy import create_eng...
code_fim
hard
{ "lang": "python", "repo": "brianjstroh/BrawlStars", "path": "/brawl_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Get population data pop_query = "SELECT mode, map, brawler," pop_query += " SUM(wins) as wins," pop_query += " SUM(matches_played) AS matches_played" pop_query += " FROM " + pop_table pop_query += " GROUP BY mode, map, brawler;" pop = sql_get_results(connection_string, p...
code_fim
hard
{ "lang": "python", "repo": "brianjstroh/BrawlStars", "path": "/brawl_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> obj.author = self.request.user return super(MemoList, self).pre_save(obj) class MemoDetail(generics.RetrieveUpdateDestroyAPIView): model = Memo serializer_class = MemoSerializer permission_classes = [ permissions.AllowAny ] class NotebookList(generics.ListCreateAP...
code_fim
medium
{ "lang": "python", "repo": "cjworld/WeddingAssist", "path": "/noters/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cjworld/WeddingAssist path: /noters/views.py from rest_framework import generics, permissions, viewsets from django.contrib.auth.decorators import login_required from django.shortcuts import render from noters.serializers import MemoSerializer, NotebookSerializer from noters.models import Memo, N...
code_fim
medium
{ "lang": "python", "repo": "cjworld/WeddingAssist", "path": "/noters/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def pre_save(self, obj): obj.owner = self.request.user return super(NotebookList, self).pre_save(obj) class NotebookDetail(generics.RetrieveUpdateDestroyAPIView): model = Notebook serializer_class = NotebookSerializer permission_classes = [ permissions.AllowAny ...
code_fim
hard
{ "lang": "python", "repo": "cjworld/WeddingAssist", "path": "/noters/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyobs/pyobs-core path: /pyobs/modules/flatfield/pointing.py import logging from typing import Union, Dict, Any from pyobs.interfaces import IRunnable, ITelescope from pyobs.modules import Module from pyobs.object import get_object from pyobs.modules import timeout from pyobs.utils.skyflats.point...
code_fim
hard
{ "lang": "python", "repo": "pyobs/pyobs-core", "path": "/pyobs/modules/flatfield/pointing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Module for pointing a telescope.""" __module__ = "pyobs.modules.flatfield" def __init__( self, telescope: Union[str, ITelescope], pointing: Union[Dict[str, Any], SkyFlatsBasePointing], **kwargs: Any ): """Initialize a new flat field pointing. Args: ...
code_fim
medium
{ "lang": "python", "repo": "pyobs/pyobs-core", "path": "/pyobs/modules/flatfield/pointing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, telescope: Union[str, ITelescope], pointing: Union[Dict[str, Any], SkyFlatsBasePointing], **kwargs: Any ): """Initialize a new flat field pointing. Args: telescope: Telescope to point pointing: Pointing for calculating coordinates. """ ...
code_fim
medium
{ "lang": "python", "repo": "pyobs/pyobs-core", "path": "/pyobs/modules/flatfield/pointing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_palestinians.py from xai.brain.wordbase.nouns._palestinian import _PALESTINIAN <|fim_suffix|> _PALESTINIAN.__init__(self) self.name = "PALESTINIANS" self.specie = 'nouns' self.basic = "palestinian" self.jsondata = {}<|fim_middle|>#calss he...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_palestinians.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _PALESTINIAN.__init__(self) self.name = "PALESTINIANS" self.specie = 'nouns' self.basic = "palestinian" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_palestinians.py from xai.brain.wordbase.nouns._palestinian import _PALESTINIAN #calss header class _PA...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_palestinians.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: medmatix/DataSciCalc path: /DataSciCalc03.py section = "./documentation/all_docs.txt" docFile=open(section, 'r') self.manual.insert(tk.INSERT, '\n' + docFile.read()) # ######################################################### # Tab4 Multivariate statis...
code_fim
hard
{ "lang": "python", "repo": "medmatix/DataSciCalc", "path": "/DataSciCalc03.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.action_blank6 = ttk.Button(self.mvStatFunctKeys, text=" ", command=lambda: af.do_blank(self)) self.action_blank6.grid(column=2, row=1, padx=4, pady=6) # Associated tool tip squareXDescr = 'Unassigned key.' createToolTip(self.action_blank6, squareXDescr) ...
code_fim
hard
{ "lang": "python", "repo": "medmatix/DataSciCalc", "path": "/DataSciCalc03.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.action_sumL = ttk.Button(self.listFunctKeys, text=" \u03a3 L " , command=lambda: af.do_sumL(self)) self.action_sumL.grid(column=0, row=1, padx=4, pady=6) # Associated tool tip sumListDescr = 'Sum elements of L, result to L' createToolTip(self.action_sumL, sumLi...
code_fim
hard
{ "lang": "python", "repo": "medmatix/DataSciCalc", "path": "/DataSciCalc03.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return minsyl, maxsyl def haiku(body): """(Accidental) haiku detector""" body = body.lower() if body.startswith("!"): return False STRINGS.append(body) if len(STRINGS) > 3: STRINGS.pop(0) syllables = count_syllables(body) COUNTS.append(syllables) if...
code_fim
hard
{ "lang": "python", "repo": "jshufro/slask", "path": "/limbo/plugins/haiku.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jshufro/slask path: /limbo/plugins/haiku.py """!haiku [x]: fetch haiku #x|random""" import re import random from limbo import conf import logging from redis.client import StrictRedis REDIS = StrictRedis(host=conf.redis_host, port=conf.redis_port, db=conf.redis_db) QUEUE = "HAIKU" LOG = logging...
code_fim
hard
{ "lang": "python", "repo": "jshufro/slask", "path": "/limbo/plugins/haiku.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if is_vowel: if verbose: print c, "is a vowel" if not on_vowel: # We weren't on a vowel before. # Seeing a new vowel bumps the syllable count. if verbose: print "new syllable" ...
code_fim
hard
{ "lang": "python", "repo": "jshufro/slask", "path": "/limbo/plugins/haiku.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 418sec/soda-sql path: /tests/common/sql_test_case.py # Copyright 2020 Soda # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-...
code_fim
hard
{ "lang": "python", "repo": "418sec/soda-sql", "path": "/tests/common/sql_test_case.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """self.target may be initialized by a test suite""" if self.target is None: self.target = os.getenv('SODA_TEST_TARGET', TARGET_POSTGRES) warehouse_fixture = SqlTestCase.warehouse_fixtures_by_target.get(self.target) if warehouse_fixture is None: log...
code_fim
hard
{ "lang": "python", "repo": "418sec/soda-sql", "path": "/tests/common/sql_test_case.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fonnesbeck/pymc4 path: /pymc4/flow/executor.py erent datasets # 4. unobserved value is provided in executor directly to replace an observed value. # An advanced usage of PyMC4 where we change the set of observed nodes (not variables) # # The a...
code_fim
hard
{ "lang": "python", "repo": "fonnesbeck/pymc4", "path": "/pymc4/flow/executor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # in a state we might have: # - return values for distributions/models # we will modify this state with: # - distributions, used to calculate logp correctly # - potentials, same purpose # - values in case we sample from a distribution # A...
code_fim
hard
{ "lang": "python", "repo": "fonnesbeck/pymc4", "path": "/pymc4/flow/executor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self, deterministic: distribution.Deterministic, state: SamplingState ) -> Tuple[Any, SamplingState]: # TODO: docs if deterministic.is_anonymous: raise EvaluationError("Attempting to create an anonymous Deterministic") scoped_name = scopes.variable_name(dete...
code_fim
hard
{ "lang": "python", "repo": "fonnesbeck/pymc4", "path": "/pymc4/flow/executor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: engineersCode/EngComp5_surfourier path: /scripts/almost_fourier_helper.py import numpy from IPython.display import HTML import ipywidgets from matplotlib import animation, pyplot def create_init_fig(wrapped_signal, freq_arr, xcm_arr): """ creates initial figure needed for animation, but it d...
code_fim
hard
{ "lang": "python", "repo": "engineersCode/EngComp5_surfourier", "path": "/scripts/almost_fourier_helper.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def update_figure(f, anim_dict, g_t, t_arr, freq_arr, display_fig=False): res = g_t * comp_fourier_term(freq_arr[f], t_arr) anim_dict['fig'].suptitle('Frequency = {:.2f}'.format(freq_arr[f])) anim_dict['xcm_arr'][f] = numpy.mean(res.real) anim_dict['WSP'].set_data(res....
code_fim
hard
{ "lang": "python", "repo": "engineersCode/EngComp5_surfourier", "path": "/scripts/almost_fourier_helper.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: srusskih/SublimeJEDI path: /dependencies/jedi/third_party/typeshed/tests/pytype_test.py #!/usr/bin/env python3 """Test runner for typeshed. Depends on pytype being installed. If pytype is installed: 1. For every pyi, do nothing if it is in pytype_blacklist.txt. 2. Otherwise, call 'pytyp...
code_fim
hard
{ "lang": "python", "repo": "srusskih/SublimeJEDI", "path": "/dependencies/jedi/third_party/typeshed/tests/pytype_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for p in subdir_paths: if not os.path.isdir(p): raise SystemExit("Cannot find typeshed subdir at {} (specify parent dir via --typeshed-location)".format(p)) def check_python_exes_runnable(*, python27_exe_arg: str, python36_exe_arg: str) -> None: for exe, version_str in zip([p...
code_fim
hard
{ "lang": "python", "repo": "srusskih/SublimeJEDI", "path": "/dependencies/jedi/third_party/typeshed/tests/pytype_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: farchanjo/mongobackup path: /backup.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import logging import datetime import os import subprocess import shutil import boto3 from botocore.exceptions import ClientError try: from pymongo import MongoClient except ImportError: print('You mus...
code_fim
hard
{ "lang": "python", "repo": "farchanjo/mongobackup", "path": "/backup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> create_backup_folder() dbs_name = load_mongo_databases() s3_client = boto3.client('s3') for db_name in dbs_name: backup_folder = '%s/%s_%s' % (BACKUP_FOLDER, db_name, today_timestamp) tar_file = '%s.tar' % backup_folder logger.info("Start Backup for database: %s o...
code_fim
hard
{ "lang": "python", "repo": "farchanjo/mongobackup", "path": "/backup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def start_remove_old_backups(): for root, dirnames, filenames in os.walk(BACKUP_FOLDER, followlinks=False): full_filenames = list(map(lambda x: '%s/%s' % (BACKUP_FOLDER, x), filenames)) for full_filename in full_filenames: if os.path.exists(full_filename): ...
code_fim
hard
{ "lang": "python", "repo": "farchanjo/mongobackup", "path": "/backup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jonrau1/ElectricEye path: /eeauditor/auditors/aws/Amazon_SageMaker_Auditor.py "Recommendation": { "Text": "For more information on SageMaker infrastructure protection refer to the Connect a Notebook Instance to Resources in a VPC section of the Amazon SageMaker Devel...
code_fim
hard
{ "lang": "python", "repo": "jonrau1/ElectricEye", "path": "/eeauditor/auditors/aws/Amazon_SageMaker_Auditor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """[SageMaker.4] SageMaker endpoints should be encrypted""" sagemaker = session.client("sagemaker") # loop through sagemaker endpoints response = sagemaker.list_endpoints() mySageMakerEndpoints = response["Endpoints"] for endpoints in mySageMakerEndpoints: endpointName = st...
code_fim
hard
{ "lang": "python", "repo": "jonrau1/ElectricEye", "path": "/eeauditor/auditors/aws/Amazon_SageMaker_Auditor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """[SageMaker.5] SageMaker models should have network isolation enabled""" sagemaker = session.client("sagemaker") # loop through sagemaker models response = sagemaker.list_models() mySageMakerModels = response["Models"] for models in mySageMakerModels: modelName = str(mode...
code_fim
hard
{ "lang": "python", "repo": "jonrau1/ElectricEye", "path": "/eeauditor/auditors/aws/Amazon_SageMaker_Auditor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeffshurtliff/khorosjx path: /khorosjx/content/videos.py # -*- coding: utf-8 -*- """ :Module: khorosjx.content.videos :Synopsis: Collection of functions relating to videos (e.g. https://community.example.com/videos/1234) :Usage: ``from khorosjx.content import video...
code_fim
hard
{ "lang": "python", "repo": "jeffshurtliff/khorosjx", "path": "/khorosjx/content/videos.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def check_if_embedded(lookup_value, lookup_type='content_id'): """This function checks to see if a native video is embedded in a document or just a standalone video. :param lookup_value: The value with which to look up the video :type lookup_value: str, int :param lookup_type: Defines if ...
code_fim
hard
{ "lang": "python", "repo": "jeffshurtliff/khorosjx", "path": "/khorosjx/content/videos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def check_if_embedded(lookup_value, lookup_type='content_id'): """This function checks to see if a native video is embedded in a document or just a standalone video. :param lookup_value: The value with which to look up the video :type lookup_value: str, int :param lookup_type: Defines if...
code_fim
hard
{ "lang": "python", "repo": "jeffshurtliff/khorosjx", "path": "/khorosjx/content/videos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@transaction.commit_on_success def insert_tweet_to_db(tweet): tweet_author, created = Tweeter.objects.get_or_create(user_id=tweet['user']['id'], screen_name=tweet['user']['screen_name'] ...
code_fim
hard
{ "lang": "python", "repo": "shuggiefisher/crowdstock", "path": "/tweetreader/reader.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: shuggiefisher/crowdstock path: /tweetreader/reader.py import tweetstream import settings from datetime import datetime import simplejson as json from django.contrib.auth.models import User from django.db import transaction from tweetreader.models import Tweeter, Tweet <|fim_suffix|> tweet_a...
code_fim
hard
{ "lang": "python", "repo": "shuggiefisher/crowdstock", "path": "/tweetreader/reader.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ekday()] return answer print(solution(1, 2))<|fim_prefix|># repo: StudyForCoding/ProgrammersLevel path: /Level1/Lessons12901/yang_12901.py def solution(a, b): label = ['MON','TUE','WED','THU','FRI','SAT','SUN'] import datetim<|fim_middle|>e answer = label[datetime.date(2016,a,b).we
code_fim
easy
{ "lang": "python", "repo": "StudyForCoding/ProgrammersLevel", "path": "/Level1/Lessons12901/yang_12901.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StudyForCoding/ProgrammersLevel path: /Level1/Lessons12901/yang_12901.py def solution(a, b): label = ['MON','TUE','WED','THU','FRI','SAT','SUN'] import datetim<|fim_suffix|>ekday()] return answer print(solution(1, 2))<|fim_middle|>e answer = label[datetime.date(2016,a,b).we
code_fim
easy
{ "lang": "python", "repo": "StudyForCoding/ProgrammersLevel", "path": "/Level1/Lessons12901/yang_12901.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": import doctest doctest.testmod()<|fim_prefix|># repo: FranzSchubert92/cw path: /python/collatz.py """ collatz(n) starts a Collatz sequence from n; doctests >>> collatz(4) '4->2->1' >>> collatz(3) '3->10->5->16->8->4->2->1' """ <|fim_middle|>def collatz(n): seq = ...
code_fim
hard
{ "lang": "python", "repo": "FranzSchubert92/cw", "path": "/python/collatz.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: FranzSchubert92/cw path: /python/collatz.py """ collatz(n) starts a Collatz sequence from n; doctests >>> collatz(4) '4->2->1' >>> collatz(3) '3->10->5->16->8->4->2->1' """ <|fim_suffix|>if __name__ == "__main__": import doctest doctest.testmod()<|fim_middle|>def collatz(n): seq = ...
code_fim
hard
{ "lang": "python", "repo": "FranzSchubert92/cw", "path": "/python/collatz.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: mount_point = join(self.VOLUME_DIR, vol_name) self._mount(dev_name, mount_point, True) except Exception as e: self.logger.exception("Failed to mount volume '%s'" % vol_name) return HttpErrorResponse('Failed to mount volume: ' + e.message...
code_fim
hard
{ "lang": "python", "repo": "ConPaaS-team/conpaas", "path": "/conpaas-services/src/conpaas/services/generic/agent/agent.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not exists(script_path): self.logger.critical("Script '%s' does not exist in the active code tarball" % script_name) return start_args = [ "bash", script_path ] + parameters.split() self.processes[command] = Popen(start_args, cwd=sel...
code_fim
hard
{ "lang": "python", "repo": "ConPaaS-team/conpaas", "path": "/conpaas-services/src/conpaas/services/generic/agent/agent.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ConPaaS-team/conpaas path: /conpaas-services/src/conpaas/services/generic/agent/agent.py rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain...
code_fim
hard
{ "lang": "python", "repo": "ConPaaS-team/conpaas", "path": "/conpaas-services/src/conpaas/services/generic/agent/agent.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zoibelli/IoT-Garden path: /ESP32 configuration/Micropython code/util/pinout.py """this module is to load proper pinout per config""" import json def set_pinout(): device_config = {} pinout = None try: with open('config/device.json', 'r') as f: d = f.read() ...
code_fim
hard
{ "lang": "python", "repo": "zoibelli/IoT-Garden", "path": "/ESP32 configuration/Micropython code/util/pinout.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> if device_config.get('board_type') == "oLAB IoTBoard1" and device_config.get('soc_type') == "esp8266": import pinouts.olab_esp8266_iot_board1 as pinout if device_config.get('board_type') == "oLAB IoTBoard1" and device_config.get('soc_type') == "esp32": import pinouts.olab_esp32_io...
code_fim
hard
{ "lang": "python", "repo": "zoibelli/IoT-Garden", "path": "/ESP32 configuration/Micropython code/util/pinout.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> if device_config.get('board_type') == "oLAB Witty" and device_config.get('soc_type') == "esp8266": import pinouts.olab_esp8266_witty as pinout if device_config.get('board_type') == "oLAB Tickernator" and device_config.get('soc_type') == "esp8266": import pinouts.olab_esp8266_t...
code_fim
medium
{ "lang": "python", "repo": "zoibelli/IoT-Garden", "path": "/ESP32 configuration/Micropython code/util/pinout.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /tests/components/thread/test_discovery.py """Test the thread websocket API.""" from unittest.mock import ANY, AsyncMock, Mock import pytest from zeroconf.asyncio import AsyncServiceInfo from homeassistant.components.thread import discovery from homeassistant.componen...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/tests/components/thread/test_discovery.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize( ("data", "unconfigured"), [ (ROUTER_DISCOVERY_HASS_NO_ACTIVE_TIMESTAMP, True), (ROUTER_DISCOVERY_HASS_BAD_STATE_BITMAP, None), (ROUTER_DISCOVERY_HASS_NO_STATE_BITMAP, None), (ROUTER_DISCOVERY_HASS_STATE_BITMAP_NOT_ACTIVE, True), ], ) as...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/tests/components/thread/test_discovery.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Discover a service with bad or missing data mock_async_zeroconf.async_get_service_info.return_value = AsyncServiceInfo(**data) listener.add_service(None, data["type_"], data["name"]) await hass.async_block_till_done() router_discovered_removed.assert_called_once_with( "aeeb2f...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/tests/components/thread/test_discovery.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>le": ["1-4,6-15周三(5-6节)", "1-4,6-8周一(9-10节)", "10-15周五(1-2节)"], "location": ["D1142(D区)", "D1338(D区)", "D1344(D区)"] } ] for a, b in zip(lists, results): assert a == b<|fim_prefix|># repo: zombie110year/cqu_jxgl path: /tests/test_chioce.py from bs4 import BeautifulSoup ...
code_fim
hard
{ "lang": "python", "repo": "zombie110year/cqu_jxgl", "path": "/tests/test_chioce.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zombie110year/cqu_jxgl path: /tests/test_chioce.py from bs4 import BeautifulSoup def test_parse_dict(): from cqu_jxgl.choice import ChoiceTable with open("tests/工程力学.html", "rt", encoding="utf-8") as file: text = file.read() table<|fim_suffix|>le": ["1-4,6-15周三(5-6节)", "1-4,...
code_fim
hard
{ "lang": "python", "repo": "zombie110year/cqu_jxgl", "path": "/tests/test_chioce.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__version__ = '1.1.1' __name__ = PRODUCT_NAME<|fim_prefix|># repo: mypaceshun/qiitacli path: /qiitacli/__init__.py ''' Qiita API v2 を利用してQiitaへの記事投稿・削除・更新などを行う ''' import os from pathlib import Path <|fim_middle|>PRODUCT_NAME = 'qiitacli' ACCESSTOKEN_PATH = os.environ.get( "QIITACLI_ACCESSTOKEN_PATH...
code_fim
medium
{ "lang": "python", "repo": "mypaceshun/qiitacli", "path": "/qiitacli/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mypaceshun/qiitacli path: /qiitacli/__init__.py ''' Qiita API v2 を利用してQiitaへの記事投稿・削除・更新などを行う ''' import os from pathlib import Path <|fim_suffix|>__version__ = '1.1.1' __name__ = PRODUCT_NAME<|fim_middle|>PRODUCT_NAME = 'qiitacli' ACCESSTOKEN_PATH = os.environ.get( "QIITACLI_ACCESSTOKEN_PATH...
code_fim
medium
{ "lang": "python", "repo": "mypaceshun/qiitacli", "path": "/qiitacli/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, zipcd, zcta, nLabel, boro): self.ZipCode = th.cleanInts(zipcd) self.ZCTA = th.cleanInts(zcta) self.Neighborhood = nLabel self.Boro = boro def toStr(self): return str(self.ZipCode) + " | " + str(self.ZCTA)<|fim_prefix|># repo: T...
code_fim
medium
{ "lang": "python", "repo": "TT0101/nyc-zcta-data-helpers", "path": "/ZipToZCTA/ziptozcta.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TT0101/nyc-zcta-data-helpers path: /ZipToZCTA/ziptozcta.py # -*- coding: utf-8 -*- """ Created on Thu Mar 15 20:25:05 2018 @author: theresa """ import TypeHelper as th <|fim_suffix|> def toStr(self): return str(self.ZipCode) + " | " + str(self.ZCTA)<|fim_middle|>class zipToZ...
code_fim
hard
{ "lang": "python", "repo": "TT0101/nyc-zcta-data-helpers", "path": "/ZipToZCTA/ziptozcta.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AmberZLH/gated_pban path: /train.py import os import torch import torch.nn as nn import argparse from sklearn import metrics from torch.utils.data import DataLoader from models import LSTM, AE_LSTM, ATAE_LSTM, PBAN from data_utils import SentenceDataset, build_tokenizer, build_embedding_matrix c...
code_fim
hard
{ "lang": "python", "repo": "AmberZLH/gated_pban", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> n_test_correct += (torch.argmax(t_outputs, -1) == t_targets).sum().item() n_test_total += len(t_outputs) t_targets_all = torch.cat((t_targets_all, t_targets), dim=0) if t_targets_all is not None else t_targets t_outputs_all =...
code_fim
hard
{ "lang": "python", "repo": "AmberZLH/gated_pban", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Process a JSON-LD file in the new format to extract Statements. Parameters ---------- fname : str The path to the JSON-LD file to be processed. Returns ------- indra.sources.hume.HumeProcessor A HumeProcessor instance, which contains a list of INDRA Stateme...
code_fim
medium
{ "lang": "python", "repo": "kolusask/indra", "path": "/indra/sources/hume/api.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- indra.sources.hume.HumeProcessor A HumeProcessor instance, which contains a list of INDRA Statements as its statements attribute. """ hp = processor.HumeJsonLdProcessor(jsonld) hp.extract_relations() hp.extract_events() return hp<|fim_prefix|...
code_fim
hard
{ "lang": "python", "repo": "kolusask/indra", "path": "/indra/sources/hume/api.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kolusask/indra path: /indra/sources/hume/api.py __all__ = ['process_jsonld_file', 'process_jsonld'] import json import logging from indra.sources.hume import processor <|fim_suffix|> """Process a JSON-LD file in the new format to extract Statements. Parameters ---------- fname :...
code_fim
medium
{ "lang": "python", "repo": "kolusask/indra", "path": "/indra/sources/hume/api.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ngcaden/ESP8266-DHT11-Weather-Station path: /main.py import dht import machine d = dht.DHT11(machine.Pin(2)) html = """<!DOCTYPE html> <html> <head> <title>ESP8266 Pins</title> </head> <body> <h1>The current temperature is: <small>%s</small></h1> <h1>The current humidity...
code_fim
medium
{ "lang": "python", "repo": "ngcaden/ESP8266-DHT11-Weather-Station", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s = socket.socket() s.bind(addr) s.listen(1) print('listening on', addr) while True: cl, addr = s.accept() print('client connected from', addr) cl_file = cl.makefile('rwb', 0) d.measure() temperature = d.temperature() humidity = d.humid...
code_fim
medium
{ "lang": "python", "repo": "ngcaden/ESP8266-DHT11-Weather-Station", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1] s = socket.socket() s.bind(addr) s.listen(1) print('listening on', addr) while True: cl, addr = s.accept() print('client connected from', addr) cl_file = cl.makefile('rwb', 0) d.measure(...
code_fim
medium
{ "lang": "python", "repo": "ngcaden/ESP8266-DHT11-Weather-Station", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: littlealexchen/Deep-Learning-with-TensorFlow-master path: /Chapter05/Python 2.7/autoencoder_1.py import tensorflow as tf import numpy as np import matplotlib.pyplot as plt # Import MINST data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_dat...
code_fim
hard
{ "lang": "python", "repo": "littlealexchen/Deep-Learning-with-TensorFlow-master", "path": "/Chapter05/Python 2.7/autoencoder_1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Initializing the variables init = tf.global_variables_initializer() # Launch the graph with tf.Session() as sess: sess.run(init) total_batch = int(mnist.train.num_examples/batch_size) # Training cycle for epoch in range(training_epochs): # Loop over all batches for i in ...
code_fim
hard
{ "lang": "python", "repo": "littlealexchen/Deep-Learning-with-TensorFlow-master", "path": "/Chapter05/Python 2.7/autoencoder_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Optimization Finished!") # Applying encode and decode over test set encode_decode = sess.run( y_pred, feed_dict=\ {X: mnist.test.images[:examples_to_show]}) # Compare original images with their reconstructions f, a = plt.subplots(2, 4, figsize=(10, 5)) for i...
code_fim
hard
{ "lang": "python", "repo": "littlealexchen/Deep-Learning-with-TensorFlow-master", "path": "/Chapter05/Python 2.7/autoencoder_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertIsNone(result.errors) self.assertEqual(1, len(result.data["filterUpdateDogs"]["updatedObjects"])) dog_result = result.data["filterUpdateDogs"]["updatedObjects"][0] self.assertEqual("New tag", dog_result["tag"]) dog.refresh_from_db() self.assertE...
code_fim
hard
{ "lang": "python", "repo": "tOgg1/graphene-django-cud", "path": "/graphene_django_cud/tests/test_filter_update_mutation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tOgg1/graphene-django-cud path: /graphene_django_cud/tests/test_filter_update_mutation.py import graphene from addict import Dict from django.test import TestCase from graphene import Schema from graphene_django_cud.mutations.filter_update import DjangoFilterUpdateMutation from graphene_django_c...
code_fim
hard
{ "lang": "python", "repo": "tOgg1/graphene-django-cud", "path": "/graphene_django_cud/tests/test_filter_update_mutation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class FilterUpdateDogMutation(DjangoFilterUpdateMutation): class Meta: model = Dog filter_fields = ("name", "name__startswith") class Mutations(graphene.ObjectType): filter_update_dogs = FilterUpdateDogMutation.Field() dog =...
code_fim
hard
{ "lang": "python", "repo": "tOgg1/graphene-django-cud", "path": "/graphene_django_cud/tests/test_filter_update_mutation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gangaiitk/pycroscopy path: /pycroscopy/io/translators/translator.py # -*- coding: utf-8 -*- """ Created on Tue Nov 3 15:07:16 2015 @author: Suhas Somnath """ from __future__ import division, print_function, absolute_import, unicode_literals import abc from os import path, remove from ..io_uti...
code_fim
hard
{ "lang": "python", "repo": "gangaiitk/pycroscopy", "path": "/pycroscopy/io/translators/translator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Writes the provided datasets and parameters to an h5 file Parameters ---------- h5_path : String / Unicode Absolute path of the h5 file to be written data_name : String / Unicode Name of the data type translator_n...
code_fim
hard
{ "lang": "python", "repo": "gangaiitk/pycroscopy", "path": "/pycroscopy/io/translators/translator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ucd-plse/mpi-error-prop path: /src/wpds/AddOns/Domains/ThirdParty/SConscript ## ######################################## ## $Id: SConscript 1849 2012-04-24 19:24:13Z driscoll $ <|fim_suffix|>BuddyEnv = BaseEnv.Clone(CPPPATH=['src']) BaseEnv.Append(CFLAGS=' -O2') BuddyEnv['WARNING_FLAGS'] = Bud...
code_fim
medium
{ "lang": "python", "repo": "ucd-plse/mpi-error-prop", "path": "/src/wpds/AddOns/Domains/ThirdParty/SConscript", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>SRCS = Glob('buddy-2.4/src/*.c') + ['buddy-2.4/src/cppext.cxx'] liba = BuddyEnv.StaticLibrary('bdd' , SRCS) iliba = BuddyEnv.Install(LibInstallDir, liba) hfiles = BuddyEnv.Install('include/buddy',Glob('buddy-2.4/src/*.h')) built = [iliba,hfiles] Return('built')<|fim_prefix|># repo: ucd-plse/mpi-error-...
code_fim
hard
{ "lang": "python", "repo": "ucd-plse/mpi-error-prop", "path": "/src/wpds/AddOns/Domains/ThirdParty/SConscript", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 8xy4 - Set Vx = Vx + Vy, set VF = carry. The values of Vx and Vy are added together. If the result is greater than 8 bits (i.e., > 255,) VF is set to 1, otherwise 0. Only the lowest 8 bits of the result are kept, and stored in Vx. """ ...
code_fim
hard
{ "lang": "python", "repo": "MeArio/Chipy38", "path": "/cpu.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MeArio/Chipy38 path: /cpu.py and if they are equal, increments the program counter by 2. """ registers = self.return_middle_registers(self.opcode) if self.registers[registers[0]] == self.registers[registers[1]]: self.pc += 2 logger.inf...
code_fim
hard
{ "lang": "python", "repo": "MeArio/Chipy38", "path": "/cpu.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 8xy7 - Set Vx = Vy - Vx, set VF = NOT borrow. If Vy > Vx, then VF is set to 1, otherwise 0. Then Vx is subtracted from Vy, and the results stored in Vx. """ register = self.return_middle_registers(self.opcode) if self.registers[regist...
code_fim
hard
{ "lang": "python", "repo": "MeArio/Chipy38", "path": "/cpu.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>) dist.SetAlgorithmToSaitoCached() viewer = vtk.vtkImageViewer() viewer.SetInputConnection(dist.GetOutputPort()) viewer.SetColorWindow(117) viewer.SetColorLevel(43) viewer.Render() #skipping source # --- end of script --<|fim_prefix|># repo: t3dbrida/VTK path: /Imaging/Core/Testing/Python/TestEuclideanDi...
code_fim
hard
{ "lang": "python", "repo": "t3dbrida/VTK", "path": "/Imaging/Core/Testing/Python/TestEuclideanDistanceCached.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: t3dbrida/VTK path: /Imaging/Core/Testing/Python/TestEuclideanDistanceCached.py #!/usr/bin/env python import vtk from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # This script shows how to use vtkImageEuclideanDistance # Image pipeline reader = vtk.vtkPNGReader() reader.S...
code_fim
hard
{ "lang": "python", "repo": "t3dbrida/VTK", "path": "/Imaging/Core/Testing/Python/TestEuclideanDistanceCached.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> `init_client` will automatically initialize the client for the region, and is useful when service requests will be made in multiple threads and it is desirable to reuse the same client between threads. """ self.region_name = region_name.lower() self.profile...
code_fim
hard
{ "lang": "python", "repo": "rnag/aws-teams-logger", "path": "/aws_teams_logger/utils/aws/client_cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: if self.THREAD_SAFE or self.profile_name: client_func = Session(profile_name=self.profile_name).client else: client_func = client return client_func(self.SERVICE_NAME, self.region_name) except UnknownServiceError: ...
code_fim
hard
{ "lang": "python", "repo": "rnag/aws-teams-logger", "path": "/aws_teams_logger/utils/aws/client_cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rnag/aws-teams-logger path: /aws_teams_logger/utils/aws/client_cache.py from collections import defaultdict from boto3 import Session, client from botocore.client import BaseClient from botocore.exceptions import UnknownServiceError class ClientCache: # boto3 service name SERVICE_NAME...
code_fim
hard
{ "lang": "python", "repo": "rnag/aws-teams-logger", "path": "/aws_teams_logger/utils/aws/client_cache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }