id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3338726
<reponame>vedaldi/dynamic-video-depth import os import torch.multiprocessing as mp from .scripts.preprocess.universal import preprocess from . import train import numpy as np from skimage.transform import resize as imresize gaps = [1, 2, 4, 6, 8] def load_index(out_dir): index_path = os.path.join(out_dir, "prepr...
StarcoderdataPython
41265
<filename>package/niflow/ants/brainextraction/__init__.py<gh_stars>0 from .__about__ import __version__ from .workflows.brainextraction import init_brain_extraction_wf
StarcoderdataPython
3295876
# -*- coding: utf-8 -*- """Top-level package for YooKassa API Python Client Library.""" from yookassa.configuration import Configuration from yookassa.payment import Payment from yookassa.receipt import Receipt from yookassa.refund import Refund from yookassa.settings import Settings from yookassa.webhook import Webho...
StarcoderdataPython
1719316
import os from pathlib import Path import cv2, imutils import time import numpy as np import pyshine as ps import argparse import subprocess from skimage.metrics import structural_similarity as compare_ssim from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QFileDialog from PyQt5.QtGui im...
StarcoderdataPython
14413
<filename>django-openstack/django_openstack/syspanel/views/instances.py # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2011 Fourth Paradigm Development...
StarcoderdataPython
3357626
#!flask/bin/python from app import app import os app.run(host=os.getenv('IP', '0.0.0.0'),port=int(os.getenv('PORT', 8080)),debug=True)
StarcoderdataPython
1718550
@jit def fast_auc(y_true, y_prob): y_true = np.asarray(y_true) y_true = y_true[np.argsort(y_prob)] nfalse = 0 auc = 0 n = len(y_true) for i in range(n): y_i = y_true[i] nfalse += (1 - y_i) auc += y_i * nfalse auc /= (nfalse * (n - nfalse)) return auc def eval_auc...
StarcoderdataPython
1696231
Huffman ( [a1,f1],[a2 ,f2],…,[an,fn]) if n=1 then code[a1] ← else let fi,fj be the 2 smallest f’ s Huffman ( [ai,fi+fj],[a1,f1],…,[an,fn] ) omits ai,aj code[aj] ← code[ai] + “0” code[ai] ← code[ai] + “1”
StarcoderdataPython
1660426
<reponame>aaditep/aadioptimize<gh_stars>0 import numpy.matlib as mat import numpy as np N =1 def initDE(N_p,lb,ub,prob): """ Initializes paramaters for differential evolution Paramaters ---------- N_p : int Number of population lb : int lower bound of searchspace ub :...
StarcoderdataPython
3217065
# In this program we take CSVs that are prepared with a search name - either a Fund name / ISIN / Stock ticker # and use that to search either Investing.com (InvestPy) or Yahoo Finance (with pandas URL) to get historical # price data. Then we plot graphs using matplotlib, and present these in PDF using ReportLab. impor...
StarcoderdataPython
33665
import kfserving from typing import List, Union import numpy as np class Predictor(): # pylint:disable=too-few-public-methods def __init__(self, clf: kfserving.KFModel): self.clf = clf def predict_fn(self, arr: Union[np.ndarray, List]) -> np.ndarray: instances = [] for req_data in arr...
StarcoderdataPython
3283597
# General name = "COVIDNext50_NewData" gpu = False batch_size = 64 n_threads = 20 random_seed = 1337 # Model # Model weights path # weights = "./experiments/ckpts/<model.pth>" weights = './experiments/COVIDNext50_NewData_F1_92.98_step_10800.pth' # Optimizer lr = 1e-4 weight_decay = 1e-3 lr_reduce_factor = 0.7 lr_red...
StarcoderdataPython
1781459
import pytest # pytest_addoption 可以让用户注册一个自定义的命令行参数,方便用户将数据传递给 pytest def pytest_addoption(parser): parser.addoption( "--cmdopt", action="store", default="None", type=list,# 类型可以int,str,float,list 等类型,如果不指定类型的话,pytest会把接受到的参数值都默认为 str 类型 # choices= ['python', 'java', 'c++'],# ...
StarcoderdataPython
3281440
<reponame>soraros/nutils import functools, numpy, operator from nutils.testing import TestCase from nutils import expression_v2, function, mesh, sample class SerializedOps: def from_int(self, v): return '{}i'.format(v) def from_float(self, v): return '{}f'.format(v) def scope(self, array): return 'scope({})'.fo...
StarcoderdataPython
3224928
<gh_stars>1-10 #!python from more_or_less import PageOfHeight from more_or_less.fixed_size_screen import FixedSizeScreen from more_or_less.input import Input from more_or_less.more_page_builder import MorePageBuilder from more_or_less.output import Output from more_or_less.page_builder import StopOutput from more_or_le...
StarcoderdataPython
86266
<filename>clickhouse_manager/config.py<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- class Config(object): config = None def __init__(self, config): self.config = config def __str__(self): return str(self.config) def __getitem__(self, item): return self.conf...
StarcoderdataPython
109022
import openturns as ot class UBoolean: """ Wrapper class of ot.Bernoulli to enable boolean operator """ def __init__(self, confidence=ot.Bernoulli()): self.confidence = confidence def __str__(self): return "UBoolean(" + str(self.confidence.getP()) + ")" def __and__(self, oth...
StarcoderdataPython
29028
# encoding: utf-8 """ @author: BrikerMan @contact: <EMAIL> @blog: https://eliyar.biz @version: 1.0 @license: Apache Licence @file: test.py.py @time: 2019-01-25 14:43 """ import unittest from tests import * from kashgari.utils.logger import init_logger init_logger() if __name__ == '__main__': unittest.main()
StarcoderdataPython
1762275
<reponame>MarlonRF/tcc_files # - Título: # Parser XML Lattes # - Descrição: # Converte dados dos XML, baixados dos currículos Lattes, em DataFrames Pandas. # Parte do trabalho de conclusão de curso de Bacharelado em Matemática Aplicada e Computaicional do IME/USP. # - Autor: # <NAME> # - Orient...
StarcoderdataPython
3344104
from db import modles def register(name,password): obj=modles.Student.get_obj_by_name(name) if obj: return False,'student name has exist' else: modles.Student(name,password) return True,'register successfully!' def choose_school(name,type): obj=modles.Student.get_obj_by_name(ty...
StarcoderdataPython
1630334
from setuptools import setup setup(name='sukima', version='0.1', description='A framework for GPT generation utilities for providing a basic API.', url='https://github.com/harubaru/sukima', author='<NAME>', license='BSD2', packages=['sukima'])
StarcoderdataPython
1671909
<reponame>rickavmaniac/masonite from ..app import App from ..request import Request from ..response import Response class ResponseMiddleware: def __init__(self, request: Request, app: App, response: Response): self.request = request self.app = app self.response = response def after(se...
StarcoderdataPython
125622
<gh_stars>10-100 from git_gopher.CommandInterface import CommandInterface from git_gopher.NoTagsException import NoTagsException from git_gopher.HistoryCommandRunner import HistoryCommandRunner from git_gopher.GitDataGetter import GitDataGetter class CheckoutTag(CommandInterface): def __init__(self, hist_command_r...
StarcoderdataPython
3210558
<filename>appengine_module/gae_ts_mon/test/shared_test.py # Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest import gae_ts_mon from infra_libs.ts_mon import shared from testing_utils import ...
StarcoderdataPython
62630
import os from os import path from eiffel_loop.scons.c_library import LIBRARY_INFO from eiffel_loop.package import TAR_GZ_SOFTWARE_PACKAGE from eiffel_loop.package import SOFTWARE_PATCH info = LIBRARY_INFO ('source/id3.getlib') print 'is_list', isinstance (info.configure [0], list) print 'url', info.url print inf...
StarcoderdataPython
155302
<filename>tests/test_refresh_token.py from django.contrib.auth import get_user_model from django.utils import timezone from .testCases import RelayTestCase, DefaultTestCase from graphql_auth.constants import Messages class RefreshTokenTestCaseMixin: def setUp(self): self.user = self.register_user( ...
StarcoderdataPython
1620350
<reponame>ejguan/data<gh_stars>0 # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import io import os import unittest import warnings import expecttest import...
StarcoderdataPython
3215199
import os, sys import SiEPIC try: import siepic_tools except: pass # import xml before lumapi (SiEPIC.lumerical), otherwise XML doesn't work: from xml.etree import cElementTree import math from SiEPIC.utils import arc, arc_xy, arc_wg, arc_to_waveguide, points_per_circle import pya from SiEPIC.utils import get_te...
StarcoderdataPython
184247
from django.conf.urls import url from . import views from django.conf.urls import url, include app_name = 'Article' urlpatterns = [ url (r'^create/',views.CreateArticle,name="CreateArticle"), url (r'^home/',views.home ,name="Home"), url (r'^(?P<pk>[0-9]+)/addLike/',views.AddLike ,name="AddLike"), url (...
StarcoderdataPython
1684975
<filename>adminmgr/media/code/A3/task2/BD_135_703_2371_6tOSZiH.py import findspark findspark.init() from pyspark import SparkConf,SparkContext from pyspark.streaming import StreamingContext from pyspark.sql import Row,SQLContext import sys import requests def func(rdd): sorted_rdd = rdd.sortBy(lambda x: (-x[1],x...
StarcoderdataPython
1778538
import io import re from urllib.parse import urlparse import requests from fair_test import FairTest, FairTestEvaluation class MetricTest(FairTest): metric_path = 'i2-fair-vocabularies-resolve' applies_to_principle = 'I2' title = 'Metadata uses resolvable FAIR Vocabularies' description = """Maturity ...
StarcoderdataPython
1634000
#!/usr/bin/env python # A logFileParser class to parse VistA FileMan Schema log files and generate # the FileMan Schema and dependencies among packages. #--------------------------------------------------------------------------- # Copyright 2012 The Open Source Electronic Health Record Agent # # Licensed under the Ap...
StarcoderdataPython
1687220
# -*- coding: utf-8 -*- # Copyright 2015-2016 Yelp # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
StarcoderdataPython
119861
# Copyright (c) 2017, MD2K Center of Excellence # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditio...
StarcoderdataPython
3211085
<reponame>Howardhuang98/Blog #!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : 6051.py @Contact : <EMAIL> @Modify Time : 2022/4/30 22:31 ------------ """ from typing import List class Solution: def countUnguarded(self, m: int, n: int, guards: List[List[int]], walls: List[List[int]]...
StarcoderdataPython
1622380
from wcloud import app, db if __name__ == '__main__': app.run(debug=app.config['DEBUG'])
StarcoderdataPython
5481
import os class StressedNetConfig: def __init__(self, synaptic_environmental_constraint=0.8, group_environmental_constraint=0.6, stress_factor=0.8, save_folder=os.path.expanduser("~/.nervous/models/")): self._synaptic_environmental_const...
StarcoderdataPython
1762952
<filename>RocketStaging.py from scipy import * from RocketParameters import * from Reference import * import sys ################################################################################ # ROCKET STAGING ################################################################################ def rocket_mass(g0, f_ine...
StarcoderdataPython
1716177
# Test file in Python style # sync-start:content_after_start __examples__/content_after_start/a.js # sync-start:content_after_start __examples__/content_after_start/c.js code = 1 # sync-end:content_after_start
StarcoderdataPython
3210358
import configparser import logging import os import time import json import requests import pygame from logging.handlers import RotatingFileHandler from datetime import datetime import sys config = configparser.ConfigParser() config.read('config.ini') auth_key = config['general'].get('auth_key') device_uid = config['...
StarcoderdataPython
144229
# -*- coding: utf-8 -*- import pytest import barbacoa @pytest.fixture def hub(): return barbacoa.hub
StarcoderdataPython
1707167
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from mo.front.common.partial_infer.multi_box_prior import multi_box_prior_infer_mxnet from mo.utils.graph import Node from mo.utils.ir_reader.extender import Extender class PriorBox_extender(Extender): op = 'PriorBox' @staticm...
StarcoderdataPython
3263120
<reponame>lukaspestalozzi/Master_Semester_Project import unittest from tichu.utils import crange class OtherTest(unittest.TestCase): def test_init(self): def trick_ends_iterative(curr, leading, next_): # assert curr != leading for k in crange(curr, curr, 4): if k =...
StarcoderdataPython
3360619
<reponame>ace-ecosystem/ace2-modules<filename>tests/core_modules/conftest.py # vim: ts=4:sw=4:et:cc=120 import pytest from ace.system.database import DatabaseACESystem from ace.system.threaded import ThreadedACESystem class TestSystem(DatabaseACESystem, ThreadedACESystem): pass @pytest.fixture async def syste...
StarcoderdataPython
173190
<gh_stars>1-10 ''' Module that contains UI objects such as text, buttons and levers ''' import pygame ''' The interface classes below are general classes for UI and text. The classes are often used as parent classes for more specialized UI classes, for example classes with some aesthethic decoration...
StarcoderdataPython
3383776
from collections import OrderedDict from .metrics import format_metric_name, format_labels from .utils import merge_dicts_ordered def count_object_fields(object_mappings, counts=None): if counts is None: counts = {} else: counts = counts.copy() for field, mapping in object_mappings['prop...
StarcoderdataPython
3284783
import logging from pathlib import Path from openpyxl import load_workbook from .. import utils from ..cache import Cache __authors__ = ["zstumgoren", "Dilcia19", "ydoc5212"] __tags__ = ["historical", "excel"] logger = logging.getLogger(__name__) def scrape( data_dir: Path = utils.WARN_DATA_DIR...
StarcoderdataPython
1754124
<reponame>ruidacosta/SP500HistoryData import sqlite3 filename = 'SP&500.csv' conn = sqlite3.connect(':memory:') tickers = [] def readInstruments(): first = True with open(filename,'r') as fd: for line in fd: if not first: tickers.append(str(line.replace('\r','').replace('\n','').split(';')[0])) else: ...
StarcoderdataPython
3230649
import cv2 import numpy as np from copy import deepcopy from registry import Registries from .base_strategy import BaseStrategy @Registries.strategy.register("group") class GroupStrategy(BaseStrategy): def __init__(self, score: object, **kwargs): super().__init__(score, **kwargs) def get_datas(self...
StarcoderdataPython
190387
# Copyright (C) 2020 GreenWaves Technologies, SAS # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This progr...
StarcoderdataPython
3259280
import asyncio from unittest import mock from aioresponses import aioresponses from django.core import mail from django.urls import reverse from freezegun import freeze_time from model_bakery import baker from glitchtip.test_utils.test_case import GlitchTipTestCase from organizations_ext.models import OrganizationUse...
StarcoderdataPython
3244977
# -*- coding: utf-8 -*- """ Copyright [2009-2021] EMBL-European Bioinformatics Institute 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 http://www.apache.org/licenses/LICENSE-2.0 Unless required by...
StarcoderdataPython
95878
# -*- coding: utf-8 -*- # Copyright 2018 IBM. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
StarcoderdataPython
3264628
import functools import os, sys import time import cv2 import numpy as np import pickle sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) import tensorflow as tf import tensorflow.contrib.slim as slim from sklearn import mixture from sklearn.metrics.cluster import normalized_mutual_info_score from scip...
StarcoderdataPython
3278165
_base_ = [ '../_base_/models/deeplabv3plus_r50-d8.py', '../_base_/datasets/flood.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py' ] img_scale = (640, 640) crop_size = (480, 480) train_pipeline = [ dict(type='LoadImageFromFile_flood'), dict(type='LoadAnnotations_flood'), di...
StarcoderdataPython
3342934
from test_junkie.rules import Rules class BadAfterTestRules(Rules): def after_test(self, **kwargs): raise Exception("Expected")
StarcoderdataPython
4833111
<reponame>ahmobayen/image_processing<filename>BackEnd/model/process/deep_learning.py from model.joint.in_app_parameters import FRAME_PARAMETERS, ALGORITHM_PARAMETERS, TRACKER_PARAMETERS from model.joint.static_paths import path, TRAINING_PATH from model.widespread.db_connection import SqlDatabaseConnection from model....
StarcoderdataPython
121579
<gh_stars>0 import os from abc import ABC import torch import core.utils as utils from torch.optim import lr_scheduler class BaseInpaint(torch.nn.Module, ABC): def __init__(self, hy): super(BaseInpaint, self).__init__() ###################### # init parameter ##################...
StarcoderdataPython
179125
<gh_stars>1-10 import argparse import numpy from readers.read_blast import BlastReader arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--test', '-t', help='Caminho para arquivo BLAST de teste', required=True) arg_parser.add_argument('--ref', '-r', ...
StarcoderdataPython
4832833
from curator import api as curator from mock import patch, Mock from . import CuratorTestCase class TestAlias(CuratorTestCase): def test_add_to_alias_positive(self): alias = 'testalias' self.create_index('dummy') self.client.indices.put_alias(index='dummy', name=alias) self.create...
StarcoderdataPython
1600780
from ramda.find_last import find_last from ramda.private.asserts import assert_equal def positive(x): return x > 0 def find_last_nocurry_test(): assert_equal(find_last(positive, [-2, -1, 0, 1, 2, -2]), 2) def find_last_curry_test(): assert_equal(find_last(positive)([-2, -1, 0, 1, 2, -1, -2]), 2) def...
StarcoderdataPython
23550
class Samples: def __init__(self): #COMMANDS self.PP = ('Für [https://osu.ppy.sh/b/{} {} [{}]{}] (OD {}, AR {}, ' 'CS {}, {}★, {}:{}) wirst du {} {}') self.PP_FOR = ('| {}pp bekommen für {}% ') self.PP_PRED = ('Für [https://osu.ppy.sh/b/{} {} [{}]{}] (OD {},...
StarcoderdataPython
17914
<reponame>ltxwanzl/ainnovation_dcim # default_app_config = '.apps.WorkflowConfig'
StarcoderdataPython
1769936
import numpy as np import pandas as pd from sklearn.base import BaseEstimator from sklearn.utils.validation import ( check_X_y, check_array, check_is_fitted, check_random_state, ) from bpr_numba import fit_bpr from utils import ( create_user_map_table, create_item_map_table, create_user_map...
StarcoderdataPython
11076
import FWCore.ParameterSet.Config as cms from SimMuon.GEMDigitizer.muonGEMDigis_cfi import * from SimMuon.GEMDigitizer.muonGEMPadDigis_cfi import * from SimMuon.GEMDigitizer.muonGEMPadDigiClusters_cfi import * muonGEMDigiTask = cms.Task(simMuonGEMDigis, simMuonGEMPadDigis, simMuonGEMPadDigiClusters) muonGEMDigi = cms...
StarcoderdataPython
1622624
from bs4 import BeautifulSoup import requests import os class App: def __init__(self): self.userlist = [] self.headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"} self.page = 1 ...
StarcoderdataPython
3237363
<gh_stars>0 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import logging import os import shutil import ssl import sys import tempfile import threading import zipfile from contextlib import contextm...
StarcoderdataPython
199495
"""Unit test for cleanup - cleanup node apps """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import glob import os import shutil import tempfile import unittest import mock import treadmill import treadmill.runt...
StarcoderdataPython
135031
<gh_stars>1-10 from chaos_genius.controllers.config_controller import get_config_object def get_creds(name): return HELPER_FUNC_DICT[name](name) def get_email_creds(name): config_obj = get_config_object(name) if config_obj is None: return "", "", "", "", "" configs = config_obj.as_dict.get(...
StarcoderdataPython
3361663
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : EXP # ----------------------------------------------- import random import string from datetime import timedelta import erb.yml as yaml import os PRJ_DIR = os.path.dirname(os.path.abspath(__file__)) CHARSET = 'utf-8' SETTINGS_PATH = '%s/conf/settings.yml' % PRJ...
StarcoderdataPython
3313074
<reponame>THEMVFFINMAN/Self-Coding-Books import zipfile, sys, os from threading import Thread def validateFile(fileName): if not os.path.isfile(fileName): print '[-] ' + fileName + ' does not exist.' exit(0) if not os.access(fileName, os.R_OK): print '[-] ' + fileName + ' access denied.' exit(0) def valida...
StarcoderdataPython
1691222
# coding=utf-8 # Copyright 2021 The Deeplab2 Authors. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
StarcoderdataPython
129767
<filename>funboost/utils/dependency_packages/mongomq/utils.py def enum(name, *sequential, **named): values = dict(zip(sequential, range(len(sequential))), **named) # NOTE: Yes, we *really* want to cast using str() here. # On Python 2 type() requires a byte string (which is str() on Python 2). # On Pyth...
StarcoderdataPython
78428
<reponame>Abrosimov-a-a/dvc from __future__ import unicode_literals from dvc.output.s3 import OutputS3 from dvc.remote.gs import RemoteGS class OutputGS(OutputS3): REMOTE = RemoteGS
StarcoderdataPython
3319889
<reponame>nuo010/pyefun<filename>pyefun/typeConv.py """ .. Hint:: 类型转换 .. literalinclude:: ../../../pyefun/typeConv_test.py :language: python :caption: 代码示例 :linenos: """ from .timeBase import * import json def 到文本(bytes): return str(bytes, encoding="utf-8") def 到字节集(str): return bytes(str...
StarcoderdataPython
3210884
<gh_stars>1-10 import pathlib import numpy as np __all__ = ["load_my_format"] def load_my_format(path, callback=None, meta_override=None): """Loads AFM data from my format This is the main function for loading your file format. Please add a description here. Parameters ---------- path: st...
StarcoderdataPython
1725363
<gh_stars>10-100 import pytest import virtool.users.utils @pytest.fixture def hmm_document(): return { "_id": "f8666902", "count": 4, "length": 199, "names": ["ORF-63", "ORF67", "hypothetical protein"], "entries": [ { "gi": "438000415", ...
StarcoderdataPython
135245
from smbus import SMBus class MCPGPIO(): __IODIR = [0x00, 0x01] # レジスタ番号 __GPPU = [0x0C, 0x0D] __GPIO = [0x12, 0x13] __OLAT = [0x14, 0x15] INPUT = 1 OUTPUT = 0 INPUTPULLUP = 3 HIGH = 1 LOW = 0 def __init__(self,address = 0x20): self.bus = SMBus(1) self.ad...
StarcoderdataPython
50187
# https://arxiv.org/pdf/1703.02910.pdf, Deep Bayesian Active Learning with Image Data import numpy as np from .baseline import Strategy from ..helpers.time import timeit class BayesianActiveLearning(Strategy): def __init__(self, nb_forward=10, **kwargs): super(BayesianActiveLearning, self).__init__() ...
StarcoderdataPython
86785
<reponame>girisagar46/DjangoTrainingClass from django.contrib.auth.decorators import login_required from django.core.mail import EmailMessage from django.db.models import Q from django.shortcuts import render, get_object_or_404 from django.template.loader import get_template from django.utils import timezone from djang...
StarcoderdataPython
3396819
from .bert_for_EL_classification import BertForELClassification __all__ = [ 'BertForELClassification', ]
StarcoderdataPython
91808
<reponame>rmishra1990/Hw-10-Web-Mongo-DB<filename>mars_scraping.py from splinter import Browser from bs4 import BeautifulSoup as bs import time import pandas as pd def init_browser(): # @NOTE: Replace the path with your actual path to the chromedriver executable_path = {"executable_path": "/usr/local/bin/chrom...
StarcoderdataPython
109171
<reponame>mixmasteru/CarND-Advanced-Lane-Lines import glob import os import pickle import cv2 import numpy as np # grid counts nx = 9 ny = 6 # prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0) objp = np.zeros((nx * ny, 3), np.float32) objp[:, :2] = np.mgrid[0:nx, 0:ny].T.reshape(-1, 2) # Arrays to ...
StarcoderdataPython
1760027
import sys from logging import getLogger from logging import NullHandler import grpc import python_liftbridge.api_pb2_grpc logger = getLogger(__name__) logger.addHandler(NullHandler()) class BaseClient(object): """ Connect creates a Client connection for the given Liftbridge cluster. """ def ...
StarcoderdataPython
3217438
"""Contains the Mode base class.""" from typing import Any, Optional from typing import Callable from typing import Dict from typing import List from typing import Set from typing import Tuple from mpf.core.delays import DelayManager from mpf.core.logging import LogMixin from mpf.core.switch_controller import SwitchHa...
StarcoderdataPython
3333907
<filename>Photo.py class Photo: def __init__(self, index, horizontal, tags): self.index = index self.horizontal = horizontal self.tags = tags
StarcoderdataPython
144751
import r_jeff_epler_1 print r_jeff_epler_1.blowup([2, 3, 5])
StarcoderdataPython
85730
#!/usr/bin/env python -*- coding: utf-8 -*- # # Python Word Sense Disambiguation (pyWSD): SemEval REader API # # Copyright (C) 2014-2020 alvations # URL: # For license information, see LICENSE.md import os, io from collections import namedtuple from BeautifulSoup import BeautifulSoup as bsoup from pywsd.utils import ...
StarcoderdataPython
139725
import os import re import dgl import numpy as np from data import * def get_edgelists(edgelist_expression, directory): if "," in edgelist_expression: return edgelist_expression.split(",") files = os.listdir(directory) compiled_expression = re.compile(edgelist_expression) return [filename for...
StarcoderdataPython
1662197
<gh_stars>1-10 """ 355. shuttleInBuildings https://www.lintcode.com/problem/shuttleinbuildings/description?_from=contest&&fromId=103 dp """ from collections import deque class Solution: """ @param heights: the heights of buildings. @param k: the vision. @param x: the energy to spend of the fir...
StarcoderdataPython
3239463
<gh_stars>1-10 ############################################################################### # # Copyright (C) 2021 - Skinok # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 ...
StarcoderdataPython
3360499
<gh_stars>1-10 """ Setup the package. """ from setuptools import find_packages, setup with open('README.md') as read_me: long_description = read_me.read() with open('requirements.txt') as f: requirements = f.read().splitlines() setup( version='0.2.0', name='eos-name-generator', description='Pytho...
StarcoderdataPython
3370215
<filename>ibis/spark/tests/conftest.py import pytest from ibis.tests.all.conftest import get_spark_testing_client @pytest.fixture(scope='session') def client(data_directory): pytest.importorskip('pyspark') return get_spark_testing_client(data_directory) @pytest.fixture(scope='session') def simple(client): ...
StarcoderdataPython
18368
<filename>charybde/parsers/dump_parser.py from bz2 import BZ2File from pathlib import Path from queue import Queue from threading import Thread from typing import Any, Callable, Dict, Iterator, List, Tuple from xmltodict import parse as xmltodict_parse def parse(dump: Path) -> Iterator[Dict[str, Any]]: def filte...
StarcoderdataPython
4810255
<reponame>spsatuva/spsatuva<filename>img-resize.py # # Usage: this script converts all of the images located in _img/<folder> # to responsive sizes and places them into assets/img/<folder>. Behavior # beyond the default behavior can be referenced by running this script with # the --help or -h o...
StarcoderdataPython
1789142
<gh_stars>10-100 """Basic tests of the sambuilder module.""" import pytest from samwell import sam from samwell.sam.sambuilder import SamBuilder def test_add_pair_all_fields() -> None: builder = SamBuilder() builder.add_pair( name="q1", chrom="chr1", bases1="ACGTG", quals1=[2...
StarcoderdataPython
1748370
<gh_stars>0 # The MIT License (MIT) # Copyright (c) 2021 by the xcube development team and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including withou...
StarcoderdataPython
3378344
<filename>utils/loader.py from .dataset import NFDataset from torch.utils.data import DataLoader import torch import numpy as np def get_loaders( train_dir, train_maskdir, val_dir, val_maskdir, img_shape, batch_size, cnn_mode, num_workers=4, pin_memory=True, ): train_ds = NFDat...
StarcoderdataPython
107350
<reponame>CXPhoenix/python-cli-game """ 這是 Text Game 的教學用模組 """ import os import sys import time class TextGame: def __init__(self, playerName: str='player'): self.playerName = playerName self.scene = {} self.clearCmd = '' self.playerRecord = {} # detect system if ...
StarcoderdataPython
1735512
<reponame>ezequieljsosa/sndg-web import json import os from tqdm import tqdm os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sndg.settings") import django django.setup() from bioresources.models import BioProject, Assembly, Structure, Expression, ResourceRelation mappings = {} assembly_nuc = {} dbmap = {"gds": Ex...
StarcoderdataPython