text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> while True: clock.tick(60) for event in pygame.event.get(): if event.type == QUIT: sys.exit() elif event.type == KEYDOWN and event.key == K_ESCAPE: break BLOCKS.update() BLOCKS.clear( screen, background ) BLOCKS.draw(screen) pygame.display.flip()<|fim_prefix|># repo: iPatso/P...
code_fim
hard
{ "lang": "python", "repo": "iPatso/PyGameProjs", "path": "/PYex/Mario Shell Defense/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HenriqueLR/movie-book path: /app/movies/forms.py #encoding: utf-8 from django import forms from core.models import Movies, ScheduledMovies <|fim_suffix|>class ScheduledMoviesForm(forms.ModelForm): ''' This class is responsible generator form ScheduledMoviesForm. ''' class Meta: ...
code_fim
medium
{ "lang": "python", "repo": "HenriqueLR/movie-book", "path": "/app/movies/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' This class is responsible generator form MovieForm. ''' class Meta: model = Movies class ScheduledMoviesForm(forms.ModelForm): ''' This class is responsible generator form ScheduledMoviesForm. ''' class Meta: model = ScheduledMovies<|fim_prefix|># repo:...
code_fim
easy
{ "lang": "python", "repo": "HenriqueLR/movie-book", "path": "/app/movies/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Custom Driver for file based ExampleGen, e.g., ImportExampleGen.""" def get_input_processor( self, splits: Iterable[example_gen_pb2.Input.Split], range_config: Optional[range_config_pb2.RangeConfig] = None, input_base_uri: Optional[str] = None) -> input_processor.InputProce...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/tfx", "path": "/tfx/components/example_gen/driver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/tfx path: /tfx/components/example_gen/driver.py # Copyright 2019 Google LLC. All Rights Reserved. # # 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 # # htt...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/tfx", "path": "/tfx/components/example_gen/driver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Tag fields = ('name',) class VideoSerializer(ModelSerializer): href = HyperlinkedIdentityField(view_name='api_v2:videos-detail') tags = TagSerializer(many=True, read_only=True) user = serializers.SerializerMethodField() filename = serializers.Seria...
code_fim
hard
{ "lang": "python", "repo": "lotube/lotube", "path": "/lotube/videos/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lotube/lotube path: /lotube/videos/serializers.py import urllib from annoying.functions import get_object_or_None from django.db import transaction from django.utils.safestring import mark_safe from rest_framework import serializers from rest_framework.serializers import SerializerMethodField, r...
code_fim
hard
{ "lang": "python", "repo": "lotube/lotube", "path": "/lotube/videos/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return ContextUtils(self.context)\ .build_absolute_uri(reverse('api_v2:video-comments-list', [obj.id])) def create(self, validated_data): # logged in required user = ContextUtils(self.context).logged_in_user() # create video video = Video(**validat...
code_fim
hard
{ "lang": "python", "repo": "lotube/lotube", "path": "/lotube/videos/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kwotsin/mimicry path: /torch_mimicry/nets/infomax_gan/infomax_gan_base.py """ Implementation of InfoMax-GAN base model. """ import torch import torch.nn.functional as F from torch_mimicry.nets.gan import gan class InfoMaxGANBaseGenerator(gan.BaseGenerator): r""" ResNet backbone generat...
code_fim
hard
{ "lang": "python", "repo": "kwotsin/mimicry", "path": "/torch_mimicry/nets/infomax_gan/infomax_gan_base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def project_features(self, local_feat, global_feat): r""" Projects local and global features. """ local_feat = self._project_local( local_feat) # (N, C, H, W) --> (N, nrkhs, H, W) global_feat = self._project_global( global_feat) # (N, C...
code_fim
hard
{ "lang": "python", "repo": "kwotsin/mimicry", "path": "/torch_mimicry/nets/infomax_gan/infomax_gan_base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oasis-open/cti-python-stix2 path: /stix2/test/v21/test_parsing.py from collections import OrderedDict import pytest from stix2 import DEFAULT_VERSION, exceptions, parsing, registration, registry BUNDLE = { "type": "bundle", "id": "bundle--00000000-0000-4000-8000-000000000007", "obj...
code_fim
hard
{ "lang": "python", "repo": "oasis-open/cti-python-stix2", "path": "/stix2/test/v21/test_parsing.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.xfail(reason="The default version is not 2.1", condition=DEFAULT_VERSION != "2.1") def test_register_marking_with_no_version(): # Uses default version (2.1 in this case) class NewMarking2: _type = 'x-new-marking2' _properties = OrderedDict() registration._register...
code_fim
hard
{ "lang": "python", "repo": "oasis-open/cti-python-stix2", "path": "/stix2/test/v21/test_parsing.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> _type = 'x-new-marking1' _properties = OrderedDict() registration._register_marking(NewMarking1, version='2.1') assert NewMarking1._type in registry.STIX2_OBJ_MAPS['2.1']['markings'] assert 'v21' in str(registry.STIX2_OBJ_MAPS['2.1']['markings'][NewMarking1._type]) @pytest....
code_fim
hard
{ "lang": "python", "repo": "oasis-open/cti-python-stix2", "path": "/stix2/test/v21/test_parsing.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ayoob7/google-research path: /hmc_swindles/neutra.py eapfrog_multiplier = integrators[integrator] kinetic_energy_fn = fun_mcmc.make_gaussian_kinetic_energy_fn(1) integrator_fn = lambda state: fun_mcmc.hamiltonian_integrator( # pylint: disable=g-long-lambda state, num_steps=num_...
code_fim
hard
{ "lang": "python", "repo": "Ayoob7/google-research", "path": "/hmc_swindles/neutra.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for chain_stats_vr_cv, vr_outputs_cv, cv_beta_val in vr_inputs: vr_outputs_cv1 = GetVarianceReducedChain(fx_chain, fxcv_chain, fxcv_mean, cv_beta_val) if return_vr_chains: vr_outputs_cv[name] = vr_outputs_cv1 ...
code_fim
hard
{ "lang": "python", "repo": "Ayoob7/google-research", "path": "/hmc_swindles/neutra.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ayoob7/google-research path: /hmc_swindles/neutra.py proposal_fn=proposal_fn, log_uniform=log_uniform) def trace_fn(state, extra): x, xcv = tf.split(state.state_extra, 2, axis=0) return (x, xcv, extra.log_accept_ratio, extra.is_accepted) (_, (x_chain, xcv_chain, log_accep...
code_fim
hard
{ "lang": "python", "repo": "Ayoob7/google-research", "path": "/hmc_swindles/neutra.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Decorators 'pass_context', 'pass_obj', 'make_pass_decorator', 'command', 'group', 'argument', 'option', 'confirmation_option', 'password_option', 'version_option', 'help_option', # Types 'ParamType', 'File', 'Path', 'Choice', 'IntRange', 'Tuple', 'DateTime', 'STRING', 'INT',...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/training-data-analyst", "path": "/courses/machine_learning/deepdive2/end_to_end_ml/labs/serving/application/lib/click/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GoogleCloudPlatform/training-data-analyst path: /courses/machine_learning/deepdive2/end_to_end_ml/labs/serving/application/lib/click/__init__.py # -*- coding: utf-8 -*- """ click ~~~~~ Click is a simple Python module inspired by the stdlib optparse to make writing command line scripts fun. Unlik...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/training-data-analyst", "path": "/courses/machine_learning/deepdive2/end_to_end_ml/labs/serving/application/lib/click/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Globals from .globals import get_current_context # Decorators from .decorators import pass_context, pass_obj, make_pass_decorator, \ command, group, argument, option, confirmation_option, \ password_option, version_option, help_option # Types from .types import ParamType, File, Path, Choice,...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/training-data-analyst", "path": "/courses/machine_learning/deepdive2/end_to_end_ml/labs/serving/application/lib/click/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ziang-Lu/Flask-Blog path: /post_service/post_service/utils.py # -*- coding: utf-8 -*- """ Utility functions. """ import functools from typing import Callable from flask import request from flask_marshmallow import Schema from .models import Post <|fim_suffix|> """ Pagination decorator...
code_fim
hard
{ "lang": "python", "repo": "Ziang-Lu/Flask-Blog", "path": "/post_service/post_service/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Populate the pagination metadata pagination_meta = { 'page': page, 'pages': p.pages, 'total': p.total } return { 'status': 'success', 'data': { 'user_data'...
code_fim
hard
{ "lang": "python", "repo": "Ziang-Lu/Flask-Blog", "path": "/post_service/post_service/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @functools.wraps(f) def wrapper(*args, **kwargs): page = request.args.get('page', type=int, default=1) per_page = min( request.args.get('per_page', type=int, default=10), max_per_page ) result = f(*args, **kwargs) ...
code_fim
hard
{ "lang": "python", "repo": "Ziang-Lu/Flask-Blog", "path": "/post_service/post_service/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_coordinates_straight_road(zarr_dataset: ChunkedDataset, cfg: dict) -> None: # on a straight road `target_positions` should increase on x only render_context = RenderContext( np.asarray(cfg["raster_params"]["raster_size"]), np.asarray(cfg["raster_params"]["pixel_size"]), ...
code_fim
hard
{ "lang": "python", "repo": "KhushalB/l5kit", "path": "/l5kit/l5kit/tests/sampling/displace_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> centroids.append(data["centroid"][:2]) centroids = np.stack(centroids) # compute XY variances for preds and centroids var_preds = np.var(preds, 0, ddof=1) var_centroids = np.var(centroids, 0, ddof=1) assert var_preds[1] / var_preds[0] < 0.001 # variance on Y is way lower tha...
code_fim
hard
{ "lang": "python", "repo": "KhushalB/l5kit", "path": "/l5kit/l5kit/tests/sampling/displace_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KhushalB/l5kit path: /l5kit/l5kit/tests/sampling/displace_test.py import numpy as np import pytest from l5kit.data import ChunkedDataset from l5kit.dataset import EgoDataset from l5kit.geometry import compute_agent_pose, rotation33_as_yaw, transform_points from l5kit.rasterization import RenderC...
code_fim
hard
{ "lang": "python", "repo": "KhushalB/l5kit", "path": "/l5kit/l5kit/tests/sampling/displace_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # image index img_index = [40*a + b for i, a in enumerate(rA) for b in rI[i]] # create sub-folders for subjects Sfolder = path.join(folder, f'subject_{S}') imfolder = path.join(Sfolder, imgType_i) if not path.exists(Sfolder): ...
code_fim
hard
{ "lang": "python", "repo": "heysoos/cppn-tensorflow", "path": "/generate_samples_for_subjects.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> imgs_paths, imgs_params = load_img_paths_and_params(save_folder, img_folder) # sort so similar params are together, with iteration number as well sort_keys = filter_keys[:] sort_keys.append('iteration') sort_list = [tuple((img_params[k]) for k in sort_keys) for img_params in imgs_par...
code_fim
hard
{ "lang": "python", "repo": "heysoos/cppn-tensorflow", "path": "/generate_samples_for_subjects.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: heysoos/cppn-tensorflow path: /generate_samples_for_subjects.py import numpy as np from os import path, makedirs, listdir from operator import itemgetter from sampler import loadJSON import shutil from PIL import Image import imageio from tqdm import tqdm def load_img_paths_and_params(dir, img_f...
code_fim
hard
{ "lang": "python", "repo": "heysoos/cppn-tensorflow", "path": "/generate_samples_for_subjects.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rfam/rfam-website path: /PfamScripts/adda/lib/AddaSegment.py min_distance_border = int(float(self.min_distance_border) / self.resolution) if self.mContinueAt == None: self.mOutfile.write( "\t".join( self.mHeaders) + "\n" ) self.mOutfile.flush() #-...
code_fim
hard
{ "lang": "python", "repo": "Rfam/rfam-website", "path": "/PfamScripts/adda/lib/AddaSegment.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if ranges: lranges, rranges = self.getCoveringRanges( lranges, rranges, ranges ) else: continue # change left child ntree[leftchild][0]= (None, current_node, level + 1, lranges) ...
code_fim
hard
{ "lang": "python", "repo": "Rfam/rfam-website", "path": "/PfamScripts/adda/lib/AddaSegment.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ## if previous segment is too small to be output: add to current type if (last_right - last_left) < self.min_segment_size: last_right = this_right last_type = this_type # print "d" continue ## otherwis...
code_fim
hard
{ "lang": "python", "repo": "Rfam/rfam-website", "path": "/PfamScripts/adda/lib/AddaSegment.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JSchneidler/nand2tetris path: /10_11_compiler/jack_compiler/tokenizer.py import logging from enum import Enum from html import escape from pathlib import Path SYMBOLS = [ "{", "}", "(", ")", "[", "]", ".", ",", ";", "+", "-", "*", "/", "&",...
code_fim
hard
{ "lang": "python", "repo": "JSchneidler/nand2tetris", "path": "/10_11_compiler/jack_compiler/tokenizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check for keyword found = False for keyword in KEYWORDS: if line.startswith(keyword): found = True tokens.append( Token(TokenType.KEYWORD, keyword, lineNumber, ...
code_fim
hard
{ "lang": "python", "repo": "JSchneidler/nand2tetris", "path": "/10_11_compiler/jack_compiler/tokenizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Crawling and write on text file textfile=open('Flyday_comment_list.txt','w',encoding='utf-8') for i in range(1,pages+1): urls=urlopen(widget_url + "&page=" + str(i)) obj=soup(urls,"html.parser") reviews = obj.find('div',{"id":"content"}).find('div',{"class"...
code_fim
hard
{ "lang": "python", "repo": "devTaemin/Clothing-Crawler", "path": "/Complete_crawler/FLYDAY/#FLYDAY_Crawler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: devTaemin/Clothing-Crawler path: /Complete_crawler/FLYDAY/#FLYDAY_Crawler.py # -*- coding: utf-8 -*- """ Created on Wed May 8 20:12:33 2019 @author: Taemin """ from bs4 import BeautifulSoup as soup from urllib.request import urlopen from math import ceil #Sequence : URL input => widget => Cr...
code_fim
hard
{ "lang": "python", "repo": "devTaemin/Clothing-Crawler", "path": "/Complete_crawler/FLYDAY/#FLYDAY_Crawler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('activities', '0015_auto_20200128_1045'), ('funding', '0050_auto_20200124_1230'), ] operations = [ migrations.RunPython(migrate_funding,migrations.RunPython.noop) ]<|fim_prefix|># repo: onepercentclub/bluebottle path: /bluebottle/funding/migrati...
code_fim
medium
{ "lang": "python", "repo": "onepercentclub/bluebottle", "path": "/bluebottle/funding/migrations/0051_funding_update_contribution_date.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: onepercentclub/bluebottle path: /bluebottle/funding/migrations/0051_funding_update_contribution_date.py # -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2020-01-29 12:43 from __future__ import unicode_literals from django.db import migrations from django.db.models import F def migrate_f...
code_fim
medium
{ "lang": "python", "repo": "onepercentclub/bluebottle", "path": "/bluebottle/funding/migrations/0051_funding_update_contribution_date.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ 绘制干扰点 """ chance = min(100, max(0, int(point_chance))) for w in range(width): for h in range(height): temp = random.randint(0, 100) if temp > 100 - chance: draw.point((w, h), fill=cls.__gen_random_c...
code_fim
hard
{ "lang": "python", "repo": "huzidabanzhang/python-admin", "path": "/libs/captcha.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def __gen_random_font(cls): """ 采用随机字体 :return: """ fonts = ["consola.ttf", "consolab.ttf", "consolai.ttf"] font = random.choice(fonts) return ("utils/captcha/" if IsWindows() else "/home/") + font @classmethod def gen_t...
code_fim
hard
{ "lang": "python", "repo": "huzidabanzhang/python-admin", "path": "/libs/captcha.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huzidabanzhang/python-admin path: /libs/captcha.py #!/usr/bin/env python # -*- coding:UTF-8 -*- ''' @Description: 验证码 @Author: Zpp @Date: 2019-09-17 15:07:00 @LastEditors: Zpp @LastEditTime: 2020-05-07 10:52:52 ''' import random import string """ Image: 画布 ImageDraw: 画笔 ImageFont: 字体 """ from PI...
code_fim
hard
{ "lang": "python", "repo": "huzidabanzhang/python-admin", "path": "/libs/captcha.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if sys.version_info < (3,): # noqa raise ImportError( """You are running GWPopulation 0.5.0 or higher on Python 2 GWPopulation 0.5.0 and above are no longer compatible with Python 2, and you still ended up with this version installed. That's unfortunate; sorry about that. It should not have ...
code_fim
medium
{ "lang": "python", "repo": "yanyuechuixue/gwpopulation", "path": "/gwpopulation/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yanyuechuixue/gwpopulation path: /gwpopulation/__init__.py """ GWPopulation ============ A collection of code for doing population inference. All of this code will run on either CPUs or GPUs using cupy for GPU acceleration. This includes: - commonly used likelihood functions in the Bilby fra...
code_fim
hard
{ "lang": "python", "repo": "yanyuechuixue/gwpopulation", "path": "/gwpopulation/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> $ pip install pip setuptools --upgrade Your choices: - Upgrade to Python 3. - Install an older version of GWPopulation: $ pip install 'gwpopulation<0.5.0' It would be great if you can figure out how this version ended up being installed, and try to check how to prevent that for future users. """ ...
code_fim
hard
{ "lang": "python", "repo": "yanyuechuixue/gwpopulation", "path": "/gwpopulation/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>gg.") sm.warp(900090103, 0) sm.dispose()<|fim_prefix|># repo: Bratah123/v203.4 path: /scripts/npc/dragonEgg.py # dragon Egg (1013002) | sm.startQuest<|fim_middle|>(22011) sm.completeQuest(22011) sm.systemMessage("You have acquired a Dragon E
code_fim
medium
{ "lang": "python", "repo": "Bratah123/v203.4", "path": "/scripts/npc/dragonEgg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bratah123/v203.4 path: /scripts/npc/dragonEgg.py # dragon Egg (1013002) | sm.startQuest<|fim_suffix|>gg.") sm.warp(900090103, 0) sm.dispose()<|fim_middle|>(22011) sm.completeQuest(22011) sm.systemMessage("You have acquired a Dragon E
code_fim
medium
{ "lang": "python", "repo": "Bratah123/v203.4", "path": "/scripts/npc/dragonEgg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bratah123/v203.4 path: /scripts/npc/dragonEgg.py # dragon Egg (1013002) | sm.startQuest(22011) sm.completeQuest(22011) sm.syst<|fim_suffix|>gg.") sm.warp(900090103, 0) sm.dispose()<|fim_middle|>emMessage("You have acquired a Dragon E
code_fim
easy
{ "lang": "python", "repo": "Bratah123/v203.4", "path": "/scripts/npc/dragonEgg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: code-cullison/gnam path: /events/gstations.wtf.py from obspy.clients.fdsn import Client from obspy import UTCDateTime from obspy import Stream from pyproj import Proj, transform from gnam.events.gevents import gevents as ge from gnam.model.bbox import bbox as bb import numpy as np import copy imp...
code_fim
hard
{ "lang": "python", "repo": "code-cullison/gnam", "path": "/events/gstations.wtf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert (ekey in self._event_stations_dict) assert (bkey in self._event_stations_dict[ekey]) assert (skey in self._event_stations_dict[ekey][bkey]) return self._event_stations_dict[ekey][bkey][skey] def getIncludedStations(self,ekey,bkey): return self._getStatio...
code_fim
hard
{ "lang": "python", "repo": "code-cullison/gnam", "path": "/events/gstations.wtf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._getStream(ekey,bkey,'2') def _getStations(self,ekey,bkey,skey): assert (ekey in self._event_stations_dict) assert (bkey in self._event_stations_dict[ekey]) assert (skey in self._event_stations_dict[ekey][bkey]) return self._event_stations_dict[eke...
code_fim
hard
{ "lang": "python", "repo": "code-cullison/gnam", "path": "/events/gstations.wtf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kdmukai/notifyme path: /notifyme.py import argparse import configparser import sys import boto3 parser = argparse.ArgumentParser(description='notifyme.py -- A simple SNS notification script') parser.add_argument(dest="target_phrase", help="input in quotes") parser.add_arg...
code_fim
hard
{ "lang": "python", "repo": "kdmukai/notifyme", "path": "/notifyme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for line in sys.stdin: if target_phrase in line: sys.stdout.write("TARGET PHRASE! %s" % line) msg = line[line.index(target_phrase):] if note: msg = "%s: %s" % (note, msg) sns.publish(Message="%s: %s" % (host, msg), TopicArn=sns_to...
code_fim
hard
{ "lang": "python", "repo": "kdmukai/notifyme", "path": "/notifyme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return (self.getClipsSize() <= 0) def isMulti (self): return (self.getClipsSize() > 0) def hasTitle (self): value = '' if self.title is None else self.title.strip() return (len(value) > 0) def hasDescription (self): value = '' if self.description is None else self.description....
code_fim
hard
{ "lang": "python", "repo": "tuaplicacionpropia/text2img", "path": "/text2img/clips.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tuaplicacionpropia/text2img path: /text2img/clips.py #!/usr/bin/env python # -*- coding: utf-8 -*- import os import copy import io import lxml.etree as ET import hjson import sys import tempfile #import xml.etree.ElementTree as ET #tree = ET.parse('/home/jmramoss/almacen/plantillas_collage/test/...
code_fim
hard
{ "lang": "python", "repo": "tuaplicacionpropia/text2img", "path": "/text2img/clips.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lymanwong/Python-Projects path: /algorithms/friend_or_foe/friend_or_foe.py # Make a program that filters a list of strings and returns a list with only your friends name in it. All your friends only have four letter in their name. <|fim_suffix|>print friend(["Ryan", "Kieran", "Mark",]) #["Ryan",...
code_fim
medium
{ "lang": "python", "repo": "lymanwong/Python-Projects", "path": "/algorithms/friend_or_foe/friend_or_foe.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list = [] for name in x: if len(name) == 4: list.append(name) return list print friend(["Ryan", "Kieran", "Mark",]) #["Ryan", "Mark"]<|fim_prefix|># repo: lymanwong/Python-Projects path: /algorithms/friend_or_foe/friend_or_foe.py # Make a program that filters a list of strings and return...
code_fim
medium
{ "lang": "python", "repo": "lymanwong/Python-Projects", "path": "/algorithms/friend_or_foe/friend_or_foe.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("hello") @cli.add("hi方法") def hi(): print("hi") cli.run()<|fim_prefix|># repo: wanggs4/util path: /example/use_cli.py #! /usr/bin/env python # -*- coding: UTF-8 -*- from util.tool.cli import cli <|fim_middle|>if __name__ == '__main__': @cli.add("hello方法") d...
code_fim
medium
{ "lang": "python", "repo": "wanggs4/util", "path": "/example/use_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wanggs4/util path: /example/use_cli.py #! /usr/bin/env python # -*- coding: UTF-8 -*- from util.tool.cli import cli if __name__ == '__main__': <|fim_suffix|> print("hi") cli.run()<|fim_middle|> @cli.add("hello方法") def hello(): print("hello") @cli.add("hi方法") ...
code_fim
medium
{ "lang": "python", "repo": "wanggs4/util", "path": "/example/use_cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def connected_routes(self) -> List[str]: return [ '/user' ] @staticmethod async def get(request: Request) -> Response: try: login = await authorized_userid(request) if not login: return respond_with_json({"error": "Un...
code_fim
hard
{ "lang": "python", "repo": "jawello/e-shop-api-monolit", "path": "/e-shop_api/app/endpoints/user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jawello/e-shop-api-monolit path: /e-shop_api/app/endpoints/user.py from typing import List from aiohttp.web import Request from aiohttp.web_response import Response from aiohttp_rest_api import AioHTTPRestEndpoint from aiohttp_rest_api.responses import respond_with_json from aiohttp_security imp...
code_fim
hard
{ "lang": "python", "repo": "jawello/e-shop-api-monolit", "path": "/e-shop_api/app/endpoints/user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize( "retention_policy", [ hstrat.perfect_resolution_algo.Policy(), hstrat.nominal_resolution_algo.Policy(), hstrat.fixed_resolution_algo.Policy(fixed_resolution=10), ], ) def test_policy_to_records_version_warning( retention_policy, caplog...
code_fim
hard
{ "lang": "python", "repo": "mmore500/hstrat", "path": "/tests/test_hstrat/test_serialization/test_policy_to_records.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mmore500/hstrat path: /tests/test_hstrat/test_serialization/test_policy_to_records.py import json import logging import pytest from hstrat import hstrat from hstrat._auxiliary_lib import log_once_in_a_row @pytest.mark.parametrize( "retention_policy", [ hstrat.perfect_resolutio...
code_fim
hard
{ "lang": "python", "repo": "mmore500/hstrat", "path": "/tests/test_hstrat/test_serialization/test_policy_to_records.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def GetWLANIP(): try: cmd = "ip addr show wlan0 | grep inet | grep -v inet6 | awk '{print $2}' | cut -d '/' -f 1" p = Popen(cmd, shell=True, stdout=PIPE) output = p.communicate()[0] ip = output[:-1] if(ip ==""): return "-" else: return ip except: r...
code_fim
hard
{ "lang": "python", "repo": "nanomesher/Nanomesher_PiSwitchCap", "path": "/OLEDDisplayDemo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nanomesher/Nanomesher_PiSwitchCap path: /OLEDDisplayDemo.py #!/usr/bin/env python # This is a demo to show ip address of eth0 and wlan0 network interace on the ProdBoard OLED Display ''' Copyright [2017] [Nanomesher Limited - www.nanomesher.com] Licensed under the Apache License, Version 2.0 (...
code_fim
hard
{ "lang": "python", "repo": "nanomesher/Nanomesher_PiSwitchCap", "path": "/OLEDDisplayDemo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: anselmobd/fo2 path: /src/geral/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-09-12 18:52 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> dependencies = [ ] ...
code_fim
hard
{ "lang": "python", "repo": "anselmobd/fo2", "path": "/src/geral/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='RecordTracking', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('user', models.CharField(max_length=64, verbose_name='Usuário')), ...
code_fim
hard
{ "lang": "python", "repo": "anselmobd/fo2", "path": "/src/geral/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arkydon/tukaan path: /tukaan/app.py import os import sys import types from typing import Any, Optional import _tkinter as tk from ._base import TkWidget from ._layouts import BaseLayoutManager from ._utils import TukaanError, from_tcl, to_tcl from ._window_mixin import WindowMixin tcl_interp =...
code_fim
hard
{ "lang": "python", "repo": "arkydon/tukaan", "path": "/tukaan/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def split_list(self, arg) -> tuple: return self.app.splitlist(arg) def run(self) -> None: self.app.mainloop(0) def quit(self) -> None: """ There is no App.destroy, just App.quit, which also quits the entire tcl interpreter """ global tc...
code_fim
hard
{ "lang": "python", "repo": "arkydon/tukaan", "path": "/tukaan/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if type(L) == QUSO: N = L.num_binary_variables model = L.to_quso() self._mapping = L.mapping self._reverse_mapping = L.reverse_mapping self._variables = L.variables self._initial_state = ( initial_state.copy() if init...
code_fim
hard
{ "lang": "python", "repo": "zeta1999/qubovert", "path": "/qubovert/sim/_quso_simulation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zeta1999/qubovert path: /qubovert/sim/_quso_simulation.py # Copyright 2020 Joseph T. Iosue # # 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....
code_fim
hard
{ "lang": "python", "repo": "zeta1999/qubovert", "path": "/qubovert/sim/_quso_simulation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def schedule_update(self, schedule, in_order=False, seed=None): """schedule_update. Update the simulation with a schedule. This function wraps the C implementation of the simulation. Parameters ---------- schedule : iterable of tuples. Each...
code_fim
hard
{ "lang": "python", "repo": "zeta1999/qubovert", "path": "/qubovert/sim/_quso_simulation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.ndim = len(start) self.likelihood = likelihood self.lp = lp self.nwalkers = nwalkers self.nthreads = nthreads self.sampler = emcee.EnsembleSampler(self.nwalkers, self.ndim, ...
code_fim
hard
{ "lang": "python", "repo": "darthoctopus/PBjam", "path": "/pbjam/mcmc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: darthoctopus/PBjam path: /pbjam/mcmc.py import emcee import numpy as np import scipy.stats as st class mcmc(): """ Class for MCMC sampling Use EMCEE to fit a provided model to a spectrum. Parameters ---------- start : ndarray An array of size ndim for the starting p...
code_fim
hard
{ "lang": "python", "repo": "darthoctopus/PBjam", "path": "/pbjam/mcmc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>plt.gcf().tight_layout() plt.gcf().set_size_inches((12.24, 6.01)) plt.gcf().subplots_adjust(left=0.12, bottom=0.13, right=0.96, top=0.96, wspace=0.75, hspace=.95)<|fim_prefix|># repo: simeoncarstens/ensemble_hic path: /scripts/plots/nora2012/make_nora_p...
code_fim
hard
{ "lang": "python", "repo": "simeoncarstens/ensemble_hic", "path": "/scripts/plots/nora2012/make_nora_plots.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sys.path.append(os.path.expanduser('~/projects/ensemble_hic/scripts/plots/nora2012/')) fish_axes = [plt.subplot2grid(fig_shape, (i / 3, 3 + i % 3)) for i in range(7)] from distance_distributions import plot_all_hists plot_all_hists(fish_axes) from TAD_analysis import plot_TADcm_hist mix_ax = plt.subplot2...
code_fim
medium
{ "lang": "python", "repo": "simeoncarstens/ensemble_hic", "path": "/scripts/plots/nora2012/make_nora_plots.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: simeoncarstens/ensemble_hic path: /scripts/plots/nora2012/make_nora_plots.py import os import sys import numpy as np import matplotlib import matplotlib.pyplot as plt sys.path.append(os.path.expanduser('~/projects/ensemble_hic/scripts/plots/')) fig_shape = (6,9) <|fim_suffix|>sys.path.append(os...
code_fim
medium
{ "lang": "python", "repo": "simeoncarstens/ensemble_hic", "path": "/scripts/plots/nora2012/make_nora_plots.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser( epilog=('Example: ./on_device_tests_gateway_client.py ' '--test_type=unit_test ' '--remote_archive_path=gs://my_bucket/path/to/artifacts.tar ' '--platform=raspi-2 ' '--config=devel'), formatter_class=ar...
code_fim
hard
{ "lang": "python", "repo": "youtube/cobalt", "path": "/tools/on_device_tests_gateway_client.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def run_watch_command(self, workdir: str, args: argparse.Namespace): """Calls On-Device Tests watch service and passing given parameters to it. Args: workdir (str): Current script workdir. args (Namespace): Arguments passed in command line. """ for response_line in self....
code_fim
hard
{ "lang": "python", "repo": "youtube/cobalt", "path": "/tools/on_device_tests_gateway_client.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: youtube/cobalt path: /tools/on_device_tests_gateway_client.py #!/usr/bin/env python3 # # Copyright 2022 The Cobalt Authors. All Rights Reserved. # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "youtube/cobalt", "path": "/tools/on_device_tests_gateway_client.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ax.set_ylim([0, 14.8]) ax.set_xlim([0, 15.5]) ax.set_xticks(range(16)) ax.set_yticks(range(15)) ax.set_ylabel('# Irrelevant Results to View') ax.set_xlabel('# Relevant Results Required') ax.legend((rects1[0], rects2[0]), ('CodeCatch', 'Google'), handletextpad=0.5) fig.tight_layout() #fig.subplots_adjus...
code_fim
hard
{ "lang": "python", "repo": "Vidya77/CodeCatch-RSSE", "path": "/experiments/process_search_length.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vidya77/CodeCatch-RSSE path: /experiments/process_search_length.py import os import json import matplotlib.pyplot as plt FIG_DIR = "C:/Users/themis/Desktop/RAISE2018/images/" if os.path.exists("C:/Users/themis/Desktop/RAISE2018/images/") else "C:/Users/user/Desktop/RAISE2018/images/" def search...
code_fim
medium
{ "lang": "python", "repo": "Vidya77/CodeCatch-RSSE", "path": "/experiments/process_search_length.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for regex, module in persistence_regexes.iteritems(): if re.match(regex, self.uri): return module raise ValueError('{} is not a valid persistence uri. Available handlers are {}.' .format(self.uri, [m.uri_regex for m in PERSISTENCE_LIST]...
code_fim
hard
{ "lang": "python", "repo": "zanachka/exporters", "path": "/exporters/persistence/persistence_config_dispatcher.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> raise ValueError('{} is not a valid persistence uri. Available handlers are {}.' .format(self.uri, [m.uri_regex for m in PERSISTENCE_LIST])) @property def config(self): return self.persistence_dispatcher.configuration_from_uri( self.uri, self.p...
code_fim
hard
{ "lang": "python", "repo": "zanachka/exporters", "path": "/exporters/persistence/persistence_config_dispatcher.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zanachka/exporters path: /exporters/persistence/persistence_config_dispatcher.py import re from exporters.persistence import PERSISTENCE_LIST class PersistenceConfigDispatcher(object): def __init__(self, uri): self.uri = uri self.persistence_dispatcher = self.get_module_fro...
code_fim
hard
{ "lang": "python", "repo": "zanachka/exporters", "path": "/exporters/persistence/persistence_config_dispatcher.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>tPage from .StrikePage import StrikePage<|fim_prefix|># repo: mscroggs/KLBFAX path: /page/special/__init__.py from .NamePage import NamePage from .LunchPage import LunchPage from .PubPage i<|fim_middle|>mport PubPage from .LeetPage import Lee
code_fim
easy
{ "lang": "python", "repo": "mscroggs/KLBFAX", "path": "/page/special/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mscroggs/KLBFAX path: /page/special/__init__.py from .NamePage import NamePage from .Lu<|fim_suffix|>mport PubPage from .LeetPage import LeetPage from .StrikePage import StrikePage<|fim_middle|>nchPage import LunchPage from .PubPage i
code_fim
easy
{ "lang": "python", "repo": "mscroggs/KLBFAX", "path": "/page/special/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>uare # 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 #/ class LeetCode_221_510:<|fim_prefix|># repo: chenlei65368/algorithm004-05 path: /Week 5/id_510/w/LeetCode_221_510.py ## #在一个由 0 和 1 组成的二维矩阵内,找到只包含 1 的最大正方形,并返回其面积。 # # 示例: # # 输入<|fim_middle|>: # # 1 0 1 0 0 # 1 0 1 1 1 # 1 1 1 1 1 # 1 0 0 1 0 ...
code_fim
medium
{ "lang": "python", "repo": "chenlei65368/algorithm004-05", "path": "/Week 5/id_510/w/LeetCode_221_510.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chenlei65368/algorithm004-05 path: /Week 5/id_510/w/LeetCode_221_510.py ## #在一个由 0 和 1 组成的二维矩阵内,找到只包含 1 的最大正方形,并返回其面积。 # # 示例: # # 输入<|fim_suffix|>uare # 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 #/ class LeetCode_221_510:<|fim_middle|>: # # 1 0 1 0 0 # 1 0 1 1 1 # 1 1 1 1 1 # 1 0 0 1 0 ...
code_fim
medium
{ "lang": "python", "repo": "chenlei65368/algorithm004-05", "path": "/Week 5/id_510/w/LeetCode_221_510.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># # 来源:力扣(LeetCode) # 链接:https://leetcode-cn.com/problems/maximal-square # 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 #/ class LeetCode_221_510:<|fim_prefix|># repo: chenlei65368/algorithm004-05 path: /Week 5/id_510/w/LeetCode_221_510.py ## #在一个由 0 和 1 组成的二维矩阵内,找到只包含 1 的最大正方形,并返回其面积。 # # 示例: # # 输入<|...
code_fim
medium
{ "lang": "python", "repo": "chenlei65368/algorithm004-05", "path": "/Week 5/id_510/w/LeetCode_221_510.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> .. note:: Use the cursor selection if startPos and endPos are none. """ QtGui.QTextEdit.ExtraSelection.__init__(self) self.signals = TextDecorationSignals() self.draw_order = draw_order self.tooltip = tooltip cursor = QtGui.QTextCursor(cursorOrBlockO...
code_fim
hard
{ "lang": "python", "repo": "mukolx/pyqode.core", "path": "/pyqode/core/decoration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def underlined(self, color=QtCore.Qt.blue): self.format.setUnderlineStyle( QtGui.QTextCharFormat.SingleUnderline) self.format.setUnderlineColor(color) def setSpellchecking(self, color=QtCore.Qt.blue): """ Underlines text as a spellcheck error. :param c...
code_fim
hard
{ "lang": "python", "repo": "mukolx/pyqode.core", "path": "/pyqode/core/decoration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mukolx/pyqode.core path: /pyqode/core/decoration.py #!/usr/bin/env python # -*- coding: utf-8 -*- # #The MIT License (MIT) # #Copyright (c) <2013-2014> <Colin Duquesnoy and others, see AUTHORS.txt> # #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software a...
code_fim
hard
{ "lang": "python", "repo": "mukolx/pyqode.core", "path": "/pyqode/core/decoration.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 'VL_ITEM', 'CST_ICMS', 'CFOP', 'ALIQ_ICMS', 'VL_PIS', 'VL_COFINS'] self._hierarchy = "5"<|fim_prefix|># repo: sebastiao-sousa-br/Extrator_SPEDFiscal path:...
code_fim
hard
{ "lang": "python", "repo": "sebastiao-sousa-br/Extrator_SPEDFiscal", "path": "/Regs/Block_C/RC470.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sebastiao-sousa-br/Extrator_SPEDFiscal path: /Regs/Block_C/RC470.py from ..IReg import IReg class RC470(IReg): def __init__(self): self._header = ['REG', <|fim_suffix|> 'VL_ITEM', 'CST_ICMS', 'CF...
code_fim
hard
{ "lang": "python", "repo": "sebastiao-sousa-br/Extrator_SPEDFiscal", "path": "/Regs/Block_C/RC470.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #----- gene ----- readable_info = "" json_info = [] for batch_id in tqdm(range(batch_numb) , ncols = 70 , desc = "Generating..."): #----- get data ----- data = dataset[batch_id * batch_size:(batch_id+1) * batch_size] sents , ents , anss , data_ent = get_data_from_batch(data, device=tc.device(...
code_fim
hard
{ "lang": "python", "repo": "vhientran/RoR_relation_extraction", "path": "/outputs/analyze/gene.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vhientran/RoR_relation_extraction path: /outputs/analyze/gene.py import torch as tc import pdb import os , sys import fitlog import re import pickle from transformers import BertTokenizer from tqdm import tqdm from utils.train_util import get_data_from_batch from utils.scorer import get_f1 from u...
code_fim
hard
{ "lang": "python", "repo": "vhientran/RoR_relation_extraction", "path": "/outputs/analyze/gene.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #----- prepare data and some global variables ----- data_train , data_test , data_valid , relations, rel_weights = load_data(C , logger) _ , loss_func , generator = initialize(C , logger , relations , rel_weights) if C.watch_type == "train": data_watch = data_train if C.watch_type == "test": dat...
code_fim
hard
{ "lang": "python", "repo": "vhientran/RoR_relation_extraction", "path": "/outputs/analyze/gene.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lumbermixalot/ScriptEvent_Transpiler path: /main.py # -*- coding: utf-8 -*- """ Copyright (c) 2020 Galib F. Arrieta Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software withou...
code_fim
hard
{ "lang": "python", "repo": "lumbermixalot/ScriptEvent_Transpiler", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from pseudo_lua_parser import PseudoLuaParser from script_event_generator import ScriptEventGenerator from class_generator import ClassGenerator def Transpile(input_filepath, output_path, ebus_name, address_type, generate_template, disable_script_event_generation): input_stream = FileStream(input_fil...
code_fim
hard
{ "lang": "python", "repo": "lumbermixalot/ScriptEvent_Transpiler", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> optparser = argparse.ArgumentParser(description='Transpiles a pseudo-lua file into a Lumberyard ScriptEvent lua file or a lua implementation template of such ScriptEvent.') optparser.add_argument("-e", "--ebus_name", required=True, help="The name of the EBus interface for the ScriptEvent file.") optp...
code_fim
hard
{ "lang": "python", "repo": "lumbermixalot/ScriptEvent_Transpiler", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: a358003542/yaogua path: /yaogua/__main__.py #!/usr/bin/env python # -*-coding:utf-8-*- import logging import click from yaogua import __version__ from .zhouyi import explain_all, zhouyi_yaogua logger = logging.getLogger(__name__) def print_version(ctx, param, value): if not ...
code_fim
medium
{ "lang": "python", "repo": "a358003542/yaogua", "path": "/yaogua/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }