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 |
|---|---|---|---|---|---|---|
educative/binarysearch/findhighestnumber.py | monishshah18/python-cp-cheatsheet | 140 | 12787151 | <filename>educative/binarysearch/findhighestnumber.py<gh_stars>100-1000
def find_highest_number(A):
if len(A) < 3:
return None
def condition(value) -> bool:
leftNeighbor = value - 1
rightNeighbor = value + 1
# TODO: Add conditions for leftmost and rightmost values
i... | 4.09375 | 4 |
playbooks/files/rax-maas/plugins/glance_registry_local_check.py | nipsy/rpc-maas | 0 | 12787152 | <reponame>nipsy/rpc-maas
#!/usr/bin/env python
# Copyright 2014, Rackspace US, 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
#
# Unl... | 1.820313 | 2 |
Multi_Page_WebApp/tests/test_db.py | Anthogr/netcdf_editor_app | 8 | 12787153 | <gh_stars>1-10
import sqlite3
import pytest
from climate_simulation_platform.db import (
get_db,
get_file_types,
get_file_type_counts,
steps_seen,
)
def test_get_close_db(app):
with app.app_context():
db = get_db()
assert db is get_db()
with pytest.raises(sqlite3.ProgrammingE... | 2.25 | 2 |
qaws/qaws.py | kacirekj/saws | 2 | 12787154 | <reponame>kacirekj/saws
import boto3
from datetime import datetime, timedelta
import time
import sys
import re
from typing import Iterator
help = '''
NAME
qaws -- Query AWS CloudWatch logs
SYNOPSIS
qaws [-g groups...]
[-t starttime | starttime endtime]
[-q query]
DESCRIPTION
-h -... | 2.671875 | 3 |
scripts/pkl_to_mesh.py | AstitvaSri/SMPL-Segmentation | 6 | 12787155 | import sys
import pickle
import numpy as np
import smplx
import torch
import trimesh
from copy import deepcopy
from psbody.mesh import Mesh
import cv2
import os
import natsort
from tqdm import tqdm
def show(verts = None, faces = None, colors = None):
if torch.is_tensor(verts):
verts = verts.detach().numpy(... | 2.109375 | 2 |
test/test_online_GMM.py | MarvinLvn/megamix | 0 | 12787156 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from scipy import linalg
from numpy.testing import assert_almost_equal
from megamix.online import GaussianMixture
from megamix.online.base import _log_normal_matrix
from megamix.online import dist_matrix
from megamix.utils_testing import checking
from sc... | 2.1875 | 2 |
wpoke/fingers/theme/models.py | sonirico/wpoke | 4 | 12787157 | <gh_stars>1-10
from dataclasses import dataclass
from typing import List, AnyStr
@dataclass
class WPThemeModelDisplay:
theme_name: AnyStr = "Theme Name"
theme_uri: AnyStr = "Theme URI"
description: AnyStr = "Description"
author: AnyStr = "Author"
author_uri: AnyStr = "Author URI"
version: AnyS... | 2.328125 | 2 |
Practica02/hill_test.py | Argenis616/cryptography | 0 | 12787158 | <gh_stars>0
import pytest
from utils import CryptographyException
from hill import Hill
from random import randint
alphabet = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZ"
cipher = None
key2 = "EBAY"
def test_init():
size = 8#randint(4, 9)
if size == 4:
with pytest.raises(CryptographyException):
cipher =... | 2.59375 | 3 |
utils.py | cartologic/cartoview_story_map | 1 | 12787159 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2017 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | 1.765625 | 2 |
BNNs/KF_Laplace/hessian_operations.py | kw-lee/Bayesian-Neural-Networks | 1 | 12787160 | from __future__ import division
import torch
# from BNNs.base_net import *
def softmax_CE_preact_hessian(last_layer_acts):
side = last_layer_acts.shape[1]
I = torch.eye(side).type(torch.ByteTensor)
# for i != j H = -ai * aj -- Note that these are activations not pre-activations
Hl = - last_layer_ac... | 2.140625 | 2 |
ceraon/models/transactions.py | Rdbaker/Mealbound | 1 | 12787161 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Models for transactions."""
import datetime as dt
import uuid
import stripe
from sqlalchemy.dialects.postgresql import JSONB, UUID
from ceraon.database import Column, IDModel, db, reference_col, relationship
class Transaction(IDModel):
"""A transaction made by a user fo... | 2.78125 | 3 |
test/test_crypto.py | eXhumer/aws-crt-python | 48 | 12787162 | <gh_stars>10-100
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
from test import NativeResourceTest
from awscrt.crypto import Hash
import unittest
class TestCredentials(NativeResourceTest):
def test_sha256_empty(self):
h = Hash.sha256_new()
... | 2.15625 | 2 |
yzrpc/config/__init__.py | ml444/yz-rpc | 5 | 12787163 | #!/usr/bin/python3.7+
# -*- coding:utf-8 -*-
"""
@auth: cml
@date: 2021/2/24
@desc: ...
"""
from .default_settings import *
| 1.28125 | 1 |
wings/resource.py | KnowledgeCaptureAndDiscovery/wings-client | 0 | 12787164 | import json
from urllib.parse import urlencode
class Resource(object):
def __init__(self, api_client):
self.api_client = api_client
def get_machine(self, resid):
params = {'resid': resid}
resp = self.api_client.session.get(self.api_client.get_server() + '/common/resources/getMachineJ... | 2.8125 | 3 |
Dodgeball/Dodgeball2.py | Software-Cat/Python-Mini-Projects | 0 | 12787165 | <gh_stars>0
import pygame
import sys
def vertical_dashed_line(screen, color, startPos, length, width, dashLength):
segments = []
dashes = int(length/dashLength)
startY = startPos[1]
for i in range(dashes):
if i%2 == 0:
segments.append([[startPos[0], startY+i*dashLength], [startPos[... | 2.984375 | 3 |
src/core/grasp.py | danbailo/T1-Teoria-Computacao | 0 | 12787166 | import numpy as np
import random
from time import time
random.seed(42)
def semi_greedy_construction(window, number_items, weight_max, values_items, weight_items):
efficiency = np.divide(values_items, weight_items)
items = {}
for i in range(number_items):
items[i] = efficiency[i], values_items[i], weight_items[i... | 2.765625 | 3 |
download_config.py | ASHIK11ab/swito | 1 | 12787167 | <reponame>ASHIK11ab/swito<filename>download_config.py
import requests
import os
import sys
URL = "https://www.googleapis.com/drive/v3/files"
QUERY_STRING = {"alt":"media"}
FILE_ID = sys.argv[1]
API_KEY = sys.argv[2]
def get_config_file_contents():
""" Reads the lines of the configuration file. """
with open(f"... | 3.21875 | 3 |
ckanext-hdx_theme/ckanext/hdx_theme/tests/test_actions/test_api_token_create.py | OCHA-DAP/hdx-ckan | 58 | 12787168 | <filename>ckanext-hdx_theme/ckanext/hdx_theme/tests/test_actions/test_api_token_create.py<gh_stars>10-100
import pytest
from builtins import str
import ckan.model as model
import ckan.plugins.toolkit as tk
import ckan.tests.factories as factories
import ckan.tests.helpers as helpers
@pytest.fixture(scope='module')
... | 2.015625 | 2 |
cornflow-server/cornflow/shared/authentication.py | ggsdc/corn | 2 | 12787169 | """
"""
# Global imports
from functools import wraps
from cornflow_core.authentication import BaseAuth
from cornflow_core.exceptions import InvalidData, NoPermission
from cornflow_core.models import ViewBaseModel, PermissionViewRoleBaseModel
# Partial imports
from flask import request, g, current_app
# Internal mo... | 2.1875 | 2 |
81.write_to_a_file.py | gptakhil/Python_Practice_Beginner | 2 | 12787170 | fp = open('./data/Program81.txt')
fp.write("Hello World 1 \n")
fp.write("Hello world 2 \n")
fp.writelines("Hello World 3 \n")
text = ["Hello World 4 \n","Hello World 5 \n", "Hello World 6"]
fp.close() | 2.71875 | 3 |
test/functional/abc_p2p_avalanche_quorum.py | edhoguntur/bitcoin-abc | 2 | 12787171 | #!/usr/bin/env python3
# Copyright (c) 2020-2022 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the quorum detection of avalanche."""
from time import time
from test_framework.avatools import (
... | 2.09375 | 2 |
SPP-loopback.py | mwswartwout/Edison_Android_Communications | 0 | 12787172 | <reponame>mwswartwout/Edison_Android_Communications
#!/usr/bin/python
from __future__ import absolute_import, print_function, unicode_literals
from optparse import OptionParser, make_option
import os
import sys
import socket
import uuid
import dbus
import dbus.service
import dbus.mainloop.glib
import mraa... | 2.203125 | 2 |
sdr_availability/__init__.py | enavu/sdr_avail | 0 | 12787173 | from .data_manips import *
from .input_prompts import * | 1.039063 | 1 |
11_Retos Diarios/reto-diario-06/main.py | rikhen/OpenBootcampPublic | 0 | 12787174 | # ----------------------------------------------------------------------------
# OpenBootcamp - Reto Diario 06
# Created By : Rikhen
# version =' 1.0'
# ---------------------------------------------------------------------------
import sys
import calculator as calc
import converter as conv
import validations as valid... | 3.296875 | 3 |
tests/test_map.py | xealits/symbolic-lisp | 0 | 12787175 | import pytest
from sym_lis3 import GlobalEnv
def test_map_basic():
g = GlobalEnv()
assert list(g.eval_str('(map (lambda (x) (* 2 x)) (list 1 2 3))')) == [2, 4, 6]
def test_map_curry():
g = GlobalEnv()
g.eval_str('(define "foo" (lambda (x y) (* x y)))')
assert list(g.eval_str('(map (curry foo 2... | 2.875 | 3 |
wonderbits/WBLedMatrix.py | BigCircleLaw/wonderguy | 1 | 12787176 | <filename>wonderbits/WBLedMatrix.py
from .WBits import WBits
from .event import Event
def _format_str_type(x):
if isinstance(x, str):
x = str(x).replace('"', '\\"')
x = "\"" + x + "\""
return x
class LedMatrix(WBits):
def __init__(self, index = 1):
WBits.__init__(self)
... | 2.953125 | 3 |
hostel/vlans/migrations/0001_initial.py | phylocko/hostel | 0 | 12787177 | <gh_stars>0
# Generated by Django 2.1.5 on 2020-10-17 21:32
from django.db import migrations, models
import django.db.models.deletion
import hostel.service.variables
class Migration(migrations.Migration):
initial = True
dependencies = [
('common', '0001_initial'),
]
operations = [
... | 1.742188 | 2 |
tests/conftest.py | lowitea/flake8-fine-pytest | 0 | 12787178 | import os
import ast
import pytest
from flake8.options.manager import OptionManager
from flake8_fine_pytest.checker import FinePytestChecker
def parse_options(allowed_test_directories, allowed_test_arguments_count, allowed_assert_count):
options = OptionManager()
options.allowed_test_directories = allowed_... | 2.34375 | 2 |
fastapi_iam/fixtures.py | jordic/fastapi_iam | 1 | 12787179 | from . import models
from .initialize import initialize_db
from async_asgi_testclient import TestClient
from fastapi.applications import FastAPI
from fastapi_asyncpg import configure_asyncpg
from fastapi_asyncpg import create_pool_test
from fastapi_iam import configure_iam
from pathlib import Path
from pytest_docker_fi... | 2.09375 | 2 |
hitcarder/exception.py | Gavin-Yi/BatchHitcarder | 6 | 12787180 | # -*- coding: utf-8 -*-
"""Exceptions used in hitcarder.
Author: Tishacy
"""
class LoginError(Exception):
"""Login Exception"""
pass
class RegexMatchError(Exception):
"""Regex Matching Exception"""
pass
class DecodeError(Exception):
"""JSON Decode Exception"""
pass
| 1.75 | 2 |
youtube_dl/extractor/space.py | zoogaezee/youtubeDL | 0 | 12787181 | <reponame>zoogaezee/youtubeDL
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .brightcove import BrightcoveLegacyIE
from ..utils import RegexNotFoundError, ExtractorError
class SpaceIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|m)\.)?space\.com/\d+-(?P<title>[^/\.... | 2.4375 | 2 |
web-backend/main.py | mathiash98/openinframap | 43 | 12787182 | from starlette.responses import PlainTextResponse, RedirectResponse
from starlette.applications import Starlette
from starlette.templating import Jinja2Templates
from starlette.routing import Mount, Route
from starlette.staticfiles import StaticFiles
from starlette.exceptions import HTTPException
from template_functio... | 2.140625 | 2 |
setup.py | hhatto/chatpy | 0 | 12787183 | <reponame>hhatto/chatpy
from setuptools import setup
from pip.req import parse_requirements
from pip.download import PipSession
long_desc = file("README.rst").read()
install_reqs = parse_requirements('requirements.txt', session=PipSession())
reqs = [str(ir.req) for ir in install_reqs]
setup(
name='chatpy',
... | 1.640625 | 2 |
boto3/iam.py | yinbiao/lazyaws | 0 | 12787184 | <gh_stars>0
# -*- coding=utf-8 -*-
#!/bin/env python
import boto3
from include.tools import fprint
from policydocument import policy
class IamApi(object):
def __init__(self):
self.iam_client = boto3.client('iam')
def create_user(self, username, path="/"):
if not path.endswith("/"):
... | 2.125 | 2 |
tests/conftest.py | gsvolt/cle_parcel_lookup | 1 | 12787185 | import pytest
from cle_parcel_lookup import create_app
@pytest.fixture
def app():
return create_app()
@pytest.fixture
def client(app):
return app.test_client()
| 1.398438 | 1 |
10 Days of Statistics/Day 9 Multiple Linear Regression.py | ersincebi/hackerrank | 0 | 12787186 | import numpy as np
m,n = [int(i) for i in '2 7'.strip().split(' ')]
data1=[
'0.18 0.89 109.85',
'1.0 0.26 155.72',
'0.92 0.11 137.66',
'0.07 0.37 76.17',
'0.85 0.16 139.75',
'0.99 0.41 162.6',
'0.87 0.47 151.77'
]
X = []
Y = []
for item in data1:
data = item.strip().split(' ')
X.append(data[:m])
Y.append(data... | 3 | 3 |
ziggonext/__init__.py | geertsmichael/ziggonext-python | 6 | 12787187 | <reponame>geertsmichael/ziggonext-python<filename>ziggonext/__init__.py<gh_stars>1-10
"""Python client for Ziggo Next."""
from .ziggonext import ZiggoNext
from .models import ZiggoRecordingSingle, ZiggoRecordingShow
from .ziggonextbox import ZiggoNextBox
from .const import ONLINE_RUNNING, ONLINE_STANDBY
from .exception... | 1.5625 | 2 |
data/python_templates/material.py | botamochi0x12/Python-Roguelike-Framework | 25 | 12787188 | from components.material import Material
# This Assumes most pieces of armor will have 1 AC as base.
Skin = Material('skin', 'Skin', hardness=0, sharpness=0, potency=0.2, weight=0.1, value=0)
Flesh = Material('flesh', 'Flesh', hardness=0, sharpness=0, potency=0.2, weight=0.15, value=0)
Fur = Material('fur', 'Fur', ... | 2.71875 | 3 |
Ngo/FinalProj/accounts/migrations/0013_auto_20201010_1226.py | Devang-25/Donate-Cart-for-NGO-By-Devang-Sharma | 0 | 12787189 | <reponame>Devang-25/Donate-Cart-for-NGO-By-Devang-Sharma
# Generated by Django 3.0.6 on 2020-10-10 06:56
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0012_auto_20201010_1225'),
]
operations = [
migrations.RenameField(
... | 1.703125 | 2 |
sanic_peewee/async_manager.py | daniel4git/sanic-peewee | 3 | 12787190 | <filename>sanic_peewee/async_manager.py
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
@Author: <NAME>
@Date: 01-Apr-2017
@Email: <EMAIL>
# @Last modified by: <NAME>
# @Last modified time: 08-Apr-2017
@License: Apache License Version 2.0
"""
__all__ = ["AsyncManager"]
from peewee_async import Manag... | 2.828125 | 3 |
python-client/swagger_client/models/vehicle.py | hallelulius/VastHinken | 0 | 12787191 | # coding: utf-8
"""
Reseplaneraren
Provides access to Västtrafik journey planner
OpenAPI spec version: 1.10.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class Vehicle(object):
"""
NOTE: This clas... | 1.84375 | 2 |
aziende/admin.py | luca772005/studio | 0 | 12787192 | <filename>aziende/admin.py<gh_stars>0
from django.contrib import admin
from aziende.models import Azienda
# Register your models here.
@admin.register(Azienda)
class AziendaAdmin(admin.ModelAdmin):
pass | 1.414063 | 1 |
002_TestMotor/main.py | DaliSummer/MindstormsEV3_py | 0 | 12787193 | <reponame>DaliSummer/MindstormsEV3_py
#!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor
from pybricks.parameters import Port
# Initialize the EV3 Brick.
ev3 = EV3Brick()
# Initialize a motor at port B.
motorB = Motor(Port.B)
# Initialize a motor at port C.
mo... | 2.8125 | 3 |
daira/migrations/0009_auto_20200816_1259.py | medram/daira | 1 | 12787194 | <filename>daira/migrations/0009_auto_20200816_1259.py
# Generated by Django 3.0.2 on 2020-08-16 11:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('daira', '0008_auto_20200712_1826'),
]
operations = [
... | 1.640625 | 2 |
signal/__init__.py | indranilsinharoy/iutils | 0 | 12787195 | # signal utils
| 0.992188 | 1 |
dizoo/classic_control/cartpole/config/cartpole_dqfd_config.py | jayyoung0802/DI-engine | 1 | 12787196 | from easydict import EasyDict
cartpole_dqfd_config = dict(
exp_name='cartpole_dqfd_seed0',
env=dict(
collector_env_num=8,
evaluator_env_num=5,
n_evaluator_episode=5,
stop_value=195,
),
policy=dict(
cuda=True,
priority=True,
model=dict(
... | 1.929688 | 2 |
base/site-packages/wi_cache/wicache.py | B-ROY/TESTGIT | 2 | 12787197 | <gh_stars>1-10
#encoding = utf-8
import sys, os
from django.core.cache import parse_backend_uri
from django.conf import settings
try:
memcache_settings = settings.memcache_settings
except:
mdefault = "memcached://127.0.0.1:11211/"
memcache_settings = {"CACHE_BACKEND": mdefault, "PAGE_CACHE_BACKEND": mdefault}
mem... | 2.140625 | 2 |
apps/reviews/views/__init__.py | Haizza1/RandomCameras-Backend | 1 | 12787198 | <reponame>Haizza1/RandomCameras-Backend
from .lens import LensReviewsViewSet
from .cameras import CamerasReviewsViewSet | 1.03125 | 1 |
src/segmentation_inference.py | emrecanaltinsoy/chromosome-semantic-segmentation | 2 | 12787199 | import argparse
import yaml
import os
from glob import glob
import inspect
import sys
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
import time
import numpy as np
import torch
from torch.ut... | 1.742188 | 2 |
MRI_reconstruction/Homogenizer.py | inbalalo/MRI_rec | 0 | 12787200 | import os
import struct
import numpy as np
import xarray as xr
import netCDF4 as ds
from pathlib import Path
import matplotlib.pyplot as plt
import struct
import itertools
import Homogenizer_GUI
from enum import Enum
from collections import OrderedDict
import pickle
class UserPrefs(Enum):
ScanFolde... | 2.296875 | 2 |
iterables/Exercises/gradepoints.py | WebucatorTraining/classfiles-actionable-python | 2 | 12787201 | def main():
pass # replace this with your code
main() | 1.054688 | 1 |
cocrawler/webserver.py | joye1503/cocrawler | 166 | 12787202 | <filename>cocrawler/webserver.py
import logging
import asyncio
from aiohttp import web
from . import config
LOGGER = logging.getLogger(__name__)
def make_app():
loop = asyncio.get_event_loop()
# TODO switch this to socket.getaddrinfo() -- see https://docs.python.org/3/library/socket.html
serverip = conf... | 2.5625 | 3 |
testsuite/tests/QB02-003__m_files/run_test.py | AdaCore/style_checker | 2 | 12787203 | <reponame>AdaCore/style_checker<gh_stars>1-10
def test_ok(style_checker):
"""Style check test against ok.m
"""
style_checker.set_year(2017)
p = style_checker.run_style_checker('whatever', 'ok.m')
style_checker.assertEqual(p.status, 0, p.image)
style_checker.assertRunOutputEmpty(p)
def test_rcs... | 2.3125 | 2 |
test/test.py | bobrock/AuthKit | 0 | 12787204 | <filename>test/test.py<gh_stars>0
"""
Very basic tests which so no more than check each of the authentication
methods to ensure that an unprotected page is accessible and that a
protected page triggers the a sign in.
Note: Should the Form and Forward methods return 401 or 200 when they
generate an HTML page for the u... | 2.8125 | 3 |
Physics250-ME22/diskfluxMagnitude.py | illusion173/Physics250 | 0 | 12787205 | import numpy as np
import math
Esubo = 8.854 * pow(10,-12)
k = 8.988 * pow(10,9)
def fluxDisk():
radius = float(input("Radius: "))
radius = radius /1000
electricField = float(input("Electric Field: "))
electricField = (electricField*pow(10,3))
theta = float(input("Theta: "))
actualTh... | 3.5 | 4 |
office365/sharepoint/sites/usage_info.py | theodoriss/Office365-REST-Python-Client | 544 | 12787206 | <reponame>theodoriss/Office365-REST-Python-Client
from office365.runtime.client_value import ClientValue
class UsageInfo(ClientValue):
"""
Provides fields used to access information regarding site collection usage.
"""
def __init__(self, bandwidth=None, discussion_storage=None, visits=None):
"... | 2.71875 | 3 |
Python_Exercise/exercise_seven.py | kindyluv/My_Personal_Python_Exercises | 0 | 12787207 | <reponame>kindyluv/My_Personal_Python_Exercises<filename>Python_Exercise/exercise_seven.py
import operator
sign_operator = {
"**": operator.pow,
"/": operator.truediv,
"-": operator.sub,
"+": operator.add,
"*": operator.mul,
"%": operator.mod,
}
is_a_good_credit = True
price = int(... | 4.125 | 4 |
python/paddle_serving_client/metric/auc.py | loveululu/Serving | 789 | 12787208 | <filename>python/paddle_serving_client/metric/auc.py
# Copyright (c) 2020 PaddlePaddle 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.apach... | 2.578125 | 3 |
convlstm/package/convlstm.py | AlbertoCenzato/pytorch_model_zoo | 11 | 12787209 | <filename>convlstm/package/convlstm.py
from typing import Optional, Union, Tuple, List
from enum import Enum
import torch
import torch.nn as nn
from torch import Tensor
# typedefs
HiddenState = Tuple[Tensor, Tensor]
HiddenStateStacked = Tuple[List[Tensor], List[Tensor]]
class ConvLSTMCell(nn.Module):
def __in... | 2.78125 | 3 |
build/lib/tunning/cross_validation.py | Breno-st/ds_utils | 0 | 12787210 | """Optimization
* :function:`.single_nested_cvrs`
* :function:`.dual_nested_cvrs`
* :function:`.single_cv`
* :function:`.chi2_test`
"""
# data wrangling
import numpy as np
import pandas as pd
from itertools import product
from scipy import stats
# validation
from sklearn.metrics import balanced_accuracy... | 2.640625 | 3 |
geoana/kernels/__init__.py | simpeg/geoana | 11 | 12787211 | <filename>geoana/kernels/__init__.py
"""This module contains kernals for (semi-)analytic geophysical responses
"""
from geoana.kernels.tranverse_electric_reflections import rTE_forward, rTE_gradient
| 1.007813 | 1 |
Desafio 105.py | MoomenEltelbany/PythonDesafios | 0 | 12787212 | <reponame>MoomenEltelbany/PythonDesafios<filename>Desafio 105.py
def notas(*n, sit=False):
d = dict()
d['total'] = len(n)
d['maior'] = max(n)
d['menor'] = min(n)
d['media'] = sum(n) / len(n)
if sit:
if d['media'] >= 7:
d['sitauaca'] = 'Boa'
elif d['media'] >= 5:
... | 3.21875 | 3 |
avaxpython/network/ip.py | jgeofil/avax-python | 25 | 12787213 | <gh_stars>10-100
# avax-python : Python tools for the exploration of the Avalanche AVAX network.
#
# Find tutorials and use cases at https://crypto.bi
"""
Copyright (C) 2021 - crypto.bi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t... | 1.984375 | 2 |
gifi/main.py | kokosing/git-gifi | 9 | 12787214 | import sys
import logging
from gifi.utils import git_utils
from gifi.command import Command, AggregatedCommand, UnknownCommandException, CommandException
import gifi.epic
import gifi.feature
import pkg_resources
import gifi.queue
import gifi.git_hub
logging.basicConfig(filename='/tmp/gifi.log', level=logging.DEBUG)
... | 2.515625 | 3 |
altair/vegalite/v2/examples/bar_chart_with_highlight.py | mtzl/altair | 1 | 12787215 | <filename>altair/vegalite/v2/examples/bar_chart_with_highlight.py
"""
Bar Chart with Highlight
------------------------
This example shows a Bar chart that highlights values beyond a threshold.
"""
import altair as alt
import pandas as pd
data = pd.DataFrame({"Day": range(1, 16),
"Value": [54.8, ... | 3.53125 | 4 |
core/core_menu.py | g0d0/green | 6 | 12787216 | import subprocess,sys,random
import GreenLib
#Mensagens
sys.path.insert(0, 'messages')
import msg_control
import msg_logo
sys.path.insert(0, 'core')
import core_cripto
import core_recon
import core_menu
#--
# Função Menu principal
#--
def main_menu():
subprocess.run(["clear"])
logos = [msg_logo.msg_logo1,ms... | 2.765625 | 3 |
tests/opensocial_tests/__init__.py | chrischabot/opensocial-python-client | 0 | 12787217 | <reponame>chrischabot/opensocial-python-client
import sys
import logging
sys.path.insert(0, sys.path[0] + '/../src')
logging.basicConfig(level=logging.INFO) | 1.664063 | 2 |
code/composite_example_ERA5.py | kuchaale/wcd_2021 | 0 | 12787218 | <filename>code/composite_example_ERA5.py
import cdstoolbox as ct
@ct.application(title='Calculate composite mean')
@ct.output.download()
def download_application():
variable = 'total_column_ozone'
data_ls = []
year_ls = [1981, 1982, 1982, 1982, 1983, 1983, 1984, 1984, 1984, 1985, 1985,
1986... | 2.671875 | 3 |
p4cw/p4cw.py | nurpax/p4cw | 1 | 12787219 | <reponame>nurpax/p4cw
#!/usr/bin/env python3
import argparse
import os
import subprocess
import tempfile
import sys
import re
from typing import List, Optional, Tuple
def friendlify(spec: List[str]) -> Tuple[Optional[str], List[str]]:
if len(spec) < 1:
return None, spec
if spec[0].startswith('# A Pe... | 2.546875 | 3 |
others/DDCC/2020/b.py | fumiyanll23/AtCoder | 0 | 12787220 | def main():
# input
N = int(input())
As = list(map(int, input().split()))
# compute
diffs = [0] * (N-1)
r, s = 0, sum(As)
for i in range(N-1):
r += As[i]
s -= As[i]
diffs[i] = abs(s-r)
# output
print(min(diffs))
if __name__ == '__main__':
main()
| 2.96875 | 3 |
michelanglo_protein/generate/protParam_mod.py | matteoferla/protein-module-for-VENUS | 1 | 12787221 | from Bio.SeqUtils import ProtParam, ProtParamData
from warnings import warn
# mod for DIWV
def mod(sequence):
"""
This is a not implemented function. It is a fix for ProtParam.ProteinAnalysis().protein_scale and the DIWV scale.
As the latter requires knowldge of the preceeding amino acid it will fail.
... | 2.4375 | 2 |
read_2600.py | john-stephens/atari_2600_reader | 0 | 12787222 |
from __future__ import print_function
import smbus
import time
import struct
import argparse
import sys
import math
# Argument definition and handling
parser = argparse.ArgumentParser(description="Read an Atari 2600 cartridge via I2C")
parser.add_argument("-s", dest="rom_size", metavar="size", type=int, required=Tru... | 3.28125 | 3 |
storage/bucket.py | FabianoBFCarvalho/api-python | 0 | 12787223 | <reponame>FabianoBFCarvalho/api-python
import os
import cloudstorage
from google.appengine.api import app_identity
import webapp2
import googleapiclient.http
import base64
storage = googleapiclient.discovery.build('storage', 'v1')
class Bucket(webapp2.RequestHandler):
def get(self):
bucket_name = os.en... | 2.890625 | 3 |
olypy/formatters.py | akhand2222/olypy | 0 | 12787224 | <reponame>akhand2222/olypy
'''
Helper functions for reading/writing Olympia lib files
'''
import sys
from functools import partial
from collections import OrderedDict
def fixed(count, char, key, array):
if not array or len(array) == 0:
return
if len(array) % count != 0:
raise ValueError(key +... | 2.796875 | 3 |
app/main.py | JevinJ/SubredditStats | 1 | 12787225 | <filename>app/main.py
import argparse
from collections import defaultdict
from datetime import datetime
import praw
from unidecode import unidecode
import fileio as fio
import constants
class SubredditStats:
def __init__(self, **kwargs):
'''
:param bot_name: The name/site of the bot as defined in ... | 2.71875 | 3 |
data/basic_deterministic.py | RandalJBarnes/OnekaPy | 0 | 12787226 | <filename>data/basic_deterministic.py
PROJECTNAME = 'Basic deterministic example'
TARGET = 0
NPATHS = 100
DURATION = 10*365.25
NREALIZATIONS = 1
BASE = 0.0
C_DIST = (35.0, 50.0, 75.0)
P_DIST = (0.25)
T_DIST = (20.0, 25.0)
BUFFER = 100
SPACING = 2
UMBRA = 10
SMOOTH = 4
CONFINED = True
TOL = 1
MAXSTEP = 20
WELLS = [... | 1.695313 | 2 |
ctr-in-action/deepctr/__init__.py | wdxtub/compute-ad-note | 21 | 12787227 | <gh_stars>10-100
from . import layers
from . import models
from .utils import check_version
__version__ = '0.4.1'
check_version(__version__)
| 1.09375 | 1 |
replay.py | fahdfareed/IoT-security-Implication | 0 | 12787228 | import json
f = open('removed_duplicates_sorted_2.json')
data = json.load(f)
f.close()
ones = []
for i in data["ones"]:
if "ali" in i["comment"]:
i["scam"] = 1
ones.append(i)
else:
ones.append(i)
data["ones"] = ones
with open('removed_duplicates_sorted_2.json', 'w') as outfile:
j... | 2.734375 | 3 |
fython/lex/mark_ropx.py | nicolasessisbreton/fython | 41 | 12787229 | <filename>fython/lex/mark_ropx.py
from ..config import *
from ..lexem import *
follower = [l.commax, l.rparx, l.rketx]
def mark_ropx(module):
lexem = module.lexem
for i in range(1, len(lexem)):
x = lexem[i]
t = x.type
v = x.value.value
if t == l.opx:
if v == ':':
n = lexem[i+1].type
if n in f... | 2.5 | 2 |
steem/steem.py | Netherdrake/steem-python | 24 | 12787230 | <filename>steem/steem.py
from .commit import Commit
from .steemd import Steemd
class Steem:
""" Connect to the Steem network.
Args:
nodes (list): A list of Steem HTTP RPC nodes to connect to. If not provided, official Steemit nodes will be used.
debug (bool): Elevate logging level... | 2.578125 | 3 |
feedzero/ingest/tests/test_models.py | dammitjim/badfeed | 0 | 12787231 | <gh_stars>0
import pytest
from feedzero.ingest.models import IngestLog
@pytest.mark.django_db
class TestIngestLog:
@pytest.mark.parametrize("state", [state[0] for state in IngestLog.STATE_CHOICES])
def test_can_create_different_log_states(self, feed, state):
"""Should be able to create each potential... | 2.28125 | 2 |
gmail_sender/__main__.py | awiseman/gmail-sender | 0 | 12787232 | <filename>gmail_sender/__main__.py<gh_stars>0
from __future__ import print_function
import argparse
import base64
import mimetypes
import os.path
import pickle
import sys
from email.mime.audio import MIMEAudio
from email.mime.base import MIMEBase
from email.mime.image import MIMEImage
from email.mime.multipart import... | 2.734375 | 3 |
try_local.py | Fredy/GCP_Things | 0 | 12787233 | <gh_stars>0
#!/usr/bin/env python
from flask import Flask, request
from main import image_borders
if __name__ == "__main__":
app = Flask(__name__)
@app.route('/')
def index():
return image_borders(request)
app.run('127.0.0.1', 8002, debug=True)
| 2.46875 | 2 |
system_query/__init__.py | vatai/system-query | 7 | 12787234 | """Initialization of system_query package."""
__all__ = [
'query_all', 'query_cpu', 'query_gpus', 'query_ram', 'query_software', 'query_and_export']
from .all_info import query_all
from .cpu_info import query_cpu
from .gpu_info import query_gpus
# from .host_info import query_host
# from .os_info import query_os
... | 1.539063 | 2 |
tests/test_scottbrian_paratools/test_smart_event.py | ScottBrian/scottbrian_paratools | 0 | 12787235 | <filename>tests/test_scottbrian_paratools/test_smart_event.py<gh_stars>0
"""test_smart_event.py module."""
###############################################################################
# Standard Library
###############################################################################
from enum import Enum
import logg... | 2.0625 | 2 |
xena_gdc_etl/gdc.py | ayan-b/xena-GDC-ETL | 5 | 12787236 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module provides basic and minimum necessary functions for carrying out
data query and download for Xena GDC ETL pipelines.
"""
# Ensure Python 2 and 3 compatibility
from __future__ import division
from __future__ import print_function
import json
import os
import... | 2.25 | 2 |
nexpose/nexpose.py | liberza/python-nexpose | 0 | 12787237 | #!/usr/bin/python3
import defusedxml.ElementTree as ET
import urllib.request
import urllib.parse
import sys
import ssl
__author__ = '<NAME> <<EMAIL>>'
class NexposeException(Exception):
'''Raise this exception when the Nexpose API returns errors.'''
pass
class Nexpose:
'''
Nexpose API wrapper.
'''
def __init__... | 2.515625 | 3 |
2020/day02.py | kyz/adventofcode | 0 | 12787238 | import re, collections
def count_valid(passwords, valid):
count = 0
m = re.compile(r"(\d+)-(\d+) (.): (.+)")
for p in passwords:
n1, n2, c, password = m.match(p).groups()
if valid(int(n1), int(n2), c, password):
count += 1
return count
def policy1(lo, hi, c, password):
... | 3.65625 | 4 |
tests/extension/__init__.py | OriolAbril/sphinx-codeautolink | 0 | 12787239 | """
Basic extension tests.
The tests are structured as .txt files, parsed and executed here.
The structure of the file is::
number of expected autolinks
# split
lines to add to the default conf.py
# split
index.html content
"""
import re
import sys
import pytest
from pathlib import Path
from bs4 impor... | 2.625 | 3 |
nrpylatex/__init__.py | zachetienne/nrpylatex | 4 | 12787240 | from nrpylatex.parse_latex import Lexer, Parser, Tensor
from nrpylatex.parse_latex import ParseError, TensorError, OverrideWarning
from nrpylatex.parse_latex import parse_latex
__version__ = "1.0.8"
| 1.265625 | 1 |
train.py | AbcEric/AlphaZero_Gomoku | 0 | 12787241 | <reponame>AbcEric/AlphaZero_Gomoku
# -*- coding: utf-8 -*-
"""
An implementation of the training pipeline of AlphaZero for Gomoku(五子棋)
@author: <NAME>
参考:
https://zhuanlan.zhihu.com/p/32089487 (说明)
https://link.zhihu.com/?target=https%3A//github.com/junxiaosong/AlphaZero_Gomoku (代码)
对于在6*6的棋盘上下4子棋这种情况,大约通过5... | 2.40625 | 2 |
tests/mail/test_sendtestemail.py | bpeschier/django | 0 | 12787242 | from __future__ import unicode_literals
from django.core import mail
from django.core.management import call_command
from django.test import SimpleTestCase
class SendTestEmailManagementCommand(SimpleTestCase):
"""
Test the sending of a test email using the `sendtestemail` command.
"""
def test_send_... | 2.625 | 3 |
src/engine/datastore/models/section.py | thomasmauerhofer/search-engine | 0 | 12787243 | #!/usr/bin/env python3
# encoding: utf-8
import pprint
from enum import Enum
from engine.datastore.models.paper_structure import PaperStructure
from engine.datastore.models.text import Text
from engine.preprocessing.text_processor import TextProcessor
from engine.utils.objects.word_hist import WordHist
class Section... | 2.5 | 2 |
envdsys/envcontacts/models.py | NOAA-PMEL/envDataSystem | 1 | 12787244 | from django.db import models
# Create your models here.
class Contact(models.Model):
street_address = models.CharField(
max_length=100,
null=True,
blank=True
)
city = models.CharField(
max_length=30,
null=True,
blank=True
)
state = models.CharField(... | 2.25 | 2 |
cats/v2/config.py | AdamBrianBright/cats-python | 2 | 12787245 | <filename>cats/v2/config.py
import asyncio
from dataclasses import dataclass
from typing import Type
from tornado.iostream import StreamClosedError
from cats.errors import CatsError
from cats.v2.handshake import Handshake
__all__ = [
'Config',
]
@dataclass
class Config:
idle_timeout: float | int = 120.0
... | 2.1875 | 2 |
pred_to_eval/excel.py | FluteXu/ms-project | 0 | 12787246 | import os
import pandas as pd
import sys
sys.path.insert(0, '../')
from LGAIresult import LGAIresult
from utils.common_utils import save_split_txt, load_split_txt, write_excel
def out_excel(ann_list, time_list, pid_list, save_dir):
time_dict = get_dict(time_list)
pid_dict = get_dict(pid_list, '\t')
c... | 2.515625 | 3 |
benchtmpl/workflow/benchmark/loader.py | scailfin/benchmark-templates | 0 | 12787247 | <filename>benchtmpl/workflow/benchmark/loader.py
# This file is part of the Reproducible Open Benchmarks for Data Analysis
# Platform (ROB).
#
# Copyright (C) 2019 NYU.
#
# ROB is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""Impleme... | 2.34375 | 2 |
deepnet/impute.py | smoitra87/deepnet | 0 | 12787248 | <gh_stars>0
"""Computes partition function for RBM-like models using Annealed Importance Sampling."""
import numpy as np
from deepnet import dbm
from deepnet import util
from deepnet import trainer as tr
from choose_matrix_library import *
import sys
import numpy as np
import pdb
import time
import itertools
import mat... | 2.125 | 2 |
rosstat/validators/control/control.py | WoolenSweater/rosstat_flc | 2 | 12787249 | from ..base import AbstractValidator
from .exceptions import PrevPeriodNotImpl
from .inspectors import PeriodInspector, FormulaInspector
class ControlValidator(AbstractValidator):
name = 'Проверка контролей'
code = '4'
def __init__(self, schema):
self._schema = schema
self.errors = []
... | 2.453125 | 2 |
twemoji/parse_list/mk_seqjson.py | ericosur/myqt | 0 | 12787250 | <reponame>ericosur/myqt
#!/usr/bin/env python3
# coding: utf-8
'''
sanilize list.txt and generate seq.json
'''
import re
import json
def main():
''' main '''
fn = 'list.txt'
arr = []
with open(fn, 'rt', encoding='UTF-8') as fh:
arr = fh.readlines()
p = re.compile(r'([0-9a-f]+)')
cp_di... | 2.90625 | 3 |