text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> user_count = User.query.count() category_count = Category.query.count() tag_count = Tag.query.count() for i in range(user_count): user = User.query.offset(randint(0, user_count - 1)).first() tag = Tag.query.offset(randint(0, tag_count - 1)).first() category = Catego...
code_fim
hard
{ "lang": "python", "repo": "techouse/nordend", "path": "/app/fake.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> context = super().get_context_data(**kwargs) return context class MyPasswordChangeView(LoginRequiredMixin, PasswordChangeView): template_name = 'profiles/password_change.html' form_class = MyPasswordChangeForm def form_valid(self, form): form.save() messages....
code_fim
hard
{ "lang": "python", "repo": "Bounty1993/my-wallet", "path": "/my_wallet/profiles/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bounty1993/my-wallet path: /my_wallet/profiles/views.py from django.conf import settings from django.contrib import messages from django.contrib.auth import authenticate, login, update_session_auth_hash from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.views impor...
code_fim
hard
{ "lang": "python", "repo": "Bounty1993/my-wallet", "path": "/my_wallet/profiles/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert h1.axes[0].metadata is None assert h2.axes[0].metadata == {"hello": "world"} ver = tuple(map(int, version.split("."))) assert h1.metadata is None if ver < (0, 9, 0): assert h2.metadata is None else: assert h2.metadata == "foo"<|fim_prefix|># repo: scikit-h...
code_fim
hard
{ "lang": "python", "repo": "scikit-hep/boost-histogram", "path": "/tests/test_pickles.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: scikit-hep/boost-histogram path: /tests/test_pickles.py from __future__ import annotations import pickle from pathlib import Path import pytest import boost_histogram as bh DIR = Path(__file__).parent.resolve() @pytest.mark.parametrize("version", ["0.10.2", "0.6.2", "0.11.1", "1.1.0"]) def ...
code_fim
hard
{ "lang": "python", "repo": "scikit-hep/boost-histogram", "path": "/tests/test_pickles.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert h2[0].value == 0 assert h2[1].value == 1 assert h2[2].value == 2 assert h2[3].value == 3 assert h2[4].value == 0 assert h3[bh.loc("one"), bh.loc(3)] == 1 assert h3[bh.loc("two"), bh.loc(2)] == 1 assert h3[bh.loc("two"), bh.loc(1)] == 1 assert h3[bh.loc("two"), b...
code_fim
hard
{ "lang": "python", "repo": "scikit-hep/boost-histogram", "path": "/tests/test_pickles.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.test_callbacks('on_batch_start', self.test_state) out = self.model.validation_step(batch) out = tu.send_to_device(out, 'cpu', non_blocking=True) self.test_state.update(out) self.test_callbacks('on_batch_end', self.test_st...
code_fim
hard
{ "lang": "python", "repo": "swagat25/Torchelie", "path": "/torchelie/recipes/trainandtest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __call__(self, train_loader, test_loader, epochs=5): """ Runs the recipe. Args: train_loader (DataLoader): Training set dataloader test_loader (DataLoader): Testing set dataloader epochs (int): number of epochs Returns: ...
code_fim
hard
{ "lang": "python", "repo": "swagat25/Torchelie", "path": "/torchelie/recipes/trainandtest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: swagat25/Torchelie path: /torchelie/recipes/trainandtest.py import copy import torch import torch.optim as optim import torchvision.models as tvmodels import torchelie.metrics.callbacks as cb import torchelie.utils as tu from torchelie.recipes.trainandcallbase import TrainAndCallBase class Tr...
code_fim
hard
{ "lang": "python", "repo": "swagat25/Torchelie", "path": "/torchelie/recipes/trainandtest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_autoclass_order(self): """Make sure fields come before methods.""" contents = self._file_contents('index') pos_field = contents.index('ClassDefinition.field') pos_method2 = contents.index('ClassDefinition.anotherMethod') pos_method = contents.index('Cla...
code_fim
hard
{ "lang": "python", "repo": "sylvestre/sphinx-js", "path": "/tests/test_build_ts/test_build_ts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sylvestre/sphinx-js path: /tests/test_build_ts/test_build_ts.py # -*- coding: utf-8 -*- from tests.testing import SphinxBuildTestCase class Tests(SphinxBuildTestCase): """Tests which require our one big Sphinx tree to be built (typescript version)""" <|fim_suffix|> def test_autoclass_or...
code_fim
hard
{ "lang": "python", "repo": "sylvestre/sphinx-js", "path": "/tests/test_build_ts/test_build_ts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: votti/CellProfiler path: /cellprofiler/modules/tests/test_identifydeadworms.py '''test_identifydeadworms.py - test the IdentifyDeadWorms module ''' import unittest from StringIO import StringIO import numpy as np from scipy.ndimage import binary_fill_holes from cellprofiler.preferences import ...
code_fim
hard
{ "lang": "python", "repo": "votti/CellProfiler", "path": "/cellprofiler/modules/tests/test_identifydeadworms.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> image_set = image_set_list.get_image_set(0) image_set.add(IMAGE_NAME, image) module = ID.IdentifyDeadWorms() module.module_num = 1 module.image_name.value = IMAGE_NAME module.object_name.value = OBJECTS_NAME pipeline = cpp.Pipeline() def ca...
code_fim
hard
{ "lang": "python", "repo": "votti/CellProfiler", "path": "/cellprofiler/modules/tests/test_identifydeadworms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chromium/chromium path: /third_party/wpt_tools/wpt/tools/third_party_modified/mozlog/mozlog/formatters/html/xmlgen.py """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software with...
code_fim
hard
{ "lang": "python", "repo": "chromium/chromium", "path": "/third_party/wpt_tools/wpt/tools/third_party_modified/mozlog/mozlog/formatters/html/xmlgen.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def list(self, obj): assert id(obj) not in self.visited self.visited[id(obj)] = 1 for elem in obj: self.visit(elem) def Tag(self, tag): assert id(tag) not in self.visited try: tag.parent = self.parents[-1] except IndexError: ...
code_fim
hard
{ "lang": "python", "repo": "chromium/chromium", "path": "/third_party/wpt_tools/wpt/tools/third_party_modified/mozlog/mozlog/formatters/html/xmlgen.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> 'Owner' : _reflection.GeneratedProtocolMessageType('Owner', (_message.Message,), { 'DESCRIPTOR' : _RECORD_OWNER, '__module__' : 'simple_supply_protobuf.record_pb2' # @@protoc_insertion_point(class_scope:Record.Owner) }) , 'Location' : _reflection.GeneratedProtocolMessageType('Locati...
code_fim
hard
{ "lang": "python", "repo": "jamwal-sahil/Major-Project", "path": "/protobuf/simple_supply_protobuf/record_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jamwal-sahil/Major-Project path: /protobuf/simple_supply_protobuf/record_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: simple_supply_protobuf/record.proto from google.protobuf import descriptor as _descriptor from google.protobuf import messa...
code_fim
hard
{ "lang": "python", "repo": "jamwal-sahil/Major-Project", "path": "/protobuf/simple_supply_protobuf/record_pb2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>Record = _reflection.GeneratedProtocolMessageType('Record', (_message.Message,), { 'Owner' : _reflection.GeneratedProtocolMessageType('Owner', (_message.Message,), { 'DESCRIPTOR' : _RECORD_OWNER, '__module__' : 'simple_supply_protobuf.record_pb2' # @@protoc_insertion_point(class_scope:Recor...
code_fim
hard
{ "lang": "python", "repo": "jamwal-sahil/Major-Project", "path": "/protobuf/simple_supply_protobuf/record_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cdeitrick/isolate_parsers path: /tests/test_breseq_folder_parser.py from pathlib import Path import pytest from loguru import logger from isolateparser import resultparser data_folder = Path(__file__).parent / 'data' @pytest.fixture def breseq_clone() -> Path: # In case I need to customize ...
code_fim
hard
{ "lang": "python", "repo": "cdeitrick/isolate_parsers", "path": "/tests/test_breseq_folder_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Since the workflow was only provided the index file, it is missing the additional columns added from the vcf and gd files. # TODO: This test currently fails because the 'alt', 'ref', 'locustag', and 'mutationCategory' columns are missing due to the # missing vcf and gd files. Refactor the code so th...
code_fim
hard
{ "lang": "python", "repo": "cdeitrick/isolate_parsers", "path": "/tests/test_breseq_folder_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path = os.path.join(dir, GROUP_VARS_DIR, target_group + '.yml') with open(path) as f: lines = f.readlines() for line in lines: if show_all or not re.search('password', line, flags=re.IGNORECASE): print(line, end="") def mkdir_p(path): os.makedirs(path, exist_o...
code_fim
hard
{ "lang": "python", "repo": "ivis-mizuguchi/ocs-templates", "path": "/Moodle-Simple/scripts/group.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ivis-mizuguchi/ocs-templates path: /Moodle-Simple/scripts/group.py from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import errno import os import re import yaml import subprocess from io import StringIO, BytesIO import tempfile i...
code_fim
hard
{ "lang": "python", "repo": "ivis-mizuguchi/ocs-templates", "path": "/Moodle-Simple/scripts/group.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def setup_ansible_cfg(inventory_path=Path('inventory.yml'), backup='.bak'): cfg = ConfigParser(interpolation=None) cfg_path = Path('ansible.cfg').resolve() if cfg_path.exists(): with cfg_path.open() as f: cfg.read_file(f) if backup is not None: cfg_path...
code_fim
hard
{ "lang": "python", "repo": "ivis-mizuguchi/ocs-templates", "path": "/Moodle-Simple/scripts/group.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: liaochenlanruo/deeparg2.0 path: /src/DeepNovelARG/model.py import tensorflow as tf from tensorflow import keras class DeepARG(): def __init__(self, input_dataset_wordvectors_size=0, input_convolutional_dataset_size=2000, num_classes=[], num_groups=[]): # setup parameters for model ...
code_fim
hard
{ "lang": "python", "repo": "liaochenlanruo/deeparg2.0", "path": "/src/DeepNovelARG/model.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> latent = keras.layers.concatenate( [wv_nn, conv_nn] ) ################################################ ################### Output ##################### ################################################ # arg groups (names) # arg_groups_h...
code_fim
hard
{ "lang": "python", "repo": "liaochenlanruo/deeparg2.0", "path": "/src/DeepNovelARG/model.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ################################################ ################### Output ##################### ################################################ # arg groups (names) # arg_groups_hidden_input = keras.layers.Dense( # 300, # activation='relu...
code_fim
hard
{ "lang": "python", "repo": "liaochenlanruo/deeparg2.0", "path": "/src/DeepNovelARG/model.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-kubernetes path: /sdk/python/pulumi_kubernetes/admissionregistration/v1/outputs.py ersions", admission_review_versions) pulumi.set(__self__, "client_config", client_config) pulumi.set(__self__, "name", name) pulumi.set(__self__, "side_effects", side_effects) ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-kubernetes", "path": "/sdk/python/pulumi_kubernetes/admissionregistration/v1/outputs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Default to the empty LabelSelector, which matches everything. :param '_meta.v1.LabelSelectorPatchArgs' object_selector: ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-kubernetes", "path": "/sdk/python/pulumi_kubernetes/admissionregistration/v1/outputs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> For example, to run the webhook on any objects whose namespace is not associated with "runlevel" of "0" or "1"; you will set the selector as follows: "namespaceSelector": { "matchExpressions": [ { "key": "runlevel", ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-kubernetes", "path": "/sdk/python/pulumi_kubernetes/admissionregistration/v1/outputs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: isabella232/reference-wallet path: /backend/context/stubs/custody.py # Copyright (c) The Diem Core Contributors # SPDX-License-Identifier: Apache-2.0 """ This module simulates a naive custody client interface that manage private keys. """ import json, os, typing, time from cryptography.hazmat....
code_fim
hard
{ "lang": "python", "repo": "isabella232/reference-wallet", "path": "/backend/context/stubs/custody.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return ( self._get_key(account_name) .public_key() .public_bytes( encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw, ) ) def sign(self, account_name: str, msg: bytes) -> bytes: ...
code_fim
hard
{ "lang": "python", "repo": "isabella232/reference-wallet", "path": "/backend/context/stubs/custody.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> counter += 1 image = np.array(image, dtype=float) image /= counter # now make the image large again pil_img = Image.fromarray(image) pil_img = pil_img.convert("L") pil_img = pil_img.resize((img_res, img_res), Image.NEAREST) pil_img.save(os.path.join(args.output_fo...
code_fim
hard
{ "lang": "python", "repo": "lbechberger/LearningPsychologicalSpaces", "path": "/code/mds/data_analysis/average_images.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lbechberger/LearningPsychologicalSpaces path: /code/mds/data_analysis/average_images.py # -*- coding: utf-8 -*- """ Compute the average image per category Created on Wed Dec 19 14:57:05 2018 @author: lbechberger """ import argparse, pickle, os from PIL import Image import numpy as np from code...
code_fim
hard
{ "lang": "python", "repo": "lbechberger/LearningPsychologicalSpaces", "path": "/code/mds/data_analysis/average_images.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jrkerns/pylinac path: /pylinac/core/image_generator/utils.py ers is not None: for layer in final_layers: simulator.add_layer(layer) simulator.generate_dicom(file_out) def generate_picketfence( simulator: Simulator, field_layer: type[FilterFreeFieldLayer | Filtere...
code_fim
hard
{ "lang": "python", "repo": "jrkerns/pylinac", "path": "/pylinac/core/image_generator/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- simulator The image simulator field_layer The primary field layer simulating radiation dir_out The directory to save the images to. field_offsets A list of lists containing the shift of the fields. Format is the same as bb_offse...
code_fim
hard
{ "lang": "python", "repo": "jrkerns/pylinac", "path": "/pylinac/core/image_generator/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jrkerns/pylinac path: /pylinac/core/image_generator/utils.py How far up (vert) to set the BB. Can be positive or negative. offset_mm_in How far in (long) to set the BB. Can be positive or negative. image_axes List of axis values for the images. Sequence is (Gantry, ...
code_fim
hard
{ "lang": "python", "repo": "jrkerns/pylinac", "path": "/pylinac/core/image_generator/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if "no" not in fn: complete_name = f"{fn.split('.')[0]}-{buffer_type}-{output}.txt" else: complete_name = f"{fn}" args = f"./puzzle --{buffer_type} -o {output} < {fn}" print(args) if compare: ...
code_fim
hard
{ "lang": "python", "repo": "Zackhardtoname/eecs_281_tools", "path": "/project_1/command_gen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Zackhardtoname/eecs_281_tools path: /project_1/command_gen.py import glob, os import subprocess compare = False test = True os.chdir("./") documents = dict() for fn in glob.glob("*.txt"): if not any(prefix in fn for prefix in ["out", "my", "exclude_"]): documents[fn] = os.path.gets...
code_fim
hard
{ "lang": "python", "repo": "Zackhardtoname/eecs_281_tools", "path": "/project_1/command_gen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if compare: res = subprocess.run(diff_args, shell=True, stdout=subprocess.PIPE).stdout if len(res): print(len(res)) if (len(res) < 1000): print(res) print()...
code_fim
hard
{ "lang": "python", "repo": "Zackhardtoname/eecs_281_tools", "path": "/project_1/command_gen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not head or not head.next: return head s = head f = head.next prev = None while f.next and f.next.next: s.next = f.next f.next = s if prev == None: head = f if prev: prev.next = f f, s = s, f prev = f ...
code_fim
medium
{ "lang": "python", "repo": "26tanishabanik/Interview-Coding-Questions", "path": "/LinkedLists/SwapTwoNodes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 26tanishabanik/Interview-Coding-Questions path: /LinkedLists/SwapTwoNodes.py """ Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.) <|fim_suffix|> if...
code_fim
medium
{ "lang": "python", "repo": "26tanishabanik/Interview-Coding-Questions", "path": "/LinkedLists/SwapTwoNodes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Examples ```python >>> from keras import backend as K >>> from keras.layers import Input, Dense >>> np_var = numpy.array([1, 2]) >>> K.is_keras_tensor(np_var) # A numpy array is not a symbolic tensor. ValueError >>> k_var = tf.placeholder('float32'...
code_fim
hard
{ "lang": "python", "repo": "knowledge-learning/snn", "path": "/snn/backend_keras/tensorflow_backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def make_sparse(value, dtype=None): if dtype is None: dtype = floatx() assert hasattr(value, 'tocoo') sparse_coo = value.tocoo() indices = np.concatenate((np.expand_dims(sparse_coo.row, 1), np.expand_dims(sparse_coo.col, 1)), 1) v = tf.SparseTen...
code_fim
hard
{ "lang": "python", "repo": "knowledge-learning/snn", "path": "/snn/backend_keras/tensorflow_backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: knowledge-learning/snn path: /snn/backend_keras/tensorflow_backend.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from tensorflow.python.framework import ops as tf_ops import numpy as np from keras.backend.c...
code_fim
hard
{ "lang": "python", "repo": "knowledge-learning/snn", "path": "/snn/backend_keras/tensorflow_backend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abcsFrederick/histogram path: /plugin_tests/create_histogram_test.py import unittest import histogramScript.create_histogram class CreateHistogramTest(unittest.TestCase): def setUp(self): self.path = 'plugins/histogram/plugin_tests/test_files/Seg.tiff' self.label = False ...
code_fim
hard
{ "lang": "python", "repo": "abcsFrederick/histogram", "path": "/plugin_tests/create_histogram_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> hist, binEdges = histogramScript.create_histogram.computeHistogram(self.path, self.label, self.bins, ...
code_fim
hard
{ "lang": "python", "repo": "abcsFrederick/histogram", "path": "/plugin_tests/create_histogram_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sqd/BouncyCastle path: /test_utils.py import unittest import utils class TestUtils(unittest.TestCase): def test_bytes_queue(self): q = utils.BytesFifoQueue() q.write(b'1234567890') self.assertEqual(q.available(), 10) read = q.read(3) self.assertEqua...
code_fim
hard
{ "lang": "python", "repo": "sqd/BouncyCastle", "path": "/test_utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> k = utils.generate_aes_key(128) clear_text = b'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod ' \ b'tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim ' \ b'veniam, quis nostrud exercitation ullamco labori...
code_fim
hard
{ "lang": "python", "repo": "sqd/BouncyCastle", "path": "/test_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: weaponhsu/youliPyLib path: /youliPyLib/redis/RedisList.py #! /usr/bin/python # -*- coding:utf-8 -*- # @author: weaponhsu # @File: RedisList # @Time: 2018/9/3 上午11:52 class RedisList(object): def __init__(self, logger=None): super(RedisList, self).__init__() self.logger =...
code_fim
hard
{ "lang": "python", "repo": "weaponhsu/youliPyLib", "path": "/youliPyLib/redis/RedisList.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 取出redis中名为key的list的长度 :param key: :return: """ result = None try: result = self.redis.llen(key) except Exception as e: self.logger.error(format(e)) finally: return result def get_item_from_...
code_fim
hard
{ "lang": "python", "repo": "weaponhsu/youliPyLib", "path": "/youliPyLib/redis/RedisList.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HighLordGame/FaceEngine path: /examples/fsdk_utils.py import os import sys def set_shared_lib_dir(): if "FSDK_ROOT" in os.environ: path_to_fsdk_root = os.getenv('FSDK_ROOT') <|fim_suffix|> else: print("Unknown platfrorm. Cannot set environment variable for share...
code_fim
hard
{ "lang": "python", "repo": "HighLordGame/FaceEngine", "path": "/examples/fsdk_utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> else: print("Unknown platfrorm. Cannot set environment variable for shared libraries.")<|fim_prefix|># repo: HighLordGame/FaceEngine path: /examples/fsdk_utils.py import os import sys def set_shared_lib_dir(): if "FSDK_ROOT" in os.environ: path_to_fsdk_root = os.getenv(...
code_fim
hard
{ "lang": "python", "repo": "HighLordGame/FaceEngine", "path": "/examples/fsdk_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Establish the thinning helper (which will set up the services behind the scenes) from DerivationFrameworkCore.ThinningHelper import ThinningHelper IDPIXLUMIThinningHelper = ThinningHelper( "IDPIXLUMIThinningHelper" ) IDPIXLUMIThinningHelper.AppendToStream( IDPIXLUMIStream ) thinningTools = [] if dumpP...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDPIXLUMI.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper IDPIXLUMISlimmingHelper = SlimmingHelper("IDPIXLUMISlimmingHelper") IDPIXLUMISlimmingHelper.AppendToDictionary = {'PixelClusters': 'xAOD::TrackMeasurementValidationContainer', 'PixelClustersAux': 'xAOD::TrackMeasurementValidationAuxContaine...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDPIXLUMI.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: strigazi/athena path: /PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDPIXLUMI.py ################# ### Steering options ################# ## Load common flags from AthenaCommon.JobProperties import jobproperties as athCommonFlags from PrimaryDPDMaker.DxAODPixLumiJobProperties import DxAODPixLumiFl...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/PhysicsAnalysis/PrimaryDPDMaker/share/DAOD_IDPIXLUMI.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KHIANWEI/visual_motif_removal path: /genoutput/run_output.py from __future__ import print_function from utils.train_utils import load_globals, init_folders, init_nets from utils.visualize_utils import generate_image import torch import sys import time import os <|fim_suffix|> my_device = tor...
code_fim
medium
{ "lang": "python", "repo": "KHIANWEI/visual_motif_removal", "path": "/genoutput/run_output.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> my_device = torch.device('cuda:0') init_folders(OUTPUT_FOLDER) opt = load_globals(net_folder, {}, override=False) net = init_nets(opt, net_folder, my_device, tag) output_path = '%s/OUTPUT_%s.png' % (OUTPUT_FOLDER, time.strftime("%Y%m%d-%H%M%S")) print('Relative Path: %s' % output_p...
code_fim
medium
{ "lang": "python", "repo": "KHIANWEI/visual_motif_removal", "path": "/genoutput/run_output.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RedHatQE/Nudgebot path: /nudgebot/config/user.py from hashlib import md5 from cached_property import cached_property from nudgebot.settings import CurrentProject from nudgebot.exceptions import CouldNotFindUserException from nudgebot.utils import flatten_dict class User(object): """ R...
code_fim
hard
{ "lang": "python", "repo": "RedHatQE/Nudgebot", "path": "/nudgebot/config/user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Get a user by specific query @param query: The query, keys and values. @rtype: `None` if user found, otherwise `User`. """ assert isinstance(query, dict) for user in cls.all(): if all(user.config_data.get(k) == v for k, v in query.it...
code_fim
hard
{ "lang": "python", "repo": "RedHatQE/Nudgebot", "path": "/nudgebot/config/user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: leifos/treconomics path: /treconomics_project/populate_users.py __author__ = 'leif' import os def populate(): print 'Adding Users' for i in range(0,20): uname = 'fin'+str(i) add_user(uname,uname,0,2,i) def add_user(username, password, condition, experiment, rotation, d...
code_fim
hard
{ "lang": "python", "repo": "leifos/treconomics", "path": "/treconomics_project/populate_users.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> t = TaskDescription.objects.get_or_create(topic_num=topic_num, title=title, description=description)[0] print "\t %s" % t return t if __name__ == '__main__': import django print "Starting Tre...
code_fim
hard
{ "lang": "python", "repo": "leifos/treconomics", "path": "/treconomics_project/populate_users.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print "Starting Treconomics population script..." os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'treconomics_project.settings') django.setup() from treconomics.models import TaskDescription from treconomics.models import UserProfile from django.contrib.auth.models import User ...
code_fim
hard
{ "lang": "python", "repo": "leifos/treconomics", "path": "/treconomics_project/populate_users.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ing/RhinoUtil.java', 'fling/src/java/core/com/google/dart/LibraryFromSources.java', 'fling/src/java/core/com/google/dart/SourceFromString.java', 'fling/src/java/test/com/google/dart/fling/MessageLoopTest.java', ], 'fling_resources': [ ], }, }<|fim_prefix|># repo: bopopescu/...
code_fim
hard
{ "lang": "python", "repo": "bopopescu/Dart-1", "path": "/dart/client/fling/fling.gypi", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bopopescu/Dart-1 path: /dart/client/fling/fling.gypi # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. { 'variables': { 'fling_...
code_fim
hard
{ "lang": "python", "repo": "bopopescu/Dart-1", "path": "/dart/client/fling/fling.gypi", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>= 3 + 4j print ('c =', c) print ('Parte real:', c.real) print ('Parte imaginária:', c.imag) print ('Conjugado:', c.conjugate())<|fim_prefix|># repo: ed1rac/AulasEstruturasDados path: /UNP/ref/Python/Basico-MacBook-Ed/TiposNumeros.py # Convertendo de real para inteiro print ('int(3.14) =', int(3.14)) # Co...
code_fim
medium
{ "lang": "python", "repo": "ed1rac/AulasEstruturasDados", "path": "/UNP/ref/Python/Basico-MacBook-Ed/TiposNumeros.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ed1rac/AulasEstruturasDados path: /UNP/ref/Python/Basico-MacBook-Ed/TiposNumeros.py # Convertendo de real para inteiro print ('int(3.14) =', int(3.14)) # Convertendo de inteiro para real print ('float(5) =', fl<|fim_suffix|>nt('20', 8) =", int('20', 8)) # base 8 print ("int('20', 16) =", int('20'...
code_fim
medium
{ "lang": "python", "repo": "ed1rac/AulasEstruturasDados", "path": "/UNP/ref/Python/Basico-MacBook-Ed/TiposNumeros.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nt('20', 8) =", int('20', 8)) # base 8 print ("int('20', 16) =", int('20', 16)) # base 16 # Operações com números complexos c = 3 + 4j print ('c =', c) print ('Parte real:', c.real) print ('Parte imaginária:', c.imag) print ('Conjugado:', c.conjugate())<|fim_prefix|># repo: ed1rac/AulasEstruturasDados pa...
code_fim
medium
{ "lang": "python", "repo": "ed1rac/AulasEstruturasDados", "path": "/UNP/ref/Python/Basico-MacBook-Ed/TiposNumeros.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: psteinb/adversarial-medicine path: /train_models/train_model.py # train_model.py # By: Samuel Finlayson # # Trains a Resnet or InceptionV3 model for binary image classification # For details, see: python train_model.py --help # # This file assumes that data for the classifier is stored per the ...
code_fim
hard
{ "lang": "python", "repo": "psteinb/adversarial-medicine", "path": "/train_models/train_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if mixup: n_data = (X_train.shape[0], X_test.shape[0]) else: n_data = (train_generator.n, validation_generator.n) return (train_generator, validation_generator, n_data) def construct_model(inceptionModel, batch_size, LR, freezeEarlyLayers = False): from keras.layers import...
code_fim
hard
{ "lang": "python", "repo": "psteinb/adversarial-medicine", "path": "/train_models/train_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mosalaheg/sklearn path: /Data Preparetion/1.5 Data Scaling/A.5.1.1.standard_scaler.py # Import important libraries from sklearn.preprocessing import StandardScaler <|fim_suffix|>scaler_data = StandardScaler(copy= True, with_mean=True, with_std=True).fit_transform(X) # scaler = StandardScaler(co...
code_fim
easy
{ "lang": "python", "repo": "mosalaheg/sklearn", "path": "/Data Preparetion/1.5 Data Scaling/A.5.1.1.standard_scaler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Showing data # print('X \n' , X[:10]) # print('y \n' , y[:10])<|fim_prefix|># repo: mosalaheg/sklearn path: /Data Preparetion/1.5 Data Scaling/A.5.1.1.standard_scaler.py # Import important libraries from sklearn.preprocessing import StandardScaler <|fim_middle|># Standard Scaler for Data scaler_data ...
code_fim
hard
{ "lang": "python", "repo": "mosalaheg/sklearn", "path": "/Data Preparetion/1.5 Data Scaling/A.5.1.1.standard_scaler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> __tablename__ = "products" id = Column(BigInteger, primary_key=True, autoincrement=True) uuid = Column(UUID(as_uuid=True), unique=True, nullable=False, default=uuid4) es_id = Column(String(100), unique=True, nullable=False) created_at = Column(DateTime, default=datetime.now) updat...
code_fim
medium
{ "lang": "python", "repo": "willrp/willorders-ws", "path": "/backend/model/product.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: willrp/willorders-ws path: /backend/model/product.py from datetime import datetime from sqlalchemy import Column, BigInteger, String, DateTime from sqlalchemy.dialects.postgresql import UUID from uuid import uuid4 <|fim_suffix|> id = Column(BigInteger, primary_key=True, autoincrement=True) ...
code_fim
medium
{ "lang": "python", "repo": "willrp/willorders-ws", "path": "/backend/model/product.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: init_bls_keys(keys_dir=config.baseDir, node_name=node_name, seed=seed) except Exception as ex: print(ex) exit() if __name__ == "__main__": buildKeepDirIfNotExists(config.baseDir) node_name, seed = parse_args() init_bls_keys(config.baseDir, node_name, seed...
code_fim
hard
{ "lang": "python", "repo": "hyperledger/indy-plenum", "path": "/scripts/init_bls_keys", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hyperledger/indy-plenum path: /scripts/init_bls_keys #! /usr/bin/env python3 import argparse from plenum.common.config_util import getConfig from plenum.common.keygen_utils import init_bls_keys from plenum.common.script_helper import buildKeepDirIfNotExists config = getConfig() <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "hyperledger/indy-plenum", "path": "/scripts/init_bls_keys", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: greylurk/mr-v1 path: /curses.py import curses import locale class ControlPanel: def __init__(self): <|fim_suffix|> def close(self): curses.nocbreak() self.screen.keypad(0) curses.echo() curses.endwin()<|fim_middle|> self.sensors = [] self.a...
code_fim
hard
{ "lang": "python", "repo": "greylurk/mr-v1", "path": "/curses.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def close(self): curses.nocbreak() self.screen.keypad(0) curses.echo() curses.endwin()<|fim_prefix|># repo: greylurk/mr-v1 path: /curses.py import curses import locale class ControlPanel: <|fim_middle|> def __init__(self): self.sensors = [] self.ac...
code_fim
hard
{ "lang": "python", "repo": "greylurk/mr-v1", "path": "/curses.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.sensors = [] self.actuators = [] self.screen = curses.initscr() curses.noecho() curses.cbreak() self.screen.keypad(1) locale.setLocale(locale.LC_ALL,'') def close(self): curses.nocbreak() self.screen.keypad(0) ...
code_fim
easy
{ "lang": "python", "repo": "greylurk/mr-v1", "path": "/curses.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return FetchedPID( provider=providers.OrganizationUUIDProvider, pid_type=providers.OrganizationUUIDProvider.pid_type, pid_value=str(data[pids.IROKO_UUID_FIELD]), ) def person_uuid_fetcher(per_uuid, data): return FetchedPID( provider=providers.PersonUUIDProvider...
code_fim
hard
{ "lang": "python", "repo": "tocororo/iroko", "path": "/iroko/pidstore/fetchers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert data, "no data" assert pids.IDENTIFIERS_FIELD in data for schema in identifiers_schemas: if schema == pid_type: return FetchedPID( provider=providers.IdentifiersProvider, pid_type=pid_type, pid_value=data[pids.IDENTIFIE...
code_fim
hard
{ "lang": "python", "repo": "tocororo/iroko", "path": "/iroko/pidstore/fetchers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tocororo/iroko path: /iroko/pidstore/fetchers.py # Copyright (c) 2022. Universidad de Pinar del Rio # This file is part of SCEIBA (sceiba.cu). # SCEIBA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """Do...
code_fim
hard
{ "lang": "python", "repo": "tocororo/iroko", "path": "/iroko/pidstore/fetchers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ values = [] for file in os.listdir('/tmp/street_data/'): with open('/tmp/street_data/' + file, 'r') as f: data = f.readlines() data = ''.join(data) soup = BeautifulSoup(data) tables = soup.findAll('table') for table in tables: ...
code_fim
hard
{ "lang": "python", "repo": "CityOfLosAngeles/data-workflows-101", "path": "/extract.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CityOfLosAngeles/data-workflows-101 path: /extract.py import requests import datetime import xml.etree.ElementTree as ET from dateutil.relativedelta import relativedelta import pandas as pd import pathlib import os from bs4 import BeautifulSoup ENDPOINT = "https://ssl.orpak.com/api40/TrackTecP...
code_fim
hard
{ "lang": "python", "repo": "CityOfLosAngeles/data-workflows-101", "path": "/extract.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ load into some format for later study params = a list of values to laod """ import sqlite3 conn = sqlite3.connect('./example.db') df = pd.DataFrame(values) df.to_sql('observations', conn) if '__name__' == '__main__': if not os.path.exists('/tmp/street_d...
code_fim
hard
{ "lang": "python", "repo": "CityOfLosAngeles/data-workflows-101", "path": "/extract.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def make_synthetic_experiment_sigma(sample_data, model, make_gibbs_fn, explicit_ub=None): rng_key = random.PRNGKey(0) # Sampling parameters Npoints = 1000 data = sample_data(rng_key, Npoints) # DPMM/PYMM parameters T = 20 t = np.arange(T + 1) for sigma in [0, 0.1, .5]: ...
code_fim
hard
{ "lang": "python", "repo": "glothe/pitman-yor", "path": "/synthetic_experiments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> make_synthetic_experiment( sample_data=sample_data_miller, model=gaussian_DPMM, make_gibbs_fn=make_gaussian_DPMM_gibbs_fn ) # Poisson DPMM experiment def sample_data_poisson(rng_key: random.PRNGKey, N: int): data = np.hstack(( Poisson(4).sample(rng_key, (int(.4...
code_fim
hard
{ "lang": "python", "repo": "glothe/pitman-yor", "path": "/synthetic_experiments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: glothe/pitman-yor path: /synthetic_experiments.py """ Investigate data size dependency on synthetic datasets. """ import numpy as np from jax import random from numpyro.distributions import Normal, Poisson import matplotlib.pyplot as plt plt.style.use('seaborn') from sampler import sample_po...
code_fim
hard
{ "lang": "python", "repo": "glothe/pitman-yor", "path": "/synthetic_experiments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kblin/aiodocker path: /tests/test_services.py import asyncio import pytest from aiodocker.exceptions import DockerError import aiohttp @pytest.mark.asyncio async def test_swarm_init(docker): swarm = await docker.swarm.init() assert swarm @pytest.mark.asyncio async def test_service_cre...
code_fim
hard
{ "lang": "python", "repo": "kblin/aiodocker", "path": "/tests/test_services.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> filters = {"service": service_id} # wait till task status is `complete` with aiohttp.Timeout(60): while True: await asyncio.sleep(2) task = await docker.tasks.list(filters=filters) if task: status = task[0]['Status']['State'] ...
code_fim
hard
{ "lang": "python", "repo": "kblin/aiodocker", "path": "/tests/test_services.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == 'POST': email = request.POST.get('email') subject = request.POST.get('subject') message = request.POST.get('message') contact = Contact(email=email, subject=subject, message=message) contact.save() messages.success(request, 'Email s...
code_fim
hard
{ "lang": "python", "repo": "devmahmud/Personal_Portfolio", "path": "/mysite/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: devmahmud/Personal_Portfolio path: /mysite/views.py from django.contrib import messages from django.shortcuts import render from .models import Contact, Post import requests def index(request): if request.method == 'POST': first_name = request.POST.get('first_name') last_nam...
code_fim
medium
{ "lang": "python", "repo": "devmahmud/Personal_Portfolio", "path": "/mysite/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ('/backends', backends.BackendResource()), ] class Resource(object): def __build_versions(self, host_url): VERSION['links'][0]['href'] = VERSION['links'][0]['href'].format( host_url) VERSIONS['versions'] = [VERSION] return json.dumps(VERSIONS, ensure_...
code_fim
hard
{ "lang": "python", "repo": "HewlettPackard/catena", "path": "/catena/api/v1/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return [ ('/', homedoc.Resource()), ('/clouds', cloud.CloudResource()), ('/clouds/types', cloud.CloudTypesResource()), ('/clouds/{cloud_id}/node_flavours', cloud.CloudFlavourResource()), ('/clouds/{cloud_id}/networks', cloud.CloudNetworkResource()), ('/...
code_fim
hard
{ "lang": "python", "repo": "HewlettPackard/catena", "path": "/catena/api/v1/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HewlettPackard/catena path: /catena/api/v1/__init__.py # Copyright (c) 2016-2017 Hewlett-Packard Development Company, L.P. # # 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 ...
code_fim
medium
{ "lang": "python", "repo": "HewlettPackard/catena", "path": "/catena/api/v1/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>TESTKEY = bytearray(range(16)) TESTDAT = bytes.fromhex("00112233 44556677 8899aabb ccddeeff") print(do_aes_128(TESTDAT, TESTKEY).hex()) from Crypto.Cipher import AES print(AES.new(TESTKEY, AES.MODE_ECB).encrypt(TESTDAT).hex())<|fim_prefix|># repo: iCodeIN/aes-playground path: /textbook_aes.py from aes....
code_fim
hard
{ "lang": "python", "repo": "iCodeIN/aes-playground", "path": "/textbook_aes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(do_aes_128(TESTDAT, TESTKEY).hex()) from Crypto.Cipher import AES print(AES.new(TESTKEY, AES.MODE_ECB).encrypt(TESTDAT).hex())<|fim_prefix|># repo: iCodeIN/aes-playground path: /textbook_aes.py from aes.transformations import * from aes.key_expansion import * def do_aes_128(_in, key): rkeys = k...
code_fim
medium
{ "lang": "python", "repo": "iCodeIN/aes-playground", "path": "/textbook_aes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iCodeIN/aes-playground path: /textbook_aes.py from aes.transformations import * from aes.key_expansion import * def do_aes_128(_in, key): <|fim_suffix|>from Crypto.Cipher import AES print(AES.new(TESTKEY, AES.MODE_ECB).encrypt(TESTDAT).hex())<|fim_middle|> rkeys = key_expansion(key) state = ad...
code_fim
hard
{ "lang": "python", "repo": "iCodeIN/aes-playground", "path": "/textbook_aes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> n = utils.get_test_node() self.dbapi.create_node(n) # test get-by-node-id res = self.dbapi.get_iface_by_node(n['id']) self.assertEqual(i['address'], res[0]['address']) # test get-by-node-uuid res = self.dbapi.get_iface_by_node(n['uuid']) se...
code_fim
hard
{ "lang": "python", "repo": "epim/ironic", "path": "/ironic/tests/db/test_ifaces.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: epim/ironic path: /ironic/tests/db/test_ifaces.py # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in complian...
code_fim
hard
{ "lang": "python", "repo": "epim/ironic", "path": "/ironic/tests/db/test_ifaces.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: y-yu/qrand path: /server/src/app.py from flask import Flask, request, session from .controller import measure, verify as verify_cont from .service import qrand, verify from .repository import result from random import Random import pickle import base64 app = Flask(__name__) # TODO: 適当なのをどうにかしろ ...
code_fim
hard
{ "lang": "python", "repo": "y-yu/qrand", "path": "/server/src/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }