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 |
|---|---|---|---|---|---|---|
ISMLnextGen/dynamicCoro.py | Ravenclaw-OIer/ISML_auto_voter | 128 | 12781851 | import asyncio
from threading import Thread
async def production_task():
i = 0
while 1:
# 将consumption这个协程每秒注册一个到运行在线程中的循环,thread_loop每秒会获得一个一直打印i的无限循环任务
asyncio.run_coroutine_threadsafe(consumption(i),
thread_loop) # 注意:run_coroutine_threadsafe... | 3.4375 | 3 |
__init__.py | JHP4911/SLAM-on-Raspberry-Pi | 5 | 12781852 | '''
This file is a modification of the file below to enable map save
https://github.com/simondlevy/PyRoboViz/blob/master/roboviz/__init__.py
roboviz.py - Python classes for displaying maps and robots
Requires: numpy, matplotlib
Copyright (C) 2018 <NAME>
This file is part of PyRoboViz.
PyRoboViz is free software: ... | 2.65625 | 3 |
code/nbs/reco-tut-asr-99-10-metrics-calculation.py | sparsh-ai/reco-tut-asr | 0 | 12781853 | #!/usr/bin/env python
# coding: utf-8
# # Import libraries and data
#
# Dataset was obtained in the capstone project description (direct link [here](https://d3c33hcgiwev3.cloudfront.net/_429455574e396743d399f3093a3cc23b_capstone.zip?Expires=1530403200&Signature=FECzbTVo6TH7aRh7dXXmrASucl~Cy5mlO94P7o0UXygd13S~Afi38FqC... | 3.109375 | 3 |
src/scmdata/__init__.py | chrisroadmap/scmdata | 2 | 12781854 | """
scmdata, simple data handling for simple climate model data
"""
from ._version import get_versions # isort:skip
__version__ = get_versions()["version"]
del get_versions
from scmdata.run import ScmRun, run_append # noqa: F401, E402
| 1.335938 | 1 |
UNIQ/actquant.py | aqui-tna/darts-UNIQ | 6 | 12781855 | import torch.nn as nn
from UNIQ.quantize import act_quantize, act_noise, check_quantization
import torch.nn.functional as F
class ActQuant(nn.Module):
def __init__(self, quatize_during_training=False, noise_during_training=False, quant=False, noise=False,
bitwidth=32):
super(ActQuant, se... | 2.421875 | 2 |
src/crumblebundle/input/keycodes.py | Peilonrayz/crumblebundle | 0 | 12781856 | class _KeyCode:
__slots__ = ("_windows", "_unix")
raw = False
def __init__(self, windows, unix):
self._windows = windows
self._unix = unix
def __repr__(self):
return "_KeyCode(windows={self._windows!r}, unix={self._unix!r})".format(
self=self
)
class KeyCo... | 3.203125 | 3 |
star_tides/services/databases/mongo/schemas/project_schema.py | STAR-TIDES/kb | 2 | 12781857 | <reponame>STAR-TIDES/kb
''' star_tides.services.databases.mongo.schemas.project_schema
'''
from marshmallow.utils import EXCLUDE
from marshmallow import Schema, fields
from marshmallow_enum import EnumField
from star_tides.services.databases.mongo.schemas import camelcase
from star_tides.services.databases.mongo.schema... | 2.015625 | 2 |
test/test_assertions.py | maxtremaine/sudoku_solver.py | 0 | 12781858 | <gh_stars>0
from unittest import TestCase
from src.assertions import is_sudoku_file, is_sudoku_string
class TestAssertions(TestCase):
def test_is_sudoku_file(self):
valid_file = '\n'.join([
' abc def ghi',
'1 7__|_4_|__1',
'2 __1|___|2__',
'3 _6_|2_9|_8_',
... | 3.125 | 3 |
badwing/firework.py | kfields/badwing | 3 | 12781859 | import random
import arcade
from badwing.constants import *
from badwing.effect import Effect
from badwing.particle import AnimatedAlphaParticle
#TODO: Some of this will go up into ParticleEffect
class Firework(Effect):
def __init__(self, position=(0,0), r1=30, r2=40):
super().__init__(position)
... | 2.734375 | 3 |
cutter_without_UI.py | Kameron2442/css-cutter | 0 | 12781860 | read_file = "YOUR_FILE.css" # The path of the file which will be cut
to_keep = ".navbar-" # The class name or prefix of class names that you want to keep
file = open(read_file, "r")
new_file = "" # String to hold the style rules that are kept
get_styles = 0 # Flag for if to_keep in found in a line
get_media ... | 3.703125 | 4 |
tf_quant_finance/math/qmc/__init__.py | slowy07/tf-quant-finance | 3,138 | 12781861 | # Lint as: python3
# Copyright 2021 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 agr... | 1.609375 | 2 |
apex-html-logs.py | ktorstensson/apex-html-logs | 0 | 12781862 | <filename>apex-html-logs.py
#!/usr/bin/env python
# coding: utf-8
''' apex-html-logs.py
Script to summarise APEX html observing logs.
<EMAIL>
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import wi... | 2.71875 | 3 |
app/api/v1/routes.py | antonnifo/StackOverflow-lite | 8 | 12781863 | """all routes"""
from flask import Blueprint
from flask_restful import Api
from .questions.views import Questions, Question, UpdateTitle, UpdateQuestion
VERSION_UNO = Blueprint('api', __name__, url_prefix='/api/v1')
API = Api(VERSION_UNO)
API.add_resource(Questions, '/questions')
API.add_resource(Question, '/question... | 2.296875 | 2 |
cwe_relation_cve/cwe_wrapper.py | pawlaczyk/sarenka_tools | 3 | 12781864 | <gh_stars>1-10
class CWEWrapper:
def __init__(self, cwe_id, description):
self.__cwe_id = cwe_id
self.__description = description
self.__cve_ids_list = []
def add_cve(self, cve_id):
self.__cve_ids_list.extend(cve_id)
@property
def cve_ids(self):
return self.__cv... | 2.484375 | 2 |
bo/pp/pp_gp_my_distmat.py | ZachZhu7/banana-git | 167 | 12781865 | <gh_stars>100-1000
"""
Classes for GP models without any PP backend, using a given distance matrix.
"""
from argparse import Namespace
import time
import copy
import numpy as np
from scipy.spatial.distance import cdist
from bo.pp.pp_core import DiscPP
from bo.pp.gp.gp_utils import kern_exp_quad, kern_matern32, \
ge... | 2.5 | 2 |
Practice/subsetprod.py | ashishjayamohan/competitive-programming | 0 | 12781866 | <gh_stars>0
T = int(input())
while T:
n = int(input())
a = list(map(int, input().split()))
a.sort()
negs0 = a[-5] * a[-4] * a[-3] * a[-2] * a[-1]
negs2 = a[0] * a[1] * a[-1] * a[-2] * a[-3]
negs4 = a[0] * a[1] * a[2] * a[3] * a[-1]
print(max(negs0, negs2, negs4))
T -= 1
| 2.265625 | 2 |
compiled/construct/position_in_seq.py | smarek/ci_targets | 4 | 12781867 | <reponame>smarek/ci_targets
from construct import *
from construct.lib import *
position_in_seq__header_obj = Struct(
'qty_numbers' / Int32ul,
)
position_in_seq = Struct(
'numbers' / Array(this.header.qty_numbers, Int8ub),
'header' / Pointer(16, LazyBound(lambda: position_in_seq__header_obj)),
)
_schema = positio... | 1.726563 | 2 |
02/checksum.py | redfast00/advent_of_code_2017 | 0 | 12781868 | with open("input_2.txt") as spreadsheet:
total = 0
for line in spreadsheet.readlines():
numbers = line.split('\t')
numbers = [int(number) for number in numbers]
difference = max(numbers) - min(numbers)
total += difference
print(total)
def find_divisor(numbers):
for numbe... | 3.53125 | 4 |
train.py | SkyLord2/Yolo-v1-by-keras | 0 | 12781869 | <gh_stars>0
# -*- coding: utf-8 -*-
import tensorflow as tf
import tensorflow.keras as keras
import config as cfg
from YOLOv1_beta_1 import YOLOv1Net
from utils.pascal_voc import pascal_voc
# 需要首先下载数据集
pascal = pascal_voc('train')
def get_train_data_by_batch():
while 1:
for i in range(0, len(pascal.gt_l... | 2.5 | 2 |
Examples/PDFTool/MergeNew.py | wxh0000mm/TKinterDesigner | 1 | 12781870 | #coding=utf-8
#import libs
import MergeNew_cmd
import MergeNew_sty
import Fun
import os
import tkinter
from tkinter import *
import tkinter.ttk
import tkinter.font
#Add your Varial Here: (Keep This Line of comments)
#Define UI Class
class MergeNew:
def __init__(self,root,isTKroot = True):
uiName = self... | 2.984375 | 3 |
setup.py | m-vdb/sentry-scrapy | 7 | 12781871 | #!/usr/bin/env python
from setuptools import setup, find_packages
VERSION = '0.2'
with open('README.md') as readme:
long_description = readme.read()
setup(
name='sentry-scrapy',
version=VERSION,
description='Scrapy integration with Sentry SDK (unofficial)',
long_description=long_description,
... | 1.289063 | 1 |
common/appenginepatch/ragendja/auth/models.py | westurner/nhs-social-web | 2 | 12781872 | <reponame>westurner/nhs-social-web<gh_stars>1-10
from django.contrib.auth.models import *
from django.contrib.auth.models import DjangoCompatibleUser as User
| 1.257813 | 1 |
Crawler/GitCrawler_U.py | FalconLK/FaCoY | 24 | 12781873 | #!/usr/bin/jython
# -*- coding: utf-8 -*-
from subprocess import call # , Popen
import requests
from os import makedirs, removedirs, walk, remove, listdir, stat, rename
from os.path import isdir, join, getmtime, abspath
from pymysql import connect
from time import strftime, gmtime
def many(cur):
while True:
... | 2.34375 | 2 |
pymongo_inmemory/_pim.py | ItsKarma/pymongo_inmemory | 25 | 12781874 | import pymongo
from .mongod import Mongod
class MongoClient(pymongo.MongoClient):
def __init__(self, host=None, port=None, **kwargs):
self._mongod = Mongod()
self._mongod.start()
super().__init__(self._mongod.connection_string, **kwargs)
def close(self):
self._mongod.stop()
... | 2.625 | 3 |
spinta/datasets/commands/error.py | atviriduomenys/spinta | 2 | 12781875 | <filename>spinta/datasets/commands/error.py
from typing import Dict
from spinta import commands
from spinta.datasets.components import Resource, Entity, Attribute
@commands.get_error_context.register(Resource)
def get_error_context(resource: Resource, *, prefix='this') -> Dict[str, str]:
context = commands.get_e... | 2.34375 | 2 |
netbox_ddns/migrations/0003_dnsstatus.py | FreedomNetNL/netbox-ddns | 58 | 12781876 | # Generated by Django 3.0.5 on 2020-04-15 10:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ipam', '0036_standardize_description'),
('netbox_ddns', '0002_add_ttl'),
]
operations = [
migration... | 1.6875 | 2 |
run_tests.py | unistra/schedulesy | 1 | 12781877 | import os
import shutil
import sys
import django
from django.apps import apps
from django.conf import settings
from django.test.utils import get_runner
def manage_model(model):
model._meta.managed = True
if __name__ == '__main__':
os.environ['DJANGO_SETTINGS_MODULE'] = 'schedulesy.settings.unittest'
dj... | 2.03125 | 2 |
sentiments.py | asmaaziz/sentiment-analysis | 0 | 12781878 | from nltk.sentiment.vader import SentimentIntensityAnalyzer
dir= 'C:\\Users\\asmazi01\\dir_path'
commentfile= 'input.txt'
delim ='\t'
fname = dir + '\\' + commentfile
with open(fname, encoding='utf-8', errors='ignore') as f:
sentences = f.readlines()
sid = SentimentIntensityAnalyzer()
totalCompoundScore = 0.0
tota... | 2.984375 | 3 |
migrations/versions/00034ea37afb_meals_dinner_many2many.py | fennec-fox-cast-team/fennec-fox-fit | 0 | 12781879 | """meals dinner many2many
Revision ID: 00034ea37afb
Revises: <PASSWORD>
Create Date: 2019-12-16 11:54:41.895663
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ##... | 1.828125 | 2 |
tests/test_box.py | ikalnytskyi/picobox | 35 | 12781880 | <filename>tests/test_box.py
"""Test picobox class."""
import collections
import inspect
import itertools
import traceback
import picobox
import pytest
def test_box_put_key(boxclass, supported_key):
testbox = boxclass()
testbox.put(supported_key, "the-value")
assert testbox.get(supported_key) == "the-va... | 2.4375 | 2 |
script.py | glaukiol1/sendit-spammer | 1 | 12781881 | <gh_stars>1-10
import requests
import json
import urllib3
import sys
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
headers = {
'Host': 'api.getsendit.com',
'Content-Length': '354',
'Sec-Ch-Ua': '" Not A;Brand";v="99", "Chromium";v="92"',
'App-Id': 'c2ad997f-1bf2-4f2c-b5fd-83926e8... | 2.765625 | 3 |
tensortrade/version.py | andrewczgithub/tensortrade | 1 | 12781882 | __version__ = "0.0.2-rc0"
| 1.054688 | 1 |
test/test_version.py | dell/dataiq-plugin-example | 1 | 12781883 | import unittest
from test import AppTest
class TestVersion(AppTest):
@staticmethod
def make_version_request(client, token):
return client.get(
'/version/',
headers={'Authorization': token})
def test_version(self, client, auth_provider):
r = TestVersion.make_versio... | 2.875 | 3 |
python_dev/send_mail.py | Dloar/stocks_games | 0 | 12781884 | <filename>python_dev/send_mail.py
###
import smtplib
import datetime
from python_dev.functions import getDailyChange, getConfigFile
from email.message import EmailMessage
import warnings
warnings.filterwarnings("ignore")
config_conn = getConfigFile()
daily_looser, daily_gainer, daily_result, percentage_change, portfo... | 2.6875 | 3 |
esanpy/__init__.py | codelibs/esanpy | 13 | 12781885 | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
import argparse
from logging import getLogger, Formatter, StreamHandler
import os
import sys
from esanpy import analyzers
from esanpy import elasticsearch
from esanpy.core import ESRUNNER_VERSION, DEFAULT_CLUSTE... | 2.171875 | 2 |
scripts/experiments/create_q_and_time_for_shortqueries.py | dcs-chalmers/dataloc_vn | 0 | 12781886 | <filename>scripts/experiments/create_q_and_time_for_shortqueries.py
#!/usr/bin/env python3
# python3 scriptname.py beijing path_to_daysfolder path_to_basefolder
import sys
sys.path.append('../../')
sys.path.append('../datasets/')
import time
from query import *
import paths
import argparse
parser = argparse.Argumen... | 2.65625 | 3 |
src/servicetools/middleware.py | zamj/python-service-tools | 0 | 12781887 | <filename>src/servicetools/middleware.py
"""Starlette middleware for services."""
import logging
from time import perf_counter
from typing import Any, Callable, Awaitable, Set, Optional
from structlog import get_logger
from starlette.middleware.base import BaseHTTPMiddleware, DispatchFunction
from starlette import sta... | 2.34375 | 2 |
jobs/baseline.py | GAIPS/ILU-RL | 0 | 12781888 | <gh_stars>0
"""Baseline:
* uses train script for setting up experiment
* has to have a command line `tls_type`: `actuated`, `static`
TODO: Include config for evaluation
"""
import os
from pathlib import Path
from datetime import datetime
import sys
import json
import tempfile
import multiprocessing
import m... | 2.21875 | 2 |
pelicanconf.py | alphor/jarmac.org | 0 | 12781889 | <reponame>alphor/jarmac.org
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = '<NAME>'
SITENAME = 'No Odd Cycles'
SITEURL = 'https://jarmac.org'
PATH = 'content'
TIMEZONE = 'EST'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_A... | 1.539063 | 2 |
api/dna.py | narendersinghyadav/dna | 0 | 12781890 | import psutil
import binascii
import socket
import ipaddress
"""
**Module Overview:**
This module will interact with Tor to get real time statistical and analytical information.
|-is_alive - check tor process is alive or killed
|-is_valid_ipv4_address-check for valid ip address
|-authenticate- cookie authentication o... | 2.625 | 3 |
src/ssh_server.py | ramonmeza/PythonSSHServerTutorial | 4 | 12781891 | import paramiko
from src.server_base import ServerBase
from src.ssh_server_interface import SshServerInterface
from src.shell import Shell
class SshServer(ServerBase):
def __init__(self, host_key_file, host_key_file_password=None):
super(SshServer, self).__init__()
self._host_key = paramiko.RSAK... | 2.671875 | 3 |
python/python-core/datetimes.py | josephobonyo/sigma_coding_youtube | 893 | 12781892 | # import our libraries
import time
import datetime
# get today's date
today = date.today()
print(today)
# create a custom date
future_date = date(2020, 1, 31)
print(future_date)
# let's create a time stamp
time_stamp = time.time()
print(time_stamp)
# create a date from a timestamp
date_stamp = date.fromtimestamp(ti... | 3.96875 | 4 |
Tools/TestSend.py | CasperTheCat/D3D11Wrapper | 11 | 12781893 | import socket
import time
import struct
import os
import numpy
import sys
with open(sys.argv[1], "rb") as f:
data = f.read()[8:]
datarts = numpy.array(struct.unpack("{}Q".format(len(data) // 8), data))
nEvents = 8
HOST = 'localhost' # The remote host
PORT = 6666 # The same port as used by the se... | 2.59375 | 3 |
main.py | Octoleet-Dev/Gingerbread_Checkers | 0 | 12781894 | print('welcome to the Gingerbread_Checkers launcher')
print('would you like to start a new game?')
wu = input('>>>')
yes = 'yes'
Yes = 'Yes'
no = 'no'
No = 'no'
def y():
print('okay, starting new game')
def x():
print('okay then')
if wu = yes:
y()
if wu = Yes
y()
if wu = no
x()
if wu = No
x()
else:
print('error... | 3.40625 | 3 |
exstracs/exstracs_output.py | bnanita/trafficapi | 0 | 12781895 | <reponame>bnanita/trafficapi<gh_stars>0
"""
Name: ExSTraCS_OutputFileManager.py
Authors: <NAME> - Written at Dartmouth College, Hanover, NH, USA
Contact: <EMAIL>
Created: April 25, 2014
Modified: August 25,2014
Description: This module contains the methods for generating the different output files... | 2.078125 | 2 |
session-1/fitting/fitter_apolo.py | Ivan-Solovyev/data-analysis-tutorial | 1 | 12781896 | <filename>session-1/fitting/fitter_apolo.py<gh_stars>1-10
#-------------------------------------------------------------------------------
import ostap.fitting.models as Models
from ostap.utils.timing import timing
from ostap.histos.histos import h1_axis
from Functions import *
#-----------------------------------... | 2.203125 | 2 |
sample_project/env/lib/python3.9/site-packages/fontTools/misc/roundTools.py | Istiakmorsalin/ML-Data-Science | 38,667 | 12781897 | """
Various round-to-integer helpers.
"""
import math
import functools
import logging
log = logging.getLogger(__name__)
__all__ = [
"noRound",
"otRound",
"maybeRound",
"roundFunc",
]
def noRound(value):
return value
def otRound(value):
"""Round float value to nearest integer towards ``+Infinity``.
The Open... | 3.734375 | 4 |
facial_emotion_image.py | richacker/theme_detection | 3 | 12781898 | from keras.preprocessing.image import img_to_array
from keras.models import load_model
import imutils
import cv2
import numpy as np
import sys
# parameters for loading data and images
detection_model_path = 'haarcascade_files/haarcascade_frontalface_default.xml'
emotion_model_path = 'models/_mini_XCEPTION.106-0.65.hdf... | 3.171875 | 3 |
tests/test_entities.py | shelsoloa/Peachy | 2 | 12781899 | <reponame>shelsoloa/Peachy<filename>tests/test_entities.py
import peachy
engine = None
world = None
room = None
def test_startup():
global engine
global world
global room
engine = peachy.Engine()
world = engine.add_world(peachy.World('Test'))
room = world.room
for i in range(100):
... | 2.546875 | 3 |
src/ros_tcp_endpoint/tcp_sender.py | Gin-TrungSon/ROS-TCP-Endpoint | 67 | 12781900 | <filename>src/ros_tcp_endpoint/tcp_sender.py
# Copyright 2020 Unity Technologies
#
# 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
#
# U... | 2.28125 | 2 |
test/tests/del_name_scoping.py | aisk/pyston | 1 | 12781901 | <reponame>aisk/pyston
x = 1
def f():
if 0:
# the del marks 'x' as a name written to in this scope
del x
print x
try:
f()
except NameError, e:
print e
| 2.671875 | 3 |
office365/sharepoint/tenant/administration/sharing_capabilities.py | wreiner/Office365-REST-Python-Client | 544 | 12781902 | class SharingCapabilities:
def __init__(self):
pass
Disabled = 0
ExternalUserSharingOnly = 1
ExternalUserAndGuestSharing = 2
ExistingExternalUserSharingOnly = 3
| 1.734375 | 2 |
fixtures/orm.py | Justcoderguy/python_training | 0 | 12781903 | from pony.orm import *
from models.group import Group
from models.contact import Contact
from pymysql.converters import encoders, decoders, convert_mysql_timestamp
from datetime import datetime
_author_ = 'pzqa'
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
... | 2.28125 | 2 |
test/correctness/unit/upsert_tests.py | titanous/fdb-document-layer | 0 | 12781904 | #
# upsert_tests.py
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
#
# 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 ... | 2.453125 | 2 |
getTheNthNodeFromtheEndOftheLinkedList1.py | kodreanuja/python | 0 | 12781905 | <filename>getTheNthNodeFromtheEndOftheLinkedList1.py
class Node:
def __init__(self, data) -> None:
self.data = data
self.next = None
class LinkedList:
def __init__(self) -> None:
self.head = None
def push(self, data):
New_node = Node(data)
New_node... | 4.03125 | 4 |
setup.py | tatp22/3d-positional-encoding | 0 | 12781906 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="positional_encodings",
version="5.0.0",
author="<NAME>",
author_email="<EMAIL>",
description="1D, 2D, and 3D Sinusodal Positional Encodings in PyTorch",
long_description=long_descripti... | 1.5 | 2 |
tests/test_assert_equal_dataframe.py | nmbrgts/py-dataframe-show-reader | 1 | 12781907 | <gh_stars>1-10
# Copyright 2019 The DataFrame Show Reader Authors. 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
#
# ... | 2.703125 | 3 |
QGL/tools/matrix_tools.py | ty-zhao/QGL | 33 | 12781908 | <gh_stars>10-100
"""
Tools for manipulating matrices
Original Author: <NAME>
Copyright 2020 Raytheon BBN Technologies
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/lice... | 1.710938 | 2 |
Framework/task.py | Phinner/DiscordBot-Framework | 1 | 12781909 | <filename>Framework/task.py<gh_stars>1-10
from asyncio import sleep
from concurrent.futures import ThreadPoolExecutor
from discord.ext.tasks import Loop
from datetime import timedelta
class TaskManager(ThreadPoolExecutor):
Tasks = dict()
# ---------------------------------------------------------------------... | 2.9375 | 3 |
templates/ws/src/python/pkg_name/common/species.py | roadnarrows-robotics/rnmake | 0 | 12781910 | """
A Living organism.
Author: @PKG_AUTHOR@
License: @PKG_LICENSE@
"""
class Species:
""" Species class """
def __init__(self, specific, genus, common=None,
appearance=0.0, extinction=0.0, distribution='Earth'):
"""
Initializer
Parameters:
_specific Species specifi... | 3.53125 | 4 |
src/test/tests/unit/test_value_simple.py | ylee88/visit | 1 | 12781911 | <reponame>ylee88/visit
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: test_value_simple.py
#
# Tests: VisIt Test Suite Test Value tests
#
# Defect ID: none
#
# Programmer: <NAME>, Sun Jan 10 10:24:59 PST 2021
#
# -----------------------------... | 1.976563 | 2 |
setup.py | exitcodezero/picloud-client-python | 1 | 12781912 | <reponame>exitcodezero/picloud-client-python
from distutils.core import setup
setup(
name='PiCloud-Client',
version='4.0.0',
author='<NAME>',
author_email='<EMAIL>',
packages=['picloud_client'],
url='https://github.com/exitcodezero/picloud-client-python',
license='LICENSE.txt',
descript... | 1.21875 | 1 |
tests/test_gendata.py | arappaport/gendata | 0 | 12781913 | import pytest
import json
from collections import OrderedDict
from gendata import gen_permutations, gen_random, prepare_col_opts
@pytest.fixture
def col_opts_test_data_one_level():
col_opts = OrderedDict()
col_opts["Col0"] = {
"Value0_A": 0.1,
"Value0_B": 0.2,
"Value0_C": 0.7
}
... | 2.28125 | 2 |
src/graph/pie_chart.py | asf174/TopDownNvidia | 0 | 12781914 | import matplotlib.pyplot as plt
import plotly.graph_objects as go
from plotly.subplots import make_subplots
class PieChart:
"""
Class which defines a PieChart graph.
Attributes:
__fig : fig ; reference to diagram (which contains all graphs)
__max_rows : int... | 3.359375 | 3 |
pyrotein/utils.py | carbonscott/pyrotein | 1 | 12781915 | <filename>pyrotein/utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from operator import itemgetter
from itertools import groupby
from .atom import constant_atomlabel, constant_aminoacid_code
def bin_image(img_orig, binning = 4, mode = 1, nan_replace = 0):
''' Bin an image for faster di... | 2.609375 | 3 |
xchainpy/xchainpy_client/xchainpy_client/models/balance.py | SLjavad/xchainpy-lib | 8 | 12781916 | from xchainpy_util.asset import Asset
class Balance:
_asset = None # Asset
_amount = 0
def __init__(self, asset, amount):
"""
:param asset: asset type
:type asset: Asset
:param amount: amount
:type amount: str
"""
self._asset = asset
self.... | 2.875 | 3 |
src/database/utils/json_response_wrapper.py | jpeirce21/api | 2 | 12781917 | <gh_stars>1-10
"""
This is a wrapper for a JSON http response specific to the massenergize API.
It ensures that the data retrieved is in a json format and adds all possible
errors to the caller of a particular route
"""
from django.http import JsonResponse
# from .common import convert_to_json
from collections.abc im... | 2.59375 | 3 |
pyaz/netappfiles/volume/export_policy/__init__.py | py-az-cli/py-az-cli | 0 | 12781918 | <gh_stars>0
from .... pyaz_utils import _call_az
def add(account_name, allowed_clients, cifs, nfsv3, nfsv41, pool_name, resource_group, rule_index, unix_read_only, unix_read_write, volume_name, add=None, force_string=None, remove=None, set=None):
'''
Add a new rule to the export policy for a volume.
Requi... | 2.265625 | 2 |
ehr_functions/models/types/elastic_net.py | fdabek1/EHR-Functions | 0 | 12781919 | from ehr_functions.models.types._sklearn import SKLearnModel
from sklearn.linear_model import ElasticNet as EN
import numpy as np
class ElasticNet(SKLearnModel):
def __init__(self, round_output=False, **kwargs):
super().__init__(EN, kwargs)
self.round_output = round_output
def predict(self, x... | 2.5625 | 3 |
Microservices/TPM/app/client_api/api_response.py | ShvDanil/Excellent | 0 | 12781920 | <filename>Microservices/TPM/app/client_api/api_response.py
"""
====================================================================================
Main response from server to client side (in case of project -> other microservice).
====================================================================================
""... | 2.640625 | 3 |
sparrow_cloud/middleware/exception.py | LaEmma/sparrow_cloud | 15 | 12781921 | import logging
import traceback
from django.conf import settings
from sparrow_cloud.dingtalk.sender import send_message
from sparrow_cloud.middleware.base.base_middleware import MiddlewareMixin
logger = logging.getLogger(__name__)
MESSAGE_LINE = """
##### <font color=\"info\"> 服务名称: {service_name}</font> #####
> 进程异... | 1.921875 | 2 |
web_chat/urls.py | yezimai/oldboyProject | 0 | 12781922 | <reponame>yezimai/oldboyProject
"""oldboyProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'... | 2.53125 | 3 |
tute.py | jccabrejas/tute | 0 | 12781923 | from app import app, db
from app.models import User, Game, Deck, Ledger, Trick
@app.shell_context_processor
def make_shell_context():
return {'db': db,
'User': User,
'Game': Game,
'Deck': Deck,
'Ledger': Ledger,
'Trick': Trick,
} | 1.78125 | 2 |
backend/Hrplatform/migrations/0001_initial.py | iamavichawla/AI-based-video-analysis | 0 | 12781924 | # Generated by Django 3.2.4 on 2021-07-05 08:53
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Audio_store1',
fields=[
('id', models.BigAu... | 1.835938 | 2 |
code/python/netmiko_router_config.py | opsec7/refs | 0 | 12781925 | <filename>code/python/netmiko_router_config.py
#!/usr/bin/env python
# lima 6/16/2017
# multiprocessing works better in linux... forking is not supported in windows
# ... just run this in linux and move on...
#
# from __future__ import absolute_import, division, print_function
import netmiko
from multiprocessing impo... | 2.375 | 2 |
metrix/metrix.py | KiriLev/metrix | 0 | 12781926 | import time
from collections import defaultdict
from dataclasses import dataclass
from logging import getLogger
from typing import Optional
@dataclass
class Bucket:
value: int = 0
last_updated_at: Optional[int] = None
def increment(self, timestamp: int):
self.value += 1
self.last_updated_... | 2.6875 | 3 |
src/materia/symmetry/symmetry_operation.py | kijanac/Materia | 0 | 12781927 | from __future__ import annotations
from typing import Iterable, Optional, Union
import materia as mtr
import numpy as np
import scipy.linalg
__all__ = [
"Identity",
"Inversion",
"Reflection",
"ProperRotation",
"ImproperRotation",
"SymmetryOperation",
]
class SymmetryOperation:
def __ini... | 2.328125 | 2 |
data/tinyfpga_bx.py | jwise/corescore | 94 | 12781928 | <reponame>jwise/corescore
ctx.addClock("i_clk", 16)
ctx.addClock("clk", 48)
| 1.117188 | 1 |
demo.py | foamliu/Zero-Shot-Learning | 22 | 12781929 | <filename>demo.py<gh_stars>10-100
import argparse
import json
import random
import numpy as np
import torchvision.transforms as transforms
from scipy.misc import imread, imresize, imsave
from utils import *
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
transform = transforms.... | 2.265625 | 2 |
algorithm.py | dacousb/7old | 5 | 12781930 | # 7old
# search engine algorithm
# that gets data from DB
import sqlite3 as sl
def searchdb(q):
con = sl.connect("results.db")
cur = con.cursor()
rows = cur.execute("SELECT * FROM RESULT ORDER BY title")
result = []
for row in rows:
if (q in row[1] # URL
and row[1].count('/')... | 3.578125 | 4 |
taskflow/monitoring/aws.py | awm33/taskflow | 22 | 12781931 | <gh_stars>10-100
import boto3
from .base import MonitorDestination
class AWSMonitor(MonitorDestination):
def __init__(self,
metric_prefix='',
metric_namespace='taskflow',
*args, **kwargs):
self.metric_namespace = metric_namespace
self.metric_prefi... | 1.9375 | 2 |
eda/lista1/13.py | BrunaNayara/ppca | 0 | 12781932 | <gh_stars>0
n = int(input())
c = int(input())
while(c != n):
if c < n:
print("O número correto é maior.")
elif c > n:
print("O número correto é menor.")
c = int(input())
print("Parabéns! Você acertou.")
| 3.953125 | 4 |
DS-400/Medium/213-House Robber II/DP.py | ericchen12377/Leetcode-Algorithm-Python | 2 | 12781933 | class Solution(object):
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
def robber(nums):
if not nums:
return 0
if len(nums) <= 2:
return max(nums)
dp = [0] * len(nums)
... | 3.234375 | 3 |
lino_book/projects/migs/__init__.py | lino-framework/lino_book | 3 | 12781934 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
# Copyright 2015-2017 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""A copy of the :ref:`noi` as a ticket management demo, for testing Django migrations.
.. autosummary::
:toctree:
settings
"""
| 0.925781 | 1 |
Basic_app/urls.py | Achan40/Portfolio_FullStack | 0 | 12781935 | from django.conf.urls import url
from Basic_app import views
from pathlib import Path
urlpatterns = [
# The about page will be the homepage
url(r'^$',views.AboutView.as_view(),name='about'),
# Creating contact page
url(r'^contact/$',views.Contact_View,name='contact_create'),
# Contact confirmati... | 2.203125 | 2 |
chester/openingbook.py | bsamseth/chester | 0 | 12781936 | import chess
import chess.polyglot
import random
def play_from_opening_book(
book, max_depth=10, fen=chess.STARTING_FEN, random_seed=None
):
"""Play out moves from an opening book and return the resulting board.
From the given `fen` starting position, draw weighted random moves from the opening book
... | 3.953125 | 4 |
crystallus/wyckoff_cfg_generator.py | yoshida-lab/crystallus | 0 | 12781937 | <filename>crystallus/wyckoff_cfg_generator.py
# Copyright 2021 TsumiNa
#
# 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 b... | 2.1875 | 2 |
amr_interop_bridge/scripts/fake_battery_percentage.py | LexxPluss/amr_interop_bridge | 1 | 12781938 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from std_msgs.msg import Float64
if __name__ == "__main__":
rospy.init_node("fake_battery_percentage")
pub = rospy.Publisher("battery_percentage", Float64, queue_size=1)
battery_percentage = rospy.get_param("~battery_percentage", 100)
pub... | 2.453125 | 2 |
dl/layers/layer_base.py | nuka137/DeepLearningFramework | 10 | 12781939 | <reponame>nuka137/DeepLearningFramework
class LayerBase:
name_counter = {}
def __init__(self):
cls = self.__class__
if self.id() not in cls.name_counter:
cls.name_counter[self.id()] = 0
self.name_ = "{}_{}".format(self.id(), cls.name_counter[self.id()])
... | 2.921875 | 3 |
rcs_back/containers_app/admin.py | e-kondr01/rcs_back | 0 | 12781940 | from django.contrib import admin
from .models import (
Building,
BuildingPart,
Container,
EmailToken,
FullContainerReport,
TankTakeoutCompany,
)
class ContainerAdmin(admin.ModelAdmin):
readonly_fields = [
"mass",
"activated_at",
"avg_fill_time",
"calc_avg_f... | 1.90625 | 2 |
rescuemap/migrations/0009_auto_20191106_0006.py | Corruption13/SOS-APP | 2 | 12781941 | <filename>rescuemap/migrations/0009_auto_20191106_0006.py
# Generated by Django 2.2.6 on 2019-11-05 18:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rescuemap', '0008_auto_20191105_2328'),
]
operations = [
migrations.RemoveField(
... | 1.5625 | 2 |
Classification/LibLinear/src/test/scripts/generate_test_data.py | em3ndez/tribuo | 1,091 | 12781942 | # Copyright (c) 2015-2020, Oracle and/or its affiliates. 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
#
# Unle... | 2.125 | 2 |
market.py | rasimandiran/Gen-dqn | 2 | 12781943 | <gh_stars>1-10
# Environment for DQN
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
class Market(object):
LOOK_BACK = 24
def __init__(self, data):
self.fee = 0.001
self.data = data
self.data.index = pd.to_datetime(self.data.index, unit="ms")
... | 2.671875 | 3 |
seq_alignment/__init__.py | ryanlstevens/seq_alignment | 1 | 12781944 | <gh_stars>1-10
# Make global + local similarity class visible to next module
from .global_similarity import global_similarity
from .local_similarity import local_similarity | 1.257813 | 1 |
scripts/find_includes.py | colin-zhou/fast-ta | 13 | 12781945 | <gh_stars>10-100
import subprocess
import sys
import os
from sysconfig import get_paths
# Attempt to see if running python installation has everything we need.
found_include = False
found_numpy_include = False
subversion = None
if sys.version_info[0] == 3:
print(get_paths()['include'])
found_include = True
... | 2.640625 | 3 |
pyspark_apps/process/movies_csv_to_parquet.py | edithhuang2019/emr-demo | 21 | 12781946 | #!/usr/bin/env python3
# Process raw CSV data and output Parquet
# Author: <NAME> (November 2020)
import argparse
from pyspark.sql import SparkSession
def main():
args = parse_args()
spark = SparkSession \
.builder \
.appName("movie-ratings-csv-to-parquet") \
.getOrCreate()
fo... | 3.234375 | 3 |
src/experiment.py | LightnessOfBeing/Understanding-Clouds | 4 | 12781947 | import collections
import os
import pandas as pd
from catalyst.dl import ConfigExperiment
from segmentation_models_pytorch.encoders import get_preprocessing_fn
from sklearn.model_selection import train_test_split
from src.augmentations import get_transforms
from src.dataset import CloudDataset
class Exp... | 2.4375 | 2 |
readme_generator/test_scaffold.py | chelseadole/401-final-project | 6 | 12781948 | <gh_stars>1-10
"""Test file for ensure scaffolding functionality."""
# from readme_generator.make_scaffold import dependencies, license, setup_dict, user_data
# def test_user_data_populated_in_make_scaffold():
# """Test that make_scaffold creates a populated user_data dict."""
# assert len(user_data) > 0
# ... | 2.453125 | 2 |
keras_wide_deep_98_table_15GB/python/intermediate_output.py | WenqiJiang/FPGA-Accelerator-for-Recommender-Systems | 4 | 12781949 | ############ This program is not successful ##############
import pandas as pd
import numpy as np
import argparse
import pandas as pd
from datetime import datetime
import tensorflow as tf
# from tensorflow import keras
from tensorflow.keras.layers import Input, Embedding, Dense, Flatten, Activation, concatenate
# fr... | 2.90625 | 3 |
parsers/api_check.py | Bassem95/Test26 | 105 | 12781950 | <reponame>Bassem95/Test26
# -*- coding: utf-8 -*-
#!/usr/bin/python
"""
"""
import requests
import time
from raven import Client
client = Client(
'https://aee9ceb609b549fe8a85339e69c74150:8604fd36d8b04fbd9a70a81bdada5cdf@sentry.io/1223891')
key = "<KEY>"
def check_api(word):
query_string = { 'api-key': key, ... | 2.640625 | 3 |