text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> ''' cBoundary : 0x0B00 Command code for array reference element begin ''' return self._cARef @property def cReferenceName(self): ''' cReferenceName : 0x1206 Command code for structure name property ''' ret...
code_fim
hard
{ "lang": "python", "repo": "diamond2nv/GDS2tov30", "path": "/GDSII_ARef.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: diamond2nv/GDS2tov30 path: /GDSII_ARef.py X: ' , self.nX print 'nY: ' , self.nY print 'xRot: ' , self.xRot print 'yRot: ' , self.yRot print 'reflection: ' , self.reflection print 'mag: ...
code_fim
hard
{ "lang": "python", "repo": "diamond2nv/GDS2tov30", "path": "/GDSII_ARef.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> smali_file = os.path.join(INPUT_DIR, 'Example.smali') classes2_dex = os.path.join(tmp_dir, 'classes2.dex') self._assemble_smali(classes2_dex, smali_file) zip_file = os.path.join(tmp_dir, 'example.apk') self._create_zip_file(zip_file, [classes_de...
code_fim
hard
{ "lang": "python", "repo": "batyrf/platform_development", "path": "/vndk/tools/definition-tool/tests/test_dex_file.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_generate_classes_dex_names(self): seq = DexFileReader.generate_classes_dex_names() self.assertEqual('classes.dex', next(seq)) self.assertEqual('classes2.dex', next(seq)) self.assertEqual('classes3.dex', next(seq)) def test_enumerate_dex_strings_buf(self)...
code_fim
hard
{ "lang": "python", "repo": "batyrf/platform_development", "path": "/vndk/tools/definition-tool/tests/test_dex_file.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: batyrf/platform_development path: /vndk/tools/definition-tool/tests/test_dex_file.py #!/usr/bin/env python3 from __future__ import print_function import os import subprocess import unittest import zipfile from vndk_definition_tool import DexFileReader, UnicodeSurrogateDecodeError from .compat...
code_fim
hard
{ "lang": "python", "repo": "batyrf/platform_development", "path": "/vndk/tools/definition-tool/tests/test_dex_file.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(sys.argv) == 4: messages_filepath, categories_filepath, database_filepath = sys.argv[1:] print( "Loading data...\n MESSAGES: {}\n CATEGORIES: {}".format( messages_filepath, categories_filepath ) ) df = load_data(mes...
code_fim
hard
{ "lang": "python", "repo": "domsieb/disaster_response_pipeline", "path": "/data/process_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return df_clean def save_data(df, database_filename): """Load cleaned data frame into an SQL database Args: df: cleaned pandas dataframe provided by database_filename: Path to sql database into which the dataframe is stored. Returns: None """ engine = cr...
code_fim
hard
{ "lang": "python", "repo": "domsieb/disaster_response_pipeline", "path": "/data/process_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: domsieb/disaster_response_pipeline path: /data/process_data.py import sys import pandas as pd from sqlalchemy import create_engine def load_data(messages_filepath, categories_filepath): """Load messages and categories into pandas dataframe Args: messages_filepath: A csv file co...
code_fim
hard
{ "lang": "python", "repo": "domsieb/disaster_response_pipeline", "path": "/data/process_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># List beiwe data types def get_beiwe_types(read_dir, beiwe_ids): beiwe_data_types = set() for i in beiwe_ids: if i[0] != '.': read_path = os.path.join(read_dir, i) types = os.listdir(read_path) for t in types: if t[0] != '.': ...
code_fim
hard
{ "lang": "python", "repo": "AMP-SCZ/logbook", "path": "/logbook/phone/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AMP-SCZ/logbook path: /logbook/phone/__init__.py import os import logging from importlib import import_module import pandas as pd from logbook import tools logger = logging.getLogger(__name__) def process(data_type, study, subject, read_dir, date_from, output_tz, input_tz, day_from, da...
code_fim
hard
{ "lang": "python", "repo": "AMP-SCZ/logbook", "path": "/logbook/phone/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lnsongxf/skillmodels path: /skillmodels/tests/pre_processing/model_spec_processor_test.py from itertools import cycle from unittest.mock import Mock import numpy as np import pandas as pd from nose.tools import assert_equal from nose.tools import assert_raises from pandas import DataFrame from p...
code_fim
hard
{ "lang": "python", "repo": "lnsongxf/skillmodels", "path": "/skillmodels/tests/pre_processing/model_spec_processor_test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.data.loc[2, "c2"] = np.nan ModelSpecProcessor._clean_controls_specification(self) res = (("c1",), ("c1", "c2")) assert_equal(self.controls, res) def test_clean_control_specs_missing_observation_drop_observation(self): self.data.loc[2, "c2"] = np.nan ...
code_fim
hard
{ "lang": "python", "repo": "lnsongxf/skillmodels", "path": "/skillmodels/tests/pre_processing/model_spec_processor_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> infile = os.path.join(qinittargetpath,'topo_landslide_subset.tt3') outfile = os.path.join(qinittargetpath,'topo_landslide_subset_less1meter.tt3') lower_DEM(infile,outfile,1.00) infile = os.path.join(qinittargetpath,'topo_river_surface_subset_200cm.tt3') outfile = os.path.join(qinitta...
code_fim
hard
{ "lang": "python", "repo": "kbarnhart/dclaw-apps", "path": "/GoldBasin/goldbasin_riverflow_2020Feb/setinit.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kbarnhart/dclaw-apps path: /GoldBasin/goldbasin_riverflow_2020Feb/setinit.py """ setinit: this routine creates local directories and sets softlinks for the topo and q-init DEMs used by setrun.py this requires that you have an environment variable $TOPO set, and topography files in $TOPO for the...
code_fim
hard
{ "lang": "python", "repo": "kbarnhart/dclaw-apps", "path": "/GoldBasin/goldbasin_riverflow_2020Feb/setinit.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def ClearField(self, field_name: typing_extensions.Literal["end", b"end", "filename", b"filename", "start", b"start"]) -> None: ... global___Range = Range @typing_extensions.final class Diagnostic(google.protobuf.message.Message): """Diagnostic represents information to be presented to a user ab...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi", "path": "/sdk/python/lib/pulumi/runtime/proto/codegen/hcl_pb2.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi path: /sdk/python/lib/pulumi/runtime/proto/codegen/hcl_pb2.pyi """ @generated by mypy-protobuf. Do not edit manually! isort:skip_file Copyright 2016-2023, Pulumi Corporation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compli...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi", "path": "/sdk/python/lib/pulumi/runtime/proto/codegen/hcl_pb2.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jinbooooom/coding-for-algorithms path: /剑指offer/10-fibonacci数列/jumpFloor2.py # -*- coding:utf-8 -*- """ 题目: 一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。 求该青蛙跳上一个n级的台阶总共有多少种跳法。 """ class Solution: <|fim_suffix|> for i in range(3, number + 1): f.append(sum(f) + 1) # f[i] = f[0]...
code_fim
hard
{ "lang": "python", "repo": "jinbooooom/coding-for-algorithms", "path": "/剑指offer/10-fibonacci数列/jumpFloor2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> f = [0, 1, 2] if number in f: # 当 number 处于闭区间 [0, 2]时,恰有f[number] = number return number for i in range(3, number + 1): f.append(sum(f) + 1) # f[i] = f[0] + f[1] + ... + f[i-1] + 1 = sum(f) + 1 # 加 1 是因为青蛙可以一次跳 i 级台阶。 retur...
code_fim
hard
{ "lang": "python", "repo": "jinbooooom/coding-for-algorithms", "path": "/剑指offer/10-fibonacci数列/jumpFloor2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Create internet gateway route Args: config (dict): Vpcs config """ for vpc_id, vpc_config in config.iteritems(): for route in vpc_config["RouteTables"]: resource = self.ec2.RouteTable(route["RouteTableId"]) for rou...
code_fim
hard
{ "lang": "python", "repo": "davidlonjon/aws-proxies", "path": "/aws_proxies/route_tables.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidlonjon/aws-proxies path: /aws_proxies/route_tables.py # -*- coding: utf-8 -*- from base_resources import BaseResources import logging from utils import setup_logger, filter_resources, tag_with_name_with_suffix class RouteTables(BaseResources): """Route Tables representation """ ...
code_fim
hard
{ "lang": "python", "repo": "davidlonjon/aws-proxies", "path": "/aws_proxies/route_tables.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Associate subnets to routes Args: config (dict): Vpcs config """ for vpc_id, vpc_config in config.iteritems(): for route in vpc_config["RouteTables"]: route_resource = self.ec2.RouteTable(route["RouteTableId"]) fo...
code_fim
hard
{ "lang": "python", "repo": "davidlonjon/aws-proxies", "path": "/aws_proxies/route_tables.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: prophile/cronoplug path: /cronoplug/plugin.py import zipfile import io import yaml import json def from_fs(base_path): def get(filename): full_path = "{}/{}".format(base_path, filename) return open(full_path, 'rb') return get class Plugin: def __init__(self, stream, ...
code_fim
medium
{ "lang": "python", "repo": "prophile/cronoplug", "path": "/cronoplug/plugin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def import_file(self, name): content = self._src(name) if content is None: raise KeyError("No file {}".format(name)) self.add_file(name, self._src(name)) def import_from_manifest(self): manifest_src = self._src('manifest.yaml') if manifest_src i...
code_fim
hard
{ "lang": "python", "repo": "prophile/cronoplug", "path": "/cronoplug/plugin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kssteven418/Q-ASR path: /nemo/collections/tts/models/base.py # Copyright (c) 2020, NVIDIA CORPORATION. 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 the Licens...
code_fim
hard
{ "lang": "python", "repo": "kssteven418/Q-ASR", "path": "/nemo/collections/tts/models/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def update_bias_spect(self): self.check_children_attributes() # Ensure self.n_mel and self.stft are defined with self.nemo_infer(): spect = torch.zeros((1, self.n_mel, 88)).to(self.device) bias_audio = self.convert_spectrogram_to_audio(spec=spect, sigma=0.0, d...
code_fim
hard
{ "lang": "python", "repo": "kssteven418/Q-ASR", "path": "/nemo/collections/tts/models/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Vocoder(ModelPT, ABC): """ Base class for all TTS models that generate audio conditioned a on spectrogram """ @abstractmethod def convert_spectrogram_to_audio(self, spec: 'torch.tensor', **kwargs) -> 'torch.tensor': """ Accepts a batch of spectrograms and returns a batc...
code_fim
hard
{ "lang": "python", "repo": "kssteven418/Q-ASR", "path": "/nemo/collections/tts/models/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#segs = "HA MP NA NP NS PA PB1 PB2".split() s = argv[5] #segs: #fastas = glob(getcwd()+'/'+s+'/v'+argv[2]+'/*fasta') fasta = argv[4] #fastas: samp = ''.join(fasta.split('/')[-1].split('.')[0:-1]) #.replace('_','/') #blastDB = blastDBroot+s+'/v-1_1/'+s blastDB = argv[3] try: blastResults = check_output([...
code_fim
hard
{ "lang": "python", "repo": "CDCgov/Mia_publication", "path": "/scripts/blast2sqlite_refs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CDCgov/Mia_publication path: /scripts/blast2sqlite_refs.py #!/usr/bin/python from glob import glob from os import getcwd from os.path import isdir from sys import argv, exit import sqlite3 as sq3 from subprocess import check_output, CalledProcessError <|fim_suffix|>s = argv[5] #segs: #fastas = ...
code_fim
hard
{ "lang": "python", "repo": "CDCgov/Mia_publication", "path": "/scripts/blast2sqlite_refs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>try: numReads = argv[1] except IndexError: print usage exit() root = '/'.join(argv[0].split('/')[:-2]) blastn = root+'/lib/ncbi-blast-2.7.1+/bin/blastn' #blastDBroot = root+'/lib/ncbi-blast-2.7.1+/BlastDB/' MIAdb = root+'/db/MIA.db' db = sq3.connect(MIAdb) dbc = db.cursor() runID = argv[2] #segs = "H...
code_fim
hard
{ "lang": "python", "repo": "CDCgov/Mia_publication", "path": "/scripts/blast2sqlite_refs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sukantadas194/Prime_Numbers path: /Finds_&_Counts_Prime-Numbers_in_a_Range_PYTHON.py #Find the Prime Numbers in a given range with total count. #(so basically prime number is a number which is only divisible by '1' & itself) #examples : 2, 3, 5, 7, 11, 13,... <|fim_suffix|> except: ...
code_fim
hard
{ "lang": "python", "repo": "sukantadas194/Prime_Numbers", "path": "/Finds_&_Counts_Prime-Numbers_in_a_Range_PYTHON.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print("\nTotal no. of Prime Numbers: ", count_Prime_nums(ip)) except: #If there's an error, without giving a Traceback it prints a message #and also restarts the programme by itself using Recursion. print("Wrong Input") print("Start again..") err...
code_fim
hard
{ "lang": "python", "repo": "sukantadas194/Prime_Numbers", "path": "/Finds_&_Counts_Prime-Numbers_in_a_Range_PYTHON.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: novopl/restible path: /src/test/restible/util/test_update_from_values.py # -*- coding: utf-8 -*- # pylint: disable=missing-docstring from __future__ import absolute_import, unicode_literals # 3rd party imports import pytest # local imports from restible import util class User(object): def...
code_fim
hard
{ "lang": "python", "repo": "novopl/restible", "path": "/src/test/restible/util/test_update_from_values.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_raises_AttributeError_if_cant_set_attribute(): user = StaticUser() with pytest.raises(AttributeError): util.update_from_values(user, {'new_attr': 'hello'})<|fim_prefix|># repo: novopl/restible path: /src/test/restible/util/test_update_from_values.py # -*- coding: utf-8 -*- # pyl...
code_fim
hard
{ "lang": "python", "repo": "novopl/restible", "path": "/src/test/restible/util/test_update_from_values.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if occlusion_sensitivity_button: data = ([face], None) explainer = OcclusionSensitivity() sensitivity_occlusion_grid = explainer.explain(data, model, predicted_class, patch_size_value) st.image(sensitivity_occlusion_grid) file_ = open("SocialAI.gif", "rb") cont...
code_fim
hard
{ "lang": "python", "repo": "AdityaTeltia/Vihaan-Covid-Project", "path": "/streamlit-based-mask-detecting-UI/st_face_mask_detector_expl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AdityaTeltia/Vihaan-Covid-Project path: /streamlit-based-mask-detecting-UI/st_face_mask_detector_expl.py import streamlit as st from tensorflow.keras.applications.mobilenet_v2 import preprocess_input from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.models import...
code_fim
hard
{ "lang": "python", "repo": "AdityaTeltia/Vihaan-Covid-Project", "path": "/streamlit-based-mask-detecting-UI/st_face_mask_detector_expl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> predicted_class = 0 label = "No Mask" if mask > withoutMask: label = "Mask" predicted_class = 1 color = (0, 255, 0) if label == "Mask" else (0, 0, 255) label = "{}: {:.2f}%".format(label, max(mask, withoutMask) * ...
code_fim
hard
{ "lang": "python", "repo": "AdityaTeltia/Vihaan-Covid-Project", "path": "/streamlit-based-mask-detecting-UI/st_face_mask_detector_expl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xenserver/guest-templates path: /json-templates/constants.py kib = 1024 mib = 1024 * kib gib = 1024 * mib <|fim_suffix|> Running = "Running" Halted = "Halted"<|fim_middle|>pv_bootloader = "pygrub" hvm_boot_policy = "BIOS order" hvm_boot_params = {"order": "cdn"} # Values of memory parame...
code_fim
hard
{ "lang": "python", "repo": "xenserver/guest-templates", "path": "/json-templates/constants.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Running = "Running" Halted = "Halted"<|fim_prefix|># repo: xenserver/guest-templates path: /json-templates/constants.py kib = 1024 mib = 1024 * kib gib = 1024 * mib pv_bootloader = "pygrub" hvm_boot_policy = "BIOS order" hvm_boot_params = {"order": "cdn"} <|fim_middle|># Values of memory parame...
code_fim
hard
{ "lang": "python", "repo": "xenserver/guest-templates", "path": "/json-templates/constants.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> params = { "udf": process['arguments']['udf'], "runtime": process['arguments']['runtime'], "output_folder": os.path.join(root_folder, process_id) } return params<|fim_prefix|># repo: eodcgmbh/eodc-openeo-bindings path: /src/eodc_openeo_bindings/map_udf.py import o...
code_fim
easy
{ "lang": "python", "repo": "eodcgmbh/eodc-openeo-bindings", "path": "/src/eodc_openeo_bindings/map_udf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eodcgmbh/eodc-openeo-bindings path: /src/eodc_openeo_bindings/map_udf.py import os def map_udf(process, root_folder, process_id): <|fim_suffix|> params = { "udf": process['arguments']['udf'], "runtime": process['arguments']['runtime'], "output_folder": os.path.join(ro...
code_fim
easy
{ "lang": "python", "repo": "eodcgmbh/eodc-openeo-bindings", "path": "/src/eodc_openeo_bindings/map_udf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trimitri/fbg_util path: /decorators.py """Some function decorators.""" from typing import Any, Callable <|fim_suffix|> Inside the decorated function, the variable can be accessed like `funcname.foovar`. """ def decorator(function): setattr(function, variable_name, initial...
code_fim
medium
{ "lang": "python", "repo": "trimitri/fbg_util", "path": "/decorators.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> setattr(function, variable_name, initial_value) return function return decorator<|fim_prefix|># repo: trimitri/fbg_util path: /decorators.py """Some function decorators.""" from typing import Any, Callable def static_variable(variable_name: str, initial_value: A...
code_fim
medium
{ "lang": "python", "repo": "trimitri/fbg_util", "path": "/decorators.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ommaury/specular-manifold-sampling path: /results/Figure_19_GlintsComparison/render_shoes.py import os, sys from subprocess import PIPE, run import numpy as np try: os.mkdir('results_shoes') except: pass def run_cmd(command, name): result = run(command, stdout=PIPE, stderr=PIPE, uni...
code_fim
hard
{ "lang": "python", "repo": "ommaury/specular-manifold-sampling", "path": "/results/Figure_19_GlintsComparison/render_shoes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if sys.argv[1] == "sms_bv": name = "sms_bv_time_{}".format(i) cmd = "mitsuba " cmd += "shoes_sms.xml " cmd += "-o results_shoes/{}.exr ".format(name) cmd += "-Dspp=999999999 " cmd += "-Dsamples_per_pass=1 " cmd += "-Dtimeout={} ".format(t) ...
code_fim
hard
{ "lang": "python", "repo": "ommaury/specular-manifold-sampling", "path": "/results/Figure_19_GlintsComparison/render_shoes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if sys.argv[1] == "sms_b": name = "sms_b_time_{}".format(i) cmd = "mitsuba " cmd += "shoes_sms.xml " cmd += "-o results_shoes/{}.exr ".format(name) cmd += "-Dspp=999999999 " cmd += "-Dsamples_per_pass=1 " cmd += "-Dtimeout={} ".format(t) ...
code_fim
hard
{ "lang": "python", "repo": "ommaury/specular-manifold-sampling", "path": "/results/Figure_19_GlintsComparison/render_shoes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rpiga/Runestone path: /thinkcspy/ch08/Excercise 12 - ex_7_20.py import image def smooth(image_in): image_new = image.EmptyImage(image_in.getWidth(), image_in.getHeight()) search = 9 for w in range(0, image_in.getWidth()): w_range = range(w - 1...
code_fim
hard
{ "lang": "python", "repo": "rpiga/Runestone", "path": "/thinkcspy/ch08/Excercise 12 - ex_7_20.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> img = image.Image("luther.jpg") width = img.getWidth() height = img.getHeight() win = image.ImageWin(width, height) img.draw(win) img_new = smooth(img) win2 = image.ImageWin(width, height) img_new.draw(win2)<|fim_prefix|># repo: rpiga/Runestone path: /thinkcspy/ch08/Excercise 12 - ex_7_20.py import im...
code_fim
hard
{ "lang": "python", "repo": "rpiga/Runestone", "path": "/thinkcspy/ch08/Excercise 12 - ex_7_20.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.config.dbtype.lower() == "mysql": create_temp_tbl_sql = f"CREATE TABLE {temp_tbl_name} LIKE {type};" elif self.config.dbtype.lower() == "sqlite": create_temp_tbl_sql = f"CREATE TABLE {temp_tbl_name} AS SELECT * FROM {type} WHERE 0" self.engine.execut...
code_fim
hard
{ "lang": "python", "repo": "FlxVctr/RADICES", "path": "/database_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FlxVctr/RADICES path: /database_handler.py import sqlite3 as lite import uuid from sqlite3 import Error import pandas as pd from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError from setup import Config class DataBaseHandler(): def __init__(self, config_path: st...
code_fim
hard
{ "lang": "python", "repo": "FlxVctr/RADICES", "path": "/database_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Table creation for SQLITE database type. # Note and TODO: the collector does not support sqlite (yet) if self.config.dbtype.lower() == "sqlite": try: self.engine = lite.connect(self.config.dbname + ".db") print("Connected to " + self.co...
code_fim
hard
{ "lang": "python", "repo": "FlxVctr/RADICES", "path": "/database_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DuarteNuno/RuuviSensor path: /__main__.py import os import math from config import * from ruuvitag_sensor.ruuvi import RuuviTagSensor from influxdb import InfluxDBClient """ start influxdb """ def config_influxdb(): client=InfluxDBClient (host=HOST,port=PORT) client.switch_database(DB) ...
code_fim
hard
{ "lang": "python", "repo": "DuarteNuno/RuuviSensor", "path": "/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for tag in sensors: deviation_t += math.pow(tag[1]["temperature"] - avg_t,2) deviation_h += math.pow(tag[1]["humidity"] - avg_h,2) deviation_p += math.pow(tag[1]["pressure"] - avg_p,2) json_deviation=[ { "measurement": "Deviation", ...
code_fim
hard
{ "lang": "python", "repo": "DuarteNuno/RuuviSensor", "path": "/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: konsan1101/pycv5 path: /vision_api_google.py #!/usr/bin/env python # -*- coding: utf-8 -*- # COPYRIGHT (C) 2014-2020 Mitsuo KONDOU. # This software is released under the MIT License. # https://github.com/konsan1101 # Thank you for keeping the rules. import sys import os import tim...
code_fim
hard
{ "lang": "python", "repo": "konsan1101/pycv5", "path": "/vision_api_google.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': #googleAPI = google_api.VisionAPI() googleAPI = VisionAPI() res1 = googleAPI.authenticate('cv' , google_key.getkey('cv' ,'url'), google_key.getkey('cv' ,'key'), ) res2 = googleAPI.authenticate(...
code_fim
hard
{ "lang": "python", "repo": "konsan1101/pycv5", "path": "/vision_api_google.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> binary_search=True, epsilon=0.3, stepsize=0.06, iterations=10, decay_factor=1.0, beta1 = 0.4, beta2 = 0.4, correction = 0.00001, random_start=False, ...
code_fim
hard
{ "lang": "python", "repo": "IsCoelacanth/NeurIPS-2018-Adversarial-Vision-Challenge-Targeted-Attack", "path": "/smiterative2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IsCoelacanth/NeurIPS-2018-Adversarial-Vision-Challenge-Targeted-Attack path: /smiterative2.py ds() s = max_ - min_ clipped = np.clip(perturbation, -epsilon * s, epsilon * s) return clipped class L1ClippingMixin(object): def _clip_perturbation(self, a, perturbation, e...
code_fim
hard
{ "lang": "python", "repo": "IsCoelacanth/NeurIPS-2018-Adversarial-Vision-Challenge-Targeted-Attack", "path": "/smiterative2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IsCoelacanth/NeurIPS-2018-Adversarial-Vision-Challenge-Targeted-Attack path: /smiterative2.py gradient = gradient / np.mean(np.abs(gradient)) min_, max_ = a.bounds() gradient = (max_ - min_) * gradient return gradient class L2GradientMixin(object): def _gradien...
code_fim
hard
{ "lang": "python", "repo": "IsCoelacanth/NeurIPS-2018-Adversarial-Vision-Challenge-Targeted-Attack", "path": "/smiterative2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juliencombarel/crawlers path: /tests/functional/spiders/afpy.py # -*- coding: utf-8 -*- import os import unittest import yaml from pyjobs_crawlers.spiders.afpy import AfpyJobSpider from pyjobs_crawlers.test import SpiderTest test_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), ...
code_fim
hard
{ "lang": "python", "repo": "juliencombarel/crawlers", "path": "/tests/functional/spiders/afpy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> items = self._get_result_html_file(items=items, html_file='jobs_add_1.html') self.assertEqual(len(items), 1, "1 jobs must be found in jobs.html, %d found" % len(items)) self._result_contains_jobs(items, expected_jobs_titles=[ u"Développeur Python/C Confirmé (H/F)", ...
code_fim
hard
{ "lang": "python", "repo": "juliencombarel/crawlers", "path": "/tests/functional/spiders/afpy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ax1.plot(dates, Av1[-SP:], '#e1edf9', label=Label1, linewidth=1.) ax1.plot(dates, Av2[-SP:], '#4ee6fd', label=Label2, linewidth=1.) ax1.grid(True, color='w') ax1.xaxis.set_major_locator(mticker.MaxNLocator(10)) ax1.xaxis.set_major_formatter(mdates.DateFormatter('%Y...
code_fim
hard
{ "lang": "python", "repo": "rosslly/quanttesting", "path": "/userFunc/chCounts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rosslly/quanttesting path: /userFunc/chCounts.py # -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: chCount Description : 缠中说禅均线强度 Author : pchaos date: 2019/6/21 ------------------------------------------------- Change Activ...
code_fim
hard
{ "lang": "python", "repo": "rosslly/quanttesting", "path": "/userFunc/chCounts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: griseau/sample-apps path: /vespa-cloud/cord-19-search/scripts/add-embeddings.py #!/usr/bin/env python3 # Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. <|fim_suffix|>DATA_FILE = sys.argv[1] EMBEDDINGS = sys.argv[2] embeddings = pand...
code_fim
medium
{ "lang": "python", "repo": "griseau/sample-apps", "path": "/vespa-cloud/cord-19-search/scripts/add-embeddings.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> DATA_FILE = sys.argv[1] EMBEDDINGS = sys.argv[2] embeddings = pandas.read_csv(EMBEDDINGS) docs = [] with open(DATA_FILE, 'r') as f: for doc in json.load(f): id = doc['id'] row = embeddings[embeddings.id == id] if not row.empty: title_embedding = eval(row.iloc[0]['title_embedding']...
code_fim
medium
{ "lang": "python", "repo": "griseau/sample-apps", "path": "/vespa-cloud/cord-19-search/scripts/add-embeddings.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: onaio/tasking path: /tasking/viewsets/projects.py """ Project viewsets """ from django_filters.rest_framework import DjangoFilterBackend from rest_framework import filters, mixins, viewsets from rest_framework.permissions import IsAuthenticated from tasking.models import Project from tasking.ser...
code_fim
hard
{ "lang": "python", "repo": "onaio/tasking", "path": "/tasking/viewsets/projects.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> viewsets.GenericViewSet, mixins.UpdateModelMixin, mixins.CreateModelMixin, mixins.ListModelMixin, mixins.DestroyModelMixin, mixins.RetrieveModelMixin, ): """ Viewset for projects """ serializer_class = ProjectSerializer permission_classes = [IsAuthenticated] ...
code_fim
medium
{ "lang": "python", "repo": "onaio/tasking", "path": "/tasking/viewsets/projects.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(): """ Main function for this module """ sandbox = create_sandbox() directory = download_package_to_sandbox( sandbox, 'https://pypi.python.org/packages/source/c/checkmyreqs/checkmyreqs-0.1.6.tar.gz' ) print(directory) destroy_sandbox(sandbox) if _...
code_fim
hard
{ "lang": "python", "repo": "DieterWilliam/healthy-2", "path": "/package_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DieterWilliam/healthy-2 path: /package_utils.py #! /usr/bin/env python # coding=utf-8 """ Utilities for fetching and unpacking packages from pypi """ import os import shutil import tarfile import tempfile import requests def create_sandbox(name='healthybox'): """ Create a temporary san...
code_fim
hard
{ "lang": "python", "repo": "DieterWilliam/healthy-2", "path": "/package_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with tarfile.open('package.tar.gz', 'r:gz') as tf: tf.extractall() directory = [d for d in os.listdir(sandbox) if os.path.isdir(d)][0] return os.path.join(sandbox, directory) def destroy_sandbox(sandbox): """ Destroys a temporary sandbox directory :param sandbox: name o...
code_fim
medium
{ "lang": "python", "repo": "DieterWilliam/healthy-2", "path": "/package_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># for else for i in range(10): continue print(i) else: print("End")<|fim_prefix|># repo: 21-guns/algo path: /practice/Python3/control_flow/interruption.py # break i = 7 f7 = 1 while True: f7 *= i i -= 1 if i == 1: break <|fim_middle|># continue for i in range(10): co...
code_fim
easy
{ "lang": "python", "repo": "21-guns/algo", "path": "/practice/Python3/control_flow/interruption.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 21-guns/algo path: /practice/Python3/control_flow/interruption.py # break i = 7 f7 = 1 while True: f7 *= i i -= 1 if i == 1: break <|fim_suffix|># for else for i in range(10): continue print(i) else: print("End")<|fim_middle|># continue for i in range(10): co...
code_fim
easy
{ "lang": "python", "repo": "21-guns/algo", "path": "/practice/Python3/control_flow/interruption.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self not in self._instances: self._instances[self] = super( Singleton, self).__call__(*args, **kwargs) return self._instances[self]<|fim_prefix|># repo: cdalvaro/machine-learning-notebooks path: /notebooks/strips/cdalvaro/singleton.py class Singleton(type): ...
code_fim
easy
{ "lang": "python", "repo": "cdalvaro/machine-learning-notebooks", "path": "/notebooks/strips/cdalvaro/singleton.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cdalvaro/machine-learning-notebooks path: /notebooks/strips/cdalvaro/singleton.py class Singleton(type): """ Metaclase para implementar el patrón de diseño Singleton https://stackoverflow.com/a/6798042/3398062 """ _instances = dict() <|fim_suffix|> if self not in self....
code_fim
easy
{ "lang": "python", "repo": "cdalvaro/machine-learning-notebooks", "path": "/notebooks/strips/cdalvaro/singleton.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def compare_many(src, compare_dir, clusters, match_data): result = open("result.txt", "w") image = cv2.imread(src) km1, calibrate = kmeans(image, clusters) detector = ColourDetector(colors=km1) filenames = glob.glob(compare_dir) filenames.sort() for filename in filenames: ...
code_fim
hard
{ "lang": "python", "repo": "spditner/cardvision", "path": "/kmeans.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spditner/cardvision path: /kmeans.py import glob import sys from collections import OrderedDict from sklearn.cluster import KMeans import matplotlib.pyplot as plt import argparse import utils import cv2 # from ShapeDetector import ShapeDetector from ColourDetector import ColourDetector # const...
code_fim
hard
{ "lang": "python", "repo": "spditner/cardvision", "path": "/kmeans.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if match_data[filename] == same_colour: print("TRUE") else: print("FALSE: Expected %s for %s, Found: %s" % ( match_data[filename], filename, same_colour, )) # plot_bar( # km1.keys(...
code_fim
hard
{ "lang": "python", "repo": "spditner/cardvision", "path": "/kmeans.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(cells) == 6: cell1 = cells[0].find(text=True) cell2 = cells[1].find(text=True) cell3 = cells[2].find(text=True) cell4 = cells[3].find(text=True) cell5 = cells[4].find(text=True) cell6 = cells[5].find(text=True) if file_name[-3:] is 'csv': result = ...
code_fim
hard
{ "lang": "python", "repo": "carolinp/table-scraper", "path": "/TableScraperEdit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: carolinp/table-scraper path: /TableScraperEdit.py #Imports the libraries we'll be using. Make sure you have these installed #first by typing import into python and seeing if it does anything from bs4 import BeautifulSoup import urllib2 #These are the editable variables in the scraper. The user d...
code_fim
hard
{ "lang": "python", "repo": "carolinp/table-scraper", "path": "/TableScraperEdit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: susumuota/PyLIS path: /gym-foodhunting/gym_foodhunting/foodhunting/gym_foodhunting_ma.py # -*- coding: utf-8 -*- # Copyright 2019 Susumu OTA # # 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 c...
code_fim
hard
{ "lang": "python", "repo": "susumuota/PyLIS", "path": "/gym-foodhunting/gym_foodhunting/foodhunting/gym_foodhunting_ma.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> GRAVITY = -10.0 BULLET_STEPS = 120 # p.setTimeStep(1.0 / 240.0), so 1 gym step == 0.5 sec. def __init__(self, render=False, robot_model=R2D2, max_steps=500, num_agents=1, num_foods=1): """Initialize environment. """ ### gym variables self.observation_space = ro...
code_fim
hard
{ "lang": "python", "repo": "susumuota/PyLIS", "path": "/gym-foodhunting/gym_foodhunting/foodhunting/gym_foodhunting_ma.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_shaves.py #calss header class _SHAVES(): def __init__(self,): self.name = "SHAVES" self.definitions = shave <|fim_suffix|> self.basic = ['shave']<|fim_middle|> self.parents = [] self.childen = [] self.properties = [] self.jsonda...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_shaves.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.name = "SHAVES" self.definitions = shave self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['shave']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_shaves.py #calss header class _SHAVES(): <|fim_middle|> def __init__(...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_shaves.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def register_node(self, address): ''' Add a new node to the set of nodes :param address: <str> HTTP Address of the node :return None ''' parsed_url = urlparse(address) self.nodes.add(parsed_url.netloc)<|fim_prefix|># repo: kiran94/b...
code_fim
medium
{ "lang": "python", "repo": "kiran94/blockchain-tutorial", "path": "/src/nodes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kiran94/blockchain-tutorial path: /src/nodes.py ''' Module contains logic to interact with nodes. ''' from urllib.request import urlparse <|fim_suffix|> def register_node(self, address): ''' Add a new node to the set of nodes :param address: <str> HTTP A...
code_fim
medium
{ "lang": "python", "repo": "kiran94/blockchain-tutorial", "path": "/src/nodes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param address: <str> HTTP Address of the node :return None ''' parsed_url = urlparse(address) self.nodes.add(parsed_url.netloc)<|fim_prefix|># repo: kiran94/blockchain-tutorial path: /src/nodes.py ''' Module contains logic to interact with nodes. ''' ...
code_fim
medium
{ "lang": "python", "repo": "kiran94/blockchain-tutorial", "path": "/src/nodes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>parser = argparse.ArgumentParser() parser.add_argument("--index", type=str, action='store', required=True) parser.add_argument("--config-path", type=str, action='store', default='../config.json') parser.add_argument("--n-shards", type=int, action='store', default=5) parser.add_argument("--no-cat", type=st...
code_fim
medium
{ "lang": "python", "repo": "xbrlware/ernest", "path": "/helpers/add-cat-mappings.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>client.indices.create(index=config[args.index]['index'], body={ "settings" : { "number_of_shards" : args.n_shards, "number_of_replicas" : 1 }, "mappings" : { config[args.index]['_type'] : dynamic_templates } })<|fim_prefix|># repo: xbrlware/ernest path: /helpers...
code_fim
hard
{ "lang": "python", "repo": "xbrlware/ernest", "path": "/helpers/add-cat-mappings.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xbrlware/ernest path: /helpers/add-cat-mappings.py ''' Create an index with `.cat` mappings index: name of index to set mapping (references config file) config-path: path to config file n-shards: number of primary shards no-cat: comma separated list of fields to omit `.ca...
code_fim
hard
{ "lang": "python", "repo": "xbrlware/ernest", "path": "/helpers/add-cat-mappings.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>img = Image.fromarray(data2) img.show() filter1 = np.array([[1,0,-1],[1,0,-1],[1,0,-1]]) filter2 = np.array([[1,1,1],[0,0,0],[-1,-1,-1]]) data3 = convolve2d(data2, filter1, 'valid') img2 = Image.fromarray(data3) img2.show() data4 = convolve2d(data2, filter2, 'valid') img3 = Image.fromarray(data4) img3....
code_fim
hard
{ "lang": "python", "repo": "connycode89/Scratchy", "path": "/convolution.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: connycode89/Scratchy path: /convolution.py # -*- coding: utf-8 -*- """ Created on Fri Jan 12 10:56:06 2018 @author: cdonovan """ # convolution <|fim_suffix|>img = Image.fromarray(data2) img.show() filter1 = np.array([[1,0,-1],[1,0,-1],[1,0,-1]]) filter2 = np.array([[1,1,1],[0,0,0],[-1,-1,-1]]...
code_fim
hard
{ "lang": "python", "repo": "connycode89/Scratchy", "path": "/convolution.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>data4 = convolve2d(data2, filter2, 'valid') img3 = Image.fromarray(data4) img3.show()<|fim_prefix|># repo: connycode89/Scratchy path: /convolution.py # -*- coding: utf-8 -*- """ Created on Fri Jan 12 10:56:06 2018 @author: cdonovan """ <|fim_middle|># convolution from scipy.misc import imread from sci...
code_fim
hard
{ "lang": "python", "repo": "connycode89/Scratchy", "path": "/convolution.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dorucioclea/posthog path: /ee/clickhouse/test/test_system_status.py from posthog.clickhouse.system_status import system_status def test_system_status(db): results = list(system_status()) assert [row["key"] for row in results] == [ "cli<|fim_suffix|> "dead_letter_queue_event...
code_fim
hard
{ "lang": "python", "repo": "dorucioclea/posthog", "path": "/ee/clickhouse/test/test_system_status.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> "dead_letter_queue_events_last_day", "dead_letter_queue_ratio_ok", ] assert len(results[6]["subrows"]["rows"]) > 0 assert len(results[7]["subrows"]["rows"]) > 0<|fim_prefix|># repo: dorucioclea/posthog path: /ee/clickhouse/test/test_system_status.py from posthog.clickhouse.syste...
code_fim
medium
{ "lang": "python", "repo": "dorucioclea/posthog", "path": "/ee/clickhouse/test/test_system_status.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhishekgrewal/reliability path: /reliability/Fitters.py def P_P_plot(self): # probability-probability plot of parametric vs non-parametric # plot each of the results if max(self.failures) <= 1: cols = 6 # this is for when the beta distribution was fitted ...
code_fim
hard
{ "lang": "python", "repo": "abhishekgrewal/reliability", "path": "/reliability/Fitters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhishekgrewal/reliability path: /reliability/Fitters.py ist_params=self) def logf(t, mu, sigma): # Log PDF (Lognormal) return anp.log(anp.exp(-0.5 * (((anp.log(t) - mu) / sigma) ** 2)) / (t * sigma * (2 * anp.pi) ** 0.5)) def logR(t, mu, sigma): # Log SF (Lognormal) r...
code_fim
hard
{ "lang": "python", "repo": "abhishekgrewal/reliability", "path": "/reliability/Fitters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> plt.subplot(2, cols, 1) xlim = max(np.hstack([self._nonparametric_CDF, self._parametric_CDF_Exponential_1P])) plt.scatter(self._nonparametric_CDF, self._parametric_CDF_Exponential_1P, marker='.', color='k') plt.plot([0, xlim], [0, xlim], 'r', alpha=0.7) plt.axis('sq...
code_fim
hard
{ "lang": "python", "repo": "abhishekgrewal/reliability", "path": "/reliability/Fitters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nr = len(grid) nc = len(grid[0]) no_of_islands = 0 for r in range(nr): for c in range(nc): if(grid[r][c]=="1"): no_of_islands += 1 self.dfs(grid, r, c, nr, nc) return no_of...
code_fim
hard
{ "lang": "python", "repo": "pillieshwar/coding_concepts", "path": "/DP/islands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pillieshwar/coding_concepts path: /DP/islands.py class Solution: def dfs(self, grid, r, c, nr, nc): if(r<0 or c<0 or r>=nr or c>=nc or grid[r][c]=="0"): return 0 grid[r][c]="0" self.dfs(grid,r-1,c, nr, nc) self.dfs(grid,r+1,c, nr, ...
code_fim
hard
{ "lang": "python", "repo": "pillieshwar/coding_concepts", "path": "/DP/islands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: noblige/depgraph path: /depgraph/depgraph.py import os import itertools class Reason(object): """ A Reason describes why a build step is performed. Parameters ---------- explanation : str """ def __init__(self, explanation): self._explanation = explanation ...
code_fim
hard
{ "lang": "python", "repo": "noblige/depgraph", "path": "/depgraph/depgraph.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- dataset : Dataset Returns ------- bool """ def visit(dataset, temp_marks, perm_marks): if dataset in temp_marks: raise CircularDependency() if dataset not in perm_marks: temp_marks.append(dataset) fo...
code_fim
hard
{ "lang": "python", "repo": "noblige/depgraph", "path": "/depgraph/depgraph.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> paths = [] if not root: return paths stack = [(root, [str(root.val)])] while stack: node, path = stack.pop() # leaf node if not node.left and not node.right: paths.append("->".join(path)) cont...
code_fim
hard
{ "lang": "python", "repo": "aimdarx/data-structures-and-algorithms", "path": "/solutions/Trees and Graphs/Binary Trees/binary_tree_paths.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }