text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def flip(vertices): x, y, z = vertices.T f = (z < 0) | ((z == 0) & (y < 0)) | ((z == 0) & (y == 0) & (x < 0)) return 1 - 2*f[:, None] decimals = 6 # Test HemiSphere.subdivide # Create a hemisphere by dividing a hemi-icosahedron hemi1 = HemiSphere.from_sphere(un...
code_fim
hard
{ "lang": "python", "repo": "Raniac/NEURO-LEARN", "path": "/env/lib/python3.6/site-packages/dipy/core/tests/test_sphere.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyprogrammerblog/mysite path: /pyproblog/views.py from django.shortcuts import get_object_or_404, render, redirect, reverse from django.views.generic import TemplateView, ListView, View from .models import BlogEntry, Subscriber from django.db.models import Q from .forms import ContactForm, Subscr...
code_fim
hard
{ "lang": "python", "repo": "pyprogrammerblog/mysite", "path": "/pyproblog/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get(self, request, *args, **kwargs): if not self.kwargs.get('unsubscribe_code'): return HttpResponseNotFound('Something went wrong!') user = get_object_or_404( Subscriber, unsubscribe_code=self.kwargs['unsubscribe_code'] ) user.d...
code_fim
hard
{ "lang": "python", "repo": "pyprogrammerblog/mysite", "path": "/pyproblog/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mksy61/python path: /learn/cc/ctxtlib.py from contextlib import contextmanager @contextmanager def file(filename, method): <|fim_suffix|> with file("a.txt", "r") as f: a = f.read() print(type(a)) print(a)<|fim_middle|> file = open(filename, method, encoding="utf-8") yield file f...
code_fim
medium
{ "lang": "python", "repo": "mksy61/python", "path": "/learn/cc/ctxtlib.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mksy61/python path: /learn/cc/ctxtlib.py from contextlib import contextmanager <|fim_suffix|> with file("a.txt", "r") as f: a = f.read() print(type(a)) print(a)<|fim_middle|> @contextmanager def file(filename, method): file = open(filename, method, encoding="utf-8") yield file f...
code_fim
medium
{ "lang": "python", "repo": "mksy61/python", "path": "/learn/cc/ctxtlib.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>with file("a.txt", "r") as f: a = f.read() print(type(a)) print(a)<|fim_prefix|># repo: mksy61/python path: /learn/cc/ctxtlib.py from contextlib import contextmanager <|fim_middle|>@contextmanager def file(filename, method): file = open(filename, method, encoding="utf-8") yield file fi...
code_fim
medium
{ "lang": "python", "repo": "mksy61/python", "path": "/learn/cc/ctxtlib.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rrwt/daily-coding-challenge path: /daily_problems/problem_101_to_200/problem_167.py """ Given a list of words, find all pairs of unique indices such that the concatenation of the two words is a palindrome. For example, given the list ["code", "edoc", "da", "d"], return [(0, 1), (1, 0), (2, 3)...
code_fim
hard
{ "lang": "python", "repo": "rrwt/daily-coding-challenge", "path": "/daily_problems/problem_101_to_200/problem_167.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": assert unique_indices(["code", "edoc", "da", "d"]) == [(0, 1), (1, 0), (2, 3)]<|fim_prefix|># repo: rrwt/daily-coding-challenge path: /daily_problems/problem_101_to_200/problem_167.py """ Given a list of words, find all pairs of unique indices such that the concatenation of...
code_fim
hard
{ "lang": "python", "repo": "rrwt/daily-coding-challenge", "path": "/daily_problems/problem_101_to_200/problem_167.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def notifyAll(self) -> None: ... def propertyManagers(self) -> Iterator[unicode]: """ Returns an iterator over the names of all existing PropertyMaps. """ ... @overload def removeAll(self, addr: ghidra.program.model.address.Address) -> None: """ ...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/program/model/util/PropertyMapManager.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Returns the PropertyMap with the given name or null if no PropertyMap exists with that name. @param propertyName the name of the property to retrieve. """ ... def getStringPropertyMap(self, propertyName: unicode) -> ghidra.program.model.util.String...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/program/model/util/PropertyMapManager.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kohnakagawa/ghidra_scripts path: /ghidra9.2.1_pyi/ghidra/program/model/util/PropertyMapManager.pyi from typing import Iterator import ghidra.program.model.address import ghidra.program.model.util import ghidra.util.task import java.lang class PropertyMapManager(object): """ Interface fo...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/program/model/util/PropertyMapManager.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: babafemisorinolu/pyadlml path: /pyadlml/dataset/_datasets/activity_assistant.py import os import pandas as pd from pyadlml.dataset.activities import correct_activities from pyadlml.dataset.devices import correct_devices from pyadlml.dataset.obj import Data from pyadlml.dataset import START_TIME,...
code_fim
hard
{ "lang": "python", "repo": "babafemisorinolu/pyadlml", "path": "/pyadlml/dataset/_datasets/activity_assistant.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> df_dev = _read_devices(os.path.join(folder_path, DATA_NAME), os.path.join(folder_path, DEV_MAP_NAME)) df_dev = correct_devices(df_dev) # get mappings lst_dev = _read_device_list(os.path.join(folder_path, DEV_MAP_NAME)) lst_act = _read_activity_list(os.path.j...
code_fim
hard
{ "lang": "python", "repo": "babafemisorinolu/pyadlml", "path": "/pyadlml/dataset/_datasets/activity_assistant.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # get mappings lst_dev = _read_device_list(os.path.join(folder_path, DEV_MAP_NAME)) lst_act = _read_activity_list(os.path.join(folder_path, ACT_MAP_NAME)) data = Data(None, df_dev, activity_list=lst_act, device_list=lst_dev) for subject in subjects: df_act = _read_activities(...
code_fim
hard
{ "lang": "python", "repo": "babafemisorinolu/pyadlml", "path": "/pyadlml/dataset/_datasets/activity_assistant.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Check for elements between 'FROM' and 'WHERE'-------------------------- result, from_query = FromValidation(query) if result != True: return result, '' #Check for elements after 'WHERE'------------------------------- result, where_query = WhereValidation(query) if result ...
code_fim
hard
{ "lang": "python", "repo": "iamar7/mini-sql-engine", "path": "/validator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iamar7/mini-sql-engine path: /validator.py import sqlparse from select_validator import * from from_validator import * from where_validator import * def ValidateQuery(query): #Remove Duplicated Spaces and spaces from start and end query = " ".join(query.split()) <|fim_suffix|> query ...
code_fim
hard
{ "lang": "python", "repo": "iamar7/mini-sql-engine", "path": "/validator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #For valid query (length > 1) in all other cases invalid query if length_query <= 1: return 'Error: Invalid Syntax', '' #Check for 'SELECT' and elements between 'SELECT' and 'FROM'------------------------- result, select_query = SelectValidation(query) if result != True: ...
code_fim
hard
{ "lang": "python", "repo": "iamar7/mini-sql-engine", "path": "/validator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lingyun666/algorithms-tutorial path: /lintcode/ThreeSum/clostest_three_sum.py # coding: utf8 ''' LintCode: http://www.lintcode.com/zh-cn/problem/3sum-closest/ 59. 最接近的三数之和: 给一个包含 n 个整数的数组 S, 找到和与给定整数 target 最接近的三元组,返回这三个数的和。 注意事项: 只需要返回三元组之和,无需返回三元组本身 样例: 例如 S = [-1, 2, 1, -4] and target = 1...
code_fim
hard
{ "lang": "python", "repo": "lingyun666/algorithms-tutorial", "path": "/lintcode/ThreeSum/clostest_three_sum.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ @param numbers: Give an array numbers of n integer @param target : An integer @return : return the sum of the three integers, the sum closest target. """ def threeSumClosest(self, numbers, target): # write your code here n = len(numbers) if n < 3: ...
code_fim
hard
{ "lang": "python", "repo": "lingyun666/algorithms-tutorial", "path": "/lintcode/ThreeSum/clostest_three_sum.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def on_activated(self): self.dbg('Activated the WinSys plugin.') def on_deactivated(self): self.dbg('Deactivated the WinSys plugin.') def on_events(self, flags): if flags & kp.Events.PACKCONFIG: self.info("Configuration changed, rebuilding catalog...") ...
code_fim
hard
{ "lang": "python", "repo": "kvnxiao/keypirinha-winsys", "path": "/src/winsys.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kvnxiao/keypirinha-winsys path: /src/winsys.py # Keypirinha | A semantic launcher for Windows | http://keypirinha.com import keypirinha as kp from . import system_actions from . import shell_actions from . import settings_actions class WinSys(kp.Plugin): """ Provides Windows 10 system...
code_fim
hard
{ "lang": "python", "repo": "kvnxiao/keypirinha-winsys", "path": "/src/winsys.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.dbg('Deactivated the WinSys plugin.') def on_events(self, flags): if flags & kp.Events.PACKCONFIG: self.info("Configuration changed, rebuilding catalog...") self.on_catalog() def load_resource_image(self, image_name): return self.load_icon('re...
code_fim
hard
{ "lang": "python", "repo": "kvnxiao/keypirinha-winsys", "path": "/src/winsys.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: psono/psono-fileserver path: /psono/cron/views/cleanup_chunks.py from django.conf import settings from django.core.files.storage import get_storage_class from rest_framework import status from rest_framework.response import Response from rest_framework.generics import GenericAPIView from rest_fra...
code_fim
hard
{ "lang": "python", "repo": "psono/psono-fileserver", "path": "/psono/cron/views/cleanup_chunks.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not status.is_success(r.status_code): return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR) deleted_chunk_list = [] for shard_id in r.json_decrypted['shards']: if shard_id not in settings.SHARDS_DICT: continue shard...
code_fim
hard
{ "lang": "python", "repo": "psono/psono-fileserver", "path": "/psono/cron/views/cleanup_chunks.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def compute_initial_figure(self): pass def onClick(self,event): if event.button == 3: if event.inaxes == MyIndMetricsCanvas.ax: cont, ind = MyIndMetricsCanvas.fig.contains(event) if cont: if hasattr(MyIndM...
code_fim
hard
{ "lang": "python", "repo": "marinaPauw/Assurance", "path": "/IndividualMetrics.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marinaPauw/Assurance path: /IndividualMetrics.py -%d') tableContainingRownames["runDate"] = table["runDate"] tableContainingRownames = tableContainingRownames.sort_values("runDate") table = table.sort_values("runDate") ...
code_fim
hard
{ "lang": "python", "repo": "marinaPauw/Assurance", "path": "/IndividualMetrics.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def onClick(self,event): if event.button == 3: if event.inaxes == MyIndMetricsCanvas.ax: cont, ind = MyIndMetricsCanvas.fig.contains(event) if cont: if hasattr(MyIndMetricsCanvas,"ann"): MyIndMetricsC...
code_fim
hard
{ "lang": "python", "repo": "marinaPauw/Assurance", "path": "/IndividualMetrics.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lkc9015/freestyle_project path: /test/test_NLP_LDA.py from app.NLP_LDA import * def test_read_letters(): letters = read_letter_from_file("test\example_shareholders_letter.csv") assert len(letters) == 38 def test_read_company(): company = read_letter_from_file("test\example_sharehold...
code_fim
hard
{ "lang": "python", "repo": "lkc9015/freestyle_project", "path": "/test/test_NLP_LDA.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_number_of_company(): company = read_company_from_file("test\example_shareholders_letter.csv") number_of_company = len(set(company)) assert number_of_company == 5 def test_name_of_company(): company = read_company_from_file("test\example_shareholders_letter.csv") name_of_compa...
code_fim
medium
{ "lang": "python", "repo": "lkc9015/freestyle_project", "path": "/test/test_NLP_LDA.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cargocult/rowan-python path: /rowan/controllers/middleware.py from time import time import urlparse import uuid import base from rowan.utils.subdicts import ChangeTrackingDict import rowan.http as http class SessionMiddleware(base.Wrapper): """ Wraps another controller, doing the sessio...
code_fim
hard
{ "lang": "python", "repo": "cargocult/rowan-python", "path": "/rowan/controllers/middleware.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # We must have a location, to check if the request came # from the correct place. from_location = request.body_params.get('from') if from_location: from_location_domain = urlparse.urlparse(from_location).netloc # Find the api...
code_fim
hard
{ "lang": "python", "repo": "cargocult/rowan-python", "path": "/rowan/controllers/middleware.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 310A/Eric path: /Eric/ZHOUDIU/python_study/test/venv/lib/python2.7/site-packages/leancloud/message.py # coding: utf-8 """ 实时通讯消息相关操作。 """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from da...
code_fim
hard
{ "lang": "python", "repo": "310A/Eric", "path": "/Eric/ZHOUDIU/python_study/test/venv/lib/python2.7/site-packages/leancloud/message.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param limit: 返回条数限制,可选,服务端默认 100 条,最大 1000 条 :param before_time: 查询起始的时间戳,返回小于这个时间(不包含)的记录,服务端默认是当前时间 :param before_message_id: 起始的消息 id,使用时必须加上对应消息的时间 before_time 参数,一起作为查询的起点 :return: 符合条件的聊天记录 """ query_params = {} # type: Dict[str, Any] if limi...
code_fim
hard
{ "lang": "python", "repo": "310A/Eric", "path": "/Eric/ZHOUDIU/python_study/test/venv/lib/python2.7/site-packages/leancloud/message.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _update_data(self, server_data): # type: (dict) -> None self.bin = server_data.get('bin') self.conversation_id = server_data.get('conv-id') self.data = server_data.get('data') self.from_client = server_data.get('from') self.from_ip = server_data.get('from-i...
code_fim
hard
{ "lang": "python", "repo": "310A/Eric", "path": "/Eric/ZHOUDIU/python_study/test/venv/lib/python2.7/site-packages/leancloud/message.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bwisgood/grpc_client_pool path: /protogen/common_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descr...
code_fim
hard
{ "lang": "python", "repo": "bwisgood/grpc_client_pool", "path": "/protogen/common_pb2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _RANGE = _descriptor.Descriptor( name='Range', full_name='Range', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='field', full_name='Range.field', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, d...
code_fim
hard
{ "lang": "python", "repo": "bwisgood/grpc_client_pool", "path": "/protogen/common_pb2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Pagination = _reflection.GeneratedProtocolMessageType('Pagination', (_message.Message,), { 'DESCRIPTOR' : _PAGINATION, '__module__' : 'common_pb2' # @@protoc_insertion_point(class_scope:Pagination) }) _sym_db.RegisterMessage(Pagination) LikeField = _reflection.GeneratedProtocolMessageType('LikeFi...
code_fim
hard
{ "lang": "python", "repo": "bwisgood/grpc_client_pool", "path": "/protogen/common_pb2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Amshra267/Thompson-Greedy-Comparison-for-MultiArmed-Bandits path: /Agents.py """ MABP:- Creating simulated data for Multi Armed Bandit problem (N armed TestBed) """ import numpy as np from collections import defaultdict from typing import List from numpy.core.fromnumeric import var from seaborn....
code_fim
hard
{ "lang": "python", "repo": "Amshra267/Thompson-Greedy-Comparison-for-MultiArmed-Bandits", "path": "/Agents.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_max_estimated_bandit(self)->Bandit: """ this function is used to estimate model based on mean/mode """ # print("mus - ", self.mu) # print("actions - ", np.argmax(self.mu)) unique, counts = np.unique(self.mu, return_counts=True) lens = coun...
code_fim
hard
{ "lang": "python", "repo": "Amshra267/Thompson-Greedy-Comparison-for-MultiArmed-Bandits", "path": "/Agents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # ID3 has a small list of supported tags if hasattr(mutafile, 'ID3'): return tagname.lower() in mutafile.ID3.valid_keys # Any arbitrary tag name is valid in VORBISCOMMENT return True def handle_file(filename, setting_tags, adding_tags, force_write=False): ftags = mutagen.File(...
code_fim
hard
{ "lang": "python", "repo": "eberjand/mutatag", "path": "/mutatag/mutatag.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eberjand/mutatag path: /mutatag/mutatag.py #!/usr/bin/env python3 import argparse import sys import mutagen class TagSetAction(argparse.Action): # pylint: disable=too-few-public-methods def __init__(self, option_strings, dest, nargs=None, **kwargs): self.tagname = kwargs.get('con...
code_fim
hard
{ "lang": "python", "repo": "eberjand/mutatag", "path": "/mutatag/mutatag.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: terasakisatoshi/pythonCodes path: /kivy/numberPlace/alpha/sudoku.py from itertools import product import numpy as np import z3 from z3solver import Z3Solver from kivy.app import App from kivy.uix.button import Label, Button from kivy.uix.gridlayout import GridLayout from kivy.uix.behaviors import...
code_fim
hard
{ "lang": "python", "repo": "terasakisatoshi/pythonCodes", "path": "/kivy/numberPlace/alpha/sudoku.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class SudokuApp(App): def on_start(self): main_grid = self.root.ids.main_grid for (k, l) in product(range(9), repeat=2): main_grid.add_widget(CustomButton( id="v_{}_{}".format(str(k), str(l)))) def solve(self): grid = lambda i, j: z3.Int("grid[...
code_fim
hard
{ "lang": "python", "repo": "terasakisatoshi/pythonCodes", "path": "/kivy/numberPlace/alpha/sudoku.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> gridLayout= 'hj_gridLayout' if mc.gridLayout(gridLayout,q=1,ex=1): mc.deleteUI(gridLayout) mc.setParent('flowLayout2') mc.gridLayout(gridLayout,nc=1,cwh=[32,32]) mc.setParent(gridLayout) global_vars = inspect.getouterframes(inspect.currentframe())[-1][0].f_globals # global_vars = globals() mc....
code_fim
hard
{ "lang": "python", "repo": "anubhab91/pyshell", "path": "/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print 'return:',menu_item return menu_item parent_menu=None for m in menu_path: menu_item = get_menu_item(m,parent_menu) parent_menu = menu_item print parent_menu # delete existing menuItem if mc.menu(parent_menu,q=1,ia=1): for m in mc.menu(parent_menu,q=1,ia=1): if mc.menuItem(m,q=...
code_fim
hard
{ "lang": "python", "repo": "anubhab91/pyshell", "path": "/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anubhab91/pyshell path: /utils.py import maya.mel as mm import maya.cmds as mc import inspect def add_menu(location='Window->General Editors',label='xxx',command='print "xxx"'): ''' Add menu to specified location in main menu. Args: location: Window->General Editors. label: the lab...
code_fim
hard
{ "lang": "python", "repo": "anubhab91/pyshell", "path": "/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pxlc/pxlc_td_toolbox path: /apps/webkit_widget_launcher/op/rebuild_shot_select/rebuild_shot_select.py # ------------------------------------------------------------------------------- # MIT License # # Copyright (c) 2018 pxlc@github # # Permission is hereby granted, free of charge, to any person ...
code_fim
medium
{ "lang": "python", "repo": "pxlc/pxlc_td_toolbox", "path": "/apps/webkit_widget_launcher/op/rebuild_shot_select/rebuild_shot_select.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> shot_list = [] filler_type = filler_info.get('filler_type','') if filler_type == 'data_list': query = filler_info.get('query_info',{}) db = BackEnd( query.get('backend_server',''), query.get('backend_type','') ) f_list = query.get("fields",[]) query_results = ...
code_fim
medium
{ "lang": "python", "repo": "pxlc/pxlc_td_toolbox", "path": "/apps/webkit_widget_launcher/op/rebuild_shot_select/rebuild_shot_select.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> filler_info = params.get('filler_info',{}) shot_list = [] filler_type = filler_info.get('filler_type','') if filler_type == 'data_list': query = filler_info.get('query_info',{}) db = BackEnd( query.get('backend_server',''), query.get('backend_type','') ) f_list = ...
code_fim
medium
{ "lang": "python", "repo": "pxlc/pxlc_td_toolbox", "path": "/apps/webkit_widget_launcher/op/rebuild_shot_select/rebuild_shot_select.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p.O9 = circle_9.get_point(-pi / 2 * 0.2) p.O10 = circle_9.get_point(pi / 2 * 0.2) p.PO9 = circle_9.get_point(-pi / 2 * 0.4) p.PO10 = circle_9.get_point(pi / 2 * 0.4) p.P9 = circle_9.get_point(-pi / 2 * 0.6) p.P10 = circle_9.get_point(pi / 2 * 0.6) p.TP9 = circle_9.get_point(...
code_fim
hard
{ "lang": "python", "repo": "scot-dev/scot", "path": "/scot/eegtopo/eegpos3d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scot-dev/scot path: /scot/eegtopo/eegpos3d.py # Released under The MIT License (MIT) # http://opensource.org/licenses/MIT # Copyright (c) 2013 Martin Billinger """Module to generate 3d EEG locations""" from numpy import * from scot.eegtopo import geo_spherical as geo from .tools import Struct ...
code_fim
hard
{ "lang": "python", "repo": "scot-dev/scot", "path": "/scot/eegtopo/eegpos3d.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> circle_FC = Circle(p.FT7, p.FCz, p.FT8) circle_CP = Circle(p.TP7, p.CPz, p.TP8) p.FC5 = intersection(circle_5, circle_FC)[0] p.FC3 = intersection(circle_3, circle_FC)[0] p.FC1 = intersection(circle_1, circle_FC)[0] p.FC2 = intersection(circle_2, circle_FC)[0] p.FC4 = intersect...
code_fim
hard
{ "lang": "python", "repo": "scot-dev/scot", "path": "/scot/eegtopo/eegpos3d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adjacentlink/python-etce path: /scripts/etce-mgen-network-receptions-stripchart #!/usr/bin/env python # # Copyright (c) 2021 - Adjacent Link LLC, Bridgewater, New Jersey # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted pro...
code_fim
hard
{ "lang": "python", "repo": "adjacentlink/python-etce", "path": "/scripts/etce-mgen-network-receptions-stripchart", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> rx_trial = None try: rx_trial = rx[rx.trial == trial] except KeyError as ke: print(ke) continue rx_trial.plot(kind='scatter', x='rxtimefrac', y='rxtimesec', ax=ax, marker='.', s=0.5, color='black') ax.set_xlabel('rx time (fractional second)') ax.set_ylab...
code_fim
hard
{ "lang": "python", "repo": "adjacentlink/python-etce", "path": "/scripts/etce-mgen-network-receptions-stripchart", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>rx['rxtimefrac'] = rx.rxtime - rx.rxtimesec all_rxers = set(rx.rxnode.unique()) rxers = all_rxers if args.nodefilter: # keep named nodes rxers = [nodename.strip() for nodename in args.nodefilter.split(':')] # filter out drop_rxers = all_rxers.difference(rxers) if drop_rxers: ...
code_fim
hard
{ "lang": "python", "repo": "adjacentlink/python-etce", "path": "/scripts/etce-mgen-network-receptions-stripchart", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ministryofjustice/money-to-prisoners-api path: /mtp_api/apps/disbursement/migrations/0020_auto_20201007_1448.py # Generated by Django 2.2.16 on 2020-10-07 13:48 <|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('disbursement', '0019_auto_20181106_1641'), ] ...
code_fim
easy
{ "lang": "python", "repo": "ministryofjustice/money-to-prisoners-api", "path": "/mtp_api/apps/disbursement/migrations/0020_auto_20201007_1448.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterModelOptions( name='disbursement', options={'get_latest_by': 'created', 'ordering': ('id',)}, ), ]<|fim_prefix|># repo: ministryofjustice/money-to-prisoners-api path: /mtp_api/apps/disbursement/migrations/0020_auto_20201007_14...
code_fim
medium
{ "lang": "python", "repo": "ministryofjustice/money-to-prisoners-api", "path": "/mtp_api/apps/disbursement/migrations/0020_auto_20201007_1448.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: royw/orchestra path: /orchestra/workflow.py from importlib import import_module from django.conf import settings from orchestra.core.errors import InvalidSlugValue from orchestra.core.errors import SlugUniquenessError class Workflow(): def __init__(self, **kwargs): ...
code_fim
hard
{ "lang": "python", "repo": "royw/orchestra", "path": "/orchestra/workflow.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_workflows(): workflows = {} for backend_module, variable in settings.ORCHESTRA_PATHS: backend_module = import_module(backend_module) workflow = getattr(backend_module, variable) if workflow.slug in workflows: raise SlugUniquenessError('Repeated slug valu...
code_fim
hard
{ "lang": "python", "repo": "royw/orchestra", "path": "/orchestra/workflow.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): super(OrderViewsetRetrieveUpdateDestroyTests, self).setUp() self.object = baker.make('example_app.Order') baker.make('example_app.OrderedMeal', order=self.object, _quantity=2) self.view_url = reverse( 'viewset_retrieve_update_destroy', kwarg...
code_fim
hard
{ "lang": "python", "repo": "vintasoftware/drf-rw-serializers", "path": "/tests/test_viewsets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vintasoftware/drf-rw-serializers path: /tests/test_viewsets.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Tests for the `drf-rw-serializers` viewsets module. """ from __future__ import absolute_import, unicode_literals from django.utils import version as django_version from model_bakery ...
code_fim
hard
{ "lang": "python", "repo": "vintasoftware/drf-rw-serializers", "path": "/tests/test_viewsets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class OrderViewsetRetrieveUpdateDestroyTests( BaseTestCase, TestRetrieveRequestSuccess, TestUpdateRequestSuccess): def setUp(self): super(OrderViewsetRetrieveUpdateDestroyTests, self).setUp() self.object = baker.make('example_app.Order') baker.make('example_app.Ordered...
code_fim
hard
{ "lang": "python", "repo": "vintasoftware/drf-rw-serializers", "path": "/tests/test_viewsets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jprebys/genetic_engineering path: /src/functions.py import pandas as pd import numpy as np def top10_accuracy_scorer(estimator, X, y): """A custom scorer that evaluates a model on whether the correct label is in the top 10 most probable predictions. Args: estimator (sklea...
code_fim
hard
{ "lang": "python", "repo": "Jprebys/genetic_engineering", "path": "/src/functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def to_numeric_sequence(sequence, subseq_len=3): """Take in a gene sequence as a string optional arg subseq_len Return a numeric sequence representing it as a Numpy array """ subs = get_subs(subseq_len) encoder = {sub: i for i, sub in enumerate(subs)} num_list = [encoder[...
code_fim
hard
{ "lang": "python", "repo": "Jprebys/genetic_engineering", "path": "/src/functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tilburgsciencehub/algolia-uploader path: /main.py import os import json from algoliasearch.search_client import SearchClient <|fim_suffix|>with open(path) as f: records = json.load(f) index.replace_all_objects(records, {'autoGenerateObjectIDIfNotExist': True})<|fim_middle|>client = Sea...
code_fim
hard
{ "lang": "python", "repo": "tilburgsciencehub/algolia-uploader", "path": "/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>with open(path) as f: records = json.load(f) index.replace_all_objects(records, {'autoGenerateObjectIDIfNotExist': True})<|fim_prefix|># repo: tilburgsciencehub/algolia-uploader path: /main.py import os import json from algoliasearch.search_client import SearchClient <|fim_middle|>client = Sea...
code_fim
hard
{ "lang": "python", "repo": "tilburgsciencehub/algolia-uploader", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def printResults(strategyName, results): print("\n-----||",strategyName,"||-----\n") if(len(results) == 0): print("No port scans detected\n") return table = PrettyTable() table.field_names = ["Suspect source", "Reason"] for idx,result in enumerate(results): ...
code_fim
hard
{ "lang": "python", "repo": "pabloegpf1/port-scanner-detector", "path": "/detector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pabloegpf1/port-scanner-detector path: /detector.py #! /usr/bin/env python3 import sys import dpkt from prettytable import PrettyTable #Import strategies from strategies.tcpsyn import tcpSynScan from strategies.tcpconnect import tcpConnectScan from strategies.tcpnull import tcpNullScan from str...
code_fim
hard
{ "lang": "python", "repo": "pabloegpf1/port-scanner-detector", "path": "/detector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: meanmail/django-extensions path: /django_extensions/jobs/daily/cache_cleanup.py # -*- coding: utf-8 -*- """ Daily cleanup job. Can be run as a cronjob to clean out old data from the database (only expired sessions at the moment). """ from django.conf import settings from django.core.cache impor...
code_fim
medium
{ "lang": "python", "repo": "meanmail/django-extensions", "path": "/django_extensions/jobs/daily/cache_cleanup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if hasattr(settings, 'CACHES'): for cache_name, cache_options in settings.CACHES.items(): if cache_options['BACKEND'].endswith("DatabaseCache"): cache = caches[cache_name] cache.clear() return<|fim_prefix|># repo: mean...
code_fim
medium
{ "lang": "python", "repo": "meanmail/django-extensions", "path": "/django_extensions/jobs/daily/cache_cleanup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> time_start = time.time() #TODO implement light color prediction #image_np = self.__preprocess_image(image) image_np = image # Expand dimensions since the model expects images to have shape: [1, None, None, 3] image_np_expanded = np.expand_dims(imag...
code_fim
hard
{ "lang": "python", "repo": "jumanamp/CarND-Capstone", "path": "/ros/src/tl_detector/light_classification/tl_classifier.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jumanamp/CarND-Capstone path: /ros/src/tl_detector/light_classification/tl_classifier.py from styx_msgs.msg import TrafficLight import rospy import tensorflow as tf import numpy as np import time from PIL import Image DETECTION_THRESHOLD = 0.5 class TLClassifier(object): def __init__(self,...
code_fim
hard
{ "lang": "python", "repo": "jumanamp/CarND-Capstone", "path": "/ros/src/tl_detector/light_classification/tl_classifier.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: twktheainur/pyclinrec path: /example_applications/agrovoc/generate_dictionary.py from logging import getLogger import argparse from pyclinrec.dictionary import generate_dictionary_from_skos_sparql parser = argparse.ArgumentParser(description='Agrovoc Dictionary Generator') <|fim_suffix|>args ...
code_fim
hard
{ "lang": "python", "repo": "twktheainur/pyclinrec", "path": "/example_applications/agrovoc/generate_dictionary.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>parser.add_argument('--from', '-f', type=str, nargs=1, required=False, dest="from_stmt", default=[""]) parser.add_argument('--output', '-o', type=str, nargs=1, required=False, dest='output', default=["agrovoc_dictionary.tsv"]) parser.add_argument('--language', '-l', type=str, nargs=1, ...
code_fim
medium
{ "lang": "python", "repo": "twktheainur/pyclinrec", "path": "/example_applications/agrovoc/generate_dictionary.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>args = parser.parse_args() endpoint = args.endpoint[0] from_stmt = args.from_stmt[0] output = args.output[0] language = args.language[0] generate_dictionary_from_skos_sparql(endpoint, output, skos_xl_labels=True, lang=language, from_statement=from_stmt)<|fim_prefix|># repo: twktheainur/pyclinrec path: ...
code_fim
hard
{ "lang": "python", "repo": "twktheainur/pyclinrec", "path": "/example_applications/agrovoc/generate_dictionary.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yannik-ammann/django-ar-organizations path: /organizations/templatetags/org_tags.py from django import template from organizations.utils import get_users_organizations register = template.Library() <|fim_suffix|> @register.assignment_tag def users_organizations(user): """ Returns all o...
code_fim
hard
{ "lang": "python", "repo": "yannik-ammann/django-ar-organizations", "path": "/organizations/templatetags/org_tags.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@register.assignment_tag def users_organizations(user): """ Returns all organizations, in wich the user is member. Use in Template: {% load org_tags %} {% users_organizations request.user as my_orgs %} """ if not user or not user.is_authenticated(): return None else...
code_fim
hard
{ "lang": "python", "repo": "yannik-ammann/django-ar-organizations", "path": "/organizations/templatetags/org_tags.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> value = int(match.group(1)) increment = match.group(2) if increment.endswith('s'): increment = increment[:-1] multiplier = { 'second': 1, 'minute': 60, 'hour': 60*60, 'day': 60*60*24 }[increment] re...
code_fim
hard
{ "lang": "python", "repo": "cloud-copy/core", "path": "/cloudcopy/server/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloud-copy/core path: /cloudcopy/server/utils.py import re import arrow import uuid from adbc.store import Database from adbc.utils import is_url def get_uuid(): <|fim_suffix|> def is_uuid(uid, version=4): # TODO: real uuid check try: uuid.UUID(uid, version=version) retu...
code_fim
medium
{ "lang": "python", "repo": "cloud-copy/core", "path": "/cloudcopy/server/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tc = CMakeToolchain(self) tc.cache_variables["BUILD_EXAMPLES"] = "FALSE" tc.cache_variables["BUILD_TESTS"] = "FALSE" tc.generate() def layout(self): cmake_layout(self, src_folder="src") def config_options(self): if self.settings.os == "Windows": ...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/open-dis-cpp/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build(self): apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() def package(self): copy(self, patt...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/open-dis-cpp/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: conan-io/conan-center-index path: /recipes/open-dis-cpp/all/conanfile.py import os from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.layo...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/open-dis-cpp/all/conanfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gogaman7/timestrap path: /timesheets/models.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from datetime import date from django.db import models from django.db.models import Sum from .utils import duration_string class Client(models.Model): name = models.CharField(ma...
code_fim
hard
{ "lang": "python", "repo": "gogaman7/timestrap", "path": "/timesheets/models.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return duration_string(self.projects.aggregate( Sum('entries__duration') )['entries__duration__sum']) class Project(models.Model): client = models.ForeignKey('Client', related_name='projects') name = models.CharField(max_length=255) archive = models.BooleanFie...
code_fim
hard
{ "lang": "python", "repo": "gogaman7/timestrap", "path": "/timesheets/models.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: liemvo/learnpython3 path: /Numbers/e.py # -*- coding: utf-8 -*- # -*- coding: utf-8 -*- from math import e def e_with_precision(n): <|fim_suffix|> break if __name__ == '__main__': main()<|fim_middle|> return '{:.{}f}'.format(e, n) def main(): while True: try: ...
code_fim
hard
{ "lang": "python", "repo": "liemvo/learnpython3", "path": "/Numbers/e.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: number = int(input('Please enter number between 3 and 48: ')) except: print('You don\'t enter a number') else: if number < 3 or number > 50: print('Number must be between 3 and 48') else: ...
code_fim
medium
{ "lang": "python", "repo": "liemvo/learnpython3", "path": "/Numbers/e.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> break if __name__ == '__main__': main()<|fim_prefix|># repo: liemvo/learnpython3 path: /Numbers/e.py # -*- coding: utf-8 -*- # -*- coding: utf-8 -*- from math import e def e_with_precision(n): return '{:.{}f}'.format(e, n) <|fim_middle|>def main(): while True: try: ...
code_fim
hard
{ "lang": "python", "repo": "liemvo/learnpython3", "path": "/Numbers/e.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: construct/construct path: /deprecated_gallery/elf32.py """ Executable and Linkable Format (ELF), 32 bit, big or little endian. Used on Unix systems as a replacement of the older a.out format. Big-endian support kindly submitted by Craig McQueen (mcqueen-c#edsrd1!yzk!co!jp). """ from construct i...
code_fim
hard
{ "lang": "python", "repo": "construct/construct", "path": "/deprecated_gallery/elf32.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "sections" / Pointer(this.sh_offset, elf32_section_header[this.sh_count]), ) elf32_file = Struct( "identifier" / Struct( Const(b"\x7fELF"), "file_class" / Enum(Byte, NONE = 0, CLASS32 = 1, CLASS64 = 2, ), "en...
code_fim
hard
{ "lang": "python", "repo": "construct/construct", "path": "/deprecated_gallery/elf32.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yottabytt/atlas path: /atlas/foundations_contrib/src/test/test_bucket_job_deployment.py import unittest from mock import patch, Mock, mock_open from foundations_contrib.bucket_job_deployment import BucketJobDeployment from foundations_spec.helpers.spec import Spec from foundations_spec.helper...
code_fim
hard
{ "lang": "python", "repo": "yottabytt/atlas", "path": "/atlas/foundations_contrib/src/test/test_bucket_job_deployment.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.deployment.upload_to_result_bucket() self.deployment._result_bucket.upload_from_file.assert_called_with(self.deployment._job_archive_name(), self._mock_open())<|fim_prefix|># repo: yottabytt/atlas path: /atlas/foundations_contrib/src/test/test_bucket_job_deployment.py import unittes...
code_fim
hard
{ "lang": "python", "repo": "yottabytt/atlas", "path": "/atlas/foundations_contrib/src/test/test_bucket_job_deployment.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @patch('builtins.open', _mock_open) def test_upload_to_result_bucket_opens_job_archive(self): self.deployment.upload_to_result_bucket() open.assert_called_with(self.deployment._job_archive(), 'rb') @patch('builtins.open', _mock_open, create=True) def test_upload_to_result...
code_fim
hard
{ "lang": "python", "repo": "yottabytt/atlas", "path": "/atlas/foundations_contrib/src/test/test_bucket_job_deployment.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if n <= 1: return 0 #Base cases prime = [True for i in range(n)] #Create an array of n True elements prime[0]=prime[1]=False # We know 0 and 1 are not primes p = 2 while (p * p < n): #Same as p < sqrt(n) # Check if p is prime so far ...
code_fim
medium
{ "lang": "python", "repo": "bpbpublications/Python-Quick-Interview-Guide", "path": "/Chapter 03/count_primes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bpbpublications/Python-Quick-Interview-Guide path: /Chapter 03/count_primes.py ''' class Solution: def countPrimes(self, n: int) -> int: if n<2: #Base cases return 0 count = 0 for i in range(2,n): if self.isPrime...
code_fim
medium
{ "lang": "python", "repo": "bpbpublications/Python-Quick-Interview-Guide", "path": "/Chapter 03/count_primes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sabse95/Snowboy_REST_API_Project path: /examples/Python/training_service.py #Python module for teaching words with the Snowboy-Training-REST-API import sys import base64 import requests def get_wave(fname): with open(fname) as infile: return base64.b64encode(infile.read()) def ma...
code_fim
hard
{ "lang": "python", "repo": "Sabse95/Snowboy_REST_API_Project", "path": "/examples/Python/training_service.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ############# MODIFY THE FOLLOWING ############# #get your Token from the Snowboy Profile Settings token = "68077f151b4f7da54af8516d4e034abf77b6591a" hotword_name = arg4 language = "dt" age_group = "20_29" gender = "F" microphone = "usb microphone" ############### END OF MODIFY #################...
code_fim
medium
{ "lang": "python", "repo": "Sabse95/Snowboy_REST_API_Project", "path": "/examples/Python/training_service.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> data = { "name": hotword_name, "language": language, "age_group": age_group, "gender": gender, "microphone": microphone, "token": token, "voice_samples": [ {"wave": get_wave("resources/"+arg1)}, {"wave": get_wave("resources/"+arg2)}, {"wave": get_wave("resources/"+arg3)} ] } r...
code_fim
hard
{ "lang": "python", "repo": "Sabse95/Snowboy_REST_API_Project", "path": "/examples/Python/training_service.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rhksdn04/Melbourne-Mouse-Movement-Detection-in-Videos path: /movement_detector/plotter.py #!/usr/bin/env python # Python 2/3 compatibility from __future__ import print_function import sys <|fim_suffix|> x=[] y=[] with open(sys.argv[1], 'rb') as f: reader = csv.reader(f) ...
code_fim
hard
{ "lang": "python", "repo": "rhksdn04/Melbourne-Mouse-Movement-Detection-in-Videos", "path": "/movement_detector/plotter.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> plt.plot(x, y, 'ro') plt.savefig(ntpath.basename(sys.argv[1])+'-output.png') if __name__ == '__main__': main()<|fim_prefix|># repo: rhksdn04/Melbourne-Mouse-Movement-Detection-in-Videos path: /movement_detector/plotter.py #!/usr/bin/env python # Python 2/3 compatibility from __future__ impo...
code_fim
hard
{ "lang": "python", "repo": "rhksdn04/Melbourne-Mouse-Movement-Detection-in-Videos", "path": "/movement_detector/plotter.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vigsterkr/FlowKet path: /src/flowket/callbacks/exact/sigma_z.py import numpy from tensorflow.keras.callbacks import Callback from ...exact.utils import fdot class ExactSigmaZ(Callback): def __init__(self, exact_variational, log_in_batch_or_epoch=True, **kwargs): <|fim_suffix|> def on_ep...
code_fim
hard
{ "lang": "python", "repo": "vigsterkr/FlowKet", "path": "/src/flowket/callbacks/exact/sigma_z.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }