text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: MosesSymeonidis/aggregation_builder path: /aggregation_builder/operators/boolean.py def AND(*expressions): """ Evaluates one or more expressions and returns true if all of the expressions are true. See https://docs.mongodb.com/manual/reference/operator/aggregation/and/ for more de...
code_fim
medium
{ "lang": "python", "repo": "MosesSymeonidis/aggregation_builder", "path": "/aggregation_builder/operators/boolean.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Evaluates a boolean and returns the opposite boolean value. See https://docs.mongodb.com/manual/reference/operator/aggregation/not/ for more details :param expression: An array of expressions :return: Aggregation operator """ return {'$not': [expression]}<|fim_prefix|>#...
code_fim
hard
{ "lang": "python", "repo": "MosesSymeonidis/aggregation_builder", "path": "/aggregation_builder/operators/boolean.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KohlbacherLab/diaproteomics path: /bin/select_pseudo_irts_from_lib.py #!/usr/bin/env python from __future__ import print_function import sys import scipy import numpy as np from scipy import stats import pandas as pd import matplotlib.pyplot as plt import glob import argparse """ select_pseudo_...
code_fim
hard
{ "lang": "python", "repo": "KohlbacherLab/diaproteomics", "path": "/bin/select_pseudo_irts_from_lib.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model.add_argument( '-rn', '--max_rt', type=int, help='maximum rt of irts to select for alignment' ) model.add_argument( '-q', '--quantiles', type=bool, help='whether to use only the 1st and 4th RT quantile for irt selection' ) model.ad...
code_fim
hard
{ "lang": "python", "repo": "KohlbacherLab/diaproteomics", "path": "/bin/select_pseudo_irts_from_lib.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nk2028/qieyun-sqlite path: /build.py import os import sqlite3 os.system('curl -LsSo 字頭表.csv https://raw.githubusercontent.com/nk2028/qieyun-data/9849852/%E5%AD%97%E9%A0%AD%E8%A1%A8.csv') os.system('curl -LsSo 小韻表.csv https://raw.githubusercontent.com/nk2028/qieyun-data/9849852/%E5%B0%8F%E9%9F%BB...
code_fim
hard
{ "lang": "python", "repo": "nk2028/qieyun-sqlite", "path": "/build.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>cur.executemany('INSERT INTO 字頭 VALUES (?, ?, ?, ?)', 字頭資料()) # Extra cur.execute(f''' CREATE VIEW '小韻全' AS SELECT 小韻號, 母 || ifnull(呼, '') || CASE 等數字 {等數字SQL} END || ifnull(重紐, '') || 韻 || 聲 AS 音韻描述, 母, 呼, CASE 等數字 {等數字SQL} END AS 等, 重紐, 韻, 聲, CASE {清濁SQL} END AS 清濁, CASE {音SQL} END AS 音, CASE {組SQL} E...
code_fim
hard
{ "lang": "python", "repo": "nk2028/qieyun-sqlite", "path": "/build.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': start_x = -1.9 # x range end_x = 1.9 start_y = -1.1 # y range end_y = 1.1 width = 1200 # image width c = -0.835 - 0.2321 * 1j bg_ratio = (4, 2.5, 1) ratio = (0.9, 0.9, 0.9) step = (end_x - start_x) / width Y, X = np.mgrid[...
code_fim
hard
{ "lang": "python", "repo": "MJPeppersdev/fracture", "path": "/julia.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> step = (end_x - start_x) / width Y, X = np.mgrid[start_y:end_y:step, start_x:end_x:step] Z = X + 1j * Y img = gen_julia(Z, c, bg_ratio, ratio) img.save('julia.png')<|fim_prefix|># repo: MJPeppersdev/fracture path: /julia.py import tensorflow as tf import numpy as np from PIL i...
code_fim
hard
{ "lang": "python", "repo": "MJPeppersdev/fracture", "path": "/julia.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MJPeppersdev/fracture path: /julia.py import tensorflow as tf import numpy as np from PIL import Image R = 4 ITER_NUM = 200 def get_color(bg_ratio, ratio): def color(z, i): if abs(z) < R: return 0, 0, 0 v = np.log2(i + R - np.log2(np.log2(abs(z)))) /...
code_fim
hard
{ "lang": "python", "repo": "MJPeppersdev/fracture", "path": "/julia.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _preprocess_file(file_name): """ reads and preprocesses a file, return the raw content and the content without comments """ raw_content = utils.run_on_main_thread( partial(utils.get_file_content, file_name, force_lf_endings=True)) # replace all comments with spaces to ...
code_fim
hard
{ "lang": "python", "repo": "MPvHarmelen/MarkdownCiteCompletions", "path": "/latextools_utils/analysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MPvHarmelen/MarkdownCiteCompletions path: /latextools_utils/analysis.py import copy import os import re import itertools from functools import partial import traceback import sublime _ST3 = True from . import utils from .cache import LocalCache from ..external.frozendict import frozendict from ...
code_fim
hard
{ "lang": "python", "repo": "MPvHarmelen/MarkdownCiteCompletions", "path": "/latextools_utils/analysis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Decorator: define a function that will never display its help if asked""" func.no_help = True return func def regex(exp): "Decorator: only process the line if it matched with regular expression" def real_decorator(func): @wraps(func) def newfunc(bot, line): ...
code_fim
hard
{ "lang": "python", "repo": "brunobord/cmdbot", "path": "/cmdbot/decorators.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> if string in line.message: return func(bot, line) return newfunc return real_decorator def no_verb(func): """Decorator: define a function that will be executed if no verb is found in the line""" func.no_verb = True return func def no_help(func): ...
code_fim
hard
{ "lang": "python", "repo": "brunobord/cmdbot", "path": "/cmdbot/decorators.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: brunobord/cmdbot path: /cmdbot/decorators.py #-*- coding: utf8 -*- import re from functools import wraps def direct(func): "Decorator: only process the line if it's a direct message" @wraps(func) def newfunc(bot, line): if line.direct: return func(bot, line) ...
code_fim
hard
{ "lang": "python", "repo": "brunobord/cmdbot", "path": "/cmdbot/decorators.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> return state.copy( latest_block_header=BeaconBlockHeader( slot=block.slot, parent_root=block.parent_root, body_root=block.body.hash_tree_root, ), ) def process_randao(state: BeaconState, block: BaseBeaconBlock, ...
code_fim
hard
{ "lang": "python", "repo": "davesque/trinity", "path": "/eth2/beacon/state_machines/forks/serenity/block_processing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return state.copy( randao_mixes=update_tuple_item( state.randao_mixes, randao_mix_index, new_randao_mix, ), ) def process_eth1_data(state: BeaconState, block: BaseBeaconBlock, config: Eth2Config) -> B...
code_fim
hard
{ "lang": "python", "repo": "davesque/trinity", "path": "/eth2/beacon/state_machines/forks/serenity/block_processing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: davesque/trinity path: /eth2/beacon/state_machines/forks/serenity/block_processing.py from eth2._utils.hash import hash_eth2 from eth2._utils.tuple import update_tuple_item from eth2._utils.numeric import ( bitwise_xor, ) from eth2.configs import ( Eth2Config, CommitteeConfig, ) from...
code_fim
hard
{ "lang": "python", "repo": "davesque/trinity", "path": "/eth2/beacon/state_machines/forks/serenity/block_processing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>The official definition of this extension is available here: http://www.opengl.org/registry/specs/EXT/swap_control.txt ''' from OpenGL import platform, constant, arrays from OpenGL import extensions, wrapper import ctypes from OpenGL.raw.WGL import _types, _glgets from OpenGL.raw.WGL.EXT.swap_control impo...
code_fim
hard
{ "lang": "python", "repo": "juso40/bl2sdk_Mods", "path": "/blimgui/dist/OpenGL/WGL/EXT/swap_control.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juso40/bl2sdk_Mods path: /blimgui/dist/OpenGL/WGL/EXT/swap_control.py '''OpenGL extension EXT.swap_control This module customises the behaviour of the OpenGL.raw.WGL.EXT.swap_control to provide a more Python-friendly API <|fim_suffix|>def glInitSwapControlEXT(): '''Return boolean indicati...
code_fim
hard
{ "lang": "python", "repo": "juso40/bl2sdk_Mods", "path": "/blimgui/dist/OpenGL/WGL/EXT/swap_control.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if 'prune' not in tcrrep.hcluster_df.columns: if verbose: print("NO PRUNE COLUMNS USED ALL SET TO 0") tcrrep.hcluster_df['prune'] = 0 print("ITERATE THROUGH CLUSTERS") svgs = list() svgs_raw = list() reference_unique = list() reference_unique_olga= list() r...
code_fim
hard
{ "lang": "python", "repo": "kmayerb/tcrdist3", "path": "/tcrdist/tree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kmayerb/tcrdist3 path: /tcrdist/tree.py r_diff) clone_df : pd.DataFrame [nclones x metadata] Contains metadata for each clone. pwmat : np.ndarray [nclones x nclones] Square distance matrix for defining neighborhoods x_cols : lis...
code_fim
hard
{ "lang": "python", "repo": "kmayerb/tcrdist3", "path": "/tcrdist/tree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kmayerb/tcrdist3 path: /tcrdist/tree.py n in clone_df that specifies counts. Default none assumes count of 1 cell for each row. subset_ind : None or np.ndarray with partial index of df, optional Provides option to tally counts only within a ...
code_fim
hard
{ "lang": "python", "repo": "kmayerb/tcrdist3", "path": "/tcrdist/tree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DavidWhittingham/agsadmin path: /agsadmin/rest_admin/system/Directory.py from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str, ...
code_fim
hard
{ "lang": "python", "repo": "DavidWhittingham/agsadmin", "path": "/agsadmin/rest_admin/system/Directory.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @local_directory_path.setter def local_directory_path(self, value): if self.use_local_directory == False: raise Exception("Cannot edit local directory path when 'use_local_directory' is false.") self._pdata["local_directory_path"] = value @property def max_file...
code_fim
hard
{ "lang": "python", "repo": "DavidWhittingham/agsadmin", "path": "/agsadmin/rest_admin/system/Directory.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return "{0}/system/directories/{1}".format(self._url_base, self.name) def clean(self): send_session_request( self._session, self._create_operation_request( self, operation = "clean", method = "POST") ) ...
code_fim
hard
{ "lang": "python", "repo": "DavidWhittingham/agsadmin", "path": "/agsadmin/rest_admin/system/Directory.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.leftSub = rospy.Subscriber( "/stepper_cmd", Int16MultiArray, self.stepper_callback) #self.pi = pigpio_istance self.pins_config = pins_config self.init_pins() self.l_speed = init_speed self.r_speed = init_speed self.left_dir = bool(0)...
code_fim
medium
{ "lang": "python", "repo": "ahmedokasha000/aio_robot", "path": "/src/stepper_driver_ros_jetson.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahmedokasha000/aio_robot path: /src/stepper_driver_ros_jetson.py #!/usr/bin/env python3 import RPi.GPIO as GPIO import rospy from std_msgs.msg import String from std_msgs.msg import Int16MultiArray import time from math import pi from math import copysign PINS_CONFIG = {"STEP_L": 18, "DIR_L": 4,...
code_fim
hard
{ "lang": "python", "repo": "ahmedokasha000/aio_robot", "path": "/src/stepper_driver_ros_jetson.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NinoDoko/nino_pianino path: /ninopianino/decision_maker.py import random import song_generator #attributes_table is a table with keys that look like this: # 'key': # { # 'related_key' : # [ # { # 'func' : get_key_values, # 'args' : ['s...
code_fim
medium
{ "lang": "python", "repo": "NinoDoko/nino_pianino", "path": "/ninopianino/decision_maker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_table_result(self, attribute_table): r, s = random.random(), 0 for d in table: if type(d['value']) == list: d_value = self.get_table_result(d) else: d_value = d['value'] s += d['prob'] if s >= r: ...
code_fim
hard
{ "lang": "python", "repo": "NinoDoko/nino_pianino", "path": "/ninopianino/decision_maker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r, s = random.random(), 0 for d in table: if type(d['value']) == list: d_value = self.get_table_result(d) else: d_value = d['value'] s += d['prob'] if s >= r: return d_value<|fim_prefix|># rep...
code_fim
hard
{ "lang": "python", "repo": "NinoDoko/nino_pianino", "path": "/ninopianino/decision_maker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: tensor with same shape as input injected with some information about the relative or absolute position of the tokens in the sequence. """ x = x + self.pe[: x.size(0)] return self.dropout(x) def gen_square_subsequent_mas...
code_fim
hard
{ "lang": "python", "repo": "gpauloski/kfac-pytorch", "path": "/examples/language/transformer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gpauloski/kfac-pytorch path: /examples/language/transformer.py """Simple Transformer Model. Based on Attention is All You Need and https://pytorch.org/tutorials/beginner/transformer_tutorial.html. """ from __future__ import annotations import math import torch from torch import nn class Tran...
code_fim
hard
{ "lang": "python", "repo": "gpauloski/kfac-pytorch", "path": "/examples/language/transformer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> position = torch.arange(max_len).unsqueeze(1) div_term = torch.exp( torch.arange(0, d_model, 2) * (-math.log(10000.0) / d_model), ) self.pe: torch.Tensor pe = torch.zeros(max_len, 1, d_model) pe[:, 0, 0::2] = torch.sin(position * div_term) ...
code_fim
hard
{ "lang": "python", "repo": "gpauloski/kfac-pytorch", "path": "/examples/language/transformer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Naavy/CodeBrainers_projekt path: /__init__.py from flask import Flask from playhouse.flask_utils import FlaskDB from flask_admin import Admin from flask_security import ( Security, PeeweeUserDatastore, UserMixin, RoleMixin, login_required ) from .config import Config <|fim_su...
code_fim
medium
{ "lang": "python", "repo": "Naavy/CodeBrainers_projekt", "path": "/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>user_datastore = PeeweeUserDatastore(db_wrapper.database, models.User, models.Role, models.UserRoles) security = Security(app, user_datastore)<|fim_prefix|># repo: Naavy/CodeBrainers_projekt path: /__init__.py from flask import Flask from playhouse.flask_utils import...
code_fim
medium
{ "lang": "python", "repo": "Naavy/CodeBrainers_projekt", "path": "/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def stop(self): self._stop.set() self.thread.join() self._stop.clear() def hasFailed(self): return self._failed.is_set() class _TooMuchWorkException(Exception): ''' Raised when looper's work takes too long to exectute, and looper can't keep up '''<|fim...
code_fim
medium
{ "lang": "python", "repo": "WildOrangutan/RPi-fan-controller", "path": "/src/looper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._stop.set() self.thread.join() self._stop.clear() def hasFailed(self): return self._failed.is_set() class _TooMuchWorkException(Exception): ''' Raised when looper's work takes too long to exectute, and looper can't keep up '''<|fim_prefix|># repo: Wil...
code_fim
hard
{ "lang": "python", "repo": "WildOrangutan/RPi-fan-controller", "path": "/src/looper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WildOrangutan/RPi-fan-controller path: /src/looper.py from typing import Callable from time import time, sleep from queue import Queue from threading import Thread, Event import src.check as check class Looper: def __init__(self, period:float, work:Callable): ''' period - ti...
code_fim
medium
{ "lang": "python", "repo": "WildOrangutan/RPi-fan-controller", "path": "/src/looper.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> test2 = {key: value for key, value in test1.items()} test2['img_prefix'] = test_img_prefix2 test2['ann_file'] = test_ann_file2 # test3 = {key: value for key, value in test1.items()} # test3['img_prefix'] = test_img_prefix3 # test3['ann_file'] = test_ann_file3 # test_list = [test1, test2, test3] test_li...
code_fim
hard
{ "lang": "python", "repo": "Deep-Spark/DeepSparkHub", "path": "/cv/ocr/satrn/pytorch/base/configs/datasets_/Sample_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Deep-Spark/DeepSparkHub path: /cv/ocr/satrn/pytorch/base/configs/datasets_/Sample_test.py test_root = 'data/mixture' # test_img_prefix1 = f'{test_root}/IIIT5K/' test_img_prefix1 = f'{test_root}/icdar_2013/' test_img_prefix2 = f'{test_root}/icdar_2015/' <|fim_suffix|>test1 = dict( type='OCRD...
code_fim
medium
{ "lang": "python", "repo": "Deep-Spark/DeepSparkHub", "path": "/cv/ocr/satrn/pytorch/base/configs/datasets_/Sample_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># test3 = {key: value for key, value in test1.items()} # test3['img_prefix'] = test_img_prefix3 # test3['ann_file'] = test_ann_file3 # test_list = [test1, test2, test3] test_list = [test1, test2]<|fim_prefix|># repo: Deep-Spark/DeepSparkHub path: /cv/ocr/satrn/pytorch/base/configs/datasets_/Sample_test....
code_fim
medium
{ "lang": "python", "repo": "Deep-Spark/DeepSparkHub", "path": "/cv/ocr/satrn/pytorch/base/configs/datasets_/Sample_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicksan2c/diskover path: /diskover/diskover.py = plugin.add_meta(path, d_stat) if extrameta_dict is not None: data.update(extrameta_dict) except (RuntimeWarning, RuntimeError) as e: err_messag...
code_fim
hard
{ "lang": "python", "repo": "nicksan2c/diskover", "path": "/diskover/diskover.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicksan2c/diskover path: /diskover/diskover.py fsize = f_stat.st_size # calculate allocated file size (du size) if IS_WIN: fsize_du = fsize elif options.altscanner: fsize_du =...
code_fim
hard
{ "lang": "python", "repo": "nicksan2c/diskover", "path": "/diskover/diskover.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not exc_empty_files or (exc_empty_files and fsize > 0): if fsize >= minfilesize and \ fmtime_sec > minmtime and \ fmtime_sec < maxmtime and \ fctime_sec > minctime and \ ...
code_fim
hard
{ "lang": "python", "repo": "nicksan2c/diskover", "path": "/diskover/diskover.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jan25/code_sorted path: /leetcode/weekly171/1_no_zero.py ''' https://leetcode.com/contest/weekly-contest-171/problems/convert-integer-to-the-sum-of-two-no-zero-integers/ ''' class Solution: def getNoZeroIntegers(self, n: int) -> List[int]: <|fim_suffix|> return a == 0 or (a % 10 !=...
code_fim
easy
{ "lang": "python", "repo": "jan25/code_sorted", "path": "/leetcode/weekly171/1_no_zero.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> return a == 0 or (a % 10 != 0 and noz(a // 10)) for a in range(1, n + 1): if noz(a) and noz(n - a): return [a, n - a]<|fim_prefix|># repo: jan25/code_sorted path: /leetcode/weekly171/1_no_zero.py ''' https://leetcode.com/contest/weekly-contest-171/...
code_fim
easy
{ "lang": "python", "repo": "jan25/code_sorted", "path": "/leetcode/weekly171/1_no_zero.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> batch_size = 32 best_accuracy = {} for seed in range(n_trials): best_accuracy[seed] = 0.0 for seed in range(n_trials): print('We are currently training on seed:', seed) # for each iteration of the hyperparameter search, return a set of parameters # and feed them into the relevant parts # ...
code_fim
hard
{ "lang": "python", "repo": "bilal841/DNNorDermatologist", "path": "/DataSplit_HpSearch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Define a Callback class that stops training once accuracy reaches 90% #class myCallback(tf.keras.callbacks.Callback): #def on_epoch_end(self, epoch, logs={}): # if(logs.get('acc')>0.87): #print("\nReached 90% accuracy so cancelling training!") #self.model.stop_training = True # make ...
code_fim
hard
{ "lang": "python", "repo": "bilal841/DNNorDermatologist", "path": "/DataSplit_HpSearch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bilal841/DNNorDermatologist path: /DataSplit_HpSearch.py import pandas as pd import numpy as np import os import sys from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix, roc_auc_score from sklearn.utils import class_weight import skopt from keras.a...
code_fim
hard
{ "lang": "python", "repo": "bilal841/DNNorDermatologist", "path": "/DataSplit_HpSearch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yanhuay/seisflows path: /seisflows/seistools/specfem2d.py from seisflows.tools.code import findpath from seisflows.seistools.shared import getpar, setpar ### input file writers def write_sources(par, hdr, path='.', suffix=''): """ Writes source information to text file """ file = ...
code_fim
hard
{ "lang": "python", "repo": "yanhuay/seisflows", "path": "/seisflows/seistools/specfem2d.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # write interfaces file file = 'DATA/interfaces.dat' lines = [] lines.extend('2\n') lines.extend('2\n') lines.extend('%f %f\n'%(par.XMIN, par.ZMIN)) lines.extend('%f %f\n'%(par.XMAX, par.ZMIN)) lines.extend('2\n') lines.extend('%f %f\n'%(par.XMIN, par.ZMAX)) lines.e...
code_fim
hard
{ "lang": "python", "repo": "yanhuay/seisflows", "path": "/seisflows/seistools/specfem2d.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>for region_i in region_list: plot_param=plottingDictionary[region_i]#setup_plot_parameters(region=region_i) fig_hall=plt.figure(figsize=(6,6)) ax_hall = fig_hall.add_subplot(111) v_hall_max=np.max(plot_param['rms_max']) v_hall_min=np.min(plot_param['rms_min']) nbin_hall=int(np.ceil...
code_fim
hard
{ "lang": "python", "repo": "GBTAmmoniaSurvey/DR1_analysis", "path": "/map_rms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data, hd=fits.getdata(file_rms, header=True) fig=plt.figure(figsize=(6,6)) ax = fig.add_subplot(111) # the histogram of the data nbin=int(np.ceil( np.abs(v_max-v_min)/ bin_size)) myarray=data[np.isfinite(data)] weights = n...
code_fim
hard
{ "lang": "python", "repo": "GBTAmmoniaSurvey/DR1_analysis", "path": "/map_rms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GBTAmmoniaSurvey/DR1_analysis path: /map_rms.py import matplotlib.pyplot as plt import astropy.units as u import warnings import numpy as np import os from astropy.io import fits import aplpy from config import plottingDictionary region_list=['L1688', 'B18', 'NGC1333', 'OrionA'] line_list=['NH...
code_fim
hard
{ "lang": "python", "repo": "GBTAmmoniaSurvey/DR1_analysis", "path": "/map_rms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jailukanna/Python-Projects-Dojo path: /05.More Python - Microsoft/07.working_with_files_read.py stream = open('./test.txt',mode='rt') print('\nIs is readable: ' + s<|fim_suffix|>to the end of the file: \n' + str(stream.readlines())) stream.close()<|fim_middle|>tr(stream.readable())) print('\nRead...
code_fim
medium
{ "lang": "python", "repo": "jailukanna/Python-Projects-Dojo", "path": "/05.More Python - Microsoft/07.working_with_files_read.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>to the end of the file: \n' + str(stream.readlines())) stream.close()<|fim_prefix|># repo: jailukanna/Python-Projects-Dojo path: /05.More Python - Microsoft/07.working_with_files_read.py stream = open('./test.txt',mode='rt') print('\nIs is readable: ' + str(stream.readable())) print('\nRead one char: ' +...
code_fim
medium
{ "lang": "python", "repo": "jailukanna/Python-Projects-Dojo", "path": "/05.More Python - Microsoft/07.working_with_files_read.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: idaholab/raven path: /scripts/conversionScripts/toOutStreamsNode.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 # # h...
code_fim
hard
{ "lang": "python", "repo": "idaholab/raven", "path": "/scripts/conversionScripts/toOutStreamsNode.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if stepsNode is not None: for outputNode in stepsNode.iter('Output'): if 'class' in outputNode.attrib and outputNode.attrib['class'] == 'OutStreamManager': outputNode.attrib['class'] = 'OutStreams' return tree if __name__=='__main__': import convert_utils import sys convert_...
code_fim
medium
{ "lang": "python", "repo": "idaholab/raven", "path": "/scripts/conversionScripts/toOutStreamsNode.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: simondaout/PyGdalSAR path: /NSBAS-playground/utils/plot_hist_dphi_r4.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- ############################################ # # PyGdalSAR: An InSAR post-processing package # written in Python-Gdal # ############################################ # Author ...
code_fim
hard
{ "lang": "python", "repo": "simondaout/PyGdalSAR", "path": "/NSBAS-playground/utils/plot_hist_dphi_r4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#f = ax1.lines[0] #xf = f.get_xydata()[:,0] #yf = f.get_xydata()[:,1] #ax1.fill_between(xf, yf, color="dodgerblue", alpha=0.5, where=(xf>(diff_med-1*diff_std)) & (xf<(diff_med+1*diff_std))) def linear_f(x, a, b): return a*x + b interval = 20 ax2.scatter(dem_clean[::interval], diff[::interval], color...
code_fim
hard
{ "lang": "python", "repo": "simondaout/PyGdalSAR", "path": "/NSBAS-playground/utils/plot_hist_dphi_r4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def linear_f(x, a, b): return a*x + b interval = 20 ax2.scatter(dem_clean[::interval], diff[::interval], color='dodgerblue', alpha=0.05, marker = 's', s = 5, edgecolor = 'none',rasterized=True, ) popt, pcov = curve_fit(linear_f, dem_clean, diff) ax2.plot(dem_clean, linear_f(dem_clean...
code_fim
hard
{ "lang": "python", "repo": "simondaout/PyGdalSAR", "path": "/NSBAS-playground/utils/plot_hist_dphi_r4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: din982/Courant-News path: /courant/core/genericadmin/templatetags/genericadmin.py from django import template from django.contrib.contenttypes.models import ContentType <|fim_suffix|> def __init__(self): pass def render(self, context): return_string = "var MODEL_URL_ARRAY = {" fo...
code_fim
medium
{ "lang": "python", "repo": "din982/Courant-News", "path": "/courant/core/genericadmin/templatetags/genericadmin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Syntax:: {% get_generic_relation_list %} """ tokens = token.contents.split() return do_get_generic_objects() register.tag('get_generic_relation_list', get_generic_relation_list)<|fim_prefix|># repo: din982/Courant-News path: /courant/core/genericadmin/templatetags/g...
code_fim
medium
{ "lang": "python", "repo": "din982/Courant-News", "path": "/courant/core/genericadmin/templatetags/genericadmin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ tokens = token.contents.split() return do_get_generic_objects() register.tag('get_generic_relation_list', get_generic_relation_list)<|fim_prefix|># repo: din982/Courant-News path: /courant/core/genericadmin/templatetags/genericadmin.py from django import template from django.contrib...
code_fim
hard
{ "lang": "python", "repo": "din982/Courant-News", "path": "/courant/core/genericadmin/templatetags/genericadmin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> the_template = None self.logger.debug(module, "Jinja template requested: >%s<" % template_name) self.logger.debug(module, "Jinja template directory: >%s<" % template_directory) try: self.jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(templ...
code_fim
hard
{ "lang": "python", "repo": "jacbeekers/excel2json", "path": "/excelform2json/utils/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.jinja_environment = None def get_jinja_template(self, template_directory, template_name): module = __name__ + ".get_jinja_template" if template_name is None: return messages.message["jinja_template_name_not_provided"], None the_template = None ...
code_fim
medium
{ "lang": "python", "repo": "jacbeekers/excel2json", "path": "/excelform2json/utils/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jacbeekers/excel2json path: /excelform2json/utils/helpers.py from lineage_excel2meta_interface.utils import messages, check_schema import logging import jinja2 import json class UtilsHelper: logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) def __init__(self): <|f...
code_fim
hard
{ "lang": "python", "repo": "jacbeekers/excel2json", "path": "/excelform2json/utils/helpers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LaplaceKorea/aboleth path: /tests/test_initialisers.py """Test the initialisation functions.""" import numpy as np import tensorflow as tf import aboleth as ab def test_glorot_std(): result = ab.initialisers._glorot_std(10, 21) assert np.allclose(result, 1. / np.sqrt(3 * 31)) def te...
code_fim
hard
{ "lang": "python", "repo": "LaplaceKorea/aboleth", "path": "/tests/test_initialisers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_initialise_stds(mocker): mocker.patch.dict("aboleth.initialisers._PRIOR_DICT", {"foo": lambda x, y: y + 10 * x}) init_val = "foo" learn_prior = False suffix = "bar" std, std0 = ab.initialisers.initialise_stds(1, 2, init_val, learn_prior, ...
code_fim
hard
{ "lang": "python", "repo": "LaplaceKorea/aboleth", "path": "/tests/test_initialisers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: peterhinch/micropython_eeprom path: /flash/flash_spi.py # flash_spi.py MicroPython driver for SPI NOR flash devices. # Released under the MIT License (MIT). See LICENSE. # Copyright (c) 2019-2020 Peter Hinch import time from micropython import const from bdevice import FlashDevice # Supported ...
code_fim
hard
{ "lang": "python", "repo": "peterhinch/micropython_eeprom", "path": "/flash/flash_spi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mvp = self._mvp for cs in self._cspins: # For each chip mvp[0] = _WREN cs(0) self._spi.write(mvp[:1]) # Enable write cs(1) mvp[0] = _CE cs(0) self._spi.write(mvp[:1]) # Start erase cs(1) ...
code_fim
hard
{ "lang": "python", "repo": "peterhinch/micropython_eeprom", "path": "/flash/flash_spi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for o in model.objects.all(): path = o.get_json_path() assert path assert isinstance(path, str)<|fim_prefix|># repo: nocproject/noc path: /tests/models/test_0009_get_json_path.py # ---------------------------------------------------------------------- # Test .get_json_path() m...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/tests/models/test_0009_get_json_path.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nocproject/noc path: /tests/models/test_0009_get_json_path.py # ---------------------------------------------------------------------- # Test .get_json_path() method # ---------------------------------------------------------------------- # Copyright (C) 2007-2020 The NOC Project # See LICENSE fo...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/tests/models/test_0009_get_json_path.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> UNDERSCORE_RE = re.compile(r''' ^ _{5,} \s* $ ''', re.VERBOSE) ### Paragraph Identification ### def is_reply_lines(lines): reply_lines = 0 empty_lines = 0 for line in lines: if len(line.strip()) == 0: empty_lines += 1 elif line.strip()[0] in ...
code_fim
hard
{ "lang": "python", "repo": "xwyangjshb/recodoc2", "path": "/recodoc2/apps/codeutil/reply_element.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> text = su.merge_lines(lines, False).strip() return (WROTE_RE.match(text) is not None, 1.0) def is_rest_reply(lines): #print('Considering stop: {0}'.format(lines)) is_stop = False for line in lines: line = line.strip() if ORIGIN_RE.match(line) or DASH_RE.match(line) or...
code_fim
hard
{ "lang": "python", "repo": "xwyangjshb/recodoc2", "path": "/recodoc2/apps/codeutil/reply_element.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: xwyangjshb/recodoc2 path: /recodoc2/apps/codeutil/reply_element.py from __future__ import unicode_literals import re import docutil.str_util as su ### CONSTANTS #### REPLY_LANGUAGE = 'r' STOP_LANGUAGE = 's' REPLY_START_CHARACTERS = set(['>']) THRESHOLD_REPLY = 0.40 ### REPLY REGEXES ### WROT...
code_fim
hard
{ "lang": "python", "repo": "xwyangjshb/recodoc2", "path": "/recodoc2/apps/codeutil/reply_element.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return new_im def sem(im, axis=0): # pragma: no cover r""" Simulates an SEM image looking into the porous material. Features are colored according to their depth into the image, so darker features are further away. Parameters ---------- im : array_like ndarray ...
code_fim
hard
{ "lang": "python", "repo": "PMEAL/porespy", "path": "/porespy/visualization/_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def xray(im, axis=0): # pragma: no cover r""" Simulates an X-ray radiograph looking through the porous material. The resulting image is colored according to the amount of attenuation an X-ray would experience, so regions with more solid will appear darker. Parameters ----------...
code_fim
hard
{ "lang": "python", "repo": "PMEAL/porespy", "path": "/porespy/visualization/_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PMEAL/porespy path: /porespy/visualization/_views.py import numpy as np import scipy.ndimage as spim import matplotlib.pyplot as plt # from mpl_toolkits.mplot3d.art3d import Poly3DCollection __all__ = [ 'show_3D', 'show_planes', 'sem', 'xray', ] def show_3D(im): # pragma: no ...
code_fim
hard
{ "lang": "python", "repo": "PMEAL/porespy", "path": "/porespy/visualization/_views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> services["garminconnect"].update({"email": OPTIN, "password": OPTIN, "tokens": NO, "metadata": YES, "data":NO}) services["garminconnect2"].update({"email": OPTIN, "password": OPTIN, "tokens": NO, "metadata": YES, "data":CACHED}) services["strava"].update({"email": NO, "password": NO, "tokens...
code_fim
medium
{ "lang": "python", "repo": "cpfair/tapiriik", "path": "/tapiriik/web/views/privacy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cpfair/tapiriik path: /tapiriik/web/views/privacy.py from django.shortcuts import render from tapiriik.services import Service from tapiriik.settings import WITHDRAWN_SERVICES, SOFT_LAUNCH_SERVICES from tapiriik.auth import User import itertools def privacy(request): OPTIN = "<span ...
code_fim
medium
{ "lang": "python", "repo": "cpfair/tapiriik", "path": "/tapiriik/web/views/privacy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fendaq/Text_Annotation path: /demo.py from Text_Annotation import Data_process, train, annotate import pickle import os DIR = os.path.dirname(os.path.abspath(__file__)) params = { 'num_units': 128, 'num_layers': 2, 'num_tags': 5 } <|fim_suffix|>annotate(model_path=DIR + '/model/', ...
code_fim
hard
{ "lang": "python", "repo": "fendaq/Text_Annotation", "path": "/demo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>train(x=texts_seq, y=target, num_words=data_process.num_words, batchsize=64, epoch=1, max_seq_len=data_process.max_seq_len, **params) annotate(model_path=DIR + '/model/', data_process_path=DIR + '/model/data_process.pkl', **params)<|fim_prefix|># repo...
code_fim
hard
{ "lang": "python", "repo": "fendaq/Text_Annotation", "path": "/demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def config_bfd_on_vsrx( self, src_vm=None, dst_vm=None, target_ip=None, gw_ip=None, lo_ip=None): ''' Pass BFD config to the vSRX ''' cmdList = [] cmdList.extend(('set system arp aging-timer...
code_fim
hard
{ "lang": "python", "repo": "sarath0/tf-test", "path": "/common/maciplearning/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sarath0/tf-test path: /common/maciplearning/base.py from builtins import range import re import time from common.base import GenericTestBase from common.connections import ContrailConnections from common import isolated_creds from vm_test import VMFixture from vn_test import VNFixture from tcutil...
code_fim
hard
{ "lang": "python", "repo": "sarath0/tf-test", "path": "/common/maciplearning/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vshulyak/ts-eval path: /tests/viz/test_data_containers.py import numpy as np import pytest from ts_eval.viz.data_containers import xr_2d_factory, xr_3d_factory from ts_eval.viz.utils import time_align """ xarray format checks """ def test_xr_2d_factory__xarray_fmt(dataset_2d): xarr = xr...
code_fim
medium
{ "lang": "python", "repo": "vshulyak/ts-eval", "path": "/tests/viz/test_data_containers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 3d array => 2d array with pytest.raises(AssertionError): xr_2d_factory(dataset_3d) def test_xr_3d_factory__nan(dataset_3d): dataset_3d = dataset_3d.copy() dataset_3d[:] = np.nan with pytest.raises(AssertionError): xr_3d_factory(dataset_3d) def test_xr_3d_factory_...
code_fim
hard
{ "lang": "python", "repo": "vshulyak/ts-eval", "path": "/tests/viz/test_data_containers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_xr_2d_factory__shape(dataset_3d): # 3d array => 2d array with pytest.raises(AssertionError): xr_2d_factory(dataset_3d) def test_xr_3d_factory__nan(dataset_3d): dataset_3d = dataset_3d.copy() dataset_3d[:] = np.nan with pytest.raises(AssertionError): xr_3d_...
code_fim
hard
{ "lang": "python", "repo": "vshulyak/ts-eval", "path": "/tests/viz/test_data_containers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gen4438/vtk-python-stubs path: /typings/vtkmodules/vtkFiltersSources/vtkOutlineSource.pyi """ This type stub file was generated by pyright. """ import vtkmodules.vtkCommonExecutionModel as __vtkmodules_vtkCommonExecutionModel class vtkOutlineSource(__vtkmodules_vtkCommonExecutionModel.vtkPolyDa...
code_fim
hard
{ "lang": "python", "repo": "gen4438/vtk-python-stubs", "path": "/typings/vtkmodules/vtkFiltersSources/vtkOutlineSource.pyi", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def SetBoxType(self, p_int): """ V.SetBoxType(int) C++: virtual void SetBoxType(int _arg) Set box type to AxisAligned (default) or Oriented. Use the method SetBounds() with AxisAligned mode, and SetCorners() with Oriented mode. """ ...
code_fim
hard
{ "lang": "python", "repo": "gen4438/vtk-python-stubs", "path": "/typings/vtkmodules/vtkFiltersSources/vtkOutlineSource.pyi", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mohit-2007/issue-reporter path: /reporter/migrations/0008_auto_20200910_0950.py # Generated by Django 3.1.1 on 2020-09-10 04:20 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterModelOptions( name='report', options={'orderi...
code_fim
medium
{ "lang": "python", "repo": "Mohit-2007/issue-reporter", "path": "/reporter/migrations/0008_auto_20200910_0950.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('reporter', '0007_vote'), ] operations = [ migrations.AlterModelOptions( name='report', options={'ordering': ['-timestamp']}, ), migrations.AddField( model_name='report', name='cr_line', ...
code_fim
medium
{ "lang": "python", "repo": "Mohit-2007/issue-reporter", "path": "/reporter/migrations/0008_auto_20200910_0950.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: H2020-newTRENDs/FLEX path: /dash_visualization/dash_figures.py ear in years] fig = CountryResultPlots(countries=countries, years=year_list, project_prefix=main.PROJECT_PREFIX).plotly_EU27_shifted_electricity() return html.Div(dcc.Graph(figure=fig), id=ids.EU27_SHIFTED_ELECTRICITY)...
code_fim
hard
{ "lang": "python", "repo": "H2020-newTRENDs/FLEX", "path": "/dash_visualization/dash_figures.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: H2020-newTRENDs/FLEX path: /dash_visualization/dash_figures.py ds.EU27_LOAD_FACTOR_CHART) def EU27_pv_self_consumption(app: Dash) -> html.Div: @app.callback(Output(ids.EU27_PV_SELF_CONSUMPTION, "children"), Input(ids.ALL_COUNTRIES_DROP_DOWN, "value"), Inp...
code_fim
hard
{ "lang": "python", "repo": "H2020-newTRENDs/FLEX", "path": "/dash_visualization/dash_figures.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return html.Div(id=ids.SHARE_HEATING_STORAGE) def share_pv(app: Dash) -> html.Div: @app.callback(Output(ids.SHARE_PV, "children"), Input(ids.COUNTRY_BUILDING_NUMBER_DROP_DOWN, "value")) def update_figure(country: str): big_df = pd.DataFrame() for year in mai...
code_fim
hard
{ "lang": "python", "repo": "H2020-newTRENDs/FLEX", "path": "/dash_visualization/dash_figures.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 判断左右是否靠近墙,取中间部分,然后再判断左右两边是否有blackwall (超过wall_factor比率是墙可以认为靠近墙) img_width = ori_img.shape[1] img_height = ori_img.shape[0] thresh_hold = wall_factor*img_height*img_width/4 up_left_part = ori_img[int(0.20*img_height):int(0.65*img_height), 0:img_width/2, :] up_right_part = or...
code_fim
hard
{ "lang": "python", "repo": "YingshuLu/AI-Formula-Racing", "path": "/auto_drive/rule_drive/TrafficSignType.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YingshuLu/AI-Formula-Racing path: /auto_drive/rule_drive/TrafficSignType.py pixel_count = len(rgwall_nonzero_index) #print black_pixel_count, rg_pixel_count average_x = 0 if black_pixel_count>rg_pixel_count and black_pixel_count>thresh_hold: average_x = blackwall_nonzero_inde...
code_fim
hard
{ "lang": "python", "repo": "YingshuLu/AI-Formula-Racing", "path": "/auto_drive/rule_drive/TrafficSignType.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # first find the region that has at least 120 red pixels # choose the one in the medium if there are three, otherwise, choose the one has largest pixels traffic_sign_img_list = [] largest_pixels_count = 3000 largest_pixels_sign_img = None sign_img_to_check =...
code_fim
hard
{ "lang": "python", "repo": "YingshuLu/AI-Formula-Racing", "path": "/auto_drive/rule_drive/TrafficSignType.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while self.connections: await asyncio.sleep(0.1) async def _run(self): for sock in self.sockets: self.servers.append(await serve( sock=sock, connections=self.connections, **self._server_settings ...
code_fim
hard
{ "lang": "python", "repo": "jeamland/guvnor", "path": "/guvnor/sanic_worker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeamland/guvnor path: /guvnor/sanic_worker.py import os import sys import signal import asyncio import logging try: import ssl except ImportError: ssl = None try: import uvloop asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) except ImportError: pass import gunicorn.w...
code_fim
hard
{ "lang": "python", "repo": "jeamland/guvnor", "path": "/guvnor/sanic_worker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }