content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
"""Generates the pins file for the SWM320"""
from __future__ import print_function
import re
import sys
import argparse
class Pin:
"""Holds the information associated with a pin."""
def __init__(self, name, port, pbit, preg, IRQn):
self.name = name
self.port = port
self.pbit = pbit
... | 31.438462 | 153 | 0.56276 | [
"MIT"
] | Synwit-Co-Ltd/micropython | ports/swm320/boards/make-pins.py | 4,087 | Python |
from threading import Thread
import time
def timer(name, delay, repeat):
print "Timer: " + name + " Started"
while repeat > 0:
time.sleep(delay)
print name + ": " + str(time.ctime(time.time()))
repeat -= 1
print "Timer: " + name + " Completed"
def Main():
t1 = Thread(target=ti... | 20.708333 | 56 | 0.571429 | [
"MIT"
] | joshdabosh/autopack | test_files/multi-threading_test.py | 497 | Python |
# pylint: disable=no-member, redefined-outer-name
"""
Annalist resource types module
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2015, G. Klyne"
__license__ = "MIT (http://o... | 30.138889 | 92 | 0.617742 | [
"MIT"
] | gklyne/annalist | src/annalist_root/annalist/resourcetypes.py | 4,340 | Python |
import logging
import os
from collections import defaultdict
from typing import Dict
from typing import List
from typing import Union
import requests
from cachecontrol import CacheControl
from cachecontrol.caches.file_cache import FileCache
from cachecontrol.controller import logger as cache_control_logger
from cach... | 35.909692 | 88 | 0.57333 | [
"MIT"
] | KevinArellano94/Python-Supabase | venv/Lib/site-packages/poetry/repositories/pypi_repository.py | 16,303 | Python |
#Hkr
import msvcrt
import os
import sys
import random
from ctypes import windll, byref, wintypes
from ctypes.wintypes import SMALL_RECT
STDOUT = -11
WIN_X = 100
WIN_Y = 60
hdl = windll.kernel32.GetStdHandle(STDOUT)
rect = wintypes.SMALL_RECT(0, 0, WIN_X, WIN_Y) # (left, top, right, bottom)
windll.kernel32.SetConsoleW... | 25.293333 | 139 | 0.542963 | [
"MIT"
] | NewLife1324/PyStorage | New Tests.py | 1,897 | Python |
from django.utils.cache import get_conditional_response
from django.utils.http import http_date, parse_http_date_safe, unquote_etag
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has an ETag or
Last-Modified header, and the request has If-None-Match or
... | 35.65625 | 80 | 0.669588 | [
"MIT"
] | CharleyFarley/ovvio | venv/lib/python2.7/site-packages/django/middleware/http.py | 1,141 | Python |
import os.path
class Settings:
def __init__(self):
self.entry_point = os.path.expanduser('facts.graft')
self.userfacts = os.path.expanduser('~/.facts/user.yml')
self.userpath = os.path.expanduser('~/.facts/grafts')
settings = Settings()
| 22.416667 | 64 | 0.657993 | [
"BSD-3-Clause"
] | johnnoone/facts | facts/conf.py | 269 | Python |
from setuptools import setup,find_packages
import os
import shutil
#remove the dist folder first if exists
if os.path.exists("dist"):
shutil.rmtree("dist")
def readme():
with open('README.rst') as f:
return(f.read())
VERSION = '1.0.53'
def write_version_py(filename='SigProfilerTopography/version.py'):
# Copied... | 26 | 136 | 0.681538 | [
"BSD-2-Clause"
] | AlexandrovLab/SigProfilerTopography | setup.py | 1,300 | Python |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 33.717391 | 77 | 0.770471 | [
"Apache-2.0"
] | ankitdobhal/aliyun-openapi-python-sdk | aliyun-python-sdk-mts/aliyunsdkmts/request/v20140618/SubmitFpCompareJobRequest.py | 3,102 | Python |
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class ShowWhitelistResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dic... | 26.385321 | 74 | 0.555285 | [
"Apache-2.0"
] | Adek06/huaweicloud-sdk-python-v3 | huaweicloud-sdk-elb/huaweicloudsdkelb/v2/model/show_whitelist_response.py | 2,876 | Python |
"""optik.option_parser
Provides the OptionParser and Values classes.
"""
__revision__ = "/home/scons/scons/branch.0/baseline/src/engine/SCons/Optik/option_parser.py 0.96.90.D001 2005/02/15 20:11:37 knight"
# Original Optik revision this is based on:
__Optik_revision__ = "option_parser.py,v 1.38.2.1 2002/07/23 01:51:... | 36.585499 | 132 | 0.561584 | [
"MIT"
] | luaman/twilight | scons-local-0.96.90/SCons/Optik/option_parser.py | 26,744 | Python |
from django.urls import path
# urlpatterns = [
# path("/register", )
# ] | 15.4 | 28 | 0.61039 | [
"MIT"
] | MohanSai1997/django-forum-engine | django_forum_engine/account/urls.py | 77 | Python |
from . import exact_diagonalisation, models, tensornetworks
| 30 | 59 | 0.85 | [
"MIT"
] | Jakob-Unfried/msc-legacy | grad_tn/__init__.py | 60 | Python |
from django.contrib import admin
from .models import UserProfile,ProfileFeedItem
# Register your models here.
admin.site.register(UserProfile)
admin.site.register(ProfileFeedItem)
| 22.75 | 47 | 0.835165 | [
"MIT"
] | abirhasansuvro/Profiles-Rest-Api | profiles_api/admin.py | 182 | Python |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... | 43.507042 | 121 | 0.622855 | [
"Apache-2.0"
] | VishalSharma0309/gap_sdk | tools/nntool/generation/at_generators/cnn_global_pool.py | 3,089 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
#
# My site is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
"""Invenio digital library framework."""
import os
from setuptools import find_packages, setup
readme = open('README.rs... | 30.022472 | 74 | 0.587201 | [
"MIT"
] | AoNoOokami/training | 08-data-models-from-scratch/solution/my-site/setup.py | 2,672 | Python |
# This file is part of
# the galxy-chop project (https://github.com/vcristiani/galaxy-chop)
# Copyright (c) 2020, Valeria Cristiani
# License: MIT
# Full Text: https://github.com/vcristiani/galaxy-chop/blob/master/LICENSE.txt
"""Fixtures input data."""
# ===============================================================... | 24.856842 | 79 | 0.502499 | [
"MIT"
] | vcristiani/galaxy-chop | tests/conftest.py | 11,807 | Python |
import numpy as np
import pytest
import pandas._testing as tm
from pandas.core.construction import sanitize_array
@pytest.mark.parametrize(
"values, dtype, expected",
[
([1, 2, 3], None, np.array([1, 2, 3], dtype=np.int64)),
(np.array([1, 2, 3]), None, np.array([1, 2, 3])),
... | 36.483871 | 73 | 0.626879 | [
"MIT"
] | alvinajacquelyn/COMP0016_2 | venv/Lib/site-packages/pandas/tests/dtypes/cast/test_construct_ndarray.py | 1,131 | Python |
import asyncio
from typing import (
Dict,
Iterable,
Optional,
Sequence,
Tuple,
cast,
)
from cancel_token import (
CancelToken,
)
from eth_utils import ValidationError, to_tuple
from eth.exceptions import (
BlockNotFound,
)
from eth2.beacon.helpers import (
compute_start_slot_of_e... | 37.102496 | 100 | 0.613226 | [
"MIT"
] | pipermerriam/trinity | trinity/protocol/bcc_libp2p/node.py | 41,629 | Python |
import re
whitespace_re = re.compile('\s+')
def pare(text, size, etc='...'):
'''Pare text to have maximum size and add etc to the end if it's
changed'''
size = int(size)
text = text.strip()
if len(text)>size:
# strip the last word or not
to_be_stripped = not whitespace_re.findall(... | 24.357143 | 71 | 0.541056 | [
"MIT"
] | SlivTime/iktomi | iktomi/utils/text.py | 682 | Python |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'nomadgram.users'
verbose_name = "Users"
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
from .signals import user_signed_up
| 20.466667 | 43 | 0.62215 | [
"MIT"
] | JeewhanR/Nomadgram | nomadgram/users/apps.py | 307 | Python |
class BotError(Exception):
"""Base bot error."""
class BotAppError(Exception):
"""Bot App Error."""
class BotApiError(Exception):
"""Bot API Error."""
| 15.181818 | 29 | 0.634731 | [
"MIT"
] | priver/gopubbot | gopubbot/bot/exceptions.py | 167 | Python |
"""
Auto-generated class for JobResult
"""
from .EnumJobResultName import EnumJobResultName
from .EnumJobResultState import EnumJobResultState
from . import client_support
class JobResult(object):
"""
auto-generated. don't touch.
"""
@staticmethod
def create(data, id, level, name, startTime, sta... | 35.609589 | 107 | 0.601462 | [
"Apache-2.0"
] | 5l1v3r1/0-orchestrator | pyclient/zeroos/orchestrator/client/JobResult.py | 5,199 | Python |
from io import BufferedIOBase
import os
import sys
if sys.platform == 'win32':
import _winapi
import msvcrt
class WindowsPipe:
def __init__(self, experiment_id: str):
self.path: str = r'\\.\pipe\nni-' + experiment_id
self.file = None
self._handle = _winapi.Crea... | 27.796875 | 107 | 0.554244 | [
"MIT"
] | 5l1v3r1/nni | nni/experiment/pipe.py | 1,779 | Python |
import os
import scipy.misc
import torch
import numpy as np
import torch.optim as optim
import config
import data_loader
import d_net
import loss_funs
import g_net
dtype = config.dtype
def save_samples(generated_images, iteration, prefix):
generated_images = generated_images.data.cpu().numpy()
num_images,... | 31.620438 | 91 | 0.635042 | [
"MIT"
] | mswang12/VideoGAN | process.py | 4,332 | Python |
# coding: ascii
"""Python 2.x/3.x compatibility tools"""
import sys
__all__ = ['geterror', 'long_', 'xrange_', 'ord_', 'unichr_',
'unicode_', 'raw_input_', 'as_bytes', 'as_unicode',
'bytes_', 'imap_', 'PY_MAJOR_VERSION']
PY_MAJOR_VERSION = sys.version_info[0]
def geterror():
... | 31.203883 | 95 | 0.593964 | [
"MIT"
] | JE-Chen/je_old_repo | Python_MiniGame_Fighter/venv/Lib/site-packages/pygame/compat.py | 3,214 | Python |
from .fhirbase import fhirbase
class CapabilityStatement(fhirbase):
"""
A Capability Statement documents a set of capabilities (behaviors) of
a FHIR Server that may be used as a statement of actual server
functionality or a statement of required or desired server
implementation.
Attributes:
... | 36.502551 | 99 | 0.626156 | [
"MIT"
] | Hector-hedb12/Cardea | cardea/fhir/CapabilityStatement.py | 42,927 | Python |
import os
import sys
import argparse
import datetime
import time
import csv
import os.path as osp
import numpy as np
import warnings
import importlib
import pandas as pd
warnings.filterwarnings('ignore')
import torch
import torch.nn as nn
from torch.optim import lr_scheduler
import torch.backends.cudnn as cudnn
import... | 38.463687 | 135 | 0.659985 | [
"MIT"
] | iCGY96/APR | main.py | 6,885 | Python |
ODD = {1, 3, 5, 7, 9}
def insert_dash(num):
num = str(num)
dex = {i for i, a in enumerate(num) if int(a) in ODD}
return ''.join(b + '-' if {i, i + 1}.issubset(dex) else b
for i, b in enumerate(num))
| 25.777778 | 61 | 0.512931 | [
"MIT"
] | akalynych/CodeWars | katas/kyu_7/insert_dashes.py | 232 | Python |
#!/usr/bin/python
import subprocess;
import sys;
UTM_ZONE="18G";
DENSIFY_FACTOR=1000;
name=sys.argv[1];
prev_x="";
prev_y="";
infile=open(name,"r");
while 1:
line=infile.readline().strip();
if not line:
break;
elements=line.split();
x=elements[0].strip();
y=elements[1].strip();
distance=0.0;
if prev_x:
... | 21.822222 | 92 | 0.670061 | [
"MIT"
] | whyjz/CARST | extra/unused/densify_utm_input.py | 982 | Python |
import requests
from bs4 import BeautifulSoup
import jinja2
import re
class Chara:
name = ''
job = ''
hp = 0
mp = 0
str = 0
end = 0
dex = 0
agi = 0
mag = 0
killer = ""
counter_hp = ""
skills = ""
passive_skills = ""
class HtmlParser:
def __init__(self, text):
... | 28.237148 | 118 | 0.558231 | [
"Apache-2.0"
] | gkmike/DamMemoSim | gen_chara.py | 18,267 | Python |
"""Base classes for Axis entities."""
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo, Entity
from .const import DOMAIN as AXIS_DOMAIN
class AxisEntityBase(Entity):
"""Base common to all Axis entiti... | 29.952381 | 77 | 0.665607 | [
"Apache-2.0"
] | 2004happy/core | homeassistant/components/axis/axis_base.py | 1,887 | Python |
'''
This module has all relevant functions to make predictions using a previously
trained model.
'''
import os
import numpy as np
import tensorflow.keras as keras
from tensorflow.keras.preprocessing import image
from tensorflow.keras.models import load_model
import cv2
model = load_model('../models/app_ban_ora_selftra... | 34.6 | 77 | 0.669798 | [
"MIT"
] | DariusTorabian/image-classifier | src/predict.py | 1,384 | Python |
import asyncio
import math
import time
import traceback
from pathlib import Path
from random import Random
from secrets import randbits
from typing import Dict, Optional, List, Set
import aiosqlite
import chia.server.ws_connection as ws
import dns.asyncresolver
from chia.protocols import full_node_protocol, introduce... | 44.271831 | 119 | 0.581459 | [
"Apache-2.0"
] | 13thProgression/gold-blockchain | chia/server/node_discovery.py | 31,433 | Python |
from collections.abc import Mapping
import inspect
import types
from typing import Callable
import numpy as np
import sympy
from sympy.codegen import cfunctions as sympy_cfunctions
from numpy.random import randn, rand
from sympy import Function as sympy_Function
from sympy import S
import brian2.units.unitsafefunctio... | 47.140975 | 109 | 0.572499 | [
"BSD-2-Clause"
] | Ziaeemehr/brian2 | brian2/core/functions.py | 35,780 | Python |
# -*- coding: utf-8 -*-
"""SQLAlchemy models for Bio2BEL HGNC."""
from __future__ import annotations
from sqlalchemy import Column, ForeignKey, Integer, String, Table
from sqlalchemy.ext.declarative import DeclarativeMeta, declarative_base
from sqlalchemy.orm import relationship
from bio2bel.compath import CompathP... | 30.283333 | 100 | 0.720143 | [
"MIT"
] | bio2bel/hgnc | src/bio2bel_hgnc/models.py | 3,634 | Python |
"""
With these settings, tests run faster.
"""
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env(
"DJANGO_SECRET_KEY",
default="Zr7lk4kl3... | 32.288462 | 80 | 0.495533 | [
"MIT"
] | Eversmann85/project | config/settings/test.py | 1,679 | Python |
#!/usr/bin/env python
import sys, os
import itertools, operator
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
def reader(myfile):
t = np.array([])
print(myfile)
with open(myfile) as f:
lines = f.readlines()
for line in lines:
parts = line.split(" ")
if(len... | 22.025862 | 100 | 0.688845 | [
"MIT"
] | filmnoirprod/parallel_processing | ex3/z1/graph.py | 2,555 | Python |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 36.306338 | 135 | 0.626612 | [
"Apache-2.0"
] | dlminvestments/ai-platform-samples | notebooks/samples/tensorflow/sentiment_analysis/dataflow/PubSubToBigQueryWithAPI.py | 10,311 | Python |
#https://docs.pymc.io/notebooks/GLM-hierarchical-binominal-model.html
import matplotlib.pyplot as plt
import scipy.stats as stats
import numpy as np
import pandas as pd
#import seaborn as sns
import pymc3 as pm
import arviz as az
import theano.tensor as tt
np.random.seed(123)
# rat data (BDA3, p. 102)
y = np.arr... | 26.103448 | 84 | 0.620872 | [
"MIT"
] | NamDinhRobotics/pyprobml | scripts/hbayes_binom_rats_pymc3.py | 3,785 | Python |
import os
from os.path import join
from ...utils import remove
from .. import run_nbgrader
from .base import BaseTestApp
class TestNbGraderExport(BaseTestApp):
def test_help(self):
"""Does the help display without error?"""
run_nbgrader(["export", "--help-all"])
def test_export(self, db, co... | 43.531915 | 125 | 0.600684 | [
"BSD-3-Clause-Clear"
] | FrattisUC/nbgrader | nbgrader/tests/apps/test_nbgrader_export.py | 2,046 | Python |
#MenuTitle: Set Transform Origin
# -*- coding: utf-8 -*-
__doc__="""
Sets origin point for Rotate tool.
"""
import vanilla
class SetTransformOriginWindow( object ):
def __init__( self ):
# Window 'self.w':
windowWidth = 370
windowHeight = 60
windowWidthResize = 0 # user can resize width by this value
wi... | 35.769231 | 127 | 0.719713 | [
"Apache-2.0"
] | eliheuer/Glyphs-Scripts | Paths/Set Transform Origin.py | 2,790 | Python |
# Copyright 2020 The TensorFlow Probability 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 39.939394 | 81 | 0.655223 | [
"Apache-2.0"
] | jeffpollock9/probability | tensorflow_probability/python/distributions/truncated_cauchy.py | 15,816 | Python |
# http://rosalind.info/problems/mmch/
from math import factorial
def nPr(n, k):
'''Returns the number of k-permutations of n.'''
return factorial(n) / factorial(n-k)
f = open("rosalind_mmch.txt", "r")
dnas = {}
currentKey = ''
for content in f:
# Beginning of a new sample
if '>' in content:
... | 25.4 | 70 | 0.635171 | [
"MIT"
] | AntoineAugusti/katas | rosalind/mmch.py | 762 | Python |
# Copyright (c) 2006-2016 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2010 Daniel Harding <dharding@gmail.com>
# Copyright (c) 2012-2014 Google, Inc.
# Copyright (c) 2013-2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Brett Cannon <brett@python.org>
# Copyright (c) 2014 Arun Persau... | 38.534714 | 118 | 0.576528 | [
"MIT"
] | DiegoSilvaHoffmann/Small-Ecommerce | venv/lib/python3.8/site-packages/pylint/checkers/base.py | 100,471 | Python |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
# @Time : 2020-01-16 15:53
# @Author : 行颠
# @Email : 0xe590b4@gmail.com
# @File : view
# @Software: view
# @DATA : 2020-01-16
"""
import os
import asyncio
import motor.motor_asyncio
import aiohttp
from aiohttp import web
import aiohttp_jinja2
import json
... | 27 | 88 | 0.567721 | [
"Apache-2.0"
] | ansible-ui/ansible-ui | apps/package/view.py | 3,727 | Python |
class ATM():
def __init__(self,balance,bankname):
self.balance = balance
self.bankname=bankname
def draw_money(self,request):
print "="*30 +"\nWelcome To " + self.bankname + "\n" + "="*30
if request > self.balance :
print "Low Account Credit"
else:
... | 30.324324 | 69 | 0.459002 | [
"MIT"
] | MoustafaAscoura/wireframing_example | atmsolution/atm - with classes.py | 1,122 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Models for storing inactive and deprecated tables from the CAL-ACCESS database.
"""
from __future__ import unicode_literals
# Models
from django.db import models
from calaccess_raw import fields
from .base import CalAccessBaseModel
from django.utils.encoding import pyt... | 31.938324 | 109 | 0.642508 | [
"MIT"
] | rkiddy/django-calaccess-raw-data | calaccess_raw/models/inactive.py | 75,087 | Python |
from rdflib import Graph
import requests
import ipaddress
import json
import socket
from urllib.parse import urlparse
from .base import BaseLDN
class Sender(BaseLDN):
def __init__(self, **kwargs):
super(self.__class__, self).__init__(**kwargs)
self.allow_localhost = kwargs.get('allow_localhost'... | 37.351852 | 77 | 0.618741 | [
"Apache-2.0"
] | trellis-ldp/py-ldn | ldnlib/sender.py | 2,017 | Python |
from datetime import datetime
from decimal import Decimal
from logging import Logger
from typing import Callable
import pytest
from faker import Faker
from passport.domain import User
from wallet.core.entities import Account, Category, Operation, OperationPayload, OperationType
from wallet.core.services.operations im... | 28.333333 | 96 | 0.718118 | [
"MIT"
] | clayman-micro/wallet | tests/core/services/operations/test_add.py | 2,125 | Python |
from backtest.indicators.StochRSI import StochRSI
import backtrader as bt
from backtest.indicators.ConnorsRSI import ConnorsRSI
class CRSI(bt.Strategy):
params = (("ratio", 0.2),)
def __init__(self) -> None:
super().__init__()
self.rsi = ConnorsRSI(self.data)
def next(self):
posi... | 25.928571 | 75 | 0.618916 | [
"MIT"
] | leejh3224/bitrush | backtest/strategies/RSI.py | 1,089 | Python |
"""
A helper class for using TLS Lite with stdlib clients
(httplib, xmlrpclib, imaplib, poplib).
"""
from tlslite.Checker import Checker
class ClientHelper:
"""This is a helper class used to integrate TLS Lite with various
TLS clients (e.g. poplib, smtplib, httplib, etc.)"""
def __init__(self,
... | 42.030675 | 76 | 0.619618 | [
"BSD-3-Clause"
] | 1065672644894730302/Chromium | third_party/tlslite/tlslite/integration/ClientHelper.py | 6,851 | Python |
""":mod:`kinsumer.version` --- Version information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
VERSION_INFO = (0, 5, 3)
VERSION = '{}.{}.{}'.format(*VERSION_INFO)
if __name__ == '__main__':
print(VERSION)
| 22.2 | 50 | 0.477477 | [
"MIT"
] | balancehero/kinsumer | kinsumer/version.py | 222 | Python |
"""
SYNOPSIS
--------
Get the details of unused resources present across regions in the AWS account
DESCRIPTION
-----------
This script provides a detailed overview of the number of unused resources present in the AWS account.
It provides service-wise details of unused resources lying around in all t... | 42.795276 | 214 | 0.620883 | [
"MIT"
] | ankitsrao/aws-unused-resources | unused_aws_resources.py | 21,740 | Python |
import os
from ....modules.utils.config_utils import get_yaml_config
str2yaml = {
"gat": "gat.yaml",
"gcn": "gcn.yaml",
"ggnn": "ggnn.yaml",
"graphsage": "graphsage.yaml",
}
dir_path = os.path.dirname(os.path.realpath(__file__))
def get_graph_embedding_args(graph_embedding_name):
"""
It... | 29.847826 | 95 | 0.630736 | [
"Apache-2.0"
] | RyanWangZf/graph4nlp | graph4nlp/pytorch/modules/config/graph_embedding/__init__.py | 1,373 | Python |
import numpy as np
from skimage import io as ios
import PySimpleGUI as sg
import warnings
import m_specfun as m_fun
def select_lines(infile, contrast, lines, res_dict, fits_dict, wloc, outfil):
"""
displays new window with image infile + start + 'fit
a rectangle around the selected line can be... | 45.09375 | 109 | 0.507046 | [
"MIT"
] | meteorspectroscopy/meteor-spectrum-calibration | myselect.py | 8,658 | Python |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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
#
# U... | 29.272727 | 80 | 0.610248 | [
"Apache-2.0"
] | NickyBar/QIP | qiskit/extensions/standard/x.py | 1,932 | Python |
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 33.986667 | 245 | 0.696352 | [
"Apache-2.0"
] | revnav/sandbox | darling_ansible/python_venv/lib/python3.7/site-packages/oci/vault/models/schedule_secret_deletion_details.py | 2,549 | Python |
# Generated by Django 2.0.4 on 2018-04-20 09:46
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('daily_tracker', '0001_in... | 28.03125 | 121 | 0.620959 | [
"MIT"
] | tanvir002700/tracker | office_tracker/daily_tracker/migrations/0002_auto_20180420_0946.py | 897 | Python |
import argparse
import pandas as pd
import re
ass15 = 'assist15', 'ASSISTments 2015'
ass17 = 'assist17', 'ASSISTments 2017'
prog19 = 'prog19', 'Programming 2019'
synth_k2 = 'synth-k2', 'Synthetic-K2'
synth_k5 = 'synth-k5', 'Synthetic-K5'
ass09up = 'assist09up', 'ASSISTments 2009 Updated'
stat = 'stat', 'Statics'
intro... | 42.745455 | 113 | 0.67248 | [
"Unlicense"
] | dlkt-review-and-empirical-evaluation/dlkt-review-and-empirical-evaluation | scripts/extract_best_kfold_results.py | 2,351 | Python |
"""
Copyright (c) 2017, Syslog777
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and... | 40.453333 | 82 | 0.636454 | [
"BSD-3-Clause"
] | Syslog777/psak | psak_src/psak_src/exploit_modules/ping.py | 3,034 | Python |
from aiogram.dispatcher.filters.state import StatesGroup, State
class Support(StatesGroup):
add_text = State()
reply_msg = State()
class AdminPanel(StatesGroup):
text = State()
class SendMsg(StatesGroup):
id = State()
msg = State()
class ChangeText(StatesGroup):
text = State()
| 15.5 | 63 | 0.687097 | [
"MIT"
] | Boryslavq/casino_bot | pkg/states/states.py | 310 | Python |
import os
import pyconll
from ufal.udpipe import Model, Pipeline, ProcessingError
class UDPipeToken:
def __init__(self, ud_token, upos=None, tags=None):
self.id = ud_token.id
self.form = ud_token.form
self.upos = ud_token.upos if upos is None else upos
self.lemma = ud_token.lemma
... | 32.95 | 113 | 0.573596 | [
"Unlicense"
] | Koziev/verslibre | py/generative_poetry/udpipe_parser.py | 2,024 | Python |
"""
Laplacian of a compressed-sparse graph
"""
# Authors: Aric Hagberg <hagberg@lanl.gov>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Jake Vanderplas <vanderplas@astro.washington.edu>
# License: BSD
from __future__ import division, print_function, absolute_import
import numpy as np
from scip... | 32.514493 | 86 | 0.574326 | [
"Apache-2.0"
] | animesh/parliament2 | docker_version/resources/usr/local/lib/python2.7/dist-packages/scipy/sparse/csgraph/_laplacian.py | 4,487 | Python |
"""
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | 30.905473 | 78 | 0.605441 | [
"Apache-2.0"
] | kurhula/cloudcafe | cloudcafe/events/models/compute/common.py | 6,212 | Python |
# -*- coding: utf-8 -*-
"""Test i18n module."""
#
# (C) Pywikibot team, 2007-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id: 791a455ab0a66f7bafcfb71718f915c9dd7b7ab2 $'
import sys
import pywikibot
from pywikibot import i18n, bot, plural
from t... | 40.422062 | 105 | 0.573386 | [
"MIT"
] | xZise/pywikibot-core | tests/i18n_tests.py | 16,847 | Python |
import socket
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
process = cms.Process("LHCInfoPopulator")
from CondCore.CondDB.CondDB_cfi import *
#process.load("CondCore.DBCommon.CondDBCommon_cfi")
#process.CondDBCommon.connect = 'sqlite_file:lhcinfo_pop_test.db'
#process.Con... | 55.247191 | 127 | 0.529388 | [
"Apache-2.0"
] | PKUfudawei/cmssw | CondTools/RunInfo/python/LHCInfoPopConAnalyzerStartFill.py | 4,917 | Python |
import string
import numpy as np
import torch as th
from ttools.training import ModelInterface
from . import utils
class VectorizerInterface(ModelInterface):
def __init__(self, model, lr, n_primitives, canvas_size, w_surface, w_alignment, csg, rounded, cuda=True):
self.model = model
self.cuda =... | 37.07377 | 112 | 0.644263 | [
"MIT"
] | dmsm/DeepParametricShapes | dps_3d/interfaces.py | 4,523 | Python |
"""
CSVLogger writes power values to a csv file.
"""
__author__ = 'Md Shifuddin Al Masud'
__email__ = 'shifuddin.masud@gmail.com'
__license__ = 'MIT License'
from pv_simulator.FileWriter import FileWriter
import csv
from datetime import datetime
import aiofiles
from aiocsv import AsyncWriter
import logging
class CSV... | 34.170732 | 114 | 0.65596 | [
"MIT"
] | Shifuddin/PV-Simulator-Challenge | pv_simulator/CSVFileWriter.py | 1,401 | Python |
'''
This function takes in index_list, data_path , save_path as the arguments. It writes a video consisting
of the frame in data_path into save_path and writes a text file with the indexed of the representative
frame into the same directory
inputs :
- frames = list of frames i.e. numpy arrays
- sca... | 30.289474 | 105 | 0.532146 | [
"Apache-2.0"
] | alilakda/Eva | storage/compression/write_original_video.py | 2,302 | Python |
"""Tests for _data_finder.py."""
import os
import shutil
import tempfile
import pytest
import yaml
import esmvalcore._config
from esmvalcore._data_finder import (get_input_filelist, get_input_fx_filelist,
get_output_file)
from esmvalcore.cmor.table import read_cmor_tables
# Initi... | 30.04386 | 79 | 0.670949 | [
"Apache-2.0"
] | Peter9192/ESMValCore | tests/integration/test_data_finder.py | 3,425 | Python |
# Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | 42.317992 | 77 | 0.635159 | [
"BSD-3-Clause"
] | kapteyn-astro/kapteyn | kapteyn/interpolation.py | 20,228 | Python |
# coding: utf-8
"""
Katib
Swagger description for Katib # noqa: E501
OpenAPI spec version: v1alpha3-0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from kubeflow.katib.models.v1alpha3_algorithm_spec import V1alpha3Alg... | 34.544 | 251 | 0.661958 | [
"Apache-2.0"
] | ChenjunZou/katib | sdk/python/v1alpha3/kubeflow/katib/models/v1alpha3_experiment_spec.py | 12,954 | Python |
## utility functions
## including: labelling, annotation, continuous borders
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
## create labels
def generate_class_label(data):
"""
generates class label on a copy of data using the columns
State, From_X, From_Y, To_X, To_Y
... | 31.747664 | 123 | 0.568737 | [
"MIT"
] | hhain/sdap17 | notebooks/pawel_ueb2/utility.py | 6,794 | Python |
# Script:
#
# remove all articles from the DB which have no
# references to them and are older than a number of days
#
# works with the db that is defined in the configuration
# pointed by ZEEGUU_CORE_CONFIG
#
# takes as argument the number of days before which the
# articles will be deleted.
#
# call like this to remo... | 22.88 | 98 | 0.666667 | [
"MIT"
] | simonchristensen1/Zeeguu-Core | tools/remove_unreferenced_articles.py | 1,716 | Python |
# coding: utf8
from __future__ import unicode_literals
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .tag_map import TAG_MAP
from .morph_rules import MORPH_RULES
from ..tokenizer_exceptions import BASE_EXCEPTIONS
from ..norm_exceptions ... | 25.560976 | 76 | 0.780534 | [
"MIT"
] | AbhishekSinhaCoder/spaCy | spacy/lang/lt/__init__.py | 1,048 | Python |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | 37.884615 | 80 | 0.617259 | [
"Apache-2.0"
] | marcofavorito/agents-aea | packages/fetchai/skills/confirmation_aw3/__init__.py | 985 | Python |
import pytest
from django.test import TestCase
from .factories import CoopTypeFactory, CoopFactory, AddressFactory, PhoneContactMethodFactory
from directory.models import Coop, CoopType
class ModelTests(TestCase):
@classmethod
def setUpTestData(cls):
print("setUpTestData: Run once to set up non-modif... | 38.850575 | 112 | 0.664201 | [
"MIT"
] | DaveyDevs/maps | web/tests/test_models.py | 3,380 | Python |
import json
from io import BytesIO
from six import text_type
import attr
from zope.interface import implementer
from twisted.internet import address, threads, udp
from twisted.internet._resolver import HostResolution
from twisted.internet.address import IPv4Address
from twisted.internet.defer import Deferred
from tw... | 26.29803 | 84 | 0.615341 | [
"Apache-2.0"
] | AlohaHealth/synapse | tests/server.py | 10,677 | Python |
import sys
import pwnlib
from pwnlib.context import context
pwnlib.log.console.stream = sys.stderr
choices = list(map(str, [16, 32, 64]))
choices += list(context.oses)
choices += list(context.architectures)
choices += list(context.endiannesses)
def context_arg(arg):
try:
context.arch = arg
except Ex... | 16.542857 | 38 | 0.623489 | [
"MIT"
] | IMULMUL/python3-pwntools | pwnlib/commandline/common.py | 579 | Python |
import torch.nn as nn
import torch.nn.functional as F
class RNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(RNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, args.rnn_hidden_dim)
self.rnn = nn.GRUCell(args.rnn_hidden_dim, args.rnn_hidd... | 35.125 | 84 | 0.637011 | [
"Apache-2.0"
] | halleanwoo/AGMA | src_convention/modules/agents/rnn_agent.py | 1,138 | Python |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class TutorialSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy... | 34.605769 | 78 | 0.666296 | [
"MIT"
] | 15217718797/Movie_Recommend | tutorial/tutorial/middlewares.py | 3,601 | Python |
from keras.engine.topology import Layer
from keras.backend.tensorflow_backend import tf
class Multiplexer(Layer):
def __init__(self, output_dim, nb_ctrl_sig, **kwargs):
"""
This layer is used to split the output of a previous Dense layer into
nb_ctrl_sig groups of size output_dim, and choo... | 36.215909 | 80 | 0.558833 | [
"MIT"
] | 2vin/multiplexed_cnn | multiplexer.py | 6,374 | Python |
from Methods import MetaTraderDataConverter, Ichimoku, Ichimoku_plot
import datetime
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from mpl_finance import candlestick_ohlc
import pandas as pd
import numpy as np
datafile="USDJPY_H1_2014_2018.csv"
df = MetaTraderDataConve... | 19.2 | 68 | 0.789583 | [
"MIT"
] | JoshChima/Ichimoku | The_Chart.py | 480 | Python |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
urlpatterns = [
url(r'^django-admin/', admin.site.urls),
url(r'^admin/... | 30.5 | 80 | 0.760929 | [
"BSD-3-Clause"
] | divio/aldryn-wagtail | aldryn_wagtail/urls.py | 732 | Python |
#! /usr/bin/python
import sys,shutil, urllib2, json, time, subprocess, os, commands, signal, re
sys.path.insert(0, 'srch2lib')
import test_lib
port = '8087'
# This test case reads data from the json files
# Then it reads all the access control data from json files too
# Then it does some search and it uses roleId i... | 36.5125 | 112 | 0.593632 | [
"BSD-3-Clause"
] | SRCH2/srch2-ngn | test/wrapper/system_tests/access_control/record-based-ACL.py | 5,842 | Python |
from .estimate import estimate
from .estimatediff import estimatediff
from .estimatewithcv import estimatewithcv
from .asymptoticconfidenceinterval import asymptoticconfidenceinterval
from .asymptoticconfidenceintervalwithcv import asymptoticconfidenceintervalwithcv
from .onlineasymci import Online
from .gradcheck impo... | 40.666667 | 82 | 0.883197 | [
"Unlicense"
] | pmineiro/elfcb | MLE/MLE/__init__.py | 488 | Python |
# SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileType: SOURCE
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the license found in the LICENSE.txt file in the root directory
# of this source ... | 24.478261 | 79 | 0.650089 | [
"MIT"
] | ameli/Orthogonal-Functions | ortho/_orthogonal_functions/declarations.py | 563 | Python |
from abc import ABC, abstractmethod
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
class mab_user(ABC):
def __init__(self, n_arms, lamb=1):
super(mab_user, self).__init__()
self.t = torch.tensor(1.0)
self.r = torch.zeros(n_arms)
self.n = torch.zero... | 27.266667 | 80 | 0.584352 | [
"Apache-2.0"
] | tginart/competing-ai | user.py | 3,272 | Python |
from flask import request, jsonify
from flask_restful import Resource, reqparse, abort
from flask_jwt import current_app
from app.auth.models import User
def generate_token(user):
""" Currently this is workaround
since the latest version that already has this function
is not published on PyPI yet and we do... | 37.652174 | 122 | 0.681871 | [
"MIT"
] | Abhishek1373/Building-Serverless-Python-Web-Services-with-Zappa | Chapter04/app/auth/resources.py | 1,732 | Python |
import unittest
import cryptomon.common as common
class Testcryptomon(unittest.TestCase):
def setUp(self):
self.response = [
{
"id": "bitcoin",
"name": "Bitcoin",
"symbol": "BTC",
"rank": "1",
"price_usd": "15653.... | 41.902439 | 93 | 0.559953 | [
"MIT"
] | S0L1DUS/cryptocoinmon | tests/test_cryptomon.py | 3,436 | Python |
class Options:
def __init__(self, output_formats):
self.output_formats = output_formats
def get_output_formats(self):
return self.output_formats
def __add__(self, other):
return Options(output_formats=self.output_formats + other.output_formats)
| 28.3 | 81 | 0.724382 | [
"MIT"
] | das-g/osmaxx-conversion-service | conversion_service/converters/converter.py | 283 | Python |
import logging
import random
import re
from urllib.parse import urljoin
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
IMAGE_FILE_REGEX = re.compile(r'([-\w]+\.(?:jpg|jpeg|gif|png))',
re.IGNORECASE)
def crawl_page(p... | 27.162162 | 78 | 0.612438 | [
"Apache-2.0"
] | b12io/orchestra | simple_workflow/v1/crawl.py | 2,010 | Python |
import math
import random
from typing import Dict, Iterable, Sequence, Tuple
from eth.constants import ZERO_HASH32
from eth_typing import BLSPubkey, BLSSignature, Hash32
from eth_utils import to_tuple
from eth_utils.toolz import keymap as keymapper
from eth_utils.toolz import pipe
from eth2._utils.bitfield import get... | 30.64598 | 95 | 0.704022 | [
"MIT"
] | AndrewBezold/trinity | eth2/beacon/tools/builder/validator.py | 21,728 | Python |
import base64
import deployment_options
import os
import tempfile
import utils
def render_file(namespace, private_key, public_key):
src_file = os.path.join(os.getcwd(), 'deploy/assisted-installer-local-auth.yaml')
dst_file = os.path.join(os.getcwd(), 'build', namespace, 'assisted-installer-local-auth.yaml')
... | 34.761194 | 112 | 0.685702 | [
"Apache-2.0"
] | lack/assisted-service | tools/deploy_local_auth_secret.py | 2,329 | Python |
# -*- coding: utf-8 -*-
data = ''
with open('input.txt') as f:
data = f.read().strip()
def Reacts(a, b):
if a == b:
return False
if a.lower() == b or b.lower() == a:
return True
return False
def Collapse(polymer):
i = 1
while i < len(polymer):
... | 19.804348 | 63 | 0.514819 | [
"Apache-2.0"
] | uberales/aoc2018 | 05/aoc05.py | 911 | Python |
# Copyright 2013 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | 39.295082 | 79 | 0.609929 | [
"Apache-2.0"
] | bopopescu/nested_quota_final | nova/virt/hyperv/pathutils.py | 9,588 | Python |
"""
Module for all Form Tests.
"""
import pytest
from django.utils.translation import gettext_lazy as _
from djcutter.users.forms import UserCreationForm
from djcutter.users.models import User
pytestmark = pytest.mark.django_db
class TestUserCreationForm:
"""
Test class for all tests related to the UserCrea... | 29.125 | 87 | 0.629185 | [
"MIT"
] | macbotxxx/djcutter | djcutter/users/tests/test_forms.py | 1,165 | Python |
#!/usr/bin/env python3
import depthai as dai
import subprocess as sp
from os import name as osName
# Create pipeline
pipeline = dai.Pipeline()
# Define sources and output
camRgb = pipeline.createColorCamera()
videoEnc = pipeline.createVideoEncoder()
xout = pipeline.createXLinkOut()
xout.setStreamName("h264")
# Pro... | 26.183333 | 118 | 0.694462 | [
"MIT"
] | AsherVo/depthai-experiments | gen2-play-encoded-stream/main.py | 1,571 | Python |
# https://github.com/TrustyJAID/Trusty-cogs/blob/master/notsobot/converter.py
import re
from discord.ext.commands.converter import Converter
from discord.ext.commands.errors import BadArgument
from redbot.core.i18n import Translator
_ = Translator("ReverseImageSearch", __file__)
IMAGE_LINKS = re.compile(
r"(htt... | 37.5 | 87 | 0.569431 | [
"MIT"
] | Danstr5544/Fixator10-Cogs | reverseimagesearch/converters.py | 3,075 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.