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
# (c) 2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible 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 of the License, or # (at your option) any lat...
35.886827
147
0.603578
[ "BSD-3-Clause" ]
nrser/nansi.collections
dev/ref/display.py
19,343
Python
import os # Defaults to where the code is contained. # If your bokeh input data is placed elsewhere, go ahead and edit this path ROOT = os.path.dirname(os.path.realpath(__file__)) ROOT = os.path.abspath(os.path.join(ROOT, '..')) # Intermediate bokeh files are cached under this path CACHE_DIR = os.path.join(ROOT, 'cac...
40
81
0.7625
[ "Apache-2.0" ]
QPC-database/multimodal-affinities
multimodal_affinities/common_config.py
640
Python
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class UsersConfig(AppConfig): name = "django_vue_shopping_list.users" verbose_name = _("Users") def ready(self): try: import django_vue_shopping_list.users.signals # noqa F401 except Impo...
24.714286
70
0.687861
[ "MIT" ]
JRedeker/django-vue-shopping-list
django_vue_shopping_list/django_vue_shopping_list/users/apps.py
346
Python
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] # snippet-sourcedescription:[rekognition-image-python-create-collection.py demonstrates how to create an Amazon Rekognition collection.] # snippet-service:[rekognition] # snippet-keyword:[Amazon Rekognition] # snippet-keyword:[...
38.818182
137
0.734778
[ "Apache-2.0" ]
ExamProCo/aws-doc-sdk-examples
python/example_code/rekognition/rekognition-image-python-create-collection.py
1,708
Python
from IMLearn.utils import split_train_test from IMLearn.learners.regressors import LinearRegression from IMLearn.metrics import * from typing import NoReturn import numpy as np import pandas as pd import plotly.graph_objects as go import plotly.express as px import plotly.io as pio pio.templates.default = "simple_whi...
36.462687
79
0.605608
[ "MIT" ]
shahaf-shafirstein/IML.HUJI
exercises/house_price_prediction.py
4,886
Python
from fastapi import APIRouter, HTTPException import pandas as pd import plotly.express as px import json from dotenv import load_dotenv import os import psycopg2 from sqlalchemy import create_engine from sqlalchemy.types import Integer, Float, Text, String, DateTime from fastapi.encoders import jsonable_encoder from os...
46.893443
336
0.634854
[ "MIT" ]
Lambda-School-Labs/Labs26-Citrics-DS-TeamC
project/app/api/wage_trade_transport_viz.py
5,721
Python
my_data=[['slashdot','USA','yes',18,'None'], ['google','France','yes',23,'Premium'], ['digg','USA','yes',24,'Basic'], ['kiwitobes','France','yes',23,'Basic'], ['google','UK','no',21,'Premium'], ['(direct)','New Zealand','no',12,'None'], ['(direct)','UK','no',21,'Basic'], ...
28.426295
75
0.632376
[ "MIT" ]
YuHongJun/python-training
CollectiveIntelligence/chapter7/treepredict.py
7,135
Python
from unittest import TestCase from estrutura_dados.ordering_algorithms import bubble_sort, quick_sort numbers = [82, 9, 6, 16, 5, 70, 63, 64, 59, 72, 30, 10, 26, 77, 64, 11, 10, 7, 66, 59, 55, 76, 13, 38, 19, 68, 60, 42, 7, 51] _sorted = [5, 6, 7, 7, 9, 10, 10, 11, 13, 16, 19, 26, 30, 38, 42, 51, 55, 59, 59, 60, 63, ...
31.7
125
0.572555
[ "MIT" ]
gustavo-veiga/-estrutura-dado
python_src/tests/tests_ordering_algorithms.py
634
Python
import re import requests import time class TeleBot(object): def __init__(self, import_name): self.import_name = import_name self.update_rules = list() self.config = dict( api_key=None, requests_kwargs=dict( timeout=60, ), ) ...
34.8125
78
0.55012
[ "MIT" ]
KyleJamesWalker/telebot
telebot/__init__.py
6,684
Python
#!/usr/bin/python3 import sys import boto3 import requests import getpass import configparser import base64 import logging import xml.etree.ElementTree as ET import re import pytz from tzlocal import get_localzone from datetime import datetime from bs4 import BeautifulSoup from os.path import expanduser from urllib.pa...
37.674641
125
0.697104
[ "MIT" ]
davidsvejda/aws-ec2-saml
samlapi_formauth_adfsv3mod_python3.py
7,874
Python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Bioindustrial-Park: BioSTEAM's Premier Biorefinery Models and Results # Copyright (C) 2020-, Yalin Li <mailto.yalin.li@gmail.com> # # This module is under the UIUC open-source license. See # github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt # for licen...
38.395349
95
0.633555
[ "MIT" ]
yoelcortes/Bioindustrial-Complex
BioSTEAM 2.x.x/biorefineries/ethanol_adipic/systems.py
11,557
Python
#!/usr/bin/env python3 # Copyright 2016 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by appli...
40.63015
203
0.565045
[ "Apache-2.0" ]
annacrombie/meson
mesonbuild/rewriter.py
43,393
Python
from switch import Switch class Link(): def __init__(self, lid, init_capacity, delay): self.lid = lid self.init_capacity = init_capacity self.capacity = init_capacity self.end1 = "None" self.end2 = "None" self.delay = delay self.level = "None" self._edges = [] # attach a link between...
23.341463
74
0.625914
[ "Apache-2.0" ]
Peniac/NSE-CSC
substrate_network/link.py
957
Python
# ------------------------------------------------------------------------------------------------- # scientific import numpy as np import pandas as pd # ------------------------------------------------------------------------------------------------- # PyQuantum.TC from PyQuantum.TC_sink.WaveFunction import WaveFuncti...
46.804878
119
0.23606
[ "MIT" ]
Global19-atlassian-net/PyQuantum
PyQuantum/TC_sink/DensityMatrix.py
3,838
Python
from common import num_range_scale from neurons_engine import neurons_request, neurons_blocking_read, neurons_blocking_read INQUIRE_ID = 0x00 SHAKE_ID = 0x01 ACC_X_ID = 0x02 ACC_Y_ID = 0x03 ACC_Z_ID = 0x04 GYRO_X_ID = 0x05 GYRO_Y_ID = 0x06 GYRO_Z_ID = 0x07 PITCH_ID = 0x08 ROLL_ID = 0x09 ROTATE_Z_ID = 0x0a ROTATE_X_ID...
27.398907
106
0.641604
[ "MIT" ]
FFtust/k210_scripts
src/neurons_engine/mbuild_modules/motion_sensor.py
5,014
Python
#!/usr/bin/env python # -*- coding:utf-8 -*- # 生成词云 ''' Reference: https://amueller.github.io/word_cloud/ https://github.com/amueller/word_cloud ''' from wordcloud import WordCloud import matplotlib.pyplot as plt filename = "***.txt" # 文本 with open(filename) as f: mytext = f.read() # print(mytext) w...
16.481481
47
0.678652
[ "MIT" ]
comeCU/coding-python
funnyPython/test_wordcloud.py
465
Python
# Copyright 2017 The TensorFlow 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 # # Unless required by applica...
35.702703
80
0.700227
[ "Apache-2.0" ]
SimiaCryptus/models
research/gan/mnist/conditional_eval.py
3,963
Python
#!/usr/bin/env python3 # # Copyright (c) 2020 The Bitcoin ABC developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from base64 import b64encode import mock import os import unittest from phabricator_wrapper import BITCOIN_A...
35.483168
97
0.544617
[ "MIT" ]
ryan763/bitcoin-abc
contrib/buildbot/test/test_phabricator.py
17,919
Python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from .. import _utilities, _tables __al...
44.953947
391
0.651251
[ "Apache-2.0" ]
pulumi/pulumi-azure-nextgen
sdk/python/pulumi_azure_nextgen/sql/firewall_rule.py
6,833
Python
import os import numpy as np import pandas as pd from gym.utils import seeding import gym from gym import spaces import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import pickle from stable_baselines3.common.vec_env import DummyVecEnv, SubprocVecEnv from stable_baselines3.common import l...
43.445652
171
0.548974
[ "MIT" ]
hyqus/Deep-Reinforcement-Learning-for-Automated-Stock-Trading-Ensemble-Strategy-ICAIF-2020
env/env_stocktrading.py
15,988
Python
# -*- coding: UTF-8 -*- import os import sys import jieba import json import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity class SinglePassCluster(): def __init__(self, stopWords_path="../data/stop_words.txt", my_stopwords=None, ...
34.554348
105
0.592639
[ "Apache-2.0" ]
murray-z/text_clustering
Single_Pass/single_pass_cluster.py
3,217
Python
from functools import wraps import numpy as np import tensorflow as tf from keras import backend as K from keras.layers import Conv2D, Add, ZeroPadding2D, UpSampling2D, Concatenate, MaxPooling2D from keras.layers.advanced_activations import LeakyReLU from keras.layers.normalization import BatchNormalization from keras...
36.800813
132
0.598144
[ "MIT" ]
yanjingke/yolov4-keras
nets/yolo4.py
9,627
Python
from hy.macros import macroexpand from hy.compiler import HyTypeError from hy.lex import tokenize def test_reader_macro_error(): """Check if we get correct error with wrong disptach character""" try: macroexpand(tokenize("(dispatch_reader_macro '- '())")[0], __name__) except HyTypeError as e: ...
30.5
76
0.70765
[ "MIT" ]
ALSchwalm/hy
tests/macros/test_reader_macros.py
366
Python
# -*- coding: utf-8 -*- import os import unittest from StringIO import StringIO import antlr3 class TestStringStream(unittest.TestCase): """Test case for the StringStream class.""" def testSize(self): """StringStream.size()""" stream = antlr3.StringStream('foo') self.failUnlessEqua...
27.087023
81
0.57502
[ "MIT" ]
MichaelReiter/CSC435
libs/antlr-3.0.1/runtime/Python/unittests/teststreams.py
17,745
Python
# coding=utf-8 """ This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base import deserialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base....
29.551181
101
0.606981
[ "MIT" ]
Jason-Paprocki/hacknjit
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
11,259
Python
import xgboost as xgb import testing as tm import numpy as np import unittest rng = np.random.RandomState(1994) class TestFastHist(unittest.TestCase): def test_fast_hist(self): tm._skip_if_no_sklearn() from sklearn.datasets import load_digits try: from sklearn.model_selection ...
36.783784
81
0.525104
[ "Apache-2.0" ]
daoliker/xgboost
tests/python/test_fast_hist.py
4,083
Python
def test_List(): a: i32 b: i32 a = [1, 2, 3] a = [-3, -2, -1] a = ["a", "b", "c"] a = [[1, 2, 3], [4, 5, 6]] # a = [-2, -1, 0.45] -> semantic error b = a[2]
15.916667
42
0.319372
[ "MIT" ]
Smit-create/lpython
tests/list1.py
191
Python
import discord import json from discord.ext import commands from cogs.ObjectCache import config from cogs.ObjectCache import server_config from cogs.ObjectCache import get_lang from collections import OrderedDict with open('commands.json') as json_data: commands_json = json.load(json_data, object_pairs_hook = Ordered...
57.017857
328
0.691513
[ "MIT" ]
Deivedux/Shiramine
cogs/Help.py
3,193
Python
import json import os import uuid from datetime import datetime, timedelta, timezone from decimal import Decimal from unittest import mock from django.contrib.auth import get_user_model from django.core.files.uploadedfile import SimpleUploadedFile from django.test import override_settings from django.urls import rever...
39.960452
128
0.64011
[ "MIT" ]
michel-rodrigues/viggio_backend
app/request_shoutout/adapters/tests/test_fulfill_shoutout_request.py
14,147
Python
import math import numpy as np import pypact as pp from tests.testerbase import Tester DECIMAL_PLACE_ACC = 6 class GroupConvertUnitTest(Tester): def _test_imp(self, in_group, in_values, out_group, expected_values, almost=False): if almost: np.testing.assert_almost_equal(expected_values, pp...
38.826923
121
0.606736
[ "Apache-2.0" ]
dvp2015/pypact
tests/input/groupconverttest.py
4,038
Python
# layout.py # --------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. # # A...
38.039474
166
0.58907
[ "MIT" ]
chibinz/CS181
tracking/layout.py
5,782
Python
# Connection libraries import os import shutil import re # Class create project class Create: def __init__(self, path): self.path = path # Create project def createProject(self, name): if not os.path.isdir(self.path + name): shutil.copytree("launcher/shablon/", self.path + name) else: n, a = os.listdir...
23.913043
71
0.681818
[ "MIT" ]
KValexander/pygame-vn
create.py
550
Python
import matplotlib.pyplot as plt, streamlit as st from typing import Iterable, Union from sklearn.metrics import classification_report from sklearn.metrics import roc_curve, auc, RocCurveDisplay def train(estimator: object, X: Iterable[Union[int, float]], y: Iterable): """ Train custom classifier model...
24.202532
78
0.611402
[ "MIT" ]
Fennec2000GH/Poly-Finance
ml.py
1,912
Python
from dataclasses import dataclass from typing import List @dataclass(frozen=True) class Channel: name: str symbols: List[str] def __post_init__(self): self.symbols.sort()
17.083333
34
0.668293
[ "MPL-2.0" ]
OrzPond/tardis-python
tardis_client/channel.py
205
Python
""" CAR CONFIG This file is read by your car application's manage.py script to change the car performance. EXMAPLE ----------- import dk cfg = dk.load_config(config_path='~/mycar/config.py') print(cfg.CAMERA_RESOLUTION) """ import os #PATHS CAR_PATH = PACKAGE_PATH = os.path.dirname(os.path.realpath(__file__)) ...
46.184
225
0.757838
[ "MIT" ]
DocGarbanzo/donkeycar
donkeycar/templates/cfg_basic.py
5,773
Python
from hatesonar import Sonar def hate_speech_detection(texts): sonar = Sonar() phrases_by_line = " ".join(texts).split(" ") dynamic_black_list = [] for sent in phrases_by_line: if sonar.ping(text=sent)['top_class'] != 'neither': [dynamic_black_list.append(i) for i in sent.split()] ...
34.8
64
0.66954
[ "MIT" ]
greaseuniverse/greaseterminator
interventions/text/speech_filter.py
348
Python
# -*- coding: utf-8 -*- """ # Author : Camey # DateTime : 2022/3/12 8:49 下午 # Description : """
17.333333
33
0.5
[ "Apache-2.0" ]
abcdcamey/Gobigger-Explore
my_work/config/__init__.py
108
Python
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A module that provides algorithms for performing linear fit between sets of 2D points. :Authors: Mihai Cara, Warren Hack :License: :doc:`../LICENSE` """ import logging import numbers import numpy as np from .linalg import inv from . import __versio...
34.521739
90
0.573603
[ "BSD-3-Clause" ]
jhunkeler/tweakwcs
tweakwcs/linearfit.py
26,996
Python
''' @Date: 2019-08-22 20:40:54 @Author: ywyz @LastModifiedBy: ywyz @Github: https://github.com/ywyz @LastEditors: ywyz @LastEditTime: 2019-08-22 20:48:24 ''' years, months = eval(input("Enter years and months: ")) if (months == 1 or months == 3 or months == 5 or months == 7 or months == 8 or months == 10 or mon...
32.954545
75
0.57931
[ "Apache-2.0" ]
ywyz/IntroducingToProgrammingUsingPython
Exercise04/4-11.py
725
Python
#!/usr/bin/env python2 # Copyright (c) 2017-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
38.918367
148
0.597273
[ "Apache-2.0" ]
keeploading/Detectron
arp/arp_infer.py
22,884
Python
#!/usr/bin/python3 # Helper script for the transactions method that can read the log file # and use it to detect and recover the state to one of the transactions # at which the script had previously been restarted. import sys import os import re import json import subprocess import codecs import argparse import temp...
39.0625
265
0.6272
[ "Unlicense" ]
NavicoOS/ac2git
recover_state_from_log.py
4,375
Python
# Generated by Django 3.1.7 on 2021-07-12 13:39 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('contact', '0002_feedback_phone'), ] operations = [ migrations.RenameField( model_name='feedback', old_name='name', ...
18.947368
47
0.580556
[ "BSD-3-Clause" ]
OMAR-EHAB777/FerpMenu
OmegaErp/contact/migrations/0003_auto_20210712_1539.py
360
Python
from django.conf.urls.defaults import * urlpatterns = patterns("", url(r"^$", "idios.views.profiles", name="profile_list"), url(r"^profile/(?P<username>[\w\._-]+)/$", "idios.views.profile", name="profile_detail"), url(r"^edit/$", "idios.views.profile_edit", name="profile_edit"), )
32.888889
93
0.648649
[ "BSD-3-Clause" ]
paltman/idios
idios/urls.py
296
Python
translation = { 'i1':'chleb', 'i2':'piwo', 'i3':'paluszki', 'i4':'śledź', 'i5':'chipsy', 'i6':'masło', 'M':'Mango', 'O':'Onion', 'N':'Nintendo', 'K':'Key-chain', 'E':'Eggs', 'Y':'Yo-yo', 'D':'Doll', 'A':'Apple', 'U':'Umbrella', 'C':'Corn', 'I':'Ice-cre...
19.861702
38
0.283878
[ "MIT" ]
Vyzrala/ZTED_Algorithms
datasets.py
3,737
Python
"""Plugin ========= The fixtures provided by pytest-kivy. """ import pytest import weakref from typing import Tuple, Type, Optional, Callable import gc import logging from os import environ from pytest_kivy.app import AsyncUnitApp __all__ = ('trio_kivy_app', 'asyncio_kivy_app', 'async_kivy_app') #: NOTE: Kivy canno...
28.085859
79
0.65258
[ "MIT" ]
matham/pytest-kivy
pytest_kivy/plugin.py
5,561
Python
from pymongo import MongoClient import json from newsapi.database import mongo class UserModel: def __init__(self, _id, username, password): self.id = _id self.username = username self.password = password @classmethod def find_by_username(cls, username): result = mongo.db...
25.59375
99
0.603175
[ "MIT" ]
rubiagatra/news-api
newsapi/user/models.py
819
Python
"""Test data purging.""" from datetime import datetime, timedelta import json from unittest.mock import patch from homeassistant.components import recorder from homeassistant.components.recorder.const import DATA_INSTANCE from homeassistant.components.recorder.models import Events, RecorderRuns, States from homeassist...
32.646091
87
0.613261
[ "Apache-2.0" ]
AdmiralStipe/core
tests/components/recorder/test_purge.py
7,933
Python
"""An abstract class for entities.""" from abc import ABC import asyncio from datetime import datetime, timedelta import functools as ft import logging from timeit import default_timer as timer from typing import Any, Awaitable, Dict, Iterable, List, Optional from homeassistant.config import DATA_CUSTOMIZE from homeas...
33.541384
133
0.628155
[ "Apache-2.0" ]
Leviosa-Shades/core
homeassistant/helpers/entity.py
24,720
Python
# from https://stackoverflow.com/questions/8032642/how-to-obtain-image-size-using-standard-python-class-without-using-external-lib import struct import imghdr def get_image_size(fname): """Determine the image type of fhandle and return its size. from draco""" with open(fname, "rb") as fhandle: ...
35.904762
131
0.5
[ "MIT" ]
geraked/mdpdfbook
mdpdfbook/mdpdf/image.py
1,508
Python
# Copyright 2021 Zeppelin Bend Pty Ltd # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. __all__ = ["get_upstream_end_to_tns"] from typing import List, Tuple, Typ...
41.481481
106
0.7125
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
zepben/pp-translator
src/pp_creators/utils.py
1,120
Python
# coding: utf-8 # Modified Work: Copyright (c) 2018, 2022, 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...
36.135135
245
0.595161
[ "Apache-2.0", "BSD-3-Clause" ]
LaudateCorpus1/oci-python-sdk
src/oci/_vendor/requests/models.py
34,762
Python
#!/usr/bin/env python # -*- coding=utf8 -*- """ # Author: achao # File Name: weight_init.py # Description: """ import copy import math import warnings import numpy as np import torch import torch.nn as nn from torch import Tensor from deep3dmap.core.utils import Registry, build_from_cfg, get_logger, print_log INITIA...
37.645954
85
0.600015
[ "Apache-2.0" ]
achao2013/DeepRecon
deep3dmap/core/utils/weight_init.py
26,051
Python
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """The minc module provides classes for interfacing with the `MINC <http://www.bic.mni.mcgill.ca/ServicesSoftware/MINC>`_ command line tools. This module was written to work with MI...
30.20641
145
0.60428
[ "Apache-2.0" ]
Inria-Visages/nipype
nipype/interfaces/minc/minc.py
111,220
Python
""" A file to contain specific logic to handle version upgrades in Kolibri. """ from shutil import rmtree from django.conf import settings from kolibri.core.upgrade import version_upgrade # Before 0.15 we copied static files to the KOLIBRI_HOME directory. # After 0.15 we read them directly from their source directo...
27.6875
71
0.78781
[ "MIT" ]
AksharFoundation/kolibri
kolibri/core/device/upgrade.py
443
Python
""" Copyright 2020 The OneFlow 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 Unless required by applicable law or agr...
29.181319
92
0.602523
[ "Apache-2.0" ]
LiuHaolan/oneflow
python/oneflow/test/graph/test_graph_optim_lamb.py
5,311
Python
#- # Copyright (c) 2016 Michael Roe # All rights reserved. # # This software was developed by SRI International and the University of # Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 # ("CTSRD"), as part of the DARPA CRASH research programme. # # @BERI_LICENSE_HEADER_START@ # # Licensed to BER...
37.435897
135
0.767123
[ "Apache-2.0" ]
capt-hb/cheritest
tests/cp2/test_cp2_c0_sc.py
1,460
Python
with open("input") as file: massList = file.readlines() def calcModuleFuel(fuel, mass): addedFuel = int(mass/3)-2 if addedFuel <=0: return fuel else: return calcModuleFuel(fuel+addedFuel, addedFuel) def calcFuelSum(massList): fuelSum = 0 for m in massList: m = float(m) ...
22.666667
56
0.642157
[ "MIT" ]
JeyP91/aoc-2019
day01/python/thomg/calc_fuel.py
408
Python
from graphql import Undefined from .mountedtype import MountedType from .structures import NonNull from .utils import get_type class InputField(MountedType): """ Makes a field available on an ObjectType in the GraphQL schema. Any type can be mounted as a Input Field except Interface and Union: - Obj...
36.347222
106
0.666412
[ "MIT" ]
AizenGlobal/graphene
graphene/types/inputfield.py
2,617
Python
# -*- coding: utf-8 -*- from cms.exceptions import CMSDeprecationWarning from django.conf import settings from patch import post_patch, post_patch_check, pre_patch import warnings def patch_settings(): """Merge settings with global cms settings, so all required attributes will exist. Never override, just app...
30.384615
109
0.708861
[ "BSD-3-Clause" ]
tonatos/django-cms
cms/conf/__init__.py
1,185
Python
#!/usr/bin/env py.test # -*- coding: utf-8 -*- __author__ = "Varun Nayyar <nayyarv@gmail.com>" import numpy as np import pytest import NN.layerversions.layers4 as layer def test_fc(): l1 = layer.FullyConnected(5, 10) x = np.ones((100, 5)) y, c = l1.forward(x) assert y.shape == (100, 10) assert ...
20
47
0.586301
[ "MIT" ]
nayyarv/CodeANet
tests/test_layers4.py
1,460
Python
import unittest class IntcodeComputer(): OP_ADD = 1 OP_MULTIPLY = 2 OP_INPUT = 3 OP_OUTPUT = 4 OP_JUMP_TRUE = 5 OP_JUMP_FALSE = 6 OP_LESS_THAN = 7 OP_EQUALS = 8 OP_MOD_REL = 9 OP_HALT = 99 PARAM_MODE_POS = '0' PARAM_MODE_IMD = '1' PARAM_MODE_REL...
32.242718
102
0.510238
[ "MIT" ]
RubenFixit/AoC
AoC 2019/intcode.py
6,642
Python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities __...
42.52381
158
0.721613
[ "Apache-2.0" ]
polivbr/pulumi-azure-native
sdk/python/pulumi_azure_native/documentdb/v20191212/list_database_account_keys.py
4,465
Python
import setuptools,subprocess,platform,os with open("README.md","r",encoding="utf-8") as r: long_description=r.read() URL="https://github.com/KoichiYasuoka/spaCy-ixaKat" if platform.machine()=="x86_64" and os.name != "nt": subprocess.check_call(["spacy_ixakat/bin/download"]) else: raise OSError("spaCy-ixaKat onl...
29.152174
58
0.691275
[ "MIT" ]
sarnthil/spaCy-ixaKat
setup.py
1,341
Python
import pytest import numpy as np from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_almost_equal, assert_equal) from nose.tools import assert_raises from pystruct.models import NodeTypeEdgeFeatureGraphCRF, EdgeFeatureGraphCRF from pystruct.inference.linear_prog...
42.36197
118
0.409091
[ "BSD-2-Clause" ]
LemonLison/pystruct
pystruct/tests/test_models/test_node_type_edge_feature_graph_crf.py
36,982
Python
from __future__ import print_function, absolute_import import importlib import logging import os from argparse import ArgumentParser from six import string_types from adr.formatter import all_formatters from .errors import MissingDataError log = logging.getLogger('adr') here = os.path.abspath(os.path.dirname(__file...
26.974359
74
0.552281
[ "MPL-2.0" ]
gmierz/active-data-recipes
adr/recipe.py
3,156
Python
import bbi import clodius.tiles.format as hgfo import functools as ft import logging import numpy as np import pandas as pd import re from concurrent.futures import ThreadPoolExecutor MAX_THREADS = 4 TILE_SIZE = 1024 logger = logging.getLogger(__name__) aggregation_modes = {} aggregation_modes['mean'] = {'name': 'M...
28.820163
110
0.583058
[ "MIT" ]
4dn-dcic/clodius
clodius/tiles/bigwig.py
10,577
Python
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-02-22 09:00 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('waldur_jira', '0011_unique_together'), ] operations = [ migrations.AlterFie...
26.129032
62
0.590123
[ "MIT" ]
opennode/waldur-jira
src/waldur_jira/migrations/0012_backend_id_null.py
810
Python
#!/usr/bin/python # Copyright (c) 2014 Wladmir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the directory that...
31.602941
98
0.585854
[ "MIT" ]
Talisman-coin/honestas
share/seeds/generate-seeds.py
4,298
Python
import praw import os from dotenv import load_dotenv load_dotenv() CLIENT_ID = os.getenv("CLIENT_ID") CLIENT_SECRET = os.getenv("CLIENT_SECRET") USERNAME = os.getenv("USERNAME") PASSWORD = os.getenv("PASSWORD") reddit = praw.Reddit(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, ...
31.038462
64
0.530359
[ "MIT" ]
Build-Week-Post-Here2/bw-DS
praw_practice.py
807
Python
import law import luigi import os from subprocess import PIPE from law.util import interruptable_popen from framework import Task class CROWNBuild(Task): """ Gather and compile CROWN with the given configuration """ # configuration variables channels = luigi.Parameter() shifts = luigi.Param...
38.013333
88
0.512978
[ "MIT" ]
swozniewski/KingMaker
processor/tasks/CROWNBuild.py
5,702
Python
#!/usr/bin/env python # encoding: utf-8 class MeanVariance(object): def __init__(self): self.n = 0 self.K = 0.0 self.ex0 = 0.0 self.ex2 = 0.0 def add_variable(self, x): if self.n == 0: self.K = x self.n += 1 delta = x - self.K self.e...
21.441176
73
0.540466
[ "Apache-2.0" ]
mraad/spark-std-dist
src/main/python/mean-variance.py
729
Python
import boto3 MAX_OBJECT_LIMIT = 1000 def get_s3_client(): boto3.setup_default_session() return boto3.client('s3') def is_object_name(client, bucket, name): try: client.get_object(Bucket=bucket, Key=name) return True except: return False def is_bucket_name(client, name): ...
25.623853
107
0.694952
[ "MIT" ]
VanOvermeire/s3bash
s3bash/s3_helper.py
2,793
Python
#!/usr/bin/python3 # -*- coding:utf-8 -*- # FORKED FROM https://github.com/floydawong/LuaFormat # Copyright (c) 2017 Floyda (floyda@163.com) # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software w...
26.695067
88
0.522986
[ "MIT" ]
schollz/LuaFormat
lua-format.py
17,873
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 use this ...
38.09901
110
0.721414
[ "Apache-2.0" ]
kylerichardson/metron
metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/rest_master.py
3,848
Python
## Ao arrumar os NCM nos registros nãoesteaindaC180 e C190 pode ocorrer duplicidade ## nos conjuntos de campos de acordo com o manual. ## No caso preciso juntar todos os registros com estas caracteristicas import helper def exec(conexao): cursor = conexao.cursor() print("RULE 02 - Inicializando",end=' ') ...
42.3
109
0.493696
[ "MIT" ]
teocrono/scripts
sped_correcao/rule02.py
5,083
Python
import argparse from functools import partial import math import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy.optimize import minimize def read_args(): '''Reads command line arguments. Returns: Parsed arguments.''' parser = argparse.ArgumentParser() ...
29.726457
100
0.657867
[ "MIT" ]
Alexandros23Kazantzidis/orbitdeterminator
orbitdeterminator/kep_determination/ellipse_fit.py
6,629
Python
from os import environ from os.path import join, dirname # Third party imports from flask_compress import Compress class Config: """ Common configurations """ # private variable used by Flask to secure/encrypt session cookies SECRET_KEY = environ['SECRET_KEY'] # get the root url and concant...
31.385714
107
0.700046
[ "MIT" ]
Rwothoromo/Flask-Okta
config.py
4,396
Python
"""Module with functions around testing. You can run tests including doctest with generating coverage, you can generate tests from readme or you can configure tests in conftest with single call.""" from mypythontools_cicd.tests.tests_internal import ( add_readme_tests, deactivate_test_settings, default_tes...
25.333333
102
0.734962
[ "MIT" ]
Malachov/mypythontools_cicd
mypythontools_cicd/tests/__init__.py
532
Python
# -*- coding: utf-8 -*- import tkinter as tk from tkinter import messagebox import ipaddress from model import RecvTcpThread, RecvUdpThread, RecvMonitorThread, HachiUtil from controller import LogController # ================================= # == 定数 # ================================= DEF_PROTO = 1 # 0:TCP 1:UDP D...
24.355556
79
0.554973
[ "MIT" ]
kinformation/hachi
controller/RxController.py
4,992
Python
# Copyright 2014, Sandia Corporation. Under the terms of Contract # DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain # rights in this software. from behave import * import numpy import toyplot import testing @given(u'a sample plot, the plot can be rendered with a dashed line style.') d...
31.75
98
0.751969
[ "BSD-3-Clause" ]
StuntsPT/toyplot
features/steps/style.py
508
Python
# Copyright 2020 The TensorFlow 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 # # Unless required by applica...
34.45098
80
0.702903
[ "Apache-2.0" ]
00arun00/tensorflow
tensorflow/python/grappler/arithmetic_optimizer_test.py
1,757
Python
from .DtnAbstractParser import DtnAbstractParser from pydantic import confloat, PositiveFloat from typing import Optional class DtnFileBroadcasterParser(DtnAbstractParser): """ Validator for a file generator """ # Data Tyoe data_type: str # Start time of the file transmission (in simulation time) ...
26.166667
63
0.695541
[ "Apache-2.0" ]
msancheznet/dtnsim
simulator/parsers/DtnFileBroadcasterParser.py
785
Python
# this file is only for presentation of the swallow fish game # http://www.4399.com/flash/201247_4.htm from pyautogui import press, keyDown, keyUp from time import time import serialPart # u = 'up' # d = 'down' # l = 'left' # r = 'right' u = 'w' d = 's' l = 'a' r = 'd' def key_unit(key, p...
23.898551
119
0.466343
[ "MIT" ]
solidsteam/myJoystic
simKeyControlGame_temp2.py
5,027
Python
#!/usr/bin/env python3 ''' A series of test for PyKMCFile class. ''' import sys import os import subprocess import kmer_utils import init_sys_path import py_kmc_api as pka import pytest if not init_sys_path.is_windows(): import resource @pytest.fixture(scope="module", autouse=True) def create_kmc_db(): ''' ...
31.420091
96
0.61183
[ "Unlicense" ]
refresh-bio/KMC
tests/py_kmc_api/test_py_kmc_file.py
6,881
Python
import tensorflow as tf def leakyrelu(x, leak=0.01): """ leakyrelu激活函数 Args: x (Tensor): input leak (int): x<0时的斜率 Returns: Tensor """ f1 = 0.5 * (1 + leak) f2 = 0.5 * (1 - leak) return f1 * x + f2 * tf.abs(x)
15.222222
34
0.474453
[ "BSD-2-Clause" ]
tangxyw/RecAlgorithm
algorithm/BST/leakyrelu.py
290
Python
from unittest import TestCase from generative_playground.codec.hypergraph_grammar import HypergraphGrammar from generative_playground.molecules.models.conditional_probability_model import CondtionalProbabilityModel from generative_playground.models.pg_runner import PolicyGradientRunner class TestStart(TestCase): de...
59.777778
107
0.430165
[ "MIT" ]
ZmeiGorynych/generative_playground
src/tests/runner_tests.py
3,766
Python
import glob print(glob.glob("./src/ibmaemagic/sdk/*")) # import sys # sys.path.append("./src/ibmaemagic/magic/") # from analytic_magic_client import AnalyticMagicClient # import analytic_engine_client.AnalyticEngineClient # from ibmaemagic.magic.analytic_magic_client import AnalyticMagicClient # from ibmaemagic.sdk.a...
32.8125
72
0.832381
[ "MIT" ]
DSE-JARVIS/3genius
tests/sdk/foo.py
525
Python
from pyinfra import host from pyinfra.modules import git, pip, server # Ensure the state of git repositories git.repo( {'Clone pyinfra repository'}, 'git@github.com:Fizzadar/pyinfra', host.data.app_dir, branch='develop', ssh_keyscan=True, sudo=True, # Carry SSH agent details w/sudo pre...
21.454545
44
0.670551
[ "MIT" ]
VilhelmPrytz/pyinfra
examples/python_app.py
944
Python
# Generated by Django 3.0.3 on 2021-03-05 03:35 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0011_update_proxy_permissions'), ] operations = [ migrations.CreateModel( name='User', f...
50
266
0.637059
[ "MIT" ]
liweisherry/recipe-app-api
app/core/migrations/0001_initial.py
1,700
Python
# -*- coding: utf-8 -*- from dfa import * """ Created on Mon Apr 1 09:50:10 2019 @author: Savio """ #Example of a simple DFA #DFA only accepts odd-sized string states = {0, 1} alphabet = {'0','1'} transition = { (0, '0'): 1, (0, '1'): 1, (1, '0'): 0, (1, '1'): 0, } start_state = 0 accept_s...
18.259259
69
0.578093
[ "MIT" ]
saviorabelo/dfa
main.py
493
Python
from amaranth import * from amaranth.asserts import * from amaranth.utils import log2_int from amaranth_soc import wishbone from amaranth_soc.memory import MemoryMap from amaranth_soc.periph import ConstantMap from . import Peripheral from ..cores import litedram __all__ = ["WritebackCache", "SDRAMPeripheral"] c...
40.146814
117
0.52377
[ "BSD-2-Clause" ]
gregdavill/lambdasoc
lambdasoc/periph/sdram.py
14,493
Python
# -*- coding: utf-8 -*- import json import logging import re from lncrawl.core.crawler import Crawler logger = logging.getLogger(__name__) search_url = 'https://www.novelall.com/search/?name=%s' class NovelAllCrawler(Crawler): base_url = 'https://www.novelall.com/' def search_novel(self, query): que...
32.454545
80
0.520658
[ "Apache-2.0" ]
BorgSquared/lightnovel-crawler
sources/novelall.py
2,856
Python
import requests import ratelimit from arcas.tools import Api from .api_key import api_key from arcas.tools import APIError class Ieee(Api): """ API argument is 'ieee'. """ def __init__(self): self.standard = 'https://ieeexploreapi.ieee.org/api/v1/search/articles?' self.key_api = api_...
36.6
105
0.598609
[ "MIT" ]
ArcasProject/Arcas
src/arcas/IEEE/main.py
4,026
Python
# # Copyright 2015-2019, Institute for Systems Biology # # 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 ...
28.97
121
0.647566
[ "Apache-2.0" ]
isb-cgc/ISB-CGC-Webapp
scripts/bigquery/cohort_table_utils.py
5,794
Python
#!/usr/bin/env python3 import datetime import os import signal import subprocess import sys import traceback from multiprocessing import Process import cereal.messaging as messaging import selfdrive.crash as crash from common.basedir import BASEDIR from common.params import Params, ParamKeyType from common.text_window...
27.779221
99
0.699548
[ "MIT" ]
Superkingggg/op4
selfdrive/manager/manager.py
6,417
Python
from __future__ import print_function, division import _init_paths import math import os.path as osp from shapely.geometry import Polygon from gen_data import get_cent from bbox_util import is_rect import argparse import sys from model.config import cfg def parse_args(): """ Parse input arguments """ parser =...
31.357488
102
0.620243
[ "MIT" ]
lz20061213/quadrilateral
tools/eval_frame.py
6,491
Python
from twisted.protocols import stateful from twisted.internet import reactor from twisted.internet.protocol import Factory, Protocol from twisted.internet.endpoints import TCP4ClientEndpoint from datetime import datetime import sys import struct import zlib import time import threading import Queue import uuid import...
36.714953
191
0.722159
[ "MIT" ]
isis-ammo/ammo-gateway
AndroidGatewayPlugin/Testdriver/AndroidConnector/ammo/AndroidConnector.py
15,714
Python
# Generated by Django 3.1.8 on 2021-05-20 18:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0020_auto_20210415_0831'), ] operations = [ migrations.AddField( model_name='candidateusermodel', name='org...
23.947368
105
0.635165
[ "MIT" ]
AlenaYanish/Data_converter
users/migrations/0021_candidateusermodel_organization.py
455
Python
import math import numpy as np import pytest import tensorflow as tf import kerastuner as kt from kerastuner.engine import hyperparameters as hp_module from kerastuner.engine import trial as trial_module from kerastuner.tuners import bayesian as bo_module @pytest.fixture(scope="function") def tmp_dir(tmpdir_factory...
32.774929
82
0.644385
[ "Apache-2.0" ]
jpodivin/keras-tuner
tests/kerastuner/tuners/bayesian_test.py
11,504
Python
import abc from ... import errors, utils from ...tl import types class ChatGetter(abc.ABC): """ Helper base class that introduces the `chat`, `input_chat` and `chat_id` properties and `get_chat` and `get_input_chat` methods. Subclasses **must** have the following private members: `_chat`, `_...
33.725
78
0.594514
[ "MIT" ]
bb010g/Telethon
telethon/tl/custom/chatgetter.py
4,047
Python