text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: toakarsky/galactica path: /engine/input.py import pygame from galactica import settings from .events import Events class Input: _input = None class _Input: def __init__(self, DEBUG): <|fim_suffix|> self.handle_events() def isKeyPressed(self, key): ...
code_fim
hard
{ "lang": "python", "repo": "toakarsky/galactica", "path": "/engine/input.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return key in self.pressedButtons @staticmethod def GetInput(DEBUG=None): if Input._input == None: Input._input = Input._Input( DEBUG=DEBUG ) return Input._input<|fim_prefix|># repo: toakarsky/galactica path: /engine/input.py im...
code_fim
hard
{ "lang": "python", "repo": "toakarsky/galactica", "path": "/engine/input.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def update(self): self.handle_events() def isKeyPressed(self, key): return key in self.pressedButtons @staticmethod def GetInput(DEBUG=None): if Input._input == None: Input._input = Input._Input( DEBUG=DEBUG ...
code_fim
hard
{ "lang": "python", "repo": "toakarsky/galactica", "path": "/engine/input.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @command(description=XKCD_DESCRIPTION, aliases=["x"]) async def xkcd(self, ctx: Context) -> None: """ Fetch an XKCD comic and allow the user to either get a random one (no params) or specify a number Parameters ----------- ctx: Context ...
code_fim
medium
{ "lang": "python", "repo": "fugwenna/bunkbot", "path": "/src/xkcd/xkcd_cog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fugwenna/bunkbot path: /src/xkcd/xkcd_cog.py from discord.ext.commands import command, Context, Cog from .xkcd_service import XKCDService from ..bunkbot import BunkBot from ..core.registry import XKCD_SERVICE XKCD_DESCRIPTION: str = "Get a random XKCD comic or specify the comic number" class ...
code_fim
hard
{ "lang": "python", "repo": "fugwenna/bunkbot", "path": "/src/xkcd/xkcd_cog.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> await ctx.send(embed=embed) except Exception as ex: print(ex) def setup(bot: BunkBot) -> None: bot.add_cog(XKCDCog(XKCD_SERVICE))<|fim_prefix|># repo: fugwenna/bunkbot path: /src/xkcd/xkcd_cog.py from discord.ext.commands import command, Context, Cog from .xkcd_...
code_fim
hard
{ "lang": "python", "repo": "fugwenna/bunkbot", "path": "/src/xkcd/xkcd_cog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> copyfile(os.path.join(gif_folder, parcellation_f), os.path.join(save_folder, folder_num, 'parcellation.nii.gz')) copyfile(os.path.join(gif_folder, circumference_f), os.path.join(save_folder, folder_num, 'circumference.nii.gz'))<|fim_prefix|># repo: EdgarRios111/pytorch-mri-segmentation-3D path: /utils/...
code_fim
hard
{ "lang": "python", "repo": "EdgarRios111/pytorch-mri-segmentation-3D", "path": "/utils/processGIFS.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EdgarRios111/pytorch-mri-segmentation-3D path: /utils/processGIFS.py import os import sys import glob from shutil import copyfile gif_folders_path = '../../../T1s/results/' save_folder = '../../Data/MS2017b/gifs/' gif_folders = glob.glob(gif_folders_path + '*') print(gif_folders_path) if not...
code_fim
medium
{ "lang": "python", "repo": "EdgarRios111/pytorch-mri-segmentation-3D", "path": "/utils/processGIFS.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # node color, size node_size = kwargs.get('node_size') if node_size is None: node_scale_by = kwargs.get('node_scale_by', 5000) node_size = [node_scale_by*(len(_) / len(y)) for n,_ in G.nodes(data='members')] node_color = [Counter(c_hex[_]).most_common()[0][0] for n,_ in G.n...
code_fim
hard
{ "lang": "python", "repo": "braindynamicslab/dyneusr", "path": "/dyneusr/tools/networkx_utils.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_prefix|># repo: braindynamicslab/dyneusr path: /dyneusr/tools/networkx_utils.py """ Network plotting helper functions. """ from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals from collections import Counter from ins...
code_fim
hard
{ "lang": "python", "repo": "braindynamicslab/dyneusr", "path": "/dyneusr/tools/networkx_utils.py", "mode": "psm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> try: # new Cover API from kmapper==1.2.0 bins = np.copy(cover.centers_) # transform each node cover_cubes = {} for i, center in enumerate(cover.centers_): lower = center - cover.radius_ upper = center + cover.radius_ cove...
code_fim
hard
{ "lang": "python", "repo": "braindynamicslab/dyneusr", "path": "/dyneusr/tools/networkx_utils.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> # binding.update({"timer_template": 'declare_timer_periodic'}) # self.timer_block.update({key: binding}) binding.update({"variable_template": [('declare_timer_periodic', 'TIMER_BINDING')]}) self.variables_block.update({key: ...
code_fim
hard
{ "lang": "python", "repo": "bawilless/AzureSphereGenX", "path": "/Generator/builders/timer_bindings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bawilless/AzureSphereGenX path: /Generator/builders/timer_bindings.py class Builder(): def __init__(self, data, signatures, variables_block, handlers_block, timer_block): self.bindings = list(elem for elem in data.get('bindings').get('timers') if elem.get('enabled', True) == True) <|...
code_fim
hard
{ "lang": "python", "repo": "bawilless/AzureSphereGenX", "path": "/Generator/builders/timer_bindings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: greenblat/vlsistuff path: /axi_noc/tbx16/counts.py nts += monitorStuff("tb.dut.merge215.axi_wr_4_merger.c_aw_fifo.int_count") counts += monitorStuff("tb.dut.merge215.axi_wr_4_merger.c_b_fifo.next_count") counts += monitorStuff("tb.dut.merge215.axi_wr_4_merger.c_b_fifo.count") counts +...
code_fim
hard
{ "lang": "python", "repo": "greenblat/vlsistuff", "path": "/axi_noc/tbx16/counts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.axi_wr_4_merger.panic_bcount")) logs.log_info("SNP %x tb.dut.merge13.axi_wr_4_merger.panic_ccount" % logs.peek("tb.dut.merge13.axi_wr_4_merger.panic_ccount")) logs.log_info("SNP %x tb.dut.merge13.axi_wr_4_merger.panic_dcount" % logs.peek("tb.dut.merge13.axi_wr_4_merger.panic_dcount")) logs....
code_fim
hard
{ "lang": "python", "repo": "greenblat/vlsistuff", "path": "/axi_noc/tbx16/counts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: greenblat/vlsistuff path: /axi_noc/tbx16/counts.py count") counts += monitorStuff("tb.dut.split100.axi_wr_4_splitter.b_fifo.next_count") counts += monitorStuff("tb.dut.split100.axi_wr_4_splitter.b_fifo.count") counts += monitorStuff("tb.dut.split100.axi_wr_4_splitter.back_bid_a_fifo.c...
code_fim
hard
{ "lang": "python", "repo": "greenblat/vlsistuff", "path": "/axi_noc/tbx16/counts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ansport as BiddingSeasonalityAdjustmentServiceGrpcTransport, )<|fim_prefix|># repo: henribru/google-ads-stubs path: /google-stubs/ads/googleads/v12/services/services/bidding_seasonality_adjustment_service/transports/__init__.pyi from .base import ( BiddingSeasonalityAdjustmentServiceTr<|fim_middle|>a...
code_fim
medium
{ "lang": "python", "repo": "henribru/google-ads-stubs", "path": "/google-stubs/ads/googleads/v12/services/services/bidding_seasonality_adjustment_service/transports/__init__.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: henribru/google-ads-stubs path: /google-stubs/ads/googleads/v12/services/services/bidding_seasonality_adjustment_service/transports/__init__.pyi from .base import ( BiddingSeasonalityAdjustmentServiceTr<|fim_suffix|>m .grpc import ( BiddingSeasonalityAdjustmentServiceGrpcTransport as Bidd...
code_fim
medium
{ "lang": "python", "repo": "henribru/google-ads-stubs", "path": "/google-stubs/ads/googleads/v12/services/services/bidding_seasonality_adjustment_service/transports/__init__.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>m .grpc import ( BiddingSeasonalityAdjustmentServiceGrpcTransport as BiddingSeasonalityAdjustmentServiceGrpcTransport, )<|fim_prefix|># repo: henribru/google-ads-stubs path: /google-stubs/ads/googleads/v12/services/services/bidding_seasonality_adjustment_service/transports/__init__.pyi from .base imp...
code_fim
medium
{ "lang": "python", "repo": "henribru/google-ads-stubs", "path": "/google-stubs/ads/googleads/v12/services/services/bidding_seasonality_adjustment_service/transports/__init__.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: srinuvasan-mentor/mtda path: /mtda/power/aviosys_8800.py # --------------------------------------------------------------------------- # aviosys power driver for MTDA # --------------------------------------------------------------------------- # # This software is a part of MTDA. # Copyright (c)...
code_fim
hard
{ "lang": "python", "repo": "srinuvasan-mentor/mtda", "path": "/mtda/power/aviosys_8800.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def command(self, args): return False def on(self): """ Power on the attached device""" status = self.dev.ctrl_transfer(0x40, 0x01, 0x0001, 0xa0, []) if status == 0: self.ev.set() return (status == 0) def off(self): """ Power off th...
code_fim
hard
{ "lang": "python", "repo": "srinuvasan-mentor/mtda", "path": "/mtda/power/aviosys_8800.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sentiments = [] passed = 0 total = 0 with open("initial_data/movie_list.txt", 'r') as movie_file: titles = movie_file.readlines() for ctr , title in enumerate(titles): try: m_title = title.strip() print(m_title) scene_sentiments = get_sentiment_by_scene(...
code_fim
medium
{ "lang": "python", "repo": "bdizon/Cinefy", "path": "/scrape_movies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bdizon/Cinefy path: /scrape_movies.py import json from initial_data.titles import titles from shared.sentiment import get_sentiment_by_scene def average_sentiment(movie_sentiment_array): keys = movie_sentiment_array[0].keys() avg_senti = {} for senti in movie_sentiment_array: ...
code_fim
medium
{ "lang": "python", "repo": "bdizon/Cinefy", "path": "/scrape_movies.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> total += 1 except: print("skipped {}".format(title)) pass with open("initial_data/initialdata.json", 'w') as fopen: fopen.write(json.dumps(sentiments, indent=4)) print(passed / total)<|fim_prefix|># repo: bdizon/Cinefy path: /scrape_movies.py import json ...
code_fim
hard
{ "lang": "python", "repo": "bdizon/Cinefy", "path": "/scrape_movies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pkalliok/almost-bad-poetry path: /runogen.cgi #!/usr/bin/env python3 # coding: utf-8 from ingest import load_url, save_state, load_state from measures import measure_map, generate_poem import html, sys STATE_FILE = 'used_stanzas.pickle' HTTP_START = """Content-type: text/html; charset=utf-8 <...
code_fim
hard
{ "lang": "python", "repo": "pkalliok/almost-bad-poetry", "path": "/runogen.cgi", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def make_poem(measure, corpus_url): if measure not in measure_map: raise ValueError("unknown measure") p(HTTP_START.format(measure.capitalize() + ' sinulle')) p('<p>(tässä saattaa kestää....)</p>') state = load_url(corpus_url) load_state(state, STATE_FILE) p('<p>Tässä runosi, ole h...
code_fim
hard
{ "lang": "python", "repo": "pkalliok/almost-bad-poetry", "path": "/runogen.cgi", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def handle_request(form): if 'tee_runo' in form: make_poem(form.getfirst('tee_runo'), form.getfirst('url')) else: show_form(form) if __name__ == '__main__': import cgi try: handle_request(cgi.FieldStorage()) except: cgi.print_exception()<|fim_prefix|># repo: pkalliok/almost-ba...
code_fim
hard
{ "lang": "python", "repo": "pkalliok/almost-bad-poetry", "path": "/runogen.cgi", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DCnomics/hard_way_for_python path: /ex4.py 자동차 = 100 차_안_공간 = 4.0 운전사 = 30 승객 = 90 운행_안하는_차 = 자동차 - 운전사 운행하는_차 = 운전사 총_정원 = 운행하는_차 * 차_안_공간 차당_평균_승객 = 승객 / 운행하는_차 <|fim_suffix|>이름 = '정동철' 나이 = 31 키 = 177 몸무게 = 70 눈 = '갈색' 이 = '하양' 머리 = '갈색' print(f"{이름}에 대해 이야기해 보죠.") print(f"키는 {키} 센티미터구요.") p...
code_fim
hard
{ "lang": "python", "repo": "DCnomics/hard_way_for_python", "path": "/ex4.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># 이 줄은 까다롭지만 정확히 따라하세요 합 = 나이 + 키 + 몸무게 print(f"{나이}, {키}, {몸무게}를 모두 더하면 {합} 랍니다.")<|fim_prefix|># repo: DCnomics/hard_way_for_python path: /ex4.py 자동차 = 100 차_안_공간 = 4.0 운전사 = 30 승객 = 90 운행_안하는_차 = 자동차 - 운전사 운행하는_차 = 운전사 총_정원 = 운행하는_차 * 차_안_공간 차당_평균_승객 = 승객 / 운행하는_차 <|fim_middle|>print("자동차", 자동차, "대가...
code_fim
hard
{ "lang": "python", "repo": "DCnomics/hard_way_for_python", "path": "/ex4.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lhericourt/trading path: /airflow/dags/candles_aggregation_dag.py import logging from airflow import DAG from operators.candles_aggregation import CandleAggregation <|fim_suffix|>with DAG(dag_id='trading_candles_aggregation', schedule_interval="@monthly", default_args=default_args) as dag: ...
code_fim
hard
{ "lang": "python", "repo": "lhericourt/trading", "path": "/airflow/dags/candles_aggregation_dag.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with DAG(dag_id='trading_candles_aggregation', schedule_interval="@monthly", default_args=default_args) as dag: aggregated_candles = CandleAggregation(task_id='candles_aggregation', provide_context=True, scope='month')<|fim_prefix|># repo: lhericourt/trading path: /airflow/dags/candles_aggregation_d...
code_fim
hard
{ "lang": "python", "repo": "lhericourt/trading", "path": "/airflow/dags/candles_aggregation_dag.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>default_args = { 'start_date': datetime(2020, 12, 23), 'owner': 'airflow', 'retries': 3, 'retry_delay': timedelta(minutes=1), 'max_active_runs': 1, 'catchup': True } with DAG(dag_id='trading_candles_aggregation', schedule_interval="@monthly", default_args=default_args) as dag: ...
code_fim
medium
{ "lang": "python", "repo": "lhericourt/trading", "path": "/airflow/dags/candles_aggregation_dag.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lapic-ufjf/evolutionary-ACS-benchmark path: /experiments/004_plot_pareto_front.py import os from pprint import pprint import numpy as np from pymoo.factory import get_problem from pymoo.visualization.scatter import Scatter from acs.objective import reduce_objectives from read.algorithm import ...
code_fim
hard
{ "lang": "python", "repo": "lapic-ufjf/evolutionary-ACS-benchmark", "path": "/experiments/004_plot_pareto_front.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print('Comparing GA with NSGA-II using two objetives') # print('=============================================\n') # instances_results_name = create_results_name_list(instances, ['ga'], ['nsga_ii'], [2, 3]) # for (instance_name, results_name_list) in instances_results_name.items(): # print(instance...
code_fim
hard
{ "lang": "python", "repo": "lapic-ufjf/evolutionary-ACS-benchmark", "path": "/experiments/004_plot_pareto_front.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ print("Plotting initial points...") plt.figure(1) for trace in traces: for point in trace: plt.scatter(point[0], point[1], c='r', alpha=0.2) print("Plotting preprocessed points...") plt.figure(3) for trace in processed_traces: for point in trace: plt.scatter(point[0], point[1...
code_fim
medium
{ "lang": "python", "repo": "bhaveshk658/graphgen", "path": "/random/gravity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ print("Plotting initial points...") plt.figure(1) for trace in traces: for point in trace: plt.scatter(point[0], point[1], c='r', alpha=0.2) print("Plotting preprocessed points...") plt.figure(3) for trace in processed_traces: for point in trace: plt.scatter(point[0], point[...
code_fim
hard
{ "lang": "python", "repo": "bhaveshk658/graphgen", "path": "/random/gravity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhaveshk658/graphgen path: /random/gravity.py import graphgen from graphgen.data import get_training_data, clean, gravity from graphgen.graph import Graph, Node from graphgen.generate import convert_to_graph from graphgen.data.utils import direction import numpy as np import matplotlib.pyplot as...
code_fim
medium
{ "lang": "python", "repo": "bhaveshk658/graphgen", "path": "/random/gravity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # read the mask image word_mask = np.array(Image.open(path.join(d, "./figures/circle_mask2.png"))) # construct wordcloud wc = WordCloud(background_color="white", max_words=100, mask=word_mask,\ stopwords=STOPWORDS.add("and")) print "generating word cloud ..." for ...
code_fim
medium
{ "lang": "python", "repo": "vsmolyakov/ml", "path": "/lda/python/word_cloud.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vsmolyakov/ml path: /lda/python/word_cloud.py #!/usr/bin/env python2 """ Masked wordcloud ================ Using a mask you can generate wordclouds in arbitrary shapes. """ from os import path from PIL import Image import numpy as np import matplotlib.pyplot as plt from wordcloud import WordClo...
code_fim
hard
{ "lang": "python", "repo": "vsmolyakov/ml", "path": "/lda/python/word_cloud.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Filters out all tweets that are longer than # The defined length, not including hashtags def TweetsShorterThanMaximumLength(self, original_list, length): short_list = list() manipulator = TwitterUtils() for status in original_list: # Remove hashtags and then count the length status_t...
code_fim
hard
{ "lang": "python", "repo": "MosheBerman/brisket-mashup", "path": "/source/TwitterFetcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MosheBerman/brisket-mashup path: /source/TwitterFetcher.py # # This class downloads the movies from # Twitter and parses them out for us. # from keys import APIKeys # Abstract out aPI keys for privacy from TwitterUtils import TwitterUtils # Utility to manipulate Tweets import twitter # Ba...
code_fim
hard
{ "lang": "python", "repo": "MosheBerman/brisket-mashup", "path": "/source/TwitterFetcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def generate_grammar(bnf_grammar, token_namespace): """ ``bnf_text`` is a grammar in extended BNF (using * for repetition, + for at-least-once repetition, [] for optional parts, | for alternatives and () for grouping). It's not EBNF according to ISO/IEC 14977. It's a dialect Python us...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/parso/py2/parso/pgen2/generator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: catboost/catboost path: /contrib/python/parso/py2/parso/pgen2/generator.py # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. # Modifications: # Copyright David Halter and Contributors # Modifications are dual-licensed: MIT and PS...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/parso/py2/parso/pgen2/generator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return '%s(%s)' % (self.__class__.__name__, self.value) def _simplify_dfas(dfas): """ This is not theoretically optimal, but works well enough. Algorithm: repeatedly look for two states that have the same set of arcs (same labels pointing to the same nodes) and unify them, un...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/parso/py2/parso/pgen2/generator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wanyine/wanyine path: /home/tests.py """ This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from datetime import date, timedelta from django.test import TestCase from d...
code_fim
hard
{ "lang": "python", "repo": "wanyine/wanyine", "path": "/home/tests.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def create_profile(self, username = 'test', balance = 0): user = models.User.objects.create_user(username) profile = models.Profile(user = user, balance = balance) profile.save() return profile def create_policy(self, sponsor, kickoff = date.today()): poli...
code_fim
hard
{ "lang": "python", "repo": "wanyine/wanyine", "path": "/home/tests.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_sponse(self): request = HttpRequest() request.user = models.User.objects.create_user('test') response = views.sponse(request) self.assertTrue(response) class AjaxTest(TestCase): def test_sayHello(self): response = ajax.sayHello(HttpRequest()) ...
code_fim
hard
{ "lang": "python", "repo": "wanyine/wanyine", "path": "/home/tests.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for x in transaction.inputs: if x.id not in unspent_ids: failed1 = True if x.id in used_ids_in_this_txn: failed2 = True used_ids_in_this_txn.append(x.id) if failed1: ...
code_fim
hard
{ "lang": "python", "repo": "n4kashu/yadacoin", "path": "/yadacoin/miningpool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def broadcast_block(cls, block): Peers.init() dup_test = Mongo.db.consensus.find_one({ 'peer': 'me', 'index': block.index, 'block.version': BU.get_version_for_height(block.index) }) if not dup_test: print ...
code_fim
hard
{ "lang": "python", "repo": "n4kashu/yadacoin", "path": "/yadacoin/miningpool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: n4kashu/yadacoin path: /yadacoin/miningpool.py import time import requests from bitcoin.wallet import P2PKHBitcoinAddress from config import Config from mongo import Mongo from peers import Peers from block import Block, BlockFactory from blockchain import Blockchain from blockchainutils import B...
code_fim
hard
{ "lang": "python", "repo": "n4kashu/yadacoin", "path": "/yadacoin/miningpool.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 0D0AResearch/gym-bandits path: /gym_bandits/scoreboard.py from gym.scoreboard.registration import add_task, add_group add_group( id='bandits', name='Bandits', description='Various N-Armed Bandit environments' ) add_task( id='BanditTwoArmedDeterministicFixed-v0', group='band...
code_fim
hard
{ "lang": "python", "repo": "0D0AResearch/gym-bandits", "path": "/gym_bandits/scoreboard.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Every bandit always pays out Each action has a reward mean (selected from a normal distribution with mean 0 and std 1), and the actual reward returns is selected with a std of 1 around the selected mean """, background="Described on page 30 of Sutton and Barto's [Reinforcement Learning...
code_fim
hard
{ "lang": "python", "repo": "0D0AResearch/gym-bandits", "path": "/gym_bandits/scoreboard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Import a global unit registry as each initialization is incompatible with each other from .stdVars import ureg # Table and combined table from .table import Combined, TexTable<|fim_prefix|># repo: htrojan/TexUtils path: /__init__.py import os import sys import math # Import often used modules import n...
code_fim
medium
{ "lang": "python", "repo": "htrojan/TexUtils", "path": "/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: htrojan/TexUtils path: /__init__.py import os import sys import math # Import often used modules import numpy as np from pint import UnitRegistry from scipy import constants as const from scipy.optimize import curve_fit from uncertainties import ufloat from uncertainties import unumpy as unp <|...
code_fim
medium
{ "lang": "python", "repo": "htrojan/TexUtils", "path": "/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>html', sidB + '.html' if os.path.exists(fA): shutil.copy(fA, fB) elif os.path.exists(fB): shutil.copy(fB, fA) else: print('Neither %s nor %s found' % (fA, fB))<|fim_prefix|># repo: thotypous/moodle-assign-scripts path: /copy_pairs.py #!/usr/bin/...
code_fim
medium
{ "lang": "python", "repo": "thotypous/moodle-assign-scripts", "path": "/copy_pairs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thotypous/moodle-assign-scripts path: /copy_pairs.py #!/usr/bin/python3 import re import sys import os import shutil for line in sys.stdin: if ',' in line: sidA, sidB = [re.search(r'^\s*(\d+)', x).group(1) for x in line.split(',')] fA, fB = sidA + '.<|fim_suffix|>sts(fB): ...
code_fim
medium
{ "lang": "python", "repo": "thotypous/moodle-assign-scripts", "path": "/copy_pairs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sts(fB): shutil.copy(fB, fA) else: print('Neither %s nor %s found' % (fA, fB))<|fim_prefix|># repo: thotypous/moodle-assign-scripts path: /copy_pairs.py #!/usr/bin/python3 import re import sys import os import shutil for line in sys.stdin: if ',' in line: <|fim_middl...
code_fim
hard
{ "lang": "python", "repo": "thotypous/moodle-assign-scripts", "path": "/copy_pairs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i, row in enumerate( gsagtab[gsag_ext].data ): lx = row['lx'] ly = row['ly'] dx = row['dx'] dy = row['dy'] if not i: ax.plot( [lx, lx+dx, lx+dx, lx, lx], [ly, ly, ly+dy, ly+dy, ly], color='r', label='Flagged Low Gain' ) else: ...
code_fim
hard
{ "lang": "python", "repo": "jhunkeler/cosmo", "path": "/cos_monitoring/simulations/show_blue.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ax.set_xlim(0, 16384) ax.set_ylim(300, 800) ax.legend( shadow=True, numpoints=1 ) ax.set_xlabel('XCORR') ax.set_ylabel('YCORR') ax.set_title('%s at HV=163 and LP2' % segment) raw_input() fig.savefig( 'LP2_%s_blue_extraction.pdf' % (segment), bbox_inches='tight' ) i...
code_fim
hard
{ "lang": "python", "repo": "jhunkeler/cosmo", "path": "/cos_monitoring/simulations/show_blue.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jhunkeler/cosmo path: /cos_monitoring/simulations/show_blue.py import matplotlib.pyplot as plt import pyfits import numpy as np #plt.ioff() plt.ion() gsagtab = pyfits.open('/grp/hst/cdbs/lref/x6l1439el_gsag.fits') xtractab = pyfits.open('/grp/hst/cdbs/lref/x6q17586l_1dx.fits') gainmap = pyfits....
code_fim
hard
{ "lang": "python", "repo": "jhunkeler/cosmo", "path": "/cos_monitoring/simulations/show_blue.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: wuchen-huawei/huaweicloud-sdk-python-v3 path: /huaweicloud-sdk-swr/huaweicloudsdkswr/v2/swr_async_client.py _params = request.get_file_stream() response_headers = [] header_params['Content-Type'] = http_utils.select_header_content_type( ['application/json']) ...
code_fim
hard
{ "lang": "python", "repo": "wuchen-huawei/huaweicloud-sdk-python-v3", "path": "/huaweicloud-sdk-swr/huaweicloudsdkswr/v2/swr_async_client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :param DeleteUserRepositoryAuthRequest request :return: DeleteUserRepositoryAuthResponse """ return self.delete_user_repository_auth_with_http_info(request) def delete_user_repository_auth_with_http_info(self, request): """删除镜像权限 删除镜像权限 :param...
code_fim
hard
{ "lang": "python", "repo": "wuchen-huawei/huaweicloud-sdk-python-v3", "path": "/huaweicloud-sdk-swr/huaweicloudsdkswr/v2/swr_async_client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sjpacwa/SBChain path: /node.py """ node.py This file defines the Node class which is used to store node specific information. 2020 Stephen Pacwa and Daniel Okazaki Santa Clara University """ # Standard library imports from hashlib import sha1 # Local imports from blockchain import Blockchain ...
code_fim
hard
{ "lang": "python", "repo": "sjpacwa/SBChain", "path": "/node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if benchmark: from threading import Semaphore self.metadata['benchmark_lock'] = Semaphore(0) if self.metadata['uuid'] == 'SYSTEM': raise InvalidID initialize_log(self.metadata['uuid'], debug) # Create the Blockchain object. sel...
code_fim
hard
{ "lang": "python", "repo": "sjpacwa/SBChain", "path": "/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lichao88/rcaudio path: /demo.py from rcaudio import * import time import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s') def demo1(): CR = CoreRecorder( time = 10, sr = 1000, ...
code_fim
hard
{ "lang": "python", "repo": "lichao88/rcaudio", "path": "/demo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> SR = SimpleRecorder(sr = 20000) BA = BeatAnalyzer(rec_time = 15, initial_bpm = 120, smooth_ratio = .8) VA = VolumeAnalyzer(rec_time = 1) SR.register(BA) SR.register(VA) SR.start() low_volume_count = 0 while True: v = VA.get_volume() if v < 50: l...
code_fim
hard
{ "lang": "python", "repo": "lichao88/rcaudio", "path": "/demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: criteo-forks/hue path: /desktop/core/ext-py/pytest-django-3.10.0/pytest_django_test/settings_postgres.py from .settings_base import * # noqa: F401 F403 # PyPy compatibility try: from psycopg2ct import compat <|fim_suffix|>DATABASES = { "default": { "ENGINE": "django.db.backends...
code_fim
easy
{ "lang": "python", "repo": "criteo-forks/hue", "path": "/desktop/core/ext-py/pytest-django-3.10.0/pytest_django_test/settings_postgres.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql_psycopg2", "NAME": "pytest_django_should_never_get_accessed", "HOST": "localhost", "USER": "", } }<|fim_prefix|># repo: criteo-forks/hue path: /desktop/core/ext-py/pytest-django-3.10.0/pytest_djang...
code_fim
medium
{ "lang": "python", "repo": "criteo-forks/hue", "path": "/desktop/core/ext-py/pytest-django-3.10.0/pytest_django_test/settings_postgres.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mehta-lab/microDL path: /tests/test_zarr_reading.py #!/usr/bin/python ''' Script for testing .zarr reading. Compares with .tiff reader to show that output preprocessed tiles and metadata are the same from both inputs: ''' from copy import deepcopy import numpy as np import numpy.testing import ...
code_fim
hard
{ "lang": "python", "repo": "mehta-lab/microDL", "path": "/tests/test_zarr_reading.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Run tests print('Running tests on tiles metadata and files') # Get output config files file_name = os.path.join(zarr_preprocess_config['output_dir'], 'preprocess_config.json') zarr_out_config = aux_utils.read_json(file_name) file_name = os.path.join(tiff_preprocess_config['output...
code_fim
hard
{ "lang": "python", "repo": "mehta-lab/microDL", "path": "/tests/test_zarr_reading.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lasofivec/slmp path: /main.py #! /usr/bin/python from geometry import z, X_mat, Y_mat, jac, eta1, eta2, npatchs, list_patchs from scipy.sparse.linalg import spsolve, splu from scipy.interpolate import interp2d from scipy.io import mmread, mmwrite import igakit.nurbs as nurbs from scipy import int...
code_fim
hard
{ "lang": "python", "repo": "lasofivec/slmp", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> zn = np.copy(znp1) zn[np.where(abs(zn) < 10**-10)] = 0. # ----------------------------------------------- # Printing of results and time-relative error #------------------------------------------------ if ((tstep == 1)or(tstep%viewstep == 0)or(tstep == nstep-1)) : list_ti...
code_fim
hard
{ "lang": "python", "repo": "lasofivec/slmp", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Computing the characteristics' origin char_eta1, char_eta2, where_char = get_pat_char(eta1, eta2, advec, dt) # Extracting the particles that stay in their own domain: char_eta1_id = np.copy(char_eta1) char_eta2_id = np.copy(char_eta2) tab_ind_out = [] for npat in list_patchs: ind_out_pat = np.whe...
code_fim
hard
{ "lang": "python", "repo": "lasofivec/slmp", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>while True: try: select = input("Enter the S.No corresponding the match: ") if select.strip() == 'q': break details(x[int(select)][0]) except: print("Invalid input!")<|fim_prefix|># repo: debasishbai/Cricket-Scorecard--python path: /Cricket-Scorecard/cricket-scorecard.py import json ...
code_fim
medium
{ "lang": "python", "repo": "debasishbai/Cricket-Scorecard--python", "path": "/Cricket-Scorecard/cricket-scorecard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: debasishbai/Cricket-Scorecard--python path: /Cricket-Scorecard/cricket-scorecard.py import json from time import sleep import requests def match(): d = {} count = 1 template1 = "http://cricapi.com/api/cricket" data = requests.get(template1) js = data.json() if js['cache']: for...
code_fim
hard
{ "lang": "python", "repo": "debasishbai/Cricket-Scorecard--python", "path": "/Cricket-Scorecard/cricket-scorecard.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> template2 = "http://cricapi.com/api/cricketScore?unique_id=" url = template2 + str(y) data = requests.get(url) js = data.json() print() if js['cache']: print(js['team-1'],"Vs",js['team-2']) print(js['score']) print(js['innings-requirement']) print() x = match() print("No.of Ongoi...
code_fim
medium
{ "lang": "python", "repo": "debasishbai/Cricket-Scorecard--python", "path": "/Cricket-Scorecard/cricket-scorecard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hunsteve/NNEF-Tools path: /nnef_tools/core/matcher.py # Copyright (c) 2017 The Khronos Group Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apa...
code_fim
hard
{ "lang": "python", "repo": "hunsteve/NNEF-Tools", "path": "/nnef_tools/core/matcher.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def copy(self, dict_so_far=None, allow_multi_consumer=None, allow_multi_consumer_inside=None, follow_producer=None): return _MatchSettings(dict_so_far=utils.first_set(dict_so_far, self.dict_so_far), allow_multi_c...
code_fim
hard
{ "lang": "python", "repo": "hunsteve/NNEF-Tools", "path": "/nnef_tools/core/matcher.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def operations(self): assert self._did_match return list(set(v for v in six.itervalues(self._dict) if isinstance(v, BaseOperation))) def __nonzero__(self): # for python 2 return self._did_match def __bool__(self): # for python 3 return self._di...
code_fim
hard
{ "lang": "python", "repo": "hunsteve/NNEF-Tools", "path": "/nnef_tools/core/matcher.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: skelsec/minidump path: /minidump/streams/__init__.py from .CommentStreamA import * from .CommentStreamW import * from .ContextStream import * from .ExceptionStream import * from .FunctionTableStream import * from .HandleDataStream import * from .HandleOperationListStream import * from .JavaScript...
code_fim
hard
{ "lang": "python", "repo": "skelsec/minidump", "path": "/minidump/streams/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = __CommentStreamA__ + __CommentStreamW__ + __ContextStream__ + __ExceptionStream__ + __FunctionTableStream__ + __HandleDataStream__ + __HandleOperationListStream__ + __JavaScriptDataStream__ + __LastReservedStream__ + __Memory64ListStream__ + __MemoryInfoListStream__ + __MemoryListStream__ + __Mi...
code_fim
hard
{ "lang": "python", "repo": "skelsec/minidump", "path": "/minidump/streams/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Oscar-Rod/SnakeGame path: /snakegame/game/button.py import pygame colors_dictionary = { "red": (200, 0, 0), "green": (0, 200, 0), "white": (255, 255, 255), "black": (0, 0, 0) } class Button: stop_the_game = "Button to stop the game" start_the_game = "Button to start the...
code_fim
hard
{ "lang": "python", "repo": "Oscar-Rod/SnakeGame", "path": "/snakegame/game/button.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.color = color self.text = text pygame.draw.rect(self.screen, self.color, ( self.center[0] - self.width / 2, self.center[1] - self.height / 2, self.width, self.height)) self.text_surface = self.font.render(self.text, True, self.text_color) ...
code_fim
medium
{ "lang": "python", "repo": "Oscar-Rod/SnakeGame", "path": "/snakegame/game/button.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._update(self.text, self.color) self.screen.blit(self.text_surface, self.rect) def _update(self, text, color): self.color = color self.text = text pygame.draw.rect(self.screen, self.color, ( self.center[0] - self.width / 2, self.center[1] - self...
code_fim
medium
{ "lang": "python", "repo": "Oscar-Rod/SnakeGame", "path": "/snakegame/game/button.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: keep-learning-cmd/noisyFER path: /loader/dataloader_raf.py import torch import scipy.misc as m import os import csv import numpy as np from tqdm import tqdm from torch.utils import data import cv2 from transforms import initAlignTransfer import time # RAF: 1: surprise, 2: fear, 3: disgust, 4: ha...
code_fim
hard
{ "lang": "python", "repo": "keep-learning-cmd/noisyFER", "path": "/loader/dataloader_raf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> img = img.transpose((2, 0, 1)) # [H,W,C] --> [C,H,W] img = ((img / 255.0 - 0.5) / 0.5) # normalize to [-1, 1] img = torch.from_numpy(img).float() exp_lbl = self.lbl_list[index] return img, exp_lbl, img_path<|fim_prefix|># repo: keep-learning-cmd/noisyFER path: /...
code_fim
hard
{ "lang": "python", "repo": "keep-learning-cmd/noisyFER", "path": "/loader/dataloader_raf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Haldir65/Jimmy path: /tutorial/hello.py #!/usr/bin/python3 print("COntent-type:text/html\r\n<|fim_suffix|>ello there"+str(i)+" </h2>") print("</body></html>")<|fim_middle|>\r\n") print("<html><body>") print("<h1>It works really ! </h>") for i in range(5): print("<h2>H
code_fim
medium
{ "lang": "python", "repo": "Haldir65/Jimmy", "path": "/tutorial/hello.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Haldir65/Jimmy path: /tutorial/hello.py #!/usr/bin/python3 print("COntent-type:text/html\r\n\r\n") print("<html><body>") print("<h1>It works rea<|fim_suffix|>ello there"+str(i)+" </h2>") print("</body></html>")<|fim_middle|>lly ! </h>") for i in range(5): print("<h2>H
code_fim
easy
{ "lang": "python", "repo": "Haldir65/Jimmy", "path": "/tutorial/hello.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ello there"+str(i)+" </h2>") print("</body></html>")<|fim_prefix|># repo: Haldir65/Jimmy path: /tutorial/hello.py #!/usr/bin/python3 print("COntent-type:text/html\r\n\r\n") print("<html><body>") print("<h1>It works rea<|fim_middle|>lly ! </h>") for i in range(5): print("<h2>H
code_fim
easy
{ "lang": "python", "repo": "Haldir65/Jimmy", "path": "/tutorial/hello.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BrianSipple/dedupe path: /test/test_haversine.py import unittest from dedupe.distance.haversine import compareLatLong import numpy class TestHaversine(unittest.TestCase): <|fim_suffix|> def test_haversine_na(self): km_dist_na = compareLatLong((0.0, 0.0), (1.0, 2.0)) assert num...
code_fim
hard
{ "lang": "python", "repo": "BrianSipple/dedupe", "path": "/test/test_haversine.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertAlmostEqual(km_dist_val, 2964, -1) def test_haversine_zero(self): km_dist_zero = compareLatLong(self.ord, self.ord) self.assertAlmostEqual(km_dist_zero, 0.0, 0) def test_haversine_na(self): km_dist_na = compareLatLong((0.0, 0.0), (1.0, 2.0)) ass...
code_fim
medium
{ "lang": "python", "repo": "BrianSipple/dedupe", "path": "/test/test_haversine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_haversine_zero(self): km_dist_zero = compareLatLong(self.ord, self.ord) self.assertAlmostEqual(km_dist_zero, 0.0, 0) def test_haversine_na(self): km_dist_na = compareLatLong((0.0, 0.0), (1.0, 2.0)) assert numpy.isnan(km_dist_na) km_dist_na = compar...
code_fim
hard
{ "lang": "python", "repo": "BrianSipple/dedupe", "path": "/test/test_haversine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Scratch microengine is the same as the default behavior""" pass<|fim_prefix|># repo: polyswarm/microengine path: /src/microengine/scratch.py from microengine import Microengine <|fim_middle|>class ScratchMicroengine(Microengine):
code_fim
easy
{ "lang": "python", "repo": "polyswarm/microengine", "path": "/src/microengine/scratch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: polyswarm/microengine path: /src/microengine/scratch.py from microengine import Microengine <|fim_suffix|> """Scratch microengine is the same as the default behavior""" pass<|fim_middle|>class ScratchMicroengine(Microengine):
code_fim
easy
{ "lang": "python", "repo": "polyswarm/microengine", "path": "/src/microengine/scratch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bhorda/BFRBAnticipationDataset path: /BFRB_Detection_Data/pipeline/1+_WindowSplit.py import numpy as np import pandas as ps import math import sys ### Positive windows # prediction window and labeled window length in seconds directory = sys.argv[1] xSize = int(sys.argv[2]) # xwindow size ySize ...
code_fim
hard
{ "lang": "python", "repo": "Bhorda/BFRBAnticipationDataset", "path": "/BFRB_Detection_Data/pipeline/1+_WindowSplit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def BehaviourSelect(behaviourName): if behaviourName == 'skin picking': return 1 elif behaviourName == 'face touching': return 2 elif behaviourName == 'fidgeting': return 3 elif behaviourName == 'skin biting': return 4 elif behaviourName == 'hand scratch...
code_fim
hard
{ "lang": "python", "repo": "Bhorda/BFRBAnticipationDataset", "path": "/BFRB_Detection_Data/pipeline/1+_WindowSplit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: swdotcom/swdc-sublime path: /vendor/celery/backends/cassandra.py # -* coding: utf-8 -*- """Apache Cassandra result store backend using the DataStax driver.""" from __future__ import absolute_import, unicode_literals import sys import threading from celery import states from celery.exceptions im...
code_fim
hard
{ "lang": "python", "repo": "swdotcom/swdc-sublime", "path": "/vendor/celery/backends/cassandra.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return 'cassandra://' def _get_task_meta_for(self, task_id): """Get task meta-data for a task by id.""" self._get_connection() res = self._session.execute(self._read_stmt, (task_id, )).one() if not res: return {'status': states.PENDING, 'result': N...
code_fim
hard
{ "lang": "python", "repo": "swdotcom/swdc-sublime", "path": "/vendor/celery/backends/cassandra.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @abc.abstractmethod def get_stored_data(self, currency): pass @abc.abstractmethod def save_over_data(self, currency, df): pass @abc.abstractmethod def save_indicators(self, df, currency, ts): pass def sanitize(self, currency): df = self.get_st...
code_fim
hard
{ "lang": "python", "repo": "retorno/aquitania", "path": "/aquitania/data_source/storage/abstract_storage_system.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_indicator_filename(self, finsec, ts): generate_folder('{}/{}/'.format(self.indicator_output_folder, finsec)) return '{}/{}/{}{}'.format(self.indicator_output_folder, finsec, ts, self.extension) def get_candles_filename(self, finsec): generate_folder('{}/{}/'.format...
code_fim
hard
{ "lang": "python", "repo": "retorno/aquitania", "path": "/aquitania/data_source/storage/abstract_storage_system.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }