repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nerevu/riko | riko/modules/csv.py | 1 | 6880 | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.csv
~~~~~~~~~~~~~~~~
Provides functions for fetching csv files.
Examples:
basic usage::
>>> from riko import get_path
>>> from riko.modules.csv import pipe
>>>
>>> url = get_path('spreadsheet.csv')
>>> next... | mit | 9e1db01a15bb83248521312ce851fcb0 | 30.851852 | 79 | 0.563808 | 3.922463 | false | false | false | false |
nerevu/riko | riko/bado/microdom.py | 1 | 33177 | # -*- test-case-name: twisted.web.test.test_xml -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Micro Document Object Model: a partial DOM implementation with SUX.
This is an implementation of what we consider to be the useful subset of the
DOM. The chief advantage of this library is ... | mit | c31252e9ca53c3dd6a255dfdb045c43a | 31.086074 | 80 | 0.584652 | 3.927667 | false | false | false | false |
eerimoq/asn1tools | asn1tools/codecs/ber.py | 1 | 57074 | """Basic Encoding Rules (BER) codec.
"""
import time
import math
import binascii
from copy import copy
import datetime
from ..parser import EXTENSION_MARKER
from . import BaseType, format_bytes, DecodeError, ErrorWithLocation
from . import EncodeError
from . import DecodeError
from . import format_or
from . import c... | mit | 001243dddd09ddb16cee2b6c71f40ad4 | 30.902739 | 119 | 0.550286 | 4.408961 | false | false | false | false |
eerimoq/asn1tools | asn1tools/codecs/compiler.py | 1 | 41188 | """Base Compiler class used by all codecs.
"""
import binascii
import sys
from operator import attrgetter
import bitstruct
from copy import copy
from copy import deepcopy
from ..errors import CompileError
from ..parser import EXTENSION_MARKER
def flatten(dlist):
flist = []
for item in dlist:
if is... | mit | 83e27553e63a2cb3e4dd263f8592e4d0 | 33.409357 | 86 | 0.503763 | 4.865682 | false | false | false | false |
beproud/beproudbot | src/haro/plugins/kudo.py | 1 | 2335 | from slackbot.bot import respond_to, listen_to
from sqlalchemy import func
from db import Session
from haro.botmessage import botsend
from haro.decorators import call_when_sls_haro_not_installed
from haro.plugins.kudo_models import KudoHistory
from haro.slack import get_user_name
HELP = """
- `<name>++`: 指定された名称に対して++... | mit | 260a274421718f2d6b2a69bcdd13227f | 28.471429 | 73 | 0.588463 | 2.553218 | false | false | false | false |
scikit-learn-contrib/imbalanced-learn | imblearn/metrics/pairwise.py | 1 | 7881 | """Metrics to perform pairwise computation."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# License: MIT
import numpy as np
from scipy.spatial import distance_matrix
from sklearn.base import BaseEstimator
from sklearn.utils import check_consistent_length
from sklearn.utils.multiclass import unique_labels
... | mit | 5f6653799defeaf61496ff0782cd5e28 | 37.072464 | 87 | 0.592184 | 3.765409 | false | false | false | false |
scikit-learn-contrib/imbalanced-learn | imblearn/over_sampling/tests/test_common.py | 1 | 4049 | from collections import Counter
import pytest
import numpy as np
from imblearn.over_sampling import (
ADASYN,
BorderlineSMOTE,
KMeansSMOTE,
SMOTE,
SMOTEN,
SMOTENC,
SVMSMOTE,
)
from imblearn.utils.testing import _CustomNearestNeighbors
@pytest.fixture
def numerical_data():
rng = np.ra... | mit | 3edbfdd7f1b47929f7689ada96c23e38 | 28.34058 | 83 | 0.619659 | 2.847398 | false | true | false | false |
scikit-learn-contrib/imbalanced-learn | imblearn/metrics/tests/test_pairwise.py | 2 | 6396 | """Test for the metrics that perform pairwise distance computation."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# License: MIT
import numpy as np
import pytest
from sklearn.exceptions import NotFittedError
from sklearn.preprocessing import LabelEncoder, OrdinalEncoder
from sklearn.utils._testing import... | mit | e1c3d3986a4aed5d357059152ea2d158 | 35.971098 | 87 | 0.665572 | 3.233569 | false | true | false | false |
scikit-learn-contrib/imbalanced-learn | imblearn/over_sampling/_smote/filter.py | 1 | 19979 | """SMOTE variant applying some filtering before the generation process."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# Fernando Nogueira
# Christos Aridas
# Dzianis Dudnik
# License: MIT
import warnings
import numpy as np
from scipy import sparse
from sklearn.base import clo... | mit | 47fbd00867b7be5625cb485e1ec7d173 | 35.994444 | 87 | 0.583121 | 3.996999 | false | false | false | false |
scikit-learn-contrib/imbalanced-learn | imblearn/over_sampling/_random_over_sampler.py | 1 | 9497 | """Class to perform random over-sampling."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# Christos Aridas
# License: MIT
from collections.abc import Mapping
from numbers import Real
import numpy as np
from scipy import sparse
from sklearn.utils import check_array, check_random_state
from sklear... | mit | 059d0e65de20f001a2ded9dabaf3a97e | 35.519231 | 86 | 0.598104 | 4.186508 | false | false | false | false |
probml/pyprobml | deprecated/scripts/pcaStandardization.py | 2 | 1556 | import superimport
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from pathlib import Path
import os
import scipy.io
# Get Data
data_dir = Path('.').absolute().parent / 'data' / 'heightWeight'
data = scipy.io.loadmat(data_dir / "heightWeight.mat")['height... | mit | ffdf2c7b7681f3e9acd73037b3ff9ad3 | 30.14 | 105 | 0.665167 | 3.130785 | false | false | false | false |
probml/pyprobml | deprecated/scripts/parzen_window_demo2.py | 1 | 2303 | # Demonstrate a non-parametric (parzen) density estimator in 1D
# Author: Gerardo Durán Martín
import superimport
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import norm
plt.rcParams["axes.spines.right"] = False
plt.rcParams["axes.spines.top"] = False
def K(u, axis=0): return np.all(np.abs... | mit | f80b6bd2deb4ed9ebdb3231f0325ba70 | 28.126582 | 74 | 0.552369 | 2.432347 | false | false | false | false |
probml/pyprobml | deprecated/scripts/dirichlet_3d_spiky_plot.py | 1 | 2056 | import superimport
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
from mpl_toolkits.mplot3d import proj3d
from scipy.stats import dirichlet
grain = 100 # 20 #how many points along each axis to plot
edgedist = 0.005 # 0.008 #How close to an extreme value of say [1,0,0] are we willin... | mit | 48f38f49bf2be28cdf2e1ae49b560a28 | 32.704918 | 98 | 0.645428 | 2.666667 | false | false | false | false |
probml/pyprobml | deprecated/scripts/mcmc_utils.py | 1 | 1764 | '''
Author : Ang Ming Liang
'''
import superimport
import numpy as np
#from tqdm.notebook import tqdm
from tqdm import tqdm
def slice_sample(init, dist, iters, sigma, burnin, step_out=True, rng=None):
"""
based on http://homepages.inf.ed.ac.uk/imurray2/teaching/09mlss/
"""
# set up empty sample hold... | mit | 4aba05b930bdf8504de3148fb0d5a3a3 | 26.5625 | 76 | 0.424036 | 3.089317 | false | false | false | false |
winpython/winpython | diff.py | 2 | 11721 | # -*- coding: utf-8 -*-
#
# Copyright © 2013 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see winpython/__init__.py for details)
"""
WinPython diff script
Created on Tue Jan 29 11:56:54 2013
"""
from __future__ import print_function, with_statement
import os
# import os.path as osp
from pathlib i... | mit | c951e5d677580f1cc3172526d6c09504 | 26.507042 | 84 | 0.509217 | 3.709402 | false | false | false | false |
probml/pyprobml | deprecated/scripts/broadcasting_fig.py | 1 | 8003 | # Modified from Jake VanderPlas' code
# https://jakevdp.github.io/PythonDataScienceHandbook/06.00-figure-code.html#Broadcasting
# Adapted from astroML: see http://www.astroml.org/book_figures/appendix/fig_broadcast_visual.html
import superimport
#import numpy as np
import matplotlib.pyplot as plt
import os
figdir = ... | mit | a052f77a58ccc307dc07db3665cde384 | 39.21608 | 98 | 0.488192 | 2.360767 | false | false | false | false |
probml/pyprobml | deprecated/scripts/logreg_poly_demo.py | 1 | 3533 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 27 10:08:08 2020
@author: kpmurphy
"""
# Fit logistic regression models to 2d data using polynomial features
import superimport
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_classification, make_blobs
from s... | mit | 578f7b3be9bd77bb60546b6424e4510a | 31.412844 | 85 | 0.626946 | 2.93195 | false | true | false | false |
probml/pyprobml | deprecated/scripts/gpc_demo_2d_sklearn.py | 1 | 1888 | # Gaussian Process Classifier demo
# Author: Drishtii@
# Based on
# https://github.com/probml/pmtk3/blob/master/demos/gpcDemo2d.m
# See also gpc_demo_2d_pytorch for a Gpytorch version of this demo.
import superimport
import pyprobml_utils as pml
import numpy as np
import matplotlib.pyplot as plt
from sklearn.gaussia... | mit | b4fdac704032fb361069c249a69226b4 | 28.061538 | 67 | 0.666314 | 2.371859 | false | false | false | false |
probml/pyprobml | deprecated/scripts/colormap_turbo.py | 1 | 14343 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 4 12:22:42 2020
@author: kpmurphy
"""
# https://gist.github.com/FedeMiorelli/640bbc66b2038a14802729e609abfe89
# This script registers the "turbo" colormap to matplotlib, and the reversed version as "turbo_r"
# Reference: https://ai.googleblog.c... | mit | 9dad1854549ec8fcc791ac6367dc38f4 | 43.685358 | 98 | 0.389528 | 2.902854 | false | false | false | false |
probml/pyprobml | deprecated/scripts/kmeans_yeast_demo.py | 1 | 1414 | import superimport
from scipy.io import loadmat
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import pyprobml_utils as pml
from matplotlib import cm
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
import requests
from io import BytesIO
url = 'https://github.com/probml/probml... | mit | 75303f1c0c5ee1e2cd6cad351fce62f4 | 24.709091 | 86 | 0.720651 | 3.034335 | false | false | false | false |
probml/pyprobml | deprecated/scripts/gpr_demo_marglik.py | 1 | 4830 | # Example of a Gaussian Process Regression with multiple local minima
# in the marginal log-likelihood as a function of the hyperparameters
# Based on: https://github.com/probml/pmtk3/blob/master/demos/gprDemoMarglik.m
# Authors: Drishti Patel & Gerardo Durán-Martín
import superimport
import numpy as np
import matplo... | mit | 5da4b8ffd62a623af68fefb7432f8649 | 32.068493 | 107 | 0.603355 | 2.741624 | false | false | false | false |
probml/pyprobml | deprecated/scripts/mix_gauss_mle_vs_map.py | 1 | 2735 | # Demonstrate failure of MLE for GMMs in high-D case, whereas MAP works
# Based on: https://github.com/probml/pmtk3/blob/master/demos/mixGaussMLvsMAP.m
# Author: Gerardo Durán-Martín
import superimport
import numpy as np
import matplotlib.pyplot as plt
from numpy.random import randn, seed
from numpy.linalg import ch... | mit | ab4f80ae1e2439c8944d7b31f46ab10b | 29.366667 | 84 | 0.562752 | 2.763397 | false | false | false | false |
probml/pyprobml | deprecated/scripts/dirichlet_3d_simplex_plots.py | 1 | 3886 | # Plot 3-dim dirichlet on 2d simplex as heatmap and samples
# Author: Thomas Boggs
# https://gist.github.com/tboggs/8778945
# http://blog.bogatron.net/blog/2014/02/02/visualizing-dirichlet-distributions/
import superimport
from functools import reduce
import numpy as np
import matplotlib.pyplot as plt
import pypro... | mit | 6d791c6ddc44969b5927a5d464c75cc3 | 33.39823 | 79 | 0.595214 | 3.1364 | false | false | false | false |
probml/pyprobml | deprecated/scripts/anscombes_quartet.py | 1 | 1610 | # Anscombe's quartet
# Author: Drishtii
import superimport
import seaborn as sns
import matplotlib.pyplot as plt
import pyprobml_utils as pml
sns.set_theme(style="ticks")
df = sns.load_dataset("anscombe")
g = sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=df, col_wrap=4, ci=None, palette="muted",
... | mit | 25c3ab9c6f04448bcc7de9cb7c6f052f | 33.255319 | 105 | 0.587578 | 2.58427 | false | false | false | false |
probml/pyprobml | deprecated/scripts/ais_demo.py | 1 | 1503 | # https://agustinus.kristia.de/techblog/2017/12/23/annealed-importance-sampling/
import numpy as np
import scipy.stats as st
import matplotlib.pyplot as plt
def f_0(x):
"""
Target distribution: \propto N(-5, 2)
"""
return np.exp(-(x+5)**2/2/2)
def f_j(x, beta):
"""
Intermediate distribution: ... | mit | e698bca8dc830c65c2a7a05ba68f920c | 21.772727 | 80 | 0.572189 | 2.693548 | false | false | false | false |
probml/pyprobml | deprecated/scripts/ngram_character_demo.py | 1 | 2970 | '''
This script consists of functions that allow users to fit ngram model, sample from an ngram model and calculate the
log likelihood of the given sequence given an ngram model.
Author : Aleyna Kara(@karalleyna)
'''
import superimport
from nltk.util import ngrams
from nltk import FreqDist, LidstoneProbDist
from datac... | mit | e1168bd225e78fbf8bc3bb2976d01e46 | 26.201835 | 115 | 0.667116 | 3.229847 | false | false | false | false |
probml/pyprobml | deprecated/scripts/vb_logreg_2d_demo.py | 1 | 1811 | # Variational Bayes for binary logistic regression
# Written by Amazasp Shaumyan
#https://github.com/AmazaspShumik/sklearn-bayes/blob/master/ipython_notebooks_tutorials/linear_models/bayesian_logistic_regression_demo.ipynb
import superimport
#from skbayes.linear_models import EBLogisticRegression,VBLogisticRegressio... | mit | 0f7181b0b86b2dd75c9466cb613a8d1b | 30.241379 | 141 | 0.66593 | 2.522284 | false | false | false | false |
probml/pyprobml | deprecated/scripts/beta_binom_approx_post_pymc3.py | 1 | 4344 | # 1d approixmation to beta binomial model
# https://github.com/aloctavodia/BAP
import superimport
import pymc3 as pm
import numpy as np
import seaborn as sns
import scipy.stats as stats
import matplotlib.pyplot as plt
import arviz as az
import math
import pyprobml_utils as pml
#data = np.repeat([0, 1], (10, 3))
dat... | mit | c374b04872962f9e963105fd5fff2f1f | 23.95977 | 66 | 0.668125 | 2.564678 | false | false | false | false |
probml/pyprobml | internal/book2/handle_book1_notebooks.py | 1 | 1062 | from glob import glob
from itertools import count
import nbformat as nbf
book1_nb = glob("notebooks/book1/*/*.ipynb")
book1_nb_to_chap = {}
for nb in book1_nb:
name = nb.split("/")[-1]
chap = nb.split("/")[-2]
book1_nb_to_chap[name] = chap
colab_base_url = "https://colab.research.google.com/github/probml/... | mit | fefae59d24c83a4b41b46dd2cb881e3d | 28.5 | 103 | 0.623352 | 2.96648 | false | false | false | false |
probml/pyprobml | deprecated/scripts/vanishing_gradients.py | 1 | 1063 | # Vanishing gradients for certain activation functions
# Based on
#https://medium.com/@karpathy/yes-you-should-understand-backprop-e2f06eab496b
import superimport
import numpy as np
import matplotlib.pyplot as plt
import os
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def sigmoid_grad(x):
p = sigmoid(x)
... | mit | c660270f7a846930910fcdce9069bf39 | 17.033898 | 77 | 0.674506 | 2.561446 | false | false | false | false |
probml/pyprobml | deprecated/scripts/agglomDemo.py | 1 | 1031 | # Agglomerative Clustering Demo
# Author: Animesh Gupta
import superimport
import numpy as np
from scipy.cluster.hierarchy import dendrogram, linkage
import matplotlib.pyplot as plt
import pyprobml_utils as pml
X = np.array([[1,2],
[2.5,4.5],
[2,2],
[4,1.5],
[4,2.5],])
labels = range(1, 6)
plt.figur... | mit | d49d320a381fce99bc25ba2f193bffa2 | 23 | 86 | 0.631426 | 2.824658 | false | false | false | false |
probml/pyprobml | deprecated/scripts/KLfwdReverseMixGauss.py | 1 | 1402 | # Visualize difference between KL(p,q) and KL(q,p) where p is a mix of two
# 2d Gaussians, and q is a single 2d Gaussian
# Author: animesh-007
import superimport
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
mu = np.array([[-1,-1],[1,1]])
Sigma = np.zeros((2,2,2))
... | mit | 9d3d4bf5d65e658601e9fa4b30d3ec2b | 24.490909 | 74 | 0.611983 | 2.200942 | false | false | false | false |
probml/pyprobml | deprecated/scripts/splines_cherry_blossoms.py | 1 | 3601 | # splines in 1d
# We use the cherry blossom daa from sec 4.5 of "Statistical Rethinking"
# We use temperature as the target variable, to match a draft version of the book,
# https://github.com/Booleans/statistical-rethinking/blob/master/Statistical%20Rethinking%202nd%20Edition.pdf
# The published version uses day of y... | mit | 73ae26155f53ab08dccecf3ef76d306e | 27.587302 | 109 | 0.655096 | 2.709556 | false | false | false | false |
probml/pyprobml | deprecated/scripts/iris_logreg_loss_surface.py | 1 | 2862 | # Plot 2d NLL loss surface for binary logistic regression with 1 feature
# Loosely based on
# https://peterroelants.github.io/posts/neural-network-implementation-part02/
import superimport
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
from mpl_toolkits.mplot3d import axes3d, Axes3... | mit | 962c76f121dd49e6565df7911a9df485 | 26.519231 | 83 | 0.680643 | 2.590045 | false | false | false | false |
probml/pyprobml | deprecated/scripts/ae_celeba_lightning.py | 1 | 6609 | # -*- coding: utf-8 -*-
"""
Author: Ang Ming Liang
Please run the following command before running the script
wget -q https://raw.githubusercontent.com/sayantanauddy/vae_lightning/main/data.py
or curl https://raw.githubusercontent.com/sayantanauddy/vae_lightning/main/data.py > data.py
Then, make sure to get your kag... | mit | 1c8befde9cad5003a36a3e8b2bfce296 | 31.55665 | 93 | 0.531851 | 3.851399 | false | false | false | false |
probml/pyprobml | deprecated/scripts/conditional_bernoulli_mix_lib.py | 1 | 12546 | # Necessary functions for demo and ClassConditionalBMM
# Author : Aleyna Kara(@karalleyna)
import jax.numpy as jnp
from jax import vmap, jit, value_and_grad
from jax.random import PRNGKey, split, permutation
from jax.lax import scan
from jax.scipy.special import expit, logit
from jax.experimental import optimizers
im... | mit | a869557758db0ba860d216f549efbf96 | 31.416021 | 123 | 0.583785 | 4.145406 | false | false | false | false |
probml/pyprobml | deprecated/scripts/vae_conv_load_tf.py | 1 | 7281 | # Load pre-trained ConvVAE model (eg trained in colab)
# See https://github.com/probml/pyprobml/blob/master/notebooks/lvm/vae_mnist_2d_tf.ipynb for training script
import superimport
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pyprobml_utils as pml
import os
figdir = "../figure... | mit | d4ad4600564cdfea53554c3362ff1840 | 30.79476 | 151 | 0.627249 | 3.153313 | false | false | false | false |
probml/pyprobml | deprecated/scripts/vb_gauss_cholesky.py | 1 | 6064 | '''
It implements the full covariance FFVB method from 3.5.1 of https://arxiv.org/abs/2103.01327
For original Matlab code, please see Example4.zip in https://github.com/VBayesLab/Tutorial-on-VB.
Author : Aleyna Kara(@karalleyna)
'''
import jax
import jax.numpy as jnp
from jax import random, jit, grad, lax, ops
import... | mit | c79106b2df7c120c1c39478df96fd470 | 36.664596 | 112 | 0.597955 | 3.367018 | false | false | false | false |
probml/pyprobml | deprecated/scripts/mixexpDemo.py | 1 | 3555 | import superimport
import pyprobml_utils as pml
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.special import logsumexp
from sklearn.linear_model import LinearRegression
from scipy.stats import multivariate_normal
n = 200
np.random.seed(1)
y = np.random.rand(n, 1)
eta = np.random.ra... | mit | f410005e34aaee869ea150755b82d561 | 24.76087 | 88 | 0.591842 | 2.566787 | false | true | false | false |
probml/pyprobml | deprecated/scripts/prior_post_pred_binom_pymc3.py | 1 | 2070 | # prior and posterior predctiive for beta binomial
# fig 1.6 of 'Bayeysian Modeling and Computation'
import superimport
import arviz as az
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymc3 as pm
from scipy import stats
from scipy.stats import entropy
from scipy.optimize import minimi... | mit | 25361f5a7d43dcff701691b52318491c | 27.666667 | 84 | 0.696558 | 2.696732 | false | false | false | false |
probml/pyprobml | deprecated/scripts/word_embedding_spacy.py | 1 | 3197 |
# Demo of word embeddigns using the Spacy library
# Based on https://spacy.io/usage/vectors-similarity
# and https://nlpforhackers.io/complete-guide-to-spacy/
# Follow installation instructions at https://spacy.io/usage/
# Then run the command below to get a word embedding model (medium sized)
# python -m spacy down... | mit | 14342106412076568d6b58b1f87e4980 | 29.740385 | 101 | 0.69096 | 2.836735 | false | false | false | false |
winpython/winpython | winpython/_vendor/qtpy/tests/test_patch_qheaderview.py | 3 | 3355 | import sys
import pytest
from qtpy import PYQT6, PYSIDE2, PYSIDE6, QT_VERSION
from qtpy.QtWidgets import QApplication
from qtpy.QtWidgets import QHeaderView
from qtpy.QtCore import Qt
from qtpy.QtCore import QAbstractListModel
def get_qapp(icon_path=None):
qapp = QApplication.instance()
if qapp is None:
... | mit | f002435e49c53627f330a2cd994bbe21 | 38.470588 | 98 | 0.752012 | 3.821185 | false | true | false | false |
probml/pyprobml | deprecated/scripts/vae_conv_mnist_flax_main.py | 1 | 1247 | from absl import app
from absl import flags
from vae_conv_mnist_flax_lib import VAE_mnist
FLAGS = flags.FLAGS
flags.DEFINE_string(
'figdir', default="mnist_results",
help=('The dataset we are interested to train out vae on')
)
flags.DEFINE_float(
'learning_rate', default=1e-3,
help=('The learning rat... | mit | 2ee527c7df7c6c221f13aeb67b3672da | 18.793651 | 62 | 0.638332 | 3.23057 | false | false | false | false |
probml/pyprobml | deprecated/scripts/linear_bandit.py | 1 | 4542 | import enum
import jax.numpy as jnp
from jax import lax
from jax import random
from tensorflow_probability.substrates import jax as tfp
tfd = tfp.distributions
class ExplorationPolicy(enum.Enum):
"""Possible exploration policies."""
linear_ucb_policy = 1
linear_thompson_sampling_policy = 2
linear_... | mit | 3a766f8b9fbf19651f5aaf655a4d70f5 | 32.895522 | 85 | 0.594232 | 3.518203 | false | false | false | false |
probml/pyprobml | deprecated/scripts/unigauss_vb_demo.py | 1 | 6165 | # Variational Bayes (VB) for univariate gaussian
# based on: https://github.com/probml/pmtk3/blob/master/demos/unigaussVbDemo.m
# Author: Gerardo Durán-Martín (@gerdm)
import superimport
import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
from jax import random
from jax.scipy import stats
from datacla... | mit | 8357758b435429260b5ef9b267fc0ca1 | 30.443878 | 115 | 0.631024 | 3.106351 | false | false | false | false |
probml/pyprobml | deprecated/scripts/mix_gauss_em_faithful.py | 1 | 2489 | #!pip install distrax
'''
Visualize fitting a mixture of Gaussians by em algorithm to the old faithful dataset
reproduce Bishop fig 9.8
Author: Gerardo Durán-Martín, Aleyna Kara(@karalleyna)
'''
import superimport
import numpy as np
import jax.numpy as jnp
import matplotlib.pyplot as plt
import pyprobml_utils as pml
... | mit | 3cd0a34872bd77959915f92c8b0f16e0 | 28.963855 | 105 | 0.646562 | 3.120452 | false | false | false | false |
probml/pyprobml | deprecated/scripts/svm_regression_1d.py | 1 | 2154 |
# SVM for regression in 1d
# Code is based on
# https://github.com/ageron/handson-ml2/blob/master/05_support_vector_machines.ipynb
import superimport
import numpy as np
import matplotlib.pyplot as plt
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.prepro... | mit | a62f3161d86bb0043988f81fc84f2c05 | 33.190476 | 89 | 0.631383 | 2.525205 | false | false | false | false |
probml/pyprobml | deprecated/scripts/gibbs_gauss_demo.py | 1 | 1440 | # Illustration of gibbs sampling for 2-dim Gaussian
# Author: Gerardo Durán-Martín
# Translated from gibbsGaussDemo.m
import superimport
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal, norm
import pyprobml_utils as pml
μ = np.zeros(2)
Σ = np.array([[1, 0.99], [0.99, 1]... | mit | 535e471face276028b457a2c91886be1 | 26.901961 | 89 | 0.620956 | 2.191063 | false | false | false | false |
probml/pyprobml | deprecated/scripts/spectral_clustering_demo.py | 1 | 3806 | import superimport
import itertools
import matplotlib.pyplot as plt
import numpy as np
from scipy.linalg import eigh
from sklearn.cluster import KMeans
from sklearn.metrics.pairwise import rbf_kernel
import pyprobml_utils as pml
plt.style.use('classic')
def spectral_clustering_demo():
np.random.seed(0)
num_c... | mit | 405159cc06a82c4af6c376530008a56d | 35.247619 | 99 | 0.607725 | 3.275387 | false | false | false | false |
probml/pyprobml | deprecated/vae/models/info_vae.py | 1 | 4990 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
def compute_kernel(x1: torch.Tensor, x2: torch.Tensor, kernel_type: str = "rbf") -> torch.Tensor:
# Convert the tensors into row and column vectors
D = x1.size(1)
N = x1.size(0)
x1 ... | mit | 91290df8d97f3b4bba4c271036e9ee59 | 29.426829 | 119 | 0.559118 | 3.158228 | false | false | false | false |
probml/pyprobml | deprecated/vae/utils/interpolation.py | 1 | 3470 | import torch
import numpy as np
import pandas as pd
from einops import rearrange
from typing import Callable
from torchvision.utils import make_grid
def get_imgs_and_attr(batch):
imgs, attr = batch
df = pd.DataFrame(
attr.numpy(),
columns=[
"5_o_Clock_Shadow",
"Arched_E... | mit | 430ce8107ab31284ad768be1c7609ec8 | 26.76 | 94 | 0.551873 | 3.333333 | false | false | false | false |
probml/pyprobml | deprecated/scripts/svi_gmm_tfp_original.py | 1 | 6229 | # SVI for a GMM
# https://github.com/brendanhasz/svi-gaussian-mixture-model/blob/master/BayesianGaussianMixtureModel.ipynb
# MIT License
#pip install tf-nightly
#pip install --upgrade tfp-nightly -q
# Imports
import superimport
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflo... | mit | 11e7466934edfa208d991ed4db282811 | 29.99005 | 106 | 0.609568 | 3.462479 | false | false | false | false |
probml/pyprobml | deprecated/scripts/bayes_change_of_var.py | 1 | 1657 | # Based on https://github.com/probml/pmtk3/blob/master/demos/bayesChangeOfVar.m
# MC on change of variables and empirical distribution, highlighting that
# modes are not, in general, preserved.
import superimport
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import os
from pyprobml_u... | mit | aac4d6463819a4086d1c236acd7377a9 | 33.520833 | 103 | 0.704888 | 2.752492 | false | false | false | false |
probml/pyprobml | deprecated/scripts/postDensityIntervals.py | 1 | 1771 |
import superimport
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
def logdet(Sigma):
return np.log2(Sigma)
def gaussProb(X, mu, Sigma):
d = 1
X = X.reshape(X.shape[0], d)
X = X - np.transpose(mu)
logp = -0.5*np.sum(np.multiply((X/(Sigma)), X), 1)
logZ = (d/2... | mit | 823f1692db5df21fa8fb434e8a563761 | 31.2 | 67 | 0.605872 | 2.466574 | false | false | false | false |
probml/pyprobml | deprecated/scripts/subspace_sgd_mlp_mnist_demo.py | 1 | 3742 | # This demo replicates Figure 2 of the paper
# "Measuring the Intrinsic Dimension of Objetive Landscape"
# By Li et al. (https://arxiv.org/abs/1804.08838)
# We consider a 2-layer MLP with ReLU activations
# Code based on the following repos:
# * https://github.com/ganguli-lab/degrees-of-freedom
# * https://github.com/u... | mit | fe68c1e3ead85e2f155db56fc2439822 | 32.357143 | 119 | 0.711724 | 2.887172 | false | true | false | false |
probml/pyprobml | deprecated/scripts/spam_dtree_size.py | 1 | 5450 |
#Performance of tree ensembles. Based on the email spam example from chapter 10 of "Elements of statistical learning". Code is from Andrey Gaskov's site:
#https://github.com/empathy87/The-Elements-of-Statistical-Learning-Python-Notebooks/blob/master/examples/Spam.ipynb
import superimport
from one_standard_error_ru... | mit | e578194ae1bf64aba2787f750ecd7d5f | 45.177966 | 153 | 0.643971 | 2.979224 | false | true | false | false |
probml/pyprobml | deprecated/scripts/activation_fun_plot.py | 1 | 2886 | # Plots various neural net activation functions.
import superimport
import numpy as np
import matplotlib.pyplot as plt
import os
import pyprobml_utils as pml
import sys
def sigmoid(z):
return 1 / (1 + np.exp(-z))
def relu(z):
return np.maximum(0, z)
def heaviside(z):
return (z > 0)
def softplus(z):
... | mit | 5977f999f981c2b226ea9d487bcc20e5 | 29.702128 | 206 | 0.638254 | 2.361702 | false | false | false | false |
amccaugh/phidl | phidl/device_layout.py | 1 | 107019 | # ==============================================================================
# Major TODO
# ==============================================================================
# Add D.add_gdsii_path() to allow creation of GDSII paths
# Add D.write_gds(max_points_per_polygon)
# Remove Device.add()
# Show labels in quickp... | mit | 95a46df0a228d3b651d77213cb78f655 | 32.767435 | 132 | 0.538871 | 4.178081 | false | false | false | false |
cmu-delphi/delphi-epidata | src/acquisition/wiki/wiki_extract.py | 2 | 3945 | """
===============
=== Purpose ===
===============
Extracts and stores article access counts
See also: wiki.py
=================
=== Changelog ===
=================
2017-02-23
* secrets and minor cleanup
2016-08-14
* use pageviews instead of pagecounts-raw
* default job limit from 1000 to ... | mit | aa43f0fd88141927e7639ee546ca5abc | 34.527778 | 269 | 0.651965 | 3.427454 | false | false | false | false |
cmu-delphi/delphi-epidata | src/server/_query.py | 1 | 15964 | from datetime import date, datetime
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Sequence,
Tuple,
Union,
cast,
Mapping,
)
from sqlalchemy import text
from sqlalchemy.engine import Row
from ._common import db, app
from ._db import metadata
from ._print... | mit | ee55865c056f4293596a5409a3251702 | 30.674603 | 143 | 0.588011 | 3.64808 | false | false | false | false |
cmu-delphi/delphi-epidata | src/acquisition/afhsb/afhsb_csv.py | 1 | 10748 | '''
afhsb_csv.py creates CSV files filled_00to13.csv, filled_13to17.csv and simple_DMISID_FY2018.csv
which will be later used to create MYSQL data tables.
Several intermediate files will be created, including:
00to13.pickle 13to17.pickle 00to13.csv 13to17.csv
Required source files:
ili_1_2000_5_2013_new.sas7bdat a... | mit | d30a15bcce09881748d06b4441dfdbc6 | 31.47432 | 97 | 0.621046 | 2.69441 | false | false | false | false |
cmu-delphi/delphi-epidata | src/acquisition/cdcp/cdc_upload.py | 1 | 7456 | """
===============
=== Purpose ===
===============
Reads zip/csv files from CDC and stores page hit counts in the database.
Files can be uploaded at:
https://delphi.cmu.edu/~automation/public/cdc_upload/
When someone uploads a new file, two things happen:
1. the uploaded file is moved to /common/cdc_stage
2. th... | mit | 039136f46bd04ef44c0c48c9736dabc1 | 25.724014 | 94 | 0.530311 | 3.197256 | false | false | false | false |
cmu-delphi/delphi-epidata | src/acquisition/covid_hosp/common/database.py | 1 | 7963 | """Common database code used by multiple `covid_hosp` scrapers."""
# standard library
from collections import namedtuple
from contextlib import contextmanager
import math
# third party
import mysql.connector
import pandas as pd
# first party
import delphi.operations.secrets as secrets
Columndef = namedtuple("Column... | mit | b72b76d5e4f3afc7bc7f58f67b9fa1c1 | 32.179167 | 133 | 0.626648 | 3.985485 | false | false | false | false |
djangonauts/django-hstore | django_hstore/utils.py | 3 | 2608 | from __future__ import unicode_literals, absolute_import
from decimal import Decimal
from datetime import date, time, datetime
from django.core.exceptions import ObjectDoesNotExist
from django.utils import six
def acquire_reference(reference):
try:
model, identifier = reference.split(':')
module... | mit | 1c4e8a6a2484fb60b16ad0ed271d18f9 | 30.421687 | 101 | 0.641488 | 4.29654 | false | false | false | false |
djangonauts/django-hstore | django_hstore/dict.py | 1 | 5377 | import json
from decimal import Decimal
from django.utils import six
from django.utils.encoding import force_text, force_str
from .compat import UnicodeMixin
from . import utils, exceptions
__all__ = [
'HStoreDict',
'HStoreReferenceDict',
]
class DecimalEncoder(json.JSONEncoder):
def default(self, ob... | mit | 53a968aa57a5c9d2124549bc5e27892f | 31.587879 | 124 | 0.581179 | 4.587884 | false | false | false | false |
deepchem/deepchem | deepchem/hyper/base_classes.py | 1 | 5216 | import logging
from typing import Any, Callable, Dict, List, Optional, Tuple
from deepchem.data import Dataset
from deepchem.trans import Transformer
from deepchem.models import Model
from deepchem.metrics import Metric
logger = logging.getLogger(__name__)
def _convert_hyperparam_dict_to_filename(hyper_params: Dict... | mit | b9a8164e6ff7b26a6abc248df003d0e0 | 36.797101 | 102 | 0.700537 | 4.504318 | false | false | false | false |
deepchem/deepchem | contrib/DeepMHC/deepmhc.py | 5 | 3829 | """DeepMHC model, found in https://www.biorxiv.org/content/early/2017/12/24/239236"""
from __future__ import division
from __future__ import unicode_literals
__author__ = "Vignesh Ram Somnath"
__license__ = "MIT"
import numpy as np
import tensorflow as tf
from deepchem.data import NumpyDataset
from deepchem.models.... | mit | 57b36d7c5f0137d7c6ad6efaa7f093c7 | 34.785047 | 85 | 0.641421 | 3.542091 | false | false | false | false |
deepchem/deepchem | deepchem/utils/pdbqt_utils.py | 3 | 10945 | """Utilities for handling PDBQT files."""
from typing import Dict, List, Optional, Set, Tuple
from deepchem.utils.typing import RDKitMol
def pdbqt_to_pdb(filename: Optional[str] = None,
pdbqt_data: Optional[List[str]] = None) -> str:
"""Extracts the PDB part of a pdbqt file as a string.
Either ... | mit | 4f8fc5cff69df4b05093626fb699247f | 30.182336 | 122 | 0.66222 | 3.382262 | false | false | false | false |
deepchem/deepchem | deepchem/rl/envs/test_tictactoe.py | 7 | 1641 | from unittest import TestCase
import numpy as np
import deepchem.rl.envs.tictactoe
class TestTicTacToeEnvironment(TestCase):
def test_constructor(self):
board = deepchem.rl.envs.tictactoe.TicTacToeEnvironment()
assert len(board.state) == 1
assert board.state[0].shape == (3, 3, 2)
assert np.sum(boa... | mit | 823056b8e3c47cd9a845d6f1b2d7ea98 | 32.489796 | 69 | 0.680073 | 2.699013 | false | true | false | false |
gae-init/gae-init-upload | main/model/config_auth.py | 12 | 5107 | # coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
from api import fields
import model
class ConfigAuth(object):
azure_ad_client_id = ndb.StringProperty(default='', verbose_name='Client ID')
azure_ad_client_secret = ndb.StringProperty(default='', verbose_name='Client Se... | mit | 3a17ecbc7fe9f0eea6a2d2425612f57f | 38.898438 | 90 | 0.722929 | 3.566341 | false | false | false | false |
gae-init/gae-init-upload | main/auth/gae.py | 18 | 1164 | # coding: utf-8
from __future__ import absolute_import
from google.appengine.api import users
import flask
import auth
import model
import util
from main import app
@app.route('/signin/gae/')
def signin_gae():
auth.save_request_params()
gae_url = users.create_login_url(flask.url_for('gae_authorized'))
retur... | mit | a13e6439171e408ec2d69d473cc12ae9 | 22.755102 | 67 | 0.683849 | 2.888337 | false | false | false | false |
gamechanger/dusty | tests/unit/commands/validate_test.py | 1 | 4225 | from schemer import ValidationException
from ...testcases import DustyTestCase
from ..utils import apply_required_keys
from dusty.commands.validate import (_validate_app_references, _validate_cycle_free,
_check_name_overlap)
from dusty import constants
class ValidatorTest(DustyTes... | mit | eb92c750ca7f33927a7e8685cbbb5b47 | 28.545455 | 84 | 0.370888 | 5.029762 | false | true | false | false |
gamechanger/dusty | dusty/systems/docker/__init__.py | 1 | 3898 | import os
import docker
import logging
from ... import constants
from ...log import log_to_client
from ...memoize import memoized
from ...subprocess import check_output_demoted
from ...compiler.spec_assembler import get_specs
def exec_in_container(container, command, *args):
client = get_docker_client()
exec... | mit | 0f4654ae97a6f546ce82a3046cefcaab | 41.369565 | 128 | 0.654182 | 3.777132 | false | false | false | false |
gamechanger/dusty | tests/unit/commands/test_test.py | 1 | 11902 | from mock import patch, call, Mock
from ...testcases import DustyTestCase
from ..utils import get_app_dusty_schema, get_lib_dusty_schema
from dusty.commands import test
from dusty.schemas.base_schema_class import DustySpecs
from dusty.source import Repo
@patch('dusty.commands.test.initialize_docker_vm')
@patch('dusty... | mit | 0d08a9dddc0716b1e5e020505deeccaf | 60.350515 | 201 | 0.593934 | 3.605574 | false | true | false | false |
skyfielders/python-skyfield | skyfield/planetarylib.py | 1 | 9586 | # -*- coding: utf-8 -*-
"""Open a BPC file, read its angles, and produce rotation matrices."""
from numpy import array, cos, nan, sin
from jplephem.pck import DAF, PCK
from .constants import ASEC2RAD, AU_KM, DAY_S, tau
from .data import text_pck
from .functions import _T, mxv, mxm, mxmxm, rot_x, rot_y, rot_z
from .uni... | mit | 78618ec24e7d2055d30742922e0ffe32 | 36.881423 | 80 | 0.587855 | 3.792639 | false | false | false | false |
ktbyers/netmiko | tests/test_netmiko_config.py | 1 | 10070 | #!/usr/bin/env python
import re
import pytest
from netmiko import ConfigInvalidException
from netmiko import ReadTimeout
def test_ssh_connect(net_connect, commands, expected_responses):
"""
Verify the connection was established successfully
"""
show_version = net_connect.send_command(commands["version... | mit | c00db6ca551af8cf3c470bad6cb56767 | 34.964286 | 87 | 0.683416 | 3.997618 | false | true | false | false |
christiansandberg/canopen | examples/simple_ds402_node.py | 1 | 4328 | import canopen
import sys
import os
import traceback
import time
try:
# Start with creating a network representing one CAN bus
network = canopen.Network()
# Connect to the CAN bus
network.connect(bustype='kvaser', channel=0, bitrate=1000000)
network.check()
# Add some nodes with correspond... | mit | 76031a0b9c0d2487e92d39ca1f283b67 | 26.392405 | 95 | 0.594732 | 3.432197 | false | false | false | false |
christiansandberg/canopen | canopen/objectdictionary/__init__.py | 1 | 17024 | """
Object Dictionary module
"""
import struct
from typing import Dict, Iterable, List, Optional, TextIO, Union
try:
from collections.abc import MutableMapping, Mapping
except ImportError:
from collections import MutableMapping, Mapping
import logging
from .datatypes import *
logger = logging.getLogger(__name... | mit | 98c4a5a60562ce75c56aa4265d92d84f | 34.173554 | 83 | 0.583353 | 4.099205 | false | false | false | false |
ktbyers/netmiko | netmiko/dell/dell_powerconnect.py | 1 | 4030 | """Dell PowerConnect Driver."""
from typing import Optional
from paramiko import SSHClient
import time
from os import path
from netmiko.ssh_auth import SSHClient_noauth
from netmiko.cisco_base_connection import CiscoBaseConnection
class DellPowerConnectBase(CiscoBaseConnection):
"""Dell PowerConnect Driver."""
... | mit | 0d0ab85d81795e158c8a8c46ad81faf2 | 33.152542 | 98 | 0.601489 | 4.08308 | false | true | false | false |
the-blue-alliance/the-blue-alliance | src/backend/api/api_trusted_parsers/json_alliance_selections_parser.py | 1 | 1458 | from typing import AnyStr, List
from pyre_extensions import safe_json
from backend.common.datafeed_parsers.exceptions import ParserInputException
from backend.common.models.alliance import EventAlliance
from backend.common.models.keys import TeamKey
from backend.common.models.team import Team
class JSONAllianceSele... | mit | c0fd3c8435ac70d975caed77289743a2 | 35.45 | 82 | 0.570645 | 4.130312 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/tasks_io/datafeeds/parsers/fms_api/fms_api_event_list_parser.py | 1 | 10289 | import datetime
import json
import logging
from typing import Any, Dict, List, Optional, Tuple
from google.appengine.ext import ndb
from backend.common.consts.event_type import EventType
from backend.common.consts.playoff_type import PlayoffType
from backend.common.helpers.event_short_name_helper import EventShortNam... | mit | fc6560ac10d277c34ca2b87cf07eaaff | 40.321285 | 100 | 0.555253 | 4.019141 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/web/handlers/tests/team_history_test.py | 1 | 3660 | from freezegun.api import freeze_time
from werkzeug.test import Client
from backend.web.handlers.tests import helpers
def test_get_bad_team_num(web_client: Client) -> None:
resp = web_client.get("/team/0/history")
assert resp.status_code == 404
def test_team_not_found(web_client: Client, ndb_stub) -> None:... | mit | e6d5edcda7019106229e7cd495a90e3f | 33.857143 | 80 | 0.623224 | 3.536232 | false | true | false | false |
the-blue-alliance/the-blue-alliance | src/backend/conftest.py | 1 | 3060 | from typing import Generator
import pytest
from freezegun import api as freezegun_api
from google.appengine.api import datastore_types
from google.appengine.api.apiproxy_rpc import _THREAD_POOL
from google.appengine.ext import ndb, testbed
from backend.common.context_cache import context_cache
from backend.common.mod... | mit | 59490c623f262f776a986c8649ef6ab2 | 29.29703 | 84 | 0.738562 | 3.308108 | false | true | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/helpers/tests/award_helper_test.py | 1 | 3904 | from typing import Optional
import pytest
from backend.common.consts.award_type import AwardType
from backend.common.helpers.award_helper import AwardHelper
from backend.common.models.award import Award
def test_organize_awards() -> None:
a1 = Award(
award_type_enum=AwardType.SAFETY,
name_str="S... | mit | ac04ba355218694644a557bfc0ce1900 | 39.666667 | 86 | 0.627818 | 3.120703 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/api/handlers/tests/update_event_matches_test.py | 1 | 15731 | import datetime
import json
from typing import Any, Dict, List, Optional
import pytest
from google.appengine.ext import ndb
from pyre_extensions import none_throws
from werkzeug.test import Client
from backend.api.trusted_api_auth_helper import TrustedApiAuthHelper
from backend.common.consts.alliance_color import All... | mit | 9d3bff5cc002e6359e7b079e38d95a67 | 29.664717 | 88 | 0.493929 | 3.513737 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/helpers/event_remapteams_helper.py | 1 | 5511 | import json
from typing import Dict, List, Optional
from google.appengine.ext import ndb
from pyre_extensions import none_throws
from backend.common.consts.alliance_color import ALLIANCE_COLORS
from backend.common.manipulators.award_manipulator import AwardManipulator
from backend.common.manipulators.event_details_ma... | mit | f2c690df115c1fa3c42ebf66e25e7774 | 37.809859 | 87 | 0.570677 | 4.149849 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/cache_clearing/get_affected_queries.py | 1 | 12018 | from typing import Any, List, Set, Tuple, Type
from google.appengine.ext import ndb
from backend.common.models.cached_model import TAffectedReferences
from backend.common.models.district_team import DistrictTeam
from backend.common.models.event import Event
from backend.common.models.event_team import EventTeam
from ... | mit | 5a64b04ec9aa012ea3186c633bdad652 | 38.019481 | 88 | 0.662506 | 3.494621 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/controllers/admin/admin_offseason_spreadsheet_controller.py | 11 | 3111 | import datetime
import logging
import os
from google.appengine.ext import ndb
from google.appengine.ext.webapp import template
from controllers.base_controller import LoggedInHandler
from datafeeds.datafeed_offseason_spreadsheet import DatafeedOffseasonSpreadsheet
from consts.event_type import EventType
from helpers... | mit | ae814e72b435a06f092a8cd6f3441e46 | 36.481928 | 131 | 0.633558 | 3.681657 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/queries/dict_converters/award_converter.py | 1 | 2819 | import json
from typing import Dict, List, NewType
from google.appengine.ext import ndb
from backend.common.consts.api_version import ApiMajorVersion
from backend.common.models.award import Award
from backend.common.models.event import Event
from backend.common.models.team import Team
from backend.common.queries.dict... | mit | 07b581b382f30ad8cfac198cd776b8d4 | 33.802469 | 86 | 0.564385 | 3.877579 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/helpers/insight_manipulator.py | 12 | 1096 | from helpers.manipulator_base import ManipulatorBase
class InsightManipulator(ManipulatorBase):
"""
Handle Insight database writes.
"""
@classmethod
def updateMerge(self, new_insight, old_insight, auto_union=True):
"""
Given an "old" and a "new" Insight object, replace the fields ... | mit | ccd0c931eca11c376e37534acb63190c | 33.25 | 81 | 0.556569 | 3.985455 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/helpers/event_short_name_helper.py | 1 | 2918 | import re
from typing import Optional, Set
from backend.common.decorators import memoize
from backend.common.models.district import District
class EventShortNameHelper:
"""
A helper class to compute event short names
"""
@staticmethod
@memoize(timeout=86400) # 1 day
def _get_all_district_co... | mit | 10a98eeec91a9400e86aadd0b208fce1 | 35.936709 | 176 | 0.566484 | 3.494611 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/consts/fcm/platform_type.py | 1 | 1528 | from __future__ import annotations
import enum
from typing import Dict
@enum.unique
class PlatformType(enum.IntEnum):
"""
Constants for the type of FCM platforms.
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
"""
ANDROID = 0
APNS = 1
WEBPUSH = 2
@staticmet... | mit | b1a1e2203d2c526195ef2bf7bfa2c6cf | 29.56 | 83 | 0.64267 | 4.107527 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/api/handlers/match.py | 1 | 1566 | from typing import Optional
from flask import Response
from backend.api.handlers.decorators import api_authenticated, validate_keys
from backend.api.handlers.helpers.model_properties import (
filter_match_properties,
ModelType,
)
from backend.api.handlers.helpers.profiled_jsonify import profiled_jsonify
from ... | mit | 6e7cb8ecfa85da531aa45994ca57548f | 33.8 | 83 | 0.765645 | 3.591743 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/web/handlers/suggestions/tests/suggest_team_media_review_controller_test.py | 1 | 8438 | import re
from typing import List
from urllib.parse import urlparse
import pytest
from bs4 import BeautifulSoup
from google.appengine.ext import ndb
from werkzeug.test import Client
from backend.common.consts.account_permission import AccountPermission
from backend.common.consts.media_type import MediaType
from backe... | mit | 29580ed0048ed210ae737d4082346c7e | 32.61753 | 87 | 0.669471 | 3.595228 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/models/tba_video.py | 1 | 1501 | from typing import List, Optional
from backend.common.models.keys import EventKey, MatchKey
class TBAVideo(object):
"""
Same interface as the retired TBAVideo class.
"""
TBA_NET_VID_PATTERN = "http://videos.thebluealliance.net/%s/%s.%s"
THUMBNAIL_FILETYPES = ["jpg", "jpeg"]
STREAMABLE_FILET... | mit | 47a8b1846cfb7e271b39952ca9f9f659 | 29.02 | 83 | 0.612258 | 3.458525 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/web/handlers/district.py | 1 | 5798 | import datetime
import logging
from datetime import timedelta
from operator import itemgetter
from typing import List, Optional, Tuple
from flask import abort
from google.appengine.ext import ndb
from werkzeug.wrappers import Response
from backend.common.decorators import cached_public
from backend.common.flask_cache... | mit | 6646b748baccae14b2bf36284d38f94d | 35.696203 | 87 | 0.656951 | 3.653434 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/consts/district_point_values.py | 1 | 5542 | from backend.common.consts.award_type import AwardType
class DistrictPointValues:
"""
A class that contains various district point constants over the years:
Documents containing point systems:
- 2016: same as 2015
- 2015: http://www.firstinspires.org/sites/default/files/uploads/resource_library/... | mit | 21ef41b6102a37a612c23d8cff4d4acd | 33.42236 | 148 | 0.608625 | 3.216483 | false | false | false | false |
the-blue-alliance/the-blue-alliance | ops/dev/vagrant/create_auth_emulator_accounts.py | 1 | 2099 | import argparse
parser = argparse.ArgumentParser(
description="Create deafult users in the Firebase authentication emulator."
)
parser.add_argument(
"--project", dest="project", required=True, help="project ID for auth emulator"
)
parser.add_argument(
"--emulator-host",
dest="emulator_host",
defau... | mit | 3f1491e6a9c4e8d0953a738fbaca248a | 24.289157 | 83 | 0.546451 | 3.982922 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/controllers/gcm/gcm.py | 5 | 11587 | ################################################################################
# gae_python_gcm/gcm.py
#
# In Python, for Google App Engine
# Originally ported from https://github.com/Instagram/node2dm
# Extended to support new GCM API.
# Greg Bayer <greg@gbayer.com>
#
# From: https://github.com/gregbayer/gae-python-... | mit | 9c97af8bf1394d52dc7fdb8be2433a5c | 39.799296 | 210 | 0.581427 | 4.192113 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/tasks_io/datafeeds/parsers/parser_html.py | 1 | 2085 | import abc
# import re
from typing import TypeVar
from backend.tasks_io.datafeeds.parsers.parser_base import ParserBase
TParsedResponse = TypeVar("TParsedResponse")
class ParserHTML(ParserBase[TParsedResponse]):
"""
Provides a basic structure for parsing pages.
Parsers are not allowed to return Model ... | mit | d59ddfc20471e78b5761c90c847451cb | 31.076923 | 113 | 0.548201 | 3.979008 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.