text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: soamvasani/emoji-pod-visualizer path: /fission-functions/podwatcher.py from flask import request from flask import current_app import json import requests def main(): eventType = request.headers["X-Kubernetes-Event-Type"] objType = request.headers["X-Kubernetes-Object-Type"] if objT...
code_fim
medium
{ "lang": "python", "repo": "soamvasani/emoji-pod-visualizer", "path": "/fission-functions/podwatcher.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> return "" def summarizeContainerStates(pod): containerStatuses = pod["status"]["containerStatuses"] states = {} for cs in containerStatuses: name = cs["name"] state = cs["state"] if "running" in state: states[name] = "running" elif "termina...
code_fim
hard
{ "lang": "python", "repo": "soamvasani/emoji-pod-visualizer", "path": "/fission-functions/podwatcher.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: jwlademann/llc-api path: /application/register_utils.py import flask import requests from application import app, charge_validators, register_validators import jsonschema import ramlfications REGISTER_INFO = { "local-land-charge": { "raml": ramlfications.parse(app.static_folder + '...
code_fim
hard
{ "lang": "python", "repo": "jwlademann/llc-api", "path": "/application/register_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def retrieve_curie(curie): """Lookup the given curie and return record if found/valid, else return None """ if curie in CURIE_CACHE: return CURIE_CACHE[curie] register, primary_id = curie.split(':') if register not in REGISTER_INFO: raise Exception("Invalid register na...
code_fim
hard
{ "lang": "python", "repo": "jwlademann/llc-api", "path": "/application/register_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _test_fit_score("LL1_TXT_CLS_apple_products_sentiment_MIN_METADATA")<|fim_prefix|># repo: kungfuai/d3m-primitives path: /tests/test_sent2vec.py from kf_d3m_primitives.natural_language_processing.sent2vec.sent2vec_pipeline import ( Sent2VecPipeline, ) def _test_fit_score(dataset): <|fim_middle|...
code_fim
medium
{ "lang": "python", "repo": "kungfuai/d3m-primitives", "path": "/tests/test_sent2vec.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kungfuai/d3m-primitives path: /tests/test_sent2vec.py from kf_d3m_primitives.natural_language_processing.sent2vec.sent2vec_pipeline import ( Sent2VecPipeline, ) <|fim_suffix|>def test_fit_score_dataset_apple_products(): _test_fit_score("LL1_TXT_CLS_apple_products_sentiment_MIN_METADATA"...
code_fim
medium
{ "lang": "python", "repo": "kungfuai/d3m-primitives", "path": "/tests/test_sent2vec.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>while (''.join(curr_guess) != chosen_word): guess = input(f'You have {curr_lives} lives. Enter a random letter: ').lower() for number in range(0, len(chosen_word)): if chosen_word[number] == guess: curr_guess[number] = guess print(assets.stages[curr_lives]) if not guess in chosen_wor...
code_fim
medium
{ "lang": "python", "repo": "eddie246/python-playground", "path": "/Week 1/day 7 - Hangman/index.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eddie246/python-playground path: /Week 1/day 7 - Hangman/index.py import random import assets import wordbank print(f'{assets.logo}\nWelcome to Handman!') chosen_word = random.choice(wordbank.word_list) curr_guess = [] curr_lives = 6 <|fim_suffix|> print(' '.join(curr_guess)) if not '_' in...
code_fim
hard
{ "lang": "python", "repo": "eddie246/python-playground", "path": "/Week 1/day 7 - Hangman/index.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(' '.join(curr_guess)) if not '_' in curr_guess: print(f'You won! the word was: {chosen_word}')<|fim_prefix|># repo: eddie246/python-playground path: /Week 1/day 7 - Hangman/index.py import random import assets import wordbank print(f'{assets.logo}\nWelcome to Handman!') chosen_word = random....
code_fim
hard
{ "lang": "python", "repo": "eddie246/python-playground", "path": "/Week 1/day 7 - Hangman/index.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>admin.site.register(Referral, ReferralAdmin)<|fim_prefix|># repo: chhantyal/referly path: /referly/referrals/admin.py # -*- coding: utf-8 -*- from django.contrib import admin from .models import Referral class ReferralAdmin(admin.ModelAdmin): <|fim_middle|> list_display = ('title', 'date_created', ...
code_fim
medium
{ "lang": "python", "repo": "chhantyal/referly", "path": "/referly/referrals/admin.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chhantyal/referly path: /referly/referrals/admin.py # -*- coding: utf-8 -*- from django.contrib import admin from .models import Referral <|fim_suffix|> list_display = ('title', 'date_created', 'user',) list_filter = ('date_created',) search_fields = ('title',) admin.site.register(R...
code_fim
easy
{ "lang": "python", "repo": "chhantyal/referly", "path": "/referly/referrals/admin.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ('title', 'date_created', 'user',) list_filter = ('date_created',) search_fields = ('title',) admin.site.register(Referral, ReferralAdmin)<|fim_prefix|># repo: chhantyal/referly path: /referly/referrals/admin.py # -*- coding: utf-8 -*- from django.contrib import admin <|fim_m...
code_fim
medium
{ "lang": "python", "repo": "chhantyal/referly", "path": "/referly/referrals/admin.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> image_urls = response.css( 'article.article-content img::attr(data-original)').getall() # yield items.MyImageItem(image_urls=map(lambda x: response.urljoin(x), image_urls)) for i in map(lambda x: response.urljoin(x), image_urls): yield {'url': i}<|fim_prefix...
code_fim
medium
{ "lang": "python", "repo": "techstay/python-study", "path": "/enjoybeautiful/enjoybeautiful/spiders/smtmm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: techstay/python-study path: /enjoybeautiful/enjoybeautiful/spiders/smtmm.py import scrapy from .. import items class SmtmmSpider(scrapy.Spider): <|fim_suffix|> def parse(self, response): image_urls = response.css( 'article.article-content img::attr(data-original)').getall...
code_fim
medium
{ "lang": "python", "repo": "techstay/python-study", "path": "/enjoybeautiful/enjoybeautiful/spiders/smtmm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # --- sqlogger ------------------------------------ SQLOGGER_DIR = DATA_DIR / 'logs' SQLOGGER_USER_KEY = 'user' # --- sendgrid ----------------------------------- SENDGRID_SENDER = '' SENDGRID_API_KEY = '< - secret - >' # --- onedrive ---------------------------------- ON...
code_fim
hard
{ "lang": "python", "repo": "k3-cat/olea", "path": "/olea/configs/production.example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: k3-cat/olea path: /olea/configs/production.example.py from datetime import timedelta from olea_path import DATA_DIR from .url_mgr import UrlMgr class Config(): # --- flask ------------------------------------- DEBUG = False MAX_CONTENT_LENGTH = 10 * 1024 <|fim_suffix|> # --- r...
code_fim
hard
{ "lang": "python", "repo": "k3-cat/olea", "path": "/olea/configs/production.example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # --- sentry ------------------------------------ SENTRY_DSN = '< - secret - >' # --- sqlogger ------------------------------------ SQLOGGER_DIR = DATA_DIR / 'logs' SQLOGGER_USER_KEY = 'user' # --- sendgrid ----------------------------------- SENDGRID_SENDER = '' SENDGRID...
code_fim
hard
{ "lang": "python", "repo": "k3-cat/olea", "path": "/olea/configs/production.example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ''' if (sessionid != "zzzz" and sessionid != False or self.is_admin()): return True else: return False def is_admin(self): ''' Checks if the client is admin. :rtype: boolean ''' if (self.role == ...
code_fim
hard
{ "lang": "python", "repo": "danilovbarbosa/sg-gameevents", "path": "/gameevents/gameevents_app/models/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ''' Generates an authentication token, which contains client data and the sessionid. A token with no associated sessionid is only allowed to admins. :param sessionid: Optional sessionid to be included in the token :param expiration: Optional custom expirati...
code_fim
hard
{ "lang": "python", "repo": "danilovbarbosa/sg-gameevents", "path": "/gameevents/gameevents_app/models/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: danilovbarbosa/sg-gameevents path: /gameevents/gameevents_app/models/client.py '''''' from uuid import UUID import OpenSSL from passlib.apps import custom_app_context as pwd_context from itsdangerous import (TimedJSONWebSignatureSerializer as Serializer, BadSignature, SignatureExpired) from flas...
code_fim
hard
{ "lang": "python", "repo": "danilovbarbosa/sg-gameevents", "path": "/gameevents/gameevents_app/models/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # find position of current group pos_omission = sum(len(g) for k, (_, g) in enumerate(groups) if k < i) # swap first element from omissions with center of group of sounds middle[pos_sound], middle[pos_omission] = ( middle[pos_omission], ...
code_fim
hard
{ "lang": "python", "repo": "mscheltienne/cardio-audio-sleep", "path": "/cardio_audio_sleep/utils/sequence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mscheltienne/cardio-audio-sleep path: /cardio_audio_sleep/utils/sequence.py import math import random from itertools import groupby from typing import Union import numpy as np from numpy.typing import NDArray from ._checks import _check_type, _check_value from ._logs import logger def generat...
code_fim
hard
{ "lang": "python", "repo": "mscheltienne/cardio-audio-sleep", "path": "/cardio_audio_sleep/utils/sequence.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if position_in_triangle(i, j): self.internal_representation[i][j] = 1 else: msg = 'Requested peg placement for location not in triangle' raise Exception(msg) def clone(self): return deepcopy(self) def get_num_pegs(self): return ...
code_fim
hard
{ "lang": "python", "repo": "deloachcd/pycrackerbarrel", "path": "/CrackerBarrelTriangle.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: deloachcd/pycrackerbarrel path: /CrackerBarrelTriangle.py import numpy as np from copy import deepcopy import textwrap # Simple function for determining if location is within triangle def position_in_triangle(i, j): return (j <= i and i < 5 and j < 5 and i >= 0 and j >= 0) # Peg positions...
code_fim
hard
{ "lang": "python", "repo": "deloachcd/pycrackerbarrel", "path": "/CrackerBarrelTriangle.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> def place_peg(self, i, j): if position_in_triangle(i, j): self.internal_representation[i][j] = 1 else: msg = 'Requested peg placement for location not in triangle' raise Exception(msg) def clone(self): return deepcopy(self) def get_...
code_fim
hard
{ "lang": "python", "repo": "deloachcd/pycrackerbarrel", "path": "/CrackerBarrelTriangle.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: pegasus-isi/SPLINTER-Workflow path: /dax-generator.py #!/usr/bin/python from Pegasus.DAX3 import * import socket import sys import os from stat import * ############################## ## Settings # Maximum tasks in a sub workflow max_tasks_per_sub_wf = 25000 ############################## b...
code_fim
hard
{ "lang": "python", "repo": "pegasus-isi/SPLINTER-Workflow", "path": "/dax-generator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Add executables to the DAX-level replica catalog subdax_generator = Executable(name="subdax-generator.py", arch="x86_64", installed=False) subdax_generator.addPFN(PFN("file://" + base_dir + "/subdax-generator.py", "local")) dax.addExecutable(subdax_generator) postsubdax_sh = Executable(name="postsubdax...
code_fim
hard
{ "lang": "python", "repo": "pegasus-isi/SPLINTER-Workflow", "path": "/dax-generator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xuechendi/HDCS path: /hdcs_manager/source/hsm-dashboard/hsm_dashboard/exceptions.py from hsmclient import exceptions as hsmclient from keystoneclient import exceptions as keystoneclient <|fim_suffix|>NOT_FOUND = (keystoneclient.NotFound, hsmclient.NotFound) # NOTE(gabriel): This i...
code_fim
hard
{ "lang": "python", "repo": "xuechendi/HDCS", "path": "/hdcs_manager/source/hsm-dashboard/hsm_dashboard/exceptions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>NOT_FOUND = (keystoneclient.NotFound, hsmclient.NotFound) # NOTE(gabriel): This is very broad, and may need to be dialed in. RECOVERABLE = (keystoneclient.ClientException, # AuthorizationFailure is raised when Keystone is "unavailable". keystoneclient.Authorizat...
code_fim
hard
{ "lang": "python", "repo": "xuechendi/HDCS", "path": "/hdcs_manager/source/hsm-dashboard/hsm_dashboard/exceptions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> **kwargs): """ :param target_indic_fname: binary indicators field name marking data units. :param new_original_indxs_fname: if provided, will create a new field with original indxs of data-units. ...
code_fim
hard
{ "lang": "python", "repo": "developerdrone/FewSum", "path": "/mltoolkit/mldp/steps/transformers/general/target_unit_selector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: developerdrone/FewSum path: /mltoolkit/mldp/steps/transformers/general/target_unit_selector.py from mltoolkit.mldp.steps.transformers import BaseTransformer from mltoolkit.mldp.utils.constants.dp import EMPTY_CHUNK import numpy as np class TargetUnitSelector(BaseTransformer): <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "developerdrone/FewSum", "path": "/mltoolkit/mldp/steps/transformers/general/target_unit_selector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if data_chunk[self.target_indic_fname].dtype not in [np.int32, np.int64]: raise ValueError("Target indxs field should contain int 0 and 1 " "values only.") if self.new_original_indxs_fname: data_chunk[self.new_original_indxs_fname] = np....
code_fim
hard
{ "lang": "python", "repo": "developerdrone/FewSum", "path": "/mltoolkit/mldp/steps/transformers/general/target_unit_selector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: madcowfred/evething path: /thing/views/pi.py # ------------------------------------------------------------------------------ # Copyright (c) 2010-2013, EVEthing team # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provid...
code_fim
hard
{ "lang": "python", "repo": "madcowfred/evething", "path": "/thing/views/pi.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """PI""" tt = TimerThing('pi') characters = Character.objects.filter( apikeys__user=request.user, apikeys__valid=True, apikeys__key_type__in=[APIKey.ACCOUNT_TYPE, APIKey.CHARACTER_TYPE] ).distinct().select_related('colony_set') pi_map = {} for character in...
code_fim
hard
{ "lang": "python", "repo": "madcowfred/evething", "path": "/thing/views/pi.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: predora005/weather-forecasting path: /07.gsm_random_forest/wfile/read_csv.py # coding: utf-8 import os import pandas as pd import re import datetime from . import name_handle ################################################## # CSVファイルから地上の気象データを読み込み、 # DataFrameを返す ############################...
code_fim
hard
{ "lang": "python", "repo": "predora005/weather-forecasting", "path": "/07.gsm_random_forest/wfile/read_csv.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: file_path (string) : ファイルパス Returns: DataFrame : ファイルの読込結果 """ # CSVファイル読み込み df = pd.read_csv(file_path, sep=',', skiprows=0, header=[0], index_col=0) # ファイル名から地点名、日付を抽出 file_name = os.path.basename(file_path) elements = name_handle.eleme...
code_fim
hard
{ "lang": "python", "repo": "predora005/weather-forecasting", "path": "/07.gsm_random_forest/wfile/read_csv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': sc = testSerial() while(True): # Receive line from the USBISS line_received = sc.test_readline() time.sleep(1) # Send the line back to the USBISS sc.test_sendLine(line_received)<|fim_prefix|># repo: gwdehaan/pyusbiss path: /test...
code_fim
hard
{ "lang": "python", "repo": "gwdehaan/pyusbiss", "path": "/tests/SerialClient.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gwdehaan/pyusbiss path: /tests/SerialClient.py # GdH SerialClient 29-3-2019 # Testprogram for the USBISS Serialdriver # Used in conjunction with the unittest : test_serial_otherclient. # Prerequisite is the availability of another COM port on the test machine. A standard FTDI based device can be ...
code_fim
hard
{ "lang": "python", "repo": "gwdehaan/pyusbiss", "path": "/tests/SerialClient.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ebonilla/GGP path: /ggp/utils.py # Author: Yin Cheng Ng # Some data pipeline and pre-processing functions are derived from https://github.com/tkipf/gcn import sys, os, zipfile import scipy.sparse as sp, numpy as np, pickle as pkl, networkx as nx, tensorflow as tf from sklearn.feature_extraction....
code_fim
hard
{ "lang": "python", "repo": "ebonilla/GGP", "path": "/ggp/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> df_y = pd.DataFrame({"a": y_all, "b": 1 - y_all}) y_all = df_y.values X_all = np.eye(g_nx.number_of_nodes()) print("y_all shape {}".format(y_all.shape)) print("X_all shape {}".format(X_all.shape)) # Extract the adjacency matrix. # A should be scipy sparse matrix print("E...
code_fim
hard
{ "lang": "python", "repo": "ebonilla/GGP", "path": "/ggp/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> files = glob.glob('*.txt') for filename in files: convert_youtube_subtitle_to_srt(filename) if __name__ == '__main__': main()<|fim_prefix|># repo: vitorfs/yt2srt path: /yt2srt.py import glob def convert_youtube_subtitle_to_srt(youtube_subtitles_filename): base_filename = youtu...
code_fim
hard
{ "lang": "python", "repo": "vitorfs/yt2srt", "path": "/yt2srt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vitorfs/yt2srt path: /yt2srt.py import glob def convert_youtube_subtitle_to_srt(youtube_subtitles_filename): base_filename = youtube_subtitles_filename.split('.')[0] srt_out_filename = '%s.srt' % base_filename subtitles = list() with open(youtube_subtitles_filename, 'r') as infi...
code_fim
hard
{ "lang": "python", "repo": "vitorfs/yt2srt", "path": "/yt2srt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize('val1, val2, val3', TEST_PUSH_MULT) def test_dque_peek(val1, val2, val3, new_dque): """Append 3 values and confirm that peek sees the end of the dque.""" assert new_dque.peek() is None new_dque.append(val1) new_dque.append(val2) new_dque.append(val3) assert...
code_fim
hard
{ "lang": "python", "repo": "Woojgh/data-structure", "path": "/src/tests/test_dque.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Append 3 values, check that pop gets the val at the end of the dque.""" new_dque.append(val1) new_dque.append(val2) new_dque.append(val3) assert new_dque.pop() == val3 assert new_dque.pop() == val2 assert new_dque.pop() == val1 @pytest.mark.parametrize('val1, val2, val3', ...
code_fim
hard
{ "lang": "python", "repo": "Woojgh/data-structure", "path": "/src/tests/test_dque.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Woojgh/data-structure path: /src/tests/test_dque.py """Test the dqueue.py module.""" import pytest TEST_PUSH = [ (1, 1), (800, 800), ('String', 'String'), ([5, 3, 17], [5, 3, 17]) ] TEST_PUSH_MULT = [ (1, 2, 3), (800, 'String', 5), ('String', ['list'], 17), ([...
code_fim
hard
{ "lang": "python", "repo": "Woojgh/data-structure", "path": "/src/tests/test_dque.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif name == 'sin': cos = sqrt(1 - value ** 2) tan = abs(value / cos) print("sin={},cos={}{},tan={}{}".format(value, sign[quad+4],cos, sign[quad+8],tan)) elif name == 'cos': ...
code_fim
hard
{ "lang": "python", "repo": "avanish981/python", "path": "/math/calcu_trig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: avanish981/python path: /math/calcu_trig.py from math import sqrt sign = ["", "","",'-','-', #sin "",'-',"-",'', #cos "",'-','',"-"] #tan def trig_func(name,value,quad=1): if name == 'tan': cos = sqrt(1 / (value ** 2 + 1)) sin = abs(value * cos) ...
code_fim
hard
{ "lang": "python", "repo": "avanish981/python", "path": "/math/calcu_trig.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif name == 'cos': sin = sqrt(1 - value ** 2) tan = abs(sin / value) print("sin={}{},cos={},tan={}{}".format(sign[quad],sin, value, sign[quad+8],tan)) else: print('not ...
code_fim
hard
{ "lang": "python", "repo": "avanish981/python", "path": "/math/calcu_trig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.scanvi import SCANVI from .gimvi import GIMVI __all__ = ["SCVI", "TOTALVI", "LinearSCVI", "AUTOZI", "SCANVI", "GIMVI"]<|fim_prefix|># repo: TheAustinator/scvi-tools path: /scvi/model/__init__.py from .scvi import SCVI from .totalvi import TOTALVI from .li<|fim_middle|>near_scvi import LinearSCVI from ....
code_fim
medium
{ "lang": "python", "repo": "TheAustinator/scvi-tools", "path": "/scvi/model/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheAustinator/scvi-tools path: /scvi/model/__init__.py from .scvi import SCVI from .totalvi import TOTALVI from .li<|fim_suffix|>.scanvi import SCANVI from .gimvi import GIMVI __all__ = ["SCVI", "TOTALVI", "LinearSCVI", "AUTOZI", "SCANVI", "GIMVI"]<|fim_middle|>near_scvi import LinearSCVI from ....
code_fim
medium
{ "lang": "python", "repo": "TheAustinator/scvi-tools", "path": "/scvi/model/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> _SPLAT.__init__(self) self.name = "SPLATS" self.specie = 'nouns' self.basic = "splat" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_splats.py from xai.brain.wordbase.nouns._splat import _SPLAT #calss header class _SPLATS(_SPLAT, ): <|fim_middle|> def _...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_splats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_splats.py from xai.brain.wordbase.nouns._splat import _SPLAT <|fim_suffix|> _SPLAT.__init__(self) self.name = "SPLATS" self.specie = 'nouns' self.basic = "splat" self.jsondata = {}<|fim_middle|>#calss header class _SPLATS(_SPLAT, ): def _...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_splats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return '' @register.assignment_tag(takes_context=True) def get_current_app(context): request = context['request'] resolved = resolve(request.path_info) app_name = resolved.app_name app = importlib.import_module(app_name) return app @register.assignment_tag(takes_context=T...
code_fim
hard
{ "lang": "python", "repo": "skada/splunk-appframework", "path": "/server/appfx/templatetags/tags.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def filter_visible_and_enabled(app): visible = app['visible'] == '1' enabled = app['disabled'] != '1' return visible and enabled def get_name_and_url(app): app_name = app['label'] app_url = "/en-US/app/%s" % app.name return { ...
code_fim
hard
{ "lang": "python", "repo": "skada/splunk-appframework", "path": "/server/appfx/templatetags/tags.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: skada/splunk-appframework path: /server/appfx/templatetags/tags.py from django import template from django.conf import settings from django.utils import importlib from django.core.urlresolvers import reverse, resolve from django.template import RequestContext from splunklib import binding regis...
code_fim
hard
{ "lang": "python", "repo": "skada/splunk-appframework", "path": "/server/appfx/templatetags/tags.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(): def sample_function(s=None): if s is None: s = np.random.uniform(-1, 1) def f(x): # return torch.sign(x)*0.2 return np.exp(-np.sum((x + s) ** 2, axis=1) / 2) # return torch.exp(-torch.sum((x + s) ** 2, dim=1) / 2).view(-1, 1)...
code_fim
hard
{ "lang": "python", "repo": "matteo-ronchetti/IKA", "path": "/paper results/neural_integration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matteo-ronchetti/IKA path: /paper results/neural_integration.py import argparse import dlib import numpy as np import scipy.optimize from scipy.spatial import distance_matrix from ika import distance_matrix as torch_distance_matrix from ika import IKA from scipy.sparse.linalg import cg import t...
code_fim
hard
{ "lang": "python", "repo": "matteo-ronchetti/IKA", "path": "/paper results/neural_integration.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__( self, fh: TextIO, edge_types: Iterable[str] = DEFAULT_EDGE_TYPES ) -> None: super(NXGraphExporter, self).__init__(edge_types=edge_types) self.fh = fh def finalize_graph(self) -> None: """Convert from FtM graph model to NetworkX directed graph.""" ...
code_fim
hard
{ "lang": "python", "repo": "alephdata/followthemoney", "path": "/followthemoney/export/graph.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class NXGraphExporter(GraphExporter): """Write to NetworkX data structure, which in turn can be exported to the file formats for Gephi (GEXF) and D3.""" def __init__( self, fh: TextIO, edge_types: Iterable[str] = DEFAULT_EDGE_TYPES ) -> None: super(NXGraphExporter, self)....
code_fim
hard
{ "lang": "python", "repo": "alephdata/followthemoney", "path": "/followthemoney/export/graph.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alephdata/followthemoney path: /followthemoney/export/graph.py from typing import Dict, Iterable, List, Optional, TextIO, Union import networkx as nx # type: ignore from networkx.readwrite.gexf import generate_gexf # type: ignore from followthemoney.graph import Edge, Graph, Node from followth...
code_fim
hard
{ "lang": "python", "repo": "alephdata/followthemoney", "path": "/followthemoney/export/graph.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mahoyen/web path: /make_queue/views/reservation/reservation.py from abc import ABCMeta from math import ceil from django.db.models import Q from django.shortcuts import render, redirect from django.urls import reverse, reverse_lazy from django.utils import timezone from django.views.generic impo...
code_fim
hard
{ "lang": "python", "repo": "mahoyen/web", "path": "/make_queue/views/reservation/reservation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return super().dispatch(request, *args, **kwargs) class ChangeReservationView(ReservationCreateOrChangeView): """View for changing a reservation (Cannot be UpdateView due to the abstract inheritance of reservations)""" new_reservation = False def dispatch(self, request, *args, **kwa...
code_fim
hard
{ "lang": "python", "repo": "mahoyen/web", "path": "/make_queue/views/reservation/reservation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>stock = pred.Stock('tesla') stock.create_dict(from_date, to_date) stock_dict = stock.get_dict() # print(stock_dict) sent = pred.Sent('tesla', 'stwits') sent.create_dict(precision, method, from_date, to_date, stock.get_stock_dates(), binning) sent_dict = sent.get_dict() # print(sent_dict) total = 0 matc...
code_fim
hard
{ "lang": "python", "repo": "bromjiri/Presto", "path": "/predictor/real_check.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bromjiri/Presto path: /predictor/real_check.py import pickle import pandas as pd import settings import predictor.predictor_sklearn as pred logreg_f = open("pickled/tesla_logreg.pickle", "rb") logreg = pickle.load(logreg_f) logreg_f.close() <|fim_suffix|>stock = pred.Stock('tesla') stock.crea...
code_fim
hard
{ "lang": "python", "repo": "bromjiri/Presto", "path": "/predictor/real_check.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>total = 0 match = 0 for key in sorted(stock_dict)[3:]: total += 1 features = sent.get_features(key) print(key, features, stock_dict[key]) if features['d3'] == stock_dict[key]: match +=1 print(total, match)<|fim_prefix|># repo: bromjiri/Presto path: /predictor/real_check.py import...
code_fim
hard
{ "lang": "python", "repo": "bromjiri/Presto", "path": "/predictor/real_check.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ter( id='Cliff-v0', entry_point='gym_gridworlds.envs:CliffEnv', )<|fim_prefix|># repo: shariq101/gym-gridworlds path: /gym_gridworlds/__init__.py from gym.envs.registration import register register( id='Gridworld-v0', entry_point='gym_gridworlds.envs:GridworldEnv'...
code_fim
medium
{ "lang": "python", "repo": "shariq101/gym-gridworlds", "path": "/gym_gridworlds/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shariq101/gym-gridworlds path: /gym_gridworlds/__init__.py from gym.envs.registration import register register( id='Gridworld-v0', entry_point='gym_gridworlds.envs:GridworldEnv', ) register( id='WindyGri<|fim_suffix|>ter( id='Cliff-v0', entry_point...
code_fim
medium
{ "lang": "python", "repo": "shariq101/gym-gridworlds", "path": "/gym_gridworlds/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> salida.append(dist_min) return tuple(salida) def match_min2(coords1,coords2,tail1=(),tail2=()): """ where coords1 and coords2 are tuples containing 1-D arrays, and tail1 and tail2 are tuples containing sequences of arbitrary types Usage: results=match_min((x1,y1),(x2,y...
code_fim
hard
{ "lang": "python", "repo": "joezuntz/DESC_BPZ", "path": "/desc_bpz/useful_py3.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: joezuntz/DESC_BPZ path: /desc_bpz/useful_py3.py it() if len(pieces)==0: continue key=pieces[0] #if type(key)<>type(''): # raise 'Keyword not string!' if len(pieces)<2: mensaje='No value(s) for parameter '+key raise mensaje ...
code_fim
hard
{ "lang": "python", "repo": "joezuntz/DESC_BPZ", "path": "/desc_bpz/useful_py3.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Usage: results=match_min((x1,y1),(x2,y2),(a1,b1,c1),(d2,e2)) It returns the sequence x1,y1,x2,y2,a1,b1,c1,d2,e2, dist_min where dist_min is the minimal value of dist(x1,y1-x2,y2) The match looks for the objects with minimal distance """ nc=len(coords1) np1=len(coords1[0])...
code_fim
hard
{ "lang": "python", "repo": "joezuntz/DESC_BPZ", "path": "/desc_bpz/useful_py3.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tarmasterellis/technical_task path: /app.py #*******************************************************************# # # # Author: Ellis Sanjay Tarmaster # # Date: 06/08/2018 # # # #*************************************************************...
code_fim
medium
{ "lang": "python", "repo": "Tarmasterellis/technical_task", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in results: return_result += [[i['rank'], i['title'], i['description'], i['link']]] return render_template('results.html', result=return_result) # Logout @app.route('/login', methods=['GET', 'POST']) def logout(): return render_template('login.html') # Main Function if __na...
code_fim
hard
{ "lang": "python", "repo": "Tarmasterellis/technical_task", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class NoopEmbedder(Embedder, Serializable): """ This embedder performs no lookups but only passes through the inputs. Normally, the input is a Sentence object, which is converted to an expression. Args: emb_dim: Size of the inputs """ yaml_tag = '!NoopEmbedder' @serializable_init d...
code_fim
hard
{ "lang": "python", "repo": "philip30/xnmt", "path": "/xnmt/modelparts/embedders.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: philip30/xnmt path: /xnmt/modelparts/embedders.py h case it will be a (possibly masked) :class:`xnmt.batcher.Batch` object Returns: An expression sequence representing vectors of each word in the input. """ # single mode if not batchers.is_batched(x): expr = expressio...
code_fim
hard
{ "lang": "python", "repo": "philip30/xnmt", "path": "/xnmt/modelparts/embedders.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class NoopEmbedder(Embedder, Serializable): """ This embedder performs no lookups but only passes through the inputs. Normally, the input is a Sentence object, which is converted to an expression. Args: emb_dim: Size of the inputs """ yaml_tag = '!NoopEmbedder' @serializable_init ...
code_fim
hard
{ "lang": "python", "repo": "philip30/xnmt", "path": "/xnmt/modelparts/embedders.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ A single Catchment :param contractedcatchment_id: :return: LDAPI views of a single Catchment """ try: if USE_CONTRACTED_CATCHMENTS: r = ContractedCatchmentRenderer(request, contractedcatchment_id, None) else: r = CatchmentRenderer(reques...
code_fim
hard
{ "lang": "python", "repo": "CSIRO-enviro-informatics/geofabric-dataset", "path": "/geofabric/controller/classes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CSIRO-enviro-informatics/geofabric-dataset path: /geofabric/controller/classes.py # -*- coding: utf-8 -*- """ This file contains all the HTTP routes for classes from the Geofabric model, such as Catchment and the Catchment Register """ from flask import Blueprint, request, abort from flask_cors i...
code_fim
hard
{ "lang": "python", "repo": "CSIRO-enviro-informatics/geofabric-dataset", "path": "/geofabric/controller/classes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Explanation: # The script would output 18 in the command line. Below is the explanation. # Since Python reads and executes scripts from top to bottom, variable a will be updated in every line until line 3 where a finally gets the value of 6 . Then the print function prints out 6 + 6 + 6 which is ...
code_fim
easy
{ "lang": "python", "repo": "jailukanna/Python-Projects-Dojo", "path": "/04.100 Python Exercises Evaluate and Improve Your Skills - AS/Exercise 01-25/exercise_01.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.fixture(scope="module", autouse=True) def cipher(): random_key = OPE.generate_key() c = instantiate_ope_cipher(random_key) return c def test_ope_encrypt(benchmark, cipher): benchmark.pedantic(cipher.encrypt, args=(randint(0, 100000),), iterations=100, rounds=100) def test_ope_...
code_fim
medium
{ "lang": "python", "repo": "ankurhcu/IoT-Cloud", "path": "/benchmark/test_ope.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> benchmark.pedantic(cipher.encrypt, args=(randint(0, 100000),), iterations=100, rounds=100) def test_ope_decrypt(benchmark, cipher): benchmark.pedantic(cipher.decrypt, args=(cipher.encrypt(randint(0, 100000)),), iterations=100, rounds=100)<|fim_prefix|># repo: ankurhcu/IoT-Cloud path: /benchmark...
code_fim
medium
{ "lang": "python", "repo": "ankurhcu/IoT-Cloud", "path": "/benchmark/test_ope.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ankurhcu/IoT-Cloud path: /benchmark/test_ope.py from random import randint import pytest from pyope.ope import OPE from client.crypto_utils import instantiate_ope_cipher @pytest.fixture(scope="module", autouse=True) def cipher(): <|fim_suffix|> def test_ope_encrypt(benchmark, cipher): ben...
code_fim
medium
{ "lang": "python", "repo": "ankurhcu/IoT-Cloud", "path": "/benchmark/test_ope.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: todun/grafit path: /backend/grafit/migrations/0013_add_unique_to_searchindex.py # Generated by Django 2.1.3 on 2018-11-22 14:17 <|fim_suffix|> dependencies = [ ('grafit', '0012_create_search_index'), ] operations = [ migrations.RunSQL( """ DROP...
code_fim
medium
{ "lang": "python", "repo": "todun/grafit", "path": "/backend/grafit/migrations/0013_add_unique_to_searchindex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> CREATE UNIQUE INDEX grafit_search_unique ON grafit_search_index (id); """ ), ]<|fim_prefix|># repo: todun/grafit path: /backend/grafit/migrations/0013_add_unique_to_searchindex.py # Generated by Django 2.1.3 on 2018-11-22 14:17 from django.db import migrat...
code_fim
hard
{ "lang": "python", "repo": "todun/grafit", "path": "/backend/grafit/migrations/0013_add_unique_to_searchindex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aldookware/IT-Support-Tracker path: /biz/api/views/issues.py import logging from django.shortcuts import Http404, get_object_or_404 from rest_framework import status from rest_framework.generics import ListAPIView, CreateAPIView, RetrieveAPIView, UpdateAPIView, RetrieveUpdateAPIView, \ ...
code_fim
hard
{ "lang": "python", "repo": "aldookware/IT-Support-Tracker", "path": "/biz/api/views/issues.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> issue = self.get_object() serializer = self.get_serializer(issue) return Response(serializer.data) def update(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data) if serializer.is_valid(): serializer.save() ...
code_fim
hard
{ "lang": "python", "repo": "aldookware/IT-Support-Tracker", "path": "/biz/api/views/issues.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def update(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data) if serializer.is_valid(): serializer.save() logger.debug(serializer.data) return Response(serializer.data) logger.debug(str(serializer.error...
code_fim
hard
{ "lang": "python", "repo": "aldookware/IT-Support-Tracker", "path": "/biz/api/views/issues.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Danielson23/mara-acl path: /mara_acl/views.py """ACL UI""" import json import flask import mara_db.postgresql import psycopg2.extensions from mara_acl import config, keys, permissions, users from mara_page import acl, navigation, response, bootstrap blueprint = flask.Blueprint('mara_acl', __na...
code_fim
hard
{ "lang": "python", "repo": "Danielson23/mara-acl", "path": "/mara_acl/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # exclude static folders of blueprints if any(flask.request.path.startswith(uri) for uri in [blueprint.url_prefix + blueprint.static_url_path for blueprint in flask.current_app.blueprints.values() if blueprint.static_url_path and blueprint.url_prefix]): ...
code_fim
hard
{ "lang": "python", "repo": "Danielson23/mara-acl", "path": "/mara_acl/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acgpiano/py-kms path: /py2-kms/dcerpc.py #!/usr/bin/env python # Copyright (c) 2003-2012 CORE Security Technologies # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # $Id: dcerpc.py...
code_fim
hard
{ "lang": "python", "repo": "acgpiano/py-kms", "path": "/py2-kms/dcerpc.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> self.__ctx_items.append(item) def getData(self): self['ctx_num'] = len(self.__ctx_items) for i in self.__ctx_items: self['ctx_items'] += i.getData() return Structure.getData(self) class MSRPCBindAck(Structure): _SIZE = 26 # Up to SecondaryAddr ...
code_fim
hard
{ "lang": "python", "repo": "acgpiano/py-kms", "path": "/py2-kms/dcerpc.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> if self['auth_data'] != '': self['auth_len'] = len(self['auth_data']) # The sec_trailer structure MUST be 4-byte aligned with respect to # the beginning of the PDU. Padding octets MUST be used to align the # sec_trailer structure if its natural beginning is no...
code_fim
hard
{ "lang": "python", "repo": "acgpiano/py-kms", "path": "/py2-kms/dcerpc.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>ADMIN_USER = 'admin' ADMIN_AGE = 30<|fim_prefix|># repo: jumper2014/http-api-test-framework-python-behave path: /libs/const.py #!/usr/bin/env python # coding=utf-8 # author: zengyuetian # const definition <|fim_middle|>api_server_host = '127.0.0.1' api_server_port = 8080 GET = 'GET' POST = 'POST' PUT = ...
code_fim
medium
{ "lang": "python", "repo": "jumper2014/http-api-test-framework-python-behave", "path": "/libs/const.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jumper2014/http-api-test-framework-python-behave path: /libs/const.py #!/usr/bin/env python # coding=utf-8 # author: zengyuetian # const definition <|fim_suffix|>ADMIN_USER = 'admin' ADMIN_AGE = 30<|fim_middle|>api_server_host = '127.0.0.1' api_server_port = 8080 GET = 'GET' POST = 'POST' PUT = ...
code_fim
medium
{ "lang": "python", "repo": "jumper2014/http-api-test-framework-python-behave", "path": "/libs/const.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: strogo/pyobjc path: /pyobjc-framework-Accessibility/PyObjCTest/test_axcustomcontent.py from PyObjCTools.TestSupport import TestCase import Accessibility import objc class TestAXCustomContent(TestCase): <|fim_suffix|> def test_protocols(self): objc.protocolNamed("AXCustomContentProvi...
code_fim
medium
{ "lang": "python", "repo": "strogo/pyobjc", "path": "/pyobjc-framework-Accessibility/PyObjCTest/test_axcustomcontent.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class TestAXCustomContent(TestCase): def test_constants(self): self.assertEqual(Accessibility.AXCustomContentImportanceDefault, 0) self.assertEqual(Accessibility.AXCustomContentImportanceHigh, 1) def test_protocols(self): objc.protocolNamed("AXCustomContentProvider")<|fim...
code_fim
easy
{ "lang": "python", "repo": "strogo/pyobjc", "path": "/pyobjc-framework-Accessibility/PyObjCTest/test_axcustomcontent.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pubsubClient = pubsub.Client( project="[projectName]" ) topicName = "raw-adsb-data" topicObj = pubsubClient.topic(topicName) with topicObj.batch() as batchObj: for eachItem in msgList: eachItem = eachItem.encode("utf-8") batchObj.publish(eachItem) return def loadList(fi...
code_fim
hard
{ "lang": "python", "repo": "sunsetmountain/raspberry_ADS-B", "path": "/batchPub.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunsetmountain/raspberry_ADS-B path: /batchPub.py import os import time from google.cloud import pubsub from oauth2client.service_account import ServiceAccountCredentials from tendo import singleton me = singleton.SingleInstance() # will sys.exit(-1) if another instance of this script is already...
code_fim
hard
{ "lang": "python", "repo": "sunsetmountain/raspberry_ADS-B", "path": "/batchPub.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.concepts = [] """ concepts of the sentence. """ self.untokenized_form = '' """ untokenized form of the sentence. """ self.length = 0 """ length of the untokenized sentence. """<|fim_prefix|># repo: WayneGame/NLP_Metric path: /SUPERT/summariser/ngram_...
code_fim
hard
{ "lang": "python", "repo": "WayneGame/NLP_Metric", "path": "/SUPERT/summariser/ngram_vector/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WayneGame/NLP_Metric path: /SUPERT/summariser/ngram_vector/base.py class Sentence: """The sentence data structure. Args: tokens (list of str): the list of word tokens. doc_id (str): the identifier of the document from which the sentence comes from. posi...
code_fim
hard
{ "lang": "python", "repo": "WayneGame/NLP_Metric", "path": "/SUPERT/summariser/ngram_vector/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Run for up to 100 generations, allowing extinction. winner = None try: winner = p.run(eval_genomes, 100) except neat.CompleteExtinctionException as e: pass assert len(stats.get_fitness_median()), "Nothing returned from get_fitness_median()" if winner: if...
code_fim
hard
{ "lang": "python", "repo": "CodeReclaimers/neat-python", "path": "/tests/test_xor_example.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }