text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>def _determines_copyright_dates() -> str: """Determines the years the copyright is in use for.""" this_year = datetime.now().year copyright_start_date = configuration.get_value(ConfigurationVariable.COPYRIGHT_START_DATE) return _to_copyright_date_string(copyright_start_date, this_year) d...
code_fim
hard
{ "lang": "python", "repo": "urutva/mbed-tools-ci-scripts", "path": "/mbed_tools_ci_scripts/license_files.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with codecs.open(args.input, "r", encoding='utf-8') as fin: for line in fin: if line == "" or line == "\n": continue else: info = line.strip().split("\t") gold_data = info[6] pred_data = info[5] ...
code_fim
hard
{ "lang": "python", "repo": "Aditi138/NeuralFactorGraph", "path": "/evaluateNRF.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aditi138/NeuralFactorGraph path: /evaluateNRF.py import argparse, codecs def manipulate_data(golds, hyps): # log.info("Lemma acc, Lemma Levenshtein, morph acc, morph F1") count = 0 morph_acc = 0 f1_precision_scores = 0 f1_precision_counts = 0 f1_recall_scores = 0 f1...
code_fim
hard
{ "lang": "python", "repo": "Aditi138/NeuralFactorGraph", "path": "/evaluateNRF.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/ShopDataDetail.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.ShopScoreResultInfo import ShopScoreResultInfo class ShopDataDetail(object): ...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/ShopDataDetail.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def to_alipay_dict(self): params = dict() if self.city_name: if hasattr(self.city_name, 'to_alipay_dict'): params['city_name'] = self.city_name.to_alipay_dict() else: params['city_name'] = self.city_name if self.county_na...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/ShopDataDetail.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #3.2 Linear SVC TARGET = "Linear_SVC" FrovedisServer.initialize("mpirun -np 8 " + os.environ["FROVEDIS_SERVER"]) f_est = frovSVC(loss='hinge', max_iter=10000) E_NM = TARGET + "_frovedis_" + frovedis.__version__ f_report = evaluate(f_est, E_NM, x_train, y_train, x_test, y_test) f_est.release() FrovedisSer...
code_fim
hard
{ "lang": "python", "repo": "frovedis/frovedis", "path": "/doc/notebook/python/01_1_ctr_binary_classification_sparse.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>train_time = [] test_time = [] accuracy = [] precision = [] recall = [] f1 = [] estimator_name = [] def evaluate(estimator, estimator_nm, x_train, y_train, x_test, y_test): ''' To generate performance report for both frovedis and sklearn estimators ''' estimator_...
code_fim
hard
{ "lang": "python", "repo": "frovedis/frovedis", "path": "/doc/notebook/python/01_1_ctr_binary_classification_sparse.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: frovedis/frovedis path: /doc/notebook/python/01_1_ctr_binary_classification_sparse.py #1. Description ''' Click though rate prediction using logistic regression. Please download the data from https://www.kaggle.com/c/avazu-ctr-prediction/ manually (registration required) and place `CTR_train` fi...
code_fim
hard
{ "lang": "python", "repo": "frovedis/frovedis", "path": "/doc/notebook/python/01_1_ctr_binary_classification_sparse.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Convert Jupyter notebooks to HTML files = getfiles('.ipynb') for f in files: os.system(f"jupyter nbconvert --to html {f}") # Move notebooks to docs/ os.system('mv *.html docs/.') os.chdir('docs') # Make index page. header = """ --- title: Data Testing Tutorial --- This contains static HTML vers...
code_fim
medium
{ "lang": "python", "repo": "pydatawrangler/data-testing-tutorial", "path": "/makedocs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pydatawrangler/data-testing-tutorial path: /makedocs.py import os def getfiles(extension): return [f for f in os.listdir() if f.endswith(extension)] def writefile(handle, string): with open(handle, 'w+') as f: f.write(string) <|fim_suffix|># Make index page. header = """ --- ...
code_fim
hard
{ "lang": "python", "repo": "pydatawrangler/data-testing-tutorial", "path": "/makedocs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> gt_match_indices = [torch.tensor([0, 1])] proposal_list = [ torch.Tensor([[23.6667, 23.8757, 228.6326, 153.8874], [23.6667, 23.8757, 228.6326, 153.8874]]) ] gt_bboxes = [ torch.Tensor([[23.6667, 23.8757, 228.6326, 153.8874], [23.6...
code_fim
hard
{ "lang": "python", "repo": "open-mmlab/mmtracking", "path": "/tests/test_models/test_track_heads/test_quasi_dense_embed_head.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: open-mmlab/mmtracking path: /tests/test_models/test_track_heads/test_quasi_dense_embed_head.py # Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch from mmdet.core import build_assigner, build_sampler from mmtrack.models.track_heads import QuasiDenseEmbedHead def test_quasi...
code_fim
hard
{ "lang": "python", "repo": "open-mmlab/mmtracking", "path": "/tests/test_models/test_track_heads/test_quasi_dense_embed_head.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Create sample results that can be passed to Head.get_targets.""" num_imgs = len(proposal_list) assign_config = dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1) sampler_config = dict( type='...
code_fim
hard
{ "lang": "python", "repo": "open-mmlab/mmtracking", "path": "/tests/test_models/test_track_heads/test_quasi_dense_embed_head.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return super(list_hardware, self).dispatch(request, *args, **kwargs) ############################################### @login_required def new_contact(request): title = 'New Contact' form = contactForm(request.POST or None) if request.POST: form = contactForm(request.POST)...
code_fim
hard
{ "lang": "python", "repo": "danteio/Dante-Dev", "path": "/atlas/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danteio/Dante-Dev path: /atlas/views.py from django.shortcuts import render, render_to_response, get_object_or_404, redirect from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.contrib.auth.decorators import login_required from django.conf import settings from dj...
code_fim
hard
{ "lang": "python", "repo": "danteio/Dante-Dev", "path": "/atlas/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> context['page_items'] = obj_z return context @method_decorator(login_required) def dispatch(self, request, *args, **kwargs): return super(list_airbill, self).dispatch(request, *args, **kwargs) ############################################### @login_required def new_pool(...
code_fim
hard
{ "lang": "python", "repo": "danteio/Dante-Dev", "path": "/atlas/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: haiiliin/pyabaqus path: /src/abaqus/Odb/OdbPretensionSection.py from .OdbMeshNode import OdbMeshNode from .OdbSet import OdbSet class OdbPretensionSection: """The pretension section object is used to define an assembly load. It associates a pretension node with a pretension section. ...
code_fim
medium
{ "lang": "python", "repo": "haiiliin/pyabaqus", "path": "/src/abaqus/Odb/OdbPretensionSection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # An OdbSet object specifying the surface set that defines the pretension section. surface: OdbSet = OdbSet("set", tuple[OdbMeshNode]()) # A tuple of Floats specifying the components of the normal to the pretension section. normal: float = None<|fim_prefix|># repo: haiiliin/pyabaqus path...
code_fim
hard
{ "lang": "python", "repo": "haiiliin/pyabaqus", "path": "/src/abaqus/Odb/OdbPretensionSection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # An OdbSet object specifying the element set that defines the pretension section. element: OdbSet = OdbSet("set", tuple[OdbMeshNode]()) # An OdbSet object specifying the surface set that defines the pretension section. surface: OdbSet = OdbSet("set", tuple[OdbMeshNode]()) # A tuple ...
code_fim
hard
{ "lang": "python", "repo": "haiiliin/pyabaqus", "path": "/src/abaqus/Odb/OdbPretensionSection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tractiming/trac-gae path: /apps/notifications/decorators.py from functools import wraps from django.conf import settings try: from google.appengine.api import taskqueue except ImportError: taskqueue = None <|fim_suffix|>def do_maybe_notification(func): """Wrap a method that returns ...
code_fim
medium
{ "lang": "python", "repo": "tractiming/trac-gae", "path": "/apps/notifications/decorators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Wrap a method that returns a serialized list of splits and send updates to the notification task queue. """ @wraps(func) def send_notification(*args, **kwargs): resp = func(*args, **kwargs) if settings.ENABLE_NOTIFICATIONS and taskqueue is not None: data ...
code_fim
medium
{ "lang": "python", "repo": "tractiming/trac-gae", "path": "/apps/notifications/decorators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NukeA/deep-learning-from-scratch-3 path: /dezero/functions.py ============================================================================= # Basic functions: sin / cos / tanh / exp / log # ============================================================================= class Sin(Function): def ...
code_fim
hard
{ "lang": "python", "repo": "NukeA/deep-learning-from-scratch-3", "path": "/dezero/functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NukeA/deep-learning-from-scratch-3 path: /dezero/functions.py ezero import cuda, utils from dezero.core import Function, Variable, as_variable, as_array # ============================================================================= # Basic functions: sin / cos / tanh / exp / log # ============...
code_fim
hard
{ "lang": "python", "repo": "NukeA/deep-learning-from-scratch-3", "path": "/dezero/functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Sigmoid(Function): def forward(self, x): xp = cuda.get_array_module(x) # y = 1 / (1 + xp.exp(-x)) y = xp.tanh(x * 0.5) * 0.5 + 0.5 # Better implementation return y def backward(self, gy): y = self.outputs[0]() gx = gy * y * (1 - y) re...
code_fim
hard
{ "lang": "python", "repo": "NukeA/deep-learning-from-scratch-3", "path": "/dezero/functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Save the object to the database immediately.""" db.session.add(self) db.session.commit() @classmethod def find_by_id(cls, request_tracker_id: int) -> RequestTracker: """Return the request tracker matching the id.""" request_tracker = None if requ...
code_fim
hard
{ "lang": "python", "repo": "bcgov/lear", "path": "/legal-api/src/legal_api/models/request_tracker.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bcgov/lear path: /legal-api/src/legal_api/models/request_tracker.py # Copyright © 2022 Province of British Columbia # # 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 # # ...
code_fim
hard
{ "lang": "python", "repo": "bcgov/lear", "path": "/legal-api/src/legal_api/models/request_tracker.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> provider_class = config['provider']['class'] module_name, class_name = provider_class.rsplit('.', 1) __import__(module_name) module = sys.modules[module_name] clazz = getattr(module, class_name) if not service_type: # if there is only one section (other then "provider")...
code_fim
hard
{ "lang": "python", "repo": "benchmarking-suite/benchsuite-core", "path": "/src/benchsuite/core/model/provider.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: benchmarking-suite/benchsuite-core path: /src/benchsuite/core/model/provider.py # Benchmarking Suite # Copyright 2014-2017 Engineering Ingegneria Informatica S.p.A. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
code_fim
hard
{ "lang": "python", "repo": "benchmarking-suite/benchsuite-core", "path": "/src/benchsuite/core/model/provider.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eferm/aoc-2020 path: /aoc_2020/day_08.py from operator import add, sub from _utils import * inp = get_input(2020, 8) tape = inp.strip().split("\n") def step(i, acc): op = {"+": add, "-": sub} instr, arg = tape[i].split() sign, num = arg[:1], arg[1:] if instr == "nop": ...
code_fim
medium
{ "lang": "python", "repo": "eferm/aoc-2020", "path": "/aoc_2020/day_08.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def swaps(tape): for i in range(len(tape)): tape_ = list(tape) t = tape_.pop(i) instr, arg = t.split() if instr == "jmp": t = f"nop {arg}" elif instr == "nop": t = f"jmp {arg}" tape_.insert(i, t) yield tape_ for tape in...
code_fim
hard
{ "lang": "python", "repo": "eferm/aoc-2020", "path": "/aoc_2020/day_08.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>register = Library() register.tag('food_network', do_get_food_network)<|fim_prefix|># repo: bhaugen/foodnetwork path: /distribution/templatetags/foodnetwork_tags.py from django.template import Library, Node from distribution.models import FoodNetwork class FoodNet(Node): def render(self, conte...
code_fim
medium
{ "lang": "python", "repo": "bhaugen/foodnetwork", "path": "/distribution/templatetags/foodnetwork_tags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhaugen/foodnetwork path: /distribution/templatetags/foodnetwork_tags.py from django.template import Library, Node from distribution.models import FoodNetwork <|fim_suffix|>register = Library() register.tag('food_network', do_get_food_network)<|fim_middle|>class FoodNet(Node): def rend...
code_fim
hard
{ "lang": "python", "repo": "bhaugen/foodnetwork", "path": "/distribution/templatetags/foodnetwork_tags.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def user_get(trans_id): request_url = "https://aip.baidubce.com/rest/2.0/face/v3/faceset/face/getlist" params = "{\"user_id\":\"" + str(trans_id) + "\",\"group_id\":\"students\"}" access_token = get_at(ak, sk) request_url = request_url + "?access_token=" + access_token headers = {'con...
code_fim
hard
{ "lang": "python", "repo": "Xchkoo/student_system_desktop", "path": "/app_mask/face_detect.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> user_face_token = user_get(trans_id) if user_face_token == -1: return {"msg": "FAIL"} access_token = get_at(ak, sk) request_url = "https://aip.baidubce.com/rest/2.0/face/v3/faceset/face/delete" params = "{\"user_id\":\""+str(trans_id)+"\",\"group_id\":\"students\",\"face_token\...
code_fim
hard
{ "lang": "python", "repo": "Xchkoo/student_system_desktop", "path": "/app_mask/face_detect.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xchkoo/student_system_desktop path: /app_mask/face_detect.py import requests import base64 ak = 'QsPqs20yfvQ7QcdnYfdWC5Ei' sk = 'EEMdjil0u1CW5uI3ts1mLD0VCQvTGYs6' def get_at(api_key, secret_key): host = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=" + a...
code_fim
hard
{ "lang": "python", "repo": "Xchkoo/student_system_desktop", "path": "/app_mask/face_detect.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>"PostForcastInteractor", "GetPrizeInteractor", "CreateUserInteractor", "GetUserInteractor", ]<|fim_prefix|># repo: ojos/python-devenv path: /src/fastapi/src/usecase/interactor/__init__.py from .forcast import PostForcastInteractor from .prize import GetPrizeInteractor from .rdb import Create<...
code_fim
hard
{ "lang": "python", "repo": "ojos/python-devenv", "path": "/src/fastapi/src/usecase/interactor/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ojos/python-devenv path: /src/fastapi/src/usecase/interactor/__init__.py from .forcast import PostForcastInteractor from .prize import GetPrizeInteractor from .rdb import CreateTableInteractor, DropTableInteractor, ITableInteractor from .user import CreateUserInteractor, GetUserInt<|fim_suffix|>"...
code_fim
medium
{ "lang": "python", "repo": "ojos/python-devenv", "path": "/src/fastapi/src/usecase/interactor/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gitCommitWiL/ChatterBot path: /tests/training/test_training.py from tests.base_case import ChatBotTestCase from chatterbot.trainers import Trainer from chatterbot.conversation import Statement <|fim_suffix|> self.assertEqual( [['Hello, how are you?', 'I am good.']], data ...
code_fim
hard
{ "lang": "python", "repo": "gitCommitWiL/ChatterBot", "path": "/tests/training/test_training.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_generate_export_data(self): self.chatbot.storage.create_many([ Statement(text='Hello, how are you?'), Statement(text='I am good.', in_response_to='Hello, how are you?') ]) data = self.trainer._generate_export_data() self.assertEqual( ...
code_fim
hard
{ "lang": "python", "repo": "gitCommitWiL/ChatterBot", "path": "/tests/training/test_training.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _read(self): return TCPStreamReceiver.read(self) def _release(self) -> None: TCPStreamReceiver.release(self)<|fim_prefix|># repo: GreenBlitz/GBVision path: /gbvision/utils/net/async_tcp_stream_receiver.py from .async_stream_receiver import AsyncStreamReceiver from .tcp_stream...
code_fim
hard
{ "lang": "python", "repo": "GreenBlitz/GBVision", "path": "/gbvision/utils/net/async_tcp_stream_receiver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> TCPStreamReceiver.__init__(self, ip, port, *args, **kwargs) AsyncStreamReceiver.__init__(self, *args, **kwargs) def _read(self): return TCPStreamReceiver.read(self) def _release(self) -> None: TCPStreamReceiver.release(self)<|fim_prefix|># repo: GreenBlitz/GBVisio...
code_fim
medium
{ "lang": "python", "repo": "GreenBlitz/GBVision", "path": "/gbvision/utils/net/async_tcp_stream_receiver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GreenBlitz/GBVision path: /gbvision/utils/net/async_tcp_stream_receiver.py from .async_stream_receiver import AsyncStreamReceiver from .tcp_stream_receiver import TCPStreamReceiver class AsyncTCPStreamReceiver(AsyncStreamReceiver, TCPStreamReceiver): <|fim_suffix|> def _read(self): ...
code_fim
medium
{ "lang": "python", "repo": "GreenBlitz/GBVision", "path": "/gbvision/utils/net/async_tcp_stream_receiver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vivekmumbles/coding-challenges path: /didi/goldman/goldman.py import sys, math nums = map(int, sys.stdin.readlines()[1:]) gauss = lambda x: (x/2.0)*(1+x) total = gauss(len(nums)-1) a = max(nums) nums.remove(a) b = max(nums) nums.remove(b) <|fim_suffix|>shit_fmt = lambda x: math.floor(x*100.0)/...
code_fim
medium
{ "lang": "python", "repo": "vivekmumbles/coding-challenges", "path": "/didi/goldman/goldman.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>shit_fmt = lambda x: math.floor(x*100.0)/100.0 # b/c hackerrank is dumb. print '{:.2f}'.format(shit_fmt(cnt/total))<|fim_prefix|># repo: vivekmumbles/coding-challenges path: /didi/goldman/goldman.py import sys, math nums = map(int, sys.stdin.readlines()[1:]) gauss = lambda x: (x/2.0)*(1+x) total = gaus...
code_fim
medium
{ "lang": "python", "repo": "vivekmumbles/coding-challenges", "path": "/didi/goldman/goldman.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # merge t_scopes scope = self.scope card = self.card for t_scope, t_card in zip(other.scope, other.card): try: scope.index(t_scope) except: scope.append(t_scope) card.append(t_card) # algo...
code_fim
hard
{ "lang": "python", "repo": "Anaphory/libpgm", "path": "/libpgm/tablecpdfactor.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Anaphory/libpgm path: /libpgm/tablecpdfactor.py # Copyright (c) 2012, CyberPoint International, LLC # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions ...
code_fim
hard
{ "lang": "python", "repo": "Anaphory/libpgm", "path": "/libpgm/tablecpdfactor.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if '{{' in line and '}}' in line and not ('#' in line and line.index('#') < line.index('{{')): begin = line.index('{{') end = line.index('}}', begin) variable_name = line[begin:end].strip().replace('{{','').replace('}}','').strip() try: ...
code_fim
hard
{ "lang": "python", "repo": "brlrt/instagram-botnet", "path": "/src/instabotnet/populate.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: brlrt/instagram-botnet path: /src/instabotnet/populate.py from colorama import init, Fore import os from string import Formatter import random from .support import merge def get_field_value(field_name, mapping): try: def recursive_get(field_name, mapping): if '.' not...
code_fim
hard
{ "lang": "python", "repo": "brlrt/instagram-botnet", "path": "/src/instabotnet/populate.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kfirstri/demisto-sdk path: /demisto_sdk/commands/common/tests/incident_field_test.py import pytest from demisto_sdk.commands.common.hook_validations.incident_field import ( GroupFieldTypes, IncidentFieldValidator) from demisto_sdk.commands.common.hook_validations.structure import \ Struct...
code_fim
hard
{ "lang": "python", "repo": "kfirstri/demisto-sdk", "path": "/demisto_sdk/commands/common/tests/incident_field_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> current_file = {"cliName": cliname, "group": group} with patch.object(StructureValidator, '__init__', lambda a, b: None): structure = StructureValidator("") structure.current_file = current_file structure.old_file = None structure.file_path =...
code_fim
hard
{ "lang": "python", "repo": "kfirstri/demisto-sdk", "path": "/demisto_sdk/commands/common/tests/incident_field_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_microphone.py #calss header class _MICROPHONE(): def __init__(self,): <|fim_suffix|> self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.specie = 'nouns' def run(self, obj1 = [], obj2 = []): return self...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_microphone.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def pltDataFrame(df): fig, axes = plt.subplots(nrows=2, ncols=4) fig.set(alpha=0.2) ans1onli = df.liNum[df["class"] == 1].value_counts() ans0onli = df.liNum[df["class"] == 0].value_counts() DataFrame({u'回答':ans1onli, u'未回答':ans0onli}) \ .plot(kind='bar', stacked=Fa...
code_fim
hard
{ "lang": "python", "repo": "bryandsy/ss_homework", "path": "/MachineLearning/sshomework_stag1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # ans0onTags = df.popTagsNum[df["class"] == 0].value_counts() # ans1onTags = df.popTagsNum[df["class"] == 1].value_counts() # DataFrame({u'回答':ans1onTags, # u'未回答':ans0onTags}) \ # .plot(kind='bar', stacked=False, # ax=plt.subplot2grid((2,4),(1,0), colspan=2)) # ...
code_fim
hard
{ "lang": "python", "repo": "bryandsy/ss_homework", "path": "/MachineLearning/sshomework_stag1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bryandsy/ss_homework path: /MachineLearning/sshomework_stag1.py # -*- coding: utf-8 -*- """ Created on Tue Jan 12 14:44:08 2016 @author: Jonater """ import math import random import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import matplotlib as mpl im...
code_fim
hard
{ "lang": "python", "repo": "bryandsy/ss_homework", "path": "/MachineLearning/sshomework_stag1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: heroku/fernet-py path: /fernet/fernet.py __author__ = 'spersinger' from .generator import Generator from .verifier import Verifier def generate(secret = None, message="", iv=None, now=None): """Public: generates a fernet token Returns the fernet token as a string. :param secret ...
code_fim
medium
{ "lang": "python", "repo": "heroku/fernet-py", "path": "/fernet/fernet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Public: generates a fernet token Returns the fernet token as a string. :param secret :param message :param options """ return Generator(secret=secret, message=message, iv=iv, now=now).generate() def verifier(secret, token, enforce_ttl=None, ttl=None, now=None): return V...
code_fim
medium
{ "lang": "python", "repo": "heroku/fernet-py", "path": "/fernet/fernet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return Verifier(secret=secret, token=token, enforce_ttl = enforce_ttl, ttl=ttl, now=now)<|fim_prefix|># repo: heroku/fernet-py path: /fernet/fernet.py __author__ = 'spersinger' from .generator import Generator from .verifier import Verifier def generate(secret = None, message="", iv=None, now=None)...
code_fim
medium
{ "lang": "python", "repo": "heroku/fernet-py", "path": "/fernet/fernet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>e = 'uploadPaperToChatGroup.html')), path('getChatGroupName', views.getChatGroupName), path('myChatGroupList.html', TemplateView.as_view(template_name = 'myChatGroupList.html')), path('createChatGroup.html', TemplateView.as_view(template_name = 'createChatGroup.html')), path('annotation-no...
code_fim
hard
{ "lang": "python", "repo": "wxzsan/pQper", "path": "/chatgroup/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wxzsan/pQper path: /chatgroup/urls.py from django.urls import path from . import views from django.views.generic.base import TemplateView urlpatterns = { path('add_annotation', views.add_annotation), path('getChatGroupPapers', views.getChatGroupPapers), path('getChatGroupMembers', vi...
code_fim
hard
{ "lang": "python", "repo": "wxzsan/pQper", "path": "/chatgroup/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pdf.html', TemplateView.as_view(template_name = 'showpdf.html')), path('memberInGroupPage.html', TemplateView.as_view(template_name = 'memberInGroupPage.html')), path('singleGroupPage.html', TemplateView.as_view(template_name = 'singleGroupPage.html')), path('uploadPaperToChatGroup.html', Temp...
code_fim
hard
{ "lang": "python", "repo": "wxzsan/pQper", "path": "/chatgroup/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rmin = r.min() rmax = r.max() ravg = r.mean() rmed = np.median(r) print ' ' print 'Minimum r-value = ', rmin print 'Maximum r-value = ', rmax print 'Mean r-value = ', ravg print 'Median r-value = ', rmed return r<|fim_prefix|># repo: gorsol/Pyroms-1 path: /p...
code_fim
hard
{ "lang": "python", "repo": "gorsol/Pyroms-1", "path": "/pyroms_toolbox/pyroms_toolbox/rfactor.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gorsol/Pyroms-1 path: /pyroms_toolbox/pyroms_toolbox/rfactor.py def rfactor(h,rmask): """ function r = rfactor(h,rmask) This function computes the bathymetry slope from a SCRUM NetCDF file. On Input: h bathymetry at RHO-points. rmask Land/Sea maski...
code_fim
medium
{ "lang": "python", "repo": "gorsol/Pyroms-1", "path": "/pyroms_toolbox/pyroms_toolbox/rfactor.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vlandeiro/yamlett path: /yamlett/artifact.py from typing import Any, Dict, Optional import cloudpickle as pickle from cloudpathlib import AnyPath class Artifact: MAGIC_KEY = "__yamlett_artifact__" <|fim_suffix|> def load(self): filepath = self.path.joinpath(f"{self.key}.pkl") ...
code_fim
hard
{ "lang": "python", "repo": "vlandeiro/yamlett", "path": "/yamlett/artifact.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> filepath = self.path.joinpath(f"{self.key}.pkl") with filepath.open("rb") as fd: return pickle.load(fd) def save(self): if self.value is not None: filepath = self.path.joinpath(f"{self.key}.pkl") with filepath.open("wb") as fd: ...
code_fim
hard
{ "lang": "python", "repo": "vlandeiro/yamlett", "path": "/yamlett/artifact.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.path = path self.key = key self.value = value @staticmethod def is_artifact(d: Dict): if isinstance(d, dict): return d.get(Artifact.MAGIC_KEY, False) return False def load(self): filepath = self.path.joinpath(f"{self.key}.pkl")...
code_fim
hard
{ "lang": "python", "repo": "vlandeiro/yamlett", "path": "/yamlett/artifact.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># outputs: ana.registerFile( mergedBamKey, 'galaxyOutput',galaxyOutMergedBam) resultsDir = ana.resultsDir(galaxyPath) # prefers nonGalaxyInput location over settings loc ana.createOutFile(mergedBamKey,'nonGalaxyOutput','%s_%s_merged',ext='bam', \ input1=bamAkey, input2=bamBkey) # Est...
code_fim
hard
{ "lang": "python", "repo": "ENCODE-DCC/uniformAnalysis", "path": "/src/galaxy/mergeBamsE3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ENCODE-DCC/uniformAnalysis path: /src/galaxy/mergeBamsE3.py #!/usr/bin/env python2.7 # mergeBamsE3.py ENCODE3 galaxy pipeline script for merging 2 bam replicates # Must run from within galaxy sub-directory. Requires settingsE3.txt in same directory as script # # Usage: python(2.7) mergeBamsE3,p...
code_fim
medium
{ "lang": "python", "repo": "ENCODE-DCC/uniformAnalysis", "path": "/src/galaxy/mergeBamsE3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zielmicha/cloudrun-client path: /cloudrun/common.py import requests, ssl, requests.adapters, socket, json from requests.packages.urllib3.poolmanager import PoolManager class HostNameIgnoringAdapter(requests.adapters.HTTPAdapter): def init_poolmanager(self, connections, maxsize, block=False):...
code_fim
hard
{ "lang": "python", "repo": "zielmicha/cloudrun-client", "path": "/cloudrun/common.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: while True: data = sock1.recv(40960) if not data: break sock2.sendall(data) except IOError as err: print(err)<|fim_prefix|># repo: zielmicha/cloudrun-client path: /cloudrun/common.py import requests, ssl, requests.adapters, socket, json fro...
code_fim
hard
{ "lang": "python", "repo": "zielmicha/cloudrun-client", "path": "/cloudrun/common.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: taoky/gadgets path: /backTCP/testch.py #!/usr/bin/python3 # Powered by FJW! import sys import os import argparse import random import threading import backTCP from utils import * # Actions: What to do for a stream of incoming packets # 0: Do nothing and forward # 1: Drop unless retransmit...
code_fim
hard
{ "lang": "python", "repo": "taoky/gadgets", "path": "/backTCP/testch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while True: action = random.choice(ACTIONS) log('debug', f"Action: {action}") packet_needed = max(1, action) packet_count = 0 while packet_count < packet_needed: p = in_sock.recv() if p is None: # The last ones aren't man...
code_fim
hard
{ "lang": "python", "repo": "taoky/gadgets", "path": "/backTCP/testch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for p in packets: out_sock.send(p) packets = [] def parse_args(): parser = argparse.ArgumentParser(description="starts a backTCP test channel", epilog="This program is created by iBug") parser.add_argument('-a', '--out-addr', '--address', metavar="addr", help="address...
code_fim
hard
{ "lang": "python", "repo": "taoky/gadgets", "path": "/backTCP/testch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for language_name in long_names: truncated = language_name[:PREVIOUS_NAME_MAX_LENGTH] try: lang = Language.objects.get(name=truncated) except Language.DoesNotExist: pass else: lang.name = language_name lang.save() class ...
code_fim
hard
{ "lang": "python", "repo": "pbanaszkiewicz/amy", "path": "/amy/workshops/migrations/0139_fix_language_names.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 1. (most inner) filter out non-language (sublanguages, dialects etc.) # 2. (middle) apply ' '.join(language['Description']) and therefore make it # a list of descriptions # 3. (top) filter out shorter language names long_names = filter( lambda x: len(x) >= PREVIOUS_NAME_MA...
code_fim
medium
{ "lang": "python", "repo": "pbanaszkiewicz/amy", "path": "/amy/workshops/migrations/0139_fix_language_names.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pbanaszkiewicz/amy path: /amy/workshops/migrations/0139_fix_language_names.py # -*- coding: utf-8 -*- # Generated by Django 1.9.12 on 2017-04-26 13:06 # Updated in Django 2.0.5 on 2018-06-02 11:15 from __future__ import unicode_literals import json from django.db import migrations, models PREV...
code_fim
hard
{ "lang": "python", "repo": "pbanaszkiewicz/amy", "path": "/amy/workshops/migrations/0139_fix_language_names.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_queryset(self, request): qs = super().get_queryset(request) return qs.filter(parent__isnull=False) class NavAdmin(nested_admin.NestedModelAdmin): inlines = [ NavInline, ] exclude = [ 'parent', ] list_display = ( 'title', 'us...
code_fim
hard
{ "lang": "python", "repo": "RoboLoCo-5338/website", "path": "/blog/admin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RoboLoCo-5338/website path: /blog/admin.py from django.contrib import admin from .models.comment import Comment from .models.post import Post from .models.nav import Nav from .models.files import Files from .models.meeting import Meeting from .models.member import Member from .models.signin impo...
code_fim
hard
{ "lang": "python", "repo": "RoboLoCo-5338/website", "path": "/blog/admin.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class MemberAdmin(admin.ModelAdmin): inlines = [ SigninInline, ] readonly_fields = ('hours', 'created', 'modified') fields = ('user', 'team', 'name', 'slack', 'created', 'modified', 'hours') list_display = ( 'team', 'name', 'user', 'slack', ...
code_fim
hard
{ "lang": "python", "repo": "RoboLoCo-5338/website", "path": "/blog/admin.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gridcoin-community/GRC-HUG-REST-API path: /WIP/extract.py import gzip import requests import msgpack from multiprocessing import Pool import time import xmltodict WORKER_COUNT = 4 # Add CPUs & increase this value to supercharge processing downloaded <|fim_suffix|>def download_extract_stats(proj...
code_fim
hard
{ "lang": "python", "repo": "gridcoin-community/GRC-HUG-REST-API", "path": "/WIP/extract.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print("len: {}".format(len(file_content['users']['user']))) pool = Pool(processes=WORKER_COUNT) # 4 workers pool_xml_data = pool.map(extract_xml_step, file_content['users']['user']) # Deploy the pool workers msg_packed_results = msgpack.packb(pool_xml_data, use_bin_type=...
code_fim
hard
{ "lang": "python", "repo": "gridcoin-community/GRC-HUG-REST-API", "path": "/WIP/extract.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ccampguilhem/Udacity-DataAnalyst path: /03-DataWranglingWithMongoDB/P02-WrangleOpenStreetMapData/completeness_audit.py from utils import * """ Data completeness audit object in a form of a callback for SAX content handler. This audit class checks compliance to gold standard. The nonconformities...
code_fim
hard
{ "lang": "python", "repo": "ccampguilhem/Udacity-DataAnalyst", "path": "/03-DataWranglingWithMongoDB/P02-WrangleOpenStreetMapData/completeness_audit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass """ Method called back when an end event is encountered. - name: element name - children: element children - locator: locator object from SAX parser """ def endEventCallback(self, name, children, locator): #Find item with a tag child having amenit...
code_fim
hard
{ "lang": "python", "repo": "ccampguilhem/Udacity-DataAnalyst", "path": "/03-DataWranglingWithMongoDB/P02-WrangleOpenStreetMapData/completeness_audit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _config(self): self.CLK_FREQ = Param(int(100e6)) def _declr(self): addClkRstn(self) super(SimpleIfStatementHls, self)._declr() def _impl(self): with Hls(self, freq=self.CLK_FREQ) as h: io = h.io a = io(self.a) b = io(sel...
code_fim
medium
{ "lang": "python", "repo": "daiwaka/hwtHls", "path": "/hwtHls/tests/ifstm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": # alias python main function from hwt.synthesizer.utils import toRtl u = SimpleIfStatementHls() p = VirtualHlsPlatform() print(toRtl(u, targetPlatform=p))<|fim_prefix|># repo: daiwaka/hwtHls path: /hwtHls/tests/ifstm.py #!/usr/bin/env python3 # -*- coding: ut...
code_fim
hard
{ "lang": "python", "repo": "daiwaka/hwtHls", "path": "/hwtHls/tests/ifstm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daiwaka/hwtHls path: /hwtHls/tests/ifstm.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- from hwt.code import If from hwt.interfaces.utils import addClkRstn from hwt.synthesizer.param import Param from hwtHls.hls import Hls from hwtHls.platform.virtual import VirtualHlsPlatform from hwtLib.sa...
code_fim
medium
{ "lang": "python", "repo": "daiwaka/hwtHls", "path": "/hwtHls/tests/ifstm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> num_test_samples = 512 # evaluating on latest model print("\nCalculating error over " + str(num_test_samples) + " test samples... (using latest model)") predictions = model.predict_generator(generate_data(image_path, test, num_test_samples, patch_size), steps=1) np.save("predictions_l...
code_fim
hard
{ "lang": "python", "repo": "EdwardDixon/ml-and-security", "path": "/transfer_student.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Sequential() model.add(conv_base) model.add(Flatten()) model.add(Dense(32, activation='relu')) model.add(BatchNormalization()) model.add(Dense(num_target_values, name="prediction")) return (model) def make_all_layers_trainable(mdl, is_trainable = True): for layer...
code_fim
hard
{ "lang": "python", "repo": "EdwardDixon/ml-and-security", "path": "/transfer_student.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EdwardDixon/ml-and-security path: /transfer_student.py ''' Trains a simple convnet to recognise a smile ''' from __future__ import print_function from os.path import exists import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, BatchNormalization fro...
code_fim
hard
{ "lang": "python", "repo": "EdwardDixon/ml-and-security", "path": "/transfer_student.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def send_post(submission, r2t): total_size = clean_after_module() r2t.send_text('Deleted: ' + str(round(total_size / (1024.0 ** 3), 3)) + 'GB.') return SupplyResult.STOP_THIS_SUPPLY<|fim_prefix|># repo: Lambada10/reddit2telegram path: /reddit2telegram/channels/tech_cleaner/app.py from utils ...
code_fim
easy
{ "lang": "python", "repo": "Lambada10/reddit2telegram", "path": "/reddit2telegram/channels/tech_cleaner/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> total_size = clean_after_module() r2t.send_text('Deleted: ' + str(round(total_size / (1024.0 ** 3), 3)) + 'GB.') return SupplyResult.STOP_THIS_SUPPLY<|fim_prefix|># repo: Lambada10/reddit2telegram path: /reddit2telegram/channels/tech_cleaner/app.py from utils import SupplyResult, clean_after_...
code_fim
medium
{ "lang": "python", "repo": "Lambada10/reddit2telegram", "path": "/reddit2telegram/channels/tech_cleaner/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lambada10/reddit2telegram path: /reddit2telegram/channels/tech_cleaner/app.py from utils import SupplyResult, clean_after_module from utils.tech import get_dev_channel <|fim_suffix|>def send_post(submission, r2t): total_size = clean_after_module() r2t.send_text('Deleted: ' + str(round(t...
code_fim
easy
{ "lang": "python", "repo": "Lambada10/reddit2telegram", "path": "/reddit2telegram/channels/tech_cleaner/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def on_reduced_position(self, order): self.take_profit = abs(self.position.qty), self.price def go_short(self): pass def should_cancel_entry(self): return False def filters(self): return [] def should_short(self): return False<|fim_prefix|># ...
code_fim
hard
{ "lang": "python", "repo": "jesse-ai/jesse", "path": "/jesse/strategies/Test18/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def filters(self): return [] def should_short(self): return False<|fim_prefix|># repo: jesse-ai/jesse path: /jesse/strategies/Test18/__init__.py from jesse.strategies import Strategy # test_on_reduced_position class Test18(Strategy): def should_long(self): <|fim_middle|> ...
code_fim
hard
{ "lang": "python", "repo": "jesse-ai/jesse", "path": "/jesse/strategies/Test18/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jesse-ai/jesse path: /jesse/strategies/Test18/__init__.py from jesse.strategies import Strategy # test_on_reduced_position class Test18(Strategy): def should_long(self): return self.price < 7 <|fim_suffix|> return [] def should_short(self): return False<|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "jesse-ai/jesse", "path": "/jesse/strategies/Test18/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: furas/python-examples path: /pyqt5/animation-after-animation/main.py # date: 2019.08.01 # https://stackoverflow.com/questions/57308598/rectangle-moving/57309451#57309451 # https://www.qtcentre.org/threads/32958-multiple-QPropertyAnimations-after-each-other-how # https://doc.qt.io/qt-5/qpropertya...
code_fim
hard
{ "lang": "python", "repo": "furas/python-examples", "path": "/pyqt5/animation-after-animation/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.anim = QPropertyAnimation(self.frame, b"geometry") self.anim.setDuration(1000) self.anim.setStartValue(QRect(0, 300, 100, 100)) self.anim.setEndValue(QRect(0, 0, 100, 100)) self.anim.finished.connect(self.doAnimation_1) self.anim.start() if __name__...
code_fim
hard
{ "lang": "python", "repo": "furas/python-examples", "path": "/pyqt5/animation-after-animation/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tjd2002/spikeforest2 path: /repos/spiketoolkit/spiketoolkit/comparison/__init__.py from .sortingcomparison import SortingComparison, MappedSortingExtractor, compute_per<|fim_suffix|>ingcomparison import MultiSortingComparison<|fim_middle|>formance, confusion_matrix from .multisort
code_fim
easy
{ "lang": "python", "repo": "tjd2002/spikeforest2", "path": "/repos/spiketoolkit/spiketoolkit/comparison/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ingcomparison import MultiSortingComparison<|fim_prefix|># repo: tjd2002/spikeforest2 path: /repos/spiketoolkit/spiketoolkit/comparison/__init__.py from .sortingcomparison import SortingComp<|fim_middle|>arison, MappedSortingExtractor, compute_performance, confusion_matrix from .multisort
code_fim
medium
{ "lang": "python", "repo": "tjd2002/spikeforest2", "path": "/repos/spiketoolkit/spiketoolkit/comparison/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._module = module self.deploy_cfg = deploy_cfg if not self._module.dec_gru: rnn_decoder_layer1 = copy.deepcopy(self._module.rnn_decoder_layer1) rnn_decoder_layer2 = copy.deepcopy(self._module.rnn_decoder_layer2) self._module.rnn_decoder_layer...
code_fim
hard
{ "lang": "python", "repo": "open-mmlab/mmdeploy", "path": "/mmdeploy/codebase/mmocr/models/text_recognition/sar_decoder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @MODULE_REWRITER.register_rewrite_module( 'mmocr.models.textrecog.decoders.SequentialSARDecoder', backend='default') class SequentialSARDecoder(nn.Module): """Rewrite Sequential Decoder module in `SAR. SequentialSARDecoder apply nn.LSTMCell inside, which brings obstacles to deployment. L...
code_fim
hard
{ "lang": "python", "repo": "open-mmlab/mmdeploy", "path": "/mmdeploy/codebase/mmocr/models/text_recognition/sar_decoder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }