text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> Arguments: X, np array (test_samples, num_features) Returns: y_pred, np.array of int (test_samples) """ # TODO: Implement predict # Hint: some of the code of the compute_loss_and_gradients # can be reused pred = np.zeros(X.shape[...
code_fim
hard
{ "lang": "python", "repo": "temur-kh/dlcourse_ai", "path": "/assignments/assignment2/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: temur-kh/dlcourse_ai path: /assignments/assignment2/model.py import numpy as np from layers import FullyConnectedLayer, ReLULayer, softmax_with_cross_entropy, l2_regularization, softmax class TwoLayerNet: """ Neural network with two fully connected layers """ def __init__(self, n_inpu...
code_fim
hard
{ "lang": "python", "repo": "temur-kh/dlcourse_ai", "path": "/assignments/assignment2/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> last_ts = 0 num_frames = 0 for fname in repo.iter_fnames(): print("{}: {}".format(fname, os.path.getsize(fname))) with open(fname, "rb") as f: fc = FrameContainer.read(f) num_frames += len(list(fc.frames)) assert fc.dataSources[0].filename == os....
code_fim
medium
{ "lang": "python", "repo": "BioroboticsLab/bb_pipeline", "path": "/test/test_scripts.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BioroboticsLab/bb_pipeline path: /test/test_scripts.py import os import pytest from pipeline.scripts.bb_pipeline import process_video as cmdline_process_video from bb_binary import FrameContainer, Repository try: from mpi4py import MPI # noqa run_mpi_test = True except ImportError: ...
code_fim
medium
{ "lang": "python", "repo": "BioroboticsLab/bb_pipeline", "path": "/test/test_scripts.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> repo = Repository(path) last_ts = 0 num_frames = 0 for fname in repo.iter_fnames(): print("{}: {}".format(fname, os.path.getsize(fname))) with open(fname, "rb") as f: fc = FrameContainer.read(f) num_frames += len(list(fc.frames)) assert fc.d...
code_fim
medium
{ "lang": "python", "repo": "BioroboticsLab/bb_pipeline", "path": "/test/test_scripts.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/instances/sunMeta/AGroupDef.py qname="{http://www.w3.org/XML/2004/xml-schema-test-suite/}Description", text="Attribute Use should has proper namespace prefix in the ref value &#10; to be...
code_fim
hard
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/instances/sunMeta/AGroupDef.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> group declaration. (valid schema)" ), AnyElement( qname="{http://www.w3.org/XML/2004/xml-schema-test-suite/}Description", text="Attribute Group use should has proper ref...
code_fim
hard
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/instances/sunMeta/AGroupDef.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/instances/sunMeta/AGroupDef.py ExpectedOutcome.INVALID ), ], current=Current( status=Status.ACCEPTED, date=XmlDate(2005, 6, 21) ), name=...
code_fim
hard
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/instances/sunMeta/AGroupDef.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()<|fim_prefix|># repo: bertrand-caron/OMFraF path: /src/application.wsgi from os import environ from os.path import dirname from sys import path <|fim_middle|>path = dirname(__file__) if path not in path: path.appen...
code_fim
medium
{ "lang": "python", "repo": "bertrand-caron/OMFraF", "path": "/src/application.wsgi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bertrand-caron/OMFraF path: /src/application.wsgi from os import environ from os.path import dirname from sys import path <|fim_suffix|>environ['DJANGO_SETTINGS_MODULE'] = 'omfraf.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()<|fim_middle|>path ...
code_fim
medium
{ "lang": "python", "repo": "bertrand-caron/OMFraF", "path": "/src/application.wsgi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>environ['DJANGO_SETTINGS_MODULE'] = 'omfraf.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()<|fim_prefix|># repo: bertrand-caron/OMFraF path: /src/application.wsgi from os import environ from os.path import dirname from sys import path <|fim_middle|>path ...
code_fim
medium
{ "lang": "python", "repo": "bertrand-caron/OMFraF", "path": "/src/application.wsgi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>0.405613" b="0.685198"/> <Point x="-0.247059" o="1" r="0.503345" g="0.491534" b="0.730058"/> <Point x="-0.121569" o="1" r="0.562399" g="0.54862" b="0.757616"/> <Point x="0.00392157" o="1" r="0.621453" g="0.606075" b="0.785544"/> <Point x="0.129412" o="1" r="0.680508" g="0.674971" b="0.8249...
code_fim
hard
{ "lang": "python", "repo": "nagyist/ParaView", "path": "/Wrapping/Python/paraview/_colorMaps.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagyist/ParaView path: /Wrapping/Python/paraview/_colorMaps.py .0"/> <Point x="0.25" r="0.9921568627450981" g="0.6823529411764706" b="0.3803921568627451" o="1.0"/> <Point x="0.5" r="1" g="1" b="0.7490196078431373" o="1.0"/> <Point x="0.75" r="0.6705882352941176" g="0.8666666666666667"...
code_fim
hard
{ "lang": "python", "repo": "nagyist/ParaView", "path": "/Wrapping/Python/paraview/_colorMaps.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagyist/ParaView path: /Wrapping/Python/paraview/_colorMaps.py 605351" o="1" r="0.962848" g="0.710445" b="0"/> <Point x="0.73913" o="1" r="0.999469" g="0.600258" b="0.0176284"/> <Point x="0.87291" o="1" r="0.994156" g="0.445975" b="0.193912"/> <Point x="1" o="1" r="0.980407" g="0.2471...
code_fim
hard
{ "lang": "python", "repo": "nagyist/ParaView", "path": "/Wrapping/Python/paraview/_colorMaps.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xue-TAN/Basic_Statistics_With_Python path: /plot_material.py __init__(self, beta1, beta2, error_scale, data_size): self.beta1 = beta1 self.beta2 = beta2 self.error_scale = error_scale self.x = np.random.randint(1, data_size, data_size) s...
code_fim
hard
{ "lang": "python", "repo": "Xue-TAN/Basic_Statistics_With_Python", "path": "/plot_material.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rect = plt.Rectangle( # (lower-left corner), width, height (0.650, 0.633), 0.2645, 0.258, fill=False, color="k", lw=2, zorder=1000, transform=fig.transFigure, figure=fig ) fig.patches.extend([rect]) rect = plt.Rectangle( # (lower-left corner), width, heig...
code_fim
hard
{ "lang": "python", "repo": "Xue-TAN/Basic_Statistics_With_Python", "path": "/plot_material.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xue-TAN/Basic_Statistics_With_Python path: /plot_material.py alpha = .7) ax[1, 2].set_title(r'$Y={}+{}X+{}u$'.format(beta1, beta2, error_scale)) ax[1, 2].annotate(r'$\rho={:.4}$'.format(lrg7.x_y_cor()), xy=(0.1, 0.9), xycoords='axes fraction') beta1, beta2, error_scale,data_size = ...
code_fim
hard
{ "lang": "python", "repo": "Xue-TAN/Basic_Statistics_With_Python", "path": "/plot_material.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chillimeat/CAN-Fuzzer path: /fuzzer.py ng=0, filename=None, id_length=MAX_ID_LENGTH - 1, payload_length=MAX_PAYLOAD_LENGTH): """ A simple random id fuzzer algorithm. Send random or static CAN payloads to random or static arbitration ids. Uses CanActions to send/rec...
code_fim
hard
{ "lang": "python", "repo": "Chillimeat/CAN-Fuzzer", "path": "/fuzzer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chillimeat/CAN-Fuzzer path: /fuzzer.py "#" + payload if filename is not None: write_directive_to_file(filename, arb_id, payload) # --- [3] # Methods that handle linear fuzzing. # --- def linear_file_fuzz(filename, logging=0): """ Use a given input file to send ca...
code_fim
hard
{ "lang": "python", "repo": "Chillimeat/CAN-Fuzzer", "path": "/fuzzer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif response == "l": for composite in composites: print(composite[0] + "#" + composite[1]) print("Dumped directives currently in memory.") else: print("Invalid option, please select a valid option.") # --- [5] # Methods that handle br...
code_fim
hard
{ "lang": "python", "repo": "Chillimeat/CAN-Fuzzer", "path": "/fuzzer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ruidacosta/SP500HistoryData path: /proccess.py import sqlite3 filename = 'SP&500.csv' conn = sqlite3.connect(':memory:') tickers = [] def readInstruments(): first = True with open(filename,'r') as fd: for line in fd: if not first: tickers.append(str(line.replace('\r','').replace('\n...
code_fim
hard
{ "lang": "python", "repo": "ruidacosta/SP500HistoryData", "path": "/proccess.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print "Loading tickers..." readInstruments() #print tickers #startDB() print "Create database..." createSQLiteDB() for ticker in tickers: print "Inserting " + ticker + " data..." insertSQLiteDB(readDataFiles(ticker),ticker) conn.commit() print "Creating csv file..." sendToFile() print "Don...
code_fim
hard
{ "lang": "python", "repo": "ruidacosta/SP500HistoryData", "path": "/proccess.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_instance(self): self.assertTrue(isinstance(self.new_source, News_source)) if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: danalvin/news-highlights path: /tests/test_news_sources.py import unittest from app.models import News_sources class News_sources_Test...
code_fim
hard
{ "lang": "python", "repo": "danalvin/news-highlights", "path": "/tests/test_news_sources.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danalvin/news-highlights path: /tests/test_news_sources.py import unittest from app.models import News_sources class News_sources_Test(unittest.Testcase): """ Test Class to test the behaviour of the News_sources class """ def setup(self): ''' Set up method that w...
code_fim
medium
{ "lang": "python", "repo": "danalvin/news-highlights", "path": "/tests/test_news_sources.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pgThiago/learning-python path: /python-exercises-for-beginners/036.py # Escreva um programa para aprovar um empréstimo bancário para a compra de uma casa. # Pergunte o valor da casa, o salário do comprador e em quantos anos ele vai pagar # A prestação mensal não poderá exceder 30% do salário ou ...
code_fim
medium
{ "lang": "python", "repo": "pgThiago/learning-python", "path": "/python-exercises-for-beginners/036.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>u salário de {salario:.2f}') print('Empréstimo negado') elif prestacao <= exced: print(f'Para pagar uma casa de R$:{valor} em {anos} anos a sua parcela será igual a R$:{prestacao:.2f}')<|fim_prefix|># repo: pgThiago/learning-python path: /python-exercises-for-beginners/036.py # Escreva um program...
code_fim
medium
{ "lang": "python", "repo": "pgThiago/learning-python", "path": "/python-exercises-for-beginners/036.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class BAllWhiteBloodCancerMicroscopicImageTest(testing.DatasetBuilderTestCase): DATASET_CLASS = B_All_White_Blood_Cancer_Microscopic_Image.\ BAllWhiteBloodCancerMicroscopicImage SPLITS = { 'train': 2 } if __name__ == "__main__": testing.tes...
code_fim
medium
{ "lang": "python", "repo": "yihangx/TensorFlow_Contribution", "path": "/tensorflow_datasets/image/B_All_White_Blood_Cancer_Microscopic_Image_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yihangx/TensorFlow_Contribution path: /tensorflow_datasets/image/B_All_White_Blood_Cancer_Microscopic_Image_test.py from __future__ import absolute_import from __future__ import division from __future__ import print_function <|fim_suffix|> class BAllWhiteBloodCancerMicroscopicImageTest(testing.D...
code_fim
medium
{ "lang": "python", "repo": "yihangx/TensorFlow_Contribution", "path": "/tensorflow_datasets/image/B_All_White_Blood_Cancer_Microscopic_Image_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for resource in ret.return_type.resources: resource_name = resource.get('name') schema = Schema(resource.get('schema')) table = {'name': resource_name, 'title': resource.get('title', resource.get('name')), 'headers': schema.headers} ...
code_fim
hard
{ "lang": "python", "repo": "rockychen-dpaw/ledger", "path": "/wildlifelicensing/apps/returns/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rockychen-dpaw/ledger path: /wildlifelicensing/apps/returns/views.py import os import shutil import tempfile from datetime import date from django.views.generic.base import TemplateView from django.shortcuts import render, get_object_or_404, redirect from django.conf import settings from django...
code_fim
hard
{ "lang": "python", "repo": "rockychen-dpaw/ledger", "path": "/wildlifelicensing/apps/returns/views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Render a file. Calls get_render_fn and inputs get_environment(), get_context_data() and returns the render """ render = self.get_render_fn() environment = self.get_environment() context_data = self.get_context_data() try: ret...
code_fim
hard
{ "lang": "python", "repo": "ddugue/stake", "path": "/stake/renderer.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ddugue/stake path: /stake/renderer.py import os import logging import unicodedata import re from . import logging from jinja2 import Environment, BaseLoader, FileSystemLoader, TemplateNotFound, \ UndefinedError, Undefined class SilentUndefined(Undefined): """ Dont break pageloads beca...
code_fim
hard
{ "lang": "python", "repo": "ddugue/stake", "path": "/stake/renderer.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Return a callable that takes environment, ctxt_data and file""" def render(environment, ctxt_data, file_path): "Renders a jinja2 template" logging.debug("Rendering with context data %s", ctxt_data) template = environment.get_template(file_path) ...
code_fim
hard
{ "lang": "python", "repo": "ddugue/stake", "path": "/stake/renderer.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kai-wei-mo/epilepsy-guard path: /extract.py import os from PIL import Image import requests from io import BytesIO # Based on https://gist.github.com/BigglesZX/4016539 (but adapted to be a # generator that yields frames instead of a function that saves out frames) def analyseImage(im): ''' ...
code_fim
hard
{ "lang": "python", "repo": "kai-wei-mo/epilepsy-guard", "path": "/extract.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert prevFrame.mode == frame.mode, "Different kinds of images." assert prevFrame.size == frame.size, "Different sizes." pairs = zip(prevFrame.getdata(), frame.getdata()) if len(prevFrame.getbands()) == 1: # for gray-scale jpegs dif = sum(abs(p1-p2...
code_fim
hard
{ "lang": "python", "repo": "kai-wei-mo/epilepsy-guard", "path": "/extract.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pairs = zip(prevFrame.getdata(), frame.getdata()) if len(prevFrame.getbands()) == 1: # for gray-scale jpegs dif = sum(abs(p1-p2) for p1,p2 in pairs) else: dif = sum(abs(c1-c2) for p1,p2 in pairs for c1,c2 in zip(p1,p2)) ncomponents = pre...
code_fim
hard
{ "lang": "python", "repo": "kai-wei-mo/epilepsy-guard", "path": "/extract.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kajiyu/MANNs path: /models/utils.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np import os, sys δ = 1e-6 def t_cuda(x, use_cuda): if use_...
code_fim
hard
{ "lang": "python", "repo": "Kajiyu/MANNs", "path": "/models/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def σ(input, axis=1): """Softmax on an axis Softmax on an axis Arguments: input {Tensor} -- input Tensor Keyword Arguments: axis {number} -- axis on which to take softmax on (default: {1}) Returns: Tensor -- Softmax output Tensor """ input_size = in...
code_fim
hard
{ "lang": "python", "repo": "Kajiyu/MANNs", "path": "/models/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>δ = 1e-6 def t_cuda(x, use_cuda): if use_cuda: return x.cuda() else: return x def θ(a, b, dimA=2, dimB=2, normBy=2): """Batchwise Cosine distance Cosine distance Arguments: a {Tensor} -- A 3D Tensor (b * m * w) b {Tensor} -- A 3D Tensor (b * r * w) ...
code_fim
medium
{ "lang": "python", "repo": "Kajiyu/MANNs", "path": "/models/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: containers-kraken/heat path: /heat_integrationtests/functional/test_purge.py # 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/li...
code_fim
medium
{ "lang": "python", "repo": "containers-kraken/heat", "path": "/heat_integrationtests/functional/test_purge.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_purge(self): stack_identifier = self.stack_create(template=self.template) self._stack_delete(stack_identifier) stacks = dict((stack.id, stack) for stack in self.client.stacks.list(show_deleted=True)) self.assertIn(stack_identifier.split('/...
code_fim
medium
{ "lang": "python", "repo": "containers-kraken/heat", "path": "/heat_integrationtests/functional/test_purge.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if ds.GetRasterBand(1).Checksum() != cs1: print(ds.GetRasterBand(1).Checksum()) print(cs1) gdaltest.post_reason('Wrong checksum') return 'fail' if ds.GetRasterBand(2).Checksum() != cs2: print(ds.GetRasterBand(2).Checksum()) print(cs2) gdalte...
code_fim
hard
{ "lang": "python", "repo": "ShinNoNoir/gdal-1.11.5-vs2015", "path": "/autotest/utilities/test_gdalbuildvrt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShinNoNoir/gdal-1.11.5-vs2015 path: /autotest/utilities/test_gdalbuildvrt.py gdal.Open('tmp/mosaic.vrt') if ds.GetProjectionRef().find('WGS 84') == -1: gdaltest.post_reason('Expected WGS 84\nGot : %s' % (ds.GetProjectionRef()) ) return 'fail' gt = ds.GetGeoTransform() ...
code_fim
hard
{ "lang": "python", "repo": "ShinNoNoir/gdal-1.11.5-vs2015", "path": "/autotest/utilities/test_gdalbuildvrt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShinNoNoir/gdal-1.11.5-vs2015 path: /autotest/utilities/test_gdalbuildvrt.py sions : %d x %d' % (ds.RasterXSize, ds.RasterYSize) ) return 'fail' if ds.RasterCount != 1: gdaltest.post_reason('Wrong raster count : %d ' % (ds.RasterCount) ) return 'fail' if ds.GetRa...
code_fim
hard
{ "lang": "python", "repo": "ShinNoNoir/gdal-1.11.5-vs2015", "path": "/autotest/utilities/test_gdalbuildvrt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nagyist/sentry path: /tests/sentry/api/endpoints/test_project_agnostic_rule_conditions.py from django.urls import reverse from sentry.testutils import APITestCase from sentry.testutils.silo import region_silo_test @region_silo_test(stable=True) class ProjectAgnosticRuleConditionsTest(APITestCa...
code_fim
hard
{ "lang": "python", "repo": "nagyist/sentry", "path": "/tests/sentry/api/endpoints/test_project_agnostic_rule_conditions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.login_as(user=self.user) org = self.create_organization(owner=self.user, name="baz") url = reverse("sentry-api-0-project-agnostic-rule-conditions", args=[org.slug]) response = self.client.get(url, format="json") assert response.status_code == 200, response.con...
code_fim
medium
{ "lang": "python", "repo": "nagyist/sentry", "path": "/tests/sentry/api/endpoints/test_project_agnostic_rule_conditions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(iterations): value = ''.join(''.join(tup) for tup in break_string(value)) return value assert solution('1', 5) == '312211' PUZZLE_INPUT = '1113222113' part1 = len(solution(PUZZLE_INPUT, 40)) print(f'Part 1: {part1}') part2 = len(solution(PUZZLE_INPUT, 50)) print(f'Part 2: {...
code_fim
medium
{ "lang": "python", "repo": "M0nica/advent_of_code", "path": "/advent_of_code/2015/day10/aoc_day_10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def solution(value: str, iterations: int) -> str: for i in range(iterations): value = ''.join(''.join(tup) for tup in break_string(value)) return value assert solution('1', 5) == '312211' PUZZLE_INPUT = '1113222113' part1 = len(solution(PUZZLE_INPUT, 40)) print(f'Part 1: {part1}') part2 =...
code_fim
hard
{ "lang": "python", "repo": "M0nica/advent_of_code", "path": "/advent_of_code/2015/day10/aoc_day_10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: M0nica/advent_of_code path: /advent_of_code/2015/day10/aoc_day_10.py from typing import Generator, Tuple def break_string(string: str) -> Generator[Tuple[int, int], None, None]: <|fim_suffix|>def solution(value: str, iterations: int) -> str: for i in range(iterations): value = ''.jo...
code_fim
hard
{ "lang": "python", "repo": "M0nica/advent_of_code", "path": "/advent_of_code/2015/day10/aoc_day_10.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lham/tonguetwister path: /tonguetwister/gui/widgets/generic/actionbar.py from kivy.uix.boxlayout import BoxLayout from kivy.uix.stacklayout import StackLayout class ActionBarPanel(BoxLayout): spacing = 10 orientation = 'vertical' <|fim_suffix|> return action_bar def add_act...
code_fim
hard
{ "lang": "python", "repo": "lham/tonguetwister", "path": "/tonguetwister/gui/widgets/generic/actionbar.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return action_bar def add_action_bar_widget(self, widget): self.action_bar.add_widget(widget)<|fim_prefix|># repo: lham/tonguetwister path: /tonguetwister/gui/widgets/generic/actionbar.py from kivy.uix.boxlayout import BoxLayout from kivy.uix.stacklayout import StackLayout class Ac...
code_fim
medium
{ "lang": "python", "repo": "lham/tonguetwister", "path": "/tonguetwister/gui/widgets/generic/actionbar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: webclinic017/algotrading-47 path: /code/integrated-strategy/models/sentiment/collect_news_aastock.py from selenium import webdriver from selenium.webdriver.chrome.options import Options from webdriver_manager.chrome import ChromeDriverManager import datetime, time from bs4 import BeautifulSoup fr...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/algotrading-47", "path": "/code/integrated-strategy/models/sentiment/collect_news_aastock.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> idx = 0 path = os.path.join(dir_name,'data-news/' + 'data-' + ticker.zfill(4) + '-aastock.csv') action = 'a' if (newstype == 'news-daily'): action = 'w' if (len(dates) > 0): with open(path,action) as f: writer = csv.writer(...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/algotrading-47", "path": "/code/integrated-strategy/models/sentiment/collect_news_aastock.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|># Wyswietlenie grafu. gnu('set terminal pdf enhanced') gnu('set output "random_points.pdf"') gnu('set grid') gnu('unset key') gnu('set size square') #gnu('unset border') #gnu('unset tics') gnu('set xlabel "x"') gnu('set ylabel "y"') gnu('set title "Random points"') gnu('set xrange [{}:{}]'.format(0, 1)) ...
code_fim
medium
{ "lang": "python", "repo": "ufkapano/planegeometry", "path": "/planegeometry/structures/tests/random_points.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ufkapano/planegeometry path: /planegeometry/structures/tests/random_points.py #!/usr/bin/env python2 # # Gnuplot under Python # # http://gnuplot-py.sourceforge.net/ # Gnuplot.py is a Python package that interfaces to gnuplot. # # https://pypi.org/project/PyGnuplot/ # Python Gnuplot wrapper # pip ...
code_fim
medium
{ "lang": "python", "repo": "ufkapano/planegeometry", "path": "/planegeometry/structures/tests/random_points.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: machinezone/rcc path: /rcc/runner/reshard.py '''Tools to reshard a redis cluster Copyright (c) 2020 Machine Zone, Inc. All rights reserved. ''' import logging import traceback import click from rcc.cluster.reshard import binPackingReshard <|fim_suffix|> '''Reshard a cluster using the binp...
code_fim
hard
{ "lang": "python", "repo": "machinezone/rcc", "path": "/rcc/runner/reshard.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: binPackingReshard(redis_url, password, user, weight, timeout, dry, node_id) except Exception as e: backtrace = traceback.format_exc() logging.debug(f'traceback: {backtrace}') logging.error(f'reshard error: {e}')<|fim_prefix|># repo: machinezone/rcc path: /rcc/...
code_fim
hard
{ "lang": "python", "repo": "machinezone/rcc", "path": "/rcc/runner/reshard.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(kPDFLineStyleNone, 0) self.assertEqual(kPDFLineStyleSquare, 1) self.assertEqual(kPDFLineStyleCircle, 2) self.assertEqual(kPDFLineStyleDiamond, 3) self.assertEqual(kPDFLineStyleOpenArrow, 4) self.assertEqual(kPDFLineStyleClosedArrow, 5) if ...
code_fim
medium
{ "lang": "python", "repo": "danchr/pyobjc-git", "path": "/pyobjc-framework-Quartz/PyObjCTest/test_PDFAnnotationLine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danchr/pyobjc-git path: /pyobjc-framework-Quartz/PyObjCTest/test_PDFAnnotationLine.py from PyObjCTools.TestSupport import * from Quartz.PDFKit import * <|fim_suffix|> self.assertEqual(kPDFLineStyleNone, 0) self.assertEqual(kPDFLineStyleSquare, 1) self.assertEqual(kPDFLineS...
code_fim
medium
{ "lang": "python", "repo": "danchr/pyobjc-git", "path": "/pyobjc-framework-Quartz/PyObjCTest/test_PDFAnnotationLine.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sympy/sympy path: /sympy/sandbox/indexed_integrals.py from sympy.tensor import Indexed from sympy.core.containers import Tuple from sympy.core.symbol import Dummy from sympy.core.sympify import sympify from sympy.integrals.integrals import Integral class IndexedIntegral(Integral): """ E...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/sandbox/indexed_integrals.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> res = super().doit() return res.xreplace(self._indexed_reverse_repl) @staticmethod def _indexed_process_limits(limits): repl = {} newlimits = [] for i in limits: if isinstance(i, (tuple, list, Tuple)): v = i[0] vr...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/sandbox/indexed_integrals.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> s = ''.join(chr(i) for i in range(128)) assert text.parse(text.format(s)) == s<|fim_prefix|># repo: nipo/tdd path: /tdd/test/test_c40.py from ..c40 import c40, text def test_c40_parse(): assert c40.parse(b'\x57\xd3') == 'Ab' assert c40.parse(b'\x7b\xa7') == 'FRA' <|fim_middle|>def test_...
code_fim
hard
{ "lang": "python", "repo": "nipo/tdd", "path": "/tdd/test/test_c40.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nipo/tdd path: /tdd/test/test_c40.py from ..c40 import c40, text def test_c40_parse(): assert c40.parse(b'\x57\xd3') == 'Ab' assert c40.parse(b'\x7b\xa7') == 'FRA' <|fim_suffix|>def test_c40_iso(): s = ''.join(chr(i) for i in range(128)) assert c40.parse(c40.format(s)) == s def...
code_fim
medium
{ "lang": "python", "repo": "nipo/tdd", "path": "/tdd/test/test_c40.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: indico/indico-plugins-cern path: /foundationsync/indico_foundationsync/blueprint.py # This file is part of the CERN Indico plugins. # Copyright (C) 2014 - 2023 CERN # # The CERN Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; se...
code_fim
medium
{ "lang": "python", "repo": "indico/indico-plugins-cern", "path": "/foundationsync/indico_foundationsync/blueprint.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@blueprint.route('!/rooms/resolve/<building>/<floor>-<number>') def resolve_room(building, floor, number): room = Room.query.filter( ~Room.is_deleted, Room.building == building, Room.floor == floor, Room.number == number ).one_or_none() if not room: rais...
code_fim
medium
{ "lang": "python", "repo": "indico/indico-plugins-cern", "path": "/foundationsync/indico_foundationsync/blueprint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mounting = root.mounting hosts = mounting.get_machine_hosts() if hosts: for host in hosts: ip_address = '0.0.0.0' logger.cmd('Set host <b>%s</b> mapped at %s in /etc/hosts.' % (host, ip_address)) cmd = root.bash( "docker", ...
code_fim
hard
{ "lang": "python", "repo": "workon-io/docker-emperor", "path": "/docker_emperor/commands/hosts/set.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ip_address = '0.0.0.0' logger.cmd('Set host <b>%s</b> mapped at %s in /etc/hosts.' % (host, ip_address)) cmd = root.bash( "docker", "run", "-t", "-i" , "-v", "%s/managehosts:/bin/manageho...
code_fim
hard
{ "lang": "python", "repo": "workon-io/docker-emperor", "path": "/docker_emperor/commands/hosts/set.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: workon-io/docker-emperor path: /docker_emperor/commands/hosts/set.py import os from docker_emperor.commands import Command import docker_emperor.logger as logger def run(root, *args, **kwargs): <|fim_suffix|> for host in hosts: ip_address = '0.0.0.0' logger.cmd('...
code_fim
hard
{ "lang": "python", "repo": "workon-io/docker-emperor", "path": "/docker_emperor/commands/hosts/set.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_value(self, config): pass<|fim_prefix|># repo: ajenti/ajenti path: /plugins/terminal/widget.py from jadi import component from aj.plugins.dashboard.api import Widget <|fim_middle|>@component(Widget) class ScriptWidget(Widget): id = 'script' name = _('Script') template = ...
code_fim
hard
{ "lang": "python", "repo": "ajenti/ajenti", "path": "/plugins/terminal/widget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajenti/ajenti path: /plugins/terminal/widget.py from jadi import component from aj.plugins.dashboard.api import Widget <|fim_suffix|> def get_value(self, config): pass<|fim_middle|>@component(Widget) class ScriptWidget(Widget): id = 'script' name = _('Script') template = ...
code_fim
hard
{ "lang": "python", "repo": "ajenti/ajenti", "path": "/plugins/terminal/widget.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Widget.__init__(self, context) def get_value(self, config): pass<|fim_prefix|># repo: ajenti/ajenti path: /plugins/terminal/widget.py from jadi import component from aj.plugins.dashboard.api import Widget @component(Widget) class ScriptWidget(Widget): <|fim_middle|> id = 'script...
code_fim
hard
{ "lang": "python", "repo": "ajenti/ajenti", "path": "/plugins/terminal/widget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ludeeus/custom-component-store path: /componentstore/view/component/the_store.py """View for 'The Store'.""" import componentstore.resources.html as load from componentstore.functions.data import get_data, migration_needed async def view(): """View for 'The Store'.""" components = await...
code_fim
medium
{ "lang": "python", "repo": "ludeeus/custom-component-store", "path": "/componentstore/view/component/the_store.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cardcontent += load.TEXT.format(components[component]['description']) cardbutton = load.LINK.format( url='/component/'+component, target='_self', style='', id='', htmlclass='', extra='', text='More info') content += load.BUTTON_CARD.format( titl...
code_fim
hard
{ "lang": "python", "repo": "ludeeus/custom-component-store", "path": "/componentstore/view/component/the_store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DavidSongGitHub/kbmod path: /analysis/filter_utils.py import os import sys import shutil import numpy as np import pandas as pd import multiprocessing as mp from kbmodpy import kbmod as kb from astropy.io import fits from astropy.wcs import WCS from skimage import measure from sklearn.cluster imp...
code_fim
hard
{ "lang": "python", "repo": "DavidSongGitHub/kbmod", "path": "/analysis/filter_utils.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Q = 0 R = np.copy(var) R[R==0.] = 100. xhat[0] = obs[0] P[0] = R[0] for k in range(1,len(obs)): xhatminus[k] = xhat[k-1] Pminus[k] = P[k-1] + Q K[k] = Pminus[k] / (Pminus[k] + R[k]) xhat[k] = xhatminus[k] + K[k]*(obs[k]-xhatminus[k]) ...
code_fim
hard
{ "lang": "python", "repo": "DavidSongGitHub/kbmod", "path": "/analysis/filter_utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> i=0 for image in imageArray: if off_edge[i] is False: xmin = int(np.rint(measureCoords[i,1]-stampWidth[0]/2)) xmax = int(xmin + stampWidth[0]) ymin = int(np.rint(measureCoords[i,0]-stampWidth[1]/2)) ymax = int(ymin + stampWidth[1]) ...
code_fim
hard
{ "lang": "python", "repo": "DavidSongGitHub/kbmod", "path": "/analysis/filter_utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>age. # Use adaptive thresholding to "binarize" the image. binarized = cv2.adaptiveThreshold(gray_blur, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 11, 1) return binarized<|fim_prefix|># repo: lfa9603/his_vis_detector path: /utils/binarize.py import cv2 def binarizeFrame(f): ...
code_fim
medium
{ "lang": "python", "repo": "lfa9603/his_vis_detector", "path": "/utils/binarize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lfa9603/his_vis_detector path: /utils/binarize.py import cv2 def binarizeFrame(f): # binarizing image gray = cv2.cvtColor(f, cv2.COLOR_BGR2G<|fim_suffix|>(gray_blur, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 11, 1) return binarized<|fim_middle|>RAY) gray_blur = c...
code_fim
medium
{ "lang": "python", "repo": "lfa9603/his_vis_detector", "path": "/utils/binarize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Answer: -1 Question 8 What is a good statement to describe the is operator as used in the following if statement: if smallest is None : smallest = value The if statement is a syntax error matches both type and value Is true if the smallest variable has a value of -1 Looks up 'No...
code_fim
hard
{ "lang": "python", "repo": "ZiqiPolimeros/Python4E", "path": "/5 quiz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZiqiPolimeros/Python4E path: /5 quiz.py Question 1 What is wrong with this Python loop: n = 5 while n > 0 : print n print 'All done' This loop will run forever There should be no colon on the while statement The print 'All done' statement should be indented four spaces wh...
code_fim
hard
{ "lang": "python", "repo": "ZiqiPolimeros/Python4E", "path": "/5 quiz.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mperrin/jwst path: /jwst/lib/s3_utils.py """ Experimental support for reading reference files from S3. Use of these functions requires installing the [aws] extras (but this module can be safely imported without them). """ import atexit __all__ = ["object_exists", "get_object", "get_client", "i...
code_fim
hard
{ "lang": "python", "repo": "mperrin/jwst", "path": "/jwst/lib/s3_utils.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- bool `True` if value is an S3 URI, `False` if not. """ return value.startswith("s3://") def split_uri(uri): """ Split an S3 URI into bucket name and key components. Parameters ---------- uri : str S3 URI (s3://bucket-name/some/key)...
code_fim
hard
{ "lang": "python", "repo": "mperrin/jwst", "path": "/jwst/lib/s3_utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Twente-Mining/tezos-reward-distributor path: /src/cli/test_walletClientManager.py from unittest import TestCase from cli.wallet_client_manager import WalletClientManager class TestWalletClientManager(TestCase): def test_parse_get_manager_for_contract_response(self): response = """ ...
code_fim
hard
{ "lang": "python", "repo": "Twente-Mining/tezos-reward-distributor", "path": "/src/cli/test_walletClientManager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = """ Disclaimer: The Tezos network is a new blockchain technology. Users are solely responsible for any risks associated with usage of the Tezos network. Users should do their own re...
code_fim
hard
{ "lang": "python", "repo": "Twente-Mining/tezos-reward-distributor", "path": "/src/cli/test_walletClientManager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhaojiedi1992/MyStudyPython path: /IO编程/文件读写.py try: f = open('/path/to/file', 'r') print(f.read()) finally: if f: f.close() with open('/path/to/file', 'r') as f: print(f.read()) <|fim_suffix|> #stringio. byteio from io import StringIO f = StringIO() f.write("hello") f....
code_fim
medium
{ "lang": "python", "repo": "zhaojiedi1992/MyStudyPython", "path": "/IO编程/文件读写.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> from io import BytesIO f = BytesIO() f.write("中文".encode(encoding='utf-8')) print(f.getvalue())<|fim_prefix|># repo: zhaojiedi1992/MyStudyPython path: /IO编程/文件读写.py try: f = open('/path/to/file', 'r') print(f.read()) finally: if f: f.close() with open('/path/to/file', 'r') as f: ...
code_fim
medium
{ "lang": "python", "repo": "zhaojiedi1992/MyStudyPython", "path": "/IO编程/文件读写.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #stringio. byteio from io import StringIO f = StringIO() f.write("hello") f.write("world!") print(f.getvalue()) from io import BytesIO f = BytesIO() f.write("中文".encode(encoding='utf-8')) print(f.getvalue())<|fim_prefix|># repo: zhaojiedi1992/MyStudyPython path: /IO编程/文件读写.py try: f = open('/p...
code_fim
medium
{ "lang": "python", "repo": "zhaojiedi1992/MyStudyPython", "path": "/IO编程/文件读写.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: qparis/DecisionAmbiguityRecognition path: /src/VideoDownload.py # Code written by Pavel Jahoda from __future__ import unicode_literals import youtube_dl import os import subprocess import requests class MyLogger(object): def debug(self, msg): pass def warning(self, msg): ...
code_fim
hard
{ "lang": "python", "repo": "qparis/DecisionAmbiguityRecognition", "path": "/src/VideoDownload.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('Merging audio and video') pathToOutput = videoPath.split('/')[0] outputVideoName = videoName.split('.')[0] finalOutput = pathToOutput+'/'+outputVideoName commandToCall = 'ffmpeg -loglevel panic -i '+videoPath+' -i '+self.audioTitle+' -c copy '+finalOutput+'.m...
code_fim
hard
{ "lang": "python", "repo": "qparis/DecisionAmbiguityRecognition", "path": "/src/VideoDownload.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with youtube_dl.YoutubeDL(self.audioOptions) as ydlAudio: ydlAudio.download([url]) print('Done converting') def MergeAudioAndVideo(self,videoPath,videoName): print('Merging audio and video') pathToOutput = videoPath.split('/')[0] outputVideoName = ...
code_fim
hard
{ "lang": "python", "repo": "qparis/DecisionAmbiguityRecognition", "path": "/src/VideoDownload.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Form training batches dataset = tf.data.Dataset.from_tensor_slices(all_fname_numbers) dataset = dataset.shuffle(buffer_size=all_fname_numbers.shape[0], reshuffle_each_iteration=True) dataset = dataset.repeat(None) dataset = da...
code_fim
hard
{ "lang": "python", "repo": "antonilo/unsupervised_detection", "path": "/data/fbms_data_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antonilo/unsupervised_detection path: /data/fbms_data_utils.py def __init__(self, directory, part='train', for_testing=False, test_temporal_t=1): self.directory = directory self.num_experiments = 0 self.samples_per_cat = {} parsing_dir ={'train': ['Trainingset']...
code_fim
hard
{ "lang": "python", "repo": "antonilo/unsupervised_detection", "path": "/data/fbms_data_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antonilo/unsupervised_detection path: /data/fbms_data_utils.py 'val' : ['Testset'], 'trainval': ['Trainingset', 'Testset']} data_dirs = [os.path.join(directory, d) for d in parsing_dir.get(part)] for d in data_dirs: if not os.p...
code_fim
hard
{ "lang": "python", "repo": "antonilo/unsupervised_detection", "path": "/data/fbms_data_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> **Arguments:** Pass a voltage clamping stimulus, either ``h.SEClamp`` or ``h.VClamp``. The argument is optional. It is the keyword argument __voltclamp__. By default it is "SEClamp" because for NEURON this is the `recommended voltage clamping method <https://www.neuron.yale.edu/phpBB/viewtopic.php...
code_fim
hard
{ "lang": "python", "repo": "cerebunit/cerebmodels", "path": "/managers/operatorsYield/recorder.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cerebunit/cerebmodels path: /managers/operatorsYield/recorder.py # ~/managers/operatorsYield/recorder.py import numpy as np from random import randint from neuron import h class Recorder(object): """ ** Available methods:** +---------------------------------------------------+-----...
code_fim
hard
{ "lang": "python", "repo": "cerebunit/cerebmodels", "path": "/managers/operatorsYield/recorder.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>import matplotlib.pyplot as plt fig = plt.figure()<|fim_prefix|># repo: sphinx-gallery/sphinx-gallery path: /sphinx_gallery/tests/tinybuild/examples/plot_scraper_broken.py """ Error during scraping ===================== <|fim_middle|>The error is actually introduced by the resetter in ``conf.py``. It m...
code_fim
medium
{ "lang": "python", "repo": "sphinx-gallery/sphinx-gallery", "path": "/sphinx_gallery/tests/tinybuild/examples/plot_scraper_broken.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sphinx-gallery/sphinx-gallery path: /sphinx_gallery/tests/tinybuild/examples/plot_scraper_broken.py """ Error during scraping ===================== <|fim_suffix|>import matplotlib.pyplot as plt fig = plt.figure()<|fim_middle|>The error is actually introduced by the resetter in ``conf.py``. It m...
code_fim
medium
{ "lang": "python", "repo": "sphinx-gallery/sphinx-gallery", "path": "/sphinx_gallery/tests/tinybuild/examples/plot_scraper_broken.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: isaacmsl/byakuganv2 path: /byakugan/scripts/controle.py from byakugan.msg import BoolStamped, SensoresDistanciaMsg, BotoesMsg, CtrlMotores, BoolGarras from geometry_msgs.msg import Vector3Stamped class Controle: def __init__(self): self.__btns = BotoesMsg() self.__circulo = B...
code_fim
hard
{ "lang": "python", "repo": "isaacmsl/byakuganv2", "path": "/byakugan/scripts/controle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.__centroid = centroid def getDistancia(self, i): return self.__dist.sensoresDistancia[i]<|fim_prefix|># repo: isaacmsl/byakuganv2 path: /byakugan/scripts/controle.py from byakugan.msg import BoolStamped, SensoresDistanciaMsg, BotoesMsg, CtrlMotores, BoolGarras from geometry_...
code_fim
hard
{ "lang": "python", "repo": "isaacmsl/byakuganv2", "path": "/byakugan/scripts/controle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.__btns = BotoesMsg() self.__circulo = BoolStamped() self.__coordenadaCirculo = Vector3Stamped() self.__dist = SensoresDistanciaMsg() self.__centroid = BoolStamped() def btnsCb(self, btns): self.__btns = btns def temCirculoCb(self, circulo): ...
code_fim
medium
{ "lang": "python", "repo": "isaacmsl/byakuganv2", "path": "/byakugan/scripts/controle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }