text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>#midi_file = '0.mid' #name = str(midi_file.replace('.mid', '.mp3')) #command = 'timidity.exe results/'+midi_file+' -Ow -o mp3/'+name #print(command) #result = os.system(command)<|fim_prefix|># repo: tobnap/Performance-RNN-PyTorch path: /midi2mp3.py import os midi_files = os.listdir("results") <|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "tobnap/Performance-RNN-PyTorch", "path": "/midi2mp3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tobnap/Performance-RNN-PyTorch path: /midi2mp3.py import os midi_files = os.listdir("results") <|fim_suffix|>#midi_file = '0.mid' #name = str(midi_file.replace('.mid', '.mp3')) #command = 'timidity.exe results/'+midi_file+' -Ow -o mp3/'+name #print(command) #result = os.system(command)<|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "tobnap/Performance-RNN-PyTorch", "path": "/midi2mp3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> smach.State.__init__(self, outcomes=['em_frente','OK']) def execute(self, userdata): if bateu: return su.bateu(angulo) if desvia and not bateu: return su.rodatudo(mini,velocidade_saida) class Procurando(smach.State): def __init__(self): smach.State.__init__(self, outcomes=['Nop', 'algo_er...
code_fim
hard
{ "lang": "python", "repo": "wesleygas/RoR9000", "path": "/estados_simples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> global mini global vel if GonnaCrash(mini): global desvia = True return 'algo_errado' else: velocidade = Twist(Vector3(0.2, 0, 0), Vector3(0, 0, 0)) print("frente") velocidade_saida.publish(velocidade) return 'OK' class Batendo(smach.State): global velocidade_saida def __init__(self): ...
code_fim
hard
{ "lang": "python", "repo": "wesleygas/RoR9000", "path": "/estados_simples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wesleygas/RoR9000 path: /estados_simples.py #! /usr/bin/env python # -*- coding:utf-8 -*- import rospy import numpy as np import tf import math import cv2 import time from geometry_msgs.msg import Twist, Vector3, Pose from nav_msgs.msg import Odometry from sensor_msgs.msg import Image, Compresse...
code_fim
hard
{ "lang": "python", "repo": "wesleygas/RoR9000", "path": "/estados_simples.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/refreeze-scripts path: /refreeze_scripts/cli.py from __future__ import annotations import sys import argparse import platform <|fim_suffix|> parser = argparse.ArgumentParser() parser.add_argument('--prefix', default=sys.prefix) parser.add_argument('--quiet', '-q', action=...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/refreeze-scripts", "path": "/refreeze_scripts/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if platform.system() != 'Windows': print( "%s requires to be running on Windows" % sys.argv[0], file=sys.stderr, ) sys.exit(1) parser = argparse.ArgumentParser() parser.add_argument('--prefix', default=sys.prefix) parser.add_argument('--quie...
code_fim
medium
{ "lang": "python", "repo": "pombredanne/refreeze-scripts", "path": "/refreeze_scripts/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#urlpatterns = patterns('', urlpatterns = i18n_patterns('', #url(r'^$', home, name = 'home'), url(r'^account/', include(account.urls)), url(r'^admin/', include(smuggler.urls)), url(r'^admin/', include(admin.site.urls)), url(r'^search/', SearchView(template = 'search.html'), name = 'search'), url(r'^...
code_fim
medium
{ "lang": "python", "repo": "mverleg/mu3", "path": "/project/source/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #urlpatterns = patterns('', urlpatterns = i18n_patterns('', #url(r'^$', home, name = 'home'), url(r'^account/', include(account.urls)), url(r'^admin/', include(smuggler.urls)), url(r'^admin/', include(admin.site.urls)), url(r'^search/', SearchView(template = 'search.html'), name = 'search'), url(r'...
code_fim
medium
{ "lang": "python", "repo": "mverleg/mu3", "path": "/project/source/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mverleg/mu3 path: /project/source/urls.py from django.conf.urls import patterns, include, url from django.conf.urls.i18n import i18n_patterns from django.views.i18n import set_language from django.contrib import admin from haystack.views import SearchView from misc.views.notification import noti...
code_fim
medium
{ "lang": "python", "repo": "mverleg/mu3", "path": "/project/source/urls.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # feed word vectors into the RNN and predict the next word inputs = [S] + words[:-1] targets = words # calculate the softmax and loss in_tensor = convert_to_variable(inputs) # seqln out_tensor = convert_to_variable(targets) # seqln logits = model(in_tensor) # 1 * nwords los...
code_fim
hard
{ "lang": "python", "repo": "debowin/nn4nlp-code", "path": "/06-rnn/lm-lstm-pytorch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: debowin/nn4nlp-code path: /06-rnn/lm-lstm-pytorch.py import time from collections import defaultdict import random import math import numpy as np import torch from torch import nn from torch.autograd import Variable torch.manual_seed(1) # format of files: each line is "word1 word2 ..." train_f...
code_fim
hard
{ "lang": "python", "repo": "debowin/nn4nlp-code", "path": "/06-rnn/lm-lstm-pytorch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Perform training best_dev = 1e20 start = time.time() dev_time = all_tagged = this_words = this_loss = 0 for ITER in range(10): i = 0 random.shuffle(train_order) for sid in train_order: i += 1 if i % int(2000) == 0: print( "[TRAIN] iter %r(step: %r)...
code_fim
hard
{ "lang": "python", "repo": "debowin/nn4nlp-code", "path": "/06-rnn/lm-lstm-pytorch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """A client can do post request successfully""" response = self.httpbin_4.test_requests_post_method() self.assertEqual(response.request.method, 'POST') self.assertEqual(response.status_code, 200) def test_client_can_do_patch_request(self): """A client can do pa...
code_fim
hard
{ "lang": "python", "repo": "ydaniels/rapic", "path": "/rapic/tests/test_rapic_client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ydaniels/rapic path: /rapic/tests/test_rapic_client.py """Tests for rapic Client.""" import unittest import json import os import requests from urllib.parse import urlencode, urlparse, quote from rapic.client import APIClient from rapic.exceptions import RapicException, RapicMissingUrlData clas...
code_fim
hard
{ "lang": "python", "repo": "ydaniels/rapic", "path": "/rapic/tests/test_rapic_client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_client_can_do_get_request(self): """A client can do get request successfully""" response = self.httpbin.get_my_headers(headers={'User-agent': 'Fake user agent'}) self.assertEqual(response.request.method, 'GET') self.assertEqual(response.status_code, 200) d...
code_fim
hard
{ "lang": "python", "repo": "ydaniels/rapic", "path": "/rapic/tests/test_rapic_client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: esberglu/openstack-health path: /openstack_health/tests/test_run_aggregator.py # Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "esberglu/openstack-health", "path": "/openstack_health/tests/test_run_aggregator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_that_runs_will_be_aggregated_by_day_and_project(self): aggregator = RunAggregator(self.runs) aggregated_runs = aggregator.aggregate(datetime_resolution='day') expected_response = { datetime.date(2015, 1, 2).isoformat(): { 'openstack/nova': ...
code_fim
hard
{ "lang": "python", "repo": "esberglu/openstack-health", "path": "/openstack_health/tests/test_run_aggregator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tiberiu44/TTS-Cube path: /scripts/train_vocoder.py # # Author: Tiberiu Boros # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
code_fim
hard
{ "lang": "python", "repo": "tiberiu44/TTS-Cube", "path": "/scripts/train_vocoder.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> trainer = pl.Trainer( accelerator=params.accelerator, devices=params.devices, max_epochs=-1, callbacks=[PrintAndSaveCallback(params.output_base)] ) trainer.fit(model, trainloader, devloader) if __name__ == '__main__': parser = ArgumentParser(description='...
code_fim
hard
{ "lang": "python", "repo": "tiberiu44/TTS-Cube", "path": "/scripts/train_vocoder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: antoinewdg/pyffs path: /test/automaton_generation/test_position.py from pyffs.automaton_generation.position import Position class TestPosition: def test_transition_with_high_tolerance(self): p = Position(0, 0) expected = [Position(1, 0)] assert p.transition((1, 0), ...
code_fim
medium
{ "lang": "python", "repo": "antoinewdg/pyffs", "path": "/test/automaton_generation/test_position.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_transition_remove_results_above_tolerance(self): p = Position(0, 1) assert p.transition((1, 0), 1) == [Position(1, 1)] assert p.transition((0, 0), 1) == [] assert p.transition((), 1) == [] def test_subsumes(self): p = Position(0, 0) assert...
code_fim
hard
{ "lang": "python", "repo": "antoinewdg/pyffs", "path": "/test/automaton_generation/test_position.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_is_subsumed_by(self): p = Position(0, 1) assert p.is_subsumed_by(p) assert p.is_subsumed_by(Position(0, 0)) assert p.is_subsumed_by(Position(1, 0)) assert p.is_subsumed_by(Position(-1, 0)) assert not p.is_subsumed_by(Position(2, 0)) as...
code_fim
hard
{ "lang": "python", "repo": "antoinewdg/pyffs", "path": "/test/automaton_generation/test_position.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmiyakawa/python_argparse_test_version path: /main.py from argparse import ArgumentParser, RawDescriptionHelpFormatter from logging import getLogger, StreamHandler, Formatter, DEBUG, INFO <|fim_suffix|>def main(): parser = prepare_parser() args = parser.parse_args() logger = getLogg...
code_fim
hard
{ "lang": "python", "repo": "dmiyakawa/python_argparse_test_version", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser = ArgumentParser(description=(__doc__), formatter_class=RawDescriptionHelpFormatter) parser.add_argument('-d', '--debug', action='store_true', help='Show debug log') # parser.add_argument('-v', '--version', action='version', # ...
code_fim
medium
{ "lang": "python", "repo": "dmiyakawa/python_argparse_test_version", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> defender = models.ForeignKey( User, null=True, on_delete=models.SET_NULL, related_name="defender_player", ) striker = models.ForeignKey( User, null=True, on_delete=models.SET_NULL, related_name="striker_player", ) def __...
code_fim
medium
{ "lang": "python", "repo": "arsenico13/rtcb-backend", "path": "/rtcbproj/rtcb/team/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: arsenico13/rtcb-backend path: /rtcbproj/rtcb/team/models.py # -*- coding: utf-8 -*- from django.db import models from rtcb.authentication.models import User <|fim_suffix|> def __str__(self): return "Team: {}".format(self.name)<|fim_middle|> class Team(models.Model): name = models....
code_fim
hard
{ "lang": "python", "repo": "arsenico13/rtcb-backend", "path": "/rtcbproj/rtcb/team/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>86981E-003 5.13989403115309215E-003 1.0000000000000000 0.0000000000000000 10500.000000000000 8.33795128363146176E-003 5.03298887150449396E-003 1.0000000000000000 0.0000000000000000 10600.000000000000 8.10586330598983551E-003 4.92620459440141524E-003 1....
code_fim
hard
{ "lang": "python", "repo": "JoelBNU/ShadowOui-Tutorial", "path": "/SCRIPTS/crystal_mosaic_bragg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 4.49833880346250936E-003 3.40989164000196892E-003 1.0000000000000000 0.0000000000000000 12600.000000000000 4.33830926847456055E-003 3.34877083062859156E-003 1.0000000000000000 0.0000000000000000 12700.000000000000 4.18361853662130301E-003 3.290754300...
code_fim
hard
{ "lang": "python", "repo": "JoelBNU/ShadowOui-Tutorial", "path": "/SCRIPTS/crystal_mosaic_bragg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoelBNU/ShadowOui-Tutorial path: /SCRIPTS/crystal_mosaic_bragg.py .34168217528014821E-002 2.69569504792379275E-002 1.0000000000000000 0.0000000000000000 5100.0000000000000 4.20077009070887186E-002 2.58493424287771500E-002 1.0000000000000000 0.0000000000000000 ...
code_fim
hard
{ "lang": "python", "repo": "JoelBNU/ShadowOui-Tutorial", "path": "/SCRIPTS/crystal_mosaic_bragg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: I201821180/gnn-asymptotics path: /gnn_normalization/lib/model/predictor.py from chainer_chemistry import links from . import graph_conv_predictor as g_predictor from . import rsgcn def setup_predictor(method, n_unit, conv_layers, class_num, <|fim_suffix|> return g_predictor.GraphConvPredict...
code_fim
hard
{ "lang": "python", "repo": "I201821180/gnn-asymptotics", "path": "/gnn_normalization/lib/model/predictor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return g_predictor.GraphConvPredictor( model, graphout, train_graph_conv=train_graph_conv)<|fim_prefix|># repo: I201821180/gnn-asymptotics path: /gnn_normalization/lib/model/predictor.py from chainer_chemistry import links from . import graph_conv_predictor as g_predictor from . impo...
code_fim
hard
{ "lang": "python", "repo": "I201821180/gnn-asymptotics", "path": "/gnn_normalization/lib/model/predictor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pscicluna/pybaycor path: /pybaycor/pybaycor.py the input data overlaid with the ellipse described by the inferred correlated multivariate distribution Parameters ---------- plotfile : str, optional Name of a file to write the plot to show : bool, optio...
code_fim
hard
{ "lang": "python", "repo": "pscicluna/pybaycor", "path": "/pybaycor/pybaycor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> or you can modify the length of burn-in and number of steps with >>> bc.fit(steps=2000, tune=2000) Once you are happy with the fit, you can get a tabular summary with >>> summary = bc.summarise() and visual summaries with >>> bc.plot_trace() >>> bc.plot_corner() >>> bc...
code_fim
hard
{ "lang": "python", "repo": "pscicluna/pybaycor", "path": "/pybaycor/pybaycor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pscicluna/pybaycor path: /pybaycor/pybaycor.py coords["chol_corr_dim_1"] = xr.DataArray(d1, dims=['pointwise_sel']) #print(plot_vars) #coords = {"chol_corr":chol_coords} #print(coords) #corner = gs.GridSpec(rows, cols, figure=fig az.plot_pair(sel...
code_fim
hard
{ "lang": "python", "repo": "pscicluna/pybaycor", "path": "/pybaycor/pybaycor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def iterate_file(fpath, start=None, stop=None, step=None, mmap_mode=None): """Iterate through the elements in a pickle (.pkl) or numpy (.npy) file. If a pickle file, structure must be a sequence of objects, one object per event. If a numpy file, it must be a one-dimensional structured array w...
code_fim
hard
{ "lang": "python", "repo": "ts4051/retro", "path": "/retro/init_obj.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ts4051/retro path: /retro/init_obj.py if not shared_table_sd_indices: continue dom_tables.load_table( fpath=fpath, sd_indices=shared_table_sd_indices, mmap=mmap, ) elif '{stri...
code_fim
hard
{ "lang": "python", "repo": "ts4051/retro", "path": "/retro/init_obj.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """From an event, take either pulses or photons (optionally applying weights to the latter for angular sensitivity) and create the three structured numpy arrays necessary for Retro to process the information as "hits". Parameters ---------- event : mapping path : string ...
code_fim
hard
{ "lang": "python", "repo": "ts4051/retro", "path": "/retro/init_obj.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: backwardn/crocoite path: /doc/_ext/clicklist.py """ Render click.yaml config file into human-readable list of supported sites """ import pkg_resources, yaml from docutils import nodes from docutils.parsers.rst import Directive from yarl import URL <|fim_suffix|> def run(self): # XXX:...
code_fim
medium
{ "lang": "python", "repo": "backwardn/crocoite", "path": "/doc/_ext/clicklist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> item = nodes.definition_list_item () term = ', '.join (map (lambda x: x.host, urls)) if urls else site['match'] k = nodes.term (text=term) item += k item += v l += item return [l] def setup(app): app.add_directive ("clic...
code_fim
hard
{ "lang": "python", "repo": "backwardn/crocoite", "path": "/doc/_ext/clicklist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ataranu/pynet_class path: /read_from_file.py #! /usr/bin/env python <|fim_suffix|>with open('yaml.txt') as f: pprint(yaml.load(f))<|fim_middle|>import json import yaml from pprint import pprint with open('json.txt') as f: pprint(json.load(f))
code_fim
medium
{ "lang": "python", "repo": "ataranu/pynet_class", "path": "/read_from_file.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ataranu/pynet_class path: /read_from_file.py #! /usr/bin/env python import json import yaml from pprint import pprint <|fim_suffix|>with open('yaml.txt') as f: pprint(yaml.load(f))<|fim_middle|>with open('json.txt') as f: pprint(json.load(f))
code_fim
easy
{ "lang": "python", "repo": "ataranu/pynet_class", "path": "/read_from_file.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>with open('json.txt') as f: pprint(json.load(f)) with open('yaml.txt') as f: pprint(yaml.load(f))<|fim_prefix|># repo: ataranu/pynet_class path: /read_from_file.py #! /usr/bin/env python <|fim_middle|>import json import yaml from pprint import pprint
code_fim
easy
{ "lang": "python", "repo": "ataranu/pynet_class", "path": "/read_from_file.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super(FunctionComponent, self).__init__(opts, helper.PACKAGE_NAME) @app_function(FN_NAME) def _app_function(self, fn_inputs): """ Function: Create a jira comment. Inputs: - fn_inputs.jira_label - fn_inputs.task_id - fn_inpu...
code_fim
hard
{ "lang": "python", "repo": "ibmresilient/resilient-community-apps", "path": "/fn_jira/fn_jira/components/jira_create_comment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ibmresilient/resilient-community-apps path: /fn_jira/fn_jira/components/jira_create_comment.py # -*- coding: utf-8 -*- # pragma pylint: disable=unused-argument, no-self-use # (c) Copyright IBM Corp. 2010, 2023. All Rights Reserved. """Add a comment to a Jira Issue""" from re import subn, compile...
code_fim
hard
{ "lang": "python", "repo": "ibmresilient/resilient-community-apps", "path": "/fn_jira/fn_jira/components/jira_create_comment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: beebyte/irisett path: /irisett/webmgmt/webmgmt.py """Webmgmt entry point. Set up the aiohttp environment and start listening for connections. """ import asyncio from aiohttp import web # noinspection PyPackageRequirements import aiohttp_jinja2 import jinja2 import os from irisett import ( ...
code_fim
medium
{ "lang": "python", "repo": "beebyte/irisett", "path": "/irisett/webmgmt/webmgmt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def initialize(loop: asyncio.AbstractEventLoop, port: int, username: str, password: str, dbcon: DBConnection, active_monitor_manager: ActiveMonitorManager) -> None: """Initialize the webmgmt listener.""" stats.set('num_calls', 0, 'WEBMGMT') app = web.Application(loop=loop, logge...
code_fim
hard
{ "lang": "python", "repo": "beebyte/irisett", "path": "/irisett/webmgmt/webmgmt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yodigi7/pentago-python path: /src/constants/board.py BOARD_SIZE = 6 # Used to detect when adding a line for drawing quarters. HALF_BOARD_SIZE = (BOARD_SIZE / 2) <|fim_suffix|>QUARTER_BOUNDARIES = { 0: (slice(0, 3), slice(0, 3)), 1: (slice(0, 3), slice(3, 6)), 2: (slice(3, 6), slice(3...
code_fim
medium
{ "lang": "python", "repo": "yodigi7/pentago-python", "path": "/src/constants/board.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>QUARTER_BOUNDARIES = { 0: (slice(0, 3), slice(0, 3)), 1: (slice(0, 3), slice(3, 6)), 2: (slice(3, 6), slice(3, 6)), 3: (slice(3, 6), slice(0, 3)) }<|fim_prefix|># repo: yodigi7/pentago-python path: /src/constants/board.py BOARD_SIZE = 6 # Used to detect when adding a line for drawing quar...
code_fim
medium
{ "lang": "python", "repo": "yodigi7/pentago-python", "path": "/src/constants/board.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: response = requests.get("http://" + str(upload_module_url()) + "/status") result = response.json() return result == "ready" except Exception: return False def __str__(self): return self.name<|fim_prefix|># repo: Azure-Sample...
code_fim
hard
{ "lang": "python", "repo": "Azure-Samples/azure-intelligent-edge-patterns", "path": "/factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/inference_modules/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IrvanDimetrio/Calculator-Fraction path: /Program.py from fractions import Fraction as P print "- PROGRAM MENGHITUNG BILANGAN PECAHAN" print " " print "1. Penjumlahan" print "2. Pengurangan" print "3. Perkalian" print "4. Pembagian" print " " pilih = input("Masukkan Pilihan : ") if ...
code_fim
hard
{ "lang": "python", "repo": "IrvanDimetrio/Calculator-Fraction", "path": "/Program.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif pilih == 3: a = input("Bulat 1 : ") b = input("Pembilang 1 : ") c = input("Penyebut 1 : ") d = input("Bulat 2 : ") e = input("Pembilang 2 : ") f = input("Penyebut 2 : ") print "-----------------------------------" print " ", b, (' '), (' '), e, (' ') pri...
code_fim
hard
{ "lang": "python", "repo": "IrvanDimetrio/Calculator-Fraction", "path": "/Program.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>), Method(name="stopAnimation", params=[Param(name='sender', Type='foundation.Object')], return_value=Return(''), description='stops the animation of an indeterminate progress indicator', ), Method(name="in...
code_fim
hard
{ "lang": "python", "repo": "gemsi/cocoa", "path": "/scripts/progress_indicator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gemsi/cocoa path: /scripts/progress_indicator.py #!env python3 from generate import Component, Property, init_method, Method, Param, Return if __name__ == "__main__": w = Component( Type="appkit.ProgressIndicator", super_type='appkit.View', description="an interface ...
code_fim
hard
{ "lang": "python", "repo": "gemsi/cocoa", "path": "/scripts/progress_indicator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def spam(self, date="", page=1, page_size=1000, order_field="date", order_direction="asc"): """Retrieves the spam complaints for this campaign.""" params = { "date": date, "page": page, "pagesize": page_size, "orderfield": order_field, ...
code_fim
hard
{ "lang": "python", "repo": "campaignmonitor/createsend-python", "path": "/lib/createsend/campaign.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: campaignmonitor/createsend-python path: /lib/createsend/campaign.py from __future__ import absolute_import import json from createsend.createsend import CreateSendBase from createsend.utils import json_to_py class Campaign(CreateSendBase): """Represents a campaign and provides associated ...
code_fim
hard
{ "lang": "python", "repo": "campaignmonitor/createsend-python", "path": "/lib/createsend/campaign.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if pkgFolder: if args.like: packagesLike = db.packagesLike( pkgFolder ) if len( packagesLike ) == 1: for v in db.versions( packagesLike[0] ): port = db.port( packagesLike[0], v ) print( port ) else: print( packagesLike ) elif pkgVersion: port = db.port( pkgFol...
code_fim
hard
{ "lang": "python", "repo": "david-antiteum/vcpkg-versions", "path": "/query.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: david-antiteum/vcpkg-versions path: /query.py import argparse from vcpckversions import PortsRepo, Port, PortsDB if __name__ == "__main__": parser = argparse.ArgumentParser( description='Query ports.' ) parser.add_argument( "--pkg", dest="pkg", help="Package to query with an optional version. ...
code_fim
hard
{ "lang": "python", "repo": "david-antiteum/vcpkg-versions", "path": "/query.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert bound.size() == ported.size()<|fim_prefix|># repo: lycantropos/cppstd path: /tests/integration_tests/vectors_tests/test_size.py from hypothesis import given from tests.utils import BoundPortedVectorsPair from . import strategies @given(strategies.vectors_pairs) def test_basic(pair: BoundPor...
code_fim
easy
{ "lang": "python", "repo": "lycantropos/cppstd", "path": "/tests/integration_tests/vectors_tests/test_size.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lycantropos/cppstd path: /tests/integration_tests/vectors_tests/test_size.py from hypothesis import given from tests.utils import BoundPortedVectorsPair from . import strategies <|fim_suffix|> assert bound.size() == ported.size()<|fim_middle|> @given(strategies.vectors_pairs) def test_basic(...
code_fim
medium
{ "lang": "python", "repo": "lycantropos/cppstd", "path": "/tests/integration_tests/vectors_tests/test_size.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlamiMejjati/GeneratingObjectStamps path: /mask_gen.py + zshape) # l = tf.nn.leaky_relu(GroupNorm(l, G=1)) # l = GNLReLU(l) x = (LinearWrap(box) .tf.pad([[0, 0], [3, 3], [3, 3], [0, 0]], mode='SYMMETRIC') .Conv2D('conv0', resha...
code_fim
hard
{ "lang": "python", "repo": "AlamiMejjati/GeneratingObjectStamps", "path": "/mask_gen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @auto_reuse_variable_scope def gen_from_zbox_adain(self, z, musigma, chan=3, n_upsampling=5): with argscope([Conv2D, Conv2DTranspose]): x = Conv2DTranspose('deconvInit', z, chs, 1, activation=tf.nn.leaky_relu, strides=4) for i in range(n_upsampling): ...
code_fim
hard
{ "lang": "python", "repo": "AlamiMejjati/GeneratingObjectStamps", "path": "/mask_gen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlamiMejjati/GeneratingObjectStamps path: /mask_gen.py 0], [3, 3], [3, 3], [0, 0]], mode='SYMMETRIC') .Conv2D('conv0', NF, 7, padding='VALID') .Conv2D('conv1', NF * 2, 3, strides=2) .Conv2D('conv2', NF * 4, 3, strides=2)()) for k in r...
code_fim
hard
{ "lang": "python", "repo": "AlamiMejjati/GeneratingObjectStamps", "path": "/mask_gen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> typeURI = 'https://wegenenverkeer.data.vlaanderen.be/ns/onderdeel#VRBeveiligingskaart' """De URI van het object volgens https://www.w3.org/2001/XMLSchema#anyURI.""" def __init__(self): super().__init__()<|fim_prefix|># repo: davidvlaminck/OTLMOW path: /src/OTLMOW/OTLModel/Classes/Ond...
code_fim
hard
{ "lang": "python", "repo": "davidvlaminck/OTLMOW", "path": "/src/OTLMOW/OTLModel/Classes/Onderdeel/VRBeveiligingskaart.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidvlaminck/OTLMOW path: /src/OTLMOW/OTLModel/Classes/Onderdeel/VRBeveiligingskaart.py # coding=utf-8 from OTLMOW.OTLModel.Classes.Abstracten.VRModuleMetFirmware import VRModuleMetFirmware <|fim_suffix|> """Processorkaart die de beveiligings- en bewakingsfunctie op zich neemt. Indien bij co...
code_fim
medium
{ "lang": "python", "repo": "davidvlaminck/OTLMOW", "path": "/src/OTLMOW/OTLModel/Classes/Onderdeel/VRBeveiligingskaart.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(self.params,Asignacion): return '\t'*tab + 'if ' + self.params.toString() + ':\n' + '\t'*(tab+1) + 'goto .' + self.goto else: return '\t'*tab + 'if ' + self.params+ ':\n' + '\t'*(tab+1) + 'goto .' + self.goto def setGoto(self,goto): self...
code_fim
medium
{ "lang": "python", "repo": "joorgej/tytus", "path": "/parser/fase2/team27/G-27/Optimizacion/Instrucciones/ins_if.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joorgej/tytus path: /parser/fase2/team27/G-27/Optimizacion/Instrucciones/ins_if.py from Optimizacion.Instrucciones.instruccion import * from Optimizacion.Asignaciones.asignacion import * class Ins_if(Instruccion): <|fim_suffix|> return {'ins': self.ins, 'params': self.params, 'goto': self....
code_fim
medium
{ "lang": "python", "repo": "joorgej/tytus", "path": "/parser/fase2/team27/G-27/Optimizacion/Instrucciones/ins_if.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setGoto(self,goto): self.goto = goto def getGoto(self): return self.goto<|fim_prefix|># repo: joorgej/tytus path: /parser/fase2/team27/G-27/Optimizacion/Instrucciones/ins_if.py from Optimizacion.Instrucciones.instruccion import * from Optimizacion.Asignaciones.asignacion impor...
code_fim
hard
{ "lang": "python", "repo": "joorgej/tytus", "path": "/parser/fase2/team27/G-27/Optimizacion/Instrucciones/ins_if.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Handles motion detection. Args: frame: The frame to compare for movement. """ try: print('*** MOTION DETECTED ***') self.event_notifier.send_motion_notification() img = Image.fromarray(frame.array, 'RGB') filename = os.path.join( settings['backup...
code_fim
hard
{ "lang": "python", "repo": "betabandido/rpisurv", "path": "/rpisurv/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: betabandido/rpisurv path: /rpisurv/main.py from apscheduler.schedulers.background import BackgroundScheduler from backup import upload_jpeg_file from daemon import runner import logging from motion import MotionDetector import os from picamera import PiCamera from picamera.array import PiRGBArray...
code_fim
hard
{ "lang": "python", "repo": "betabandido/rpisurv", "path": "/rpisurv/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagyist/sentry path: /tests/snuba/models/test_group.py from sentry.models import Group from sentry.testutils import SnubaTestCase, TestCase from sentry.testutils.helpers.datetime import before_now, iso_format from sentry.testutils.silo import region_silo_test from sentry.types.issues import Group...
code_fim
hard
{ "lang": "python", "repo": "nagyist/sentry", "path": "/tests/snuba/models/test_group.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.transaction_event_1 = self.store_event(data=event_data_1, project_id=self.project.id) self.transaction_event_2 = self.store_event(data=event_data_2, project_id=self.project.id) self.transaction_event_3 = self.store_event(data=event_data_3, project_id=self.project.id) p...
code_fim
hard
{ "lang": "python", "repo": "nagyist/sentry", "path": "/tests/snuba/models/test_group.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Examples -------- Source: modified from flopy.plot.plotutil.plot_shapefile """ import matplotlib.pyplot as plt if 'vmin' in kwargs: vmin = kwargs.pop('vmin') else: vmin = None if 'vmax' in kwargs: vmax = kwargs.pop('vmax') ...
code_fim
hard
{ "lang": "python", "repo": "kbefus/wy_gwres", "path": "/wy_gwres/utils/plot_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if ax is None: ax = plt.gca() cm = plt.get_cmap(cmap) pc,bpc = shp_to_patchcollection(in_polys=in_polys,in_shp=in_shp,radius=radius) pc.set(**kwargs) if a is None: nshp = len(pc.get_paths()) cccol = cm(1. * np.arange(nshp) / nshp) if facecolor ==...
code_fim
hard
{ "lang": "python", "repo": "kbefus/wy_gwres", "path": "/wy_gwres/utils/plot_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kbefus/wy_gwres path: /wy_gwres/utils/plot_utils.py # -*- coding: utf-8 -*- """ Created on Fri Dec 08 11:52:22 2017 @author: kbefus """ import numpy as np import matplotlib.pyplot as plt from .shp_utils import shp_to_patchcollection,poly_bound_to_extent # ------------- Gener...
code_fim
hard
{ "lang": "python", "repo": "kbefus/wy_gwres", "path": "/wy_gwres/utils/plot_utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Teams', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('team_id', models.IntegerField()), ('rarity', models.Integer...
code_fim
hard
{ "lang": "python", "repo": "wwftherocksp/Pcrd-Wiki", "path": "/pcrd_unpack/migrations/0003_auto_20180529_1852.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wwftherocksp/Pcrd-Wiki path: /pcrd_unpack/migrations/0003_auto_20180529_1852.py # Generated by Django 2.0.3 on 2018-05-29 10:52 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.C...
code_fim
hard
{ "lang": "python", "repo": "wwftherocksp/Pcrd-Wiki", "path": "/pcrd_unpack/migrations/0003_auto_20180529_1852.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Fhwang0926/class path: /python/basic/class_study_if.py #!/usr/bin/python // 파이썬을 위한 파일임을 선언 # -*- coding: utf8 -*- // 인코딩 방식 지정 => 한글 주석으로 인한 실행 에러 방지 # Code.01 # if문 ---> 조건문 --> 조건식을 활용 --> 조건식 : 연산의 결과((T/F))bool # 연산 결과가 논리타입으로 나오는 연산자 --> 비교연산자 # 비교 연산자 : <, >, <=, >=, ==, != if 10 > 1: ...
code_fim
hard
{ "lang": "python", "repo": "Fhwang0926/class", "path": "/python/basic/class_study_if.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Code.14 a = ["핸드폰", "지갑", "시계"] if "지갑1" not in a: print("나갈 수가 없어요") # Code.15 # if 조건식 : # 코드블럭 ---> 코드 테스트 --> 나중에 만들 예정 if money >= 5000 : pass # if 조건1 : # 코드블럭 : 조건1이 참인 경우 # elif 조건2 : # 코드블럭 : 조건1이 거짓이면서 조건2가 참인 경우 # else: # 코드블럭 : 조건1/조건2 모두 거짓인 경우 # Code.16 #...
code_fim
hard
{ "lang": "python", "repo": "Fhwang0926/class", "path": "/python/basic/class_study_if.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Code.10 a = 8 # 1000 b = 9 # 1001 # 1001 -> 9 print(bool(a or b)) print(a or b) # a의 값이 출력됨 # Code.11 a = 9 print(bool(not a)) # ! print(not a) # ~ # Code.12 # 돈 : 3000보다 많거나 카드가 있다면 택시 # 적거나 카드가 없다면 걸어간다. # 3000보다 많거나 카드가 있다 : money >= 3000 or ca...
code_fim
hard
{ "lang": "python", "repo": "Fhwang0926/class", "path": "/python/basic/class_study_if.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: STIXProject/stixproject.github.io path: /documentation/concepts/composition/observable_composition.py #!/usr/bin/env python # Copyright (c) 2014, The MITRE Corporation. All rights reserved. # See LICENSE.txt for orcomplete terms. from stix.core import STIXPackage from stix.indicator import Indic...
code_fim
hard
{ "lang": "python", "repo": "STIXProject/stixproject.github.io", "path": "/documentation/concepts/composition/observable_composition.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pkg.add_observable(andcomp) # USE CASE: single object, one property with multiple values obs = SocketAddress() obs.ip_address = ['10.0.0.0', '10.0.0.1', '10.0.0.2'] # comma delimiter automagically added obs.ip_address.condition = "Equals" obs.ip_address.apply_condition = "ANY" ...
code_fim
hard
{ "lang": "python", "repo": "STIXProject/stixproject.github.io", "path": "/documentation/concepts/composition/observable_composition.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> orcomp.add(obs) obs = File() obs.file_name = "barfoobar" obs.file_name.condition = "Equals" orcomp.add(obs) # andcomp = the above is true AND a network connection is present andcomp = ObservableComposition() andcomp.operator = "AND" andcomp.add(orcomp) obs = Ne...
code_fim
hard
{ "lang": "python", "repo": "STIXProject/stixproject.github.io", "path": "/documentation/concepts/composition/observable_composition.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: globocom/dojo path: /2013_08_21/numeros_romanos.py LETRAS_ROMANAS = { "Y": 0, "I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000 } <|fim_suffix|> for i in xrange(len(romano) - 1 ): atual = LETRAS_ROMANAS[romano[i]] prox = LETRAS_ROMANAS[romano[i + ...
code_fim
medium
{ "lang": "python", "repo": "globocom/dojo", "path": "/2013_08_21/numeros_romanos.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if atual < prox: resposta -= atual else: resposta += atual return resposta<|fim_prefix|># repo: globocom/dojo path: /2013_08_21/numeros_romanos.py LETRAS_ROMANAS = { "Y": 0, "I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000 } def ...
code_fim
hard
{ "lang": "python", "repo": "globocom/dojo", "path": "/2013_08_21/numeros_romanos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cyrus19901/volttron path: /services/core/SQLHistorian/sqlhistorian/historian.py LDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHA...
code_fim
hard
{ "lang": "python", "repo": "cyrus19901/volttron", "path": "/services/core/SQLHistorian/sqlhistorian/historian.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cyrus19901/volttron path: /services/core/SQLHistorian/sqlhistorian/historian.py imer in the documentation # and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,...
code_fim
hard
{ "lang": "python", "repo": "cyrus19901/volttron", "path": "/services/core/SQLHistorian/sqlhistorian/historian.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @doc_inherit def query_historian(self, topic, start=None, end=None, agg_type=None, agg_period=None, skip=0, count=None, order="FIRST_TO_LAST"): _log.debug("query_historian Thread is: {}".format( threading.currentThread().getName()...
code_fim
hard
{ "lang": "python", "repo": "cyrus19901/volttron", "path": "/services/core/SQLHistorian/sqlhistorian/historian.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Reno-Greenleaf/tomb path: /input_output.py class IO(object): """ Decides which objects should react to a command. """ def fill(self): pass def process(self, pool): locations = pool.get_rooms() current = [] <|fim_suffix|> pool[location].obey(command) for name in pool.get_ro...
code_fim
hard
{ "lang": "python", "repo": "Reno-Greenleaf/tomb", "path": "/input_output.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for name in pool.get_rooms()[location]: pool[name].obey(command) def _print(self, output): if output: print output<|fim_prefix|># repo: Reno-Greenleaf/tomb path: /input_output.py class IO(object): """ Decides which objects should react to a command. """ def fill(self): pass ...
code_fim
hard
{ "lang": "python", "repo": "Reno-Greenleaf/tomb", "path": "/input_output.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: milanmitric/SOFT path: /default/functions.py import numpy as np import cv2 import matplotlib.pyplot as plt import math IMAGE_WIDTH = 28 IMAGE_HEIGHT = 28 SUDOKU_SIZE = 9 N_MIN_ACTIVE_PIXELS = 10 # Uzmi ivice slike da bi se remapirala def getOuterPoints(rcCorners): ar = []; ar.append(rc...
code_fim
hard
{ "lang": "python", "repo": "milanmitric/SOFT", "path": "/default/functions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Prepoznavanje broja u pravougaoniku def Recognize_number( x, y,warp_gray): # Izvuci broj [im_number, im_number_thresh, n_active_pixels] = extract_number(x, y,warp_gray) if n_active_pixels> N_MIN_ACTIVE_PIXELS: [x_b, y_b, w, h] = find_biggest_bounding_box(im_number_thresh) i...
code_fim
hard
{ "lang": "python", "repo": "milanmitric/SOFT", "path": "/default/functions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alvations/sarah path: /sarah_.py # -*- coding: utf-8 -*- from sarah import ParallelData, Seq2Seq, L2Regularizer, Adam, Trainer from sarah import bleu # The input files. src_filename = 'en.txt' trg_filename = 'de.txt' # Place to save the model. model_directory = 'sarah_en-de/' data = ParallelD...
code_fim
hard
{ "lang": "python", "repo": "alvations/sarah", "path": "/sarah_.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|># Or when loading data, use: ##ParallelData(loadfrom=model_directory) # Define the architecture. architecture = Seq2Seq(data, encoder_size=512, decoder_size=512, memory='gru', beam_size=3) # Define the regularize...
code_fim
medium
{ "lang": "python", "repo": "alvations/sarah", "path": "/sarah_.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> if center[0] > midX: percentGX = int(((center[0] - midX)/disX)*10) if percentGX > 9: percentGX = 9 if x2 < width: x1 += moveX[percentGX] x2 += moveX[percentGX] elif center[0] < midX: percentLX = int(((midX - center[0])/disX)*10) if pe...
code_fim
hard
{ "lang": "python", "repo": "kunjp188/ball-tracking", "path": "/camera.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kunjp188/ball-tracking path: /camera.py x1 = 0 y1 = 0 x2 = 600 y2 = 300 origWidth = 600 origHeight = 300 maxWidth = 800 maxHeight = 400 moveSpeed = 10 growSpeedX = 10 growSpeedY = 5 moveX = [0, 0, 1, 2, 3, 5, 8, 13, 21, 34] moveY = [0, 0, 0, 0, 1, 2, 4, 6, 9, 12] growX = [-4, -2, -2, 0, 0, 0, 2, ...
code_fim
hard
{ "lang": "python", "repo": "kunjp188/ball-tracking", "path": "/camera.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> percent = max(percentLX, percentGX) if (percent > 4 and x2-x1 < maxWidth) or (percent < 5 and x2-x1 > origWidth): if x1 > 0 and x2 < width and y1 > 0 and y2 < height: x1 -= growX[percent] x2 += growX[percent] y1 -= growY[percent] y2 += growY[...
code_fim
hard
{ "lang": "python", "repo": "kunjp188/ball-tracking", "path": "/camera.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JupiterEthan/ted.python path: /tests/test_signal_io.py #!/usr/bin/env python """ Test classes for writing and reading signals to and from HDF files. """ import unittest import os import numpy as np import bionet.utils.signal_io as s filename = 'test_signal_io_data.h5' block_size = 10000 clas...
code_fim
medium
{ "lang": "python", "repo": "JupiterEthan/ted.python", "path": "/tests/test_signal_io.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def testReadManyBlocks(self): '''Test multi-block read of saved data.''' r = s.ReadArray(filename) temp = [] while True: data_block = r.read(block_size) if not len(data_block): break temp += data_block.tolist(...
code_fim
hard
{ "lang": "python", "repo": "JupiterEthan/ted.python", "path": "/tests/test_signal_io.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> db.collection('media').document(normalized_key).set({ 'danbooru_tags': tags_obj, 'format': image_format, 'width': width, 'height': height, }, merge=True) hash = md5(normalized_key) hash_prefix = hash[:2] db.collection('media_hashset').document(hash_pre...
code_fim
hard
{ "lang": "python", "repo": "hakatashi/HakataArchiver", "path": "/bin/tag_executor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }