text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: elenaviter/rasa path: /rasa/nlu/featurizers/featurizer.py import numpy as np import scipy.sparse from typing import Any, Text, Union, Optional from rasa.nlu.training_data import Message from rasa.nlu.components import Component from rasa.nlu.constants import SPARSE_FEATURE_NAMES, DENSE_FEATURE_NA...
code_fim
hard
{ "lang": "python", "repo": "elenaviter/rasa", "path": "/rasa/nlu/featurizers/featurizer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class Featurizer(Component): @staticmethod def _combine_with_existing_dense_features( message: Message, additional_features: Any, feature_name: Text = DENSE_FEATURE_NAMES[TEXT_ATTRIBUTE], ) -> Any: if message.get(feature_name) is not None: if len(me...
code_fim
hard
{ "lang": "python", "repo": "elenaviter/rasa", "path": "/rasa/nlu/featurizers/featurizer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: songfuture/asv-subtools path: /pytorch/libs/nnet/framework.py # -*- coding:utf-8 -*- # Copyright xmuspeech (Author: Snowdar 2019-07-01) import torch.nn import libs.support.utils as utils #### Use 'from libs.nnet import *' in your model.py to use all components and loss functions. ## Function...
code_fim
hard
{ "lang": "python", "repo": "songfuture/asv-subtools", "path": "/pytorch/libs/nnet/framework.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def load_transform_state_dict(self, state_dict): """It is used in transform-learning. """ assert isinstance(self.transform_keys, list) assert isinstance(self.rename_transform_keys, dict) remaining = { utils.key_to_value(self.rename_transform_keys, k, False):v f...
code_fim
hard
{ "lang": "python", "repo": "songfuture/asv-subtools", "path": "/pytorch/libs/nnet/framework.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Rotation followed by the inverse rotation should leave # everything the same (except that the frame data will be either a # 1 or a series of 1s) np.random.seed(hash("test_rotation_inversion") % 4294967294) # Use mod to get in an acceptable range W_in = w() assert W_in.ensure_val...
code_fim
hard
{ "lang": "python", "repo": "moble/scri", "path": "/tests/test_rotations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: moble/scri path: /tests/test_rotations.py # Copyright (c) 2015, Michael Boyle # See LICENSE file for details: <https://github.com/moble/scri/blob/master/LICENSE> import pytest import numpy as np from numpy import * import quaternion import spherical_functions as sf import scri from conftest imp...
code_fim
hard
{ "lang": "python", "repo": "moble/scri", "path": "/tests/test_rotations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_convert_nonnumeric_value(): """Test exception is thrown for nonnumeric type.""" with pytest.raises(TypeError): pressure_util.convert("a", PRESSURE_HPA, PRESSURE_INHG) def test_convert_from_hpascals(): """Test conversion from hPA to other units.""" hpascals = 1000 ass...
code_fim
medium
{ "lang": "python", "repo": "BenWoodford/home-assistant", "path": "/tests/util/test_pressure.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BenWoodford/home-assistant path: /tests/util/test_pressure.py """Test Home Assistant pressure utility functions.""" import pytest from homeassistant.const import ( PRESSURE_HPA, PRESSURE_INHG, PRESSURE_MBAR, PRESSURE_PA, PRESSURE_PSI, ) import homeassistant.util.pressure as p...
code_fim
medium
{ "lang": "python", "repo": "BenWoodford/home-assistant", "path": "/tests/util/test_pressure.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_author(metadata): author = filter(lambda x: '##author' in x, metadata) author = author[0][9: len(author[0])] return author def get_date(metadata): date = filter(lambda x: '##date' in x, metadata) date = date[0][7: len(date[0])] return date def get_topic(metadata): top...
code_fim
hard
{ "lang": "python", "repo": "fadikar/gurukul.github.io", "path": "/scripts/gen_posts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fadikar/gurukul.github.io path: /scripts/gen_posts.py ## This script contains useful functions to generate a html page given a ## blog post txt file. It also creates meta data for the blog posts to be ## used to make summaries. ## Input should be a txt file of specific format def read_file(in...
code_fim
hard
{ "lang": "python", "repo": "fadikar/gurukul.github.io", "path": "/scripts/gen_posts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> date = filter(lambda x: '##date' in x, metadata) date = date[0][7: len(date[0])] return date def get_topic(metadata): topic = filter(lambda x: '##topic' in x, metadata) topic = topic[0][8: len(topic[0])] return topic def modify_template(file_to_modify, string2find, replace_value,...
code_fim
hard
{ "lang": "python", "repo": "fadikar/gurukul.github.io", "path": "/scripts/gen_posts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Regardless, the strncpy call included a specific size, and that's precisely the maximum that was read in: 0:002> dd eax 006d2a08 54415453 41412053 41414141 41414141 006d2a18 41414141 41414141 41414141 41414141 006d2a28 41414141 41414141 41414141 41414141 006d2a38 41414141 41414141 41414141 41414141 00...
code_fim
hard
{ "lang": "python", "repo": "SYANiDE-/VulnServer", "path": "/OSED/not_exploitable/stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SYANiDE-/VulnServer path: /OSED/not_exploitable/stats.py #!/usr/bin/env python3 import os, sys, re, socket, binascii from struct import pack, unpack from IPython import embed ### ((cmd.exe /c "taskkill /F /IM vulnserver.exe" && timeout 3 && START /B "" "C:\users\admin\desktop\current_thing\vulns...
code_fim
hard
{ "lang": "python", "repo": "SYANiDE-/VulnServer", "path": "/OSED/not_exploitable/stats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># def unpacklatin(fmt, inp): # return unpack(fmt, inp.encode('latin-1'))[0] # def uniesc_to_bytestr(instring): # r""" '\\x58\\x59\\x5a\\xa0' -> 'XYZ\xa0' # hexstrings in from cli, ex., argparse """ # return bytes(instring, 'utf-8').decode("unicode_escape") # def bytestr_to_lon...
code_fim
hard
{ "lang": "python", "repo": "SYANiDE-/VulnServer", "path": "/OSED/not_exploitable/stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif general_command == "ChangeAll": substring = command[1] replacement = command[2] if substring in message: message = message.replace(substring, replacement) print(message) print(f"You have a new text message: {message}")<|fim_prefix|># repo: eclipse-ib/Softw...
code_fim
hard
{ "lang": "python", "repo": "eclipse-ib/Software-University-Fundamentals_Module", "path": "/12-Exam_preparation/1-Secret_Chat.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eclipse-ib/Software-University-Fundamentals_Module path: /12-Exam_preparation/1-Secret_Chat.py message = input() while True: command = input().split(":|:") if command[0] == "Reveal": break <|fim_suffix|> if general_command == "InsertSpace": index = int(command[1]) ...
code_fim
medium
{ "lang": "python", "repo": "eclipse-ib/Software-University-Fundamentals_Module", "path": "/12-Exam_preparation/1-Secret_Chat.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(config_path, "w+") as f: config = source f.write(config) if not args.config_dist_only: print(" requirements.txt") # Create requirements.txt requirements_path = os.path.join(current_dir, "requirements.txt") if not o...
code_fim
hard
{ "lang": "python", "repo": "skoczen/will", "path": "/will/scripts/generate_will_project.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skoczen/will path: /will/scripts/generate_will_project.py #!/usr/bin/env python import argparse import os import stat import sys from six.moves import input from clint.textui import puts from will.utils import print_head SERVICE_BACKENDS = ('Slack', 'HipChat', 'Rocket.chat', 'Shell') PROJECT_RO...
code_fim
hard
{ "lang": "python", "repo": "skoczen/will", "path": "/will/scripts/generate_will_project.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Create config.py print(" config.py.dist") config_path = os.path.join(current_dir, "config.py.dist") if not os.path.exists(config_path) or ask_user("! config.py.dist exists. Overwrite it?"): with open(os.path.join(PROJECT_ROOT, "config.py.dist"), "r") as source_f: ...
code_fim
hard
{ "lang": "python", "repo": "skoczen/will", "path": "/will/scripts/generate_will_project.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": # index_from_json("geo", "circle_geo.json", "children") # index_from_json("ms", "circle_ms.json", "children") index_from_json("sweet", "clusters_sweet.json", "children")<|fim_prefix|># repo: jdramani/599-2 path: /q11/tika-similarity-edited/indexer.py import json imp...
code_fim
hard
{ "lang": "python", "repo": "jdramani/599-2", "path": "/q11/tika-similarity-edited/indexer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jdramani/599-2 path: /q11/tika-similarity-edited/indexer.py import json import os def index_from_json(type, file_name, child_node): with open(file_name, 'r') as f: json_obj = json.load(f) obj_dict = {} walk_json(type, json_obj, "", child_node, obj_dict) with open...
code_fim
medium
{ "lang": "python", "repo": "jdramani/599-2", "path": "/q11/tika-similarity-edited/indexer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: j4c0bs/choppy path: /choppy/user_options.py #! usr/bin/env/ python3 """Parser for CLI user options""" import argparse import getpass import os import sys from choppy.version import VERSION # ------------------------------------------------------------------------------ def confirm_directory(s...
code_fim
hard
{ "lang": "python", "repo": "j4c0bs/choppy", "path": "/choppy/user_options.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> load_keypass_options(chp, pfx='en') # -------------------------------------------------------------------------- mrg_grp = mrg.add_argument_group('Merge') mrg_grp.add_argument( 'input', nargs='+', type=argparse.FileType('rb'), metavar='infile', help='input files to decryp...
code_fim
hard
{ "lang": "python", "repo": "j4c0bs/choppy", "path": "/choppy/user_options.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Returns: level_ids: array of shape (N,), per-box level indices, ranging from coarse to fine """ im_area = im_size[0] * im_size[1] widths = boxes[:, 2] - boxes[:, 0] + 1.0 heights = boxes[:, 3] - boxes[:, 1] + 1.0 areas = widths * heights # if e.g. the finest...
code_fim
hard
{ "lang": "python", "repo": "simonmeister/old-motion-rcnn", "path": "/lib/layers/assign_to_levels.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: boxes: array of shape (N, 4), [[x1, y1, x2, y2], ...] im_size: [height, width] of full image num_levels: number of pyramid levels finest_stride: average stride of box side length Returns: level_ids: array of shape (N,), per-box level indices, ...
code_fim
medium
{ "lang": "python", "repo": "simonmeister/old-motion-rcnn", "path": "/lib/layers/assign_to_levels.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: simonmeister/old-motion-rcnn path: /lib/layers/assign_to_levels.py # -------------------------------------------------------- # Motion R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Simon Meister # -------------------------------------------------------- from __futu...
code_fim
medium
{ "lang": "python", "repo": "simonmeister/old-motion-rcnn", "path": "/lib/layers/assign_to_levels.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vluk/cutieBot path: /utils/werebear/werebeargame.py from discord.ext import commands import asyncio from utils import bitecoin from utils.bitecoin import add_exp, add_coins from utils.werebear.roles import Stoner, Looker, Stealer, Provocateur, Huntsman, Sleepyhead, Sloshed, Copycat from utils....
code_fim
hard
{ "lang": "python", "repo": "vluk/cutieBot", "path": "/utils/werebear/werebeargame.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.players[player] = None def set_roles(self, role_list): self.roles = role_list def run(self): if self.phase != 1: print("woops") self.phase = 2 def lock(self): if self.phase != 0: print("woops") self.phase = 1 ...
code_fim
medium
{ "lang": "python", "repo": "vluk/cutieBot", "path": "/utils/werebear/werebeargame.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("possibilities", len(found)) print("solution", max(found))<|fim_prefix|># repo: kiike/aoc path: /2019/7/find.py #!/usr/bin/env python import itertools import subprocess <|fim_middle|> found = [] with open("input") as f: program = f.read() settings = [str(e) for e in range(5, 10)] for settin...
code_fim
hard
{ "lang": "python", "repo": "kiike/aoc", "path": "/2019/7/find.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: kiike/aoc path: /2019/7/find.py #!/usr/bin/env python import itertools import subprocess <|fim_suffix|>print("possibilities", len(found)) print("solution", max(found))<|fim_middle|>found = [] with open("input") as f: program = f.read() settings = [str(e) for e in range(5, 10)] for settin...
code_fim
hard
{ "lang": "python", "repo": "kiike/aoc", "path": "/2019/7/find.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hramchenko/NCC path: /masked_normxcorr.py import numpy as np import cv2 def masked_normxcorr(img, templ, mask): templ *= mask mask_sum = mask.sum() templ_sum = templ.sum() templ_mean = templ_sum/mask_sum <|fim_suffix|> Q1 = cv2.filter2D(img, -1, templ_norm, borderType=cv2....
code_fim
medium
{ "lang": "python", "repo": "Hramchenko/NCC", "path": "/masked_normxcorr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Q1 = cv2.filter2D(img, -1, templ_norm, borderType=cv2.BORDER_CONSTANT) Q2 = mean_img*templ_norm_sum Q = Q1 - Q2 D1 = cv2.filter2D(img*img, -1, mask, borderType=cv2.BORDER_CONSTANT) D2 = -2*mean_img*sum_img D3 = mask_sum*(mean_img*mean_img) D4 = (templ_norm*templ_norm).sum() ...
code_fim
medium
{ "lang": "python", "repo": "Hramchenko/NCC", "path": "/masked_normxcorr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def for_week(self, season: int, week: int) -> List[Game]: query = Query("week", "==", week) return self.firestore.where(GameRepository.path(season), query) def delete_all(self, season: int): self.firestore.delete_all(GameRepository.path(season))<|fim_prefix|># repo: mdryde...
code_fim
hard
{ "lang": "python", "repo": "mdryden/110yards", "path": "/yards_py/domain/repositories/game_repository.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdryden/110yards path: /yards_py/domain/repositories/game_repository.py from yards_py.core.base_repository import Query from typing import List from google.cloud.firestore_v1.transaction import Transaction from yards_py.core.firestore_proxy import FirestoreProxy from yards_py.domain.entities.ga...
code_fim
hard
{ "lang": "python", "repo": "mdryden/110yards", "path": "/yards_py/domain/repositories/game_repository.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.firestore.get_all(GameRepository.path(season), transaction) def set(self, season, game: Game, transaction: Transaction = None): return self.firestore.set(GameRepository.path(season), game, transaction) def for_week(self, season: int, week: int) -> List[Game]: ...
code_fim
medium
{ "lang": "python", "repo": "mdryden/110yards", "path": "/yards_py/domain/repositories/game_repository.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sammous/biasimpact path: /biasimpacter/tests/conftest.py import pytest import sys import os from mock import patch, Mock, MagicMock sys.path.append( os.path.join( os.path.dirname(__file__), '..', 'app')) def _mock_response( status=200, content="CONTEN...
code_fim
medium
{ "lang": "python", "repo": "sammous/biasimpact", "path": "/biasimpacter/tests/conftest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> uri=None, database=None, collection=None, build_index=None): mock_mongo = Mock() mock_collection = MagicMock() mock_mongo.collection = mock_collection mock_collection.insert_one = Mock() return mock_mongo<|fim_prefix|># repo: sammous/biasimpact path: /b...
code_fim
hard
{ "lang": "python", "repo": "sammous/biasimpact", "path": "/biasimpacter/tests/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> DebuggerNonUserCodeAttribute() """ def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __reduce_ex_...
code_fim
medium
{ "lang": "python", "repo": "shnlmn/Rhino-Grasshopper-Scripts", "path": "/IronPythonStubs/release/stubs.min/System/Diagnostics/__init___parts/DebuggerNonUserCodeAttribute.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> DebuggerNonUserCodeAttribute() """ def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __reduce_ex__(s...
code_fim
medium
{ "lang": "python", "repo": "shnlmn/Rhino-Grasshopper-Scripts", "path": "/IronPythonStubs/release/stubs.min/System/Diagnostics/__init___parts/DebuggerNonUserCodeAttribute.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> d=pd.DataFrame([harps,uves,feros]).T d.columns=['harps','uves','feros'] final=pd.merge(d,tois,right_on='TIC ID', left_index=True) # final=final[['harps','feros','TIC ID','TOI']].sort_values('TOI') final.sort_values('TOI').to_csv('toi_with_eso_data.csv',index=False)<|fim_prefix|># repo: jpdeleon/archive_...
code_fim
hard
{ "lang": "python", "repo": "jpdeleon/archive_digger", "path": "/scripts/query_all_toi_eso", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpdeleon/archive_digger path: /scripts/query_all_toi_eso #!/usr/bin/env python import sys import pyvo as vo from astropy.coordinates import SkyCoord from astropy import units as u import urllib import pandas as pd from tqdm import tqdm from joblib import Parallel, delayed import multiprocessing ...
code_fim
hard
{ "lang": "python", "repo": "jpdeleon/archive_digger", "path": "/scripts/query_all_toi_eso", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Williano/Solved-Practice-Questions path: /magic_dates.py # Script: magic_dates # Description: This program ask the user to enter a month (in numeric form), a day, # and a two digit year. The program should then determine whether the # month times the day equals the year....
code_fim
hard
{ "lang": "python", "repo": "Williano/Solved-Practice-Questions", "path": "/magic_dates.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Telling the user what the program does. print("This program ask the user to enter a month (in numeric form), a day,") print("and a two digit year. The program should then determine whether the") print("month times the day equals the year. If so, it should display a message") print("s...
code_fim
medium
{ "lang": "python", "repo": "Williano/Solved-Practice-Questions", "path": "/magic_dates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vkuznet/WMCore path: /src/python/WMCore/JobSplitting/Generators/ReproducibleSeeding.py #!/usr/bin/env python # encoding: utf-8 """ ReproducibleSeeding.py Created by Dave Evans on 2010-08-30. Copyright (c) 2010 Fermilab. All rights reserved. Seeding algorithm that generates job seeds at splittin...
code_fim
hard
{ "lang": "python", "repo": "vkuznet/WMCore", "path": "/src/python/WMCore/JobSplitting/Generators/ReproducibleSeeding.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> GeneratorInterface.__init__(self, **options) self.couchUrl = options.get("CouchUrl") self.couchDBName = options.get("CouchDBName") self.couchConfigDoc = options.get("ConfigCacheDoc") confCache = ConfigCache(dbURL = self.couchUrl, couchDBName = self.couchDBName, id ...
code_fim
hard
{ "lang": "python", "repo": "vkuznet/WMCore", "path": "/src/python/WMCore/JobSplitting/Generators/ReproducibleSeeding.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>import random from random import SystemRandom _inst = SystemRandom() # // # // Max bit mask size for 32 bit integers #// This is required to be max 900M for CMSSW _MAXINT = 900000000 newSeed = lambda : _inst.randint(1, _MAXINT) class ReproducibleSeeding(GeneratorInterface): def __init__(self, **...
code_fim
medium
{ "lang": "python", "repo": "vkuznet/WMCore", "path": "/src/python/WMCore/JobSplitting/Generators/ReproducibleSeeding.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> from tree import SearchTree bfs_tree = SearchTree(domain, tree_depth) import numpy as np rng = np.random.default_rng() candidate_set = CandidateSet( domain, bfs_tree, rng, min_macro_size, max_macro_size, wildcard_rate, rollout_length, num_patterns, num_instances, max_...
code_fim
hard
{ "lang": "python", "repo": "garrettkatz/cubies", "path": "/candidate_set.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: garrettkatz/cubies path: /candidate_set.py import itertools as it import numpy as np import matplotlib.pyplot as pt from pattern_database import PatternDatabase from algorithm import run from utils import softmax class Candidate: def __init__(self, patterns, wildcard, macros): self.p...
code_fim
hard
{ "lang": "python", "repo": "garrettkatz/cubies", "path": "/candidate_set.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 20-1-SKKU-OSS/2020-1-OSS-1 path: /pyxel/ui/button.py import pyxel from .constants import BUTTON_LIGHTING_TIME from .widget import Widget class Button(Widget): """ Events: __on_press() __on_repeat() __on_release() """ def __init__(self, parent, x, y, wid...
code_fim
hard
{ "lang": "python", "repo": "20-1-SKKU-OSS/2020-1-OSS-1", "path": "/pyxel/ui/button.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __on_mouse_down(self, key, x, y): if key != pyxel.MOUSE_LEFT_BUTTON: return self._is_pressed = True self.call_event_handler("press") def __on_mouse_repeat(self, key, x, y): if key != pyxel.MOUSE_LEFT_BUTTON: return self._is_pre...
code_fim
hard
{ "lang": "python", "repo": "20-1-SKKU-OSS/2020-1-OSS-1", "path": "/pyxel/ui/button.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _generate_random_curve(x, sigma=0.2, knot=4): xx = ((np.arange(0, x.shape[0], (x.shape[0] - 1) / (knot + 1)))).transpose() yy = np.random.normal(loc=1.0, scale=sigma, size=(knot + 2, )) x_range = np.arange(x.shape[0]) cs = CubicSpline(xx[:], yy[:]) return np.array(cs(x_range)).tra...
code_fim
hard
{ "lang": "python", "repo": "JuWaver/ICASSP2019_TCN", "path": "/code/data_augmentation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def time_warp(x, sigma=0.1): output = np.zeros(x.shape) for i in range(x.shape[1]): tt_new = _distort_timesteps(x[:, i], sigma) tt_new = np.clip(tt_new, 0, x.shape[0] - 1) output[:, i] = x[tt_new.astype(int), i] return output def permute(x, nPerm=4, minSegLength=10): ...
code_fim
hard
{ "lang": "python", "repo": "JuWaver/ICASSP2019_TCN", "path": "/code/data_augmentation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JuWaver/ICASSP2019_TCN path: /code/data_augmentation.py # Data augmentation for EMG signals adapted from: # T. T. Um et al., “Data augmentation of wearable sensor data for parkinson’s disease monitoring using convolutional neural networks,” in Proceedings of the 19th ACM International Confe...
code_fim
hard
{ "lang": "python", "repo": "JuWaver/ICASSP2019_TCN", "path": "/code/data_augmentation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ send request """ request = body request['action'] = action request.setdefault('zone', self.zone) if self.expires: request['expires'] = self.expires resp = self.send(url, request, verb) if resp: return json_load(resp) ...
code_fim
hard
{ "lang": "python", "repo": "chenhaiq/qingcloud-sdk-python", "path": "/qingcloud/app/connection.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def send_request(self, action, body, url = '/app/', verb = 'GET'): """ send request """ request = body request['action'] = action request.setdefault('zone', self.zone) if self.expires: request['expires'] = self.expires resp = self.send(url, r...
code_fim
hard
{ "lang": "python", "repo": "chenhaiq/qingcloud-sdk-python", "path": "/qingcloud/app/connection.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chenhaiq/qingcloud-sdk-python path: /qingcloud/app/connection.py from qingcloud.iaas.connection import APIConnection from qingcloud.conn import auth from . import constants as const from qingcloud.misc.json_tool import json_load class AppConnection(APIConnection): <|fim_suffix|> """ send ...
code_fim
hard
{ "lang": "python", "repo": "chenhaiq/qingcloud-sdk-python", "path": "/qingcloud/app/connection.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @app.route('/api/color', methods=['POST']) def color(): if request.method == 'POST': messagebus.put(request.get_json()) return "", 204 app.run()<|fim_prefix|># repo: sandnabba/rgb_candlestick path: /controller/http_server/server.py from flask import Flask, reques...
code_fim
medium
{ "lang": "python", "repo": "sandnabba/rgb_candlestick", "path": "/controller/http_server/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sandnabba/rgb_candlestick path: /controller/http_server/server.py from flask import Flask, request import os.path def run(messagebus): <|fim_suffix|> @app.route('/api', methods=['GET', 'POST']) def root(): if request.method == 'POST': # print(request.get_json()) ...
code_fim
easy
{ "lang": "python", "repo": "sandnabba/rgb_candlestick", "path": "/controller/http_server/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>retCode = subprocess.call(['python','../../../framework/Driver.py',inputFile]) if retCode == 0: proc = subprocess.Popen(['compare', '-metric', differenceMetric, '-fuzz',fuzzAmount, testImage,goldImage,'null:'],stderr=subprocess.PIPE) retCode = int(proc.stderr.read()) sys.exit(retCode)<|fim_prefix|>#...
code_fim
hard
{ "lang": "python", "repo": "idaholab/raven", "path": "/tests/framework/OutStreams/testImageColorbar.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: idaholab/raven path: /tests/framework/OutStreams/testImageColorbar.py # Copyright 2017 Battelle Energy Alliance, 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 # #...
code_fim
medium
{ "lang": "python", "repo": "idaholab/raven", "path": "/tests/framework/OutStreams/testImageColorbar.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Linusp/zhtools path: /zhtools/utils/inverted_index.py from operator import itemgetter from collections import defaultdict, namedtuple import logging import pickle from enum import IntEnum from copy import deepcopy from zhtools.preprocess import to_halfwidth from zhtools.tokenize import get_token...
code_fim
hard
{ "lang": "python", "repo": "Linusp/zhtools", "path": "/zhtools/utils/inverted_index.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- storage: Storage 存储后端,用于获取实际的文档内容 field: str 要匹配的文档的字段,若不存在触发 FieldNotExistsError 异常 value: any 需匹配的字段的值 Return ------ documents: list 匹配到的文档列表 """ # field...
code_fim
hard
{ "lang": "python", "repo": "Linusp/zhtools", "path": "/zhtools/utils/inverted_index.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: crisp-archive/send-my-link path: /send_my_link.py import os from flask import Flask from flask import request app = Flask(__name__) <|fim_suffix|> link = request.args.get('link', '') os.system("open %s" % link) return 'RECV'<|fim_middle|>@app.route('/', methods=['GET']) def handle_re...
code_fim
easy
{ "lang": "python", "repo": "crisp-archive/send-my-link", "path": "/send_my_link.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> link = request.args.get('link', '') os.system("open %s" % link) return 'RECV'<|fim_prefix|># repo: crisp-archive/send-my-link path: /send_my_link.py import os from flask import Flask from flask import request <|fim_middle|>app = Flask(__name__) @app.route('/', methods=['GET']) def handle_re...
code_fim
medium
{ "lang": "python", "repo": "crisp-archive/send-my-link", "path": "/send_my_link.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: self.competition_dict = {} if use_proxy: robj = requests.get("http://%s.openjudge.cn/" % prefix, proxies=proxies) else: robj = requests.get("http://%s.openjudge.cn/" % prefix)...
code_fim
hard
{ "lang": "python", "repo": "fossabot/OJ_spider", "path": "/openjudge_spider.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fossabot/OJ_spider path: /openjudge_spider.py import requests from bs4 import BeautifulSoup import json import re import base64 proxies = {"http": "Your proxy here", "https": "Your proxy here"} use_proxy = False # Use proxy may help to accerate downloading images. def single_img_to_...
code_fim
hard
{ "lang": "python", "repo": "fossabot/OJ_spider", "path": "/openjudge_spider.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class spider_mainpage: def __init__(self, prefix): while True: try: self.competition_dict = {} if use_proxy: robj = requests.get("http://%s.openjudge.cn/" % prefix, proxies=proxies) else: ...
code_fim
hard
{ "lang": "python", "repo": "fossabot/OJ_spider", "path": "/openjudge_spider.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__( self, task: Task, tiled_context: Dict[TileableType, TileableType] = None, config: Config = None, ): self._task = task self.tileable_graph = task.tileable_graph self._config = config self.tile_context = tiled_context ...
code_fim
hard
{ "lang": "python", "repo": "hekaisheng/mars", "path": "/mars/services/task/supervisor/preprocessor.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hekaisheng/mars path: /mars/services/task/supervisor/preprocessor.py # Copyright 1999-2021 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
code_fim
hard
{ "lang": "python", "repo": "hekaisheng/mars", "path": "/mars/services/task/supervisor/preprocessor.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> done = property(_get_done, _set_done) def cancel(self): self._cancelled.set() def get_tiled(self, tileable: TileableType): tileable = tileable.data if hasattr(tileable, "data") else tileable return self.tile_context[tileable] def _update_tileable_params( ...
code_fim
hard
{ "lang": "python", "repo": "hekaisheng/mars", "path": "/mars/services/task/supervisor/preprocessor.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MaxBolD/UdemyTF path: /Chapter4_NN/Chapter4_2_DeepNeuralNetworks/gradientDescent.py import numpy as np from helper import f from helper import f_prime_x0 from helper import f_prime_x1 from helper import plot_rosenbrock <|fim_suffix|> learning_rate = 0.005 # [0.001, 0.00001] nu...
code_fim
hard
{ "lang": "python", "repo": "MaxBolD/UdemyTF", "path": "/Chapter4_NN/Chapter4_2_DeepNeuralNetworks/gradientDescent.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(f"Global minimum: {(1, 1)}") print(f"X_start = {x_start}") print(f"Y_start = {y_start}") plot_rosenbrock(x_start) learning_rate = 0.005 # [0.001, 0.00001] num_iterations = 1000 gradient_steps = [] for it in range(num_iterations): x0 = x0 - learn...
code_fim
medium
{ "lang": "python", "repo": "MaxBolD/UdemyTF", "path": "/Chapter4_NN/Chapter4_2_DeepNeuralNetworks/gradientDescent.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def process_args(self, context: MessageContext, *args: str) -> bool: """Converts an nether location to a over world location.""" output = [] for datum in args: datum = datum.strip().strip(",") if datum.isnumeric(): output.append(...
code_fim
hard
{ "lang": "python", "repo": "Acropolis/eorzeas-only-hope", "path": "/src/minecraft/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Converts an over world location to a nether location.""" def __init__(self) -> None: super().__init__("overworld", 1, 9) async def process_args(self, context: MessageContext, *args: str) -> bool: """Converts an over world location to a nether location.""" output =...
code_fim
hard
{ "lang": "python", "repo": "Acropolis/eorzeas-only-hope", "path": "/src/minecraft/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Acropolis/eorzeas-only-hope path: /src/minecraft/__init__.py #!/usr/bin/env python3 """Minecraft Bot Commands""" from __future__ import annotations import math import bot.commands from bot.commands import MessageContext class Pillars(bot.commands.ParamCommand): """Calculates even pillar...
code_fim
hard
{ "lang": "python", "repo": "Acropolis/eorzeas-only-hope", "path": "/src/minecraft/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # ...for sheet music display self.sheetFrame = Frame(borderwidth=1) def initControlButtons(): # Transcription control button container self.controlButtons = Frame(relief=SUNKEN, borderwidth=1) # Define buttons self.recordBtn = Button(self.controlButtons, text="Record", ...
code_fim
hard
{ "lang": "python", "repo": "ravi-11/music-transcription", "path": "/transcribe.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Add to note buffer: 1 measure's worth of audio if ( self.listener.detectedPitch ): theNote = note.Note(self.listener.pitch.note) self.noteBuffer.append(theNote) else: self.noteBuffer.append(None) def processBuffer(self, noteBuffer): """Process the recorded note buffer and turn ...
code_fim
hard
{ "lang": "python", "repo": "ravi-11/music-transcription", "path": "/transcribe.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ravi-11/music-transcription path: /transcribe.py # Graphics from Tkinter import * from bettertimer import * import ImageTk, Image import tkFileDialog, tkMessageBox # Audio from music21 import note, stream, pitch, clef, tempo from pitchdetect import * # Misc import time from itertools import gr...
code_fim
hard
{ "lang": "python", "repo": "ravi-11/music-transcription", "path": "/transcribe.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yubinbai/python_practice path: /permutation.py ''' generate all permutations of an iterable ''' def permutation(array): def _permute(array, step): if step == len(array) - 1: results.append(list(array)) return for i in range(step, len(array)): ...
code_fim
hard
{ "lang": "python", "repo": "yubinbai/python_practice", "path": "/permutation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': data = list("abbd") # for row in permutation(data): print(''.join(row)) for row in uniquePermutations(data): print(''.join(row))<|fim_prefix|># repo: yubinbai/python_practice path: /permutation.py ''' generate all permutations of an iterable ''' def permut...
code_fim
hard
{ "lang": "python", "repo": "yubinbai/python_practice", "path": "/permutation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: koriisabellaa/Python path: /chiper/cryptomath_module.py def gcd(a: int, b: int) -> int: """ >>> gcd(10, 5) 5 >>> gcd(5, 10) 5 >>> gcd(0, 5) 5 """ while a != 0: a, b = b % a, a return b <|fim_suffix|> """ >>> find_mod_inverse(2, 5) 3 ...
code_fim
medium
{ "lang": "python", "repo": "koriisabellaa/Python", "path": "/chiper/cryptomath_module.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ >>> find_mod_inverse(2, 5) 3 >>> find_mod_inverse(7, 26) 15 >>> find_mod_inverse(1, 26) 1 """ if gcd(a, m) != 1: raise ValueError(f"mod kebalikan dari {a!r} dan {m!r} tidak ada") u1, u2, u3 = 1, 0, a v1, v2, v3 = 0, 1, m while v3 != 0: q ...
code_fim
medium
{ "lang": "python", "repo": "koriisabellaa/Python", "path": "/chiper/cryptomath_module.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: slivingston/btsynth path: /examples/gridworld_example.py #!/usr/bin/env python """ testing on gridworlds... SCL; Aug, Sep 2011; Feb 2012. """ import tulip import tulip.congexf as cg import sys from btsynth import * from btsynth.automaton import BTAutomaton if __name__ == "__main__": if l...
code_fim
hard
{ "lang": "python", "repo": "slivingston/btsynth", "path": "/examples/gridworld_example.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> history, intent, obs_poses = navobs_sim(init_list[0], aut_patched, W_actual, num_obs=num_obs, num_it=1000) print intent print pretty_world(W_actual, goal_list=goal_list, init_list=init_list, env_init_list=en...
code_fim
hard
{ "lang": "python", "repo": "slivingston/btsynth", "path": "/examples/gridworld_example.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> aut.writeDotFileCoord("tempsyn-ORIG.dot") with open("tempsyn-ORIG.gexf", "w") as f: f.write(cg.dumpGexf(aut, use_viz=True, use_clusters=True)) # sim_history = grsim([aut], num_it=20, deterministic_env=False) # for step in sim_history: # print str(step[0]) + "-> " + str(ext...
code_fim
hard
{ "lang": "python", "repo": "slivingston/btsynth", "path": "/examples/gridworld_example.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> features = tf.nn.conv2d(features, self.weights['features.12.weight'], strides=[1,2,2,1], padding='SAME') features = tf.nn.batch_normalization(features, self.weights['features.13.running_mean'], self.weights['features.13.running_var'], None, None, 1e-6) features = tf.nn.relu(featu...
code_fim
hard
{ "lang": "python", "repo": "cumtchenchang/Key.Net", "path": "/keyNet/model/hardnet.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_prefix|># repo: cumtchenchang/Key.Net path: /keyNet/model/hardnet.py import tensorflow as tf import pickle class HardNet(object): def __init__(self, checkpoint): file = open(checkpoint, 'rb') pickle_dataset = pickle.load(file) file.close() self.create_weights(pick...
code_fim
hard
{ "lang": "python", "repo": "cumtchenchang/Key.Net", "path": "/keyNet/model/hardnet.py", "mode": "psm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> def input_norm(self, x, eps=1e-6): x_flatten = tf.layers.flatten(x) x_mu, x_std = tf.nn.moments(x_flatten, axes=[1]) # Add extra dimension x_mu = tf.expand_dims(x_mu, axis=1) x_std = tf.expand_dims(x_std, axis=1) x_norm = (x_f...
code_fim
hard
{ "lang": "python", "repo": "cumtchenchang/Key.Net", "path": "/keyNet/model/hardnet.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|>, and therefore able to be referenced by # pkgutil.get_data.<|fim_prefix|># repo: sipb/homeworld path: /platform/python/template_init.py # this is a template file that gets instantiated for any baz<|fim_middle|>el package with python-accessible resources. # its simple presence as __init__.py is enough to...
code_fim
medium
{ "lang": "python", "repo": "sipb/homeworld", "path": "/platform/python/template_init.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sipb/homeworld path: /platform/python/template_init.py # this is a template file that gets instantiated for any bazel package with python-accessible resources. # its simple pr<|fim_suffix|>, and therefore able to be referenced by # pkgutil.get_data.<|fim_middle|>esence as __init__.py is enough to...
code_fim
medium
{ "lang": "python", "repo": "sipb/homeworld", "path": "/platform/python/template_init.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_met_pos_region(site_ref, region_ref): print("Start searching met pos in each region...") total_region_met_pos = dict() for each_chr in region_ref: print("\tStart parsing chromosome {}".format(each_chr)) each_site_ref = numpy.array(list(site_ref[each_chr])) each_...
code_fim
hard
{ "lang": "python", "repo": "zhq921/cfWGBS-bioinfo-pip", "path": "/2. DMR_calling/extract_CpG_met_matrix.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhq921/cfWGBS-bioinfo-pip path: /2. DMR_calling/extract_CpG_met_matrix.py import re import os import sys import glob import numpy from collections import defaultdict def parse_subtype(path_subtype): print("Start reading from {}".format(path_subtype)) normal_samples = [] cancer_sampl...
code_fim
hard
{ "lang": "python", "repo": "zhq921/cfWGBS-bioinfo-pip", "path": "/2. DMR_calling/extract_CpG_met_matrix.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ECellNitrr/teesco-backend path: /tests/org/test_search_org_api.py from org.models import * from tests.AuthAPITestCase import AuthAPITestCase from rest_framework.test import APITestCase,APIClient from rest_framework import status from org.serializers import * class SearchOrgTestCase(AuthAPITestCa...
code_fim
hard
{ "lang": "python", "repo": "ECellNitrr/teesco-backend", "path": "/tests/org/test_search_org_api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_fail_without_auth_header(self): un_auth_client = APIClient() response = un_auth_client.get(self.search_org_api) self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) def test_success_with_auth_header(self): auth_client = self.create_auth_cli...
code_fim
hard
{ "lang": "python", "repo": "ECellNitrr/teesco-backend", "path": "/tests/org/test_search_org_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sangminwoo/evo_ai path: /nn_optimize/nn_optimize.py f get_model(state_dict=None): model = nn.Sequential( nn.Flatten(), nn.Linear(784, 1000, bias=True), nn.Sigmoid(), nn.Linear(1000, 10, bias=False) ) if state_dict is None: return model if isinstance(state_dict, str): state_dict ...
code_fim
hard
{ "lang": "python", "repo": "sangminwoo/evo_ai", "path": "/nn_optimize/nn_optimize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run(self): time_meter = AverageMeter() end = time.time() fitness_history = [] population = self.init_population() for iteration in range(self.num_generations): accs = []; fits = [] for indv in population: acc, fit = self.fitness(indv) accs.append(acc) fits.append(fit) ...
code_fim
hard
{ "lang": "python", "repo": "sangminwoo/evo_ai", "path": "/nn_optimize/nn_optimize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> children[i, :crossover_points[0]] = parents[idx[0], :crossover_points[0]] children[i, crossover_points[0]:crossover_points[1]] = parents[idx[1], crossover_points[0]:crossover_points[1]] children[i, crossover_points[1]:crossover_points[2]] = parents[idx[0], crossover_points[1]:crossover_points[...
code_fim
hard
{ "lang": "python", "repo": "sangminwoo/evo_ai", "path": "/nn_optimize/nn_optimize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>tps://github.com/enjoy-digital/liteeth """<|fim_prefix|># repo: Nic30/hwtLib path: /hwtLib/peripheral/ethernet/__init__.py """ https://github.com/alexforencich/verilog-ethernet/tree/master/rtl https://githu<|fim_middle|>b.com/jsyk/miilink/tree/master/fpga/src ht
code_fim
easy
{ "lang": "python", "repo": "Nic30/hwtLib", "path": "/hwtLib/peripheral/ethernet/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nic30/hwtLib path: /hwtLib/peripheral/ethernet/__init__.py """ https://github.com/alexforencich/veri<|fim_suffix|>tps://github.com/enjoy-digital/liteeth """<|fim_middle|>log-ethernet/tree/master/rtl https://github.com/jsyk/miilink/tree/master/fpga/src ht
code_fim
medium
{ "lang": "python", "repo": "Nic30/hwtLib", "path": "/hwtLib/peripheral/ethernet/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def initiali(zorig, nr, rmin, rmax, r, dr, r2, dl, njrc=[None] * 4, xntot=0., nel=0, input_stream='stdin'): ''' Description ----------- Initialise the radial charge grid Parameters ---------- zorig : float nr : int Number of radial grid points...
code_fim
hard
{ "lang": "python", "repo": "Liam-Deacon/phaseshifts", "path": "/phaseshifts/lib/hartfock.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }