text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> loss = entropy_loss(theta, X, Y); x, y = idx2pos(theta, d); origin_val = theta[x][y]; diff = get_d1_loss(theta, d, X, Y); d2loss = get_d2_loss(theta, d, X, Y); if abs(d2loss) > 0.0: theta[x][y] -= diff / d2loss; new_loss = entropy_loss(theta, X, Y); return abs(new_l...
code_fim
hard
{ "lang": "python", "repo": "AshuAkshi0708/Data-Science-Projects", "path": "/Wine Dataset - Coordinate Descent/src/softmax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: XiaoqingWang/deepcake path: /cake.py import datetime import json import os,sys import numpy as np import tensorflow as tf from reader import * from config import * from logger import * from models import * logger = init_log(debug = True) def model(inputs): if FLAGS.model == "wide": return...
code_fim
hard
{ "lang": "python", "repo": "XiaoqingWang/deepcake", "path": "/cake.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># metric here tf.get_variable_scope().reuse_variables() accuracy_logits = model(validate_batch_features) validate_softmax = tf.nn.softmax(accuracy_logits) validate_batch_labels = tf.to_int64(validate_batch_labels) correct_prediction = tf.equal(tf.argmax(validate_softmax, 1), validate_batch_labels) accurac...
code_fim
hard
{ "lang": "python", "repo": "XiaoqingWang/deepcake", "path": "/cake.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with tf.device("/cpu:0"): # better than gpu global_step = tf.Variable(0, name='global_step', trainable=False) train_op = optimizer.minimize(loss, global_step=global_step) # metric here tf.get_variable_scope().reuse_variables() accuracy_logits = model(validate_batch_features) validate_softmax = tf.nn....
code_fim
hard
{ "lang": "python", "repo": "XiaoqingWang/deepcake", "path": "/cake.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fig.tight_layout() fig.savefig(os.path.join(CONFIG['IO_OPTION']['OUTPUT_ROOT'], 'roc_curve.png'), dpi=100) def plot_fig(test_img, scores, save_dir, class_name, wav_names): num = len(scores) vmax = scores.max() vmin = scores.min() for i in tqdm(range(num), '| plot heatmap | test | ...
code_fim
hard
{ "lang": "python", "repo": "HirokiNarita/dcase2021_task2", "path": "/src/model_codes/PaDiM/ex8/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if mean_img_roc_auc < max_img_roc_auc: img_scores = max_img_scores fpr, tpr = max_fpr, max_tpr img_roc_auc = max_img_roc_auc else: img_scores = mean_img_scores fpr, tpr = mean_fpr, mean_tpr img_roc_auc = mean_img_roc_a...
code_fim
hard
{ "lang": "python", "repo": "HirokiNarita/dcase2021_task2", "path": "/src/model_codes/PaDiM/ex8/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HirokiNarita/dcase2021_task2 path: /src/model_codes/PaDiM/ex8/main.py a import DataLoader from torchvision.models import wide_resnet50_2, resnet18 from models import ResNet38, Cnn14_16k import datasets.mvtec as mvtec import DCASE2021_task2 from DCASE_util import DCASE2021_Task2_Score_Calculator ...
code_fim
hard
{ "lang": "python", "repo": "HirokiNarita/dcase2021_task2", "path": "/src/model_codes/PaDiM/ex8/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def scan_victims(pkg): print('Scaning for victims: %s' % (pkg.handler.info()['name'])) vdb = LocalDatabase() for child in pkg.info: if child['type'] == '.jar': matches = vdb.match_archive(child['sha512']) if len(matches) > 0: cve_str = ','.join(matches) filename = join(child['path'], ch...
code_fim
hard
{ "lang": "python", "repo": "abn/jsnoop", "path": "/examples/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abn/jsnoop path: /examples/process.py #! /usr/bin/env python3 import sys from os.path import basename, join, isfile, isdir from os import listdir from jsnoop.package import Package from jsnoop.plugins.victims import LocalDatabase from optparse import OptionParser from multiprocessing import Pool...
code_fim
medium
{ "lang": "python", "repo": "abn/jsnoop", "path": "/examples/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> time_steps: int = 8 # :math:`T` depth: int = 2 recurrent_hidden_channels: int = 64 num_cascades: int = 8 no_parameter_sharing: bool = True<|fim_prefix|># repo: NKI-AI/direct path: /direct/nn/cirim/config.py # coding=utf-8 # Copyright (c) DIRECT Contributors from dataclasses import d...
code_fim
medium
{ "lang": "python", "repo": "NKI-AI/direct", "path": "/direct/nn/cirim/config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NKI-AI/direct path: /direct/nn/cirim/config.py # coding=utf-8 # Copyright (c) DIRECT Contributors from dataclasses import dataclass from direct.config.defaults import ModelConfig <|fim_suffix|> time_steps: int = 8 # :math:`T` depth: int = 2 recurrent_hidden_channels: int = 64 ...
code_fim
easy
{ "lang": "python", "repo": "NKI-AI/direct", "path": "/direct/nn/cirim/config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: YooInKeun/CAU_CSE_Capstone_3 path: /BeautyForMe/myvenv/Lib/site-packages/win32com/test/daodump.py # import dao3032 # No longer imported here - callers responsibility to load # import win32com.client def DumpDB(db, bDeep = 1): # MUST be a DB object. DumpTables(db,bDeep) DumpRelations(...
code_fim
hard
{ "lang": "python", "repo": "YooInKeun/CAU_CSE_Capstone_3", "path": "/BeautyForMe/myvenv/Lib/site-packages/win32com/test/daodump.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for progid in ("DAO.DBEngine.36", "DAO.DBEngine.35", "DAO.DBEngine.30"): try: ob = win32com.client.gencache.EnsureDispatch(progid) except pythoncom.com_error: print(progid, "does not seem to be installed") else: TestEngine(ob) bre...
code_fim
hard
{ "lang": "python", "repo": "YooInKeun/CAU_CSE_Capstone_3", "path": "/BeautyForMe/myvenv/Lib/site-packages/win32com/test/daodump.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from .stores import dl_async, export, MediaData from .generators import dwca from .generators import api<|fim_prefix|># repo: plantnet/gbif-dl path: /gbif_dl/__init__.py """ __gbif-dl__ provides easy access to media data from the GBIF database to be used for training machine learning models. It wraps the...
code_fim
medium
{ "lang": "python", "repo": "plantnet/gbif-dl", "path": "/gbif_dl/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: plantnet/gbif-dl path: /gbif_dl/__init__.py """ __gbif-dl__ provides easy access to media data from the GBIF database to be used for training machine learning models. It wraps the GBIF API and supports directly querying the api to obtain and download a list of urls. Existing queries can also be o...
code_fim
medium
{ "lang": "python", "repo": "plantnet/gbif-dl", "path": "/gbif_dl/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SandraCoburn/graphs_guided path: /word_ladders2.py class Queue(): def __init__(self): self.queue = [] def enqueue(self, value): self.queue.append(value) def dequeue(self): if self.size() > 0: return self.queue.pop(0) else: return...
code_fim
hard
{ "lang": "python", "repo": "SandraCoburn/graphs_guided", "path": "/word_ladders2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> q = Queue() visited = set() q.enqueue([start_word]) while q.size() > 0: current_path = q.dequeue() current_word = current_path[-1] if current_word == end_word: return current_path if current_word not in visited: visited.add...
code_fim
hard
{ "lang": "python", "repo": "SandraCoburn/graphs_guided", "path": "/word_ladders2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if current_word not in visited: visited.add(current_word) neighbors = get_neighbors(current_word) for neighbor in neighbors: new_path = current_path + [neighbor] q.enqueue(new_path)<|fim_prefix|># repo: SandraCoburn/graphs_guided...
code_fim
hard
{ "lang": "python", "repo": "SandraCoburn/graphs_guided", "path": "/word_ladders2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> post.self_print(contraversial=True, hide=['all_comments','selftext_html','punchline_ext']) #self.network.show_graph() #print(post) return f'returning from {self}' def create_network_edge(self, start, end, type):#, network): if str(type) == "<class '...
code_fim
hard
{ "lang": "python", "repo": "jaquielajoie/Reddit-NLP", "path": "/Social_Scraper/Web_Server/Reddit/PostReader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaquielajoie/Reddit-NLP path: /Social_Scraper/Web_Server/Reddit/PostReader.py import praw from praw.models import MoreComments import pprint from datetime import datetime import re import string import sqlite3 import nltk from nltk.tokenize import sent_tokenize, word_tokenize from nltk.chunk impo...
code_fim
hard
{ "lang": "python", "repo": "jaquielajoie/Reddit-NLP", "path": "/Social_Scraper/Web_Server/Reddit/PostReader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #print(i, comm.author, comm.body) #com = Comment() #self.create_network_edge(start=ru,end=redd_comm,type=type(redd_comm), network_name=comm.submission.id) post.self_print(contraversial=True, hide=['all_comments','selftext_html','punchlin...
code_fim
hard
{ "lang": "python", "repo": "jaquielajoie/Reddit-NLP", "path": "/Social_Scraper/Web_Server/Reddit/PostReader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> index = 0 # preprocess img = np.asarray(img, dtype=np.uint8) prob = prob.squeeze() key = key.squeeze() color = [(15, 15, 240), (15, 240, 155), (240, 155, 15), (240, 15, 155), (240, 15, 240)] for c, p in enumerate(prob): if p > 0.5: img = cv2.circle(img, (i...
code_fim
medium
{ "lang": "python", "repo": "MahmudulAlam/Unified-Gesture-and-Fingertip-Detection", "path": "/visualize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MahmudulAlam/Unified-Gesture-and-Fingertip-Detection path: /visualize.py import cv2 import numpy as np from preprocess.data_generator import label_generator def visualize(img, prob, key): index = 0 <|fim_suffix|> if __name__ == '__main__': image, probability, keypoints = label_generato...
code_fim
hard
{ "lang": "python", "repo": "MahmudulAlam/Unified-Gesture-and-Fingertip-Detection", "path": "/visualize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.cursor.execute("SELECT typeName FROM invtypes WHERE typeID = %s; " % type_id) type_name = '' for row in self.cursor: type_name = row[0] return type_name def type_id_has_group_id(self, type_id): self.cursor.execute("SELECT marketGroupID FROM inv...
code_fim
hard
{ "lang": "python", "repo": "Marclass/EveCommon", "path": "/EveCommon/SDEConnector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.cursor.close() self.connection.close() def get_type_id_by_type_name(self, type_name): self.cursor.execute("SELECT typeID FROM invtypes WHERE typeName = %s; " % type_name) type_id = 0 for row in self.cursor: type_id = row[0] return type_...
code_fim
hard
{ "lang": "python", "repo": "Marclass/EveCommon", "path": "/EveCommon/SDEConnector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Marclass/EveCommon path: /EveCommon/SDEConnector.py import sqlite3 class SDEConnector(object): def __init__(self, db_name='', host='127.0.0.1', port=3306, user='root', passwd=''): self.db_name = db_name self.host = host self.port = port self.user = user ...
code_fim
medium
{ "lang": "python", "repo": "Marclass/EveCommon", "path": "/EveCommon/SDEConnector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThoughtWorksInc/CD4ML-Scenarios path: /test/test_acceptance_arg_parsing.py import datetime import os from pathlib import Path from cd4ml.filenames import get_model_files from scripts import acceptance as acceptance_script def test_acceptance_with_model_id(): model_id = acceptance_script.pa...
code_fim
medium
{ "lang": "python", "repo": "ThoughtWorksInc/CD4ML-Scenarios", "path": "/test/test_acceptance_arg_parsing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>earlier_time = int(datetime.datetime(2020, 8, 29, 12, 0, 0).timestamp()) later_time = int(datetime.datetime(2020, 8, 29, 14, 0, 0).timestamp()) def test_acceptance_with_no_arguments(tmp_path): os.environ["CD4ML_DATA_DIR"] = str(tmp_path) files = get_model_files('', base_data_dir=tmp_path) b...
code_fim
medium
{ "lang": "python", "repo": "ThoughtWorksInc/CD4ML-Scenarios", "path": "/test/test_acceptance_arg_parsing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_acceptance_with_no_arguments(tmp_path): os.environ["CD4ML_DATA_DIR"] = str(tmp_path) files = get_model_files('', base_data_dir=tmp_path) base_results_directory = files['results_folder'] earlier_folder = Path(base_results_directory, "earlier") earlier_folder.mkdir(parents=True...
code_fim
hard
{ "lang": "python", "repo": "ThoughtWorksInc/CD4ML-Scenarios", "path": "/test/test_acceptance_arg_parsing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rxedu/tensorflow-tutorials path: /tensorflow_tutorials/mnist/test/mnist_test.py # pylint: disable=import-error # pylint: disable=missing-docstring # pylint: disable=redefined-outer-name import pytest <|fim_suffix|>def test_distribution(): assert MNIST().distribution is not None def test_en...
code_fim
hard
{ "lang": "python", "repo": "rxedu/tensorflow-tutorials", "path": "/tensorflow_tutorials/mnist/test/mnist_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mnist = MNIST() session = mnist.train(mnist_data.train) accuracy = mnist.check_accuracy(mnist_data.test, session) assert accuracy >= 0.91 assert accuracy <= 0.93 session.close()<|fim_prefix|># repo: rxedu/tensorflow-tutorials path: /tensorflow_tutorials/mnist/test/mnist_test.py # ...
code_fim
hard
{ "lang": "python", "repo": "rxedu/tensorflow-tutorials", "path": "/tensorflow_tutorials/mnist/test/mnist_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import numpy as np # Circulant embedding circ = np.zeros((2 * L, 2 * M, 2 * N, 3), dtype=np.complex128) for i in range(0, 3): circ[0:L, 0:M, 0:N, i] = toep[:, :, :, i] circ[0:L, 0:M, N+1:2*N, i] = toep[0:L, 0:M, -1:0:-1, i] circ[0:L, M+1:2*M, 0:N, i] = toep[0:L, -1...
code_fim
hard
{ "lang": "python", "repo": "JBannister96/vines", "path": "/vines/precondition/threeD.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JBannister96/vines path: /vines/precondition/threeD.py def gperiodic_coeff_nop(cube): import numpy as np if cube in 'L': Gp = np.array((+1.0, -1.0, -1.0, +1.0, +1.0, +1.0)) elif cube in 'M': Gp = np.array((+1.0, -1.0, +1.0, +1.0, -1.0, +1.0)) elif cube in 'N': ...
code_fim
hard
{ "lang": "python", "repo": "JBannister96/vines", "path": "/vines/precondition/threeD.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> WBH15RMK_24 = [##this section is being decoded correctly ('RRC-TAPE-RECORD-ID',0,2,'pic_any'), ('WB-H15-REMARK-KEY',2,3,'pic_numeric'), ('WB-H15-REMARK-TEXT',5,70,'pic_any') ]##inherits API from 01 and h15 key from 23. Might work well as json WBSB126_25 = ...
code_fim
hard
{ "lang": "python", "repo": "skylerbast/TXRRC_data_harvest", "path": "/dbf900_layouts.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: skylerbast/TXRRC_data_harvest path: /dbf900_layouts.py LL-BORE-PLUGGED',10,8,'pic_yyyymmdd'), ##YYYYMMDD ('WB-PLUG-TOTAL-DEPTH',18,5,'pic_numeric'), ('WB-PLUG-CEMENT-COMP',23,32,'pic_any'), ('WB-PLUG-MUD-FILLED',55,1,'pic_any'), ('WB-PLUG-MUD-APPLIE...
code_fim
hard
{ "lang": "python", "repo": "skylerbast/TXRRC_data_harvest", "path": "/dbf900_layouts.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: skylerbast/TXRRC_data_harvest path: /dbf900_layouts.py ('WB-WELL-LOC-NEAREST-TOWN',96,13,'pic_any'), ('WB-DIST-FROM-SURVEY-LINES',137,28,'pic_any'), ('WB-DIST-DIRECT-NEAR-WELL',165,28,'pic_any') ]##should inherit API10, many wells do not have this section WBNE...
code_fim
hard
{ "lang": "python", "repo": "skylerbast/TXRRC_data_harvest", "path": "/dbf900_layouts.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>def s3_sync(s3_bucket, s3_prefix, sync_path="."): """ Syncs a given path to an s3 prefix Args: s3_bucket (str): bucket name s3_prefix (str): s3 prefix to sync to sync_path (str, Path): path to sync to bucket:prefix Returns: (None) """ # Get bucket...
code_fim
hard
{ "lang": "python", "repo": "apalizha/CAMD", "path": "/camd/utils/data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apalizha/CAMD path: /camd/utils/data.py # Copyright (c) 2019 Toyota Research Institute. All rights reserved. """ This module consolidates s3-based dataset loading for CAMD, mostly in the form of dataframes """ import os import boto3 import botocore import requests import pandas as pd import n...
code_fim
hard
{ "lang": "python", "repo": "apalizha/CAMD", "path": "/camd/utils/data.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert last_eoe_idx is None or last_eoes[last_eoe_idx], f"last_eoe_idx:{last_eoe_idx}" if last_eoe_idx is not None: replace_hist_before_eoe(hist=new_act_buf, eoe_idx_in_hist=last_eoe_idx - self.start_acts_offset - 1) replace_hist_before_eoe(hist=last_act_buf, eoe_i...
code_fim
hard
{ "lang": "python", "repo": "trackmania-rl/tmrl", "path": "/tmrl/custom/custom_memories.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trackmania-rl/tmrl path: /tmrl/custom/custom_memories.py input to the append() method of the memory the user must define both this function and the append() method of the memory CAUTION: prev_act is the action that comes BEFORE obs (i.e. prev_obs, prev_act(prev_obs), obs(prev_act)) ""...
code_fim
hard
{ "lang": "python", "repo": "trackmania-rl/tmrl", "path": "/tmrl/custom/custom_memories.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trackmania-rl/tmrl path: /tmrl/custom/custom_memories.py ============== def last_true_in_list(li): for i in reversed(range(len(li))): if li[i]: return i return None def replace_hist_before_eoe(hist, eoe_idx_in_hist): """ Pads the history hist before the End...
code_fim
hard
{ "lang": "python", "repo": "trackmania-rl/tmrl", "path": "/tmrl/custom/custom_memories.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.name = name super(ShapeSystVar, self).__init__(name, pretty_name=pretty_name, on=on) class ForHist(SystVar.ForHist): def __init__(self, hist, systVar): super(ShapeSystVar.ForHist, self).__init__(hist, systVar) self.histUp = self._findVarHist("up") ...
code_fim
hard
{ "lang": "python", "repo": "pieterdavid/mplbplot", "path": "/cms_stacks/systematics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pieterdavid/mplbplot path: /cms_stacks/systematics.py """ Systematics classes (based on plotIt) """ __all__ = ("HistoKey", "SystVarsForHist", "SystVar", "ParameterizedSystVar", "ConstantSystVar", "LogNormalSystVar", "ShapeSystVar" ) import itertools import histo_utils as h1u...
code_fim
hard
{ "lang": "python", "repo": "pieterdavid/mplbplot", "path": "/cms_stacks/systematics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(ParameterizedSystVar, self).__init__(name, pretty_name=pretty_name, on=on) def nom(self, hist, i): pass def up(self, hist, i): pass def down(self, hist, i): pass class ForHist(SystVar.ForHist): """ delegate everything to the corresponding syst...
code_fim
hard
{ "lang": "python", "repo": "pieterdavid/mplbplot", "path": "/cms_stacks/systematics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.basic = ['homicide']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_homicides.py #calss header class _HOMICIDES(): def __init__(self,): self.name = "HOMICIDES" self.definitions = homicide <|fim_middle|> self.parents = [] self.childen = [] self.properties = []...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_homicides.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_homicides.py #calss header class _HOMICIDES(): <|fim_suffix|> self.basic = ['homicide']<|fim_middle|> def __init__(self,): self.name = "HOMICIDES" self.definitions = homicide self.parents = [] self.childen = [] self.properties = [...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_homicides.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return (f.LocalPath().endswith(('html')) and (os.path.join('resources', '') not in f.LocalPath())) for f in input_api.AffectedFiles(include_deletes=False, file_filter=file_filter): if not _CheckFileTimeoutMetaTags(f): re...
code_fim
hard
{ "lang": "python", "repo": "chromium/chromium", "path": "/third_party/blink/web_tests/wpt_internal/prerender/PRESUBMIT.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chromium/chromium path: /third_party/blink/web_tests/wpt_internal/prerender/PRESUBMIT.py # Copyright 2021 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Chromium presubmit script for prerender in Web Platform Tests. <...
code_fim
medium
{ "lang": "python", "repo": "chromium/chromium", "path": "/third_party/blink/web_tests/wpt_internal/prerender/PRESUBMIT.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for f in input_api.AffectedFiles(include_deletes=False, file_filter=file_filter): if not _CheckFileTimeoutMetaTags(f): results.append( output_api.PresubmitError( ('Missing long timeout. ' ...
code_fim
hard
{ "lang": "python", "repo": "chromium/chromium", "path": "/third_party/blink/web_tests/wpt_internal/prerender/PRESUBMIT.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Limmen/gym-idsgame path: /gym_idsgame/simulation/dao/simulation_config.py import csv class SimulationConfig: def __init__(self, num_episodes: int = 10, video_fps=5, video=False, gif_dir=None, video_dir=None, gifs=False, render=False, sleep=0.35, log_frequen...
code_fim
hard
{ "lang": "python", "repo": "Limmen/gym-idsgame", "path": "/gym_idsgame/simulation/dao/simulation_config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param file_path: path to the file :return: None """ with open(file_path, "w") as f: writer = csv.writer(f) writer.writerow(["parameter", "value"]) writer.writerow(["render", str(self.render)]) writer.writerow(["sleep", str(se...
code_fim
hard
{ "lang": "python", "repo": "Limmen/gym-idsgame", "path": "/gym_idsgame/simulation/dao/simulation_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ConstantOpTest(test.TestCase, parameterized.TestCase): @parameterized.parameters( dtypes.bfloat16, dtypes.complex128, dtypes.complex64, dtypes.double, dtypes.float16, dtypes.float32, dtypes.float64, dtypes.half, dtypes.int16, dtypes.int3...
code_fim
medium
{ "lang": "python", "repo": "NVIDIA/tensorflow", "path": "/tensorflow/python/framework/constant_op_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NVIDIA/tensorflow path: /tensorflow/python/framework/constant_op_test.py # Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of ...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/tensorflow", "path": "/tensorflow/python/framework/constant_op_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return reverse('nowait:booking_list') def form_valid(self, form): result = super(BookingCreateView, self).form_valid(form) booking = form.instance try: booking.save_and_take_slottime(self.slottime, self.request) except Exception as e: ms...
code_fim
hard
{ "lang": "python", "repo": "simodalla/mezzanine_nowait", "path": "/nowait/views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class BookingTypeDetailView(PageContextTitleMixin, DetailView): model = BookingType def get_page_title(self): return _('%(title)s') % {'title': self.object.title.title()} class SlottimeSelectView(PageContextTitleMixin, TemplateView): template_name = 'nowait/slottime_select.html' ...
code_fim
hard
{ "lang": "python", "repo": "simodalla/mezzanine_nowait", "path": "/nowait/views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: simodalla/mezzanine_nowait path: /nowait/views.py # -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import import logging from datetime import datetime from django.contrib import messages from django.core.urlresolvers import reverse from django.shortcuts import redirect ...
code_fim
hard
{ "lang": "python", "repo": "simodalla/mezzanine_nowait", "path": "/nowait/views.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return False def has_delete_permission(self, request, obj=None): return False<|fim_prefix|># repo: mickbad/django-extended-settings path: /extended_settings/admin.py from django.contrib import admin from extended_settings.models import ExtentedSettings # ----------------------------...
code_fim
hard
{ "lang": "python", "repo": "mickbad/django-extended-settings", "path": "/extended_settings/admin.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fieldsets = ( (None, { "fields": ("name", "key", "value", "updated_at",) }), ) def has_add_permission(self, request, obj=None): return False def has_delete_permission(self, request, o...
code_fim
medium
{ "lang": "python", "repo": "mickbad/django-extended-settings", "path": "/extended_settings/admin.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mickbad/django-extended-settings path: /extended_settings/admin.py from django.contrib import admin from extended_settings.models import ExtentedSettings # ---------------------------------------------------------------------------------------------------------------------- # - Création de l'adm...
code_fim
medium
{ "lang": "python", "repo": "mickbad/django-extended-settings", "path": "/extended_settings/admin.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert m._tx_model_params['parameter2'] == 'P2' assert len(m._tx_model_params.used_keys) == 2 assert 'parameter1' in m._tx_model_params.used_keys assert 'parameter2' in m._tx_model_params.used_keys assert m._tx_model_params.all_used assert m._tx_model_params.get( 'missing...
code_fim
hard
{ "lang": "python", "repo": "sebix/textX", "path": "/tests/functional/test_metamodel/test_model_params.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sebix/textX path: /tests/functional/test_metamodel/test_model_params.py from __future__ import unicode_literals from textx import (metamodel_from_str) import os.path from pytest import raises from textx.exceptions import TextXError grammar = r""" Model: 'MyModel' name=ID; """ text = r""" MyMod...
code_fim
hard
{ "lang": "python", "repo": "sebix/textX", "path": "/tests/functional/test_metamodel/test_model_params.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> owner = serializers.PrimaryKeyRelatedField(allow_null=True, queryset=Owner.objects.all(), required=False) driver = serializers.PrimaryKeyRelatedField(allow_null=True, queryset=Driver.objects.all(), required=False, validators=[UniqueValidator(queryset...
code_fim
hard
{ "lang": "python", "repo": "manibhushan05/tms", "path": "/web/transiq/restapi/serializers/owner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: manibhushan05/tms path: /web/transiq/restapi/serializers/owner.py pload.bucket, 'folder': doc.s3_upload.folder, 'uuid': doc.s3_upload.uuid, 'filename': doc.s3_upload.filename, 'validity': None, ...
code_fim
hard
{ "lang": "python", "repo": "manibhushan05/tms", "path": "/web/transiq/restapi/serializers/owner.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> id = serializers.IntegerField(label='ID', read_only=True) vehicle_number = serializers.CharField(write_only=True, max_length=18, validators=[UniqueValidator(queryset=Vehicle.objects.all())]) rc_number = serializers.CharField(allow_null=True ,max_lengt...
code_fim
hard
{ "lang": "python", "repo": "manibhushan05/tms", "path": "/web/transiq/restapi/serializers/owner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pablo0723/just-a-test path: /component/board/tests.py from rest_framework.test import APIClient, APITestCase from component.board.models import Board, TodoTask from component.board.serializers import BoardSerializer, TodoTaskSerializer class TestBoardViews(APITestCase): def setUp(self): ...
code_fim
hard
{ "lang": "python", "repo": "pablo0723/just-a-test", "path": "/component/board/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_todos_post(self): response = self.client.post(f'/api/board/{self.board.slug}/todos/', {'board': self.board.id, 'name': 'Test 2'}) self.assertEqual(response.status_code, 201) todo = TodoTask.objects.get(id=response.json()['id']) serializer = TodoTaskSerializer(t...
code_fim
hard
{ "lang": "python", "repo": "pablo0723/just-a-test", "path": "/component/board/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = self.client.delete(f'/api/board/boards/{self.board.id}/') self.assertEqual(response.status_code, 204) def test_todo_delete(self): response = self.client.delete(f'/api/board/{self.board.slug}/todos/{self.todo.id}/') self.assertEqual(response.status_code, 204)...
code_fim
hard
{ "lang": "python", "repo": "pablo0723/just-a-test", "path": "/component/board/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def field_to_swagger_object( self, field, swagger_object_type, use_references, **kwargs ): if issubclass(type(field), NamedBase64FieldMixin): properties = OrderedDict( file_name=openapi.Schema( type=openapi.TYPE_STRING, ...
code_fim
hard
{ "lang": "python", "repo": "LeeHanYeong/drf-base64-filename", "path": "/src/drf_base64/inspectors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, field, swagger_object_type, use_references, **kwargs ): if issubclass(type(field), NamedBase64FieldMixin): properties = OrderedDict( file_name=openapi.Schema( type=openapi.TYPE_STRING, description=r"Uploaded file...
code_fim
hard
{ "lang": "python", "repo": "LeeHanYeong/drf-base64-filename", "path": "/src/drf_base64/inspectors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LeeHanYeong/drf-base64-filename path: /src/drf_base64/inspectors.py from collections import OrderedDict from drf_yasg import openapi from drf_yasg.inspectors import FieldInspector, NotHandled <|fim_suffix|> def field_to_swagger_object( self, field, swagger_object_type, use_references...
code_fim
hard
{ "lang": "python", "repo": "LeeHanYeong/drf-base64-filename", "path": "/src/drf_base64/inspectors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: radiasoft/sirepo path: /sirepo/srunit.py unt_key", "frameCount"))) assert c, "frame_count_key={} or frameCount={} is zero".format( a.get("frame_count_key"), a.get("frameCount"), ) pkdlog("frameReport={} count={}",...
code_fim
hard
{ "lang": "python", "repo": "radiasoft/sirepo", "path": "/sirepo/srunit.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Returns: object: Parsed JSON result """ op = lambda r: self.post(r, json=data) return self.__req( route_or_uri, params=params, query={}, op=op, raw_response=raw_response, **kwargs, )...
code_fim
hard
{ "lang": "python", "repo": "radiasoft/sirepo", "path": "/sirepo/srunit.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def sr_post(self, route_or_uri, data, params=None, raw_response=False, **kwargs): """Posts JSON data to route_or_uri to server File parameters are posted as:: Args: route_or_uri (str): string name of route or uri if contains '/' (http:// or '/foo') dat...
code_fim
hard
{ "lang": "python", "repo": "radiasoft/sirepo", "path": "/sirepo/srunit.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: universitas/universitas.no path: /django/apps/stories/migrations/0014_auto_20190219_1945.py # Generated by Django 2.1.5 on 2019-02-19 18:45 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( ...
code_fim
hard
{ "lang": "python", "repo": "universitas/universitas.no", "path": "/django/apps/stories/migrations/0014_auto_20190219_1945.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='story', name='comment_field', field=models.CharField( choices=[('facebook', 'facebook'), ('disqus', 'disqus'), ('off', 'off')], default='off', ...
code_fim
hard
{ "lang": "python", "repo": "universitas/universitas.no", "path": "/django/apps/stories/migrations/0014_auto_20190219_1945.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('stories', '0013_auto_20181117_0241'), ] operations = [ migrations.AlterField( model_name='story', name='comment_field', field=models.CharField( choices=[('facebook', 'facebook'), ('disqus', 'disqus'), ...
code_fim
hard
{ "lang": "python", "repo": "universitas/universitas.no", "path": "/django/apps/stories/migrations/0014_auto_20190219_1945.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> kf = KFold(n_splits=n_cv_folds, shuffle=True) cv = kf.split(X) elif dv_type == 'categorical': df_eval = pd.DataFrame(columns=['model', 'eval_type', 'acc', 'auc', 'f1']) skf = StratifiedKFold(n_splits=n_cv_folds, shuffle=True) cv = skf.split(X, y) # Fit to...
code_fim
hard
{ "lang": "python", "repo": "samtashukla/mlToolbox", "path": "/mlToolbox/pandas_helpers.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: samtashukla/mlToolbox path: /mlToolbox/pandas_helpers.py t numpy as np import scipy as sp import pandas as pd print('v5') # Preproc stuff ########################### from sklearn.utils import shuffle from sklearn.preprocessing import PolynomialFeatures, StandardScaler, RobustScaler, Imputer fro...
code_fim
hard
{ "lang": "python", "repo": "samtashukla/mlToolbox", "path": "/mlToolbox/pandas_helpers.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: samtashukla/mlToolbox path: /mlToolbox/pandas_helpers.py sers/stephaniesorenson/anaconda/bin/python import numpy as np import scipy as sp import pandas as pd print('v5') # Preproc stuff ########################### from sklearn.utils import shuffle from sklearn.preprocessing import PolynomialFe...
code_fim
hard
{ "lang": "python", "repo": "samtashukla/mlToolbox", "path": "/mlToolbox/pandas_helpers.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: darthinvader/DnDiscordBot path: /embed_creator.py import discord def dice_roll_embed(dice_amount, dice_types, rolls): embed = discord.Embed(title='Dice Roll', colour=0x000080) total_amount = 0 for da, dt, dr in zip(dice_amount, dice_types, rolls): stringer = '' amoun...
code_fim
medium
{ "lang": "python", "repo": "darthinvader/DnDiscordBot", "path": "/embed_creator.py", "mode": "psm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> embed = discord.Embed(title='Initiative Rolls', colour=0x000000) for i in initiatives: embed.add_field(name=i[0] + ' rolled:', value=str(i[1])) return embed<|fim_prefix|># repo: darthinvader/DnDiscordBot path: /embed_creator.py import discord def dice_roll_embed(dice_amount, dice_ty...
code_fim
hard
{ "lang": "python", "repo": "darthinvader/DnDiscordBot", "path": "/embed_creator.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> return Algorithm(algorithm_type=DecisionTreeRegressor, algorithm_name="DECISION TREE REGRESSOR", hyper_parameter_dict=param_dict, discrete_hyper_parameter_dict=discrete_parameter_dict, discrete_hyper_parameter_mapping=...
code_fim
hard
{ "lang": "python", "repo": "CzakoZoltan08/AutoAI", "path": "/AlgorithmFactories/RegressionAlgorithmFactories/DecisionTreeRegressorAlgorithmFactory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CzakoZoltan08/AutoAI path: /AlgorithmFactories/RegressionAlgorithmFactories/DecisionTreeRegressorAlgorithmFactory.py # -*- coding: utf-8 -*- """ Created on Fri Apr 26 20:00:57 2019 @author: Zoltan """ from collections import OrderedDict from sklearn.tree import DecisionTreeRegressor from ..A...
code_fim
hard
{ "lang": "python", "repo": "CzakoZoltan08/AutoAI", "path": "/AlgorithmFactories/RegressionAlgorithmFactories/DecisionTreeRegressorAlgorithmFactory.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_algorithm(): return Algorithm(algorithm_type=DecisionTreeRegressor, algorithm_name="DECISION TREE REGRESSOR", hyper_parameter_dict=param_dict, discrete_hyper_parameter_dict=discrete_parameter_dict, discrete_hy...
code_fim
hard
{ "lang": "python", "repo": "CzakoZoltan08/AutoAI", "path": "/AlgorithmFactories/RegressionAlgorithmFactories/DecisionTreeRegressorAlgorithmFactory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # fig:gg_mean_link print('fig:gg_mean_link') cp(src(OUT_DIR, GG, "explore", "mean_link.png") , dst(THESIS_DIR, Chap5, GG, "mean_link.png") ) # fig:gg_prior_distrib_summaries print('fig:gg_prior_distrib_summaries') cp(src(OUT_DIR, GGPrior, DA, "DataAugmentation-L4x200-Adam...
code_fim
hard
{ "lang": "python", "repo": "victor-estrade/SystGradDescent", "path": "/update_manuscript.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: victor-estrade/SystGradDescent path: /update_manuscript.py # coding: utf-8 from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import os import shutil import stat OUT_DIR = "/home/estrade/Bureau/Ph...
code_fim
hard
{ "lang": "python", "repo": "victor-estrade/SystGradDescent", "path": "/update_manuscript.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cp(src(OUT_DIR, COMPARE, GGCalib, BEST_MSE, "GG-calib_best_average_N=2000-errplot_mse.png") , dst(THESIS_DIR, Chap5, COMPARE, GGCalib, BEST_MSE, "GG-calib_best_average_N=2000-errplot_mse.png") ) cp(src(OUT_DIR, COMPARE, GGCalib, BEST_MSE, "GG-calib_best_average_N=2000-boxplot_mse.png")...
code_fim
hard
{ "lang": "python", "repo": "victor-estrade/SystGradDescent", "path": "/update_manuscript.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bbbbdragon/python-pype-lang-3 path: /pype3/macros.py from pype3.fargs import embedded_pype,assoc,concat,l,append,dissoc,build_list,build_dict,merge,closure,_,_0,_1,deep_merge,rtrn from pype3.fargs import is_map,is_filter,is_mirror from pype3.helpers import dct_dissoc,dct_assoc,dct_merge,ls_extend...
code_fim
hard
{ "lang": "python", "repo": "bbbbdragon/python-pype-lang-3", "path": "/pype3/macros.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return cl(ifta(is_dict,~_[key])) def cl_app(*fArgs): if not fArgs: return cl([h,x],app(x)) return cl([h,x],app(*fArgs)) def consec(iterable,dct,n): return ep((zip_consec,iterable,n), [(get_call_or_false_core,dct,True,_)], {_}) def consec_dct(i...
code_fim
hard
{ "lang": "python", "repo": "bbbbdragon/python-pype-lang-3", "path": "/pype3/macros.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return fArgs, def ea(*keysAndVal): key=keysAndVal[0] if len(keysAndVal) == 2: val=keysAndVal[1] return a(key,val) return a(key,ep(_[key],ea(*keysAndVal[1:]))) def lm(callableFArg): return (callableFArg,_) def ifa(*fArgs): if len(fArgs) == 1: r...
code_fim
hard
{ "lang": "python", "repo": "bbbbdragon/python-pype-lang-3", "path": "/pype3/macros.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daetsamupm/gestion-it path: /ui/mainui.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'main.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Main(object)...
code_fim
hard
{ "lang": "python", "repo": "daetsamupm/gestion-it", "path": "/ui/mainui.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _translate = QtCore.QCoreApplication.translate Main.setWindowTitle(_translate("Main", "Gestion IT DAETSAM")) self.tableWiFi.setSortingEnabled(True) self.btnAccesos.setText(_translate("Main", "Ver Accesos Autorizados")) self.btnDenegados.setText(_translate("Main", "V...
code_fim
hard
{ "lang": "python", "repo": "daetsamupm/gestion-it", "path": "/ui/mainui.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># __all__ += units.__all__ __all__ += _add_to_astropy_units.__all__ ############################################################################### # END<|fim_prefix|># repo: nstarman/amuse_util path: /amuse_util/units/astropy_units.py # -*- coding: utf-8 -*- # Docstring """Astropy Units. Merge exist...
code_fim
medium
{ "lang": "python", "repo": "nstarman/amuse_util", "path": "/amuse_util/units/astropy_units.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nstarman/amuse_util path: /amuse_util/units/astropy_units.py # -*- coding: utf-8 -*- # Docstring """Astropy Units. Merge existing astropy units with AMUSE-compatible additions. """ __author__ = "Nathaniel Starkman" __credits__ = ["astropy"] __all__ = [] <|fim_suffix|>######################...
code_fim
hard
{ "lang": "python", "repo": "nstarman/amuse_util", "path": "/amuse_util/units/astropy_units.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ############################################################################### # END<|fim_prefix|># repo: nstarman/amuse_util path: /amuse_util/units/astropy_units.py # -*- coding: utf-8 -*- # Docstring """Astropy Units. Merge existing astropy units with AMUSE-compatible additions. """ __author__ =...
code_fim
medium
{ "lang": "python", "repo": "nstarman/amuse_util", "path": "/amuse_util/units/astropy_units.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pavponn/machine-learning path: /labs/svm/smo.py import random from kernels import Kernel, calc_kernel, calculate_kernels class SVMModel(object): def __init__(self, n, c, xs, ys, kernel: Kernel, param): self.alphas = [0] * n self.b = 0 self.c = c self.xs = xs ...
code_fim
hard
{ "lang": "python", "repo": "pavponn/machine-learning", "path": "/labs/svm/smo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def update_alpha(alpha_j, e_i, e_j, y_j: int, nu: float, ll: float, h: float): new_alpha = alpha_j - y_j * (e_i - e_j) / nu return put_alpha_in_range(new_alpha, ll, h) def put_alpha_in_range(alpha_j, ll, h): if alpha_j > h: return h if h >= alpha_j >= ll: return alpha_j ...
code_fim
hard
{ "lang": "python", "repo": "pavponn/machine-learning", "path": "/labs/svm/smo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def build_schedule(lr: float, final_lr: float, n_epochs: int) -> Callable: """ Builds the schedule of which the learning rate decreases. The schedule makes the learning rate decrease linearly. :param lr: initial learning rate. :param final_lr: final learning rate. :param n_epochs:...
code_fim
hard
{ "lang": "python", "repo": "zurk/ml-core", "path": "/sourced/ml/core/algorithms/id_splitter/pipeline.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zurk/ml-core path: /sourced/ml/core/algorithms/id_splitter/pipeline.py from datetime import datetime import logging import os import random from typing import Callable, Iterable, List, Tuple import warnings import keras from keras import backend as kbackend from keras.callbacks import CSVLogger,...
code_fim
hard
{ "lang": "python", "repo": "zurk/ml-core", "path": "/sourced/ml/core/algorithms/id_splitter/pipeline.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: daviddrysdale/python-phonenumbers path: /tools/python/allcheck.py #!/usr/bin/env python import sys import re import glob # Use the local code in preference to any pre-installed version sys.path.insert(0, '../../python') import phonenumbers import phonenumbers.geocoder import phonenumbers.carrie...
code_fim
hard
{ "lang": "python", "repo": "daviddrysdale/python-phonenumbers", "path": "/tools/python/allcheck.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }