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 |
|---|---|---|---|---|---|---|
Module/nikodou_information.py | RyoTozawa/LineBot | 1 | 17800 | <reponame>RyoTozawa/LineBot
#!/usr/bin/env python3
# coding:utf-8
import urllib
from xml.etree import ElementTree
import xml.dom.minidom as md
class Niko(object):
def __init__(self):
self.url_ranking = 'http://www.nicovideo.jp/ranking/fav/hourly/sing?rss=2.0&lang=ja-jp'
self.url_news = 'http://new... | 2.765625 | 3 |
climbing/add_new_climbs.py | JiriKalvoda/slama.dev | 7 | 17801 | <filename>climbing/add_new_climbs.py<gh_stars>1-10
#!/usr/bin/env python3
import os
import shutil
from subprocess import Popen, PIPE
from datetime import date
import yaml
os.chdir(os.path.dirname(os.path.realpath(__file__)))
CLIMBING_FOLDER = "."
CLIMBING_VIDEOS_FOLDER = os.path.join(CLIMBING_FOLDER, "videos")
CLI... | 2.59375 | 3 |
posts/models.py | dnetochaves/blog | 0 | 17802 | from django.db import models
from categorias.models import Categoria
from django.contrib.auth.models import User
from django.utils import timezone
# Create your models here.
class Post(models.Model):
titulo_post = models.CharField(max_length=50, verbose_name='Titulo')
autor_post = models.ForeignKey(User, on_... | 2.21875 | 2 |
src/ros_vision_interaction/examples/example_interaction.py | HaaaO/vision-project | 0 | 17803 | #!/usr/bin/env python
import datetime
import logging
import os
import random
import rospy
import schedule
from interaction_engine.cordial_interface import CordialInterface
from interaction_engine.database import Database
from interaction_engine.int_engine import InteractionEngine
from interaction_engine.message impor... | 2.171875 | 2 |
explicalib/distribution/multiclass_distribution.py | euranova/estimating_eces | 2 | 17804 | <reponame>euranova/estimating_eces
# -*- coding: utf-8 -*-
"""
@author: nicolas.posocco
"""
from abc import ABC
import numpy as np
class MulticlassDistribution(ABC):
def __init__(self):
"""
Initializes the distribution, allowing later sampling and posterior probabilities calculations.
""... | 2.984375 | 3 |
test.py | JulioPDX/ci_cd_dev | 6 | 17805 | #!/usr/bin/env python
"""Script used to test the network with batfish"""
from pybatfish.client.commands import *
from pybatfish.question import load_questions
from pybatfish.client.asserts import (
assert_no_duplicate_router_ids,
assert_no_incompatible_bgp_sessions,
assert_no_incompatible_ospf_sessions,
... | 2.390625 | 2 |
algs15_priority_queue/circular_queue.py | zhubaiyuan/learning-algorithms | 0 | 17806 | """
A fixed-capacity queue implemented as circular queue.
Queue can become full.
* enqueue is O(1)
* dequeue is O(1)
"""
class Queue:
"""
Implementation of a Queue using a circular buffer.
"""
def __init__(self, size):
self.size = size
self.storage = [None] * size
self.first =... | 4.09375 | 4 |
pos_evaluation/create_train_dev_old.py | ayyoobimani/GNN-POSTAG | 0 | 17807 | <reponame>ayyoobimani/GNN-POSTAG
"""
Create train and dev set from bronze data
Example call:
$ python3 create_train_dev.py --pos /mounts/work/ayyoob/results/gnn_align/yoruba/pos_tags_tam-x-bible-newworld_posfeatFalse_transformerFalse_trainWEFalse_maskLangTrue.pickle --bible tam-x-bible-newworld.txt --bronze 1 --lang t... | 2.734375 | 3 |
lib/spack/spack/test/permissions.py | SimeonEhrig/spack | 2 | 17808 | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import pytest
import stat
from spack.hooks.permissions_setters import (
chmod_real_entries, InvalidPermissi... | 1.84375 | 2 |
data_statistics/variable_statistics.py | go-jugo/ml_event_prediction_trainer | 0 | 17809 | import dask.dataframe as dd
def descibe_dataframe(df):
error_cols = [col for col in df.columns if 'errorCode' in col]
df = df.categorize(columns=error_cols)
statistics = df.describe(include='all').compute()
statistics = statistics.T
statistics.to_excel('../statistics/variables_statistics.xls... | 3.0625 | 3 |
code/com/caicongyang/python/study/base/pandas_sql.py | caicongyang/python-study | 0 | 17810 | <filename>code/com/caicongyang/python/study/base/pandas_sql.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy as np
import pandas as pd
'''
如何用sql的方式打开pandas
'''
from pandas import DataFrame, Series
from pandasql import sqldf, load_meat, load_births
df1 = DataFrame({'name': ['jack', 'tony', 'pony'], 'data1'... | 3.8125 | 4 |
tests/test_publish_parq.py | jacobtobias/s3parq | 0 | 17811 | <reponame>jacobtobias/s3parq<filename>tests/test_publish_parq.py
import pytest
from mock import patch
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import boto3
from string import ascii_lowercase
import random
from dfmock import DFMock
import s3parq.publish_parq as parq
import s3fs
from moto imp... | 1.835938 | 2 |
docs/examples/examplesCategorization.py | benstear/pyiomica | 12 | 17812 | <gh_stars>10-100
#import sys
#sys.path.append("../..")
import pyiomica as pio
from pyiomica import categorizationFunctions as cf
if __name__ == '__main__':
# Unzip example data
with pio.zipfile.ZipFile(pio.os.path.join(pio.ConstantPyIOmicaExamplesDirectory, 'SLV.zip'), "r") as zipFile:
zi... | 2.484375 | 2 |
tworaven_apps/eventdata_queries/initialization/icews_unique_count.py | TwoRavens/TwoRavens | 20 | 17813 | # returns number of unique records for icews with different filtering:
# -by rounded lat/lon (100,000)
# -by country, district, province, city (100,000)
# -by lat/lon, filtered by 2 or more matches (70,000)
from pymongo import MongoClient
import os
mongo_client = MongoClient(host='localhost', port=27017) # Default p... | 2.875 | 3 |
OcCo_Torch/models/pointnet_util.py | sun-pyo/OcCo | 158 | 17814 | <reponame>sun-pyo/OcCo
# Copyright (c) 2020. <NAME>, <EMAIL>
# Ref: https://github.com/fxia22/pointnet.pytorch/pointnet/model.py
import torch, torch.nn as nn, numpy as np, torch.nn.functional as F
from torch.autograd import Variable
def feature_transform_regularizer(trans):
d = trans.size()[1]
I = torch.ey... | 2.046875 | 2 |
Week#3__Assignment#3/join.py | P7h/IntroToDataScience__Coursera_Course | 1 | 17815 | import MapReduce
import sys
"""
SQL style Joins in MapReduce
"""
mr = MapReduce.MapReduce()
# =============================
# Do not modify above this line
def mapper(record):
# key: document identifier
# value: document contents
value = str(record[0])
num = str(record[1])
mr.emit_intermediate(num, (value... | 3.234375 | 3 |
tests/test_testresources.py | sjoerdk/anonapi | 0 | 17816 | from anonapi.testresources import (
MockAnonClientTool,
JobInfoFactory,
RemoteAnonServerFactory,
JobStatus,
)
def test_mock_anon_client_tool():
some_responses = [
JobInfoFactory(status=JobStatus.DONE),
JobInfoFactory(status=JobStatus.ERROR),
JobInfoFactory(status=JobStatus.... | 2.28125 | 2 |
homeassistant/components/mikrotik/hub.py | jvitkauskas/home-assistant | 0 | 17817 | <gh_stars>0
"""The Mikrotik router class."""
from datetime import timedelta
import logging
import socket
import ssl
import librouteros
from librouteros.login import plain as login_plain, token as login_token
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME, CONF_VERIFY_SSL
from homeassistant.ex... | 2.25 | 2 |
gemlog_from_rss/spip/page.py | Hookz/Gemlog-from-RSS | 1 | 17818 | <gh_stars>1-10
from bs4 import BeautifulSoup
import requests
import re
from lxml.html import fromstring
from lxml.etree import ParserError
from gemlog_from_rss.spip import SinglePost
def localize(lang):
if lang == "pl":
return {
"our_articles": "Nasze artykuły"
}
if lang == "fr":
... | 2.734375 | 3 |
simulation/aivika/modeler/arrival_timer.py | dsorokin/aivika-modeler | 0 | 17819 | # Copyright (c) 2017 <NAME> <<EMAIL>>
#
# Licensed under BSD3. See the LICENSE.txt file in the root of this distribution.
from simulation.aivika.modeler.model import *
from simulation.aivika.modeler.port import *
def create_arrival_timer(model, name, descr = None):
"""Return a new timer that allows measuring the ... | 2.21875 | 2 |
mundo 1/aula 7/exer8.py | jonatan098/cursopython | 0 | 17820 | m = float(input('digite o metro '))
print(f'{m} metros e igual {m*100} centimetros e {m*1000} milimetros') | 3.5 | 4 |
ros/src/airsim_ros_pkgs/scripts/readscan.py | juwangvsu/AirSim | 0 | 17821 | #!/usr/bin/env python
import rospy
import rosbag
import os
import sys
import textwrap
import yaml
lidarmsg=None
################# read the lidar msg from yaml file and return ##############
def readlidardummy():
global lidarmsg
if lidarmsg==None:
lidarmsg= doreadlidar()
return lidarmsg
def doreadlidar():... | 2.734375 | 3 |
flytekit/models/qubole.py | slai/flytekit | 0 | 17822 | <gh_stars>0
from flyteidl.plugins import qubole_pb2 as _qubole
from flytekit.models import common as _common
class HiveQuery(_common.FlyteIdlEntity):
def __init__(self, query, timeout_sec, retry_count):
"""
Initializes a new HiveQuery.
:param Text query: The query string.
:param ... | 2.3125 | 2 |
app/app.py | SogoKato/mecab-parser | 0 | 17823 | <reponame>SogoKato/mecab-parser
# -*- coding: utf-8 -*-
from dataclasses import asdict
from logging import DEBUG
import os
from flask import Flask, jsonify, request
from werkzeug.exceptions import HTTPException
from mecab_parser import MecabParserFactory
app = Flask(__name__)
app.config["JSON_AS_ASCII"] = False
@... | 2.3125 | 2 |
src/data_migrator/emitters/__init__.py | schubergphilis/data-migrator | 18 | 17824 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""Emitters are used to export models to output format.
This module contains all classes for emitters: base and actuals. Currently
the system has two emitters: :class:`~.CSVEmitter` and :class:`~.MySQLEmitter`
implemented, of which the last is the default emitter. An emitt... | 2.8125 | 3 |
cycleshare/migrations/0013_remove_cycle_toprofile.py | vasundhara7/College-EWallet | 2 | 17825 | # Generated by Django 2.0.9 on 2018-12-12 08:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cycleshare', '0012_cycle_toprofile'),
]
operations = [
migrations.RemoveField(
model_name='cycle',
name='toprofile',
... | 1.421875 | 1 |
projects/aFPGA/10_python/npu/generate_npu_sram_init_file.py | helloworld1983/NPU_on_FPGA | 63 | 17826 | <gh_stars>10-100
import math
import numpy as np
from scipy import signal
#%% 全自动的数据生成
M = 16; N = 100;
AddImm = 1000;
MAT_M = 3; MAT_N = 5; MAT_P = 7;
Pm = 5; Pn = 5;
Km = 5; Kn = 5;
MODE = 1;
fpp = open("./npu_verification_para.list", "w")
fpp.write("%d\n"%(M))
fpp.write("%d\n"%(N))
fpp.write("%d\n"%(AddImm))
fpp.wr... | 2.359375 | 2 |
2.py | modianor/git_project | 0 | 17827 | A = 1
B = 2
C = 4 | 0.988281 | 1 |
src/ixu/commands/server/__init__.py | luanguimaraesla/ixu | 2 | 17828 | from . import up
| 1.203125 | 1 |
pythoncev/exercicios/ex096.py | gustavobelloni/Python | 0 | 17829 | <reponame>gustavobelloni/Python
def área(larg, comp):
a = larg * comp
print(f'A área de um terreno {larg}x{comp} é de {a}m²')
print('Controle de Terrenos')
print('--------------------')
l = float(input('Largura (m): '))
c = float(input('Comprimento (m): '))
área(l, c)
| 3.671875 | 4 |
readthedocs/proxito/views/decorators.py | tkoyama010/readthedocs.org | 2 | 17830 | <gh_stars>1-10
import logging
from functools import wraps
from django.http import Http404
from readthedocs.projects.models import Project, ProjectRelationship
log = logging.getLogger(__name__) # noqa
def map_subproject_slug(view_func):
"""
A decorator that maps a ``subproject_slug`` URL param into a Proje... | 2.34375 | 2 |
tortue_geniale/tg_channel_events.py | vavalm/discord_bot_tortue_geniale | 0 | 17831 | import discord
import asyncio
import re
import logging
from data.groups_name import free_random_name
logging.basicConfig(level=logging.INFO)
client = discord.Client()
class ClientEvents(discord.Client):
'''
Classe initialization
'''
def __init__(self, *args, **kwargs):
super().__init__(*args... | 2.71875 | 3 |
middleware/login_required.py | ahmetelgun/flask-boilerplate | 2 | 17832 | <reponame>ahmetelgun/flask-boilerplate
from flask import request, make_response, jsonify, g
from datetime import datetime
from functools import wraps
import jwt
from models import DBContext, User
from settings import SECRET_KEY
from service import is_token_valid
def login_required(func):
@wraps(func)
def wra... | 2.46875 | 2 |
libs/sqlservice/utils.py | smartadvising/smartadvising-api | 0 | 17833 | """
Utilities
---------
The utilities module.
"""
from collections.abc import Mapping, Sequence
from functools import wraps
import types
class FrozenDict(Mapping):
"""A frozen dictionary implementation that prevents the object from being
mutated. This is primarily used when defining a dict-like object as a ... | 3.109375 | 3 |
tests/test_normals.py | foobarbecue/trimesh | 0 | 17834 | try:
from . import generic as g
except BaseException:
import generic as g
class NormalsTest(g.unittest.TestCase):
def test_vertex_normal(self):
mesh = g.trimesh.creation.icosahedron()
# the icosahedron is centered at zero, so the true vertex
# normal is just a unit vector of the v... | 2.4375 | 2 |
flagmaker/settings.py | google/sa360-bigquery-bootstrapper | 4 | 17835 | # /***********************************************************************
# Copyright 2019 Google Inc.
#
# 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/LICE... | 1.648438 | 2 |
cli/sub.py | mylovage/GolemQT | 0 | 17836 | # coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2018-2020 azai/Rgveda/GolemQuant base on QUANTAXIS/yutiansut
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, ... | 1.210938 | 1 |
setup.py | voxel51/eta | 25 | 17837 | #!/usr/bin/env python
"""
Installs ETA.
Copyright 2017-2021, Voxel51, Inc.
voxel51.com
"""
import os
from setuptools import setup, find_packages
from wheel.bdist_wheel import bdist_wheel
VERSION = "0.6.1"
class BdistWheelCustom(bdist_wheel):
def finalize_options(self):
bdist_wheel.finalize_options(self... | 1.976563 | 2 |
Kernel/kernel.py | y11en/BranchMonitoringProject | 122 | 17838 | <filename>Kernel/kernel.py
# Kernel introspection module to enrich branch collected data
# This code is part of BranchMonitoring framework
# Written by: <NAME> - 2017
# Federal University of Parana (UFPR)
from xml.etree.ElementTree import ElementTree # Parse XML
import subprocess ... | 2.84375 | 3 |
config/environments/__init__.py | mihail-ivanov/flask-init | 0 | 17839 |
from .development import DevelopmentConfig
from .testing import TestingConfig
from .production import ProductionConfig
app_config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
}
| 1.453125 | 1 |
dialogs.py | rdbende/Sun-Valley-messageboxes | 5 | 17840 | <reponame>rdbende/Sun-Valley-messageboxes<gh_stars>1-10
import tkinter as tk
from tkinter import ttk
from functools import partial
def popup(parent, title, details, icon, *, buttons):
dialog = tk.Toplevel()
result = None
big_frame = ttk.Frame(dialog)
big_frame.pack(fill="both", expand=True)
big_... | 2.5625 | 3 |
enthought/endo/docerror.py | enthought/etsproxy | 3 | 17841 | # proxy module
from __future__ import absolute_import
from etsdevtools.endo.docerror import *
| 1.0625 | 1 |
troposphere/kendra.py | marinpurgar/troposphere | 0 | 17842 | # Copyright (c) 2012-2020, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 18.6.0
from . import AWSObject
from . import AWSProperty
from . import Tags
from .validators import boolean
from .validator... | 1.804688 | 2 |
cv2/wxPython-CV-widget/main.py | whitmans-max/python-examples | 140 | 17843 | import wx
import cv2
#----------------------------------------------------------------------
# Panel to display image from camera
#----------------------------------------------------------------------
class WebcamPanel(wx.Window): # wx.Panel, wx.Control
def __init__(self, parent, camera, fps=15, flip=Fals... | 2.578125 | 3 |
src/inputbox.py | creikey/nuked-dashboard | 1 | 17844 | <gh_stars>1-10
import pynk
from pynk.nkpygame import NkPygame
class InputBox:
def __init__(self, max_len):
# self.max_len = pynk.ffi.new("int *", max_len)
self.len = pynk.ffi.new("int *", 0)
self.max_len = max_len
# self.len = 0
self.cur_text = pynk.ffi.new("char[{}]".forma... | 2.5 | 2 |
01_demo/MLP_test.py | wwww666/Tensorflow2.0 | 2 | 17845 | <gh_stars>1-10
'''
自定义实现双层网络,实现Relu激活函数
'''
import tensorflow as tf
import numpy as np
import sys
sys.path.append("..")
from softmax_test import train_che3
from tensorflow.keras.datasets.fashion_mnist import load_data
# 加载数据集;转换类型并做归一化处理
(x_train,y_train),(x_test,y_test)=load_data()
batch_size=256
x_trai... | 2.890625 | 3 |
ticketnum/ticket_numbering.py | phizzl3/PrintShopScripts | 1 | 17846 | <gh_stars>1-10
"""
A simple script for numbering nUp tickets for the print shop.
"""
def numbering_main() -> None:
"""
Gets numbering sequences for nUp ticket numbering.
Gets the total number of tickets requested along with now many will fit on a
sheet (n_up) as well as the starting ticket number and... | 3.78125 | 4 |
emergent ferromagnetism near three-quarters filling in twisted bilayer graphene/scripts/myTerrain.py | aaronsharpe/publication_archives | 0 | 17847 | <reponame>aaronsharpe/publication_archives
# -*- coding: utf-8 -*-
"""
Created on Mon May 15 21:32:17 2017
@author: <NAME>
"""
import numpy as np
import os
from matplotlib.colors import LinearSegmentedColormap
def igorTerrain(n):
n1 = np.around(n*25/256)
n2 = np.around(n*37/256)
n3 = np.around(n*100/256)... | 2.734375 | 3 |
datapackage_pipelines/generators/utilities.py | gperonato/datapackage-pipelines | 109 | 17848 | def arg_to_step(arg):
if isinstance(arg, str):
return {'run': arg}
else:
return dict(zip(['run', 'parameters', 'cache'], arg))
def steps(*args):
return [arg_to_step(arg) for arg in args]
| 2.609375 | 3 |
plugin/taskmage2/project/projects.py | willjp/vim-taskmage | 1 | 17849 | import os
import shutil
import tempfile
from taskmage2.utils import filesystem, functional
from taskmage2.asttree import asttree, renderers
from taskmage2.parser import iostream, parsers
from taskmage2.project import taskfiles
class Project(object):
def __init__(self, root='.'):
""" Constructor.
... | 2.625 | 3 |
discord/ext/vbu/cogs/utils/converters/filtered_user.py | 6days9weeks/Novus | 2 | 17850 | from discord.ext import commands
class FilteredUser(commands.UserConverter):
"""
A simple :class:`discord.ext.commands.UserConverter` that doesn't allow bots
or the author to be passed into the function.
"""
def __init__(self, *, allow_author: bool = False, allow_bots: bool = False):
supe... | 2.796875 | 3 |
py/2017/3B.py | pedrotari7/advent_of_code | 0 | 17851 | a = 289326
coords = [(1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1), (1, 1)]
x,y = (0,0)
dx,dy = (1,0)
M = {(x,y):1}
while M[(x, y)] < a:
x, y = x+dx, y+dy
M[(x, y)] = sum([M[(x+ox, y+oy)] for ox,oy in coords if (x+ox,y+oy) in M])
if (x == y) or (x > 0 and x == 1-y) or (x < 0 and x == -y):
... | 2.90625 | 3 |
q.py | Akatsuki1910/tokuron | 0 | 17852 | <reponame>Akatsuki1910/tokuron
""" Q learning """
import numpy as np
import plot
Q = np.array(np.zeros([11, 3]))
GAMMA = 0.9
ALPHA = 0.1
def action_select(s_s):
""" action select """
return np.random.choice([i for i in range(1, 4) if i + s_s < 11])
for i in range(10000):
S_STATE = 0
while S_STAT... | 2.9375 | 3 |
videogame_project/videogame_app/models.py | cs-fullstack-fall-2018/django-form-post1-R3coTh3Cod3r | 0 | 17853 | <gh_stars>0
from django.db import models
from django.utils import timezone
class GameIdea(models.Model):
name=models.CharField(max_length=100)
genre= models.CharField(max_length=100)
currentdate= models.DateTimeField(blank=True, null=True)
def __str__(self):
return self.name, self.genre
... | 2.46875 | 2 |
tests/test_estimate_r.py | lo-hfk/epyestim | 11 | 17854 | <filename>tests/test_estimate_r.py
import unittest
from datetime import date
import numpy as np
import pandas as pd
from numpy.testing import assert_array_almost_equal
from scipy.stats import gamma
from epyestim.estimate_r import overall_infectivity, sum_by_split_dates, estimate_r, gamma_quantiles
class EstimateRTe... | 2.671875 | 3 |
tests/imagenet_classification_test.py | SanggunLee/edgetpu | 2 | 17855 | # Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.4375 | 2 |
11_testing_best_practices/generate_maze_faster.py | krother/maze_run | 7 | 17856 |
# Improved version of the code from chapter 03
# created in chapter 11 to accelerate execution
import random
XMAX, YMAX = 19, 16
def create_grid_string(dots, xsize, ysize):
"""
Creates a grid of size (xx, yy)
with the given positions of dots.
"""
grid = ""
for y in range(ysize):
f... | 4.09375 | 4 |
flask-backend/create_database.py | amlannandy/OpenMF | 0 | 17857 | from api.models.models import User
from api import db, create_app
db.create_all(app=create_app()) | 1.625 | 2 |
src/UQpy/Distributions/baseclass/DistributionContinuous1D.py | marrov/UQpy | 132 | 17858 | import numpy as np
import scipy.stats as stats
from UQpy.Distributions.baseclass.Distribution import Distribution
class DistributionContinuous1D(Distribution):
"""
Parent class for univariate continuous probability distributions.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
... | 2.734375 | 3 |
bridge/models/basic/layers.py | JTT94/schrodinger_bridge | 0 | 17859 | <gh_stars>0
import torch
from torch import nn
import torch.nn.functional as F
import math
from functools import partial
class MLP(torch.nn.Module):
def __init__(self, input_dim, layer_widths, activate_final = False, activation_fn=F.relu):
super(MLP, self).__init__()
layers = []
prev_width ... | 2.609375 | 3 |
chessbot.py | UbiLabsChessbot/tensorflow_chessbot | 0 | 17860 | <reponame>UbiLabsChessbot/tensorflow_chessbot<filename>chessbot.py<gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Finds submissions with chessboard images in them,
# use a tensorflow convolutional neural network to predict pieces and return
# a lichess analysis link and FEN diagram of chessboard
import praw
imp... | 2.796875 | 3 |
Tools/english_word/src/spider.py | pynickle/awesome-python-tools | 21 | 17861 | import requests
import re
import time
import random
import pprint
import os
headers = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3858.0 Safari/537.36"}
def youdict(threadName, q):
res = []
index = 0
url = q.get(timeout = 2)
... | 2.671875 | 3 |
NFCow/malls/migrations/0001_initial.py | jojoriveraa/titulacion-NFCOW | 0 | 17862 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-23 08:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
nam... | 1.6875 | 2 |
mmdnn/conversion/examples/tensorflow/extractor.py | ferriswym/MMdnn | 0 | 17863 | <filename>mmdnn/conversion/examples/tensorflow/extractor.py
#----------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#------... | 2.046875 | 2 |
nostrint/command_line.py | zevtyardt/no-strint | 13 | 17864 | <filename>nostrint/command_line.py
from redat import __version__
import argparse as _argparse
import sys as _sys
def CLI():
_parser = _argparse.ArgumentParser(
description='simple str & int obfuscator (c) zvtyrdt.id',
formatter_class=_argparse.RawTextHelpFormatter,
version=__version__)
... | 2.78125 | 3 |
simple_lib.py | rcmorehead/simplanets | 0 | 17865 | <gh_stars>0
"""
Useful classes and functions for SIMPLE.
"""
import numpy as np
import warnings
import math
from scipy import integrate
r_sun_au = 0.004649
r_earth_r_sun = 0.009155
day_hrs = 24.0
#@profile
def impact_parameter(a, e, i, w, r_star):
"""
Compute the impact parameter at for a transiting planet.
... | 3.1875 | 3 |
y10m/join.lines.py | goodagood/story | 3 | 17866 | <reponame>goodagood/story
#inputFile = 'sand.407'
inputFile = 'sand.407'
outputFile= 'sand.out'
def joinLine():
pass
with open(inputFile) as OF:
lines = OF.readlines()
print(lines[0:3])
| 2.828125 | 3 |
web_programming/fetch_github_info.py | JB1959/Python | 14 | 17867 | #!/usr/bin/env python3
"""
Created by sarathkaul on 14/11/19
Basic authentication using an API password is deprecated and will soon no longer work.
Visit https://developer.github.com/changes/2020-02-14-deprecating-password-auth
for more information around suggested workarounds and removal dates.
"""
import requests... | 2.78125 | 3 |
ACM ICPC/Sorting/Merge Sort/Python/Merge_Sort.py | shreejitverma/GeeksforGeeks | 2 | 17868 | <filename>ACM ICPC/Sorting/Merge Sort/Python/Merge_Sort.py
class MergeSort:
def __init__(self, lst):
self.lst = lst
def mergeSort(self, a):
midPoint = len(a) // 2
if a[len(a) - 1] < a[0]:
left = self.mergeSort(a[:midPoint])
right = self.mergeSort(a[midPoint:])
... | 4.15625 | 4 |
nightly.py | insolar/insolar-jepsen | 6 | 17869 | #!/usr/bin/env python3
# vim: set ai et ts=4 sw=4:
import os
import subprocess
import argparse
import time
import calendar
import re
def run(cmd):
code = subprocess.call(['/bin/bash', '-o', 'pipefail', '-c', cmd])
if code != 0:
raise RuntimeError("Command `%s` returned non-zero status: %d" %
... | 2.1875 | 2 |
ecart/ecart.py | micael-grilo/E-Cart | 0 | 17870 | import redis
import copy
from functools import wraps
from .exception import ErrorMessage
from .decorators import raise_exception
from .serializer import Serializer
TTL = 604800
class Cart(object):
"""
Main Class for Cart, contains all functionality
"""
@raise_exception("E-Cart can't be initiali... | 2.96875 | 3 |
app/tests/test_transaction.py | geometry-labs/icon-filter-registration | 0 | 17871 | <gh_stars>0
import pytest
from app.main import app
from app.models import TransactionRegistration
from app.settings import settings
from httpx import AsyncClient
from tests.conftest import RequestCache
registration = TransactionRegistration(
to_address="cx0000000000000000000000000000000000000001",
from_address... | 2.0625 | 2 |
oslo_messaging/tests/rpc/test_server.py | ox12345/oslo.messaging | 0 | 17872 |
# Copyright 2013 Red Hat, Inc.
#
# 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 agr... | 1.84375 | 2 |
3.03-pdDataOps.py | pgiardiniere/notes-PythonDataScienceHandbook | 2 | 17873 | <filename>3.03-pdDataOps.py
# Recall material on NP Universal Functions from Ch2
# PD builds on ufuncs functionality a few ways:
# first, for unary operations (negation / trig funcs), ufuncs preserve
# index and column labels in the output
# second, for binary operations (addition / multiplication) PD aligns
# indice... | 3.671875 | 4 |
cogs/feelings.py | Surice/dc_sophie | 0 | 17874 | from itertools import chain
from components.config import getConfig
from components.convert import fetchUser, pretRes
import discord
from discord import channel
from discord.ext import commands
class Feelings(commands.Cog):
def __init__(self, client) -> None:
self.client = client
self.config = get... | 2.5 | 2 |
Solutions/arrays/Median_of_Two_Sorted_Arrays.py | HuitingZhengAvery/Leetcode-solutions | 1 | 17875 | '''
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
'''
### Nature: the meaning of MEDIAN, is that, the number of elements less than it,
##... | 3.96875 | 4 |
carl/envs/mario/mario_game.py | automl/genRL | 27 | 17876 | from abc import ABC, abstractmethod
class MarioGame(ABC):
@abstractmethod
def getPort(self) -> int:
pass
@abstractmethod
def initGame(self):
pass
@abstractmethod
def stepGame(self, left: bool, right: bool, down: bool, speed: bool, jump: bool):
pass
@abstractmetho... | 3.359375 | 3 |
sec5.2/train.py | Z-T-WANG/ConvergentDQN | 1 | 17877 | <reponame>Z-T-WANG/ConvergentDQN<filename>sec5.2/train.py<gh_stars>1-10
import torch
import torch.optim as optim
import torch.nn.functional as F
import optimizers
import time, os, random
import numpy as np
import math, copy
from collections import deque
from common.utils import epsilon_scheduler, beta_scheduler, upd... | 1.859375 | 2 |
tests/broker/test_update_chassis.py | ned21/aquilon | 7 | 17878 | <gh_stars>1-10
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2012,2013,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... | 1.945313 | 2 |
label_propagation/label_propagation.py | lujiaxuan0520/NAIC-ReID-2020-contest | 1 | 17879 | <filename>label_propagation/label_propagation.py
#########################################################################################
# semi-supervised learning: use label propagation to make pseudo labels for no label data
# This is not the parallel implement of label propagation, may requires a lot of time
# Aut... | 2.0625 | 2 |
tests/helpers/test_file.py | Centaurioun/PyFunceble | 0 | 17880 | """
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ █... | 2.265625 | 2 |
malaya_speech/supervised/unet.py | ishine/malaya-speech | 111 | 17881 | from malaya_speech.utils import (
check_file,
load_graph,
generate_session,
nodes_session,
)
from malaya_speech.model.tf import UNET, UNETSTFT, UNET1D
def load(model, module, quantized=False, **kwargs):
path = check_file(
file=model,
module=module,
keys={'model': 'model.pb... | 2.171875 | 2 |
scripts/GUI_restart.py | zainamir-98/bioradar | 0 | 17882 | <reponame>zainamir-98/bioradar
# Use this command if numpy import fails: sudo apt-get install python-dev libatlas-base-dev
# If this doesn't work, uninstall both numpy and scipy. Thonny will keep an older default version of numpy.
# Install an older version of scipy that corresponds to the correct version of numpy.
fr... | 2.34375 | 2 |
pyFileFixity/lib/distance/distance/_lcsubstrings.py | hadi-f90/pyFileFixity | 0 | 17883 | <reponame>hadi-f90/pyFileFixity
# -*- coding: utf-8 -*-
from array import array
def lcsubstrings(seq1, seq2, positions=False):
"""Find the longest common substring(s) in the sequences `seq1` and `seq2`.
If positions evaluates to `True` only their positions will be returned,
together with their length, in a tupl... | 3.484375 | 3 |
colour/models/rgb/transfer_functions/tests/test_panasonic_vlog.py | JGoldstone/colour | 0 | 17884 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the :mod:`colour.models.rgb.transfer_functions.\
panasonic_vlog` module.
"""
import numpy as np
import unittest
from colour.models.rgb.transfer_functions import (
log_encoding_VLog,
log_decoding_VLog,
)
from colour.utilities import domain_rang... | 2.53125 | 3 |
test/IECoreRI/All.py | gcodebackups/cortex-vfx | 5 | 17885 | <gh_stars>1-10
##########################################################################
#
# Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... | 0.828125 | 1 |
molecool/tests/test_measure.py | pavankum/molecool | 0 | 17886 | <gh_stars>0
"""
Unit tests for measure
"""
# Import package, test suite, and other packages as needed
import numpy as np
import molecool
import pytest
def test_calculate_distance():
"""Sample test to check calculate_distance is working """
r1 = np.array([1, 0, 0])
r2 = np.array([3, 0, 0])
e... | 2.890625 | 3 |
tests/test_util_matrix.py | PeerHerholz/pyrsa | 4 | 17887 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
test_util_matrix
@author: jdiedrichsen
"""
import unittest
import pyrsa.util as rsu
import numpy as np
class TestIndicator(unittest.TestCase):
def test_indicator(self):
a = np.array(range(0, 5))
a = np.concatenate((a, a))
X = rsu.matrix... | 2.75 | 3 |
custom_components/smartthinq_washer/wideq/washer.py | Golab/ha-smartthinq-washer | 1 | 17888 | <gh_stars>1-10
"""------------------for Washer"""
import datetime
import enum
import time
import logging
from typing import Optional
from .device import (
Device,
DeviceStatus,
STATE_UNKNOWN,
STATE_OPTIONITEM_ON,
STATE_OPTIONITEM_OFF,
)
from .washer_states import (
STATE_WASHER,
STATE_WASH... | 2.609375 | 3 |
year2020/day17/reader.py | Sebaestschjin/advent-of-code | 0 | 17889 | from pathlib import Path
def read(filename='in'):
file_path = Path(__file__).parent / filename
with file_path.open('r') as file:
return read_lines(file.readlines())
def read_lines(lines):
cells = {}
for y in range(len(lines)):
line = lines[y].strip()
for x in range(len(line))... | 3.21875 | 3 |
squad/base/argument_parser.py | uwnlp/piqa | 89 | 17890 | <filename>squad/base/argument_parser.py
import argparse
import os
class ArgumentParser(argparse.ArgumentParser):
def __init__(self, description='base', **kwargs):
super(ArgumentParser, self).__init__(description=description)
def add_arguments(self):
home = os.path.expanduser('~')
self... | 2.609375 | 3 |
getml/loss_functions.py | srnnkls/getml-python-api | 0 | 17891 | <gh_stars>0
# Copyright 2019 The SQLNet Company GmbH
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merg... | 1.570313 | 2 |
transit/helpers.py | moredatarequired/python-stitch-client | 71 | 17892 | ## Copyright 2014 Cognitect. 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 required by applicable... | 1.9375 | 2 |
part4/matplotlib/seoul_to_cn_gb_kw.py | tls1403/PythonTest | 0 | 17893 | import pandas as pd
import matplotlib.pyplot as plt
#한글 폰트 오류 제거
from matplotlib import font_manager,rc
font_path ="D:/5674-833_4th/part4/malgun.ttf"
font_name = font_manager.FontProperties(fname=font_path).get_name()
rc('font',family = font_name)
df = pd.read_excel('D:/5674-833_4th/part4/시도별 전출입 인구수.xlsx',engine = 'o... | 2.875 | 3 |
blsqpy/query.py | BLSQ/blsqpy | 0 | 17894 | <filename>blsqpy/query.py
import os
from jinja2 import Environment, FileSystemLoader
QUERIES_DIR = os.path.dirname(os.path.abspath(__file__))
def get_query(query_name, params):
j2_env = Environment(loader=FileSystemLoader(QUERIES_DIR+"/queries"),
trim_blocks=True)
return j2_env.get_te... | 2.46875 | 2 |
SINE.py | EduardoMCF/SINE | 0 | 17895 | <gh_stars>0
import matplotlib.pyplot as plt
import pyaudio, wave
import numpy as np
from collections import OrderedDict as OD
from struct import pack
from math import fmod
from os import system
def getNoteAndDuration(chord : str, defaultDuration : float):
if ',' in chord:
note,duration = chord.strip('()')... | 2.53125 | 3 |
setup.py | lkylych/lagom | 0 | 17896 | <reponame>lkylych/lagom
from setuptools import setup
from setuptools import find_packages
from lagom.version import __version__
# Read content of README.md
with open('README.md', 'r') as f:
long_description = f.read()
setup(name='lagom',
version=__version__,
author='<NAME>',
author_email='<EMA... | 1.546875 | 2 |
plugins_inactive/plugin_wikipediasearch.py | ademaro/Irene-Voice-Assistant | 0 | 17897 | import os
import time
import pyautogui
# from voiceassmain import play_voice_assistant_speech
from vacore import VACore
# based on EnjiRouz realization https://github.com/EnjiRouz/Voice-Assistant-App/blob/master/app.py
# функция на старте
def start(core: VACore):
manifest = {
"name": "Википедия (поиск)"... | 2.59375 | 3 |
todo/management/urls.py | Sanguet/todo-challenge | 0 | 17898 | # Django
from django.urls import include, path
# Django REST Framework
from rest_framework.routers import DefaultRouter
# Views
from .views import tasks as task_views
router = DefaultRouter()
router.register(r'tasks', task_views.TaskViewSet, basename='task')
urlpatterns = [
path('', include(router.urls))
]
| 1.820313 | 2 |
dnd5e/items.py | MegophrysNasuta/dnd5e | 0 | 17899 | <reponame>MegophrysNasuta/dnd5e
import enum
from typing import Any, List, Optional, Tuple
class ArmorType(enum.Enum):
LIGHT = enum.auto()
MEDIUM = enum.auto()
HEAVY = enum.auto()
def __repr__(self):
return '%s.%s' % (self.__class__.__name__, self.name)
class Armor:
def __init__(self, na... | 3.046875 | 3 |