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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rlworkgroup/metaworld | metaworld/policies/sawyer_door_close_v2_policy.py | 1 | 1745 | import numpy as np
from metaworld.policies.action import Action
from metaworld.policies.policy import Policy, assert_fully_parsed, move
class SawyerDoorCloseV2Policy(Policy):
@staticmethod
@assert_fully_parsed
def _parse_obs(obs):
return {
'hand_pos': obs[:3],
'unused_1':... | mit | c8929190c15231cac9c83237c3f8ffc1 | 31.314815 | 89 | 0.516332 | 3.178506 | false | false | false | false |
rlworkgroup/metaworld | metaworld/policies/sawyer_drawer_close_v2_policy.py | 1 | 1550 | import numpy as np
from metaworld.policies.action import Action
from metaworld.policies.policy import Policy, assert_fully_parsed, move
class SawyerDrawerCloseV2Policy(Policy):
@staticmethod
@assert_fully_parsed
def _parse_obs(obs):
return {
'hand_pos': obs[:3],
'unused_g... | mit | 35ec9d66d5113c80d40b7382ae0c3227 | 30 | 89 | 0.527742 | 3.270042 | false | false | false | false |
rlworkgroup/metaworld | metaworld/envs/mujoco/sawyer_xyz/v1/sawyer_lever_pull.py | 1 | 3590 | import numpy as np
from gym.spaces import Box
from metaworld.envs.asset_path_utils import full_v1_path_for
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
class SawyerLeverPullEnv(SawyerXYZEnv):
def __init__(self):
hand_low = (-0.5, 0.40, -0.15)
han... | mit | 48034d870b099db80073ad70ac37be10 | 29.423729 | 121 | 0.556267 | 3.208222 | false | false | false | false |
hackerspace-ntnu/website | applications/forms.py | 1 | 2195 | from django.core.mail import send_mail
from django.forms import ModelForm, Textarea, TextInput
from django.template.loader import render_to_string
from .models import Application, ApplicationGroupChoice
class ApplicationGroupChoiceField(TextInput):
def value_from_datadict(self, data, files, name):
value ... | mit | 30f3a3cdc9a458fcdc08084432654111 | 31.731343 | 88 | 0.575467 | 4.291585 | false | false | false | false |
python-hyper/hpack | docs/source/conf.py | 1 | 2400 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | mit | f4e8c694b03ca65204156e9e2577ecd1 | 32.333333 | 82 | 0.650417 | 4 | false | true | false | false |
hackerspace-ntnu/website | door/migrations/0001_initial.py | 1 | 1091 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-06-16 22:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='DoorSta... | mit | 7b13ebdd191b0811bf24e586c15923b7 | 29.305556 | 114 | 0.531622 | 4.584034 | false | false | false | false |
hackerspace-ntnu/website | applications/migrations/0001_initial.py | 1 | 1990 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-03-09 22:51
from __future__ import unicode_literals
import applications.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = ... | mit | a4cc92b12f8be08a7a767432eb91b7aa | 47.463415 | 179 | 0.596376 | 3.903733 | false | false | false | false |
hackerspace-ntnu/website | news/views.py | 1 | 15817 | from datetime import datetime, timedelta
from itertools import chain
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.core.exceptions imp... | mit | a3f6145e19f7e4390493fd9fe758e25a | 33.433551 | 89 | 0.632332 | 4.047375 | false | false | false | false |
hackerspace-ntnu/website | projectarchive/models.py | 1 | 2763 | from bleach import clean
from bleach_whitelist import markdown_attrs, markdown_tags
from django.contrib.auth.admin import User
from django.core.validators import MaxLengthValidator
from django.db import models
from django.db.models import Q
from django.utils import timezone
from markdownx.models import MarkdownxField
f... | mit | 1088b1e1310cfe2b40f836edb6401bd7 | 30.386364 | 86 | 0.65677 | 3.912181 | false | false | false | false |
hackerspace-ntnu/website | inventory/tests.py | 1 | 1609 | from django.test import TestCase
from django.urls import reverse
from .models import Item
from .views import InventoryListAPIView
class ItemTests(TestCase):
"""Tests for the Item model"""
def test_in_stock(self):
"""You should be able to check if an item is in stock"""
item = Item.objects.cr... | mit | 7ef6d54d5935ff1345f27ab06d3a2e09 | 32.520833 | 83 | 0.637663 | 4.032581 | false | true | false | false |
xesscorp/skidl | tests/spice_tests/pckg_test.py | 1 | 6436 | import matplotlib.pyplot as plt
from skidl.pyspice import *
sky_lib = SchLib(
"/home/devb/tmp/skywater-pdk/libraries/sky130_fd_pr/latest/models/sky130.lib.spice",
recurse=True,
lib_section="tt",
)
nfet_wl = Parameters(W=1.26, L=0.15)
pfet_wl = Parameters(W=1.26, L=0.15)
pfet = Part(sky_lib, "sky130_fd_p... | mit | 81e8fa54ea1caa27a27c46a62ddc02c8 | 24.641434 | 88 | 0.535115 | 2.449011 | false | false | false | false |
xesscorp/skidl | skidl/libs/mechanical_sklib.py | 1 | 1364 | from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
mechanical = SchLib(tool=SKIDL).add_parts(*[
Part(name='Heatsink',dest=TEMPLATE,tool=SKIDL,keywords='thermal heat temperature',description='Heatsink',ref_prefix='HS',num_units=1,do_erc=True),
Part(name='Heatsink_PAD',dest... | mit | 013b2683d3ca685fda42ca7891e857d9 | 96.428571 | 213 | 0.703079 | 2.939655 | false | false | true | false |
xesscorp/skidl | skidl/libs/wiznet_sklib.py | 1 | 5080 | from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
wiznet = SchLib(tool=SKIDL).add_parts(*[
Part(name='W5100',dest=TEMPLATE,tool=SKIDL,keywords='Wiznet Ethernet controller',description='WizNet W5100 10/100Mb Ethernet controller with TCP/IP stack',ref_prefix='U',num_units=1,fplist... | mit | 58426242e72ee23c3e6cd1a27b0030f8 | 60.204819 | 244 | 0.558858 | 2.56955 | false | false | true | false |
scitran/core | api/auth/__init__.py | 2 | 2582 | from ..types import Origin
from ..web.errors import APIPermissionException
PERMISSIONS = [
{
'rid': 'ro',
'name': 'Read-Only',
},
{
'rid': 'rw',
'name': 'Read-Write',
},
{
'rid': 'admin',
'name': 'Admin',
},
]
INTEGER_PERMISSIONS = {r['rid']: i f... | mit | dec40c6ad4290d87e779417cc0e98694 | 28.340909 | 77 | 0.637103 | 3.972308 | false | false | false | false |
scitran/core | api/jobs/jobs.py | 2 | 15075 | """
Jobs
"""
import bson
import copy
import datetime
import string
from ..types import Origin
from ..dao.containerutil import create_filereference_from_dictionary, create_containerreference_from_dictionary, create_containerreference_from_filereference
from .. import config
from ..util import render_template
from ..w... | mit | 08bdb4eb08cd300724fc10b2f9bb3781 | 31.559395 | 157 | 0.503416 | 4.319484 | false | true | false | false |
scitran/core | tests/integration_tests/python/test_containers.py | 2 | 45024 | import bson
def test_switching_project_between_groups(data_builder, as_admin):
group_1 = data_builder.create_group()
group_2 = data_builder.create_group()
project = data_builder.create_project(group=group_1)
r = as_admin.put('/projects/' + project, json={'group': group_2})
assert r.ok
r = as... | mit | e20e909a3860db0d058331174d09b15a | 31.531792 | 118 | 0.588242 | 3.500816 | false | true | false | false |
xesscorp/skidl | tests/test_interface.py | 1 | 15711 | # -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout.
import copy
import pytest
from skidl import TEMPLATE, Bus, Circuit, Interface, Net, Part, Pin, subcircuit
from .setup_teardown import setup_function, teardown_function
def test_interface_1():
"""Test interface."""
... | mit | 55e0b929d2b4c9573c0bc5bfc2367a5c | 25.185 | 90 | 0.526128 | 2.830811 | false | false | false | false |
scitran/core | api/jobs/rules.py | 2 | 9872 | import fnmatch
import re
from .. import config
from ..types import Origin
from ..dao.containerutil import FileReference
from ..web.errors import APIValidationException
from . import gears
from .jobs import Job
from .queue import Queue
log = config.log
# {
# '_id': 'SOME_ID',
# 'project_id': 'SOME_PRO... | mit | 33eef4c365db3f7b845fe2b61fda45fc | 31.367213 | 137 | 0.587318 | 3.923688 | false | false | false | false |
xesscorp/skidl | skidl/libs/Zilog_sklib.py | 1 | 5393 | from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
Zilog = SchLib(tool=SKIDL).add_parts(*[
Part(name='Z80CPU',dest=TEMPLATE,tool=SKIDL,keywords='Z80 CPU uP',description='8-bit General Purpose Microprocessor, DIP-40',ref_prefix='U',num_units=1,fplist=['DIP*', 'PDIP*'],do_erc=True,... | mit | a5a46ddd770595ad4a23458226ed5b36 | 60.988506 | 215 | 0.545522 | 2.553504 | false | false | true | false |
xesscorp/skidl | skidl/part.py | 1 | 47466 | # -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout.
"""
Handles parts.
"""
from __future__ import ( # isort:skip
absolute_import,
division,
print_function,
unicode_literals,
)
import functools
import re
from builtins import dict, int, object, range, str, super... | mit | 3ba691156ac0fd3eb75870a76ee0c897 | 33.545852 | 114 | 0.550731 | 4.332025 | false | false | false | false |
xesscorp/skidl | skidl/libs/digital-audio_sklib.py | 1 | 28336 | from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
digital_audio = SchLib(tool=SKIDL).add_parts(*[
Part(name='AK5392VS',dest=TEMPLATE,tool=SKIDL,keywords='24bit Sigma Delta Audio ADC 2ch',description='AK5392-VS, Enhanced Audio ADC, 2 channels Sigma Delta, 24bit, SO28',ref_prefix=... | mit | 35eadebbe14de42984813170cb9508be | 64.441109 | 279 | 0.558865 | 2.586345 | false | false | true | false |
xesscorp/skidl | examples/bricolage/briccolage_galg.py | 1 | 10207 | from random import choice, randint
import numpy as np
import matplotlib.pyplot as plt
from skidl.pyspice import *
import traceback
lib_search_paths[SPICE].append('SpiceLib')
@subcircuit
def vreg(vin, vout, vadj, gnd):
'''Voltage regulator similar to NCP1117.'''
v_bandgap = v(dc_value=1.25 @ u_V) # Bandgap vo... | mit | 809f84ac051bccc77a4ed06f0612d41d | 36.251825 | 195 | 0.588028 | 3.037798 | false | false | false | false |
xesscorp/skidl | skidl/logger.py | 1 | 7557 | # -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout.
"""
Logging for generic messages and ERC.
"""
from __future__ import ( # isort:skip
absolute_import,
division,
print_function,
unicode_literals,
)
import logging
import os
import queue
import sys
from builtin... | mit | 3a8f84b460f0ddac6b7e0d7630b4ae9b | 30.098765 | 100 | 0.600371 | 4.089286 | false | false | false | false |
twisted/txaws | txaws/testing/payload.py | 2 | 34115 | from txaws import version
sample_get_console_output_result = """\
<GetConsoleOutputResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
<instanceId>i-abcdef0123456789</instanceId>
<timestamp>2010-10-14T01:12:41.000Z</timestamp>
<output>TGludXggd... | mit | 9caabb39697334f960df142982a64f26 | 28.79476 | 86 | 0.655811 | 2.80551 | false | false | false | false |
twisted/txaws | txaws/server/registry.py | 3 | 2546 | from txaws.server.exception import APIError
class Registry(object):
"""Register API L{Method}s. for handling specific actions and versions"""
def __init__(self):
self._by_action = {}
def add(self, method_class, action, version=None):
"""Add a method class to the regitry.
@param ... | mit | 4186dacdcd1380c5035110ad361becb3 | 37.575758 | 78 | 0.60055 | 4.420139 | false | false | false | false |
davidhalter/jedi-vim | pythonx/jedi_vim.py | 1 | 41069 | # -*- coding: utf-8 -*-
"""
The Python parts of the Jedi library for VIM. It is mostly about communicating
with VIM.
"""
from typing import Optional
import traceback # for exception output
import re
import os
import sys
from shlex import split as shsplit
from contextlib import contextmanager
from pathlib import Path
... | mit | 778727e55b499f5dc79e46c44e428ae2 | 32.854081 | 97 | 0.562182 | 3.752284 | false | false | false | false |
cleverhans-lab/cleverhans | cleverhans_v3.1.0/examples/nips17_adversarial_competition/dev_toolkit/sample_targeted_attacks/step_target_class/attack_step_target_class.py | 1 | 5595 | """Implementation of sample attack."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import os
import numpy as np
import tensorflow as tf
from tensorflow.contrib.slim.nets import inception
from scipy.misc import imread
from scipy.misc import i... | mit | d9c1aa7a939e6ddc6f008b260bb86fd1 | 34.865385 | 87 | 0.622163 | 3.649706 | false | false | false | false |
alkaline-ml/pmdarima | pmdarima/compat/matplotlib.py | 2 | 2244 | # -*- coding: utf-8 -*-
#
# Author: Taylor G Smith <taylor.smith@alkaline-ml.com>
#
# Patch backend for MPL
import sys
import os
__all__ = [
'get_compatible_pyplot',
'mpl_hist_arg'
]
def get_compatible_pyplot(backend=None, debug=True):
"""Make the backend of MPL compatible.
In Travis Mac distributi... | mit | fc9e511d17f65983fe0b903bff4ae51f | 27.769231 | 77 | 0.627005 | 4.25 | false | false | false | false |
cleverhans-lab/cleverhans | cleverhans_v3.1.0/cleverhans_tutorials/mnist_tutorial_tf.py | 1 | 8278 | """
This tutorial shows how to generate adversarial examples using FGSM
and train a model using adversarial training with TensorFlow.
It is very similar to mnist_tutorial_keras_tf.py, which does the same
thing but with a dependence on keras.
The original paper can be found at:
https://arxiv.org/abs/1412.6572
"""
# pyli... | mit | 21e1cfc776eadeec36fe82d06b5d7a1e | 32.51417 | 84 | 0.651365 | 3.558899 | false | true | false | false |
alkaline-ml/pmdarima | pmdarima/arima/utils.py | 2 | 6450 | # -*- coding: utf-8 -*-
#
# Author: Taylor Smith <taylor.smith@alkaline-ml.com>
#
# Common ARIMA functions
from sklearn.utils.validation import column_or_1d
import numpy as np
import warnings
from .. import context_managers as ctx
from ..utils import get_callable
from ..utils.array import diff, check_endog
from ..co... | mit | 61ad1f43c6891e2582df26672dd87d74 | 29.424528 | 125 | 0.593488 | 3.765324 | false | true | false | false |
alkaline-ml/pmdarima | pmdarima/datasets/heartrate.py | 2 | 4646 | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from ..compat import DTYPE
__all__ = [
'load_heartrate'
]
def load_heartrate(as_series=False, dtype=DTYPE):
"""Uniform heart-rate data.
A sample of heartrate data borrowed from an
`MIT database <http://ecg.mit.edu/time-series/>`_. The ... | mit | 32994c993dc2316d4c937a311bb36cbd | 42.420561 | 78 | 0.579423 | 2.364377 | false | false | false | false |
cleverhans-lab/cleverhans | cleverhans_v3.1.0/examples/adversarial_asr/generate_robust_adv.py | 1 | 24951 | import tensorflow as tf
from lingvo import model_imports
from lingvo import model_registry
import numpy as np
import scipy.io.wavfile as wav
import generate_masking_threshold as generate_mask
from tool import create_features, create_inputs, create_speech_rir
import time
from lingvo.core import cluster_factory
from absl... | mit | 4fcd94f96b08dff40853717df0fa163f | 35.056358 | 112 | 0.452487 | 4.189924 | false | false | false | false |
cleverhans-lab/cleverhans | cleverhans_v3.1.0/examples/multigpu_advtrain/utils_svhn.py | 1 | 3364 | """
Reading the SVHN dataset. It is derived from CIFAR10 scripts in RevNets code.
https://github.com/renmengye/revnet-public/blob/master/resnet/data/cifar_input.py
MIT License
Copyright (c) 2017 Mengye Ren
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated d... | mit | c142309284dc48224f3189becaaa1b24 | 33.326531 | 82 | 0.699168 | 3.401416 | false | true | false | false |
cleverhans-lab/cleverhans | cleverhans_v3.1.0/examples/nips17_adversarial_competition/dataset/download_images.py | 1 | 4974 | """Script which downloads dataset images.
Usage:
python download_images.py --input_file=INPUT_FILE --output_dir=IMAGES_DIR
where:
INPUT_FILE is input csv file with dataset description, i.e. dev_dataset.csv
IMAGES_DIR is output directory where all images should be downloaded
Example:
# create directory for im... | mit | 380987a9f37f059f0af224dd6cb78ac6 | 29.515337 | 86 | 0.599517 | 3.630657 | false | false | false | false |
cleverhans-lab/cleverhans | cleverhans/jax/utils.py | 1 | 1349 | import jax.numpy as np
def one_hot(x, k, dtype=np.float32):
"""Create a one-hot encoding of x of size k."""
return np.array(x[:, None] == np.arange(k), dtype)
def partial_flatten(x):
"""Flatten all but the first dimension of an ndarray."""
return np.reshape(x, (x.shape[0], -1))
def clip_eta(eta, n... | mit | b5ef119b2ebfc9756cafa987d2dbd1ac | 33.589744 | 109 | 0.621201 | 3.3725 | false | false | false | false |
cleverhans-lab/cleverhans | cleverhans_v3.1.0/examples/RL-attack/model.py | 1 | 4084 | import tensorflow as tf
import tensorflow.contrib.layers as layers
from rlattack.common.tf_util import noisy_dense
def model(img_in, num_actions, scope, noisy=False, reuse=False, concat_softmax=False):
with tf.variable_scope(scope, reuse=reuse):
out = img_in
with tf.variable_scope("convnet"):
... | mit | 2ac7a8f7a94eab321d7fc0c30d42fb8d | 41.103093 | 86 | 0.537218 | 3.968902 | false | false | false | false |
gratipay/gratipay.com | gratipay/billing/instruments.py | 4 | 1787 | import braintree
import balanced
class CreditCard:
def __init__(self, *args, **kwargs):
fields = [
'card_type',
'number',
'expiration_year',
'expiration_month',
'address_line1',
'address_line2',
'address_city',
... | mit | f03c35813179ae1fbad881cdd739f81a | 35.469388 | 84 | 0.524902 | 4.369193 | false | false | false | false |
gratipay/gratipay.com | tests/py/test_history.py | 1 | 8281 | from __future__ import absolute_import, division, print_function, unicode_literals
from datetime import datetime
import json
from mock import patch
from gratipay.billing.payday import Payday
from gratipay.models.participant import Participant
from gratipay.testing import Harness, D,P
from gratipay.testing.billing im... | mit | a63abb83d269048116a44f2e72f17b3b | 36.301802 | 102 | 0.594252 | 3.581747 | false | true | false | false |
gratipay/gratipay.com | bin/update-user-info.py | 4 | 5484 | #!/usr/bin/env python
"""This is a one-off script to update user_info for #1936.
This could be generalized for #900.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import time
import sys
import requests
from gratipay import wireup
from requests_oauthlib import OAuth1... | mit | ca95ee48203a9412e9d0be23cbeb53bd | 29.466667 | 93 | 0.50547 | 4.205521 | false | false | false | false |
gratipay/gratipay.com | tests/py/test_participant_routes.py | 1 | 1996 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from gratipay.testing import Harness
from gratipay.models.exchange_route import ExchangeRoute
class GetPayoutRoutes(Harness):
def test_gets_payout_routes(self):
alice = self.make_participant('alice... | mit | baa1c70f951f30f849fe070450d1b995 | 42.391304 | 93 | 0.65481 | 3.459272 | false | true | false | false |
has2k1/plotnine | plotnine/stats/stat_quantile.py | 1 | 2484 | from warnings import warn
import pandas as pd
import statsmodels.formula.api as smf
from ..doctools import document
from ..exceptions import PlotnineWarning
from .stat import stat
# method_args are any of the keyword args (other than q) for
# statsmodels.regression.quantile_regression.QuantReg.fit
@document
class s... | mit | f3328cc9decea906c942ed4a56c239cb | 27.551724 | 72 | 0.592995 | 3.735338 | false | false | false | false |
has2k1/plotnine | plotnine/themes/theme_linedraw.py | 1 | 1345 | from .elements import element_line, element_rect, element_text, element_blank
from .theme import theme
from .theme_gray import theme_gray
class theme_linedraw(theme_gray):
"""
A theme with only black lines of various widths on white backgrounds
Parameters
----------
base_size : int, optional
... | mit | acba34df4487e0e99dc1054a4b8e4c9a | 39.757576 | 79 | 0.617844 | 3.736111 | false | false | false | false |
has2k1/plotnine | plotnine/stats/stat_sum.py | 1 | 1685 | from ..mapping.aes import ALL_AESTHETICS
from ..mapping.evaluation import after_stat
from ..utils import groupby_apply
from ..doctools import document
from .stat import stat
@document
class stat_sum(stat):
"""
Sum unique values
Useful for overplotting on scatterplots.
{usage}
Parameters
---... | mit | eee12f18c62461d777eeffa2b3a386ab | 24.530303 | 68 | 0.543027 | 3.820862 | false | false | false | false |
has2k1/plotnine | plotnine/geoms/geom_segment.py | 1 | 2555 | import numpy as np
import pandas as pd
import matplotlib.collections as mcoll
from ..utils import to_rgba, make_line_segments, interleave
from ..utils import SIZE_FACTOR
from ..doctools import document
from .geom import geom
@document
class geom_segment(geom):
"""
Line segments
{usage}
Parameters
... | mit | ec4262d84dcaa7dabac48bee4828b927 | 31.341772 | 71 | 0.542857 | 3.847892 | false | false | false | false |
has2k1/plotnine | tests/test_geom_segment.py | 1 | 1315 | import pandas as pd
from plotnine import ggplot, aes, geom_segment, arrow, theme
n = 4
# stepped horizontal line segments
df = pd.DataFrame({
'x': range(1, n+1),
'xend': range(2, n+2),
'y': range(n, 0, -1),
'yend': range(n, 0, -1),
'z': range(1, n+1)
})
_theme = theme(sub... | mit | e7b95556e3f2e08c41eebba8af4d6e58 | 29.581395 | 73 | 0.504183 | 2.955056 | false | false | false | false |
has2k1/plotnine | tests/test_geom_map.py | 1 | 3539 | import numpy as np
from geopandas import GeoDataFrame
from shapely.geometry import (
Point,
Polygon,
LineString,
MultiPoint,
MultiPolygon,
MultiLineString
)
from plotnine import ggplot, aes, geom_map, labs, theme, facet_wrap
_theme = theme(subplots_adjust={'right': 0.85})
def test_geometries... | mit | 20d97f19a75e5c894684f793b601d22c | 27.772358 | 75 | 0.529811 | 3.053494 | false | false | false | false |
has2k1/plotnine | plotnine/positions/position_jitter.py | 1 | 1831 | from copy import deepcopy
import numpy as np
from ..utils import jitter, resolution
from .position import position
class position_jitter(position):
"""
Jitter points to avoid overplotting
Parameters
----------
width : float
Proportion to jitter in horizontal direction.
Default i... | mit | 2b90b7c4475a7139414147b0bae34e8d | 31.122807 | 67 | 0.568542 | 4.25814 | false | false | false | false |
has2k1/plotnine | plotnine/geoms/geom_bar.py | 1 | 1226 | from ..utils import resolution
from ..doctools import document
from .geom_rect import geom_rect
@document
class geom_bar(geom_rect):
"""
Bar plot
{usage}
Parameters
----------
{common_parameters}
width : float, optional (default None)
Bar width. If :py:`None`, the width is set to... | mit | 0e1fae915f8b3f51cdf7808ba0c90815 | 25.085106 | 66 | 0.510604 | 3.553623 | false | false | false | false |
has2k1/plotnine | plotnine/geoms/geom_errorbarh.py | 1 | 1751 | import numpy as np
import pandas as pd
from ..utils import copy_missing_columns, resolution
from ..doctools import document
from .geom import geom
from .geom_segment import geom_segment
@document
class geom_errorbarh(geom):
"""
Horizontal interval represented as an errorbar
{usage}
Parameters
-... | mit | e4e58353e3ec1571443eb7f2d420b7f5 | 31.425926 | 70 | 0.543689 | 3.701903 | false | false | false | false |
has2k1/plotnine | plotnine/themes/theme_538.py | 1 | 1359 | from .elements import (element_line, element_rect,
element_text, element_blank)
from .theme import theme
from .theme_gray import theme_gray
class theme_538(theme_gray):
"""
Theme in the likeness of fivethirtyeight.com plots
Parameters
----------
base_size : int, optional
... | mit | 3b0b62433ecaae6727f908ec99b3531d | 31.357143 | 64 | 0.548197 | 4.032641 | false | false | false | false |
has2k1/plotnine | tests/test_geom_text_label.py | 1 | 2879 | import pandas as pd
import numpy as np
from plotnine import (ggplot, aes, geom_text, geom_label, geom_point,
scale_size_continuous, scale_y_continuous)
from plotnine.data import mtcars
n = 5
labels = ['ggplot', 'aesthetics', 'data', 'geoms',
r'$\mathbf{statistics^2}$', 'scales', 'coord... | mit | 332bc02a8fdf482969a403b5bbbeba15 | 31.715909 | 76 | 0.524835 | 3.12256 | false | true | false | false |
has2k1/plotnine | plotnine/themes/theme_matplotlib.py | 1 | 3385 | import matplotlib as mpl
from ..options import get_option
from .theme import theme
from .elements import element_rect, element_text
class theme_matplotlib(theme):
"""
The default matplotlib look and feel.
The theme can be used (and has the same parameter
to customize) like a :class:`matplotlib.rc_co... | mit | ee8392f49ee3e7a6c14345bddd15b345 | 31.548077 | 70 | 0.489808 | 4.02497 | false | false | false | false |
has2k1/plotnine | plotnine/geoms/geom_smooth.py | 1 | 2877 | from matplotlib.patches import Rectangle
from ..doctools import document
from .geom import geom
from .geom_ribbon import geom_ribbon
from .geom_line import geom_line
from .geom_line import geom_path
@document
class geom_smooth(geom):
"""
A smoothed conditional mean
{usage}
Parameters
----------... | mit | 04d7aababaad8d0c4b1ee54009b6ef8d | 29.284211 | 70 | 0.519986 | 3.951923 | false | false | false | false |
has2k1/plotnine | plotnine/geoms/geom_boxplot.py | 1 | 8832 | from warnings import warn
import numpy as np
import pandas as pd
import matplotlib.lines as mlines
from matplotlib.patches import Rectangle
from ..doctools import document
from ..exceptions import PlotnineWarning
from ..positions import position_dodge2
from ..positions.position import position
from ..utils import mak... | mit | ab1e9e36adecfe0efd45e1e34156f657 | 35.8 | 75 | 0.519588 | 4.079446 | false | false | false | false |
has2k1/plotnine | plotnine/themes/theme_void.py | 1 | 2709 | from ..options import get_option
from .elements import element_text, element_blank
from .theme import theme
class theme_void(theme):
"""
A classic-looking theme, with x & y axis lines and
no gridlines.
Parameters
----------
base_size : int, optional
Base font size. All text sizes are ... | mit | 9e35c244cdf303b6392391c7e41aa5c3 | 32.036585 | 70 | 0.481728 | 4.037258 | false | false | false | false |
has2k1/plotnine | plotnine/data/__init__.py | 1 | 14889 | """
Plotnine Data
"""
from pathlib import Path
import pandas as pd
from pandas.api.types import CategoricalDtype
__all__ = ['diamonds', 'economics', 'economics_long',
'midwest', 'mpg', 'msleep', 'presidential',
'seals', 'txhousing', 'luv_colours',
'faithful', 'faithfuld',
#... | mit | 791d0a88cda38ed3c70922ffc79a536b | 27.852427 | 78 | 0.601252 | 3.464444 | false | false | false | false |
has2k1/plotnine | plotnine/stats/density.py | 1 | 5968 | """
Kernel Density Functions
These functions make it easy to integrate stats that compute
kernel densities with the wider scientific python ecosystem.
Credit: Jake VanderPlas for the original kde_* functions
https://jakevdp.github.io/blog/2013/12/01/kernel-density-estimation/
"""
from contextlib import suppress
impo... | mit | ae0d3028b7f419346b356cea68838341 | 25.762332 | 74 | 0.628016 | 3.976016 | false | false | false | false |
psd-tools/psd-tools | src/psd_tools/composite/effects.py | 2 | 1825 | import numpy as np
from skimage import filters
from skimage.morphology import disk
import logging
from psd_tools.terminology import Enum, Key
from .vector import (
draw_solid_color_fill, draw_pattern_fill, draw_gradient_fill
)
import psd_tools.composite
logger = logging.getLogger(__name__)
def draw_stroke_effec... | mit | d8ad8be157aec6fd672ed9992ae8376c | 32.181818 | 72 | 0.64 | 3.443396 | false | false | false | false |
psd-tools/psd-tools | tests/psd_tools/api/test_effects.py | 2 | 5969 | from __future__ import absolute_import, unicode_literals
import pytest
import logging
from psd_tools.api.psd_image import PSDImage
from psd_tools.terminology import Enum
from ..utils import full_name
logger = logging.getLogger(__name__)
LAYER_EFFECTS = PSDImage.open(full_name('layer_effects.psd'))
@pytest.fixture... | mit | 49f24f3c410659b032aaa33c5298b7f9 | 29.146465 | 61 | 0.697102 | 3.780241 | false | true | false | false |
psd-tools/psd-tools | src/psd_tools/composer/blend.py | 2 | 8700 | """
Blending module.
Check Blending_ section of W3C recommendation for blending mode definitions.
.. _Blending: https://www.w3.org/TR/compositing/#blending
"""
from __future__ import absolute_import, unicode_literals
import logging
from psd_tools.utils import new_registry
from psd_tools.constants import BlendMode
fr... | mit | 6dd2f35d01f3ccba6729277705ee5c1f | 24.217391 | 78 | 0.607241 | 2.693498 | false | false | false | false |
summernote/django-summernote | djs_playground/migrations/0002_author_book.py | 1 | 1075 | # Generated by Django 2.0 on 2018-02-22 05:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('djs_playground', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Author',
... | mit | 38a5216d874308b35023ff682e570b4f | 33.677419 | 119 | 0.564651 | 4.199219 | false | false | false | false |
psd-tools/psd-tools | src/psd_tools/psd/effects_layer.py | 2 | 13044 | """
Effects layer structure.
Note the structures in this module is obsolete and object-based layer effects
are stored in tagged blocks.
"""
from __future__ import absolute_import, unicode_literals
import attr
import logging
from psd_tools.constants import BlendMode, EffectOSType
from psd_tools.psd.base import BaseEle... | mit | c2bf42ec384a65c6b321be84291a65bd | 32.106599 | 79 | 0.607636 | 3.43806 | false | false | false | false |
biocore-ntnu/pyranges | pyranges/multioverlap.py | 1 | 6679 | import pyranges as pr
import numpy as np
def count_overlaps(grs, features=None, strandedness=None, how=None, nb_cpu=1):
"""Count overlaps in multiple pyranges.
Parameters
----------
grs : dict of PyRanges
The PyRanges to use as queries.
features : PyRanges, default None
The P... | mit | c80f0fbffcd31fc0346e89c1568471d3 | 40.74375 | 113 | 0.382991 | 3.88766 | false | false | false | false |
reanahub/reana-client | tests/test_validate_compute_backends.py | 1 | 5756 | # -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2022 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA client validate compute backends tests."""
import pytest
import yaml
from reana_com... | mit | 3cdd9741f98598df4b6b1c669ad213b4 | 36.376623 | 87 | 0.668346 | 4.062103 | false | true | false | false |
rsheftel/pandas_market_calendars | pandas_market_calendars/exchange_calendar_bse.py | 1 | 14952 | """
Bombay Stock Exchnage
"""
from pandas import Timestamp
from pytz import timezone
from datetime import time
from .market_calendar import MarketCalendar
BSEClosedDay = [
Timestamp('1997-01-23', tz='UTC'),
Timestamp('1997-03-07', tz='UTC'),
Timestamp('1997-03-24', tz='UTC'),
Timestamp('1997-04-08', ... | mit | 3cf9c5c68e54dd4e13394309d7528dc5 | 37.635659 | 80 | 0.574706 | 2.976115 | false | false | false | false |
biocore-ntnu/pyranges | pyranges/methods/k_nearest.py | 1 | 5401 | import numpy as np
import pandas as pd
from time import time
from sorted_nearest import k_nearest_previous_nonoverlapping, k_nearest_next_nonoverlapping, get_all_ties
try:
dummy = profile
except NameError:
profile = lambda x: x
def nearest_previous_idx(d1, d2, k, ties=None):
d1s = d1.Start.sort_values()... | mit | 3e2f20daee8f237d26ba76ab08c543fe | 24.00463 | 105 | 0.572116 | 2.772587 | false | false | false | false |
biocore-ntnu/pyranges | pyranges/methods/attr.py | 1 | 1808 | import pyranges as pr
import numpy as np
import pandas as pd
def _setattr(self, column_name, column, pos=False):
if not len(self):
return
isiterable = isinstance(column, (list, pd.Series, np.ndarray))
isdict = isinstance(column, dict)
if isiterable:
if not len(self) == len(column):
... | mit | dfb9eb6cc97fe4383820229bc9b17827 | 25.985075 | 81 | 0.587389 | 3.689796 | false | false | false | false |
reanahub/reana-client | reana_client/cli/ping.py | 1 | 3768 | # -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA client configuration commands."""
import json
import lo... | mit | 8666a24e75e292410b54c5b1effcaf61 | 27.984615 | 88 | 0.605361 | 3.852761 | false | true | false | false |
rsheftel/pandas_market_calendars | pandas_market_calendars/exchange_calendar_tase.py | 1 | 4284 | from datetime import time
from pandas import Timestamp
from pytz import timezone
from .market_calendar import MarketCalendar
TASEClosedDay = [
# 2019
Timestamp('2019-03-21', tz='Asia/Jerusalem'),
Timestamp('2019-04-09', tz='Asia/Jerusalem'),
Timestamp('2019-04-25', tz='Asia/Jerusalem'),
T... | mit | d99e61cf5d2be688b2a832b4de9e2b2c | 34 | 119 | 0.628385 | 2.92823 | false | false | false | false |
biocore-ntnu/pyranges | pyranges/multithreaded.py | 1 | 12706 | import numpy as np
import pandas as pd
import pyranges as pr
from natsort import natsorted
import os
ray = None
def get_n_args(f):
import inspect
nparams = len(inspect.signature(f).parameters)
return nparams
def call_f(f, nparams, df, odf, kwargs):
if nparams == 3:
return f.remote(df, ... | mit | 8ac97dbb0911198ac0bde84e38f7644f | 23.671845 | 105 | 0.545412 | 3.587239 | false | false | false | false |
nerevu/riko | riko/modules/strconcat.py | 1 | 4333 | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.modules.strconcat
~~~~~~~~~~~~~~~~~~~~~~
Provides functions for concatenating strings (aka stringbuilder).
Useful when you need to build a string from multiple substrings, some coded
into the pipe, other parts supplied when the pipe is run.
Examples:
bas... | mit | b0641dc0c01fbec3ecc282cc9f7691c0 | 28.882759 | 79 | 0.558735 | 4.186473 | false | false | false | false |
beproud/beproudbot | src/haro/plugins/alias.py | 1 | 5493 | from prettytable import PrettyTable
from slackbot.bot import respond_to
from db import Session
from haro.botmessage import botsend
from haro.decorators import call_when_sls_haro_not_installed
from haro.plugins.alias_models import UserAliasName
from haro.slack import get_user_name, get_slack_id_by_name
HELP = """
- `$a... | mit | 3ef6ef546bdc7f42c79e1f0565231fca | 31.257353 | 83 | 0.648279 | 2.172858 | false | false | false | false |
beproud/beproudbot | src/haro/plugins/create_models.py | 1 | 1049 | import datetime
from sqlalchemy import Column, Integer, Unicode, DateTime, ForeignKey
from sqlalchemy.orm import relation
from db import Base
class CreateCommand(Base):
"""語録を登録するコマンドを管理するModel
"""
__tablename__ = 'create_command'
id = Column(Integer, primary_key=True)
name = Column(Unicode(100)... | mit | 6cc3a41536c532784303f952cb242b26 | 29.53125 | 75 | 0.692938 | 3.289562 | false | false | false | false |
beproud/beproudbot | src/haro/plugins/kintai.py | 1 | 6334 | import csv
import datetime
import random
from calendar import monthrange
from collections import defaultdict, OrderedDict
from io import StringIO
import requests
from slackbot import settings
from slackbot.bot import respond_to, listen_to
from sqlalchemy import func, Date, cast
from db import Session
from haro.botmess... | mit | 4eeca8e391d85a27340b472e23ca9e2f | 28.411765 | 80 | 0.616727 | 2.465262 | false | false | false | false |
beproud/beproudbot | src/haro/slack.py | 1 | 1965 | import logging
from cachetools.func import ttl_cache
import slacker
from slackbot import settings
logger = logging.getLogger(__name__)
@ttl_cache(ttl=60 * 60 * 4)
def get_users_info():
"""SlackAPIのusersAPIをキャッシュする
Slacker で users.list API を呼び出す
- https://github.com/os/slacker
- https://api.slack.co... | mit | 6d8386b0a7bce53351c5b29bbe8d2e7b | 23.957143 | 61 | 0.62221 | 2.759874 | false | false | false | false |
beproud/beproudbot | src/alembic/migrations/versions/98ecbc1e5b66_add_emergency_models.py | 1 | 1598 | """add emergency models
Revision ID: 98ecbc1e5b66
Revises: 8e7a2acd24b8
Create Date: 2019-04-26 14:07:15.245678
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '98ecbc1e5b66'
down_revision = '8e7a2acd24b8'
branch_labels = None
depends_on = None
def upgrade():
... | mit | 2cd4a528bc25feebb7e6f71bbb84c549 | 33 | 74 | 0.671464 | 3.329167 | false | false | false | false |
raelgc/scudcloud | scudcloud/leftpane.py | 1 | 2425 | from scudcloud.resources import Resources
from PyQt5 import QtCore
from PyQt5.QtCore import QUrl
from PyQt5.QtWebKit import QWebSettings
from PyQt5.QtWebKitWidgets import QWebView
class LeftPane(QWebView):
def __init__(self, window):
QWebView.__init__(self)
self.window = window
with open(... | mit | 7b0d5f5fedd58d1d92809787cdf0ab3a | 34.661765 | 137 | 0.638351 | 3.771384 | false | false | false | false |
raelgc/scudcloud | setup.py | 1 | 2551 | #!/usr/bin/env python3
from setuptools import setup
from setuptools.command.build_py import build_py
from distutils import log
from scudcloud.version import __version__
import glob
import os
class MinifyJsBuildCommand(build_py):
"""
Processes JavaScript files with jsmin to yield minified versions.
"""
... | mit | 7c0652536315bca58d2cd2ce3180d21a | 33.945205 | 88 | 0.610349 | 3.494521 | false | false | false | false |
cmu-delphi/delphi-epidata | src/server/endpoints/covid_hosp_state_timeseries.py | 1 | 9053 | from flask import Blueprint
from .._query import execute_query, QueryBuilder
from .._validate import extract_integers, extract_strings, extract_date, require_all
# first argument is the endpoint name
bp = Blueprint("covid_hosp_state_timeseries", __name__)
alias = "covid_hosp"
@bp.route("/", methods=("GET", "POST"))... | mit | 4b4c19bc49217a9b27cc12732283ddbc | 52.568047 | 290 | 0.684083 | 3.100342 | false | false | false | false |
cmu-delphi/delphi-epidata | src/acquisition/covid_hosp/state_timeseries/database.py | 1 | 15938 | # first party
from delphi.epidata.acquisition.covid_hosp.common.database import Database as BaseDatabase
from delphi.epidata.acquisition.covid_hosp.common.database import Columndef
from delphi.epidata.acquisition.covid_hosp.common.utils import Utils
class Database(BaseDatabase):
TABLE_NAME = 'covid_hosp_state_time... | mit | d2b6060b250cd57675e2be15eebc5a52 | 69.211454 | 109 | 0.731773 | 3.070314 | false | false | false | false |
cmu-delphi/delphi-epidata | src/server/endpoints/kcdc_ili.py | 1 | 1162 | from flask import Blueprint
from .._query import execute_query, QueryBuilder
from .._validate import extract_integer, extract_integers, extract_strings, require_all
# first argument is the endpoint name
bp = Blueprint("kcdc_ili", __name__)
alias = None
@bp.route("/", methods=("GET", "POST"))
def handle():
requi... | mit | 05e11eba794723cf4c34a11639ffa8f4 | 28.05 | 87 | 0.648881 | 3.417647 | false | false | false | false |
cmu-delphi/delphi-epidata | integrations/acquisition/covidcast/test_covidcast_meta_caching.py | 1 | 5429 | """Integration tests for covidcast's metadata caching."""
# standard library
import json
import unittest
# third party
import mysql.connector
import requests
# first party
from delphi_utils import Nans
from delphi.epidata.client.delphi_epidata import Epidata
import delphi.operations.secrets as secrets
import delphi.... | mit | 3041d0e84ceffe15d2f1f722b9e757ac | 29.329609 | 97 | 0.625714 | 3.37205 | false | true | false | false |
cmu-delphi/delphi-epidata | src/server/_validate.py | 1 | 5852 | from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
from flask import request
from ._exceptions import UnAuthenticatedException, ValidationFailedException
from .utils import TimeValues
def resolve_auth_token() -> Optional[str]:
# auth request param
if "auth" in request.values:
... | mit | a1d7477fbb1e4d84d3636361dd8a6354 | 29.962963 | 93 | 0.605776 | 3.978246 | false | false | false | false |
cmu-delphi/delphi-epidata | src/server/endpoints/wiki.py | 1 | 2959 | from flask import Blueprint, request
from .._query import execute_query, filter_dates, filter_integers, filter_strings
from .._validate import extract_integers, extract_strings, require_all, require_any
# first argument is the endpoint name
bp = Blueprint("wiki", __name__)
alias = None
@bp.route("/", methods=("GET"... | mit | f0fc587ebb4f736206396413185dee1a | 46.725806 | 270 | 0.644812 | 3.539474 | false | false | false | false |
deepchem/deepchem | examples/roitberg/pyanitools.py | 6 | 4201 | # Written by Roman Zubatyuk and Justin S. Smith
# Modified by Yutong Zhao to make python2 compatible
import h5py
import numpy as np
import platform
import os
PY_VERSION = int(platform.python_version().split('.')[0]) > 3
class datapacker(object):
def __init__(self, store_file, mode='w-', complib='gzip', complevel=... | mit | 8501308864e98f19b8124db0cf77fde8 | 26.279221 | 108 | 0.591288 | 3.320949 | false | false | false | false |
deepchem/deepchem | deepchem/models/IRV.py | 4 | 4183 | import logging
import numpy as np
import tensorflow as tf
from deepchem.models import KerasModel, layers
from deepchem.models.losses import SigmoidCrossEntropy
from deepchem.trans import undo_transforms
from tensorflow.keras.layers import Input, Layer, Activation, Concatenate, Lambda
class IRVLayer(Layer):
""" Cor... | mit | fd80036eaf8a948107a623bb774719d2 | 29.757353 | 104 | 0.61726 | 3.384304 | false | false | false | false |
deepchem/deepchem | deepchem/utils/coordinate_box_utils.py | 3 | 12127 | """This module adds utilities for coordinate boxes"""
from typing import List, Sequence, Tuple
import numpy as np
from scipy.spatial import ConvexHull
class CoordinateBox(object):
"""A coordinate box that represents a block in space.
Molecular complexes are typically represented with atoms as
coordinate points... | mit | bba73cff4d52748f051fdc507fc62224 | 31.167109 | 80 | 0.62901 | 3.35649 | false | false | false | false |
deepchem/deepchem | deepchem/models/jax_models/jax_model.py | 1 | 25099 | import numpy as np
import time
import logging
from collections.abc import Sequence as SequenceCollection
from deepchem.data import Dataset, NumpyDataset
from deepchem.metrics import Metric
from deepchem.models.models import Model
from deepchem.models.losses import Loss
from deepchem.models.optimizers import Optimizer,... | mit | df7c5d2824f4a1bcde7672baa3f4c73e | 35.481105 | 119 | 0.628192 | 4.080475 | false | false | false | false |
deepchem/deepchem | contrib/rl/tictactoe.py | 4 | 2508 | import copy
import random
import shutil
import numpy as np
import tensorflow as tf
import deepchem as dc
import deepchem.rl.envs.tictactoe
from deepchem.models.tensorgraph.layers import Flatten, Dense, SoftMax, \
BatchNorm, Squeeze
from deepchem.models.optimizers import Adam
class TicTacToePolicy(dc.rl.Policy):... | mit | 6a0f7bcf79e242702e700d97ffa7b63e | 25.125 | 73 | 0.610447 | 3.15869 | false | false | false | false |
deepchem/deepchem | deepchem/models/tests/test_layers.py | 1 | 31669 | import deepchem as dc
import numpy as np
import pytest
try:
import tensorflow as tf
import deepchem.models.layers as layers
from tensorflow.python.framework import test_util
has_tensorflow = True
except:
has_tensorflow = False
try:
import torch
import deepchem.models.torch_models.layers as torch_layers
... | mit | c84863254e1a6c81c764f31682ce961c | 34.187778 | 100 | 0.656983 | 3.183454 | false | true | false | false |
deepchem/deepchem | deepchem/hyper/tests/test_random_hyperparam_opt.py | 1 | 8422 | """
Tests for random hyperparam optimization.
"""
import unittest
import tempfile
import numpy as np
import pytest
import deepchem as dc
import sklearn
import sklearn.ensemble
import os
from scipy.stats import uniform
class TestRandomHyperparamOpt(unittest.TestCase):
"""
Test random hyperparameter optimization AP... | mit | 235c987f1a9c2724f900755a9510034e | 37.990741 | 97 | 0.612444 | 3.676124 | false | true | false | false |
deepchem/deepchem | deepchem/hyper/random_search.py | 1 | 11216 | """
Contains class for random hyperparameter optimizations.
"""
import numpy as np
import os
import tempfile
import collections
import logging
import itertools
from typing import Dict, List, Optional, Tuple, Any, Callable
from deepchem.data import Dataset
from deepchem.trans import Transformer
from deepchem.models imp... | mit | 0abad145c5223828e95459c3746e102b | 37.020339 | 122 | 0.662981 | 4 | false | false | false | false |
deepchem/deepchem | examples/hopv/hopv_tf_models.py | 4 | 1115 | """
Script that trains multitask models on HOPV dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
import deepchem as dc
from deepchem.molnet import load_hopv
# Only for debug!
np.random.seed(123)
# Load HOPV dataset
n_feature... | mit | 964c8f501a0ceca51cb4a2462bc62108 | 23.23913 | 79 | 0.730045 | 3.222543 | false | false | false | false |
deepchem/deepchem | contrib/hagcn/hagcn_layers.py | 5 | 5094 | """K-Hop Layer and Adaptive Filter Module from https://arxiv.org/pdf/1706.09916.pdf"""
from __future__ import division
from __future__ import unicode_literals
__author__ = "Vignesh Ram Somnath"
__license__ = "MIT"
import numpy as np
import tensorflow as tf
import os
import sys
import logging
from deepchem.models.te... | mit | 80537106fb92a927f6f3a2f1ad278854 | 29.502994 | 102 | 0.640754 | 3.559748 | false | false | false | false |
deepchem/deepchem | deepchem/models/torch_models/cnn.py | 2 | 8785 | import torch
import numpy as np
import deepchem as dc
from deepchem.models.torch_models.torch_model import TorchModel
from deepchem.models.torch_models.layers import CNNModule
from deepchem.models.losses import L2Loss
from deepchem.metrics import to_one_hot
from typing import List, Union, Callable, Optional
from deepc... | mit | 4cac56c7f4bb32b81e640fe6a1d3cd1e | 41.645631 | 118 | 0.614343 | 4.266634 | false | false | false | false |
deepchem/deepchem | deepchem/molnet/load_function/clearance_datasets.py | 2 | 2488 | """
clearance dataset loader.
"""
import os
import deepchem as dc
from deepchem.molnet.load_function.molnet_loader import TransformerGenerator, _MolnetLoader
from deepchem.data import Dataset
from typing import List, Optional, Tuple, Union
CLEARANCE_URL = "https://deepchemdata.s3-us-west-1.amazonaws.com/datas... | mit | 18a1b8375da1dc3ff3dc9c5d0d79220f | 38.129032 | 91 | 0.696543 | 3.664212 | false | false | false | false |
deepchem/deepchem | deepchem/molnet/load_function/delaney_datasets.py | 3 | 3265 | """
Delaney dataset loader.
"""
import os
import deepchem as dc
from deepchem.molnet.load_function.molnet_loader import TransformerGenerator, _MolnetLoader
from deepchem.data import Dataset
from typing import List, Optional, Tuple, Union
DELANEY_URL = "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/delaney-p... | mit | 4b15ccba15b78f46a836a49613803354 | 39.8125 | 94 | 0.728025 | 3.648045 | false | false | false | false |
deepchem/deepchem | deepchem/models/torch_models/attentivefp.py | 2 | 10938 | """
DGL-based AttentiveFP for graph property prediction.
"""
import torch.nn as nn
import torch.nn.functional as F
from deepchem.models.losses import Loss, L2Loss, SparseSoftmaxCrossEntropy
from deepchem.models.torch_models.torch_model import TorchModel
class AttentiveFP(nn.Module):
"""Model for Graph Property Pre... | mit | 019edee7e111093045935935bf4ad530 | 34.270968 | 95 | 0.643223 | 3.707698 | false | false | false | false |
deepchem/deepchem | contrib/pubchem_dataset/create_smiles_mapping.py | 6 | 2008 | import pandas as pd
import os
from rdkit import Chem
import time
import gzip
import pickle
import deepchem
def main():
print("Processing PubChem FTP Download")
data_dir = deepchem.utils.get_data_dir()
sdf_dir = os.path.join(data_dir, "SDF")
compound_read_count = 0
keys = list()
values = list()
overall... | mit | a62fa5797115f9ac2f510cca86057b60 | 26.506849 | 80 | 0.64243 | 3.352254 | false | false | false | false |
deepchem/deepchem | deepchem/feat/molecule_featurizers/sparse_matrix_one_hot_featurizer.py | 1 | 3162 | import logging
from typing import List
import numpy as np
import scipy
from deepchem.feat.base_classes import Featurizer
from typing import Any, Iterable
logger = logging.getLogger(__name__)
CHARSET = [
'A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',
'S', 'T', 'V', 'W', 'Y', 'X', 'Z'... | mit | cf1b135a6010c498605c6290a8475ef2 | 29.403846 | 83 | 0.643896 | 3.746445 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.