text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: sympy/sympy path: /sympy/physics/mechanics/tests/test_jointsmethod.py from sympy.core.function import expand from sympy.core.symbol import symbols from sympy.functions.elementary.trigonometric import (cos, sin) from sympy.matrices.dense import Matrix from sympy.simplify.trigsimp import trigsimp f...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/physics/mechanics/tests/test_jointsmethod.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> elif isinstance(idx, slice): start, stop, stride = idx.indices(len(self)) try: it = iter(value) except TypeError: raise TypeError(f'values `{value}` must be iterable!') else: p, i = self.head, 0 ...
code_fim
hard
{ "lang": "python", "repo": "Pyabecedarian/Algorithms-and-Data-Structures-using-Python", "path": "/Stage_1/Task2_LinkedList/linkedlist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pyabecedarian/Algorithms-and-Data-Structures-using-Python path: /Stage_1/Task2_LinkedList/linkedlist.py """ Linked List is a collection of items where each item holds a relative position with respect to the others. The structure seems like: head -> node1 -> node2 -> ... -> tail We can defin...
code_fim
hard
{ "lang": "python", "repo": "Pyabecedarian/Algorithms-and-Data-Structures-using-Python", "path": "/Stage_1/Task2_LinkedList/linkedlist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wanghaisheng/Hashtag-Monitor path: /hashtag_monitor/apps/monitor/migrations/0006_auto_20191219_1729.py # Generated by Django 3.0 on 2019-12-19 17:29 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.RemoveField( model_name='tweet', ...
code_fim
medium
{ "lang": "python", "repo": "wanghaisheng/Hashtag-Monitor", "path": "/hashtag_monitor/apps/monitor/migrations/0006_auto_20191219_1729.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RemoveField( model_name='tweet', name='hashtag', ), migrations.AddField( model_name='tweet', name='hashtags', field=models.ManyToManyField(to='monitor.Hashtag'), ), ]<|fim_prefix|>...
code_fim
medium
{ "lang": "python", "repo": "wanghaisheng/Hashtag-Monitor", "path": "/hashtag_monitor/apps/monitor/migrations/0006_auto_20191219_1729.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: samlet/stack path: /interacts/sl_tests_df.py import streamlit as st import pandas as pd import numpy as np from interacts.common import display_lang_selector # from interacts.map_store import map_store from interacts.json_store import json_store from interacts.sl_utils import all_labels, write_s...
code_fim
hard
{ "lang": "python", "repo": "samlet/stack", "path": "/interacts/sl_tests_df.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> df1 = pd.DataFrame( np.random.randn(3, 20), columns=('col %d' % i for i in range(20))) my_table = st.table(df1) if st.button('Add rows'): df2 = pd.DataFrame( np.random.randn(3, 20), columns=('col %d' % i for i in range(20))) my_table.a...
code_fim
hard
{ "lang": "python", "repo": "samlet/stack", "path": "/interacts/sl_tests_df.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> st.write(opt_vals) if st.button('Add a record'): json_store.add() my_placeholder.table(json_store.get_df()) if st.button('Clear'): json_store.clear() my_placeholder.table(json_store.get_df()) def main(): sidebar() st.subheader("Data frame Application"...
code_fim
hard
{ "lang": "python", "repo": "samlet/stack", "path": "/interacts/sl_tests_df.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: taka-mochi/cryptocurrency-autotrading path: /real_trade/api/binance_api/order.py # coding: utf-8 from binance_api.servicebase import ServiceBase import json from binance.client import Client from binance.exceptions import BinanceAPIException class Order(ServiceBase): def _get_filter(self, s...
code_fim
hard
{ "lang": "python", "repo": "taka-mochi/cryptocurrency-autotrading", "path": "/real_trade/api/binance_api/order.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ ret example { "symbol": "BTCUSDT", "orderId": 28, "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "0.00000000", "origQty": "10.00000000", "executedQty": "10.00000000", "status": "...
code_fim
hard
{ "lang": "python", "repo": "taka-mochi/cryptocurrency-autotrading", "path": "/real_trade/api/binance_api/order.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: curest0x1021/Python-Django-Web path: /Tan_ShinYi/Assignments/Flask_Fundamentals/5_Ninja_Gold/server.py from flask import Flask, render_template, session, request, redirect import random from time import localtime, strftime app = Flask(__name__) app.secret_key = 'my_secret_key' <|fim_suffix|>@app...
code_fim
medium
{ "lang": "python", "repo": "curest0x1021/Python-Django-Web", "path": "/Tan_ShinYi/Assignments/Flask_Fundamentals/5_Ninja_Gold/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> location = { 'farm':random.randint(10,20), 'cave':random.randint(5,10), 'house':random.randint(2,5), 'casino':random.randint(-50,50), } if request.form['location'] in location: result = location[request.form['location']] session['gold'] = session...
code_fim
medium
{ "lang": "python", "repo": "curest0x1021/Python-Django-Web", "path": "/Tan_ShinYi/Assignments/Flask_Fundamentals/5_Ninja_Gold/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route('/reset') #I've included this route for dev's to reset the page def reset(): #for the purposes of debugging session.clear() return redirect('/') if __name__ == '__main__': app.run(debug = True)<|fim_prefix|># repo: curest0x1021/Python-Django-Web path: /Tan_ShinYi/Assignments...
code_fim
hard
{ "lang": "python", "repo": "curest0x1021/Python-Django-Web", "path": "/Tan_ShinYi/Assignments/Flask_Fundamentals/5_Ninja_Gold/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NickKeller/azure-cli-extensions path: /src/devcenter/azext_devcenter/_validators.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the p...
code_fim
medium
{ "lang": "python", "repo": "NickKeller/azure-cli-extensions", "path": "/src/devcenter/azext_devcenter/_validators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> regex = "([01]?[0-9]|2[0-3]):[0-5][0-9]" pattern = re.compile(regex) validation = pattern.match(namespace.delay_time) if validation is None: raise InvalidArgumentValueError("--delay-time should be in the format HH:MM")<|fim_prefix|># repo: NickKeller/azure-cli-extensions path: /sr...
code_fim
hard
{ "lang": "python", "repo": "NickKeller/azure-cli-extensions", "path": "/src/devcenter/azext_devcenter/_validators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # The Jquery fullcalendar app requires a JSON news feed, so this function # creates the feed from upcoming SeriesClass and Event objects. def json_event_feed(request, instructorFeedKey='', locationId=None, roomId=None): if not getConstant('calendar__calendarFeedEnabled'): return JsonResponse...
code_fim
hard
{ "lang": "python", "repo": "django-danceschool/django-danceschool", "path": "/danceschool/core/feeds.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not getConstant('calendar__calendarFeedEnabled'): return JsonResponse({}) startDate = request.GET.get('start', '') endDate = request.GET.get('end', '') timeZone = request.GET.get('timezone', getattr(settings, 'TIME_ZONE', 'UTC')) filters = ( Q(event__month__isnull...
code_fim
hard
{ "lang": "python", "repo": "django-danceschool/django-danceschool", "path": "/danceschool/core/feeds.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: django-danceschool/django-danceschool path: /danceschool/core/feeds.py from django.http import JsonResponse from django.db.models import Q from django.utils.translation import gettext_lazy as _ from django.conf import settings from django.utils import timezone from django_ical.views import ICalF...
code_fim
hard
{ "lang": "python", "repo": "django-danceschool/django-danceschool", "path": "/danceschool/core/feeds.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bruinhomesolutions/cascara path: /getdata/forms.py from django import forms from .models import DataPoint <|fim_suffix|> class Meta: model = DataPoint fields = ['category', 'data'] # removing user. we'll handle that in view<|fim_middle|>class DataForm(forms.ModelForm):
code_fim
easy
{ "lang": "python", "repo": "bruinhomesolutions/cascara", "path": "/getdata/forms.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> model = DataPoint fields = ['category', 'data'] # removing user. we'll handle that in view<|fim_prefix|># repo: bruinhomesolutions/cascara path: /getdata/forms.py from django import forms from .models import DataPoint class DataForm(forms.ModelForm): <|fim_middle|> class Meta:
code_fim
easy
{ "lang": "python", "repo": "bruinhomesolutions/cascara", "path": "/getdata/forms.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = DataPoint fields = ['category', 'data'] # removing user. we'll handle that in view<|fim_prefix|># repo: bruinhomesolutions/cascara path: /getdata/forms.py from django import forms from .models import DataPoint <|fim_middle|>class DataForm(forms.ModelForm):
code_fim
easy
{ "lang": "python", "repo": "bruinhomesolutions/cascara", "path": "/getdata/forms.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, root=None, hostname=None, data_location_code=None): """ :param office365.onedrive.root.Root root: The hostname for the site collection. :param str hostname: The hostname for the site collection. :param str data_location_code: The geographic region co...
code_fim
medium
{ "lang": "python", "repo": "vgrem/Office365-REST-Python-Client", "path": "/office365/onedrive/sites/site_collection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vgrem/Office365-REST-Python-Client path: /office365/onedrive/sites/site_collection.py from office365.runtime.client_value import ClientValue class SiteCollection(ClientValue): <|fim_suffix|> """ :param office365.onedrive.root.Root root: The hostname for the site collection. ...
code_fim
medium
{ "lang": "python", "repo": "vgrem/Office365-REST-Python-Client", "path": "/office365/onedrive/sites/site_collection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param office365.onedrive.root.Root root: The hostname for the site collection. :param str hostname: The hostname for the site collection. :param str data_location_code: The geographic region code for where this site collection resides """ super(SiteCollection, self...
code_fim
medium
{ "lang": "python", "repo": "vgrem/Office365-REST-Python-Client", "path": "/office365/onedrive/sites/site_collection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @dataclass(eq=False) class If(Statement): ifs_and_elifs: List[Tuple[Expression, List[Statement]]] # never empty list else_block: List[Statement] # for init; cond; incr @dataclass(eq=False) class ForLoopHeader: init: List[Statement] cond: Optional[Expression] incr: List[Statement] ...
code_fim
hard
{ "lang": "python", "repo": "Akuli/oomph", "path": "/pyoomph/ast.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Akuli/oomph path: /pyoomph/ast.py from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import List, Optional, Tuple, Union @dataclass(eq=False) class Type: pass @dataclass(eq=False) class AutoType(Type): pass @dataclass(eq=False)...
code_fim
hard
{ "lang": "python", "repo": "Akuli/oomph", "path": "/pyoomph/ast.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sofroniewn/image-demos path: /examples/keiser_tiles.py """ Dynamically load irregularly shapes images of ants and bees """ import numpy as np from dask_image.imread import imread from dask.cache import Cache from napari import Viewer, gui_qt from pandas import read_csv from glob import glob ca...
code_fim
hard
{ "lang": "python", "repo": "sofroniewn/image-demos", "path": "/examples/keiser_tiles.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # def forward(viewer): # """Increments the current view by one # """ # current = viewer.dims.indices[0] # if current + 1 < viewer.dims.range[0][1]: # viewer.dims.set_point(0, current + 1) # # def backward(viewer): # """Decrements the current ...
code_fim
hard
{ "lang": "python", "repo": "sofroniewn/image-demos", "path": "/examples/keiser_tiles.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cbosdo/salt-lsp path: /salt_lsp/workspace.py """Module implementing a custom workspace that automatically updates the parsed contents utilizing the existing Workspace implementation from pygls. """ from logging import getLogger, Logger, DEBUG from pathlib import Path from platform import python_...
code_fim
hard
{ "lang": "python", "repo": "cbosdo/salt-lsp", "path": "/salt_lsp/workspace.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def trees(self) -> UriDict[Tree]: """A dictionary which contains the parsed :ref:`Tree` for each document tracked by the workspace. """ return self._trees @property def document_symbols(self) -> UriDict[List[types.DocumentSymbol]]: """The ...
code_fim
hard
{ "lang": "python", "repo": "cbosdo/salt-lsp", "path": "/salt_lsp/workspace.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: woctezuma/steam-reviews path: /download_reviews.py import steamreviews def main(download_reference_hidden_gems_as_well=False): if download_reference_hidden_gems_as_well: from appids import appid_hidden_gems_reference_set <|fim_suffix|> # All the remaining hidden-gem candidates, ...
code_fim
medium
{ "lang": "python", "repo": "woctezuma/steam-reviews", "path": "/download_reviews.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # All the reference hidden-gems steamreviews.download_reviews_for_app_id_batch(appid_hidden_gems_reference_set) # All the remaining hidden-gem candidates, which app_ids are stored in idlist.txt steamreviews.download_reviews_for_app_id_batch() return True if __name__ == "__m...
code_fim
medium
{ "lang": "python", "repo": "woctezuma/steam-reviews", "path": "/download_reviews.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>N=3 M = confusion_matrix([.55]*N) for j in range(5000): P = np.array([1.0/N]*N) actual_classification = weighted_choice(P) votes = np.array([], dtype='int') for i in range(num_classifications): old_shannon = shannon(P) prob_classification = np.dot(M, P) report = we...
code_fim
hard
{ "lang": "python", "repo": "visenger/aggregation", "path": "/blog/expected_information.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: visenger/aggregation path: /blog/expected_information.py import matplotlib #matplotlib.use('WXAgg') import matplotlib.pyplot as plt import numpy as np num_classifications = 30 info = [[] for i in range(num_classifications)] info_gain = [[] for i in range(num_classifications)] correctness = [[] ...
code_fim
hard
{ "lang": "python", "repo": "visenger/aggregation", "path": "/blog/expected_information.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> s = self.clt("clt", slice(0, 1), latitude=( 30, 70), longitude=(-130, -60)) s2 = MV2.masked_greater(s, 65.) self.x.plot(s2, "default", "isofill", bg=self.bg) self.checkImage("test_vcs_isofill_mask_cell_shift.png")<|fim_prefix|># repo: CDAT/vcs path: /tests/test...
code_fim
easy
{ "lang": "python", "repo": "CDAT/vcs", "path": "/tests/test_vcs_isofill_mask_cell_shift.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: CDAT/vcs path: /tests/test_vcs_isofill_mask_cell_shift.py import basevcstest import MV2 class TestVCSIsofill(basevcstest.VCSBaseTest): <|fim_suffix|> s = self.clt("clt", slice(0, 1), latitude=( 30, 70), longitude=(-130, -60)) s2 = MV2.masked_greater(s, 65.) se...
code_fim
easy
{ "lang": "python", "repo": "CDAT/vcs", "path": "/tests/test_vcs_isofill_mask_cell_shift.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> traceback.append(context) return '\n'.join(traceback) def parseMessage(data): return str(data['message'])<|fim_prefix|># repo: datamade/semabot path: /utils.py def parseException(data): traceback = [] for value in data['values']: for frame in value['stacktrace']['f...
code_fim
medium
{ "lang": "python", "repo": "datamade/semabot", "path": "/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datamade/semabot path: /utils.py def parseException(data): traceback = [] for value in data['values']: for frame in value['stacktrace']['frames']: context = 'File {filename}, line {lineno}, in {function}\n'.format(**frame) try: context += ...
code_fim
medium
{ "lang": "python", "repo": "datamade/semabot", "path": "/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @x.setter def x(self, x): self.set_pos(x, self._y) @property def y(self): return self._y @y.setter def y(self, y): self.set_pos(self._x, y) def __str__(self) -> str: return f"Shape < {self.name} > @({self._x},{self._y}) -> {self.positions}" ...
code_fim
hard
{ "lang": "python", "repo": "joaojomoura/UA", "path": "/3_ano/IA/Project/tpg-tetris-ia_equipa_13/shape.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joaojomoura/UA path: /3_ano/IA/Project/tpg-tetris-ia_equipa_13/shape.py from common import Dimensions import random S = "S", [ [".....", ".....", "..11.", ".11..", "....."], [".....", "..1..", "..11.", "...1.", "....."], ] Z = "Z", [ [...
code_fim
hard
{ "lang": "python", "repo": "joaojomoura/UA", "path": "/3_ano/IA/Project/tpg-tetris-ia_equipa_13/shape.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>T = "T", [ [".....", "..1..", ".111.", ".....", "....."], [".....", "..1..", "..11.", "..1..", "....."], [".....", ".....", ".111.", "..1..", "....."], [".....", "..1..", ".11..", "..1..", ".......
code_fim
hard
{ "lang": "python", "repo": "joaojomoura/UA", "path": "/3_ano/IA/Project/tpg-tetris-ia_equipa_13/shape.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>hip) admin.site.register(Car) admin.site.register(Certificate)<|fim_prefix|># repo: TonikX/ITMO_ICT_WebProgramming_2020 path: /students/k3343/practical_works/Rolinskiy_Sergey/Pr2/project_first_app/admin.py from django.contrib import admin from project_first_app.models<|fim_middle|> import Owner, Owner...
code_fim
medium
{ "lang": "python", "repo": "TonikX/ITMO_ICT_WebProgramming_2020", "path": "/students/k3343/practical_works/Rolinskiy_Sergey/Pr2/project_first_app/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TonikX/ITMO_ICT_WebProgramming_2020 path: /students/k3343/practical_works/Rolinskiy_Sergey/Pr2/project_first_app/admin.py from django.contrib import admin from project_first_app.models<|fim_suffix|>ls here. admin.site.register(Owner) admin.site.register(Ownership) admin.site.register(Car) ad...
code_fim
medium
{ "lang": "python", "repo": "TonikX/ITMO_ICT_WebProgramming_2020", "path": "/students/k3343/practical_works/Rolinskiy_Sergey/Pr2/project_first_app/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ls here. admin.site.register(Owner) admin.site.register(Ownership) admin.site.register(Car) admin.site.register(Certificate)<|fim_prefix|># repo: TonikX/ITMO_ICT_WebProgramming_2020 path: /students/k3343/practical_works/Rolinskiy_Sergey/Pr2/project_first_app/admin.py from django.contrib import admin ...
code_fim
medium
{ "lang": "python", "repo": "TonikX/ITMO_ICT_WebProgramming_2020", "path": "/students/k3343/practical_works/Rolinskiy_Sergey/Pr2/project_first_app/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return pygame.Rect(quad[0], quad[1], quad[2], quad[3]) pygame.init() screen = pygame.display.set_mode((400, 300)) while 1: json_msg = sys.stdin.readline().rstrip() # blocking; remove trailing \n pygame.event.pump() # required for Pygame's internal workings # otherwise Pygame stops: htt...
code_fim
medium
{ "lang": "python", "repo": "pombredanne/swarch", "path": "/pipe-and-filter/displaypygame.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/swarch path: /pipe-and-filter/displaypygame.py """ input: game state output: none (pygame display) Update the display every time I receive a game state in JSON. {'mybox': [1,2,3,4], 'borders': [ [1,2,3,4], [2,3,4,5] ], 'pellets': [ [1,2,3,4] ] } """ import json import sys import...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/swarch", "path": "/pipe-and-filter/displaypygame.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> screen.fill((0, 0, 64)) # dark blue [pygame.draw.rect(screen, (0, 191, 255), b) for b in borders] # deep sky blue [pygame.draw.rect(screen, (255, 192, 203), p) for p in pellets] # pink pygame.draw.rect(screen, (0, 191, 255), myrect) # Deep Sky Blue pygame.displa...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/swarch", "path": "/pipe-and-filter/displaypygame.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#TV LI_TV = LI.Appliance(LI,1,60,3,480,0.16,77) LI_TV.windows([0,1440],[660,1170],0.2,[720,840]) #phone chargeri LI_Phone_charger = LI.Appliance(LI,2,5,3,230,0.26,60) LI_Phone_charger.windows([0,1440],[720,1320],0.35,[660,930]) #freezer LI_Freezer = LI.Appliance(LI,1,200,1,1160,0,30,'yes',3) LI_Freezer....
code_fim
hard
{ "lang": "python", "repo": "CIE-UMSS/VLIR_Energy_Demand", "path": "/Residential_Sector/LI_El_Sena.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CIE-UMSS/VLIR_Energy_Demand path: /Residential_Sector/LI_El_Sena.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 13 12:08:23 2020 @author: alejandrosoto """ """ Created on Fri Feb 8 10:46:25 2019 <|fim_suffix|>#outdoor bulb LI_outdoor_bulb = LI.Appliance(LI,2,13,2,284...
code_fim
hard
{ "lang": "python", "repo": "CIE-UMSS/VLIR_Energy_Demand", "path": "/Residential_Sector/LI_El_Sena.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#outdoor bulb LI_outdoor_bulb = LI.Appliance(LI,2,13,2,284,0.24,70) LI_outdoor_bulb.windows([1200,1440],[0,30],0.2) #TV LI_TV = LI.Appliance(LI,1,60,3,480,0.16,77) LI_TV.windows([0,1440],[660,1170],0.2,[720,840]) #phone chargeri LI_Phone_charger = LI.Appliance(LI,2,5,3,230,0.26,60) LI_Phone_charger.wind...
code_fim
hard
{ "lang": "python", "repo": "CIE-UMSS/VLIR_Energy_Demand", "path": "/Residential_Sector/LI_El_Sena.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> global_data['stats'] = {} # global stats total_requests = 0 total_request_time = 0 # iterate over each batch of tests for interval in global_data['raw']: data = global_data['raw'][interval] count = len(data) total = 0 # aggregate time for user in data: total = total + data[user] # sav...
code_fim
hard
{ "lang": "python", "repo": "ideamelt/stress-test", "path": "/helpers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ideamelt/stress-test path: /helpers.py from datetime import datetime, timedelta import urllib import settings import simplejson as json import os # common methods def create_echo_url(user_url_s): return (settings.ECHO_API_URL + settings.ECHO_CLIENT_URL + settings.ECHO_DATATYPE_URL + urllib.q...
code_fim
medium
{ "lang": "python", "repo": "ideamelt/stress-test", "path": "/helpers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yinan-Zhang/RichCSpace path: /basics/robotics/WarehouseRobot.py import sys, os, copy sys.path.append('../math') import pygame; import math; from geometry import * from polygon import * from hyper_geometry import * from configuration import * from robot import * from BlockRobots import Block cl...
code_fim
hard
{ "lang": "python", "repo": "Yinan-Zhang/RichCSpace", "path": "/basics/robotics/WarehouseRobot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def config_clearance( self, config, mode='L2' ): '''Get clearance of a given configuration''' oldcfg = self.get_config(); self.set_config(config); dist = min( [ self.__robot2block__(mode), self.__robot2wall__() ] ); self.set_config(oldcfg); return dist;<|fim_prefix|># repo: Yinan-Zhang/RichCS...
code_fim
hard
{ "lang": "python", "repo": "Yinan-Zhang/RichCSpace", "path": "/basics/robotics/WarehouseRobot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''test if a robot is valid''' oldcfg = self.get_config(); self.set_config(config); dist = min( [ self.__robot2block__(), self.__robot2wall__() ] ); self.set_config(oldcfg); return dist > 0; def config_clearance( self, config, mode='L2' ): '''Get clearance of a given configuration''' old...
code_fim
hard
{ "lang": "python", "repo": "Yinan-Zhang/RichCSpace", "path": "/basics/robotics/WarehouseRobot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daveinnyc/various path: /python-practice/generators_example.py # Based on https://www.learnpython.org/en/Generators # Using pytest to create propety based tests for the generator functions import random def lottery(): <|fim_suffix|>if __name__ == '__main__': fibs = list() co...
code_fim
hard
{ "lang": "python", "repo": "daveinnyc/various", "path": "/python-practice/generators_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: yield first first, second = second, first + second if __name__ == '__main__': fibs = list() count = 0 for n in fib(): fibs.append(n) print(fibs) if count == 10: break else: count += 1<|fim_...
code_fim
medium
{ "lang": "python", "repo": "daveinnyc/various", "path": "/python-practice/generators_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mihi-tr/mnmlwrt path: /setup.py from distutils.core import setup setup(name='mnmlwrt', <|fim_suffix|>on editor', author='Michael Bauer', url='http://mnmlwrt.tentacleriot.eu/', scripts=['mnmlwrt'], )<|fim_middle|> version='0.03', description='A minimum distracti
code_fim
easy
{ "lang": "python", "repo": "mihi-tr/mnmlwrt", "path": "/setup.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>on editor', author='Michael Bauer', url='http://mnmlwrt.tentacleriot.eu/', scripts=['mnmlwrt'], )<|fim_prefix|># repo: mihi-tr/mnmlwrt path: /setup.py from distutils.core import setup setup(name='mnmlwrt', <|fim_middle|> version='0.03', description='A minimum distracti
code_fim
easy
{ "lang": "python", "repo": "mihi-tr/mnmlwrt", "path": "/setup.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def OnRunScripts(self, event): """ Run selected scripts sequentially - updating progress bars :param e: :return: """ # initialize msg = '' filenames = [] # Clear processing window self.m_dataViewListCtrlRunning.DeleteAllIt...
code_fim
hard
{ "lang": "python", "repo": "IMAGE-ET/dicom2cloud", "path": "/dicom2cloud/clientgui.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: IMAGE-ET/dicom2cloud path: /dicom2cloud/clientgui.py putdir) for y in iglob(join(x[0], '*.IMA'))] self.controller.parseDicom(self, allfiles) # n = 1 # for filename in allfiles: # try: # if not self.db.hasFile(filename): # dcm...
code_fim
hard
{ "lang": "python", "repo": "IMAGE-ET/dicom2cloud", "path": "/dicom2cloud/clientgui.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> desc = self.controller.db.getDescription(event.String) self.m_stTitle.SetLabelText(event.String) self.m_stDescription.SetLabelText(desc) self.Layout() cbtn = event.GetEventObject() if len(cbtn.GetCheckedItems()) > 0: self.m_btnRunProcess.Enable()...
code_fim
hard
{ "lang": "python", "repo": "IMAGE-ET/dicom2cloud", "path": "/dicom2cloud/clientgui.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jovanzac/Captain path: /Scripts/__init__.py """import main_game and start game.""" <|fim_suffix|># display the splash screen and start game main.splash.display() # tkinter mainloop main.root.mainloop()<|fim_middle|>import Scripts.main_game as main
code_fim
easy
{ "lang": "python", "repo": "jovanzac/Captain", "path": "/Scripts/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # display the splash screen and start game main.splash.display() # tkinter mainloop main.root.mainloop()<|fim_prefix|># repo: jovanzac/Captain path: /Scripts/__init__.py """import main_game and start game.""" <|fim_middle|>import Scripts.main_game as main
code_fim
easy
{ "lang": "python", "repo": "jovanzac/Captain", "path": "/Scripts/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saeidnp/pyprob path: /pyprob/nn/__init__.py from .dataset import Batch, OnlineDataset, OfflineDataset, TraceSampler, TraceBatchSampler, DistributedTraceBatchSampler from .embedding_feedforward import EmbeddingFeedForward from .embedding_cnn_2d_5c import EmbeddingCNN2D5C from .embedding_cnn_3d_5c ...
code_fim
hard
{ "lang": "python", "repo": "saeidnp/pyprob", "path": "/pyprob/nn/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>icalCategorical from .proposal_bernoulli_bernoulli import ProposalBernoulliBernoulli from .inference_network import InferenceNetwork from .inference_network_feedforward import InferenceNetworkFeedForward from .inference_network_lstm import InferenceNetworkLSTM<|fim_prefix|># repo: saeidnp/pyprob path: /p...
code_fim
hard
{ "lang": "python", "repo": "saeidnp/pyprob", "path": "/pyprob/nn/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bossjones/ultron8 path: /tests/config/test_pyconfig.py """Test Global Pyconfig setter/getters.""" # pylint: disable=protected-access import logging import pyconfig import pytest from ultron8.config import do_get_flag, do_set_flag, do_set_multi_flag logger = logging.getLogger(__name__) <|fim_s...
code_fim
medium
{ "lang": "python", "repo": "bossjones/ultron8", "path": "/tests/config/test_pyconfig.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_set_multi_get_multi(self): multi_data = [] multi_data.append(("test.fake.bbbbb", "foo")) multi_data.append(("test.fake.bbbbb1", "foo1")) do_set_multi_flag(multi_data) assert do_get_flag("test.fake.bbbbb") == "foo" assert do_get_flag("test.fake.b...
code_fim
hard
{ "lang": "python", "repo": "bossjones/ultron8", "path": "/tests/config/test_pyconfig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kimi-michael/microsim path: /usim/pydot-1.0.28/tkexample1.py #!/bin/env python2.7 # author: Michael Kimi # date : Fri Jan 10 15:11:41 2014 from Tkinter import * root = Tk() content = Frame(root) frame = Frame(content, borderwidth=5, relief="sunken", width=200, height=100) namelbl = Label(con...
code_fim
hard
{ "lang": "python", "repo": "kimi-michael/microsim", "path": "/usim/pydot-1.0.28/tkexample1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>content.grid(column=0, row=0, sticky=(N, S, E, W)) frame.grid (column=0, row=0, columnspan=3, rowspan=3, sticky=(N, S, E, W)) namelbl.grid(column=3, row=0, columnspan=2, sticky=(N, W), padx=5) name.grid (column=3, row=1, columnspan=2, sticky=(N, E, W), padx=5, pady=5) one.grid...
code_fim
hard
{ "lang": "python", "repo": "kimi-michael/microsim", "path": "/usim/pydot-1.0.28/tkexample1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class TfidfMeanEmbeddingVectorizer(TransformerMixin): def __init__(self, embedding_matrix): self.embedding_matrix = embedding_matrix self.tfidf_weights = None if len(embedding_matrix) > 0: self.dim = len(embedding_matrix[next(iter(embedding_matrix))]) else:...
code_fim
hard
{ "lang": "python", "repo": "kurumeti/sentiment-analysis-in-amazon-reviews", "path": "/src/vectorizers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kurumeti/sentiment-analysis-in-amazon-reviews path: /src/vectorizers.py import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.base import TransformerMixin from collections import defaultdict class Doc2VecVectorizer(TransformerMixin): def __init__(self...
code_fim
hard
{ "lang": "python", "repo": "kurumeti/sentiment-analysis-in-amazon-reviews", "path": "/src/vectorizers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>try: while True: thing_2_do = input("Enter f/b/l/r to go forward/backward/left/right, anything else to end the program: ") if thing_2_do == 'f': move_time = int(input("How long do you want to move(in seconds): ")) m1.forward(40+cal) m2.forward(40) ...
code_fim
medium
{ "lang": "python", "repo": "neel-kumar/learn-robotics-rpi", "path": "/MotorTest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neel-kumar/learn-robotics-rpi path: /MotorTest.py #!/usr/bin/python import PiMotor import time import RPi.GPIO as GPIO import config GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) #Name of Individual MOTORS cal = int(config.read("motor")) # Right Motor if config.read("rightrev")[0] == "f":...
code_fim
medium
{ "lang": "python", "repo": "neel-kumar/learn-robotics-rpi", "path": "/MotorTest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wuyou8933/Leetcode path: /pan/lib/python2.7/site-packages/samples/advanced/authentication.py # coding: utf-8 from azure.cosmosdb.table import TableService # ------------------------------------------------------------------------- # Copyright (c) Microsoft. All rights reserved. # # Licensed und...
code_fim
medium
{ "lang": "python", "repo": "wuyou8933/Leetcode", "path": "/pan/lib/python2.7/site-packages/samples/advanced/authentication.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Directly client = TableService(account_name='<account_name>', sas_token='<sas_token>') def emulator(self): # With account account = CloudStorageAccount(is_emulated=True) client = account.create_table_service() # Directly client = TableService...
code_fim
hard
{ "lang": "python", "repo": "wuyou8933/Leetcode", "path": "/pan/lib/python2.7/site-packages/samples/advanced/authentication.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: boh1996/LectioAPI path: /scrapers/grade_sheet.py #https://www.lectio.dk/lectio/517/grades/grade_karakterblad.aspx?elevid=4789793691&prevurl=grades%2fgrade_report.aspx%3felevid%3d4789793691%26culture%3dda-DK%26prevurl%3dforside.aspx #3310 HTX #3010 HHX - 3 årrig #3020 HHX - 1 årrig <|fim_suffix|...
code_fim
medium
{ "lang": "python", "repo": "boh1996/LectioAPI", "path": "/scrapers/grade_sheet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># http://www.admsys.uni-c.dk/~/media/ADMSYS/EASY%20A/Dokumenter/Eksamen/XPRS/Tvungne%20proever%20og%20fortsaetter%20paa%20hoejere%20niveau%20paa%20hhx%20og%20htx%202011.ashx<|fim_prefix|># repo: boh1996/LectioAPI path: /scrapers/grade_sheet.py #https://www.lectio.dk/lectio/517/grades/grade_karakterblad.a...
code_fim
hard
{ "lang": "python", "repo": "boh1996/LectioAPI", "path": "/scrapers/grade_sheet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if loss == float('inf'): break step_time, loss = 0.0, 0.0 sys.stdout.flush() if FLAGS.max_train_iteration > 0 and current_step > FLAGS.max_train_iteration: break def decode(): config = tf.ConfigProto() config.gpu_options.allow_growth = True with tf.Session(config=config) ...
code_fim
hard
{ "lang": "python", "repo": "QingyaoAi/Unbiased-Learning-to-Rank-with-Unbiased-Propensity-Estimation", "path": "/Unbiased_LTR/IPW_LTR/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Create model and initialize or load parameters in session.""" click_model = None with open(FLAGS.click_model_json) as fin: model_desc = json.load(fin) click_model = cm.loadModelFromJson(model_desc) p_estimator = None with open(FLAGS.estimator_json) as fin: data = json.load(fin) if 'IPW_lis...
code_fim
hard
{ "lang": "python", "repo": "QingyaoAi/Unbiased-Learning-to-Rank-with-Unbiased-Propensity-Estimation", "path": "/Unbiased_LTR/IPW_LTR/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: QingyaoAi/Unbiased-Learning-to-Rank-with-Unbiased-Propensity-Estimation path: /Unbiased_LTR/IPW_LTR/main.py """Training and testing the inverse propensity weighting algorithm for unbiased learning to rank. See the following paper for more information on the dual learning algorithm. * Xuanhui ...
code_fim
hard
{ "lang": "python", "repo": "QingyaoAi/Unbiased-Learning-to-Rank-with-Unbiased-Propensity-Estimation", "path": "/Unbiased_LTR/IPW_LTR/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # lookup dns A records via ipv4, since a records don't have names or labels if addresses: # can only lookup dns if addresses exists a_records = {} for zone in cli_gcp.dns_client().list_zones(): for record in zone.list_resource_record_sets(): a_records[re...
code_fim
hard
{ "lang": "python", "repo": "nathants/cli-gcp", "path": "/gcp-compute/gcp-compute-lb-ls", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nathants/cli-gcp path: /gcp-compute/gcp-compute-lb-ls #!/usr/bin/env python3 import sys import argh import cli_gcp import os import shell import yaml def main(name=None, verbose=False, project=os.environ['GCP_PROJECT'], region=os.environ['GCP_REGION'],): lb_name = ...
code_fim
hard
{ "lang": "python", "repo": "nathants/cli-gcp", "path": "/gcp-compute/gcp-compute-lb-ls", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @parameterized.named_parameters({ 'testcase_name': 'constant', 'boundaries': [1], 'values': [5.0], 'test_inputs': [0, 1, 10], 'expected_outputs': [5.0, 5.0, 5.0] }, { 'testcase_name': 'ramp_up', 'boundaries': [10, 20], 'values': [1.0, 11.0], 'test...
code_fim
medium
{ "lang": "python", "repo": "google-research/tensor2robot", "path": "/utils/global_step_functions_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: google-research/tensor2robot path: /utils/global_step_functions_test.py # coding=utf-8 # Copyright 2023 The Tensor2Robot Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the L...
code_fim
hard
{ "lang": "python", "repo": "google-research/tensor2robot", "path": "/utils/global_step_functions_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': main()<|fim_prefix|># repo: theodorcostache/pdf-protect path: /app/main.py from view import PdfProtectFrame from controller import Controller from model import Model import wx import constants <|fim_middle|>def main(): app = wx.App() frame = PdfProtectFrame(None, t...
code_fim
medium
{ "lang": "python", "repo": "theodorcostache/pdf-protect", "path": "/app/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> app = wx.App() frame = PdfProtectFrame(None, title=constants.TITLE) controller = Controller(frame, Model()) frame.Show() app.MainLoop() if __name__ == '__main__': main()<|fim_prefix|># repo: theodorcostache/pdf-protect path: /app/main.py from view import PdfProtectFrame from cont...
code_fim
easy
{ "lang": "python", "repo": "theodorcostache/pdf-protect", "path": "/app/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: theodorcostache/pdf-protect path: /app/main.py from view import PdfProtectFrame from controller import Controller from model import Model import wx import constants <|fim_suffix|>if __name__ == '__main__': main()<|fim_middle|>def main(): app = wx.App() frame = PdfProtectFrame(None, t...
code_fim
medium
{ "lang": "python", "repo": "theodorcostache/pdf-protect", "path": "/app/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tula18/steamlink path: /bin/pynode-example.py #!/usr/bin/env python3 # a Python based Node for SteamLink import asyncio import time import signal import sys import logging logger = logging.getLogger() from steamlink.pynode import PyNode, SL_NodeCfgStruct mqtt_conf = { 'clientid': 'pynode_%...
code_fim
hard
{ "lang": "python", "repo": "tula18/steamlink", "path": "/bin/pynode-example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def setup_logging(loglvl): # FORMAT='%(name)s - %(levelname)s - %(message)s' # logging.basicConfig(level=loglvl, format=FORMAT) logging.basicConfig(level=loglvl) logging.DBG = 0 logging.DBGK = [] setup_logging(logging.INFO) loop = asyncio.get_event_loop() loop.run_until_complete(run(loop)) logger.in...
code_fim
hard
{ "lang": "python", "repo": "tula18/steamlink", "path": "/bin/pynode-example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #given n terms, find the mean of the connection strengths of subgraphs considering each term as pivot. #return the mean of max strength term subgraph def find_pivot_subgraph(self,terms): max_mean = 0 std_dev = 0 max_mean_term = None means_dict = {} if (l...
code_fim
hard
{ "lang": "python", "repo": "ajitvr/cls_sentence_representations", "path": "/sentence_dist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajitvr/cls_sentence_representations path: /sentence_dist.py T_CUM_DIST = "cum_dist.txt" OUTPUT_ZERO_VEC_COUNTS = "zero_vec_counts.txt" OUTPUT_TAIL_COUNTS = "tail_counts.txt" DESC_CLUSTERS = "desc_clusters.txt" SUBSERVIENT_CLUSTERS = "subservient_clusters.txt" EMPTY_SENTENCES = "empty_sentences.tx...
code_fim
hard
{ "lang": "python", "repo": "ajitvr/cls_sentence_representations", "path": "/sentence_dist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_distribution_for_term(self,term1): if (term1 in self.dist_threshold_cache): return self.dist_threshold_cache[term1],self.dist_zero_cache terms_count = self.terms_dict dist_dict = {} val_dict = {} zero_dict = {} for k in self.terms_dic...
code_fim
hard
{ "lang": "python", "repo": "ajitvr/cls_sentence_representations", "path": "/sentence_dist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OrIOg/TronRacerTest path: /Entities/EntityGroup.py import pygame class EntityGroup(pygame.sprite.Group): def __init__(self): <|fim_suffix|> sprites = self.sprites() for spr in sprites: spr.draw(surface) self.lostsprites = []<|fim_middle|> pygame.sp...
code_fim
medium
{ "lang": "python", "repo": "OrIOg/TronRacerTest", "path": "/Entities/EntityGroup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pygame.sprite.Group.__init__(self) def draw(self, surface): sprites = self.sprites() for spr in sprites: spr.draw(surface) self.lostsprites = []<|fim_prefix|># repo: OrIOg/TronRacerTest path: /Entities/EntityGroup.py import pygame class EntityGroup(pygam...
code_fim
easy
{ "lang": "python", "repo": "OrIOg/TronRacerTest", "path": "/Entities/EntityGroup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sprites = self.sprites() for spr in sprites: spr.draw(surface) self.lostsprites = []<|fim_prefix|># repo: OrIOg/TronRacerTest path: /Entities/EntityGroup.py import pygame class EntityGroup(pygame.sprite.Group): <|fim_middle|> def __init__(self): pygame.sp...
code_fim
medium
{ "lang": "python", "repo": "OrIOg/TronRacerTest", "path": "/Entities/EntityGroup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># The first operator is a convolution. assert(op_code.BuiltinCode() == tflite.BuiltinOperator.CONV_2D) # Custom operator need more interface, won't cover here. assert(op_code.BuiltinCode() != tflite.BuiltinOperator.CUSTOM) ############# the operator ################################################## #...
code_fim
hard
{ "lang": "python", "repo": "GAOHunter/tflite", "path": "/tests/mobilenet_example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GAOHunter/tflite path: /tests/mobilenet_example.py import tflite import util_for_test # Example of parsing a TFLite model with `tflite` python package. # Use this package, you can *import* the `tflite* package ONLY ONCE. # Otherwise, you need to import every class when using them. def read_mode...
code_fim
hard
{ "lang": "python", "repo": "GAOHunter/tflite", "path": "/tests/mobilenet_example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>############# quant ####################################################### # Quantization parameters of the tensor, only valid for quantized model quant = tensor.Quantization() # Scale and zero point assert(quant.ScaleAsNumpy()[0] == 0.02182667888700962) assert(quant.ZeroPointAsNumpy()[0] == 151) # Mi...
code_fim
hard
{ "lang": "python", "repo": "GAOHunter/tflite", "path": "/tests/mobilenet_example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmsherr/niobeta path: /test_lift_block.py from unittest.mock import patch from nio.testing.block_test_case import NIOBlockTestCase from nio import Signal from ..filter_block import Filter class LiftSignal(Signal): def __init__(self, val): super().__init__() self.val = val...
code_fim
hard
{ "lang": "python", "repo": "dmsherr/niobeta", "path": "/test_lift_block.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }