max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
DynamicModel/io.py | horribleheffalump/AUVResearch | 4 | 12771051 | <reponame>horribleheffalump/AUVResearch<gh_stars>1-10
"""Save/load operations
"""
import numpy as np
import pandas as pd
from glob import glob
from sys import maxsize, float_info
def save_path(filename, x):
np.savetxt(filename, x, fmt='%f')
def save_many(filename_template, x, start_from=0, total=None):
if ... | 2.125 | 2 |
ee/api/chalicelib/blueprints/bp_saml.py | champkeh/openreplay | 1 | 12771052 | from chalice import Blueprint
from chalicelib import _overrides
from chalicelib.utils.SAML2_helper import prepare_request, init_saml_auth
app = Blueprint(__name__)
_overrides.chalice_app(app)
from chalicelib.utils.helper import environ
from onelogin.saml2.auth import OneLogin_Saml2_Logout_Request
from onelogin.saml... | 2.15625 | 2 |
utils/ranked.py | Plux1/imagelab | 0 | 12771053 | import numpy as np
def rank5_accuracy(predictions, labels):
# initialize the rank-1 and rank-5 accuracies
rank_1 = 0
rank_5 = 0
# new_predictions = []
# loop over the predictions and the ground-truth labels
for (prediction_, ground_truth) in zip(predictions, labels):
# sort the probab... | 2.828125 | 3 |
cogs/example.py | StvenYun/BBBot | 0 | 12771054 | <gh_stars>0
from discord.ext import commands
#######################KEY COMPONENT#########################
class Example(commands.Cog):
def __init__(self, bot):
self.bot = bot
#######################KEY COMPONENT#########################
#Events
@commands.Cog.listener()
async def on_ready(... | 2.515625 | 3 |
sippycode/twitter/sippy_twitter.py | schreck2/sippycode | 0 | 12771055 | # Copyright 2008 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 2.5 | 2 |
yarnrunner_python/vm_std_lib.py | mapto/YarnRunner-Python | 2 | 12771056 | <gh_stars>1-10
functions = {
'Add': (2, lambda p: p[0] + p[1]),
'Minus': (2, lambda p: p[0] - p[1]),
'UnaryMinus': (1, lambda p: -p[0]),
'Divide': (2, lambda p: p[0] / p[1]),
'Multiply': (2, lambda p: p[0] * p[1]),
'Modulo': (2, lambda p: p[0] % p[1]),
'EqualTo': (2, lambda p: p[0] == p[1]),... | 2.875 | 3 |
graphic_trees.py | nelliesnoodles/PythonDLL | 0 | 12771057 | from DLL import *
# create list
mytrees = DLList()
mytrees.push('pine')
mytrees.push('maple')
mytrees.push('palm')
mytrees.push('redwood')
mytrees.push('baobab')
mytrees.graphical()
noodles = DLList()
node1 = DLLNode(None, 'ramen', None)
node2 = DLLNode(None, 'egg', None)
node3 = DLLNode(None, 'speghe... | 2.296875 | 2 |
scrape_name.py | OpenHacks-2020/wishbot | 3 | 12771058 | <gh_stars>1-10
# NOT implemented as part of bot.py
# Possible usage: ask user if they would like to add the suggested gift (by displaying the name and soliciting a 'yes' or 'no') before adding it to the wishlist
# #-*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
def getName(url):
'''Takes a produc... | 3.453125 | 3 |
phi/physics/pressuresolver/geom.py | Neroware/PhiFlow | 13 | 12771059 | from numbers import Number
from phi import math
from phi.math.blas import conjugate_gradient
from phi.math.helper import _dim_shifted
from phi.physics.field import CenteredGrid
from .solver_api import PoissonDomain, PoissonSolver
class GeometricCG(PoissonSolver):
def __init__(self, accuracy=1e-5, gradient_accur... | 2.765625 | 3 |
COMET/ui_plugins/Alignment_window.py | dallaval5u/COMET | 0 | 12771060 | <filename>COMET/ui_plugins/Alignment_window.py
import ast
import json
import os
import os.path as osp
import sys, importlib, logging
import numpy as np
import pyqtgraph as pq
from PyQt5.QtCore import Qt
from PyQt5 import QtGui
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from random import randint
from time... | 2.0625 | 2 |
playground/playground.py | llv22/pyalgorithm | 0 | 12771061 | <gh_stars>0
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.2
# kernelspec:
# display_name: Python 3
# language: python
# name: pyth... | 2.890625 | 3 |
djecommerce/settings/production.py | IHIMEKPEN/Pegasus | 0 | 12771062 | from .base import *
DEBUG = config('DEBUG', cast=bool)
ALLOWED_HOSTS = ['*']
AUTH_PASSWORD_VALIDATORS = [
{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'},
{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'},
{'NAME': 'django.contrib.auth.password... | 1.679688 | 2 |
api.py | Wern-rm/UnitPay-PythonAPI | 1 | 12771063 | from flask import Flask
import locale
from flask_sqlalchemy import SQLAlchemy
from config import Config
app = Flask(__name__)
app.config.from_object(Config)
locale.setlocale(locale.LC_ALL, '')
db = SQLAlchemy(app)
@app.route('/')
def index():
return 'UnitPay API'
from models import UnitpayPayments, AccountData... | 2.3125 | 2 |
updates_to_drs/mf_ccf_mask_may2020.py | njcuk9999/apero-utils | 2 | 12771064 | import numpy as np
from astropy.io import fits
from astropy.table import Table
from scipy.interpolate import InterpolatedUnivariateSpline
import matplotlib.pyplot as plt
#from scipy.signal import medfilt
# Your input template
template = 'Template_s1d_Gl699_sc1d_v_file_AB.fits'
# template = 'Template_s1d_Gl15A_sc1d_v_f... | 2.375 | 2 |
scrapperwheather101.py | srgautam01/Weather | 0 | 12771065 | <reponame>srgautam01/Weather
import requests
from bs4 import BeautifulSoup
print("Downloading page...")
page = requests.get("https://forecast.weather.gov/MapClick.php?lat=30.504170000000045&lon=-90.45845999999995")
assert page.status_code == 200
print("Parsing HTML...")
soup = BeautifulSoup(page.content, 'html.parser... | 3.453125 | 3 |
tests/test_ktbxsosdconfig.py | tmbx/kctl | 0 | 12771066 | <filename>tests/test_ktbxsosdconfig.py
# -*- mode: python; tab-width: 4; indent-tabs-mode: t; py-indent-offset: 4 -*-
import sys
# Make sure we test local classes first.
sys.path.insert(0, '.')
import unittest
from kctllib.ktbxsosdconfig import *
class KTbxsosdConfigTest(unittest.TestCase):
def test(self):
... | 2.578125 | 3 |
ocellaris_post/inspector/panel_files.py | TormodLandet/Ocellaris | 1 | 12771067 | <reponame>TormodLandet/Ocellaris
# Copyright (C) 2017-2019 <NAME>
# SPDX-License-Identifier: Apache-2.0
import yaml
import wx
from . import pub, TOPIC_METADATA, TOPIC_RELOAD
class OcellarisFilesPanel(wx.Panel):
def __init__(self, parent, inspector_state):
super().__init__(parent)
self.istate = in... | 1.976563 | 2 |
src/werkzeug/wrappers/__init__.py | omerholz/werkzeug | 0 | 12771068 | <reponame>omerholz/werkzeug
from .accept import AcceptMixin
from .auth import AuthorizationMixin, WWWAuthenticateMixin
from .base_request import BaseRequest
from .base_response import BaseResponse
from .common_descriptors import (
CommonRequestDescriptorsMixin,
CommonResponseDescriptorsMixin,
)
from .etag impor... | 1.1875 | 1 |
letsencrypt/client/acme.py | rcoscali/lets-encrypt-preview | 1 | 12771069 | <gh_stars>1-10
#!/usr/bin/env python
# acme.py
# validate JSON objects as ACME protocol messages
import json, jsonschema
import pkg_resources
schemata = {schema: json.load(open(pkg_resources.resource_filename(
__name__, "schemata/%s.json" % schema))) for schema in [
"authorization", "authorizationRequest", "ce... | 2.890625 | 3 |
testarch/unet/model.py | weihao94/deepdyn | 42 | 12771070 | <reponame>weihao94/deepdyn<gh_stars>10-100
import torch
import torch.nn.functional as F
from torch import nn
from utils.weights_utils import initialize_weights
class _DoubleConvolution(nn.Module):
def __init__(self, in_channels, middle_channel, out_channels, p=0):
super(_DoubleConvolution, self).__init__... | 2.25 | 2 |
solution_10.py | johndunne2019/pands-problem-set | 1 | 12771071 | # This program displays a plot of the functions x, x2 and 2x in the range [0, 4]
# <NAME> 2019-03-24
# I formulated this solution using the week 9 lectures as a starting point followed by further reading and research which is detailed further in the references section in the Readme file
# Additional reading included th... | 4.375 | 4 |
single qubit/deep QL/environment.py | 93xiaoming/RL_state_preparation | 17 | 12771072 | import numpy as np
from scipy.linalg import expm
class Env( object):
def __init__(self,
action_space=[0,1,2],
dt=0.1):
super(Env, self).__init__()
self.action_space = action_space
self.n_actions = len(self.action_space)
self.n_features = 4
self.state = np.arr... | 2.328125 | 2 |
server/equationObject.py | petnica-rac-seminari/stunning-calculator-2021 | 1 | 12771073 | from pydantic import BaseModel
class EquationObject(BaseModel):
equation: str | 1.773438 | 2 |
girder/app/app/constants.py | bnmajor/mongochemserver | 14 | 12771074 | class Features:
NOTEBOOKS = 'app.features.notebooks'
class Deployment:
SITE = 'app.deployment.site'
class Branding:
PRIVACY = 'app.configuration.privacy'
LICENSE = 'app.configuration.license'
HEADER_LOGO_ID = 'app.configuration.header.logo.file.id'
FOOTER_LOGO_ID = 'app.configuration.footer.lo... | 1.398438 | 1 |
vanilla_gan.py | Immocat/csc321_assignment4 | 0 | 12771075 | # CSC 321, Assignment 4
#
# This is the main training file for the vanilla GAN part of the assignment.
#
# Usage:
# ======
# To train with the default hyperparamters (saves results to checkpoints_vanilla/ and samples_vanilla/):
# python vanilla_gan.py
import os
import pdb
import pickle
import argparse
import... | 2.390625 | 2 |
python/examples/core/variables.py | chelini/iree-llvm-sandbox | 29 | 12771076 | <reponame>chelini/iree-llvm-sandbox
"""Utilities for search space exploration over linalg operations."""
import typing as tp
class Variable:
'Abstract class used as a base for all search variables.'
def __init__(self, name):
self.name = name
def assign(self, assignments, value):
'Assigns variable to ... | 2.8125 | 3 |
wordrank/feature.py | shibing624/term-weighting | 28 | 12771077 | <reponame>shibing624/term-weighting<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>)
@description:
"""
from wordrank import config
from wordrank.features.language_feature import LanguageFeature
from wordrank.features.statistics_feature import StatisticsFeature
from wordrank.features.text_feature im... | 2.421875 | 2 |
snapchat_problems/problem_5.py | loftwah/Daily-Coding-Problem | 129 | 12771078 | <filename>snapchat_problems/problem_5.py
"""This problem was asked by Snapchat.
You are given an array of length N, where each element i represents the number of ways
we can produce i units of change. For example, [1, 0, 1, 1, 2] would indicate that
there is only one way to make 0, 2, or 3 units, and two ways of mak... | 4.0625 | 4 |
ex068.py | juniorpedroso/Exercicios-CEV-Python | 0 | 12771079 | <reponame>juniorpedroso/Exercicios-CEV-Python<gh_stars>0
from random import randint
venceu = 0 # iniciando a variável de quantas vezes o usuário venceu
print('-=' * 20)
print('VAMOS JOGAR PAR OU IMPAR')
while True:
print('-=' * 20)
usuario_valor = int(input('Digite um valor: ')) # Recebe o valor do usuário
... | 3.84375 | 4 |
ejemplos/worldcup/bpgoleslv.py | amherag/databook | 0 | 12771080 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv('fifa-world-cup/WorldCupMatches.csv')
goles = map(sum,zip(df['Home Team Goals'], df['Away Team Goals']))
fig, ax = plt.subplots()
# the histogram of the data
ax.boxplot(list(goles),
vert=True, # vertical box alignment... | 3.125 | 3 |
neighbourhoodapp/migrations/0005_auto_20200326_1744.py | marknesh/neighbourhood-watch | 0 | 12771081 | # Generated by Django 3.0.4 on 2020-03-26 14:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('neighbourhoodapp', '0004... | 1.609375 | 2 |
anchor_txt/__init__.py | vitiral/anchor | 1 | 12771082 | <reponame>vitiral/anchor<gh_stars>1-10
# anchor_txt: attributes in markdown
#
# Copyright (C) 2019 <NAME> <github.com/vitiral>
#
# The source code is Licensed under either of
#
# * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE... | 2.984375 | 3 |
ttt/t2t_trainer.py | wangcongcong123/ | 42 | 12771083 | ''''
this is a customize trainer for T5-like mode training,
in this class, the training loop is customized for more flexibility and control over
'''
import math
import os
import sys
import warnings
import tensorflow as tf
from tqdm import tqdm
from sklearn.metrics import accuracy_score, classification_report
import nu... | 2.515625 | 3 |
jp.atcoder/abc032/abc032_d/8538935.py | kagemeka/atcoder-submissions | 1 | 12771084 | <reponame>kagemeka/atcoder-submissions
# 2019-11-20 22:09:02(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op... | 2.28125 | 2 |
src/utils/callbacks.py | Neelesh-Jaiswal/perceptron_implementation | 0 | 12771085 | import tensorflow as tf
import os
import numpy as np
import time
def get_timestamp(name):
timestamp = time.asctime().replace(' ', '_').replace(':', '')
unique_name = f'{name}_at_{timestamp}'
return unique_name
def get_callbacks(config, X_train):
logs = config['logs']
unique_dir_name = get_timest... | 2.078125 | 2 |
Laplace_experiments/cifar/new_models/__init__.py | Sanaelotfi/Bayesian_model_comparison | 11 | 12771086 | <reponame>Sanaelotfi/Bayesian_model_comparison
from .fixup_resnet_cifar import *
from .resnet_cifar import *
from .cnn_models import * | 0.824219 | 1 |
pyringe/plugins/mod_base.py | Freezind/pyringe | 507 | 12771087 | #! /usr/bin/env python
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 2.1875 | 2 |
next/database_client/CacheStore/redis_data_structures/matrix-test2.py | sumeetsk/NEXT-1 | 0 | 12771088 | import redismatrix
import numpy
import time
import matplotlib.pyplot as plot
from numpy import *
from numpy.random import *
from redismatrix import *
from matplotlib.font_manager import FontProperties
def main():
file2 = open('T[i][j].txt', 'w')
file3 = open('test.txt', 'w')
n = 100 # ... | 3.234375 | 3 |
tests/utils.py | FantasqueX/censys-python | 1 | 12771089 | <gh_stars>1-10
import unittest
import responses
from censys.common.base import CensysAPIBase
BASE_URL = "https://search.censys.io/api"
V1_URL = BASE_URL + "/v1"
V2_URL = BASE_URL + "/v2"
class CensysTestCase(unittest.TestCase):
api_id = "test-api-id"
api_secret = "test-api-secret"
api_key = "test-api-k... | 2.65625 | 3 |
extra_files/helper.py | aldpdz/ssd_keras | 0 | 12771090 | <reponame>aldpdz/ssd_keras
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import os
from scipy import misc
from imageio import imwrite, imread
def save_images_to(path_from, path_to, list_img_names):
'''
Save images into a path
path_from: path where to load the images
pat... | 2.625 | 3 |
apps/home.py | nikhil-96/Hawkeye_Viz | 1 | 12771091 | from dash import html
import dash_bootstrap_components as dbc
import pandas as pd
import json
# Reading accidents, casualty and vehicles data from last 5 years
dfa = pd.read_csv('data/dft-road-casualty-statistics-accident-last-5-years.csv', low_memory=False)
dfc = pd.read_csv('data/dft-road-casualty-statistics-casual... | 3.0625 | 3 |
app/models/cart.py | ea137/mini-amazon-skeleton | 0 | 12771092 | from flask import current_app as app
from .cart_product import Cart_Product
class Cart:
def __init__(self, id, pid, quantity):
self.id = id
self.pid = pid
self.quantity = quantity
@staticmethod
def get(id):
try:
rows = app.db.execute('''
SELECT p.id... | 2.90625 | 3 |
Day 17/main.py | anti-batman/100-Days-of-Code | 72 | 12771093 | <reponame>anti-batman/100-Days-of-Code
from question_model import Question
from data import question_data
from quiz_brain import QuizBrain
question_bank = []
for question in question_data:
# Loading the question & answers
question_text = question["question"]
question_answer = question["correct_answer"]
... | 3.296875 | 3 |
cloudberry-py/cloudberry/api/query.py | olliekrk/cloud-berry | 0 | 12771094 | <reponame>olliekrk/cloud-berry<filename>cloudberry-py/cloudberry/api/query.py
import requests
from .backend import CloudberryConfig, CloudberryApi
from .model import DataSeries
class Query(CloudberryApi):
def __init__(self, config: CloudberryConfig) -> None:
super().__init__(config)
self.base_ur... | 2.359375 | 2 |
tools/timestamper/timestamper.py | NatLibFi/Finto-data | 14 | 12771095 | <gh_stars>10-100
#!/usr/bin/env python
# Utility to generate dct:created and dct:modified timestamps (xsd:date) for
# SKOS concepts.
# The idea is that for each concept, a hash (MD5) is calculated based on the
# triples where that concept is either the subject or object. Whenever the
# triples change, the hash will b... | 2.640625 | 3 |
certificate_mailer/__init__.py | GauravPatel89/EPAi2_capstone | 0 | 12771096 | from .core import *
from .helpers import *
from .mailer_utils import * | 1.039063 | 1 |
webtable_recognition/evaluator.py | jonashering/webtable-recognition | 0 | 12771097 | <gh_stars>0
from sklearn.metrics import classification_report
def evaluation_report(Y_true, Y_pred, classes=None):
print(classification_report(Y_true, Y_pred, target_names=classes))
| 2.078125 | 2 |
examples/volumetric/mesh2volume.py | danielhrisca/vedo | 0 | 12771098 | <filename>examples/volumetric/mesh2volume.py
"""Left: build a volume (grey) from a mesh where the
foreground voxels are 1 and the background voxels are 0.
Right: the Volume is isosurfaced.
"""
from vedo import *
s = load(datadir+"bunny.obj").normalize().wireframe()
v = mesh2Volume(s, spacing=(0.02, 0.02, 0.02)).alph... | 2.96875 | 3 |
chapter01/common.py | Alchemy2011/spider | 0 | 12771099 | <gh_stars>0
# -*- coding: utf-8 -*-
import urllib2
import urlparse
def download1(url):
"""Simple downloader"""
return urllib2.urlopen(url).read()
def download2(url):
"""Download function that catches errors"""
print 'Downloading:', url
try:
html = urllib2.urlopen(url).read()
except ... | 3.390625 | 3 |
metrics/log_collectors/training_data_service_client/tail_to_tds.py | just4jc/FfDL | 0 | 12771100 | <gh_stars>0
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import sys
from log_collectors.training_data_service_client import extract_datetime as extract_datetime
from . import push_log_line
from . import connec... | 2.203125 | 2 |
Setup.py | prbpedro/simple_peewee_flask_webapi | 0 | 12771101 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="simple_peewee_flask_webapi",
version="1.0.0",
author="<NAME>",
author_email="<EMAIL>",
description="Simple peewee Flask WEB-API",
long_description=long_description,
lon... | 1.453125 | 1 |
backend/api/views/tips.py | hack4impact-uiuc/c2tc-fall-2018 | 7 | 12771102 | <reponame>hack4impact-uiuc/c2tc-fall-2018<gh_stars>1-10
from flask import Blueprint, request, jsonify
from api.models.Tips import Tips
from api.models.User import User
from api.core import (
create_response,
serialize_list,
logger,
authenticated_route,
necessary_post_params,
can_be_authenticated... | 2.578125 | 3 |
AutoDL_sample_code_submission/at_toolkit/interface/adl_classifier.py | dianjixz/AutoDL | 1,044 | 12771103 | <reponame>dianjixz/AutoDL
import numpy as np
class AdlClassifier(object):
def init(self, class_num: int, init_params: dict):
self.class_num = class_num
self.label_map = list()
self.clf_name = None
raise NotImplementedError
def fit(self, train_examples_x: np.ndarray, train_exam... | 2.46875 | 2 |
reportPupilEngagement.py | dhicks6345789/data-tools | 0 | 12771104 | #!/usr/bin/python
import os
import io
import sys
import json
import shutil
import pandas
import dataLib
import datetime
# PIL - the Python Image Library, used for bitmap image manipulation.
import PIL
import PIL.ImageFont
import PIL.ImageDraw
# ReportLab - used for PDF document generation.
import reportlab.lib.units
... | 2.328125 | 2 |
rasalit/apps/nlucluster/app.py | omidforoqi/rasalit | 261 | 12771105 | <reponame>omidforoqi/rasalit<gh_stars>100-1000
import os
import pathlib
from io import StringIO
from pkg_resources import resource_filename
import streamlit as st
from whatlies.language import CountVectorLanguage
from whatlies.transformers import Pca, Umap
from whatlies import EmbeddingSet, Embedding
import sentencep... | 2.171875 | 2 |
main/views.py | lgb2002/club | 1 | 12771106 | from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.forms import UserCreationForm
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from main.forms import SignupForm
from django.core.paginator i... | 2.21875 | 2 |
couplet_composer/util/cache.py | anttikivi/ode-composer | 0 | 12771107 | # Copyright (c) 2020 <NAME>
# Licensed under the MIT License
"""A module that contains caching helpers.
"""
from functools import update_wrapper
__all__ = ["cached"]
def cached(func):
"""Decorator that caches result of method or function.
"""
cache = {}
def wrapper(*args, **kwargs):
key =... | 3.015625 | 3 |
replay_buffer.py | DrArryYao/PVE-MCC_for_unsignalized_intersection | 12 | 12771108 | from collections import deque
import random
import rank_based
class ReplayBuffer(object):
def __init__(self, buffer_size, batch_size=32, learn_start=2000, steps=100000, rand_s=False):
self.buffer_size = buffer_size
self.num_experiences = 0
self.buffer = deque()
self.rand_s = rand_... | 2.65625 | 3 |
gameconst.py | pestunov/game | 0 | 12771109 | <filename>gameconst.py
WIDTH = 512
HEIGHT = 336
FPS = 50
PIX_FOR_BRIX = 16
STEPS_FOR_CYCLE = 16
N_STEP_FOR_TEST = 5
BLACK = (0, 0, 0)
BKGR = (0, 0, 0)
| 1.296875 | 1 |
gottesdienstplan/auth.py | wulmer/churchtools-automation | 0 | 12771110 | import json
import os
from google.oauth2 import service_account
from googleapiclient.discovery import build
SCOPES = [
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/drive",
]
credentials = service_account.Credentials.from_service_account_info(
json.loads(os.environ["GOOG... | 2.390625 | 2 |
udp-client.py | BrandonSoto/Socket-Types | 0 | 12771111 | #!/usr/bin/env python
import socket
import time
server_name = 'localhost'
server_port = 4242
client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
for i in range(0, 25):
message = 'message ' + str(i)
client_socket.sendto(message, (server_name, server_port))
receved_message, server_address = c... | 3.109375 | 3 |
Python/Algorithms/Sieve Algorithms/Sieve of Eratosthenes.py | m-payal/AlgorithmsAndDataStructure | 195 | 12771112 | <reponame>m-payal/AlgorithmsAndDataStructure<gh_stars>100-1000
"""
Sieve of Eratosthenes :
Generate all the primes less than any integer nn
"""
from math import sqrt
def get_primes(n):
m = n + 1
# numbers = [True for i in range(m)]
numbers = [True] * m
for i in range(2, int(sqrt(n) + 1)):
... | 3.484375 | 3 |
tests/conftest.py | thusser/spexxy | 4 | 12771113 | import pytest
import numpy as np
from spexxy.grid import GridAxis, ValuesGrid
@pytest.fixture()
def number_grid():
# define grid
grid = np.array([
[1, 2, 3, 4, 5],
[3, 4, 5, 6, 7],
[2, 3, 4, 5, 6],
[4, 5, 6, 7, 8]
])
# define axes
ax1 = GridAxis(name='x', values=l... | 2.421875 | 2 |
src/database/biz/Accounts/Accounts.py | ytitweb/GitHub.Uploader.Pi3.Https.201802230700 | 0 | 12771114 | <reponame>ytitweb/GitHub.Uploader.Pi3.Https.201802230700
from database.Database import Database as Db
class Accounts:
def __init__(self, db):
#self.__db = Database().Accounts
#self.__db = Db()._Database__Initializers[self.__class__.__name__].Db
self.__db = db # dataset.connect('sqlite:///' ... | 2.71875 | 3 |
sys_simulator/general/actions_discretizations.py | lbaiao/sys-simulator-2 | 1 | 12771115 | <reponame>lbaiao/sys-simulator-2
import numpy as np
def db_five(min_value: float, max_value: float):
a_max = max_value - 10
aux = np.linspace(a_max-30, a_max, 4)
actions = [min_value, *aux]
return actions
def db_six(min_value: float, max_value: float):
a_max = max_value - 10
aux = np.linspac... | 2.828125 | 3 |
CybORG/CybORG/Agents/SimpleAgents/B_line.py | rafvasq/cage-challenge-1 | 18 | 12771116 | from CybORG.Agents import BaseAgent
from CybORG.Shared import Results
from CybORG.Shared.Actions import PrivilegeEscalate, ExploitRemoteService, DiscoverRemoteSystems, Impact, \
DiscoverNetworkServices, Sleep
class B_lineAgent(BaseAgent):
def __init__(self):
self.action = 0
self.target_ip_addr... | 2.65625 | 3 |
mailer/__main__.py | snoonetIRC/anope-mailer-daemon | 0 | 12771117 | import time
from .daemon import Daemon
def main():
daemon = Daemon()
while True:
daemon.tick()
files = daemon.get_email_files()
for file in files:
try:
daemon.handle_email(file)
except Exception:
daemon.on_error()
time.s... | 2.65625 | 3 |
tools/fake_robot.py | BHAY-3DiTex/Pyluos | 16 | 12771118 | from __future__ import division
import json
from time import time
from random import randint, choice
from threading import Timer
from tornado.ioloop import IOLoop
from tornado.web import Application
from tornado.websocket import WebSocketHandler
class RepeatedTimer(object):
def __init__(self, interval, functio... | 2.4375 | 2 |
src/vessel_NN_training.py | Binjie-Qin/SVS-net | 8 | 12771119 | ###################################################
#
# Script to:
# - Load the images and extract the patches
# - Define the neural network
# - define the training
#
##################################################
import numpy as np
import configparser
from keras.utils import multi_gpu_model
... | 2.359375 | 2 |
converters/ipynb.py | ekmixon/journal-cli | 11 | 12771120 | <gh_stars>10-100
from os import path, makedirs
import click
from config import config
from commands.util import generate_image_path, generate_post_path
IPYNB_TEMPLATE = '''
{%- extends 'markdown.tpl' -%}
{% block data_text scoped %}
```ipynb-output
{{ output.data['text/plain']}}
```
{% endblock data_text %}
{% blo... | 2.609375 | 3 |
main_loglizer.py | zaihanLit/logbert | 0 | 12771121 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
from loglizer import InvariantsMiner, PCA, IsolationForest, OneClassSVM, LogClustering, LR
from loglizer import dataloader, preprocessing
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--output_dir", metavar="DIR", h... | 2.4375 | 2 |
clevr/helper.py | Clevrai/Clevr | 0 | 12771122 | <gh_stars>0
import base64
import os
import json
from clevr.library_helpers import Library_Functions
class Helper():
def image_learner_object(directory_object):
if type(directory_object) != dict:
raise Exception('Parameter directory_object must be a dictionary.')
learner = {}
v... | 2.609375 | 3 |
src/p4rrot/known_types.py | gycsaba96/P4RROT | 0 | 12771123 | #
# Classes representing available types and their P4 equivalent.
#
from typing import Dict, List, Tuple
import ctypes
from functools import lru_cache
class KnownType:
"""
Base class of available types.
"""
pass
class uint8_t(KnownType):
def get_p4_type() -> str:
return 'bit<8>'
def... | 2.921875 | 3 |
vidyo/__init__.py | parafoxia/vidyo | 0 | 12771124 | <filename>vidyo/__init__.py
__productname__ = "vidyo"
__version__ = "0.1.0"
__description__ = "A simple way to get information on YouTube videos."
__url__ = "https://github.com/parafoxia/vidyo"
__docs__ = "https://vidyo.readthedocs.io/en/latest/"
__author__ = "<NAME>"
__license__ = "BSD-3-Clause"
__bugtracker__ = "http... | 1.570313 | 2 |
gdrive_sync/tasks_test.py | mitodl/ocw-studio | 2 | 12771125 | """Tests for gdrive_sync tasks"""
from datetime import datetime
import pytest
import pytz
from gdrive_sync import tasks
from gdrive_sync.conftest import LIST_FILE_RESPONSES, LIST_VIDEO_RESPONSES
from gdrive_sync.constants import (
DRIVE_API_FILES,
DRIVE_FILE_FIELDS,
DRIVE_FOLDER_FILES_FINAL,
DRIVE_FOL... | 2.109375 | 2 |
sparse/repos/CINPLA/exdir/setup.py | yuvipanda/mybinder.org-analytics | 1 | 12771126 | # -*- coding: utf-8 -*-
from setuptools import setup
import os
from setuptools import setup, find_packages
import versioneer
long_description = open("README.md").read()
install_requires = []
setup(
name="exdir",
packages=find_packages(),
include_package_data=True,
version=versioneer.get_version(),
... | 1.132813 | 1 |
pytfa/optim/config.py | embt/pytfa | 30 | 12771127 | # -*- coding: utf-8 -*-
"""
.. module:: pytfa
:platform: Unix, Windows
:synopsis: Thermodynamics-based Flux Analysis
.. moduleauthor:: pyTFA team
Pre-tuned configurations for faster solving
"""
def dg_relax_config(model):
"""
:param model:
:return:
"""
# grbtune output on a hard model :
... | 2.09375 | 2 |
vnpy/trader/app/cmaStrategy/__init__.py | ghjan/vnpy | 4 | 12771128 | # encoding: UTF-8
from vnpy.trader.app.cmaStrategy.cmaEngine import CmaEngine
from vnpy.trader.app.cmaStrategy.uiCmaWidget import CmaEngineManager
appName = 'CrossMarketArbitrage'
appDisplayName = u'跨市场套利'
appEngine = CmaEngine
appWidget = CmaEngineManager
appIco = 'cma.ico' | 1.171875 | 1 |
data/external/repositories/113677/KaggleBillionWordImputation-master/scripts/count_syntactic_ngrams.py | Keesiu/meta-kaggle | 0 | 12771129 | <filename>data/external/repositories/113677/KaggleBillionWordImputation-master/scripts/count_syntactic_ngrams.py<gh_stars>0
#!/usr/bin/env python
'''
Count frequency of each syntactic n-gram and save to Pickle file.
The n-gram frequencies are held in an in-memory dict, so this script
can only be used if the vocab is s... | 2.796875 | 3 |
test/__init__.py | KnowledgeCaptureAndDiscovery/sosen | 4 | 12771130 | <reponame>KnowledgeCaptureAndDiscovery/sosen
import unittest
from .test_data_to_graph import *
from .end_to_end import *
if __name__ == "__main__":
unittest.main() | 0.964844 | 1 |
cogs/mine.py | dashr9230/Discord-Bot | 1 | 12771131 |
from discord.ext import commands
from PIL import Image
import discord, datetime, re
import PIL, shutil, os, random
class MineBase:
def __init__(self, member):
self.grid = [[0 for x in range(12)] for y in range(12)]
self.grid_show = [[0 for x in range(12)] for y in range(12)]
self.file = f"... | 2.65625 | 3 |
src/pyshowdown/message.py | ScottehMax/pyshowdown | 0 | 12771132 | <gh_stars>0
import json
from typing import Optional, List, Dict
from pyshowdown.user import User
class Message:
def __init__(self, room: str, message_str: str):
"""Initialize a Message object.
Args:
room (str): The room the message was sent to.
message_str (str): The raw ... | 2.90625 | 3 |
tests/test_kubernetes.py | riksu-raksu/k-lga | 0 | 12771133 | <reponame>riksu-raksu/k-lga
import base64
import os
import tempfile
from pathlib import Path
import pytest
from kubernetes.client.rest import ApiException
from kolga.libs.kubernetes import Kubernetes
from kolga.libs.project import Project
from kolga.utils.general import get_deploy_name
from kolga.utils.models import ... | 2.09375 | 2 |
tempus/timetracking/models.py | rixx/tempus | 3 | 12771134 | <reponame>rixx/tempus
import datetime
import random
import os
import yaml
import pytz
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.template.defaultfilters import slugify
class BaseTimetracking(models.Model):
name = models.CharField(max_len... | 1.976563 | 2 |
setup.py | Jimdo/nagios2trac | 0 | 12771135 | #!/usr/bin/env python
from setuptools import Command, setup
import sys
class PyPandoc(Command):
description = 'Generates the documentation in reStructuredText format.'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def convert(self, infile... | 2.015625 | 2 |
synthqc/errors.py | jcreinhold/synthqc | 0 | 12771136 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
synthqc.errors
This module holds project defined errors
Author: <NAME> (<EMAIL>)
Created on: Nov 15, 2018
"""
class SynthQCError(Exception):
pass
| 1.273438 | 1 |
test/test_wordle_core.py | tanayseven/wordle-solver-bot | 1 | 12771137 | import pytest
from core import WordsRepository
@pytest.mark.parametrize(
"input_words,forget_letters,remaining_words",
[
("urger,ribat,anorn,stram,sofar", "ugo", "ribat,stram")
]
)
def test_forget_letters(input_words, forget_letters, remaining_words):
input_words = tuple(input_words.split(','... | 2.734375 | 3 |
Model/Models.py | BluePinetree/KaKR_3rd_month-Car_class_classification | 0 | 12771138 | import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.applications.resnet50 import ResNet50
from keras.applications.inception_v3 import InceptionV3
from keras.applications.xception import Xception
# from efficientnet.keras import EfficientNetB3
from keras_preprocessing.i... | 2.578125 | 3 |
Python/API Sellsy/__version__.py | Cantin-L/Professionelle | 1 | 12771139 | __title__ = 'Sellsy'
__description__ = 'https://api.sellsy.fr/documentation/methodes'
__version__ = '0.0.4'
__author__ = '<NAME>.'
print("API de ", __title__ ," lien de la documentation : ", __description__ ," c'est la version ", __version__ ," développer par ", __author__)
| 1.179688 | 1 |
readme/forms.py | audax/pypo | 25 | 12771140 | <filename>readme/forms.py
from crispy_forms import layout
from django import forms
from django.conf import settings
from django.utils.encoding import force_text
from haystack.forms import FacetedSearchForm
import six
from taggit.forms import TagWidget
from .models import Item, UserProfile
from crispy_forms.helper impor... | 2.28125 | 2 |
language-learning/python/tricks/equal_vs_is.py | imteekay/programming-language-research | 24 | 12771141 | a = [1, 2, 3]
b = a
print(a == b)
# => True
print(a is b)
# => True
c = list(a)
# == evaluates to true if the objects referred by the variables are equal
print(a == c)
# => True
# is evaluates to true if both variables point to the same object
print(a is c)
# => false
| 3.953125 | 4 |
dnnv/nn/transformers/simplifiers/convert_batch_norm.py | samysweb/dnnv | 5 | 12771142 | import numpy as np
from copy import copy
from .base import Simplifier
from ... import operations
from ...analyzers import SplitAnalysis
class ConvertBatchNorm(Simplifier):
ANALYSES = {"is_split": SplitAnalysis}
def visit_BatchNormalization(self, operation: operations.BatchNormalization):
input_op =... | 2.453125 | 2 |
research/cv/NFNet/src/models/NFNet/classifier.py | mindspore-ai/models | 77 | 12771143 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2.25 | 2 |
config.py | gokul-uf/tf-BEGAN | 0 | 12771144 | import tensorflow as tf
class Config:
batch_size = 16
n = 13 # TODO: change
embedding_dim = 64
z_low_limit = -1
z_high_limit = 1
img_width = 64
img_height = 64
num_channel = 3
lambda_k = 0.001
gamma = 0.5
k_0 = 0
lr = 5e-5
sample_location = "../samples"
num... | 2.21875 | 2 |
SIDRE/core.py | joshwalawender/SIDRE | 1 | 12771145 | <reponame>joshwalawender/SIDRE<filename>SIDRE/core.py<gh_stars>1-10
import os
import sys
import re
import tempfile
import logging
from glob import glob
from datetime import datetime as dt
if sys.version_info.major == 2:
import subprocess32 as subprocess
elif sys.version_info.major == 3:
import subprocess
impor... | 1.78125 | 2 |
app/create_newsletter.py | cheevahagadog/barker | 12 | 12771146 | <gh_stars>10-100
# -*- coding:utf-8 -*-
"""Fetches bookmark data and renders the email HTML file"""
from jinja2 import Environment, FileSystemLoader
import pandas as pd
import requests
from bs4 import BeautifulSoup as bs
from textblob import TextBlob
import datetime
from gensim.summarization import summarize
import co... | 2.78125 | 3 |
milkviz/__init__.py | Mr-Milk/milkviz | 0 | 12771147 | <reponame>Mr-Milk/milkviz<filename>milkviz/__init__.py
from ._bubble import bubble
from ._cell_map import point_map, polygon_map
from ._clustermap import anno_clustermap
from ._dot import dot
from ._dot_matrix import dot_heatmap
from ._graph import graph
from ._stacked_bar import stacked_bar
from ._upset import upset
f... | 0.96875 | 1 |
masar_cheques/overrides/overrides.py | karamakcsc/masar_cheques | 0 | 12771148 | import frappe
import erpnext
from frappe import throw, msgprint, _
from erpnext.accounts.doctype.payment_entry.payment_entry import PaymentEntry
def custom_add_bank_gl_entries(self, gl_entries):
if self.mode_of_payment == "Cheque":
if self.payment_type in ("Pay", "Internal Transfer"):
for d in self.get("payme... | 2.015625 | 2 |
python-real-time-application/views/base_project_main_qt4.py | italogsfernandes/emg-moviments-classifier | 2 | 12771149 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'layouts/base_project_main.ui'
#
# Created by: PyQt4 UI code generator 4.12.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
d... | 1.625 | 2 |
config/printout_info.py | etfovac/rpi_cam | 0 | 12771150 | <reponame>etfovac/rpi_cam<filename>config/printout_info.py<gh_stars>0
import platform
import datetime
import psutil
import subprocess
import sys
import os
sys.path.append(os.path.abspath(".."))
import config.printout_format as cpf
plt_id = platform.uname()
degree = chr(223) # spec. char for ° for LCD
def get_ip():
... | 2.28125 | 2 |