id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3383095
<gh_stars>1-10 from pandas.core.frame import DataFrame from sklearn.model_selection import train_test_split, cross_val_score from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix from sklearn.preproce...
StarcoderdataPython
4789
from braintree.configuration import Configuration from braintree.resource import Resource class AccountUpdaterDailyReport(Resource): def __init__(self, gateway, attributes): Resource.__init__(self, gateway, attributes) if "report_url" in attributes: self.report_url = attributes.pop("re...
StarcoderdataPython
1757068
#! /usr/bin/env python3 from .base_miner import BaseTupleMiner from ..utils import loss_and_miner_utils as lmu import torch class TripletMarginMiner(BaseTupleMiner): """ Returns triplets that violate the margin Args: margin type_of_triplets: options are "all", "hard", or "semihard"....
StarcoderdataPython
1614857
<reponame>vwrs/nmf-visualization-3d import torch from nmf import normalize_col EPS = torch.finfo(torch.float).eps def prnorm_matrix_normalized(N, M, K, noise_coeff=0): D = torch.randn(N, K).clamp(min=EPS) C = torch.randn(K, M).clamp(min=EPS) D = normalize_col(D) C = normalize_col(C) X = D.mm(C) ...
StarcoderdataPython
3306565
from django.contrib.auth.models import User from django.db.models import Sum from multidb.pinning import use_master from affiliates.base.management.commands import QuietCommand from affiliates.links.models import LeaderboardStanding class Command(QuietCommand): help = ('Populate the leaderboard with the latest ...
StarcoderdataPython
3337549
#!/usr/bin/env python # read mc file with filename given as command line argument and # sho BH and Mue plot # # Usage: # plot.mcv.py <filename> # import matplotlib.pylab as pl import femagtools.mcv import femagtools.plot import sys mcv = femagtools.mcv.read(sys.argv[1]) if mcv['mc1_type'] in (femagtools.mcv.MAGCRV, ...
StarcoderdataPython
48639
<reponame>RayYoh/BasicRL from dqn import DQN from utils import * from logx import * import gym class DuelingDQN(DQN): def __init__( self, env_fn, target_update,epsilon_decay, dqn = DuelingNetwork, seed=0, steps_per_epoch=600, epochs=100, replay_size=int(2000), ...
StarcoderdataPython
1666377
from web3.auto import Web3 import time import requests import json def create_ocean_request(query): pass def process_response(response,command): pass def prepare_tx(fun): nonce = w3.eth.getTransactionCount(account.address) query_txn = fun.buildTransaction({ 'gas': 300000, ...
StarcoderdataPython
194185
<filename>assets/glue/scripts/transform_clean_to_business_partition.py import sys from awsglue.transforms import * from awsglue.utils import getResolvedOptions from pyspark.context import SparkContext from awsglue.context import GlueContext from awsglue.job import Job ## @params: [JOB_NAME] args = getResolvedOptions(s...
StarcoderdataPython
3269512
from ddq.topics.logics.topic import Logic class FirstOrderLogic(Logic): pass
StarcoderdataPython
159809
<filename>exp3/chat_client_udp.py import socket s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind(("127.0.0.1",2225)) while True: data,address=s.recvfrom(1024) print "server:"+str(data) input=raw_input("client:") if input=="bye" or input=="exit": s.sendto(input,("1...
StarcoderdataPython
3212095
<gh_stars>0 #!/usr/bin/env python3 import math name = input("What is your name? ") birthdate = input("What is your birthdate? ") age =int(input("How old are you? "))/2 print(f"{name} was born on {birthdate}.") print("Half of your age is", str(int(math.floor(age))) + ".")
StarcoderdataPython
1719585
#!/usr/bin/env python3 import argparse from pathlib import Path import numpy as np import statsmodels.api as sm from scipy import stats from matplotlib import pyplot as plt parser = argparse.ArgumentParser( description="Train generalized linear model to get coefficient for each variable." ) parser.add_argument( ...
StarcoderdataPython
1727693
<reponame>devdut1999/Algorithms-for-Programming ## Problem : Given two sorted arrays arr1[] of size N and arr2[] of size M. ## Each array is sorted in non-decreasing order. ## Merge the two arrays into one sorted array in non-decreasing order without using any extra space. ## Input: T(number ...
StarcoderdataPython
1643766
from ubiquiti.unifi import API as Unifi_API import json import paho.mqtt.client as mqtt import time class anybody_home(): def __init__(self): self.n_devices = 4 self.dev_1 = '192.168.0.51' self.dev_2 = '192.168.0.52' self.dev_3 = '192.168.0.53' self.dev_4 = '192.168.0.54' ...
StarcoderdataPython
68727
<reponame>metrizable/deep-learning-containers import os import re import pytest from invoke.context import Context from test.test_utils import ( LOGGER, CONTAINER_TESTS_PREFIX, ec2, get_framework_and_version_from_tag, is_canary_context, is_tf_version, is_dlc_cicd_context, is_pr_contex...
StarcoderdataPython
3290396
class Test: def __init__(self): self.x = 0 class Derived_Test(Test): def __init__(self): super().__init__() self.y = 1 def main(): b = Derived_Test() print(b.x, b.y) main()
StarcoderdataPython
67935
import pymongo def connect_mongo(engine=pymongo, host='mongo', port=27017): mongo_client = engine.MongoClient(host, port) mongo_db = mongo_client['main_db'] return mongo_db
StarcoderdataPython
3221657
import unittest import logging import numpy as np from src.lattice_boltzmann_method import compute_velocity_field class TestVelocityComputation(unittest.TestCase): def setUp(self) -> None: logging.basicConfig(level=logging.DEBUG) def test_velocity_computation(self): """ Test velocity...
StarcoderdataPython
3214627
<reponame>chrisreedy/fun<filename>A336433/sequence.py """ Compute the number of sequences of n numbers from 1 to n that do not have a subsequence that adds up to n. (OEIS sequence A336433) More precise: Compute the number of sequences k1, k2, ..., kn, ki an integer with 1 <= ki <= n and no indices 1 <= j1 < j2 < ... <...
StarcoderdataPython
1752607
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Classes and functions that support unsupervised clustering of data using Simulated Annealing (SA) based algorithms """ from abc import ABC, abstractmethod import time from scipy.spatial.distance import pdist, cdist import numpy as np class AbstractCoolingSchedule(ABC...
StarcoderdataPython
14868
# -*- coding: utf-8 -*- ################################################################################ # | # # | ______________________________________________________________ # # | :~8a.`~888a:::::::::::::::88......88:::::::::...
StarcoderdataPython
4810147
<filename>dataset/get_export.py #!/usr/bin/python # -*- coding: UTF-8 -*- # Exports tabular data for analysis __author__ = """<NAME>""" import numpy as np import logging, codecs, csv logging.basicConfig(filename='logs/parser_stats.log',filemode="w+",level=logging.INFO) logger = logging.getLogger("Main") # MongoDB fro...
StarcoderdataPython
1756956
import unittest import mock import logging import json import requests import esgfpid.solr.solr # Logging: LOGGER = logging.getLogger(__name__) LOGGER.addHandler(logging.NullHandler()) # Test resources: from tests.resources.IGNORE.TESTVALUES_IGNORE import TESTVALUES_SOLR SOLR_URL_HTTP = 'http://'+TESTVALUES_SOLR['sol...
StarcoderdataPython
154046
from __future__ import absolute_import # from celery import shared_task # from celery.decorators import task from information.task_module.rescue_crawler import RescueCrawler from information.task_module.dart_crawler import DartUpdate from information.models import Rescue, Dart import os import time from datetim...
StarcoderdataPython
157340
# Generated by Django 3.2.9 on 2021-11-25 10:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('run', '0013_remove_run_date'), ] operations = [ migrations.AddField( model_name='run', name='duration', ...
StarcoderdataPython
1741868
<filename>mylis/mylis_2/exercises/ackermann.py """This module contains a code example related to Think Python, 2nd Edition by <NAME> http://thinkpython2.com Copyright 2015 <NAME> License: http://creativecommons.org/licenses/by/4.0/ """ def ackermann(m, n): """Computes the Ackermann function A(m, n) See htt...
StarcoderdataPython
156290
<reponame>bermeom/quadruped-robot import numpy as np import tensorflow as tf import tensorblock as tb class layer_conv1d: ####### Data def name(): return 'Conv1D' def shapeMult(): return 1 def dims(): return 1 def allowPooling(): return True ####### Function def function( x , W , b , recipe , ...
StarcoderdataPython
57215
<filename>src/nodepy/utils/tracing.py<gh_stars>10-100 # The MIT License (MIT) # # Copyright (c) 2017-2018 <NAME> # # 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, includi...
StarcoderdataPython
3381544
<reponame>MirrorYu/eagleeye from setuptools import setup setup(name='eagleeye', version='0.0.1', description='eagleeye dataflow framework scaffold', __short_description__='eagleeye dataflow framework scaffold', url='https://github.com/jianzfb/eagleeye', author='jian', author_email='...
StarcoderdataPython
152979
<filename>products/migrations/0002_auto_20200629_2249.py<gh_stars>1-10 # Generated by Django 3.0.7 on 2020-06-30 01:49 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('products', '0001_initial'), ] operations = [ migrations.AlterUniqueTogether( ...
StarcoderdataPython
4819506
<filename>temp/dict_test.py res_dict_list = ["pos0.6", "total0.6", "pos0.8", "total0.8", "pos1.0", "total1.0"] res_dict = dict([(res, 0) for res in res_dict_list]) print(res_dict)
StarcoderdataPython
3231656
from setuptools import setup, find_packages # #NOTE: whenever we publish a new version come in here and bump up the version number first! # Our version number follows the convention of 3 numbers: MAJOR (new api), MINOR (added functionality), PATCH (bug fix) # #pip install -e . to test locally before publishing #build...
StarcoderdataPython
4802315
<gh_stars>10-100 ''' Generates hdf5 file from pre_data tsv for recurrence plot''' import os import os.path import glob import csv import numpy as np import pandas as pd base_dir = sys.argv[1] plot_dir=os.path.join(base_dir, "figures/") pre_data=os.path.join(plot_dir,"data/data_recurrence_plot.tsv") donor_to_cancert...
StarcoderdataPython
1759634
<gh_stars>0 # Copyright 2017-present Open Networking Foundation # # 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 applicabl...
StarcoderdataPython
189414
<filename>quote/Utils.py from random import randint from .database import get_db from .models import Post # Write your custom classes and functions here # Estimating post reading time def reading_time(content): """" https://infusion.media/content-marketing/how-to-calculate-reading-time/ """ words = c...
StarcoderdataPython
3324191
<gh_stars>1-10 # -*- coding: utf-8 -*- import operator import warnings import numpy import dask import dask.array from . import _compat from . import _pycompat def _norm_input_labels_index(input, labels=None, index=None): """ Normalize arguments to a standard form. """ input = _compat._asarray(i...
StarcoderdataPython
96458
<reponame>huangshenno1/project_euler import sys def check(n): tmp = n*(n-1)/2 x = int(tmp**0.5) return x*(x+1) == tmp def next(n, rate): m = int(n*rate) while not check(m): m += 1 return m, float(m)/n n = 4 rate = 5.0 for i in xrange(0, 100): (n, rate) = next(n, rate) print n if n > int(1e12): print '-...
StarcoderdataPython
1768436
# pseudoInverseIsing.py # # <NAME> # 12.9.2013 # # Attempting to do inverse ising using # the 'pseudolikelihood' approach # described in # Aurell and Ekeberg, PRL 108, 090201 (2012) # #import scipy.weave #import sys import scipy.optimize import pylab # for testing exp,log,sum,array = scipy.exp,scipy.log,scipy.sum,sc...
StarcoderdataPython
1725381
"""The main entry point for the command-line interface.""" import click import logging from logging.handlers import RotatingFileHandler from .container import container from .patient import patient from .trial import trial from .time import time @click.group() @click.option('-v', '--verbose', ...
StarcoderdataPython
70550
<gh_stars>1-10 from dbug12 import Debugger import tempfile, os, subprocess asm = ''' org $1FF0 fcc "Hello World!" dc.b $00 org $2000 ldd #$1FF0 ldx #$0 jsr [#$EE88,X] swi ''' # assemble the src code # (optionally you can compile externally and # feed the .s19 content to the load method) try: asm_file = open...
StarcoderdataPython
1679613
<gh_stars>1-10 import matplotlib.pyplot as plt import csv from paths import get_operator_test_path filelist = {"TruA.csv" : "TA", "LOA.csv" : "LOA", "MedA.csv" : "MA", "APA2.csv" : "APAII", "APA.csv" : "APA", "ETAI.csv" : "ETAI", # "ESA.csv" ...
StarcoderdataPython
1656520
import collections import numpy as np import pytest from psyneulink.globals.utilities import convert_all_elements_to_np_array @pytest.mark.parametrize( 'arr, expected', [ ([[0], [0, 0]], np.array([np.array([0]), np.array([0, 0])])), # should test these but numpy cannot easily create an array ...
StarcoderdataPython
3309310
<reponame>jnywong/nondim-slurry<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 20 13:20:26 2020 @author: <NAME> ############################################################################### # SLURRY.PY # #########...
StarcoderdataPython
3313859
<gh_stars>1-10 # -*- coding: utf-8 -*- """Top-level package for VirulenceFactorCharacterizer.""" __author__ = """VirulenceFactorCharacterizationGroup""" __email__ = '<EMAIL>' __version__ = '0.1.0'
StarcoderdataPython
3315514
<filename>ConsensusCruncher/consensus_helper.py #!/usr/bin/env python ############################################################### # # Consensus Helper # # Author: <NAME> # Date Created: Mar 24, 2016 ############################################################### # Function: # Helper functions f...
StarcoderdataPython
3239846
""" Main module for the program excecution without tkinter GUI Made with ❤️ by kalaLokia """ import pandas as pd from core.load_database import loadDatabase from core import excel_report from core.bom import Bom from core.article import Article from core.excel_report import ExcelReporting APPLOG = [] if __name__...
StarcoderdataPython
1760249
"""Example 001: Use embedded signing""" from docusign_esign.client.api_exception import ApiException from flask import render_template, redirect, Blueprint, current_app as app from .eSignature.examples.eg001_embedded_signing import Eg001EmbeddedSigningController from .docusign import authenticate from .ds_config impo...
StarcoderdataPython
1663224
from splitcli.ux import menu from splitcli.accounts import user from splitcli.split_apis import users_api def sign_in(): email = menu.text_input("Enter your email") menu.info_message("To find your Admin API Key, follow the directions here:") menu.info_message("https://www.youtube.com/watch?v=80Bz2ZcZUrs") ...
StarcoderdataPython
96065
from typing import List, Union from src.config.settings import get_settings from src.db.timescale_db.tsdb_connector_pool import TimescaleDBConnectorPool from src.models.models.project import ProjectDB,Project from src.models.models.time_series import TimeSeries, TimeSeriesProject, TimeSeriesSample def query_time_ser...
StarcoderdataPython
1641071
<filename>lpr/process/characterSegmentation.py import cv2 def img2gray(plate): #img = cv2.imread(filename) img_gray = cv2.cvtColor(plate, cv2.COLOR_BGR2GRAY) # cv2.imshow('gray', img_gray) # cv2.waitKey(0) return img_gray def gray2thre(img_gray): # img_thre = img_gray # cv2.threshold(img...
StarcoderdataPython
1615747
<reponame>bobbyluig/eclipse<filename>src/cerebral/pack1/demo.py from agility.gait import Dynamic from cerebral.pack1.hippocampus import Android from agility.main import Agility import math # Definition. robot = Android.robot # Initialize objects. agility = Agility(robot) gait = Dynamic(robot) def execute_vector(ve...
StarcoderdataPython
1684510
from django.core.management.base import BaseCommand from ...utils.lgUtils import * from ...utils.earthquakesUtils import * import requests import json from datetime import timedelta import simplekml from polycircles import polycircles import datetime from json.decoder import JSONDecodeError class Command(BaseCommand)...
StarcoderdataPython
1688551
__author__ = 'sei' import socket import time import sys import multiprocessing class Controller(object): def __init__(self, ip=None, port=None, coordinate_mapping = None, z_correction_angle = None): self.is_initialized = False received = None self._lock = multiprocessing.Lock() sel...
StarcoderdataPython
168666
''' File [ eval_metrics.py ] Author [ <NAME> (NTUEE) ] Synopsis [ Evaluation metrics. ] ''' import edit_distance as ed def split_sequence(seq, mode='word'): ''' Split sequence by word or characters. ''' if mode in ['word', 'phone']: return seq.split(' ') elif mode == 'char':...
StarcoderdataPython
3222571
<reponame>robotika/osgar """ Convert depth image to "lidar" scan """ import math import cv2 import numpy as np from osgar.node import Node from osgar.bus import BusShutdownException from osgar.lib.depth import depth2dist, DepthParams, decompress as decompress_depth from osgar.lib.quaternion import multiply as multi...
StarcoderdataPython
105317
<reponame>KyleKing/My-Programming-Sketchbook """Tutorial for Dagster. ```sh # Run with Python or dagit: poetry run python dagster_demo.py poetry run dagit -f dagster_demo.py # Set a persistent location for dagit to store metadata (otherwise in temporary directory) DAGSTER_HOME=$PWD/dagit-cache export DAGSTER_HOME ECH...
StarcoderdataPython
178799
<filename>Chapter08/qt08_winBkground01.py<gh_stars>0 # -*- coding: utf-8 -*- ''' 【简介】 界面背景图片设置 ''' import sys from PyQt5.QtWidgets import QMainWindow , QApplication app = QApplication(sys.argv) win = QMainWindow() win.setWindowTitle("界面背景图片设置") win.resize(350, 250) win.setObjectName("MainWindow") win....
StarcoderdataPython
3384978
<filename>doctor/views.py import datetime import os import socket import sys import unittest from django.conf import settings from django.contrib.sites.models import Site from django.http import HttpResponse, Http404 from django.shortcuts import render from django.utils.datastructures import SortedDict from django.uti...
StarcoderdataPython
1790902
<gh_stars>1-10 import os user = os.getlogin() print('\nCurrent Logged in User:\n{}'.format(user)) info = os.uname() print('\nCurrent Operating System Info:\n{}'.format(info)) files = os.listdir() print('\nFiles in Current Working Directory:\n{}'.format(files))
StarcoderdataPython
1757839
<gh_stars>1000+ import numpy as np import sys from theano import function from theano import tensor as T _, model_path, sigma = sys.argv from pylearn2.utils import serial model = serial.load(model_path) from pylearn2.config import yaml_parse dataset = yaml_parse.load(model.dataset_yaml_src) dataset = dataset.get_test...
StarcoderdataPython
1673469
<gh_stars>100-1000 from .plots import output_notebook, show, histogram, cumulative_histogram, histogram2d, scatter, joint_plot, qq, manhattan, smoothed_pdf, pdf, cdf, set_font_size, visualize_missingness __all__ = ['output_notebook', 'show', 'histogram', 'cumulative_histogram', ...
StarcoderdataPython
1696702
# Copyright Contributors to the OpenCue Project # # 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...
StarcoderdataPython
6984
# Copyright 2012 OpenStack Foundation # # 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 agreed to in...
StarcoderdataPython
1653618
pkgname = "xorriso" pkgver = "1.5.4.2" _xver = "1.5.4.pl02" pkgrel = 0 build_style = "gnu_configure" configure_args = [ "--enable-libedit", "--disable-libreadline", "MKDIR_P=mkdir -p" # install-sh is buggy ] makedepends = [ "zlib-devel", "libbz2-devel", "libedit-devel", "acl-devel", "linux-headers" ] pkgdes...
StarcoderdataPython
3359151
<filename>api/src/tests/integration/provider/test_objects_tracker_model.py from tests.integration.factories.objs import create_project from wt.ids import EntityId, EntityType OBJECT_ID1 = "PRJ-23" OBJECT_ID2 = "GGG-56" def test_track_object(objects_tracker_model, put_project): object_id = EntityId(OBJECT_ID1) ...
StarcoderdataPython
1603030
<gh_stars>0 import numpy as np import cv2 def play(file_list): caps = [cv2.VideoCapture(file) for file in file_list] frames = [None] * len(file_list) ret = [None] * len(file_list) while True: for i, cap in enumerate(caps): if cap is not None: ret[...
StarcoderdataPython
4840656
# Copyright 2004-2018 <NAME> <<EMAIL>> # 2008-2018 <NAME> <<EMAIL>> # # 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 2 of the License, or # (at your option) any later v...
StarcoderdataPython
1736386
""" MIT License Copyright (c) 2019 Samsung. <EMAIL> 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 without limitation the rights to use, copy, modify, merge, publish...
StarcoderdataPython
79206
from env_FireFighter import EnvFireFighter import random def generate_tgt_list(agt_num): tgt_list = [] for i in range(agt_num): tgt_list.append(random.randint(0, 1)) return tgt_list env = EnvFireFighter(4) max_iter = 100 for i in range(max_iter): print("iter= ", i) print("actual fire lev...
StarcoderdataPython
3251696
#!/usr/bin/env python # -*- coding: utf-8; -*- # # collectd implementation of: # https://github.com/BrightcoveOS/Diamond/blob/master/src/collectors/tcp/tcp.py import collectd import os class Tcp(object): PROC = ['/proc/net/netstat', '/proc/net/snmp'] GAUGES = ['CurrEstab', 'MaxConn'] def __init__(self...
StarcoderdataPython
26668
<gh_stars>0 from django.apps import AppConfig class EurocvConfig(AppConfig): name = 'eurocv'
StarcoderdataPython
77012
from pyrogram import Client, Message from bot import LOCAL, CONFIG from bot.handlers import help_message_handler async def func(client : Client, message: Message): try: await message.delete() except: pass if ' '.join(message.command[1:]) == CONFIG.BOT_PASSWORD: CONFIG.CHAT_ID.append...
StarcoderdataPython
1745800
<reponame>jamesmarshall24/awx<filename>awx_collection/plugins/modules/tower_settings.py #!/usr/bin/python # coding: utf-8 -*- # (c) 2018, <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __met...
StarcoderdataPython
3376738
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft and contributors. 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 ...
StarcoderdataPython
2943
import numpy as np import copy import combo.misc import cPickle as pickle from results import history from .. import utility from ...variable import variable from ..call_simulator import call_simulator from ... import predictor from ...gp import predictor as gp_predictor from ...blm import predictor as blm_predictor im...
StarcoderdataPython
3304485
<filename>24.py from collections import defaultdict, deque from itertools import combinations from functools import reduce from operator import add, mul import re CHALLENGE_DAY = "24" REAL = open(CHALLENGE_DAY + ".txt").read() SAMPLE = open(CHALLENGE_DAY + ".sample.txt").read() SAMPLE_EXPECTED = 99 def p...
StarcoderdataPython
19836
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # [0,0] = TN # [1,1] = TP # [0,1] = FP # [1,0] = FN # cm is a confusion matrix # Accuracy: (TP + TN) / Total def accuracy(cm: pd.DataFrame) -> float: return (cm[0,0] + cm[1,1]) / cm.sum() # Precision: TP / (TP + FP) de...
StarcoderdataPython
30510
<gh_stars>1-10 import math from scipy.spatial.ckdtree import cKDTree from core.camera import Camera from core.intersection import Intersection from core.ray import Ray from core.renderer import Renderer from core.sample import Sample from core.sampler import Sampler from core.scene import Scene from core.spect...
StarcoderdataPython
3388315
<gh_stars>1-10 import cv2 from colors import rgb_to_lab, color_quantization from edge import calc_grad from histogram import compute def process(path): image = cv2.imread(path) return process_image(image) def process_image(image): lnum = 10 anum = 3 bnum = 3 cnum = lnum * anum * bnum o...
StarcoderdataPython
162785
<filename>neural_semigroups/utils.py<gh_stars>1-10 """ Copyright 2019-2021 <NAME> 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 U...
StarcoderdataPython
4836705
# -*- coding:utf-8 -*- # # Copyright © 2020 cGIfl300 # # 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 without limitation # the rights to use, copy, modify, mer...
StarcoderdataPython
63284
<filename>src/settingRes.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'main.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError...
StarcoderdataPython
3344204
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incor...
StarcoderdataPython
3312829
#! /usr/bin/env python import subprocess import argparse import pathlib import shutil import re import os working_dir = pathlib.Path(".protos_working_dir").absolute() java_protos_directory = pathlib.Path("./app/src/main/proto").absolute() tensorflow_serving_github = "https://github.com/tensorflow/serving.git" tensorfl...
StarcoderdataPython
3259925
<filename>npms/utils/image_proc.py import numpy as np from NPMs._C import backproject_depth_ushort as backproject_depth_ushort_c from NPMs._C import backproject_depth_float as backproject_depth_float_c from NPMs._C import compute_validity_and_sign_mask as compute_validity_and_sign_mask_c from NPMs._C import compute_no...
StarcoderdataPython
129474
<reponame>soniasingla/addons-server import re from django.conf import settings from rest_framework import exceptions, serializers from olympia import amo from olympia.accounts.serializers import BaseUserSerializer from olympia.amo.templatetags.jinja_helpers import absolutify from olympia.amo.urlresolvers import get_...
StarcoderdataPython
4831828
<reponame>tomshaked/CumInCAD-Crawler<filename>config.py<gh_stars>1-10 ## Database parameters DATABASE_CONFIG = { 'host': 'localhost', 'dbname': '', 'user': '', 'password': '', 'port': 3306 } ## Saved papers directory (On Windows OS, the SAVE_DIR path should use \ instead of /) SAVE_DIR = ''
StarcoderdataPython
1731015
<filename>cpython_stats/env.py # © Copyright 2021 <NAME>. Licensed under Apache License, Version 2.0. from __future__ import annotations from typing import * import os from dotenv import load_dotenv load_dotenv() GITHUB_API_TOKEN = os.environ["GITHUB_API_TOKEN"] GIT_REPO_LOCATION = os.environ.get("GIT_REPO_LOCATIO...
StarcoderdataPython
112666
__________________________________________________________________________________________________ sample 148 ms submission from bisect import bisect_left, bisect_right, insort class Solution: def countRangeSum(self, nums: List[int], lower: int, upper: int) -> int: if(lower > upper): return 0 ...
StarcoderdataPython
3399328
<filename>backend/DrugProt/app/tagner.py<gh_stars>0 import os import sys import unicodedata from flask_cors import CORS from flask import Flask, request from app import app import numpy as np import tensorflow as tf from flask import g, json, request, jsonify from common import process_sentences, load_ner_model from c...
StarcoderdataPython
3348708
from PIL.ImageGL import *
StarcoderdataPython
1719909
<reponame>aimldl/coding #!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' aimldl > python3 > topics > command_line_arguments > tutorialspoint.com > test.py Rev.2: 2019-11-07 (Thu) Rev.1: 2019-03-01 (Fri) Draft: 2018-11-08 (Thu) Source: Python - Command Line Arguments https://www.tutorialspoint.com/python/py...
StarcoderdataPython
1695951
<reponame>kazuyaujihara/rdkit # $Id$ # # Copyright (C) 2004-2008 <NAME> and Rational Discovery LLC # All Rights Reserved # """ Defines Naive Baysean classification model Based on development in: Chapter 6 of "Machine Learning" by <NAME> """ import numpy from rdkit.ML.Data import Quantize def _getBinId(val, ...
StarcoderdataPython
190390
#!/usr/bin/python # -*- coding: ascii -*- # $Id$ # # Author: <NAME> #<EMAIL> # Date: 9 November 2017 # Date: 03 may 2018 # A special thanks to <NAME> and Vasilis. #This plugin is based on a variation # of yours plugin Driller and My_Plugin example. # To correct: Thats why the first point starts, __author__ = "<NAME...
StarcoderdataPython
3376105
import datetime import math import mpyq import binascii import requests import struct from pathlib import Path from io import BytesIO from importlib import import_module from typing import Dict from zephyrus_sc2_parser.events import ( ObjectEvent, AbilityEvent, SelectionEvent, ControlGroupEvent, Upg...
StarcoderdataPython
1737806
<reponame>ShenQianwithC/HistomicsTK #!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2013 Kitware Inc. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you may not use this file except in compliance with ...
StarcoderdataPython
186204
""" Copyright (C) 2019 <NAME>, ETH Zurich 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 without limitation the rights to use, copy, modify, merge, publish, distri...
StarcoderdataPython
3245619
<filename>samo_tidy/core/test/test_summary.py import unittest import samo_tidy.core.summary as summary import samo_tidy.test.test_support as test_support class TestSummary(unittest.TestCase): def test_merge_multiple_entries(self): the_summary1 = summary.Summary() the_summary2 = summary.Summary() ...
StarcoderdataPython
3253832
import logging import io from PIL import Image import redis from flask import current_app redis_client = redis.Redis() logger = logging.getLogger('Telepict.image') def flatten_p_image(img, background_color=(255, 255, 255)): background = Image.new('RGBA', img.size, background_color) background.paste(img) ...
StarcoderdataPython