repo_name
stringlengths
7
65
path
stringlengths
5
185
copies
stringlengths
1
4
size
stringlengths
4
6
content
stringlengths
977
990k
license
stringclasses
14 values
hash
stringlengths
32
32
line_mean
float64
7.18
99.4
line_max
int64
31
999
alpha_frac
float64
0.25
0.95
ratio
float64
1.5
7.84
autogenerated
bool
1 class
config_or_test
bool
2 classes
has_no_keywords
bool
2 classes
has_few_assignments
bool
1 class
deepchem/deepchem
contrib/torch/torch_model.py
8
8255
# -*- coding: utf-8 -*- """ Created on Mon Mar 13 22:31:24 2017 @author: Zhenqin Wu """ import torch import time import numpy as np from deepchem.trans import undo_transforms from deepchem.utils.save import log from deepchem.models import Model class TorchMultitaskModel(Model): def __init__(self, ...
mit
40fd4d16f0a205513f26290eed5daaca
34.12766
79
0.624591
3.830626
false
false
false
false
deepchem/deepchem
examples/toxcast/toxcast_rf.py
4
1089
""" Script that trains Sklearn multitask models on toxcast & tox21 dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np from sklearn.ensemble import RandomForestClassifier from deepchem.molnet import load_toxcast import deepchem a...
mit
7ada64db090c32f4fbeb827762b8e62e
27.657895
71
0.773186
3.392523
false
false
false
false
deepchem/deepchem
contrib/atomicconv/models/atomicnet_ops.py
5
8790
"""Tensorflow Ops for Atomicnet.""" from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np import tensorflow as tf __author__ = "Joseph Gomes" __copyright__ = "Copyright 2016, Stanford University" __license__ = "MIT" ### AtomicNet fully-connect...
mit
d97ca3448b51f1673e2cfadb9f299fd8
24.186246
79
0.628328
3.303269
false
false
false
false
deepchem/deepchem
deepchem/molnet/dnasim.py
2
14029
import numpy as np def get_distribution(GC_fraction): from simdna.util import DiscreteDistribution return DiscreteDistribution({ 'A': (1 - GC_fraction) / 2, 'C': GC_fraction / 2, 'G': GC_fraction / 2, 'T': (1 - GC_fraction) / 2 }) def simple_motif_embedding(motif_name, seq_length, num_...
mit
f101b39797c2450d9ebb7c9d2584e209
33.811414
86
0.670468
3.866869
false
false
false
false
deepchem/deepchem
contrib/torch/torch_multitask_regression.py
8
3927
# -*- coding: utf-8 -*- """ Created on Mon Mar 13 22:31:24 2017 @author: Zhenqin Wu """ import torch import numpy as np from torch_model import TorchMultitaskModel class TorchMultitaskRegression(TorchMultitaskModel): def __init__(self, n_tasks, n_features, **kwargs): """Constructs the computational graph. ...
mit
e6a9076b64d9e4d2b3d4bb1f35d92a1d
33.147826
85
0.639419
3.302775
false
false
false
false
deepchem/deepchem
examples/delaney/delaney_graph_conv.py
4
1172
""" Script that trains graph-conv models on Tox21 dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np from deepchem.models import GraphConvModel np.random.seed(123) import tensorflow as tf tf.random.set_seed(123) import deepch...
mit
3b4a8084b9d2d03db9325c8092a0af7f
24.478261
68
0.762799
3.255556
false
false
false
false
deepchem/deepchem
deepchem/hyper/grid_search.py
1
9135
""" Contains basic hyperparameter optimizations. """ import numpy as np import os import itertools import tempfile import collections import logging from functools import reduce from operator import mul from typing import Dict, List, Optional, Tuple from deepchem.data import Dataset from deepchem.trans import Transfor...
mit
1981e2bdd1205ad3afbc9bba3cff9e6d
38.206009
87
0.674658
4.01715
false
false
false
false
deepchem/deepchem
deepchem/models/torch_models/torch_model.py
1
47201
import numpy as np import torch try: import torch.utils.tensorboard _has_tensorboard = True except: _has_tensorboard = False import time import logging import os from deepchem.data import Dataset, NumpyDataset from deepchem.metrics import Metric from deepchem.models.losses import Loss from deepchem.models.models...
mit
4b3b17ed4cbe2ab505cabc1034965207
38.236076
119
0.645113
4.182632
false
false
false
false
gae-init/gae-init-upload
main/cache.py
25
1092
# coding: utf-8 from google.appengine.api import memcache import flask import config ############################################################################### # Helpers ############################################################################### def bump_counter(key, time=3600, limit=4): client = memcach...
mit
135cdef4624041bf42673195eba19820
25.634146
79
0.484432
4.403226
false
false
false
false
gae-init/gae-init-upload
main/api/helpers.py
7
1766
# coding: utf-8 from datetime import datetime import logging from werkzeug import exceptions import flask import flask_restful import util class Api(flask_restful.Api): def unauthorized(self, response): flask.abort(401) def handle_error(self, e): return handle_error(e) def handle_error(e): logging...
mit
0769b260a1a8afe19711d6137eb4e448
24.970588
72
0.642695
3.532
false
false
false
false
gamechanger/dusty
tests/unit/commands/manage_config_test.py
1
2734
import os import tempfile import shutil import json import dusty.constants from dusty.commands.manage_config import list_config_values, save_value, _eligible_config_keys_for_setting from dusty.compiler.spec_assembler import get_specs_repo from ...testcases import DustyTestCase from dusty import constants class TestMa...
mit
e338c0b561907e846ae1302d540a8d24
52.607843
174
0.618873
3.883523
false
true
false
false
gamechanger/dusty
tests/unit/systems/docker/testing_images_test.py
1
5529
from mock import Mock, patch, call import docker from nose.tools import nottest from ....fixtures import premade_app from ....testcases import DustyTestCase from dusty.systems.docker.testing_image import (_ensure_base_image, _create_tagged_image, _get_split_volumes, _get_create_container_volumes, ...
mit
b0a140695f042f8572644f9a7aea7b0e
59.758242
140
0.631217
3.560206
false
true
false
false
skyfielders/python-skyfield
skyfield/tests/test_frames.py
1
3697
from numpy import cos from skyfield import framelib from skyfield.api import Topos, load, wgs84 from skyfield.constants import AU_M, ERAD from skyfield.positionlib import Geocentric def test_radec_and_altaz_angles_and_rates(): # HORIZONS test data in Skyfield repository: authorities/radec-altaz-rates ts = load...
mit
50ed77c851a786bed553557b48e1f8de
37.915789
79
0.647011
2.730428
false
true
false
false
skyfielders/python-skyfield
design/satellite_is_sunlit.py
1
2590
"""Verdict: light-time delay from the Sun can be neglected in is_sunlit()! For the Sun's position from Earth, does calling observe() really make enough difference to justify the expense? Here we take two approaches to answering the question: we compare the difference every day over 40 years, and then we do a back-of-...
mit
ef15312ed05f0d64f12798ee685463f7
39.46875
78
0.739382
3.189655
false
false
false
false
skyfielders/python-skyfield
skyfield/vectorlib.py
1
9234
"""Vector functions and their composition.""" from jplephem.names import target_names as _jpl_code_name_dict from numpy import max from .constants import C_AUDAY from .descriptorlib import reify from .errors import DeprecationError from .functions import length_of from .positionlib import build_position from .timelib ...
mit
d3712e47a3bdb659c26d67362a5e14a3
33.073801
79
0.623457
3.812552
false
false
false
false
skyfielders/python-skyfield
skyfield/tests/test_magnitudes.py
1
1157
from skyfield.api import load from skyfield.magnitudelib import planetary_magnitude def test_magnitudes(): ts = load.timescale() #t = ts.utc(1995, 5, 22) # Rings edge-on from Earth. t = ts.utc(2021, 10, 4) eph = load('de421.bsp') earth = eph['earth'] names = [ 'mercury', 'venus', 'mars...
mit
3d43d65f311393df8affe753294a80d4
34.060606
74
0.54624
2.735225
false
false
false
false
skyfielders/python-skyfield
examples/venus_evening_chart.py
1
3584
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap from skyfield import almanac from skyfield.api import load, wgs84 from skyfield.magnitudelib import planetary_magnitude MONTH_NAMES = '0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split() # Figure out the ti...
mit
c026f3ac670c7b17691cc45087e467fa
29.555556
78
0.642797
2.850877
false
false
false
false
skyfielders/python-skyfield
skyfield/constellationlib.py
1
3334
# -*- coding: utf-8 -*- """Constellation identification. Constellation identification is tradionally performed with: http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/42 https://iopscience.iop.org/article/10.1086/132034/pdf Given a position, a binary search can be used to index into its roughly 12k data table for a matching...
mit
11eaf03a30f7441bcf6b52d4c05495e1
36.863636
77
0.718487
3.511064
false
false
false
false
skyfielders/python-skyfield
skyfield/tests/test_satellite_events.py
1
5246
from __future__ import print_function, division from skyfield import api def test_sat_almanac_LEO(): # Testcase from # https://github.com/skyfielders/astronomy-notebooks/blob/master/Solvers/Earth-Satellite-Passes.ipynb # with elevated horizon tle = ["TIANGONG 1", "1 37820U 11053A 14314.79...
mit
c7c356a77501d88efe8680d593fd82d1
43.837607
105
0.595501
3.053551
false
false
false
false
mining/mining
mining/bin/scheduler.py
6
4168
# -*- coding: utf-8 -*- from os import sys, path import schedule from time import sleep from bottle.ext.mongo import MongoPlugin sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from mining.utils import conf, log_it from mining.tasks import process log_it("START", "bin-scheduler") onrun = {} regi...
mit
38db7437bbe16c87e106219ab6e0cfe0
33.163934
78
0.543426
4.03876
false
false
false
false
sissaschool/elementpath
elementpath/datatypes/qname.py
1
2951
# # Copyright (c), 2018-2020, SISSA (International School for Advanced Studies). # All rights reserved. # This file is distributed under the terms of the MIT License. # See the file 'LICENSE' in the root directory of the present # distribution, or http://opensource.org/licenses/MIT. # # @author Davide Brunato <brunato@...
mit
80b6a4416d9a4516c02c84ef02ec896b
32.534091
87
0.623856
3.754453
false
false
false
false
sissaschool/elementpath
elementpath/datatypes/proxies.py
1
7025
# # Copyright (c), 2018-2020, SISSA (International School for Advanced Studies). # All rights reserved. # This file is distributed under the terms of the MIT License. # See the file 'LICENSE' in the root directory of the present # distribution, or http://opensource.org/licenses/MIT. # # @author Davide Brunato <brunato@...
mit
3152afc1ff9328c65bb465d7fcee9312
35.21134
97
0.630178
4.007416
false
false
false
false
sissaschool/elementpath
elementpath/datatypes/binary.py
1
5121
# # Copyright (c), 2018-2020, SISSA (International School for Advanced Studies). # All rights reserved. # This file is distributed under the terms of the MIT License. # See the file 'LICENSE' in the root directory of the present # distribution, or http://opensource.org/licenses/MIT. # # @author Davide Brunato <brunato@...
mit
f17556165fa714567a6dadc12cdd0683
31.00625
90
0.585433
3.830217
false
false
false
false
sissaschool/elementpath
profiling/profile_xpath_tokens.py
1
1440
#!/usr/bin/env python # # Copyright (c), 2021, SISSA (International School for Advanced Studies). # All rights reserved. # This file is distributed under the terms of the MIT License. # See the file 'LICENSE' in the root directory of the present # distribution, or http://opensource.org/licenses/MIT. # # @author Davide ...
mit
18d236c52af26a12d77481df613290ed
29.638298
75
0.63125
3.235955
false
false
false
false
agconti/cookiecutter-django-rest
{{cookiecutter.github_repository_name}}/{{cookiecutter.app_name}}/config/common.py
1
6588
import os from os.path import join from distutils.util import strtobool import dj_database_url from configurations import Configuration BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) class Common(Configuration): INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.au...
mit
64bfb523b860be4451d9f64c977b88e2
31.776119
113
0.551913
4.172261
false
false
false
false
sissaschool/elementpath
elementpath/xpath2/_xpath2_constructors.py
1
18848
# # Copyright (c), 2018-2021, SISSA (International School for Advanced Studies). # All rights reserved. # This file is distributed under the terms of the MIT License. # See the file 'LICENSE' in the root directory of the present # distribution, or http://opensource.org/licenses/MIT. # # @author Davide Brunato <brunato@...
mit
fdc44c5f969454f9f9d2f66c2e7abcda
30.784148
95
0.657152
3.796173
false
false
false
false
robbievanleeuwen/section-properties
examples/00-basic/01_simple.py
1
1784
r""" .. _ref_ex_simple: Simple Example -------------- Calculate section properties of a circle. The following example calculates the geometric, warping and plastic properties of a 50 mm diameter circle. The circle is discretised with 64 points and a mesh size of 2.5 mm\ :sup:`2`. The geometry and mesh are plotted, ...
mit
1fe31884e8037e4b7e9189b8833cd6a0
31.436364
83
0.758408
3.560878
false
false
false
false
liampauling/betfair
betfairlightweight/metadata.py
1
3083
""" Useful metadata/limits from: https://developer.betfair.com/exchange-api/ """ transaction_limit = 5000 # transactions per hour (£0.002 cost per transaction after) order_limits = { "placeOrders": 200, "cancelOrders": 60, "updateOrders": 60, "replaceOrders": 60, } list_current_orders = {"marke...
mit
00618eca5a5b81c9e27e9ff70df81584
37.049383
136
0.631408
2.717813
false
false
false
false
liampauling/betfair
betfairlightweight/resources/bettingresources.py
2
34189
from .baseresource import BaseResource class EventType: """ :type id: unicode :type name: unicode """ def __init__(self, id: str, name: str): self.id = id self.name = name class EventTypeResult(BaseResource): """ :type event_type: EventType :type market_count: int ...
mit
da4a77b7a92465d007b1d3f631db4477
28.964067
88
0.620112
3.852716
false
false
false
false
liampauling/betfair
betfairlightweight/streaming/stream.py
1
9789
import datetime import logging import time from typing import Optional from .cache import CricketMatchCache, MarketBookCache, OrderBookCache, RaceCache logger = logging.getLogger(__name__) MAX_CACHE_AGE = 60 * 60 * 8 # 8hrs class BaseStream: """Separate stream class to hold market/order caches""" _lookup...
mit
2c43983db52922922543c06b642d2507
33.347368
88
0.537134
3.898447
false
false
false
false
liampauling/betfair
tests/test_streamingendpoint.py
2
1817
import unittest from unittest import mock from betfairlightweight import APIClient from betfairlightweight.endpoints import Streaming class StreamingTest(unittest.TestCase): def setUp(self): self.client = APIClient("username", "password", "app_key", "UK") self.streaming = Streaming(self.client) ...
mit
0f749a7767a30dd3a0eb66c96ee9db85
37.659574
87
0.67639
3.833333
false
true
false
false
miyuchina/mistletoe
test/test_traverse.py
1
3858
from textwrap import dedent import unittest from mistletoe import Document from mistletoe.span_token import Strong from mistletoe.utils import traverse class TestTraverse(unittest.TestCase): def test(self): doc = Document("a **b** c **d**") filtered = [t.node.__class__.__name__ for t in traverse(...
mit
bc8b5ec2b530f70fa3c51b225d27b68e
29.864
83
0.456973
4.291435
false
true
false
false
miyuchina/mistletoe
contrib/scheme.py
1
5152
import re from collections import ChainMap from mistletoe import BaseRenderer, span_token, block_token from mistletoe.core_tokens import MatchObj class Program(block_token.BlockToken): def __init__(self, lines): self.children = span_token.tokenize_inner(''.join([line.strip() for line in lines])) class E...
mit
12733dd154fcc858614de9c376709c32
31.607595
107
0.537849
3.640989
false
false
false
false
authomatic/authomatic
authomatic/extras/gae/openid.py
2
5233
# -*- coding: utf-8 -*- # We need absolute import to import from openid library which has the same # name as this module from __future__ import absolute_import import logging import datetime import openid.store.interface logger = logging.getLogger(__name__) try: from google.appengine.ext import ndb except Import...
mit
f5b532cb8942900c70d5328fea8bb463
31.302469
96
0.598318
4.538595
false
false
false
false
authomatic/authomatic
authomatic/six.py
2
29751
# -*- coding: utf-8 -*- """Utilities for writing code that runs on Python 2 and 3""" # Copyright (c) 2010-2015 Benjamin Peterson # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without res...
mit
221d5c894d069180e75cd08fccd85eb9
33.878077
98
0.6305
4.018233
false
false
false
false
choderalab/pymbar
pymbar/mbar.py
2
84532
############################################################################## # pymbar: A Python Library for MBAR # # Copyright 2017-2022 University of Colorado Boulder # Copyright 2010-2017 Memorial Sloan-Kettering Cancer Center # Portions of this software are Copyright (c) 2010-2016 University of Virginia # Portions...
mit
bea4dafc051d0d21d75dd5655bf02021
41.822695
201
0.54461
3.7387
false
false
false
false
gwu-libraries/launchpad
lp/ui/management/commands/make_sitemap.py
1
2292
import gzip import os from django.conf import settings from django.core.management.base import BaseCommand from django.db import connections def _newfile(counter): """Generate a new sitemap filename based on count.""" name = '%s/sitemap-%s.xml.gz' % (settings.SITEMAPS_DIR, counter) fp = gzip.open...
mit
812b189ca9ac911d783bf3f2f52a2393
33.208955
73
0.538394
3.493902
false
false
false
false
gwu-libraries/launchpad
lp/ui/summon.py
1
9590
import re import logging import summoner from urllib import urlencode from datetime import datetime from django.core.urlresolvers import reverse class Summon(): """ A wrapper for summoner.Summon which massages the Summon response format into schema.org flavored JSON-LD. Maybe this could be pushed into ...
mit
b7f3701e1333bd02439987fb4666e61b
35.743295
107
0.522836
4.122958
false
false
false
false
maxpumperla/elephas
elephas/parameter/server.py
1
7559
import abc import pickle import socket from threading import Thread from flask import Flask, request from multiprocessing import Process from tensorflow.keras.models import Model from elephas.utils.sockets import determine_master from elephas.utils.sockets import receive, send from elephas.utils.serialization import d...
mit
0c530ff8dd717a70ff2c80e77ed5c1f5
31.581897
80
0.59836
4.270621
false
false
false
false
maxpumperla/elephas
elephas/parameter/client.py
1
3164
import abc import numpy as np import socket import pickle import urllib.request as urllib2 from ..utils.sockets import determine_master, send, receive class BaseParameterClient(abc.ABC): """BaseParameterClient Parameter-server clients can do two things: retrieve the current parameters from the corresp...
mit
772dd83e377e5fa929204df6bdb0800e
33.769231
97
0.636852
4.304762
false
false
false
false
openpathsampling/openpathsampling
openpathsampling/engines/openmm/features/instantaneous_temperature.py
3
1516
from openpathsampling.integration_tools import openmm as mm from openpathsampling.integration_tools import unit as u @property def n_degrees_of_freedom(snapshot): """ Returns ------- n_degrees_of_freedom: int number of degrees of freedom in this system (after accounting for constraints)...
mit
d04a6104a627e098e56c1aa56cd1eb10
32.688889
74
0.691953
3.771144
false
false
false
false
openpathsampling/openpathsampling
openpathsampling/netcdfplus/chaindict.py
4
13154
import collections import numpy as np from .proxy import LoaderProxy __author__ = 'Jan-Hendrik Prinz' class ChainDict(object): """ A dict-like structure with a logic to fill missing values from other dicts The default ChainDict requires a list of keys. If you want to allow also single values you ne...
mit
e455acf589ea264ad50a20aab890bf2a
26.692632
80
0.548502
4.47872
false
false
false
false
jpadilla/pyjwt
tests/keys/__init__.py
2
1488
import json import os from jwt.algorithms import has_crypto from jwt.utils import base64url_decode try: from cryptography.hazmat.primitives.asymmetric import ec except ModuleNotFoundError: pass if has_crypto: from jwt.algorithms import RSAAlgorithm BASE_PATH = os.path.dirname(os.path.abspath(__file__)) ...
mit
e6441ac4c121f1c2ae8517454f9fe6e7
24.655172
74
0.671371
2.993964
false
false
false
false
openpathsampling/openpathsampling
openpathsampling/treelogic.py
3
14599
__author__ = 'Jan-Hendrik Prinz' class TreeMixin(object): """ A mixin that provides basic tree handling. A tree is basically a node with children of the same type. The mixin requires to implement `.subnodes` to contain a list of children. The `__contains__` operator requires `_default_match` to b...
mit
5f077d4da5fe7eed2facb4164396e99b
29.799578
113
0.521543
4.676169
false
false
false
false
openpathsampling/openpathsampling
openpathsampling/__init__.py
3
6795
# start by importing version, because for some weird reason, I sometimes get # networkx as over-riding the version here (no idea why...) try: # should work if installed through normal means: setup.py-based with # pip, conda, easy_install, etc. from . import version except ImportError: # pragma: no cover ...
mit
e8237c7d9d7bc5ae2e0741d8dad318fc
33.846154
76
0.781457
3.762458
false
false
false
false
openpathsampling/openpathsampling
openpathsampling/engines/external_snapshots/snapshot.py
3
4849
import time from openpathsampling.engines import features from openpathsampling.engines.snapshot import BaseSnapshot from . import features as ext_features import logging logger = logging.getLogger(__name__) @features.base.attach_features([ features.engine, features.coordinates, features.velocities, ...
mit
dfb85deabd1530bdb56b6a6edd06b040
32.212329
76
0.611879
4.372408
false
false
false
false
theolind/pymysensors
tests/test_sensor.py
1
6404
"""Test task module.""" import pytest import voluptuous from mysensors.sensor import ChildSensor, Sensor from mysensors.const import get_const def test_is_smart_sleep_node(): """Test schedule persistence on threading gateway.""" const = get_const("1.4") sensor_id = 1 sensor = Sensor(sensor_id) s...
mit
fbb86f7b32086ab160b3ffddfd69fd08
31.180905
86
0.685197
3.312985
false
true
false
false
dashwav/nano-chan
cogs/spoils.py
1
3168
""" A cog that handles posting a large embed to block out spoils. """ import discord import asyncio from datetime import datetime, timedelta from discord.ext import commands from .utils import checks class Spoils(commands.Cog): """ Class that creates a task to run every minute and check for time since las...
mit
0ce3ca91c92084a8675b0cd3294dbc2b
40.116883
79
0.49463
4.662739
false
false
false
false
dashwav/nano-chan
cogs/stats.py
1
21473
""" Fun things with stats """ import discord import datetime from collections import defaultdict from .utils import helpers, checks from discord.ext import commands ALLOWED_CHANNELS = [ 378684962934751239, 282640120388255744, 220762067739738113, 176429411443146752, ] class Stats(commands.Cog): """...
mit
38a4f5625745e76d909eb05654c4a357
43.884937
273
0.531718
3.739759
false
false
false
false
jonathf/chaospy
chaospy/expansion/frontend.py
1
4467
"""Frontend function for generating polynomial expansions.""" from .stieltjes import stieltjes from .cholesky import cholesky from .gram_schmidt import gram_schmidt EXPANSION_NAMES = { "ttr": "stieltjes", "three_terms_recurrence": "stieltjes", "stieltjes": "stieltjes", "chol": "cholesky", "cholesky...
mit
0c7b1a2d5aa879e097a75b510f2e4d24
39.243243
80
0.506156
4.353801
false
false
false
false
jonathf/chaospy
chaospy/descriptives/variance.py
1
1232
"""Variance operator.""" import numpy import numpoly from .expected import E def Var(poly, dist=None, **kws): """ The variance of a distribution or polynomial. Args: poly (numpoly.ndpoly, Distribution): Input to take variance on. dist (Distribution): Defines the s...
mit
527e43bcbecf118ecce787ca20bf3f6f
27.651163
72
0.559253
3.480226
false
false
false
false
jonathf/chaospy
chaospy/distributions/operators/negative.py
1
2315
""" Negative of a distribution. Example usage ------------- Invert sign of a distribution:: >>> distribution = -chaospy.Uniform() >>> distribution Negative(Uniform()) >>> distribution.sample(5).round(4) array([-0.3464, -0.885 , -0.0497, -0.5178, -0.1275]) >>> distribution.fwd([-0.3, -0.2, -0....
mit
028a17566a667c84b8f68eaf5341f9bd
24.43956
62
0.539525
3.307143
false
false
false
false
jonathf/chaospy
chaospy/distributions/collection/double_gamma.py
1
2012
"""Double gamma distribution.""" import numpy from scipy import special from ..baseclass import SimpleDistribution, ShiftScaleDistribution class double_gamma(SimpleDistribution): """Double gamma distribution.""" def __init__(self, a): super(double_gamma, self).__init__(dict(a=a)) def _pdf(self,...
mit
ecd673d18c819c16c1c43480a720df25
27.338028
78
0.538767
3.303777
false
false
false
false
jblance/mpp-solar
mppsolar/outputs/json_mqtt.py
1
1869
import json as js import logging import re from . import to_json from .mqtt import mqtt from ..helpers import get_kwargs from ..helpers import key_wanted log = logging.getLogger("json_mqtt") class json_mqtt(mqtt): def __str__(self): return "outputs all the results to the supplied mqtt broker in a single...
mit
d63d1a1ee1871a5703c8728e692bed9e
33.611111
111
0.58641
3.806517
false
false
false
false
jonathf/chaospy
chaospy/quadrature/lobatto.py
1
5502
# -*- coding: utf-8 -*- """ Generate the abscissas and weights in Gauss-Loboto quadrature. Example usage ------------- With increasing order:: >>> distribution = chaospy.Beta(2, 2, lower=-1, upper=1) >>> for order in range(4): # doctest: +NORMALIZE_WHITESPACE ... X, W = chaospy.generate_quadrature( ...
mit
32a69c1dce72219f6848c8a81f8be797
34.25641
81
0.580545
3.216374
false
false
false
false
jonathf/chaospy
chaospy/quadrature/sparse_grid.py
1
5429
"""Smolyak sparse grid constructor.""" from collections import defaultdict from itertools import product import numpy from scipy.special import comb import numpoly import chaospy def sparse_grid( order, dist, growth=None, recurrence_algorithm="stieltjes", rule="gaussian", tolerance=1e-10, ...
mit
035670735e41ca64a69600d05e206af2
33.801282
87
0.587769
3.578774
false
false
false
false
jonathf/chaospy
chaospy/quadrature/newton_cotes.py
1
4354
""" Example usage ------------- Generate Newton-Cotes quadrature rules:: >>> distribution = chaospy.Uniform(0, 1) >>> for order in range(5): ... abscissas, weights = chaospy.generate_quadrature( ... order, distribution, rule="newton_cotes") ... print(order, abscissas.round(3), wei...
mit
8156830b0dbe2ff18bdaf78040c8996b
36.534483
84
0.573496
3.017325
false
false
false
false
jblance/mpp-solar
mppsolar/outputs/postgres.py
1
2288
import logging from datetime import datetime import psycopg2 as psycopg2 from psycopg2._json import Json from psycopg2.extensions import register_adapter from . import to_json, get_common_params from .baseoutput import baseoutput from ..helpers import get_kwargs log = logging.getLogger("postgres") """ To use, run `...
mit
cff033c59fb21a2991d5b8955a0c6a3f
27.246914
117
0.593094
3.97913
false
false
false
false
scidash/sciunit
sciunit/models/runnable.py
1
4954
"""Runnable model.""" import inspect import warnings from typing import Union import sciunit.capabilities as cap from .backends import Backend, available_backends from .base import Model class RunnableModel(Model, cap.Runnable): """A model which can be run to produce simulation results.""" def __init__( ...
mit
b9ebc69667fbb2995b6d6605f1a70e30
34.640288
107
0.557933
4.304083
false
false
false
false
jonathf/chaospy
chaospy/quadrature/chebyshev.py
1
3938
"""Chebyshev-Gauss quadrature rule of the first kind.""" import numpy import chaospy from .hypercube import hypercube_quadrature def chebyshev_1(order, lower=-1, upper=1, physicist=False): r""" Chebyshev-Gauss quadrature rule of the first kind. Compute the sample points and weights for Chebyshev-Gauss q...
mit
2bcfd3d614e52ed0882b843da8939157
35.12844
78
0.656679
3.639556
false
false
false
false
jonathf/chaospy
chaospy/distributions/approximation.py
1
9969
"""Collection of approximation functions.""" import logging import numpy import chaospy def approximate_inverse( distribution, idx, qloc, bounds=None, cache=None, parameters=None, xloc0=None, iterations=300, tolerance=1e-12, ): """ Calculate the approximation of the invers...
mit
344c4487cb02683bc83c0285c94693d0
34.603571
87
0.608587
3.970131
false
false
false
false
jblance/mpp-solar
mppsolar/inout/dalyserialio.py
1
1630
import logging import serial import time from .baseio import BaseIO from ..helpers import get_kwargs log = logging.getLogger("DalySerialIO") class DalySerialIO(BaseIO): def __init__(self, *args, **kwargs) -> None: self._serial_port = get_kwargs(kwargs, "device_path") self._serial_baud = get_kwar...
mit
076e87f5cb3464f5aa902dd0fb21dd18
36.906977
82
0.542331
4.034653
false
false
false
false
jonathf/chaospy
chaospy/distributions/sampler/sequences/sobol.py
1
4235
""" Generates samples from the Sobol sequence. Papers:: Antonov, Saleev, USSR Computational Mathematics and Mathematical Physics, Volume 19, 1980, pages 252 - 256. Paul Bratley, Bennett Fox, Algorithm 659: Implementing Sobol's Quasirandom Sequence Generator, ACM Transactions on Mathematic...
mit
c48883b8914863ff146fb6b5fad8c94f
31.083333
78
0.609681
3.48273
false
false
false
false
jonathf/chaospy
chaospy/descriptives/percentile.py
1
1975
"""Percentile function.""" import numpy import chaospy def Perc(poly, q, dist, sample=10000, **kws): """ Percentile function. Note that this function is an empirical function that operates using Monte Carlo sampling. Args: poly (numpoly.ndpoly): Polynomial of interest. ...
mit
fe77445ac45967ba7903df9488bfd33e
29.384615
80
0.551392
3.144904
false
false
false
false
jblance/mpp-solar
mppsolar/protocols/jkabstractprotocol.py
1
7558
import logging import struct from .abstractprotocol import AbstractProtocol from .protocol_helpers import crc8 log = logging.getLogger("jkAbstractProtocol") SOR = bytes.fromhex("55aaeb90") COMMANDS = { "getInfo": { "name": "getInfo", "command_code": "97", "record_type": "3", "de...
mit
a6f71e1c3f1ce14749964d6b4c260619
40.756906
618
0.585737
4.184939
false
false
false
false
jonathf/chaospy
chaospy/distributions/collection/hyperbolic_secant.py
1
1868
"""Hyperbolic secant distribution.""" import numpy from scipy import special from ..baseclass import SimpleDistribution, ShiftScaleDistribution class hyperbolic_secant(SimpleDistribution): """Hyperbolic secant distribution.""" def __init__(self): super(hyperbolic_secant, self).__init__() def _p...
mit
1114b905a2b4006fb290c22209acc958
26.072464
75
0.547645
3.384058
false
false
false
false
jblance/mpp-solar
mppsolar/inout/serialio.py
1
1313
import logging import serial import time from .baseio import BaseIO from ..helpers import get_kwargs log = logging.getLogger("SerialIO") class SerialIO(BaseIO): def __init__(self, *args, **kwargs) -> None: self._serial_port = get_kwargs(kwargs, "device_path") self._serial_baud = get_kwargs(kwarg...
mit
1967f711a765761c3fad68609fad3522
36.514286
82
0.579589
3.873156
false
false
false
false
pyamg/pyamg
pyamg/classical/classical.py
1
6695
"""Classical AMG (Ruge-Stuben AMG).""" from warnings import warn from scipy.sparse import csr_matrix, isspmatrix_csr, SparseEfficiencyWarning from pyamg.multilevel import MultilevelSolver from pyamg.relaxation.smoothing import change_smoothers from pyamg.strength import classical_strength_of_connection, \ symmet...
mit
f795c542231c97ba1fd5d4e9faff25cc
35.38587
79
0.62599
3.832284
false
false
false
false
staticdev/django-pagination-bootstrap
src/django_pagination_bootstrap/paginator.py
1
6137
"""paginator classes.""" from django.core.paginator import EmptyPage from django.core.paginator import Page from django.core.paginator import PageNotAnInteger from django.core.paginator import Paginator class InfinitePaginator(Paginator): """Paginator designed for when it's not important to know how many total pa...
mit
5c02a23fe9677225c61c3e2e1fe589d8
31.3
83
0.617729
4.337102
false
false
false
false
atmtools/typhon
typhon/physics/units/em.py
1
20325
# -*- coding: utf-8 -*- """Module for anything related to the electromagnetic spectrum. This module imports typhon.physics.units.common and therefore has a soft dependency on the pint units library. """ # Any commits made to this module between 2015-05-01 and 2017-03-01 # by Gerrit Holl are developed for the EC proj...
mit
b3d9b8a5366e354f30ef85c0f32b82f4
36.583333
135
0.576989
3.530793
false
false
false
false
atmtools/typhon
typhon/plots/cm/_cmocean.py
1
87751
# -*- coding: utf-8 -*- """ It is a subset of the cmocean package [0] provided by Kristen M. Thyng. The MIT License (MIT) Copyright (c) 2015 Kristen M. Thyng 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 t...
mit
c373cbb18cdfd4906e4229a89bb3f4d7
40.568451
78
0.644711
1.99943
false
false
false
false
atmtools/typhon
typhon/physics/em.py
1
21321
# -*- coding: utf-8 -*- """Module for anything related to the electromagnetic spectrum. """ import numpy as np from typhon import constants __all__ = [ 'planck', 'planck_wavelength', 'planck_wavenumber', 'rayleighjeans', 'rayleighjeans_wavelength', 'radiance2planckTb', 'radiance2rayleigh...
mit
88ee5fd3c7307c6a445bda88fa399d76
26.943644
90
0.58243
3.217778
false
false
false
false
atmtools/typhon
typhon/retrieval/common.py
1
11884
from ast import literal_eval import copy from importlib import import_module import numpy as np import pandas as pd from sklearn.pipeline import Pipeline from typhon.utils import to_array __all__ = [ 'RetrievalProduct', ] class NotTrainedError(Exception): """Should be raised if someone runs a non-trained re...
mit
e37e767484e8d7a0a2629a5ddd29357a
30.191601
77
0.561595
4.706535
false
false
false
false
atmtools/typhon
setup.py
1
2972
"""Typhon is a collection of tools for atmospheric research. Typhon provides: - reading and writing routines for ARTS XML files - an API to run and access ARTS through Python - conversion routines for various physical quantities - a tool kit to collocate different data sets (e.g. satellite, ship, ...) - different ret...
mit
f227ba027ae40f070369e1cfba631873
28.425743
78
0.605316
3.660099
false
false
false
false
liiight/notifiers
notifiers/core.py
1
12450
import logging from abc import ABC from abc import abstractmethod import jsonschema import requests from jsonschema.exceptions import best_match from .exceptions import BadArguments from .exceptions import NoSuchNotifierError from .exceptions import NotificationError from .exceptions import SchemaError from .utils.he...
mit
efaf3096dd616aff3bafd9de5d00da78
33.109589
117
0.638072
4.365358
false
false
false
false
caleb531/automata
automata/base/utils.py
1
2735
#!/usr/bin/env python3 """Miscellaneous utility functions and classes.""" from frozendict import frozendict def freezeValue(value): """ A helper function to convert the given value / structure into a fully immutable one by recursively processing said structure and any of its members, freezing them as...
mit
4a03117a77aac8931329a8ce73910e04
32.765432
99
0.596344
4.08209
false
false
false
false
fabric-bolt/fabric-bolt
fabric_bolt/hosts/forms.py
7
1571
from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Submit from crispy_forms.bootstrap import FormActions from fabric_bolt.hosts import models class HostCreateForm(forms.ModelForm): class Meta: model = models.Host fields = ['name', 'alias'] ...
mit
313a1b2097d2059c6a5a9b6cf0faafe8
24.754098
66
0.616805
3.636574
false
false
false
false
beetbox/beets
beetsplug/deezer.py
1
8660
# This file is part of beets. # Copyright 2019, Rahul Ahuja. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, mod...
mit
dc557fc596a47f56b541b178da8df423
35.851064
79
0.579446
3.972477
false
false
false
false
beetbox/beets
beets/autotag/mb.py
1
22483
# This file is part of beets. # Copyright 2016, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, ...
mit
63e7489c62ab9088f198f8c15fd98ae3
35.146302
79
0.603701
3.901267
false
false
false
false
beetbox/beets
beetsplug/duplicates.py
1
13255
# This file is part of beets. # Copyright 2016, Pedro Silva. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, mod...
mit
f67c26fb7e01ed47550000fda3a00eb9
37.75731
79
0.483516
4.581749
false
false
false
false
beetbox/beets
beetsplug/spotify.py
1
25045
# This file is part of beets. # Copyright 2019, Rahul Ahuja. # Copyright 2022, Alok Saboo. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitatio...
mit
3ee825513dc4c78974ae7fced6e33373
36.380597
116
0.538071
4.260803
false
false
false
false
beetbox/beets
beetsplug/fuzzy.py
2
1465
# This file is part of beets. # Copyright 2016, Philippe Mongeau. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy...
mit
ffa098162395102d9935882f884cebf9
30.847826
71
0.686689
4.173789
false
true
false
false
beetbox/beets
beetsplug/types.py
2
1629
# This file is part of beets. # Copyright 2016, Thomas Scholtes. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy,...
mit
ed95dcc515f38ab222949f417ee5faeb
31.58
71
0.626765
4.379032
false
true
false
false
beetbox/beets
test/test_importfeeds.py
1
2123
import os import os.path import tempfile import shutil import unittest from beets import config from beets.library import Item, Album, Library from beetsplug.importfeeds import ImportFeedsPlugin class ImportfeedsTestTest(unittest.TestCase): def setUp(self): config.clear() config.read(user=False)...
mit
9c10d165d521840fad92227d80434f34
33.241935
72
0.617993
3.604414
false
true
false
false
beetbox/beets
beetsplug/chroma.py
2
11871
# This file is part of beets. # Copyright 2016, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, ...
mit
183ff2c251e754e985b59e843fe5db38
33.408696
79
0.618145
4.00236
false
false
false
false
zarr-developers/zarr-python
zarr/meta_v1.py
1
1655
import json import numpy as np from zarr.errors import MetadataError def decode_metadata(b): s = str(b, 'ascii') meta = json.loads(s) zarr_format = meta.get('zarr_format', None) if zarr_format != 1: raise MetadataError('unsupported zarr format: %s' % zarr_format) try: meta = dict...
mit
75d49d71eca17c041d713a321f2e8ac7
24.859375
72
0.583082
3.661504
false
false
false
false
zarr-developers/zarr-python
zarr/tests/test_convenience.py
1
35689
import atexit import tempfile import unittest from numbers import Integral import numpy as np import pytest from numcodecs import Adler32, Zlib from numpy.testing import assert_array_equal import zarr from zarr.convenience import ( consolidate_metadata, copy, copy_store, load, open, open_conso...
mit
e7a90911565df96089b1f92ab55f9273
34.196252
99
0.583849
3.650675
false
true
false
false
beetbox/beets
beetsplug/fetchart.py
1
44426
# This file is part of beets. # Copyright 2016, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, ...
mit
ffed2a47d11e34c9f1a0aadc6046e399
37.631304
94
0.525368
4.345691
false
false
false
false
beetbox/beets
test/test_ui_commands.py
1
3673
# This file is part of beets. # Copyright 2016, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, ...
mit
577b761cc2e4e2ae3190409021439b6d
29.355372
71
0.633542
3.608055
false
true
false
false
compas-dev/compas
src/compas_rhino/__init__.py
1
9473
""" ************ compas_rhino ************ .. currentmodule:: compas_rhino .. toctree:: :maxdepth: 1 compas_rhino.artists compas_rhino.conduits compas_rhino.conversions compas_rhino.forms compas_rhino.geometry compas_rhino.utilities """ from __future__ import absolute_import import io i...
mit
03152c4285f3462f84c2cd20fd7b9b74
26.780059
118
0.530033
3.874438
false
false
false
false
compas-dev/compas
src/compas/geometry/transformations/projection.py
1
5282
""" This library for transformations partly derived and was re-implemented from the following online resources: * http://www.lfd.uci.edu/~gohlke/code/transformations.py.html * http://www.euclideanspace.com/maths/geometry/rotations/ * http://code.activestate.com/recipes/578108-determinant-of-matrix-of-any-o...
mit
fdd953267e7d75698e58d381d16d1080
32.220126
163
0.61738
4.379768
false
false
false
false
compas-dev/compas
src/compas/files/dxf.py
1
2581
from __future__ import absolute_import from __future__ import division from __future__ import print_function from compas import _iotools class DXF(object): """Class for working with DXF files. Parameters ---------- filepath : path string | file-like object | URL string A path, a file-like ob...
mit
f9a4381adafaf4df9a1102cfd79372e5
24.303922
72
0.598605
4.169628
false
false
false
false
compas-dev/compas
src/compas/data/__init__.py
1
1843
""" ******************************************************************************** data ******************************************************************************** .. currentmodule:: compas.data .. rst-class:: lead This package provides a base data class for all COMPAS data objects such as geometry objects, r...
mit
1ed3a465354e42fcfd02bfb7e6cf52a1
18
122
0.613673
3.784394
false
false
false
false
compas-dev/compas
src/compas_blender/artists/circleartist.py
1
3737
from typing import Any from typing import List from typing import Optional from typing import Union import bpy import compas_blender from compas.geometry import add_vectors from compas.geometry import Circle from compas.artists import PrimitiveArtist from compas.colors import Color from .artist import BlenderArtist ...
mit
0779350d6a181c5b52495acddecf01ff
29.884298
117
0.565962
4.280641
false
false
false
false
compas-dev/compas
src/compas/geometry/offset/offset.py
1
6243
from __future__ import print_function from __future__ import absolute_import from __future__ import division from compas.geometry import scale_vector from compas.geometry import normalize_vector from compas.geometry import add_vectors from compas.geometry import subtract_vectors from compas.geometry import cross_vecto...
mit
6f2f5017e5a0011316d0267a06c3c47e
29.753695
108
0.662182
4.035553
false
false
false
false
compas-dev/compas
src/compas_blender/artists/networkartist.py
1
10273
from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union import bpy from functools import partial import compas_blender from compas.datastructures import Network from compas.geometry import centroid_points from compas.utilitie...
mit
42744a191508d0774214530ef6e7255e
31.926282
124
0.567215
4.495842
false
false
false
false
compas-dev/compas
src/compas/numerical/devo/devo_numpy.py
1
7418
from __future__ import absolute_import from __future__ import division from __future__ import print_function from numpy import array from numpy import argsort from numpy import argmin from numpy import delete from numpy import eye from numpy import floor from numpy import max from numpy import min from numpy import ne...
mit
ef068166218b9407ab0cca35cd3260f1
27.312977
113
0.515638
3.56121
false
false
false
false
compas-dev/compas
src/compas_plotters/artists/meshartist.py
1
23269
from typing import Dict from typing import Tuple from typing import List from typing import Union from typing import Optional from typing import Any from typing_extensions import Literal from matplotlib.collections import LineCollection, PatchCollection from matplotlib.patches import Polygon as PolygonPatch from matp...
mit
699f32819cd7193191885886245584f7
30.744884
127
0.549186
4.286056
false
false
false
false
compas-dev/compas
src/compas/utilities/images.py
1
1411
from __future__ import print_function from __future__ import absolute_import from __future__ import division import os import compas if not compas.IPY: import imageio __all__ = ["gif_from_images"] def gif_from_images( files, gif_path, fps=10, loop=0, reverse=False, pingpong=False, ...
mit
94af30724e48937ddbda4e7d2e456bca
22.915254
107
0.61871
3.876374
false
false
false
false
compas-dev/compas
src/compas/numerical/dr/dr_numpy.py
1
8315
from __future__ import absolute_import from __future__ import division from __future__ import print_function from numpy import array from numpy import isnan from numpy import isinf from numpy import ones from numpy import zeros from scipy.linalg import norm from scipy.sparse import diags from compas.numerical import ...
mit
6cf73fc7e70e410ff0de77677b8cc853
31.354086
103
0.414432
3.75395
false
false
false
false