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 |
|---|---|---|---|---|---|---|
ci_test_settings.py | cumanachao/utopia-crm | 13 | 42800 | <gh_stars>10-100
# coding=utf-8
from datetime import date
from settings import *
DEBUG = True
ALLOWED_HOSTS = ['testserver', ]
DATABASES = {
'default': {
'HOST': '127.0.0.1',
'NAME': 'utopia',
'PASSWORD': '<PASSWORD>',
'USER': 'utopiatest_django',
'ENGINE': 'django.contri... | 1.203125 | 1 |
trialswithotherCV/RDFRandomCV.py | devs4v/DecisionTreeAndRDF | 1 | 42801 | ''' crossvalidation.py
# Author : <NAME>
# Last Modified : 06:25 PM, 10th September 2013
# Purpose : Perform random cross validation [Machine Learning](Checking accuracy of classified decisions using k-fold validation)
# Copyright : (C) 2013
'''
from random import random
import sys
from rdforest import * #importi... | 3.265625 | 3 |
core/dr_utils/dib_renderer_x/__init__.py | weiqi-luo/Self6D-Diff-Renderer | 90 | 42802 | # NOTE: override the kaolin one
from .renderer.base import Renderer as DIBRenderer
| 1.15625 | 1 |
raiden/billing/invoices/util/encoding_util.py | marcosmartinez7/lumino | 8 | 42803 | <gh_stars>1-10
import bitstring
# Bech32 spits out array of 5-bit values. Shim here.
def u5_to_bitarray(arr):
ret = bitstring.BitArray()
for a in arr:
ret += bitstring.pack("uint:5", a)
return ret
# Map of classical and witness address prefixes
base58_prefix_map = {
'bc' : (0, 5),
'tb' ... | 2.65625 | 3 |
notebooks-text-format/vdvae_jax_cifar_demo.py | arpitvaghela/probml-notebooks | 166 | 42804 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab... | 2.09375 | 2 |
models.py | plumdog/mainstay_kanban | 0 | 42805 | <reponame>plumdog/mainstay_kanban<filename>models.py
from django.db import models
from mainstay.models import UpdatedAndCreated
class TaskUsersManager(models.Manager):
def for_user(self, user):
return self.get_queryset().filter(models.Q(user=user) | models.Q(user=None))
class Task(UpdatedAndCreated, mod... | 2.25 | 2 |
Demo/facenet_align/align/align_dataset_mtcnn.py | swapnil96/BTP | 0 | 42806 | """Performs face alignment and stores face thumbnails in the output directory."""
# MIT License
#
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restr... | 2.21875 | 2 |
kivy/tests/pyinstaller/video_widget/main.py | Galland/kivy | 13,889 | 42807 | <reponame>Galland/kivy
from project import VideoApp
if __name__ == '__main__':
from kivy.core.video import Video
assert Video is not None
VideoApp().run()
| 1.75 | 2 |
custom_conda_create/util/shell_funcs.py | bk-m/custom_conda_create | 0 | 42808 | # -*- coding: utf-8 -*-
"""
Shell functions for the module.
"""
import pathlib
import re
import os
import sys
import subprocess
def run_in_shell_with_output(cmd):
"""
Runs a given command in a subshell and prints the ouput.
:param cmd: Command to run.
:returns: Returns the exit code of the subproces... | 3.078125 | 3 |
mnist/conv_tf.py | stallmanifold/kaggle | 0 | 42809 | """
Convnet classifier for MNIST data using TensorFlow.
"""
import tensorflow as tf
import mnist.mnist as mnist
import pandas as pd
DEFAULT_INPUT_DIMENSIONS = 784
DEFAULT_OUTPUT_DIMENSIONS = 10
DEFAULT_LEARNING_RATE = 0.1
DEFAULT_BATCH_SIZE = 50
DEFAULT_KEEP_PROB = 0.5
class CNNClassifier(... | 3.8125 | 4 |
hawkbot/__main__.py | bmintz/hawkbot | 1 | 42810 | <filename>hawkbot/__main__.py
from . import bot
from configparser import ConfigParser
import sys
def get_config(filename):
config = ConfigParser()
config.read(filename)
return config
def main():
config = get_config(sys.argv[1])
bot.config = config
bot.run(config['login']['token'])
if __name__ == '__main__':... | 2.046875 | 2 |
AlgorithmTest/BOJ_STEP_PYTHON/Step10/BOJ10872.py | bluesky0960/AlgorithmTest | 0 | 42811 | # https://www.acmicpc.net/problem/10872
def n_fac(n):
if n==1:
return 1
else:
return n * n_fac(n-1)
n = int(input())
if n == 0:
print(1)
else:
print(n_fac(n)) | 3.515625 | 4 |
tests/test_utils.py | msakai/DeepSentinel | 7 | 42812 | <reponame>msakai/DeepSentinel<gh_stars>1-10
from pathlib import Path
from tempfile import TemporaryDirectory
import pytest
from deep_sentinel import utils
# pytest's temporary directory fixture (tmpdir) is a py.path.LocalPath object
# This is a workaround to use tempfile.TemporaryDirectory
@pytest.fixture
def tmp_d... | 2.171875 | 2 |
module_api/rogertests/test_accounts.py | rogertalk/roger-api | 3 | 42813 | <filename>module_api/rogertests/test_accounts.py
import mock
from roger import accounts, streams
from roger_common import errors
import rogertests
class BaseTestCase(rogertests.RogerTestCase):
def setUp(self):
super(BaseTestCase, self).setUp()
# Make sure the bots are initialized during this tes... | 2.484375 | 2 |
tests/main_tests/main2/libraries/user/__init__.py | ruke47/squadron | 0 | 42814 | import os
def schema():
return {
'title': 'User schema',
'type': 'string',
}
def verify(**kwargs):
return []
def apply(**kwargs):
return []
| 1.859375 | 2 |
app/admin.py | mugisha-thierry/online-shop | 1 | 42815 | <gh_stars>1-10
from django.contrib import admin
from .models import Profile,Category,Product,OrderItem,Order,Transaction,Rate,Delivery
# Register your models here.
admin.site.register(Category)
admin.site.register(Delivery)
admin.site.register(Profile)
admin.site.register(Product)
admin.site.register(OrderItem)
admin... | 1.617188 | 2 |
modules/multistream.py | zapdos26/python-zapdosbot | 0 | 42816 | <gh_stars>0
from threading import Timer
import logging
class Multistream:
def multi_set(self):
c = self.connection
if self.check_mod() == 0:
print("Setting multitwitch failed. User is not a mod.")
return
multi_targets = '/'.join(self.chatmessage[2:])
... | 2.640625 | 3 |
scripts/ln_jnas_subset.py | nameless-writer/become-yukarin | 562 | 42817 | <gh_stars>100-1000
import argparse
import multiprocessing
from pathlib import Path
from jnas_metadata_loader import load_from_directory
from jnas_metadata_loader.jnas_metadata import JnasMetadata
parser = argparse.ArgumentParser()
parser.add_argument('jnas', type=Path)
parser.add_argument('output', type=Path)
parser.... | 2.140625 | 2 |
backend/image_process/dummy.py | y-tsutsu/yukari | 0 | 42818 | <filename>backend/image_process/dummy.py
import cv2
from models.character import CharacterTable
from .base import BaseImageProcess
class DummyProcess(BaseImageProcess):
def __init__(self, interval):
self.__db_update_count = 0
self.__move_count = 0
self.DB_UPDATE_INTERVAL_COUNT = int(0.5 ... | 2.390625 | 2 |
speedtest/python3/speedtest.py | guyue/google-diff-match-patch | 304 | 42819 | #!/usr/bin/python3
#
# Copyright 2010 Google Inc.
# All Rights Reserved.
"""Diff Speed Test
"""
__author__ = "<EMAIL> (<NAME>)"
import imp
import gc
import sys
import time
import diff_match_patch as dmp_module
# Force a module reload. Allows one to edit the DMP module and rerun the test
# without leaving the Pytho... | 2.703125 | 3 |
tests/test_ni_usb_6211.py | Jyrijoul/arduino-adc-tester | 0 | 42820 | from tester.ni_usb_6211 import NiUsb6211
import numpy as np
OUTPUT_READ_CHANNEL = "ai0"
VCC_READ_CHANNEL = "ai1"
TOLERANCE = 0.001
def test_find_devices():
devices = NiUsb6211.find_devices()
assert type(devices) == list, "Not a list!"
if len(devices) > 0:
assert type(devices[0]) == str, "An eleme... | 2.625 | 3 |
app/main/errors.py | ZxShane/slam_hospital | 2 | 42821 | from app.main import main
from flask import render_template
@main.app_errorhandler(404)
def page_not_found():
return render_template('404.html'), 404
@main.app_errorhandler(500)
def internal_server_error(e):
return render_template('500.html'), 500
| 2.375 | 2 |
ctr/model.py | neoyinyao/Recommender | 0 | 42822 | from layers import MLP, DotInteraction
import tensorflow as tf
from tensorflow import keras
class DeepFM(keras.Model):
def __init__(self, embedding_size, vocab_size, num_int_fea, num_cat_fea, mlp_units):
super().__init__()
self.embedding_size = embedding_size
self.embedding_layer = keras.l... | 2.8125 | 3 |
main/forms.py | olekthunder/fontcrawler | 0 | 42823 | from django import forms
class ParsePageForm(forms.Form):
url = forms.URLField(label='Enter page link here', required=True)
| 1.898438 | 2 |
destiny_timelost/exceptions.py | dmfigol/destiny-timelost | 0 | 42824 | <reponame>dmfigol/destiny-timelost
class IncorrectSideError(Exception):
pass
| 1.046875 | 1 |
examples/creating_fields.py | 4577/Jawa | 1 | 42825 | """
An example showing how to create fields on a new class.
"""
from jawa import ClassFile
if __name__ == '__main__':
cf = ClassFile.create('HelloWorld')
# Creating a field from a field name and descriptor
field = cf.fields.create('BeerCount', 'I')
# A convienience shortcut for creating static fields... | 3.359375 | 3 |
chap8/mxnet/benchmark_model.py | wang420349864/dlcv_for_beginners | 1,424 | 42826 | import time
import mxnet as mx
benchmark_dataiter = mx.io.ImageRecordIter(
path_imgrec="../data/test.rec",
data_shape=(1, 28, 28),
batch_size=64,
mean_r=128,
scale=0.00390625,
)
mod = mx.mod.Module.load('mnist_lenet', 35, context=mx.gpu(2))
mod.bind(
data_shapes=benchmark_dataiter.provide_data... | 2.53125 | 3 |
src/rpasdt/gui/analysis/centrality.py | damianfraszczak/rpasdt | 2 | 42827 | import typing
import matplotlib
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import networkx as nx
from PyQt5.QtWidgets import QWidget
from rpasdt.gui.analysis.models import AnalysisData
from rpasdt.gui.mathplotlib_components import NetworkxGraphPanel
matplotlib.use("Qt5Agg")
class Centralit... | 2.6875 | 3 |
alphaml/engine/components/models/image_classification/xception.py | dingdian110/alpha-ml | 1 | 42828 | import numpy as np
from keras import layers
from keras import Model
from keras import backend
from ConfigSpace import ConfigurationSpace
from ConfigSpace import UniformIntegerHyperparameter, CategoricalHyperparameter
from alphaml.engine.components.models.base_dl_model import BaseImageClassificationModel
from alphaml.u... | 2.375 | 2 |
regex_compiler.py | philcombiths/Phon_query_to_csv | 0 | 42829 | <reponame>philcombiths/Phon_query_to_csv
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 6 17:47:32 2020
@author: Philip
"""
import regex as re
def re_pattern(search_elements, split_on=None, prefix=None, suffix=None, groups=None):
"""
Generates a regexPattern for searching for all elements of a str or
... | 3.21875 | 3 |
test_check_DB_ORM.py | leScandal/Training | 0 | 42830 | import mysql.connector
from fixture.orm import ORMFixture
from model.group import Group
db = ORMFixture(host="127.0.0.1", database = "addressbook", user = "root", password = "")
#connection = mysql.connector.connect(host="127.0.0.1", database = "addressbook", user = "root", password = "")
try:
l = db.get_group_li... | 2.453125 | 2 |
Chapter08/07_degrees_of_separation.py | susumuasaga/Python-Web-Scraping-Cookbook | 1 | 42831 | from wikipedia.spiders import WikipediaSpider
from scrapy.crawler import CrawlerProcess
import networkx as nx
import matplotlib.pyplot as plt
import urllib.parse
if __name__ == "__main__":
crawl_depth = 2
process = CrawlerProcess({
'LOG_LEVEL': 'ERROR',
'DEPTH_LIMIT': crawl_depth
})
pro... | 3.203125 | 3 |
C_Sort_Algorithms/A_Algorithms/sort_quickSimple.py | Oscar-Oliveira/Data-Structures-Algorithms | 0 | 42832 | <reponame>Oscar-Oliveira/Data-Structures-Algorithms<filename>C_Sort_Algorithms/A_Algorithms/sort_quickSimple.py<gh_stars>0
"""
Quick Sort Simple
"""
from A_Algorithms.sort_adt import Sort
class QuickSortSimple(Sort):
"""QuickSort"""
@staticmethod
def sort(list_, show_steps=False):
sort... | 3.984375 | 4 |
tempeh/datasets/compas_datasets.py | Bhaskers-Blu-Org2/tempeh | 8 | 42833 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Defines a class for the COMPAS dataset."""
import pandas as pd
import numpy as np
from .base_wrapper import BasePerformanceDatasetWrapper
from tempeh.constants import FeatureType, Tasks, DataTypes, ClassVars, CompasDatase... | 2.671875 | 3 |
ap/tests/test_request_certs.py | oscar-king/A-Decentralised-Digital-Identity-Architecture | 4 | 42834 | class TestRequest_certs():
def test_request_certs(self):
return
| 1.320313 | 1 |
.kodi/addons/plugin.video.projectfreetv/default.py | C6SUMMER/allinclusive-kodi-pi | 0 | 42835 | import xbmc, xbmcgui, xbmcplugin
import urllib, urllib2
import re, string
try:
from addon.common.addon import Addon
from addon.common.net import Net
except:
print 'Failed to import script.module.addon.common'
xbmcgui.Dialog().ok("PFTV Import Failure", "Failed to import addon.common", "A compon... | 2.25 | 2 |
Python/MVC/Flask/P3 SIMPLE BLOG done/Final-Project/simpleblog.py | UndreamtMayhem/Back-End-Dev | 0 | 42836 | #!/usr/bin/python
# Python Dependencies
import os
from datetime import datetime
# Python 3rd Party dependencies
from werkzeug.utils import secure_filename
# Flask dependecies
from flask import Flask, flash, render_template, request, redirect, url_for
import flask_login
# SQL alchemy dependencies
from sqlalchemy imp... | 1.9375 | 2 |
telnet_rtr_functions.py | karimjamali/Class-2 | 0 | 42837 | <reponame>karimjamali/Class-2
import telnetlib
import os
import sys
import time
ip_addr='172.16.58.3'
TELNET_PORT=23
TELNET_TIMEOUT=6
username = "pyclass"
password = "<PASSWORD>"
def telnet_connect(ip_addr, TELNET_PORT,TELNET_TIMEOUT):
try:
return telnetlib.Telnet(ip_addr, TELNET_PORT, TELNET_TIMEOUT)
except soc... | 3 | 3 |
proj1_1/code/waypoint_traj.py | anthonyn2121/autonomous_uav | 1 | 42838 | import numpy as np
from scipy.interpolate import CubicSpline
class WaypointTraj(object):
"""
"""
def __init__(self, points):
"""
This is the constructor for the Trajectory object. A fresh trajectory
object will be constructed before each mission. For a waypoint
trajectory, ... | 3.234375 | 3 |
test/cluster/keytar/keytar.py | llhhbc/vitess | 15 | 42839 | <gh_stars>10-100
#!/usr/bin/env python
# Copyright 2017 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/LICENSE-2.0
#
# Unless required ... | 2.265625 | 2 |
pytedee/pytedee/example.py | konradsikorski/pytedee | 4 | 42840 | <reponame>konradsikorski/pytedee
'''
Created on 01.11.2020
@author: joerg
'''
import time
from pytedee.TedeeClient import TedeeClient
from pytedee.Lock import Lock
from pytedee.TedeeClientException import TedeeClientException
'''Tedee Credentials'''
username = "username"
password = "password"
client = TedeeClient(us... | 2.078125 | 2 |
wms/event/task.py | bhavesh95863/WMS | 0 | 42841 | import frappe
from frappe.utils import today, getdate, cint, now, add_days, parse_val,add_to_date,nowdate
from frappe.utils.safe_exec import get_safe_globals
def create_task_for_event(doc, method):
try:
if (frappe.flags.in_import and frappe.flags.mute_emails) or frappe.flags.in_patch or frappe.flags.in_inst... | 2.03125 | 2 |
www/apis.py | yumaojun03/blog-python-app | 200 | 42842 | <reponame>yumaojun03/blog-python-app
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
实现以Json数据格式进行交换的RESTful API
设计原因:
由于API就是把Web App的功能全部封装了,所以,通过API操作数据,
可以极大地把前端和后端的代码隔离,使得后端代码易于测试,
前端代码编写更简单
实现方式:
一个API也是一个URL的处理函数,我们希望能直接通过一个@api来
把函数变成JSON格式的REST API, 因此我们需要实现一个装饰器,
由该装饰器将 函数返回的数据 处理成... | 2.890625 | 3 |
USD-Scripts/python/scenegraphUSD/Utility.py | iceprincefounder/selected-sources | 10 | 42843 | <reponame>iceprincefounder/selected-sources
import os,sys
class queue(object):
def __init__(self,input):
self.data = input
if ( self.data ):
self.front = self.data[0]
self.rear = self.data[-1]
else:
self.front = self.rear = None
def knocke... | 2.59375 | 3 |
src/05_ptb_rnn/simple_sequence/predict_simple_sequence.py | corochann/deep-learning-tutorial-with-chainer | 31 | 42844 | """Inference/predict code for simple_sequence dataset
model must be trained before inference,
train_simple_sequence.py must be executed beforehand.
"""
from __future__ import print_function
import argparse
import os
import matplotlib
import numpy as np
from simple_sequence.simple_sequence_dataset import N_VOCABULA... | 2.734375 | 3 |
Demo/sgi/al/record.py | 1byte2bytes/cpython | 5 | 42845 | # Record mono 16bits samples from the audio device and send them to stdout.
# Assume the sampling rate is compatible.
# Use a small queue size to minimize delays.
import al, sys
import AL
BUFSIZE = 2000
QSIZE = 4000
def main():
c = al.newconfig()
c.setchannels(AL.MONO)
c.setqueuesize(QSIZE)
p = al.openport('', '... | 2.546875 | 3 |
utils/get_themes.py | MakerFace/auto_theme | 1 | 42846 | <reponame>MakerFace/auto_theme<gh_stars>1-10
#!/usr/bin/env python3
import sys
sys.path.append('.')
from utils.read_config import ReadConfig
def get_themes():
res = ReadConfig("themes")
res = res.list_to_shell_array(res.get())
print(res)
if __name__ == '__main__':
get_themes()
| 1.601563 | 2 |
scripts/custom_env_utils.py | mahaitongdae/Feasible-Policy-Optimization | 0 | 42847 | from gym.envs.registration import register
def register_custom_env():
# finite time convergence test suite
config = {
'robot_base': 'xmls/point.xml', # dt in xml, default 0.002s for point
# finite time convergence test suite modification
'robot_placements': None, # Robot placements list (defa... | 2.234375 | 2 |
Semester 6/MA 322 (Scientific Computing Theory)/Labs/Lab 7/Code/q7.py | Imperial-lord/IITG | 4 | 42848 | # Question 07, Lab 07
# AB Satyaprakash, 180123062
# imports
import pandas as pd
import numpy as np
# functions
def f(t, y):
return y - t**2 + 1
def F(t):
return (t+1)**2 - 0.5*np.exp(t)
def RungeKutta4(t, y, h):
k1 = f(t, y)
k2 = f(t+h/2, y+h*k1/2)
k3 = f(t+h/2, y+h*k2/2)
k4 = f(t+h, y+... | 3.03125 | 3 |
Pyspark/Ak1Twitter.py | akshaymantriwar/Data-Analysis | 1 | 42849 | <reponame>akshaymantriwar/Data-Analysis
import socket
import sys
import requests
import requests_oauthlib
import json
ACCESS_TOKEN = 'your access token'
ACCESS_SECRET = 'yours'
CONSUMER_KEY = 'yours'
CONSUMER_SECRET = 'yours'
my_auth = requests_oauthlib.OAuth1(CONSUMER_KEY, CONSUMER_SECRET,ACCESS_TOKEN, ACCESS_SECRET)... | 3.140625 | 3 |
gymenv.py | syeehyn/learn2cut | 5 | 42850 | import numpy as np
import cwrapping
GurobiEnv = cwrapping.gurobicpy.GurobiEnv
def make_float64(lists):
newlists = []
for e in lists:
newlists.append(np.float64(e))
return newlists
def check_feasibility(A, b, solution):
RHS = np.dot(A, solution)
if np.sum(RHS - (1.0 - 1e-10) * b > 1e-5) >= 1:
return False
... | 2.390625 | 2 |
client/verta/verta/dataset/_path.py | alexandermiller702/modeldb | 0 | 42851 | <reponame>alexandermiller702/modeldb
# -*- coding: utf-8 -*-
from __future__ import print_function
import hashlib
import os
from .._protos.public.modeldb.versioning import Dataset_pb2 as _DatasetService
from ..external import six
from .._internal_utils import _utils
from . import _dataset
class Path(_dataset._D... | 2.28125 | 2 |
qt/__init__.py | BradleyCSO/university-thesis | 0 | 42852 | from qt.CandlestickChart import CandlestickChart
from qt.CurrencyListModel import CurrencyListModel
from qt.HistoricTreeModel import HistoricTreeModel
from qt.ItemRoles import ItemRoles
from qt.ModeModel import ModeModel
from qt.CurrencyChart import CurrencyChart
from qt.SeriesFilter import SeriesFilter
from qt.DollarI... | 1.046875 | 1 |
script/units/shadowman.py | xzfn/toy | 0 | 42853 |
import math
import vmath
from vmathlib import vcolor, vutil
import vmathlib
import toy
import keycodes
import drawutil
from unit_manager import Unit
import mathutil
class Shadowman(Unit):
def __init__(self, world, unit_id, param):
super().__init__(world, unit_id, param)
self.camera_transform... | 2.375 | 2 |
gspread_pandas/__init__.py | andmatt/gspread-pandas | 0 | 42854 | from .client import Spread, Client
from ._version import __version__, __version_info__
__all__ = ["Spread", "Client", "__version__", "__version_info__"]
| 1.03125 | 1 |
examples/ncbi_gene_mapping.py | JTaeger/graphio | 12 | 42855 | # This excample script shows how to download a data file,
# parse nodes and relationships from the file and load them to Neo4j
#
# The maintainer of this package has a background in computational biology.
# This example loads data on gene IDs from a public genome database.
# We create (:Gene) nodes and (:Gene)-[:MAPS]-... | 3.0625 | 3 |
qa327_test/test_R5.py | HenryTsui1/CISC327 | 1 | 42856 | <reponame>HenryTsui1/CISC327<filename>qa327_test/test_R5.py<gh_stars>1-10
import pytest
from seleniumbase import BaseCase
from qa327_test.conftest import base_url
from unittest.mock import patch
from qa327.models import db, User, Ticket
from werkzeug.security import generate_password_hash, check_password_hash
# Moch ... | 2.46875 | 2 |
backend_app/users/models.py | shakil2995/IUB-Help-Desk-System | 1 | 42857 | <gh_stars>1-10
import uuid
from django.db import models
from django.contrib.auth.base_user import BaseUserManager
from django.contrib.auth.models import AbstractBaseUser
from django.utils import timezone
from .modelchioce import PRIORITY_CHOICE, RESOLVE_CHOICE, USER_TYPE_CHOICE
today = timezone.now
class CustomUser... | 2.21875 | 2 |
data_loader/data_sets.py | Shawn-Guo-CN/EmergentLanguage | 1 | 42858 | import numpy as np
import torch
from torch.utils.data import Dataset
class DSpritesDataset(Dataset):
"""dSprites dataset."""
def __init__(self, npz_file:str, transform=None):
"""
Args:
npz_file: Path to the npz file.
root_dir: Directory with all the images.
... | 2.703125 | 3 |
tools/bin/pythonSrc/pychecker-0.8.18/test_input/test25.py | YangHao666666/hawq | 450 | 42859 | 'doc'
import sys
class A:
'doc'
z = 1
def x(self): pass
def xxx():
print A.x()
print A.z
print A.a
print A.y()
print sys.lkjsdflksjasdlf
| 2.46875 | 2 |
src/STConvLSTM.py | vineeths96/Video-Frame-Prediction | 3 | 42860 | import torch
import torch.nn as nn
class STConvLSTMCell(nn.Module):
"""
Spatio-Temporal Convolutional LSTM Cell Implementation.
"""
def __init__(self, input_size, input_dim, hidden_dim, kernel_size, bias, forget_bias=1.0, layer_norm=True):
super(STConvLSTMCell, self).__init__()
self.... | 2.71875 | 3 |
MAIOReMENORnumero.py | joaoschweikart/python_projects | 0 | 42861 | <filename>MAIOReMENORnumero.py<gh_stars>0
print('MAIOR E MENOR NÚMERO')
a = int(input('Digite um número inteiro: '))
b = int(input('Digite outro número inteiro: '))
c = int(input('Digite outro: '))
#VERIFICANDO O MENOR NÚMERO:
if a<c and a<b:
menor = a
if b<c and b<a:
menor = b
if c<b and c<a:
menor = c
#VE... | 4.15625 | 4 |
xuebadb/dfanalysis/stats.py | vaghulb1992/xuebadb | 0 | 42862 | import seaborn as sns
import matplotlib.pyplot as plt
def dfSummary(data):
try:
return data.describe() #statistical summary
except:
print("Unable to provide a statistical summary")
return False
def colBoxPlot(data):
boxplot_inputs = []
for col in range(0, len(data.colu... | 3.21875 | 3 |
vakt/storage/sql/__init__.py | chuxuantinh/vakt | 132 | 42863 | <filename>vakt/storage/sql/__init__.py
"""
SQL Storage for Policies.
"""
import logging
from sqlalchemy import and_, or_, literal, func
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import FlushError
from .model import PolicyModel, PolicyActionModel, PolicyResourceModel, PolicySubjectModel
from .... | 2.359375 | 2 |
networks/decoders/__init__.py | Yaoyi-Li/HOP-Matting | 56 | 42864 | <gh_stars>10-100
from .resnet_dec import ResNet_D_Dec, BasicBlock
from .res_localHOP_posEmb_dec import ResLocalHOP_PosEmb_Dec
__all__ = ['res_localHOP_posEmb_decoder_22']
def _res_localHOP_posEmb_dec(block, layers, **kwargs):
model = ResLocalHOP_PosEmb_Dec(block, layers, **kwargs)
return model
def res_loc... | 1.867188 | 2 |
demo.py | bigmms/color-transferred-cnn-dehazing | 3 | 42865 | # -*- coding: utf-8 -*-
from tflearn.data_utils import *
from os.path import join
import numpy as np
from skimage import io, transform
from keras.models import load_model
from skimage.color import rgb2lab, lab2rgb
import time
from functools import wraps
import warnings
from tensorflow.python.ops.image_ops import rgb_to... | 2.03125 | 2 |
common/NormalTable.py | hanhui666888/AIStudy | 0 | 42866 | <filename>common/NormalTable.py
import numpy as np
import math
import random as rd
normalTable = [0.5000,0.5040,0.5080,0.5120,0.5160,0.5199,0.5239,0.5279,0.5319,0.5359,
0.5398,0.5438,0.5478,0.5517,0.5557,0.5596,0.5636,0.5675,0.5714,0.5753,
0.5793,0.5832,0.5871,0.5910,0.5948,0.5987,0.6026,... | 1.726563 | 2 |
app/database.py | skasberger/owat_api | 1 | 42867 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Database"""
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.config import get_config_name, get_config
from app.models import Base
def get_engine(config_name=None):
if config_name is None:
config_name = get_c... | 2.609375 | 3 |
objax/functional/parallel.py | kihyuks/objax | 715 | 42868 | # Copyright 2020 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.21875 | 2 |
checklists_scrapers/tests/validation/test_species.py | StuartMacKay/checklists_scrapers | 4 | 42869 | """Validate the species in each entry of the downloaded checklists.
Validation Tests:
Species:
1. the species is a dict.
2. either the common name or scientific name is given.
SpeciesName:
1. common name is a string.
2. common name is set.
3. common name does not have leading... | 3.734375 | 4 |
Python/davisPutnam.py | BuserLukas/Logic | 13 | 42870 | <gh_stars>10-100
def complement(l):
"Compute the complement of the literal L."
if isinstance(l, str):
return ('¬', l)
else:
return l[1]
def extractVariable(l):
"Extract the propositional variable from the literal L."
if isinstance(l, str):
return l
else:
return l... | 3.296875 | 3 |
IIV_app/app/views.py | micado-scale/component-iivr | 0 | 42871 | from flask import jsonify,request
from app import app
import base64
import sys,os
#import sgxwraper to get access to the enclave
sys.path.insert(0,'../SGX_lib/')
import sgxwrapper
@app.route('/')
@app.route('/index')
def index():
return "<h1>My Inventory List</h1>"
@app.route('/api/v1.0/image_verify',methods=['P... | 2.796875 | 3 |
String/Leetcode 316. Remove Duplicate Letters.py | kaizhengny/LeetCode | 31 | 42872 | class Solution:
def removeDuplicateLetters(self, s: str) -> str:
dic = {}
for char in s:
dic[char] = dic.get(char,0)+1
res = []
for char in s:
dic[char] -= 1
if char not in res:
while res and char<res[-1] and dic[res[-1]]>0:
... | 3.375 | 3 |
parser.py | TeamCrazyPerformance/boj-googlesheet-crawler | 1 | 42873 | <gh_stars>1-10
import requests
from bs4 import BeautifulSoup
from multiprocessing import Pool
from collections import OrderedDict
import time_util as tu
BASE_URL = "https://www.acmicpc.net"
def get_submission_links_from_user(boj_id: str) -> list:
# 유저 프로필 '푼 문제'에 있는 제출 내역을 가져온다
# 최근 100문제의 리스트를 가져온다
re... | 2.6875 | 3 |
rbfmorph/__init__.py | utkarshmech/rbfmorph | 2 | 42874 | <reponame>utkarshmech/rbfmorph<filename>rbfmorph/__init__.py<gh_stars>1-10
"""
rbfmorph init file
"""
from .fem_disp import *
from .input import *
from .coordinates import *
from .import_msh import *
from .rbf_func import *
from .solve import *
from .vtk_export import *
from .new_coor import *
__project__ = 'rbfmorph'... | 1.15625 | 1 |
sdk/python/pulumi_aws_native/apigateway/resource.py | AaronFriel/pulumi-aws-native | 29 | 42875 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__a... | 2.046875 | 2 |
tests/test_router.py | Slanman3755/VERAS | 0 | 42876 | import pytest
from veras import router
@pytest.mark.parametrize("origin, destination, expected", [
("KLAX", "KSFO", "SUMMR2 STOKD SERFR SERFR4"),
])
def test_find_route(origin, destination, expected):
assert router.find_route(origin, destination) == expected
| 2.296875 | 2 |
platforms/HT_m3/programming/gui.py | lab11/M-ulator | 19 | 42877 | <filename>platforms/HT_m3/programming/gui.py
#!/usr/bin/env python2
# vim: sts=4 ts=4 sw=4 noet:
import threading
import sys, os, platform, time, errno
import subprocess
import logging
import inspect
from datetime import datetime
import glob
import configparser
import queue
import argparse
import tkinter as Tk
import ... | 2.234375 | 2 |
physics/atoms.py | wirawan0/pyqmc | 0 | 42878 | # $Id: atoms.py,v 1.2 2010-09-07 15:10:56 wirawan Exp $
#
# pyqmc.physics.atoms module
# Created: 20100903
# <NAME>
#
# This module is part of PyQMC project.
#
# Information about atoms
#
# Rigged with the help of Wikipedia,
# http://en.wikipedia.org/wiki/List_of_elements_by_symbol
# - taken from the source code (see ... | 1.6875 | 2 |
minitcm/app.py | JackLPK/MiniTCM | 0 | 42879 | <reponame>JackLPK/MiniTCM<filename>minitcm/app.py<gh_stars>0
import sys
import toml
import wx
from minitcm import CONFIG_FP
from minitcm.mainframe import MainFrame
class MyApp(wx.App):
def OnInit(self):
#
try:
toml.load(CONFIG_FP)
except Exception as e:
print(f'Er... | 2.546875 | 3 |
sciope/utilities/summarystats/summary_base.py | rmjiang7/sciope | 5 | 42880 | <gh_stars>1-10
# Copyright 2017 <NAME>, <NAME> and <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 ... | 3.140625 | 3 |
crystal_toolkit/apps/main.py | mkhorton/mp-dash-components | 0 | 42881 | <filename>crystal_toolkit/apps/main.py
import logging
import os
from ast import literal_eval
from random import choice
from time import time
from typing import Optional
from urllib import parse
from uuid import uuid4
import dash
import sentry_sdk
from dash.dependencies import Input, Output, State
from dash.exceptions ... | 1.820313 | 2 |
application/mod_collage/col_controllers.py | hieusydo/Voyage | 1 | 42882 | <filename>application/mod_collage/col_controllers.py<gh_stars>1-10
from flask import Blueprint, render_template, session, redirect, url_for
from flask_wtf import FlaskForm
from wtforms import SelectField
from application.mod_collage.photoManip import generateCollage
from application.mod_auth.models import Landmark
mo... | 2.546875 | 3 |
web_aggregator/wsgi.py | shenoy-anurag/Aggre-Gator | 1 | 42883 | <filename>web_aggregator/wsgi.py<gh_stars>1-10
import os
from web_aggregator.server import app
if __name__ == "__main__":
app.run(port=5005, debug=True if os.environ.get('FLASK_DEBUG') == 1 else False)
| 1.742188 | 2 |
kneaddata/db_preprocessing/mergesams.py | zwets/kneaddata | 41 | 42884 | import argparse
def merge(infiles, outfile):
setReads = set()
for infile in infiles:
with open(infile, "r") as fileIn:
for strLine in fileIn:
if strLine.startswith('@'):
continue
strSplit = strLine.split("\t")
if strSplit[... | 3.328125 | 3 |
6_nac_workflow/step2b/DO_NACs.py | compchem-cybertraining/Tutorials_QE_and_eQE | 1 | 42885 | <gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# # DO NACs (HPC version)
#
# This file demonstrates how to run the calculations of the NACs in the KS space, using QE.
#
# In particular, this example is designed to run calculations on UB HPC cluster, CCR (Center for Computational Research). More specifically, u... | 2.625 | 3 |
cloudkittyclient/tests/unit/v1/test_hashmap.py | NeCTAR-RC/python-cloudkittyclient | 19 | 42886 | # -*- coding: utf-8 -*-
# Copyright 2018 <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 appli... | 2.203125 | 2 |
src/tmtccmd/__init__.py | robamu-org/tmtccmd | 1 | 42887 | VERSION_NAME = "tmtccmd"
VERSION_MAJOR = 1
VERSION_MINOR = 10
VERSION_REVISION = 2
# I think this needs to be in string representation to be parsed so we can't
# use a formatted string here.
__version__ = "1.10.2"
| 1.40625 | 1 |
knocker/request.py | klen/knocker | 4 | 42888 | """Do requests."""
import asyncio
import http
from random import random
import sentry_sdk
from asgi_tools._compat import aio_sleep
from httpx import (
HTTPError, ConnectError, TimeoutException, NetworkError,
AsyncClient, Response, HTTPStatusError)
from . import config as global_config, logger
async def pro... | 2.40625 | 2 |
endurance/activations.py | Giully314/Endurance | 0 | 42889 | <reponame>Giully314/Endurance<filename>endurance/activations.py
from endurance.variable import Variable, ReLUOperation
from typing import Union
import math
def _unary_relu(x):
out = Variable(x.value if x.value > 0 else 0)
op = ReLUOperation(x, None, out)
out.operation = op
return out
def relu(x: Union... | 3.125 | 3 |
tests/test_program_event.py | yokaze/crest-python | 0 | 42890 | <reponame>yokaze/crest-python
#
# test_program_event.py
# crest-python
#
# Copyright (C) 2017 <NAME>
# Distributed under the MIT License.
#
import crest_loader
import unittest
from crest.events import ProgramEvent
class TestProgramEvent(unittest.TestCase):
def test_ctor(self):
ProgramEvent()
... | 2.546875 | 3 |
test/test.py | kiziebar/pycom | 0 | 42891 | <filename>test/test.py
import unittest
import numpy as np
from pycom import Comet
class TestComet(unittest.TestCase):
def test_criteriaFail(self):
with self.assertRaises(TypeError):
Comet(["Bad", 0.5, 1])
def test_criteriaType(self):
with self.assertRaises(TypeError):
... | 2.46875 | 2 |
ccvpn/models/icinga.py | CCrypto/ccvpn | 81 | 42892 | <reponame>CCrypto/ccvpn
import json
import re
import requests
import socket
from beaker import cache
class IcingaError(Exception):
pass
class IcingaQuery(object):
def __init__(self, urlbase, auth):
self.baseurl = urlbase
self.auth = auth
try:
content = self._get_availcgi... | 2.484375 | 2 |
denoise/denoise_binarize_noise_mask.py | yl3506/iMVPD_dev | 2 | 42893 | ## the noise masks of funcSize are not binarized, this script is to binarize them
import os, json
import nibabel as nib
import numpy as np
from scipy import ndimage
# initalize data
work_dir = '/mindhive/saxelab3/anzellotti/forrest/output_denoise/'
all_subjects = ['sub-01', 'sub-02', 'sub-03', 'sub-04', 'sub-05', 'sub... | 2.25 | 2 |
wait_until/test_main.py | gabrieldemarmiesse/wait-until | 2 | 42894 | import time
from wait_until import wait_until
import pytest
def some_function_that_cannot_work():
raise ValueError("I cannot work!")
def test_wait_until_exception_raised():
with pytest.raises(TimeoutError) as err:
wait_until(some_function_that_cannot_work, timeout=1)
assert "Timeou... | 2.921875 | 3 |
Python/CiaserCypher.py | Souhardya-Ganguly/hacktoberfest2021 | 0 | 42895 | <reponame>Souhardya-Ganguly/hacktoberfest2021
def caesar_encrypt(word,n):
c = ''
for i in word:
if (not i.isalpha()):
c += i
elif (i.isupper()):
c += chr((ord(i) + n-65) % 26 + 65)
else:
c += chr((ord(i) + n - 97) % 26 + 97)
return c
def caesar_de... | 3.890625 | 4 |
sql_handler.py | zepc007/CityData | 1 | 42896 | import json
import pandas as pd
from sqlalchemy import create_engine
class SqlClient:
def __init__(self, host, port, username, password, db):
self.host = host
self.port = port
self.username = username
self.password = password
self.db = db
self._conn = None
... | 2.828125 | 3 |
Curso em Video - Aulas/Aula 21/Aula 21 - Funcoes (Parte 2) - TESTE 06.py | JefferMarcelino/Aulas-Python | 2 | 42897 | def parOuImpar(n=0):
if n % 2 ==0:
return True
else:
return False
num = int(input("Digite um numero: "))
if parOuImpar(num):
print("E par!")
else:
print("Nao e par!")
| 3.875 | 4 |
src/mipi-code2vec/mipi_websocket/mipi_server.py | ngocpq/mipi | 0 | 42898 | <filename>src/mipi-code2vec/mipi_websocket/mipi_server.py
#!/usr/bin/env python
import asyncio
import json
import websockets
from mipi.base_codemeaning_predictor import PatchInfo
from mipi.mipi_app import Mipi
class MipiWSServer:
def __init__(self, mipi_obj, address="localhost", port=8765, port_admin=8766):
... | 2.4375 | 2 |
wall.py | AndySchroder/DistributedCharge | 20 | 42899 | <filename>wall.py
###############################################################################
###############################################################################
#Copyright (c) 2020, <NAME>
#See the file README.md for licensing information.
###############################################################... | 1.960938 | 2 |