text
stringlengths
0
1.05M
meta
dict
# bicep_util.py # # This is a module containing subfunctions to evaluate the bicep1 or bicep2 likelihood # # get_bpwf # load_cmbfast # calc_expvals # read_data_products_bandpowers # read_M # calc_vecp # g # vecp # saveLikelihoodToText # #$Id: bicep_util.py,v 1.1.2.5 2014/03/12 18:20:57 dbarkats Exp $ # # IMPORTANT NOT...
{ "repo_name": "baudren/montepython_public", "path": "montepython/likelihoods/bicep2/bicep_util.py", "copies": "2", "size": "16824", "license": "mit", "hash": 6850111305666872000, "line_mean": 35.2586206897, "line_max": 150, "alpha_frac": 0.5072515454, "autogenerated": false, "ratio": 2.6845380564...
"""Bicycle balancing task.""" from __future__ import division from __future__ import unicode_literals from __future__ import print_function from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import range from past.utils import old_div from .Domai...
{ "repo_name": "rlpy/rlpy", "path": "rlpy/Domains/Bicycle.py", "copies": "1", "size": "6959", "license": "bsd-3-clause", "hash": 5354627604018450000, "line_mean": 32.9463414634, "line_max": 118, "alpha_frac": 0.5141543325, "autogenerated": false, "ratio": 3.3328544061302683, "config_test": false...
"""Bicycle balancing task.""" from .Domain import Domain import numpy as np from itertools import product from rlpy.Tools import plt __copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy" __credits__ = ["Alborz Geramifard", "Robert H. Klein", "Christoph Dann", "William Dabney", "Jonathan P. How...
{ "repo_name": "BerkeleyAutomation/rlpy", "path": "rlpy/Domains/Bicycle.py", "copies": "4", "size": "6548", "license": "bsd-3-clause", "hash": 8958800419799242000, "line_mean": 32.4081632653, "line_max": 118, "alpha_frac": 0.498014661, "autogenerated": false, "ratio": 3.312089023773394, "config_...
"""bideox URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-base...
{ "repo_name": "tuanquanghpvn/bideox", "path": "bideox/urls.py", "copies": "1", "size": "1060", "license": "mit", "hash": 2476595010852178000, "line_mean": 38.2592592593, "line_max": 79, "alpha_frac": 0.6679245283, "autogenerated": false, "ratio": 3.452768729641694, "config_test": false, "has_...
"""Bi-directional converter for the vector music format (VMF).""" from music21 import converter, note, stream, meter import vmf_converter.core.vmf_converter_core as vmf_converter_core import json class VMFConverter(converter.subConverters.SubConverter): """Converter for parsing and writing VMF files.""" regis...
{ "repo_name": "project-schumann/vmf-converter", "path": "vmf_converter/vmf_converter.py", "copies": "1", "size": "1095", "license": "mit", "hash": -8800219740490955000, "line_mean": 38.1071428571, "line_max": 72, "alpha_frac": 0.6675799087, "autogenerated": false, "ratio": 3.737201365187713, "c...
''' Bidirectional dictionary that maps between words and ids. ''' class Dictionary(object): def __init__(self, unknown_token=None): self.str2idx = {} self.idx2str = [] self.accept_new = True self.unknown_token = None self.unknown_id = None if unknown_token != None: self.set_unknown_token...
{ "repo_name": "luheng/deep_srl", "path": "python/neural_srl/shared/dictionary.py", "copies": "1", "size": "1472", "license": "apache-2.0", "hash": 8799901869687968000, "line_mean": 26.2592592593, "line_max": 124, "alpha_frac": 0.6080163043, "autogenerated": false, "ratio": 3.330316742081448, "c...
""" Bid REST Endpoints """ from decimal import Decimal from flask import g from flask_restful import Resource, abort, reqparse, fields, marshal from penelophant import crud, auther from penelophant.models.Bid import Bid as Bid_model from penelophant.helpers.auction import get_auction_by_id_or_abort class BidAuction(R...
{ "repo_name": "kevinoconnor7/penelophant", "path": "penelophant/api/bid.py", "copies": "1", "size": "2205", "license": "apache-2.0", "hash": 6132344443501912000, "line_mean": 25.5662650602, "line_max": 82, "alpha_frac": 0.6276643991, "autogenerated": false, "ratio": 3.335854765506808, "config_t...
"""BIDSLayout class.""" import os import json import re from collections import defaultdict from io import open from functools import partial, lru_cache from itertools import chain import copy import warnings import enum import difflib import sqlalchemy as sa from bids_validator import BIDSValidator from ..utils impo...
{ "repo_name": "INCF/pybids", "path": "bids/layout/layout.py", "copies": "1", "size": "55524", "license": "mit", "hash": -3942655823551650300, "line_mean": 41.5145482389, "line_max": 104, "alpha_frac": 0.5717707658, "autogenerated": false, "ratio": 4.715814506539833, "config_test": true, "has_...
"""BIDS-StatsModels functionality.""" import json from collections import namedtuple, OrderedDict from itertools import chain import numpy as np import pandas as pd from bids.layout import BIDSLayout from bids.utils import matches_entities, convert_JSON from bids.variables import (BIDSVariableCollection, SparseRunVa...
{ "repo_name": "INCF/pybids", "path": "bids/analysis/analysis.py", "copies": "1", "size": "18129", "license": "mit", "hash": 1442345256971769000, "line_mean": 39.0198675497, "line_max": 81, "alpha_frac": 0.606652325, "autogenerated": false, "ratio": 4.65681993321346, "config_test": false, "has...
# BIG BANG - COUNTDOWN # Import modules import mcpi.minecraft as minecraft import mcpi.block as block import time #import RPi.GPIO as GPIO import anyio.GPIO as GPIO # GPIO pins on breadboard BANG = 15 # Setup mc = minecraft.Minecraft.create() GPIO.setmode(GPIO.BCM) # use broadcom GPIO numbers GPIO.setup(BANG, GPI...
{ "repo_name": "whaleygeek/mc_bigbang", "path": "countdown.py", "copies": "1", "size": "1067", "license": "mit", "hash": 420281806466949060, "line_mean": 22.1956521739, "line_max": 92, "alpha_frac": 0.6138706654, "autogenerated": false, "ratio": 2.7642487046632125, "config_test": false, "has_n...
# BIG BANG - STUDENT # Import modules import mcpi.minecraft as minecraft import mcpi.block as block import time import RPi.GPIO as GPIO ####import pygame import time # GPIO pins on breadboard BUTTON = 4 LED = 15 # Setup mc = minecraft.Minecraft.create() GPIO.setmode(GPIO.BCM) # use broadcom GPIO numbers GPIO.set...
{ "repo_name": "whaleygeek/mc_bigbang", "path": "sensors.py", "copies": "1", "size": "1141", "license": "mit", "hash": -4074451226725877000, "line_mean": 22.7708333333, "line_max": 93, "alpha_frac": 0.6424189308, "autogenerated": false, "ratio": 2.7965686274509802, "config_test": false, "has_n...
# BIG DATA TEST import numpy as np import pickle A1 = np.load('../../data/A1_matrix.npy') A2 = np.load('../../data/A2_matrix.npy') A3 = np.load('../../data/A3_matrix.npy') vocabulary = np.load('../../data/vocabulary_list.npy') fD_dictionary = pickle.load(open('../fD_pickled', "rb")) fD_list = [] for item in voc...
{ "repo_name": "S-E-D-A/SEDA-ML-Summarization", "path": "Summary_Generation/testcases/big_data_test.py", "copies": "1", "size": "1267", "license": "apache-2.0", "hash": 1807243419946409700, "line_mean": 19.435483871, "line_max": 87, "alpha_frac": 0.6037884767, "autogenerated": false, "ratio": 2.43...
#big imports from drapache import dbapi import sys name = 'templates' __doc__ = "Functions for using jinja templates hosted on dropbox" def build(env,path): self = env.get_new_module(path+'.'+name) #no submodules @env.privileged def _render_template_to_string(path,with_data): sys.stderr.write("foobar\n"...
{ "repo_name": "louissobel/Drapache", "path": "drapache/dbpy/builtins/dbpy/templates.py", "copies": "1", "size": "1330", "license": "mit", "hash": -1745789290103996000, "line_mean": 25.0980392157, "line_max": 89, "alpha_frac": 0.7052631579, "autogenerated": false, "ratio": 3.21256038647343, "con...
"""bigint Revision ID: 4d9c223a796d Revises: ca7b124852b1 Create Date: 2019-06-21 20:35:48.936858 """ # revision identifiers, used by Alembic. revision = "4d9c223a796d" down_revision = "ca7b124852b1" from alembic import op import sqlalchemy as sa def upgrade(): # ### commands auto generated by Alembic - pleas...
{ "repo_name": "DBeath/flask-feedrsub", "path": "migrations/versions/4d9c223a796d_bigint.py", "copies": "1", "size": "13907", "license": "mit", "hash": 3275013370852891000, "line_mean": 23.4841549296, "line_max": 84, "alpha_frac": 0.5259221975, "autogenerated": false, "ratio": 3.7924734115080447, ...
# BIGINT,VARCHAR(65535),CHAR(2),DATE,TIME,DOUBLE PRECISION, DECIMAL(10,3), # BOOLEAN # col_bigint, col_vrchar, col_char, col_date, col_time, col_double, col_decimal, col_boolean import datetime import random import time import string import names from random import randint # col_bigint def genRandomBigInt(): ""...
{ "repo_name": "kfaraaz/tests", "path": "src/genAllTypesCSV.py", "copies": "1", "size": "3630", "license": "apache-2.0", "hash": 9184873422372814000, "line_mean": 26.5, "line_max": 92, "alpha_frac": 0.5129476584, "autogenerated": false, "ratio": 3.704081632653061, "config_test": false, "has_no...
#Big list of general changes I should make: #Organize code in a sane manner #I'm not a "real" python programmer, and I don't know the best organizations practices, #so everything is a mess right now #Exception handling #I let beautifulsoup/urllib throw everything for me. #Depending on what I decide proper us...
{ "repo_name": "pconner03/rapgenius.py", "path": "rapgenius.py", "copies": "1", "size": "7977", "license": "mit", "hash": -7611131767845625000, "line_mean": 22.3958944282, "line_max": 116, "alpha_frac": 0.6784505453, "autogenerated": false, "ratio": 2.916636197440585, "config_test": false, "ha...
# Big Monitoring Fabric Inline config script import requests import json import sys requests.packages.urllib3.disable_warnings() controller_ip = "" username = "" password = "" # do not modify cookie = "" bigchain_path = '/api/v1/data/controller/applications/bigchain/' def controller_request(method, path, data="",...
{ "repo_name": "bigswitch/sample-scripts", "path": "bmf/inline.py", "copies": "1", "size": "9034", "license": "mit", "hash": 8615491226223279000, "line_mean": 41.214953271, "line_max": 404, "alpha_frac": 0.6364843923, "autogenerated": false, "ratio": 3.251979841612671, "config_test": false, "h...
# Big Monitoring Fabric Inline measure rate on LAG and # adds member when rate exceeds threshold import requests import json import os import time requests.packages.urllib3.disable_warnings() # do not modify access_token = '' controller_ip = '10.2.19.102' controller_path = '/api/v1/data/controller/' bigchain_path = ...
{ "repo_name": "bigswitch/sample-scripts", "path": "bmf/lag_app.py", "copies": "1", "size": "3647", "license": "mit", "hash": 3200051875944871400, "line_mean": 36.5979381443, "line_max": 199, "alpha_frac": 0.6298327392, "autogenerated": false, "ratio": 3.4147940074906367, "config_test": false, ...
"""Big query client that wraps google's library""" #pylint: disable=super-on-old-class #pylint: disable=too-many-arguments from etl_framework.datastore_interfaces.datastore_interface import DatastoreInterface from gcloud.datastores.mixins.project import ProjectMixin from gcloud.datastores.mixins.client import ClientMi...
{ "repo_name": "pantheon-systems/etl-framework", "path": "gcloud/datastores/bigquery.py", "copies": "1", "size": "8190", "license": "mit", "hash": -554024042256447040, "line_mean": 27.838028169, "line_max": 85, "alpha_frac": 0.5681318681, "autogenerated": false, "ratio": 4.230371900826446, "conf...
"""BigQuery ibis client implementation.""" import datetime from collections import OrderedDict from typing import Optional, Tuple import google.cloud.bigquery as bq import ibis try: import ibis.common.exceptions as com except ImportError: import ibis.common as com import ibis.expr.datatypes as dt import ibi...
{ "repo_name": "ibis-project/ibis-bigquery", "path": "ibis_bigquery/client.py", "copies": "1", "size": "17145", "license": "apache-2.0", "hash": -4591639121937838000, "line_mean": 29.6160714286, "line_max": 79, "alpha_frac": 0.6286964129, "autogenerated": false, "ratio": 3.8745762711864407, "con...
"""Bigquery Loader""" #pylint: disable=relative-import #pylint: disable=too-many-function-args #pylint: disable=too-many-arguments #pylint: disable=abstract-class-instantiated from etl_framework.schemas.schema_interface import SchemaInterface from gcloud.datastores.bigquery import BigqueryClient class BigquerySchema(...
{ "repo_name": "pantheon-systems/etl-framework", "path": "gcloud/schemas/bigquery.py", "copies": "1", "size": "1476", "license": "mit", "hash": 4406891210627250000, "line_mean": 24.4482758621, "line_max": 68, "alpha_frac": 0.6233062331, "autogenerated": false, "ratio": 4.169491525423729, "config...
"""BigQuery public API.""" from typing import Optional import google.auth.credentials import google.cloud.bigquery # noqa: F401, fail early if bigquery is missing import pydata_google_auth from pydata_google_auth import cache from . import version as ibis_bigquery_version from .client import (BigQueryClient, BigQue...
{ "repo_name": "ibis-project/ibis-bigquery", "path": "ibis_bigquery/__init__.py", "copies": "1", "size": "8140", "license": "apache-2.0", "hash": 1498282788034672400, "line_mean": 32.2244897959, "line_max": 78, "alpha_frac": 0.622972973, "autogenerated": false, "ratio": 4.470071389346513, "confi...
"""BigQuery public API.""" from typing import Optional import google.auth.credentials import google.cloud.bigquery # noqa: F401, fail early if bigquery is missing import pydata_google_auth import ibis.common.exceptions as com from ibis.bigquery.client import BigQueryClient from ibis.bigquery.compiler import dialect...
{ "repo_name": "cpcloud/ibis", "path": "ibis/bigquery/api.py", "copies": "1", "size": "2216", "license": "apache-2.0", "hash": -1676047108688058400, "line_mean": 23.6222222222, "line_max": 79, "alpha_frac": 0.666967509, "autogenerated": false, "ratio": 3.762308998302207, "config_test": false, ...
"""BigQuery public API.""" from typing import Optional import google.auth.credentials import google.cloud.bigquery # noqa: F401, fail early if bigquery is missing import ibis.common.exceptions as com from client import TeradataClient # TODO make non local from compiler import dialect # TODO make non local from ib...
{ "repo_name": "GoogleCloudPlatform/professional-services-data-validator", "path": "third_party/ibis/ibis_teradata/api.py", "copies": "1", "size": "1486", "license": "apache-2.0", "hash": 2911265474403791400, "line_mean": 24.186440678, "line_max": 77, "alpha_frac": 0.6581426649, "autogenerated": fal...
"""bigquery sync Revision ID: 484c5d15ac06 Revises: b662c5bb00cc Create Date: 2019-05-31 16:22:55.821536 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = "484c5d15ac06" down_revision = "b662c5bb00cc" branch_labels = None depe...
{ "repo_name": "all-of-us/raw-data-repository", "path": "rdr_service/alembic/versions/484c5d15ac06_bigquery_sync.py", "copies": "1", "size": "2419", "license": "bsd-3-clause", "hash": -6679023180619707000, "line_mean": 34.5735294118, "line_max": 117, "alpha_frac": 0.6684580405, "autogenerated": fals...
"""BigScrewDipole.py - MD simulation of two screw dipoles annihilating. This example shows the annihilation of two screw dipoles. It can use the old or the new EMT potential, it can plot or not, and it can run in serial or in parallel. Usage: [mpi]python BigScrewDipole.py {newpot|oldpot} {plot|noplot} ...
{ "repo_name": "auag92/n2dm", "path": "Asap-3.8.4/Examples/BigScrewDipole.py", "copies": "1", "size": "6398", "license": "mit", "hash": 519142822377513860, "line_mean": 30.8308457711, "line_max": 237, "alpha_frac": 0.6242575805, "autogenerated": false, "ratio": 3.104318292091218, "config_test": ...
# big thanks to mads hagbarth lund for providing the code and of course to # https://code.google.com/p/dedafx-dev/source/browse/trunk/python/gui/qt/ColorWheel.py?r=3 # ben deda from whom this derived import sys import math import PySide.QtGui as QtGui import PySide.QtCore as QtCore class ColorWheelWidget(QtGui.QWid...
{ "repo_name": "nebukadhezer/rvColorUi", "path": "plugins/Python/qtColorWheel.py", "copies": "1", "size": "16593", "license": "apache-2.0", "hash": -2657192978189706000, "line_mean": 42.5538057743, "line_max": 139, "alpha_frac": 0.5724703188, "autogenerated": false, "ratio": 3.2961859356376637, ...
"""BigWig file operations using bwtool""" from modkit import Modkit from pyppl import Proc from diot import Diot from . import params, delefactory, procfactory Modkit().delegate(delefactory()) pBWExtract = proc_factory( desc = 'Extract features from bigwig file.', config = Diot(annotate = """ @description: E...
{ "repo_name": "pwwang/bioprocs", "path": "bioprocs/bwtool.py", "copies": "1", "size": "1676", "license": "mit", "hash": 593980978651870200, "line_mean": 31.2307692308, "line_max": 81, "alpha_frac": 0.7088305489, "autogenerated": false, "ratio": 3.0583941605839415, "config_test": false, "has_n...
#bike assignment class Bike(object): def __init__(self,price,max_speed): self.price = price self.max_speed = max_speed self.miles = 0 def displayInfo(self): print "Price: " + str(self.price) print "Max speed: " + self.max_speed print "Mileage: " + str(self.miles)...
{ "repo_name": "authman/Python201609", "path": "Nguyen_Ken/Assignments/Python OOP/bike.py", "copies": "1", "size": "1042", "license": "mit", "hash": -3436820045375726000, "line_mean": 21.170212766, "line_max": 44, "alpha_frac": 0.6353166987, "autogenerated": false, "ratio": 2.823848238482385, "c...
"""bikeshop URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
{ "repo_name": "BridgeCityBicycleCoop/workstand", "path": "bikeshop/urls.py", "copies": "1", "size": "1820", "license": "mit", "hash": 4666077995227646000, "line_mean": 34, "line_max": 81, "alpha_frac": 0.7159340659, "autogenerated": false, "ratio": 3.479923518164436, "config_test": false, "ha...
"""Bilayer graphene nanoribbon with zigzag edges""" import pybinding as pb import matplotlib.pyplot as plt from pybinding.repository import graphene from math import pi, sqrt pb.pltutils.use_style() def bilayer_graphene(): """Bilayer lattice in the AB-stacked form (Bernal-stacked)""" lat = pb.Lattice(a1=[gra...
{ "repo_name": "dean0x7d/pybinding", "path": "docs/examples/ribbons/bilayer_graphene.py", "copies": "1", "size": "1484", "license": "bsd-2-clause", "hash": 2461483538043743000, "line_mean": 30.5744680851, "line_max": 85, "alpha_frac": 0.5242587601, "autogenerated": false, "ratio": 2.55862068965517...
""" Bilinear-Attention-Transform and Non-Local Attention Paper: `Non-Local Neural Networks With Grouped Bilinear Attentional Transforms` - https://openaccess.thecvf.com/content_CVPR_2020/html/Chi_Non-Local_Neural_Networks_With_Grouped_Bilinear_Attentional_Transforms_CVPR_2020_paper.html Adapted from original code:...
{ "repo_name": "rwightman/pytorch-image-models", "path": "timm/models/layers/non_local_attn.py", "copies": "1", "size": "6147", "license": "apache-2.0", "hash": 1355347241861267000, "line_mean": 41.986013986, "line_max": 154, "alpha_frac": 0.6004555068, "autogenerated": false, "ratio": 2.975314617...
"""-bill crescendostats help returns a list of all crescendo commands""" import re import json import simplejson from utils import crescendoUtils from utils import dynamo import random import gif CRESCENDO_ENV = dynamo.getDynamoEnvironment() # social stats socialPosts = 0 publishedBlogs = 0 totalBlogs = 0 failedPosts...
{ "repo_name": "BobbyJohansen/BillBot", "path": "plugins/crescendostats.py", "copies": "1", "size": "11420", "license": "mit", "hash": -1178311060919610600, "line_mean": 30.2904109589, "line_max": 217, "alpha_frac": 0.6041155867, "autogenerated": false, "ratio": 3.7467191601049867, "config_test"...
"""Bill feed Revision ID: 247dbc4763f1 Revises: 138c92cb2218 Create Date: 2013-09-30 00:46:20.508375 """ # revision identifiers, used by Alembic. revision = '247dbc4763f1' down_revision = '138c92cb2218' import re from alembic import op import sqlalchemy as sa from sqlalchemy.types import SchemaType, TypeDecorator,...
{ "repo_name": "teampopong/pokr.kr", "path": "alembic/versions/247dbc4763f1_bill_feed.py", "copies": "2", "size": "4437", "license": "apache-2.0", "hash": 6290456031062540000, "line_mean": 26.0548780488, "line_max": 94, "alpha_frac": 0.5835023665, "autogenerated": false, "ratio": 3.682157676348547...
"""bill gif <search term> return a random result from the google gif search result for <search term>""" from urllib import quote import re import requests from random import shuffle def gif(searchterm, unsafe=False): searchterm = quote(searchterm) safe = "&safe=" if unsafe else "&safe=active" searchurl ...
{ "repo_name": "BobbyJohansen/BillBot", "path": "plugins/gif.py", "copies": "1", "size": "1038", "license": "mit", "hash": -4455024361198759400, "line_mean": 33.6, "line_max": 165, "alpha_frac": 0.6791907514, "autogenerated": false, "ratio": 3.13595166163142, "config_test": false, "has_no_keyw...
"""Bill Greene's credit scoring data.""" from statsmodels.datasets import utils as du __docformat__ = 'restructuredtext' COPYRIGHT = """Used with express permission of the original author, who retains all rights.""" TITLE = __doc__ SOURCE = """ William Greene's `Econometric Analysis` More information ca...
{ "repo_name": "jseabold/statsmodels", "path": "statsmodels/datasets/ccard/data.py", "copies": "4", "size": "1601", "license": "bsd-3-clause", "hash": -4533196525417256000, "line_mean": 25.2459016393, "line_max": 73, "alpha_frac": 0.6527170518, "autogenerated": false, "ratio": 3.8578313253012047, ...
"""Bill Greene's credit scoring data.""" __docformat__ = 'restructuredtext' COPYRIGHT = """Used with express permission of the original author, who retains all rights.""" TITLE = __doc__ SOURCE = """ William Greene's `Econometric Analysis` More information can be found at the web site of the text: http:...
{ "repo_name": "bzero/statsmodels", "path": "statsmodels/datasets/ccard/data.py", "copies": "25", "size": "1635", "license": "bsd-3-clause", "hash": -2438590061850389500, "line_mean": 26.7118644068, "line_max": 73, "alpha_frac": 0.6568807339, "autogenerated": false, "ratio": 3.793503480278422, "...
"""bill image <search term> return a random result from the google image search result for <search term>""" from urllib import quote import re import requests from random import shuffle def image(searchterm, unsafe=False): searchterm = quote(searchterm) safe = "&safe=" if unsafe else "&safe=active" searc...
{ "repo_name": "BobbyJohansen/BillBot", "path": "plugins/image.py", "copies": "1", "size": "1038", "license": "mit", "hash": 989278574945453300, "line_mean": 33.6, "line_max": 165, "alpha_frac": 0.683044316, "autogenerated": false, "ratio": 3.326923076923077, "config_test": false, "has_no_keyw...
""" Billing utils that require Django. """ import json from itertools import islice, chain from django.core import serializers from djorm_core.postgresql import server_side_cursors from go.billing.utils import JSONEncoder from go.billing.models import Transaction class TransactionSerializer(object): """ Helpe...
{ "repo_name": "praekelt/vumi-go", "path": "go/billing/django_utils.py", "copies": "1", "size": "5271", "license": "bsd-3-clause", "hash": -1182610634288326400, "line_mean": 29.2931034483, "line_max": 80, "alpha_frac": 0.6365016126, "autogenerated": false, "ratio": 4.338271604938272, "config_tes...
"""bill translate to <language-code> <message>""" from bs4 import BeautifulSoup import re from urllib import quote, unquote import urllib2 import requests def google(q): query = quote(q) url = "http://www.translate.google.com?q={0}".format(query) soup = BeautifulSoup(requests.get(url).text) answer = s...
{ "repo_name": "BobbyJohansen/BillBot", "path": "plugins/translate.py", "copies": "1", "size": "1896", "license": "mit", "hash": -8593293974937772000, "line_mean": 35.4615384615, "line_max": 144, "alpha_frac": 0.6534810127, "autogenerated": false, "ratio": 3.0384615384615383, "config_test": fals...
"""bill wiki <topic> returns a wiki link for <topic>""" import json import re from urllib import quote import sys import requests from bs4 import BeautifulSoup def wiki(searchterm): """return the top wiki search result for the term""" searchterm = quote(searchterm) url = "https://en.wikipedia.org/w/api.p...
{ "repo_name": "BobbyJohansen/BillBot", "path": "plugins/wiki.py", "copies": "1", "size": "1187", "license": "mit", "hash": 2453504015082513400, "line_mean": 26.6046511628, "line_max": 111, "alpha_frac": 0.6394271272, "autogenerated": false, "ratio": 3.353107344632768, "config_test": false, "h...
# Bimodal distribution (mixture of two 1d Gaussians) # Based on https://github.com/probml/pmtk3/blob/master/demos/bimodalDemo.m import numpy as np import matplotlib.pyplot as plt import os figdir = os.path.join(os.environ["PYPROBML"], "figures") def save_fig(fname): plt.savefig(os.path.join(figdir, fname)) ...
{ "repo_name": "probml/pyprobml", "path": "scripts/bimodal_dist_plot.py", "copies": "1", "size": "1407", "license": "mit", "hash": 5639750120470553000, "line_mean": 26.7142857143, "line_max": 76, "alpha_frac": 0.6652452026, "autogenerated": false, "ratio": 2.5628415300546448, "config_test": fals...
#BiMonBUPyCon - First meeting - 3/22/2015 #Iterables #Example 1 - Loop through a string #----------------------------------------------------------------------------------------- string = 'Hello World' for letter in string: print(letter) print() stop = input('Moving onto Ex. 2...') print() #----------------------...
{ "repo_name": "BU-PyCon/Meeting-1", "path": "Programs/iterables.py", "copies": "1", "size": "2711", "license": "mit", "hash": -1519410794797371400, "line_mean": 17.5684931507, "line_max": 90, "alpha_frac": 0.3246034674, "autogenerated": false, "ratio": 4.902350813743219, "config_test": false, ...
"""BiMPM.""" from keras.models import Model from keras.layers import Dense, Concatenate, Dropout from keras.layers import Bidirectional, LSTM from matchzoo.engine.param import Param from matchzoo.engine.param_table import ParamTable from matchzoo.engine.base_model import BaseModel from matchzoo.contrib.layers import ...
{ "repo_name": "faneshion/MatchZoo", "path": "matchzoo/contrib/models/bimpm.py", "copies": "1", "size": "6010", "license": "apache-2.0", "hash": 1633683735483953200, "line_mean": 39.3355704698, "line_max": 98, "alpha_frac": 0.5866888519, "autogenerated": false, "ratio": 3.9025974025974026, "conf...
# Binance # https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md # By Lari Taskula <lari@taskula.fi> from exchange import Exchange, CURRENCY class Binance(Exchange): name = "Binance" code = "binance" ticker = "https://www.binance.com/api/v1/ticker/24hr" discovery = "...
{ "repo_name": "nilgradisnik/coinprice-indicator", "path": "coin/exchanges/binance.py", "copies": "1", "size": "1764", "license": "mit", "hash": -8440312522566823000, "line_mean": 25.328358209, "line_max": 87, "alpha_frac": 0.5107709751, "autogenerated": false, "ratio": 3.769230769230769, "confi...
"""Binaries""" from __future__ import print_function from collections import defaultdict import sys def print_table(rows, headers=None, space_between_columns=4): """ Convenience method for printing a list of dictionary objects into a table. Automatically sizes the columns to be the maximum size of any en...
{ "repo_name": "amplifylitco/asiaq", "path": "bin/__init__.py", "copies": "1", "size": "1711", "license": "bsd-2-clause", "hash": 4394757159946991600, "line_mean": 40.7317073171, "line_max": 110, "alpha_frac": 0.6206896552, "autogenerated": false, "ratio": 4.309823677581864, "config_test": false...
"""BinarizationService URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='hom...
{ "repo_name": "acislab/HuMaIN_Microservices", "path": "OCRopyServices/BinarizationService/BinarizationService/urls.py", "copies": "1", "size": "1048", "license": "apache-2.0", "hash": -2296821606105719300, "line_mean": 39.3076923077, "line_max": 79, "alpha_frac": 0.7089694656, "autogenerated": fals...
import os import subprocess import tempfile ''' Module to 'unpack' an ext2 file system. We are taking a shortcut. We're using e2cp to copy files, but we're recreating the directories in the file system ourselves. We can get this information from the output of el2s. The second column displays the Ext2/linux mode flag...
{ "repo_name": "armijnhemel/binaryanalysis", "path": "src/bat/ext2.py", "copies": "1", "size": "2695", "license": "apache-2.0", "hash": -3263329017701341700, "line_mean": 38.0579710145, "line_max": 179, "alpha_frac": 0.5643784787, "autogenerated": false, "ratio": 4.114503816793893, "config_test"...
import os import subprocess import re import zlib import tempfile # method to process output of jffs2dump and read all the inodes from a JFFS2 file system. def readJFFS2Inodes(path, bigendian): # quick hack for systems that don't have /usr/sbin in $PATH (such as Debian and Ubuntu) unpackenv = os.environ.copy(...
{ "repo_name": "armijnhemel/binaryanalysis", "path": "src/bat/jffs2.py", "copies": "1", "size": "8411", "license": "apache-2.0", "hash": -8240353959233635000, "line_mean": 43.7393617021, "line_max": 159, "alpha_frac": 0.5583164903, "autogenerated": false, "ratio": 3.8231818181818182, "config_tes...
''' Binary Circles Problem 265 2N binary digits can be placed in a circle so that all the N-digit clockwise subsequences are distinct. For N=3, two such circular arrangements are possible, ignoring rotations: p265_BinaryCircles.gif For the first arrangement, the 3-digit subsequences, in clockwise order, are: 000, 00...
{ "repo_name": "bgwines/project-euler", "path": "src/solved/problem265.py", "copies": "1", "size": "2729", "license": "bsd-3-clause", "hash": -7116756031158577000, "line_mean": 26.8469387755, "line_max": 249, "alpha_frac": 0.5994869916, "autogenerated": false, "ratio": 3.0055066079295156, "confi...
"""binary classification count results""" __author__ = 'thor' import pandas as pd import itertools def equality_counts(df): """ returns a Series indexed by every True/False combination of observed equalities of the columns of df, along with the count of this combination. Example: criteria ...
{ "repo_name": "thorwhalen/ut", "path": "stats/classification/analysis.py", "copies": "1", "size": "1238", "license": "mit", "hash": -7759343297142603000, "line_mean": 34.3714285714, "line_max": 94, "alpha_frac": 0.6082390953, "autogenerated": false, "ratio": 3.856697819314642, "config_test": fa...
"""Binary classification""" from math import log,e from ..preprocess.util import * from .lr import LR class LogisticRegression(): def fit(self,X,Y): LR.fit(self,X,Y) self.classes=set(Y) if len(self.classes)>2: raise ValueError("This problem is for binary classification expected only 2 classes but given %d"%(l...
{ "repo_name": "konemshad/ML", "path": "ml/GLM/binary.py", "copies": "2", "size": "1102", "license": "mit", "hash": -8724057295309407000, "line_mean": 22.9565217391, "line_max": 121, "alpha_frac": 0.6188747731, "autogenerated": false, "ratio": 2.465324384787472, "config_test": false, "has_no_k...
"""Binary class.""" import os from subprocess import CalledProcessError from subprocess import check_output from subprocess import STDOUT class Binary(object): # pylint: disable=too-few-public-methods """Represent Binary structure.""" def __init__(self, path): # type: (str) -> None """Binary...
{ "repo_name": "proggga/hardest", "path": "hardest/binary.py", "copies": "1", "size": "2405", "license": "mit", "hash": -7094412527437831000, "line_mean": 32.4027777778, "line_max": 79, "alpha_frac": 0.5422037422, "autogenerated": false, "ratio": 4.279359430604982, "config_test": false, "has_n...
"""Binary clock example using BlinkyTape.py Displays UNIX epoch time using 32 LEDs (white), localtime hours using 6 LEDs (red), localtime minutes using 6 LEDs (green), localtime seconds using 6 LEDs (blue) """ from BlinkyTape import BlinkyTape import time from datetime import datetime, timedelta import optparse ...
{ "repo_name": "jpsingleton/BlinkyTape_Python", "path": "binary_clock.py", "copies": "1", "size": "1655", "license": "mit", "hash": 2942346414183003600, "line_mean": 29.0909090909, "line_max": 93, "alpha_frac": 0.6719033233, "autogenerated": false, "ratio": 3.031135531135531, "config_test": fals...
""" Binary copy plugin for PubTal Copyright (c) 2003 Florian Schulze (http://proff.crowproductions.com/) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must reta...
{ "repo_name": "owlfish/pubtal", "path": "lib/pubtal/plugins/binaryCopy.py", "copies": "1", "size": "2830", "license": "bsd-3-clause", "hash": -5797872413842391000, "line_mean": 35.2820512821, "line_max": 135, "alpha_frac": 0.7572438163, "autogenerated": false, "ratio": 3.8980716253443526, "conf...
""" binary downloader """ import hashlib from clangd import glog as log import json import platform import os import tarfile from shutil import rmtree from sys import platform as sys_platform try: from urllib.request import urlretrieve except ImportError: from urllib import urlretrieve try: from urllib.requ...
{ "repo_name": "Chilledheart/vim-clangd", "path": "python/clangd/binary_downloader.py", "copies": "1", "size": "5280", "license": "bsd-3-clause", "hash": -7623736132752032000, "line_mean": 34.6756756757, "line_max": 101, "alpha_frac": 0.5676136364, "autogenerated": false, "ratio": 3.99394856278366...
"""Binary encoding""" import pandas as pd from sklearn.base import BaseEstimator, TransformerMixin import category_encoders as ce __author__ = 'willmcginnis' class BinaryEncoder(BaseEstimator, TransformerMixin): """Binary encoding for categorical variables, similar to onehot, but stores categories as binary bi...
{ "repo_name": "wdm0006/categorical_encoding", "path": "category_encoders/binary.py", "copies": "2", "size": "5050", "license": "bsd-3-clause", "hash": -6990368688457042000, "line_mean": 31.5806451613, "line_max": 123, "alpha_frac": 0.6017821782, "autogenerated": false, "ratio": 4.095701540957015,...
# Binary EXpanding TREE # (for those not familiar with ESRI trivia) # The spatial index tree behind the SBN file format from spatialindex import Bin, Feature from math import log, ceil class Node: id = None tree = None split = None # "x" or "y" based on axis of cutting coord righttop = None # child n...
{ "repo_name": "drwelby/hasbeen", "path": "bextree.py", "copies": "1", "size": "10564", "license": "mit", "hash": 2465961283147704000, "line_mean": 32.0125, "line_max": 115, "alpha_frac": 0.5010412722, "autogenerated": false, "ratio": 3.9329858525688755, "config_test": false, "has_no_keywords"...
"""Binary for training translation models and decoding from them. Running this program without --decode will download the WMT corpus into the directory specified as --data_dir and tokenize it in a very basic way, and then start training a model saving checkpoints to --train_dir. Running with --decode starts an intera...
{ "repo_name": "neuralconcept/DrWhoAI", "path": "DeepLearning/Seq2Seq/AIBot.py", "copies": "1", "size": "16804", "license": "apache-2.0", "hash": -7750954153705197000, "line_mean": 44.912568306, "line_max": 589, "alpha_frac": 0.6479409664, "autogenerated": false, "ratio": 3.4633140972794725, "co...
#binaryGrayConvert.py #two functions to convert to and from gray codes import functools def fill(b, width=0): return b if len(b) >= width else '0' * (width - len(b)) + b def to_bin(x): return bin(x)[2:] def from_bin(s): return int(s, 2) def bin_wrapper(f): @functools.wraps(f) def wrapper(x): ...
{ "repo_name": "rec/led", "path": "led/Binary.py", "copies": "1", "size": "1230", "license": "artistic-2.0", "hash": -330333089120080200, "line_mean": 23.6, "line_max": 66, "alpha_frac": 0.6056910569, "autogenerated": false, "ratio": 2.86046511627907, "config_test": false, "has_no_keywords": f...
"""Binary heap data structure. Heap is the binary tree with the following properties: 1. parent is not greater (min-heap) or not less (max-heap) than it's children. 2. all levels (except of deepest) are fully filled 3. leaves are filled left to right. Example of min-heap: 0 ...
{ "repo_name": "vadimadr/python-algorithms", "path": "algorithms/structures/heap.py", "copies": "1", "size": "4439", "license": "mit", "hash": 7468362912496227000, "line_mean": 30.4822695035, "line_max": 78, "alpha_frac": 0.5154314035, "autogenerated": false, "ratio": 3.8633594429939078, "config...
# Binary heap implementation based on Sedgewick and Wayne's # IndexMaxPQ.java: http://algs4.cs.princeton.edu/24pq/IndexMaxPQ.java import array class Heap: def __init__(self): self.pq = array.array('i', [-1]) self.qp = array.array('i', [-1]) self.keys = array.array('f', [-1]) s...
{ "repo_name": "jdugge/GridToTIN", "path": "heap.py", "copies": "1", "size": "2391", "license": "mit", "hash": -8130825532297636000, "line_mean": 24.7204301075, "line_max": 75, "alpha_frac": 0.4688414889, "autogenerated": false, "ratio": 3.2008032128514055, "config_test": false, "has_no_keywor...
# Binary heap implementation based on Sedgewick and Wayne's # IndexMaxPQ.java: http://algs4.cs.princeton.edu/24pq/IndexMaxPQ.java import array class Heap: def __init__(self): self.pq = array.array('i', [-1]) self.qp = array.array('i', [-1]) self.keys = array.array('f', [-1]) self...
{ "repo_name": "umeier/GridToTIN", "path": "grid2tin/heap.py", "copies": "1", "size": "1921", "license": "mit", "hash": 2770184254132688400, "line_mean": 23.0125, "line_max": 69, "alpha_frac": 0.4825611661, "autogenerated": false, "ratio": 3.1491803278688524, "config_test": false, "has_no_keyw...
"""Binary Heap Implementation""" class BinHeap: def __init__(self): """Initialize binary heap.""" # list of heap items # Children of some node p are left = 2p, right = 2p+1 # left children are <= # Parent of node at pos n is n//2. self.heapList = [0] # current size of heap self....
{ "repo_name": "carlb15/Python", "path": "binary_heap.py", "copies": "1", "size": "3197", "license": "mit", "hash": 640740530903864300, "line_mean": 27.0438596491, "line_max": 60, "alpha_frac": 0.6152643103, "autogenerated": false, "ratio": 3.536504424778761, "config_test": false, "has_no_keyw...
# Binary image adaptive threshold import cv2 from . import print_image from . import plot_image from . import fatal_error def adaptive_threshold(img, maxValue, thres_type, object_type, device, debug=None): """Creates a binary image from a grayscaled image using adaptive thresholding Inputs: img ...
{ "repo_name": "jshoyer/plantcv", "path": "plantcv/adaptive_threshold.py", "copies": "2", "size": "2240", "license": "mit", "hash": 5269615434504975000, "line_mean": 31.4637681159, "line_max": 90, "alpha_frac": 0.6236607143, "autogenerated": false, "ratio": 3.714759535655058, "config_test": fals...
# Binary image auto threshold from __future__ import division, print_function import cv2 import math import numpy as np from . import print_image from . import plot_image def _detect_peaks(x, mph=None, mpd=1, threshold=0, edge='rising', kpsh=False, valley=False, show=False, ax=None): """Marcos Duarte, https://gi...
{ "repo_name": "AntonSax/plantcv", "path": "plantcv/triangle_auto_threshold.py", "copies": "2", "size": "10651", "license": "mit", "hash": 8527953842168864000, "line_mean": 34.861952862, "line_max": 113, "alpha_frac": 0.5777861234, "autogenerated": false, "ratio": 3.336779448621554, "config_test...
# Binary image auto threshold import cv2 from . import print_image from . import plot_image def otsu_auto_threshold(img, maxValue, object_type, device, debug=None): """Creates a binary image from a grayscaled image using Otsu's thresholding. Inputs: img = img object, grayscale maxValue = ...
{ "repo_name": "jshoyer/plantcv", "path": "plantcv/otsu_auto_threshold.py", "copies": "2", "size": "1666", "license": "mit", "hash": 960066751998877600, "line_mean": 29.8518518519, "line_max": 82, "alpha_frac": 0.6254501801, "autogenerated": false, "ratio": 3.8036529680365296, "config_test": fal...
# Binary image threshold device import cv2 from . import print_image from . import plot_image from . import fatal_error def binary_threshold(img, threshold, maxValue, object_type, device, debug=None): """Creates a binary image from a gray image based on the threshold value. Inputs: img = img obj...
{ "repo_name": "AntonSax/plantcv", "path": "plantcv/binary_threshold.py", "copies": "2", "size": "1873", "license": "mit", "hash": 771589304540680600, "line_mean": 35.0192307692, "line_max": 97, "alpha_frac": 0.6086492258, "autogenerated": false, "ratio": 3.814663951120163, "config_test": false,...
# Binary indexed tree or fenwick tree # Space Complexity: O(N) for declaring another array of N=size num_of_elements # Time Complexity: O(logN) for each operation(update and query as well) # original array for storing values for later lookup # Part of Cosmos by OpenGenus Foundation array=[] # array to store cumulative ...
{ "repo_name": "Deepak345/al-go-rithms", "path": "data_structures/binary_indexed_tree/Python/FenwickTree.py", "copies": "9", "size": "1685", "license": "mit", "hash": -7564958328275724000, "line_mean": 30.2037037037, "line_max": 105, "alpha_frac": 0.706231454, "autogenerated": false, "ratio": 2.85...
"""Binary indexed tree, supports point updates and range sum queries in O(log n) time. Note that BIT uses 1-based indexing so for all the operations that take index as argument 1 is the minimum value. It should also be noted that when BIT is generated the first item in the given sequence is discarded. Time complexity ...
{ "repo_name": "niemmi/algolib", "path": "algolib/binary_indexed_tree/bit.py", "copies": "1", "size": "5106", "license": "bsd-3-clause", "hash": 2909840739795605500, "line_mean": 22.6388888889, "line_max": 94, "alpha_frac": 0.5554249902, "autogenerated": false, "ratio": 3.8594104308390023, "conf...
"""Binary integer addition Arrays contain individual bits This procedure assumes both arrays are of equal length Copyright 2016, Sjors van Gelderen """ def binary_integer_addition(_array_0, _array_1): print("Binary integer addition of {} and {}".format(_array_0, _array_1)) result = [] overflow = False ...
{ "repo_name": "SjorsVanGelderen/Graduation", "path": "python_3/algorithms/binary_integer_addition.py", "copies": "1", "size": "1196", "license": "mit", "hash": -7007648677325499000, "line_mean": 25.5777777778, "line_max": 76, "alpha_frac": 0.6287625418, "autogenerated": false, "ratio": 4, "conf...
"Binary Join module." from progressivis.core.slot import SlotDescriptor from .table import Table from .module import TableModule from .join import join from .dshape import dshape_join from collections import OrderedDict class Paste(TableModule): """ Binary join module to join two tables and return a third on...
{ "repo_name": "jdfekete/progressivis", "path": "progressivis/table/paste.py", "copies": "1", "size": "2786", "license": "bsd-2-clause", "hash": 3680735340693988400, "line_mean": 41.2121212121, "line_max": 80, "alpha_frac": 0.5951184494, "autogenerated": false, "ratio": 3.685185185185185, "confi...
"Binary Join module." from progressivis.core.utils import Dialog, indices_len from progressivis.core.slot import SlotDescriptor from .table import Table from .module import TableModule from .join import join, join_start, join_cont, join_reset class BinJoin(TableModule): """ Binary join module to join two tab...
{ "repo_name": "jdfekete/progressivis", "path": "progressivis/table/bin_join.py", "copies": "1", "size": "2766", "license": "bsd-2-clause", "hash": -6347497993679903000, "line_mean": 36.8904109589, "line_max": 82, "alpha_frac": 0.5842371656, "autogenerated": false, "ratio": 4.085672082717873, "c...
# Binary Matrix Fractals using iteration method # FB - 201003184 from PIL import Image imgx = 512 imgy = 512 image = Image.new("RGB", (imgx, imgy)) ### Sierpinski triangle ##bm = [[1,0], \ ## [1,1]] # Sierpinski square bm = [[1,1,1], \ [1,0,1], \ [1,1,1]] ### Snowflake ##bm = [[1,1,0], \ ## [1,...
{ "repo_name": "ActiveState/code", "path": "recipes/Python/577126_Binary_Matrix_Fractals_using/recipe-577126.py", "copies": "1", "size": "1102", "license": "mit", "hash": 6971647756788364000, "line_mean": 19.0363636364, "line_max": 57, "alpha_frac": 0.4246823956, "autogenerated": false, "ratio": 2...
# Binary matrix fractals using recursion # FB - 201003265 from PIL import Image imgx = 512 imgy = 512 image = Image.new("L", (imgx, imgy)) ### Sierpinski triangle ##bm = [[1,0], \ ## [1,1]] # Sierpinski square bm = [[1,1,1], \ [1,0,1], \ [1,1,1]] ### Vicsek fractal ##bm = [[1,0,1], \ ## [0,1,0]...
{ "repo_name": "ActiveState/code", "path": "recipes/Python/577157_Binary_Matrix_Fractals_using/recipe-577157.py", "copies": "1", "size": "1046", "license": "mit", "hash": 2839928265963274000, "line_mean": 17.6785714286, "line_max": 75, "alpha_frac": 0.4445506692, "autogenerated": false, "ratio": 2...
# Binary Matrix IFS Fractals # FB - 201003173 from PIL import Image import random # image size imgx = 512 imgy = 512 image = Image.new("L", (imgx, imgy)) ### Sierpinski triangle ##bm = [[1,0], \ ## [1,1]] ### Sierpinski square ##bm = [[1,1,1], \ ## [1,0,1], \ ## [1,1,1]] ### Snowflake ##bm = [[1,1,0],...
{ "repo_name": "ActiveState/code", "path": "recipes/Python/577125_Binary_Matrix_IFS_Fractals/recipe-577125.py", "copies": "1", "size": "1038", "license": "mit", "hash": 308234432874608960, "line_mean": 16.8965517241, "line_max": 71, "alpha_frac": 0.4335260116, "autogenerated": false, "ratio": 2.00...
"""Binary Min Heap.""" class BinHeap(object): """Min Heap Data Structure.""" def __init__(self, iterable=[]): """Initialize an empty min heap.""" if not isinstance(iterable, list): raise TypeError( 'None or list types are the only valid arguments supported.') ...
{ "repo_name": "Bonanashelby/data_structures", "path": "src/binheap.py", "copies": "1", "size": "1745", "license": "mit", "hash": -526026804250305300, "line_mean": 33.9, "line_max": 78, "alpha_frac": 0.5277936963, "autogenerated": false, "ratio": 4.406565656565657, "config_test": false, "has_n...
"""Binary Minimization """ import copy import numpy as np from libact.base.dataset import Dataset from libact.base.interfaces import QueryStrategy, ContinuousModel from libact.utils import inherit_docstring_from, seed_random_state, zip from libact.models.multilabel import BinaryRelevance, DummyClf class BinaryMinim...
{ "repo_name": "ntucllab/libact", "path": "libact/query_strategies/multilabel/binary_minimization.py", "copies": "1", "size": "2573", "license": "bsd-2-clause", "hash": -7095860874748604000, "line_mean": 30.3780487805, "line_max": 87, "alpha_frac": 0.6342790517, "autogenerated": false, "ratio": 3....
"""Binary Neural Network (BNN) Operators""" from __future__ import absolute_import as _abs import tvm from .. import tag from ..util import simplify, get_const_int def binarize_pack(data, axis=None, name="PackedInput"): """Binarization and bit-packing along a certain axis. Parameters ---------- data ...
{ "repo_name": "phisiart/tvm", "path": "topi/python/topi/nn/bnn.py", "copies": "1", "size": "2539", "license": "apache-2.0", "hash": -676248446914677900, "line_mean": 31.1392405063, "line_max": 85, "alpha_frac": 0.5628200079, "autogenerated": false, "ratio": 3.521497919556172, "config_test": fal...
"""Binary node.""" import functools import numpy as np @functools.total_ordering class Bnode: """Binary node. In binary segmentation, each segment [start, end) is a binary node. """ def __init__(self, start, end, val, left=None, right=None, parent=None): self.start = start self.end ...
{ "repo_name": "deepcharles/ruptures", "path": "src/ruptures/utils/bnode.py", "copies": "1", "size": "1127", "license": "bsd-2-clause", "hash": -8670810378255522000, "line_mean": 24.6136363636, "line_max": 76, "alpha_frac": 0.5545696539, "autogenerated": false, "ratio": 3.926829268292683, "confi...
"""Binary (Protobuf) formatting utilities.""" import binascii import numbers import logging import google.protobuf.message from google.protobuf.internal.decoder import _DecodeVarint from google.protobuf.internal import encoder from openxc.formats.base import VehicleMessageStreamer from openxc import openxc_pb2 LOG...
{ "repo_name": "openxc/openxc-python", "path": "openxc/formats/binary.py", "copies": "1", "size": "19940", "license": "bsd-3-clause", "hash": 2879960832998670300, "line_mean": 47.0481927711, "line_max": 109, "alpha_frac": 0.649448345, "autogenerated": false, "ratio": 4.102880658436214, "config_t...
"""binary representation modes used for a StarStruct object.""" import sys import enum @enum.unique class Mode(enum.Enum): """The StarStruct modes match the modes supported by struct.pack/unpack.""" Native = '=' Little = '<' Big = '>' Network = '!' def to_byteorder(self): """ ...
{ "repo_name": "sprout42/NamedStruct", "path": "starstruct/modes.py", "copies": "2", "size": "1137", "license": "mit", "hash": 2752121894268897000, "line_mean": 26.7317073171, "line_max": 79, "alpha_frac": 0.5549692172, "autogenerated": false, "ratio": 4.38996138996139, "config_test": false, "...
"""Binary search algorithm Complexity: O(log n) Copyright 2016, Sjors van Gelderen """ def binary_search(_target, _collection): if not _collection: print("Error, list is empty!") print("Binary search for {} on {}".format(_target, _collection)) # Sort the collection for the binary search _c...
{ "repo_name": "SjorsVanGelderen/Graduation", "path": "python_3/algorithms/binary_search.py", "copies": "1", "size": "1083", "license": "mit", "hash": 7268605692533675000, "line_mean": 24.1860465116, "line_max": 68, "alpha_frac": 0.5586334257, "autogenerated": false, "ratio": 3.996309963099631, ...
# Binary search algorithms directly from the Python 2.42 distribution # Blender doesn't bother to include this useful and well tested # module in it's bundled Python version for some reason. # - Joe Greenawalt (jsgreenawalt@gmail.com) # # Python 2.4.2 License and Bisect.py source code below this point ''' A. HISTORY...
{ "repo_name": "pchan126/Blender_DTS_30", "path": "DTSPython/pyBisect.py", "copies": "1", "size": "8806", "license": "mit", "hash": 7228294985839150000, "line_mean": 36.9568965517, "line_max": 92, "alpha_frac": 0.6305927777, "autogenerated": false, "ratio": 3.6569767441860463, "config_test": fal...
# binary search challenge # -- given a list of ints L, determine if a target t is in the list class BinaryList: def __init__(self): self.bl = [] def __insert_element(self, l): if(isinstance(l, int)): self.bl.append(l) self.bl = sorted(self.bl, key=int) else: raise(TypeError("element must be an int")) ...
{ "repo_name": "cripplet/jobs", "path": "bentley/code/begpoxsmjp.py", "copies": "1", "size": "1502", "license": "mit", "hash": 115265227209525540, "line_mean": 22.1076923077, "line_max": 67, "alpha_frac": 0.5938748336, "autogenerated": false, "ratio": 2.4502446982055464, "config_test": false, ...
'''BinarySearch class inheriting from List and having a search function(recursive) containing an argument''' class BinarySearch(list): def __init__(self, a, b): '''a is the lenght of the list and b is the step or difference between consecutive values''' self.a = a self.b = b def search(self, search_value): '...
{ "repo_name": "anthonyndunguwanja/Anthony-Ndungu-bootcamp-17", "path": "Day4/Binary_Search.py", "copies": "1", "size": "1267", "license": "mit", "hash": -2073009966313576400, "line_mean": 37.3939393939, "line_max": 108, "alpha_frac": 0.6961325967, "autogenerated": false, "ratio": 3.5, "config_t...
# BinarySearchEx.py # By: Abdullahi Farah # Program will use binary search to find a number btween 1 and 100 from random import randint def main(): arrOfNumb = randint(1,9) minx = 1 maxx = 9 average = int((maxx + minx)/2) guess = average print("numb is = "+str(arrOfNumb)+" Guess = "+str(guess) + " min = "+str(...
{ "repo_name": "Abdullahif14688/hello-world", "path": "BinarySearchEx.py", "copies": "1", "size": "1092", "license": "mit", "hash": -860407103567473400, "line_mean": 32.1212121212, "line_max": 104, "alpha_frac": 0.6456043956, "autogenerated": false, "ratio": 2.5694117647058823, "config_test": fa...
"""Binary search implementation. Expected performance O(lg(n))""" def search(array, element): """ Searches array for an element and returns its index Args: array: searched array element: element to search for Returns: int: element index if element is found, -1 otherwise """ ...
{ "repo_name": "litvinchuck/python-scripts", "path": "algorithms/binary_search.py", "copies": "2", "size": "1311", "license": "mit", "hash": 1539876552378824200, "line_mean": 28.7954545455, "line_max": 89, "alpha_frac": 0.6338672769, "autogenerated": false, "ratio": 3.9969512195121952, "config_t...
# Binary search inorder traversal asked by Amazon # struct Node # { # int data; # Node *right.*left,*random # } # Tree should be in-order traversal and random node should keep the in-order transversal path. class Stack: def __init__(self): self.stack = [0]*10 self.head = -1 self.numEle = 0 def push(self...
{ "repo_name": "smenon8/AlgDataStruct_practice", "path": "practice_problems/PracticeTree.py", "copies": "1", "size": "2069", "license": "mit", "hash": 1733887893763410700, "line_mean": 19.0970873786, "line_max": 94, "alpha_frac": 0.6631222813, "autogenerated": false, "ratio": 2.6289707750952984, ...
#BinarySearch #Asymptotic complexity: O(log(len(n))) #Python version 2.7 #Suppose we know something about the order in which elemnets are stored #e.g. a list of integer stored in ascending order. def search(L, e): """Assume that L is a list, elements ordered in ascending order Returns True if e is in L and False ot...
{ "repo_name": "pparacch/PlayingWithPython", "path": "computationAndProgrammingUsingPython/src/algorithms/binarySearch.py", "copies": "1", "size": "1112", "license": "mit", "hash": -9220738799755587000, "line_mean": 24.8604651163, "line_max": 71, "alpha_frac": 0.6798561151, "autogenerated": false, ...
# Binary Search class Solution: def arrangeCoins(self, n: int) -> int: left, right = 0, n while left <= right: k = (right + left) // 2 curr = k * (k + 1) // 2 if curr == n: return k if n < curr: right = k - 1 ...
{ "repo_name": "saisankargochhayat/algo_quest", "path": "leetcode/441. Arranging Coins/soln.py", "copies": "1", "size": "1044", "license": "apache-2.0", "hash": 3208696725533102000, "line_mean": 25.1, "line_max": 55, "alpha_frac": 0.3946360153, "autogenerated": false, "ratio": 3.1732522796352582, ...
"""Binary search tree example Copyright 2016, Sjors van Gelderen """ # Binary Search Tree Logic class BST: def __init__(self, _parent, _key): self.parent = _parent self.left = None self.right = None self.key = _key # Complexity: O(h) where h = BST height def insert(self, _v...
{ "repo_name": "SjorsVanGelderen/Graduation", "path": "python_3/data_structures/binary_search_tree.py", "copies": "1", "size": "2215", "license": "mit", "hash": -6804820727162647000, "line_mean": 28.9324324324, "line_max": 94, "alpha_frac": 0.4893905192, "autogenerated": false, "ratio": 4.23518164...
# BinarySearchTree implementation # Reference: http://stackoverflow.com/questions/2598437/how-to-implement-a-binary-tree-in-python class TreeNode: def __init__(self, key): self.key = key self.left = None self.right = None self.parent = None def addLeftChild(self, keyOrNode): newNode = keyOrNode if isinst...
{ "repo_name": "honghaoz/CrackingTheCodingInterview", "path": "Cracking the Coding Interview/Chapter 4_Trees and Graphs/BinaryTree.py", "copies": "1", "size": "2599", "license": "mit", "hash": -9079788325415781000, "line_mean": 23.2990654206, "line_max": 96, "alpha_frac": 0.7025779146, "autogenerate...
""" Binary Search Tree implemented with embedded lists. Node format: [value, left child, right child]. Leaf nodes look like: [value, [], []]. """ __author__ = "Caleb Madrigal" __date__ = "2015-02-25" def node_value(node, new_value=None): """ Set value: node_value(node, value); Get value: node_value(node). """ ...
{ "repo_name": "calebmadrigal/algorithms-in-python", "path": "binary_search_tree.py", "copies": "1", "size": "6175", "license": "mit", "hash": 533107839594138300, "line_mean": 32.7431693989, "line_max": 99, "alpha_frac": 0.6291497976, "autogenerated": false, "ratio": 3.3523344191096633, "config_...
# Binary Search Tree : Insertion # Developer: Murillo Grubler # https://www.hackerrank.com/challenges/binary-search-tree-insertion/problem # Time complexity: O(log N) class Node: def __init__(self, info): self.info = info self.left = None self.right = None self.level = None ...
{ "repo_name": "Murillo/Hackerrank-Algorithms", "path": "Data Structures/Trees/binary-search-tree-insertion.py", "copies": "1", "size": "1558", "license": "mit", "hash": 2408376460641458700, "line_mean": 26.350877193, "line_max": 76, "alpha_frac": 0.5032092426, "autogenerated": false, "ratio": 4.1...
#Binary Search Tree is based off the list-based tree #so for example a tree with a root of 5 and children of 4 and 6 would be represented as [5,4,6] class BST(object): __slots__ = "val", "left", "right" def __init__(self, val=None, left=None, right=None): #if val is none then it is an empty tree if...
{ "repo_name": "Bedrock02/General-Coding", "path": "Structures/Tree.py", "copies": "1", "size": "1629", "license": "mit", "hash": -1567783975455203600, "line_mean": 24.8571428571, "line_max": 95, "alpha_frac": 0.6034376918, "autogenerated": false, "ratio": 3.5259740259740258, "config_test": fals...
# Binary Search Tree : Lowest Common Ancestor # Developer: Murillo Grubler # https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor/problem class Node: def __init__(self, info): self.info = info self.left = None self.right = None self.level = None ...
{ "repo_name": "Murillo/Hackerrank-Algorithms", "path": "Data Structures/Trees/binary-search-tree-lowest-common-ancestor.py", "copies": "1", "size": "1533", "license": "mit", "hash": 6359970105025157000, "line_mean": 27.4074074074, "line_max": 89, "alpha_frac": 0.4938030007, "autogenerated": false, ...
# Binary Search Tree class BSTNode(object): def __init__(self, data): self.data = data self.left = None self.right = None def set_data(self, data): """Set value for the current node""" self.data = data def get_data(self): """Return node value""" retu...
{ "repo_name": "martindavid/code-sandbox", "path": "algorithm/COMP90038/Tree/bst.py", "copies": "1", "size": "1376", "license": "mit", "hash": -5915662150282234000, "line_mean": 27.0816326531, "line_max": 75, "alpha_frac": 0.4956395349, "autogenerated": false, "ratio": 4.286604361370716, "config...
#Binary Search Tree class TreeNode: def __init__(self,n): self.val=n self.left,self.right=None,None # Convert Sorted Array to Binary Search Tree class sortedArrayToBSTSolution(object): def sortedArrayToBST(self, nums): if not nums: return None return self.buildTree(n...
{ "repo_name": "allenyao0702/shuati", "path": "BST.py", "copies": "1", "size": "1956", "license": "mit", "hash": 4200346107382366000, "line_mean": 26.5633802817, "line_max": 60, "alpha_frac": 0.6119631902, "autogenerated": false, "ratio": 3.6088560885608856, "config_test": false, "has_no_keywo...
"""Binary search tree""" from tree import TreeNode class BSTNode(TreeNode): def __init__(self, data): self.parent = None super(BSTNode, self).__init__(data) def bst_search(root, data): if root is None: return None if data == root.data: return data elif data < root.dat...
{ "repo_name": "shichao-an/ctci", "path": "chapter4/bst.py", "copies": "1", "size": "1461", "license": "bsd-2-clause", "hash": 7917907369100625000, "line_mean": 20.8059701493, "line_max": 70, "alpha_frac": 0.5749486653, "autogenerated": false, "ratio": 3.9486486486486485, "config_test": false, ...