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
theislab/scanpy
scanpy/external/pp/_magic.py
1
7212
"""\ Denoise high-dimensional data using MAGIC """ from typing import Union, Sequence, Optional from anndata import AnnData from packaging import version from ... import logging as logg from ..._settings import settings from ..._compat import Literal from ..._utils import AnyRandom MIN_VERSION = "2.0" def magic( ...
bsd-3-clause
c0e900ab368f6265814c4c0d22c1bb06
34.693069
85
0.617337
3.703133
false
false
false
false
aaugustin/websockets
src/websockets/legacy/protocol.py
1
62936
from __future__ import annotations import asyncio import codecs import collections import logging import random import ssl import struct import time import uuid import warnings from typing import ( Any, AsyncIterable, AsyncIterator, Awaitable, Callable, Deque, Dict, Iterable, List, ...
bsd-3-clause
a366d58a8307191d5a3d2e1433d9536d
37.65602
87
0.602682
4.520003
false
false
false
false
foauth/foauth.org
services/taskrabbit.py
2
1120
from oauthlib.oauth2.draft25 import utils import foauth.providers class Taskrabbit(foauth.providers.OAuth2): # General info about the provider provider_url = 'https://www.taskrabbit.com/' docs_url = 'http://taskrabbit.github.com/' category = 'Tasks' # URLs to interact with the API # These are...
bsd-3-clause
3871a9e01064811179f9bfe33a65d5ae
31
78
0.655357
3.578275
false
false
false
false
foauth/foauth.org
services/dwolla.py
2
1693
from oauthlib.common import add_params_to_uri import foauth.providers class Dwolla(foauth.providers.OAuth2): # General info about the provider provider_url = 'https://dwolla.com/' docs_url = 'http://developers.dwolla.com/dev/docs' category = 'Money' # Required by Dwolla's ToS disclaimer = "Th...
bsd-3-clause
720d9e2b2fa5187e75efc46629038cbb
38.372093
193
0.65505
3.564211
false
false
false
false
scikit-rf/scikit-rf
skrf/vi/sa.py
1
4343
""" .. module:: skrf.vi.sa ++++++++++++++++++++++++++++++++++++++++++++++++++++ Spectrum Analyzers (:mod:`skrf.vi.sa`) ++++++++++++++++++++++++++++++++++++++++++++++++++++ .. autosummary:: :toctree: generated/ HP8500 """ import numpy as npy from ..frequency import Frequency from ..netw...
bsd-3-clause
629cbd11f28071e19c6158eebb5d9674
23.104046
82
0.487221
3.944596
false
false
false
false
scikit-rf/scikit-rf
skrf_qtapps/data_grabber.py
1
2061
from skrf_qtapps.skrf_qtwidgets import NetworkListWidget, NetworkPlotWidget, qt, widgets from qtpy import QtWidgets, QtCore class DataGrabber(QtWidgets.QWidget): def __init__(self, parent=None): super().__init__(parent) # --- Setup UI --- # self.resize(825, 575) self.setWindowTitl...
bsd-3-clause
fbbbb0da3fbea33894d1b5f2c6d098ef
41.958333
109
0.712761
3.948276
false
false
false
false
scikit-rf/scikit-rf
skrf/vectorFitting.py
1
87576
import os import logging import warnings from timeit import default_timer as timer from typing import Any, Tuple, TYPE_CHECKING import numpy as np try: from . import plotting # will perform the correct setup for matplotlib before it is called below import matplotlib.pyplot as mplt from matplotlib.ticke...
bsd-3-clause
1a0b3eb3c4442b40a4dbda97863ea860
43.432268
126
0.549831
3.940959
false
false
false
false
scikit-rf/scikit-rf
skrf/frequency.py
1
20119
""" .. currentmodule:: skrf.frequency ======================================== frequency (:mod:`skrf.frequency`) ======================================== Provides a frequency object and related functions. Most of the functionality is provided as methods and properties of the :class:`Frequency` Class. Frequency Cla...
bsd-3-clause
c0e864e4589a0208de015f2a7ef8bae4
26.005369
99
0.529748
4.121057
false
false
false
false
scikit-rf/scikit-rf
skrf/__init__.py
1
2142
""" skrf is an object-oriented approach to microwave engineering, implemented in Python. """ __version__ = '0.24.1' ## Import all module names for coherent reference of name-space #import io from . import frequency from . import network from . import networkSet from . import media from . import circuit from . imp...
bsd-3-clause
8e9dd31aa203552bb08d273cd8c57cdb
20
75
0.707283
3.818182
false
false
false
false
scikit-rf/scikit-rf
skrf/media/rectangularWaveguide.py
1
12574
""" rectangularWaveguide (:mod:`skrf.media.rectangularWaveguide`) ================================================================ Represents a single mode of a homogeneously filled rectangular waveguide of cross-section `a` x `b`. The mode is determined by `mode-type` (`'te'` or `'tm'`) and mode indices ( `m` and `n`...
bsd-3-clause
32b37e6bf38e5a8d2ababfaa6a1c895e
25.925054
100
0.507794
3.627813
false
false
false
false
scikit-rf/scikit-rf
skrf/vi/vna/nanovna_v2.py
1
17964
from . import abcvna import numpy as np import skrf from time import sleep # Communication commands and register addresses are listed in the user manual at # https://nanorfe.com/nanovna-v2-user-manual.html # See also `python/nanovna.py` in the NanoVNA project repository at https://github.com/nanovna-v2/NanoVNA2-firmw...
bsd-3-clause
3985123d9dfbe52a8686a3ceca8c37eb
35.072289
123
0.588232
3.288905
false
false
false
false
wagtail/wagtail
wagtail/utils/version.py
4
1478
# This file is heavily inspired by django.utils.version def get_version(version): """Return a PEP 440-compliant version number from VERSION.""" version = get_complete_version(version) # Now build the two parts of the version number: # main = X.Y[.Z] # sub = .devN - for pre-alpha releases # ...
bsd-3-clause
875e0fad6fb8fc1ea4225198ce7f72f1
27.980392
76
0.602842
3.485849
false
false
false
false
wagtail/wagtail
wagtail/test/snippets/migrations/0001_initial.py
4
2139
# -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration): dependencies = [] operations = [ migrations.CreateModel( name="AlphaSnippet", fields=[ ( "id", models.AutoField( ...
bsd-3-clause
9291d285eb2167160823cee3f8903a84
27.144737
59
0.338943
6.2
false
false
false
false
wagtail/wagtail
wagtail/contrib/settings/tests/site_specific/base.py
4
1027
from django.http import HttpRequest from wagtail.models import Page, Site from wagtail.test.testapp.models import TestSiteSetting class SiteSettingsTestMixin: def setUp(self): root = Page.objects.first() other_home = Page(title="Other Root") root.add_child(instance=other_home) se...
bsd-3-clause
e9cffb7033c5a617cb306b23d27ca51a
34.413793
85
0.657254
3.965251
false
true
false
false
wagtail/wagtail
wagtail/admin/views/mixins.py
4
11492
import csv import datetime from collections import OrderedDict from io import BytesIO from django.core.exceptions import FieldDoesNotExist from django.http import FileResponse, StreamingHttpResponse from django.utils import timezone from django.utils.dateformat import Formatter from django.utils.encoding import force_...
bsd-3-clause
0a1f4c9b160265d1158fbaf6b037b696
38.965157
165
0.617786
4.048712
false
false
false
false
wagtail/wagtail
wagtail/test/snippets/migrations/0008_filterablesnippet.py
4
1189
# Generated by Django 4.0.5 on 2022-07-18 07:15 from django.db import migrations, models import wagtail.search.index class Migration(migrations.Migration): dependencies = [ ("snippetstests", "0007_translatablesnippet"), ] operations = [ migrations.CreateModel( name="Filterab...
bsd-3-clause
232000d6ce685c0c10b11798ee286038
28
63
0.385198
5.429224
false
false
false
false
wagtail/wagtail
wagtail/contrib/table_block/blocks.py
4
6786
import json from django import forms from django.template.loader import render_to_string from django.utils import translation from django.utils.functional import cached_property from django.utils.translation import gettext as _ from wagtail.admin.staticfiles import versioned_static from wagtail.blocks import FieldBlo...
bsd-3-clause
981024d4ffa80081e34e0ae4ba3157b0
31.941748
113
0.549808
4.420847
false
false
false
false
wagtail/wagtail
wagtail/users/migrations/0004_capitalizeverbose.py
4
1389
# -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("wagtailusers", "0003_add_verbose_names"), ] operations = [ migrations.AlterModelOptions( name="userprofile", options={"verbose_name": "user p...
bsd-3-clause
f3ee47cd89b95e86dc0b70e5aa878550
31.302326
89
0.548596
5.533865
false
false
false
false
wagtail/wagtail
wagtail/admin/panels.py
3
46535
import functools from warnings import warn from django import forms from django.apps import apps from django.conf import settings from django.contrib.auth import get_user_model from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured from django.core.signals import setting_changed from django.dispatc...
bsd-3-clause
a32b19fdaaad5e5dc4d6b0cf182b071d
34.14577
146
0.563836
4.507265
false
false
false
false
wagtail/wagtail
wagtail/test/emailuser/migrations/0001_initial.py
4
2337
# Generated by Django 3.2.3 on 2021-05-25 13:26 from django.db import migrations, models import uuid class Migration(migrations.Migration): initial = True dependencies = [ ("auth", "0012_alter_user_first_name_max_length"), ] operations = [ migrations.CreateModel( name="...
bsd-3-clause
83abd2f918cdf626c456c0904280ea92
34.953846
134
0.434745
5.372414
false
false
false
false
wagtail/wagtail
wagtail/admin/views/reports/audit_logging.py
4
7681
import datetime from collections import defaultdict import django_filters from django import forms from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.db.models import IntegerField, Value from django.utils.encoding import force_str from django.utils.tra...
bsd-3-clause
fdf529431627c2c4f290cd9a2ef28c6a
37.59799
101
0.637547
4.142934
false
false
false
false
wagtail/wagtail
wagtail/models/collections.py
4
6430
from django.contrib.auth.models import Group, Permission from django.db import models from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ from treebeard.mp_tree import MP_Node from wagtail.query import TreeQuerySet from wagtail....
bsd-3-clause
aad5a392ba85a155206f93f539df26be
32.789474
114
0.65296
4.28
false
false
false
false
wagtail/wagtail
wagtail/users/models.py
4
2661
import os import uuid from django.conf import settings from django.db import models from django.utils.translation import get_language from django.utils.translation import gettext_lazy as _ def upload_avatar_to(instance, filename): filename, ext = os.path.splitext(filename) return os.path.join( "avata...
bsd-3-clause
fe9aa038e5bb785906fe1924f22a08d7
28.566667
159
0.644495
4.472269
false
false
false
false
wagtail/wagtail
wagtail/contrib/routable_page/models.py
4
7470
import logging from functools import partial from django.core.checks import Warning from django.http import Http404 from django.template.response import TemplateResponse from django.urls import URLResolver from django.urls import path as path_func from django.urls import re_path as re_path_func from django.urls.resolv...
bsd-3-clause
f24691ef8832e177b3552e5873bf6882
32.053097
100
0.561044
4.527273
false
false
false
false
wagtail/wagtail
wagtail/users/views/users.py
4
8746
from django.conf import settings from django.contrib.auth import get_user_model, update_session_auth_hash from django.contrib.auth.models import Group from django.core.exceptions import PermissionDenied from django.db.models import Q from django.shortcuts import get_object_or_404 from django.urls import reverse from dj...
bsd-3-clause
e25b16aa8b51d52b50cc393aacebe9ed
31.03663
87
0.631031
3.75526
false
false
false
false
wagtail/wagtail
wagtail/query.py
4
22648
import posixpath import warnings from collections import defaultdict from typing import Any, Dict, Iterable, Tuple from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.db.models import CharField, Prefetch, Q from django.db.models.expressions import Exists, OuterRef from d...
bsd-3-clause
fe73d4e3a03dd910b529464dc625271e
36.127869
108
0.585747
4.50169
false
false
false
false
wagtail/wagtail
wagtail/whitelist.py
4
5662
""" A generic HTML whitelisting engine, designed to accommodate subclassing to override specific rules. """ import re from bs4 import BeautifulSoup, Comment, NavigableString, Tag from django.utils.html import escape ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "mailto", "tel"] PROTOCOL_RE = re.compile("^[a-z0-9][-...
bsd-3-clause
3b84113bbc5ba91615eb6ec42e2546b3
35.529032
96
0.625044
4.044286
false
false
false
false
nephila/djangocms-blog
djangocms_blog/migrations/0011_auto_20151024_1809.py
1
3170
import aldryn_apphooks_config.fields import django.utils.timezone from django.db import migrations, models from djangocms_blog.settings import get_setting class Migration(migrations.Migration): dependencies = [ ("djangocms_blog", "0010_auto_20150923_1151"), ] operations = [ migrations.A...
bsd-3-clause
c56e5865a22a8dcd3541a97cfd2319f3
36.294118
106
0.555836
4.561151
false
true
false
false
nephila/djangocms-blog
tests/media_app/models.py
1
1822
import re import requests from cms.models import CMSPlugin from django.db import models from djangocms_blog.media.base import MediaAttachmentPluginMixin class YoutTubeVideo(MediaAttachmentPluginMixin, CMSPlugin): url = models.URLField("video URL") _media_autoconfiguration = { "params": [ ...
bsd-3-clause
27bc45cb1c7bfbb736934a3f9bcda438
25.794118
114
0.555982
3.544747
false
false
false
false
ros/ros
core/roslib/src/roslib/resources.py
1
4541
# Software License Agreement (BSD License) # # Copyright (c) 2008, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above...
bsd-3-clause
50b1e30d5f19c5c92902ac1c11edeafa
40.66055
103
0.713499
4.018584
false
false
false
false
ros/ros
tools/rosboost_cfg/src/rosboost_cfg/rosboost_cfg.py
1
14144
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2010, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code...
bsd-3-clause
6b166889b3cf7b65bfaf8301556ae3b1
35.266667
157
0.590003
3.527182
false
false
false
false
mwaskom/seaborn
seaborn/_compat.py
1
5742
import numpy as np import matplotlib as mpl from seaborn.external.version import Version def MarkerStyle(marker=None, fillstyle=None): """ Allow MarkerStyle to accept a MarkerStyle object as parameter. Supports matplotlib < 3.3.0 https://github.com/matplotlib/matplotlib/pull/16692 """ if isi...
bsd-3-clause
15f6d48d88ca8809b71c6a60f0d830e1
34.012195
88
0.606235
3.922131
false
false
false
false
mwaskom/seaborn
doc/sphinxext/gallery_generator.py
1
10739
""" Sphinx plugin to run example scripts and create a gallery page. Lightly modified from the mpld3 project. """ import os import os.path as op import re import glob import token import tokenize import shutil import warnings import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt # noqa: E402 # Py...
bsd-3-clause
dcaf128639d537cae392eba3c4e3570e
26.3257
79
0.525375
3.732708
false
false
false
false
mwaskom/seaborn
tests/_core/test_properties.py
1
19306
import numpy as np import pandas as pd import matplotlib as mpl from matplotlib.colors import same_color, to_rgb, to_rgba import pytest from numpy.testing import assert_array_equal from seaborn.external.version import Version from seaborn._core.rules import categorical_order from seaborn._core.scales import Nominal,...
bsd-3-clause
3b8ce62e0470ebe89a07fa845ca62709
32.171821
88
0.600694
3.481695
false
true
false
false
mwaskom/seaborn
tests/test_rcmod.py
1
8965
import pytest import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import numpy.testing as npt from seaborn import rcmod, palettes, utils def has_verdana(): """Helper to verify if Verdana font is present""" # This import is relatively lengthy, so to prevent its import for # testing...
bsd-3-clause
79267bd65fc911485912a0210789e4ca
27.826367
78
0.603904
3.578842
false
true
false
false
mwaskom/seaborn
examples/heat_scatter.py
2
1187
""" Scatterplot heatmap ------------------- _thumb: .5, .5 """ import seaborn as sns sns.set_theme(style="whitegrid") # Load the brain networks dataset, select subset, and collapse the multi-index df = sns.load_dataset("brain_networks", header=[0, 1, 2], index_col=0) used_networks = [1, 5, 6, 7, 8, 12, 13, 17] used...
bsd-3-clause
725896fa49f34b2137f7e09e90720ccd
27.95122
78
0.636057
3.028061
false
false
false
false
mwaskom/seaborn
seaborn/_stats/aggregation.py
1
3267
from __future__ import annotations from dataclasses import dataclass from typing import ClassVar, Callable import pandas as pd from pandas import DataFrame from seaborn._core.scales import Scale from seaborn._core.groupby import GroupBy from seaborn._stats.base import Stat from seaborn._statistics import EstimateAggr...
bsd-3-clause
8f2d1a8febbd05a7e0d5d4580c425056
26.686441
87
0.601163
3.870853
false
false
false
false
mwaskom/seaborn
examples/many_facets.py
1
1110
""" Plotting on a large number of facets ==================================== _thumb: .4, .3 """ import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="ticks") # Create a dataset with many short random walks rs = np.random.RandomState(4) pos = rs.randint(-1...
bsd-3-clause
2216100e8521d169c35b2bfe764032eb
27.461538
66
0.636937
3
false
false
false
false
janelia-flyem/gala
gala/iterprogress.py
2
1826
import logging class NoProgressBar(object): def __init__(self, *args, **kwargs): pass def start(self, *args, **kwargs): pass def update(self, *args, **kwargs): pass def update_i(self, *args, **kwargs): pass def finish(self, *args, **kwargs): pass def set_title(self, *args, **kwargs): pass def ...
bsd-3-clause
f202a33224a171af60ac2b418575c31b
29.433333
77
0.548193
3.926882
false
false
false
false
janelia-flyem/gala
gala/features/squiggliness.py
2
1624
import numpy as np from . import base def compute_bounding_box(indices, shape): d = len(shape) unraveled_indices = np.concatenate( np.unravel_index(list(indices), shape)).reshape((-1,d), order='F') m = unraveled_indices.min(axis=0) M = unraveled_indices.max(axis=0) + np.ones(d) return m, M ...
bsd-3-clause
4ba64cbb0eeef27de3d30c54ec27d1ec
35.909091
74
0.586207
3.075758
false
false
false
false
janelia-flyem/gala
gala/features/base.py
1
5302
import numpy as np from .. import evaluate as ev class Null(object): def __init__(self, *args, **kwargs): self.default_cache = 'feature-cache' def __call__(self, g, n1, n2=None): return self.compute_features(g, n1, n2) def write_fm(self, json_fm={}): return json_fm def compu...
bsd-3-clause
d96bf400798829c5b3270f382a5c1c7f
36.338028
79
0.571105
3.289082
false
false
false
false
janelia-flyem/gala
gala/classify.py
1
10542
#!/usr/bin/env python # system modules import os import logging import random import pickle as pck # libraries import h5py import numpy as np np.seterr(divide='ignore') from sklearn.ensemble import RandomForestClassifier import joblib try: from vigra.learning import RandomForest as BaseVigraRandomForest fro...
bsd-3-clause
7b958e975c2e41bf25612d192e589e12
31.436923
78
0.618194
3.861538
false
false
false
false
astropy/ccdproc
ccdproc/log_meta.py
2
5533
# Licensed under a 3-clause BSD style license - see LICENSE.rst from functools import wraps import inspect from itertools import chain import numpy as np from astropy.nddata import NDData from astropy import units as u from astropy.io import fits import ccdproc # Really only need Keyword from ccdproc __all__ = []...
bsd-3-clause
f2be34d65b68176752299878ae799bc9
33.58125
87
0.590819
4.119881
false
false
false
false
astropy/ccdproc
ccdproc/extern/bitfield.py
1
19025
# External license! License can be found in "licenses/LICENSE_STSCI_TOOLS.txt". """ A module that provides functions for manipulating bitmasks and data quality (DQ) arrays. :Authors: Mihai Cara (contact: help@stsci.edu) :License: `<http://www.stsci.edu/resources/software_hardware/pyraf/LICENSE>`_ """ import sys im...
bsd-3-clause
6ed21a683ae65804fe37078721bf2bb5
41.277778
87
0.59159
3.875535
false
false
false
false
pinax/symposion
symposion/conference/migrations/0001_initial.py
4
1830
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import timezone_field.fields class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Conference', fields=[ ...
bsd-3-clause
9479af1e975ec9ea20528807dd0faea9
40.590909
115
0.553552
4.42029
false
false
false
false
dask/distributed
distributed/chaos.py
1
1947
from __future__ import annotations import asyncio import ctypes import random import sys from typing import Literal from dask.utils import parse_timedelta from distributed.diagnostics.plugin import WorkerPlugin class KillWorker(WorkerPlugin): """Kill Workers Randomly This kills workers in a cluster random...
bsd-3-clause
f0474efd05e6f5f51a8475e1eea0faa4
27.632353
138
0.602979
3.773256
false
false
false
false
scikit-optimize/scikit-optimize
examples/interruptible-optimization.py
4
4670
""" ================================================ Interruptible optimization runs with checkpoints ================================================ Christian Schell, Mai 2018 Reformatted by Holger Nahrstaedt 2020 .. currentmodule:: skopt Problem statement ================= Optimization runs can take a very long ...
bsd-3-clause
b63bfd60b037cf1113cc3b26e45cf117
36.95122
117
0.62425
4.098332
false
false
false
false
dask/distributed
conftest.py
1
1168
# https://pytest.org/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option from __future__ import annotations import pytest # Uncomment to enable more logging and checks # (https://docs.python.org/3/library/asyncio-dev.html) # Note this makes things slower and might consume much memory...
bsd-3-clause
0400a0ca3173f23e070b5a346dbd57d6
26.809524
106
0.695205
3.661442
false
true
false
false
dask/distributed
distributed/dashboard/scheduler.py
1
5485
from __future__ import annotations from urllib.parse import urljoin from tlz import memoize from tornado import web from tornado.ioloop import IOLoop from distributed.dashboard.components.nvml import ( gpu_doc, gpu_memory_doc, gpu_utilization_doc, ) from distributed.dashboard.components.scheduler import ...
bsd-3-clause
499cada40442f20c3bf4fff23231b6d7
30.522989
87
0.632999
3.966016
false
false
false
false
scikit-optimize/scikit-optimize
skopt/space/space.py
1
38720
import numbers import numpy as np import yaml from scipy.stats.distributions import randint from scipy.stats.distributions import rv_discrete from scipy.stats.distributions import uniform from sklearn.utils import check_random_state from sklearn.utils.fixes import sp_version from .transformers import CategoricalEnco...
bsd-3-clause
2b5c86a109cdb443d531df234254b89a
32.964912
79
0.560511
4.512821
false
false
false
false
dask/distributed
distributed/tests/test_client.py
1
226630
from __future__ import annotations import asyncio import concurrent.futures import functools import gc import inspect import logging import operator import os import pathlib import pickle import random import subprocess import sys import threading import traceback import types import warnings import weakref import zip...
bsd-3-clause
ddd4dc1bbf45c8cbcce06e6ccfe02129
27.73827
99
0.603265
3.223205
false
true
false
false
scikit-optimize/scikit-optimize
skopt/utils.py
1
27455
from copy import deepcopy from functools import wraps from sklearn.utils import check_random_state import numpy as np from scipy.optimize import OptimizeResult from scipy.optimize import minimize as sp_minimize from sklearn.base import is_regressor from sklearn.ensemble import GradientBoostingRegressor from joblib impo...
bsd-3-clause
5dae05df24efbdf58efb7b31a969f807
33.534591
84
0.619195
4.288504
false
false
false
false
scikit-optimize/scikit-optimize
examples/parallel-optimization.py
5
3174
""" ===================== Parallel optimization ===================== Iaroslav Shcherbatyi, May 2017. Reviewed by Manoj Kumar and Tim Head. Reformatted by Holger Nahrstaedt 2020 .. currentmodule:: skopt Introduction ============ For many practical black box optimization problems expensive objective can be evaluated...
bsd-3-clause
84f743cd8f30f0f8ed6359514caeb9a9
37.670732
140
0.715142
4.048531
false
false
false
false
dask/distributed
distributed/_signals.py
1
1297
from __future__ import annotations import asyncio import logging import signal from typing import Any logger = logging.getLogger(__name__) async def wait_for_signals() -> None: """Wait for sigint or sigterm by setting global signal handlers""" signals = (signal.SIGINT, signal.SIGTERM) loop = asyncio.get...
bsd-3-clause
49c5a7cdb847545656a9f1cfdd116610
30.634146
134
0.655359
3.930303
false
false
false
false
dask/distributed
distributed/protocol/torch.py
1
1993
from __future__ import annotations import torch from distributed.protocol.serialize import ( dask_deserialize, dask_serialize, deserialize, register_generic, serialize, ) @dask_serialize.register(torch.Tensor) def serialize_torch_Tensor(t): requires_grad_ = t.requires_grad if requires_g...
bsd-3-clause
0ff07a8b33e26bd40c5e72f2dcb921f0
27.471429
82
0.644757
3.656881
false
false
false
false
dask/distributed
distributed/multi_lock.py
1
8042
from __future__ import annotations import asyncio import logging import uuid from collections import defaultdict from collections.abc import Hashable from dask.utils import parse_timedelta from distributed.client import Client from distributed.utils import TimeoutError, log_errors from distributed.worker import get_...
bsd-3-clause
f6a5c3ddd95d80b1158fe8b2433e4a75
32.932489
89
0.576225
4.307445
false
false
false
false
dask/distributed
distributed/comm/asyncio_tcp.py
1
34198
from __future__ import annotations import asyncio import collections import logging import os import socket import ssl import struct import sys import weakref from itertools import islice from typing import Any import dask from distributed.comm.addressing import parse_host_port, unparse_host_port from distributed.co...
bsd-3-clause
67e2e247e7cad8ef3e48f4400da2b26c
34.003071
122
0.575268
4.307053
false
false
false
false
scikit-optimize/scikit-optimize
skopt/sampler/grid.py
1
6250
""" Inspired by https://github.com/jonathf/chaospy/blob/master/chaospy/ distributions/sampler/sequences/grid.py """ import numpy as np from .base import InitialPointGenerator from ..space import Space from sklearn.utils import check_random_state def _quadrature_combine(args): args = [np.asarray(arg).reshape(len(a...
bsd-3-clause
9291273adf04e3c0f13097b60fbde9c7
35.764706
76
0.55952
3.832005
false
false
false
false
dask/distributed
distributed/protocol/utils.py
1
6102
from __future__ import annotations import ctypes import struct from collections.abc import Sequence import dask from distributed.utils import nbytes BIG_BYTES_SHARD_SIZE = dask.utils.parse_bytes(dask.config.get("distributed.comm.shard")) msgpack_opts = { ("max_%s_len" % x): 2**31 - 1 for x in ["str", "bin", "...
bsd-3-clause
13fcbd67b33d0159c0bf9006c54020cd
29.207921
100
0.628319
3.816135
false
false
false
false
dask/distributed
distributed/comm/tcp.py
1
24496
from __future__ import annotations import asyncio import ctypes import errno import functools import logging import socket import ssl import struct import sys import weakref from ssl import SSLCertVerificationError, SSLError from typing import Any, ClassVar from tlz import sliding_window from tornado import gen, netu...
bsd-3-clause
6b9ab267e92e8281bb2cf6e21af01e70
32.694635
116
0.588504
4.117667
false
false
false
false
dask/distributed
distributed/deploy/tests/test_old_ssh.py
1
2182
from __future__ import annotations from time import sleep import pytest pytest.importorskip("paramiko") from distributed import Client from distributed.deploy.old_ssh import SSHCluster from distributed.metrics import time @pytest.mark.avoid_ci def test_cluster(loop): with SSHCluster( scheduler_addr="1...
bsd-3-clause
d31fe00f38c42f6b61531e839d8ced74
26.620253
71
0.55637
3.480064
false
true
false
false
dask/distributed
distributed/deploy/adaptive.py
1
6702
from __future__ import annotations import logging from inspect import isawaitable from tornado.ioloop import IOLoop import dask.config from dask.utils import parse_timedelta from distributed.deploy.adaptive_core import AdaptiveCore from distributed.protocol import pickle from distributed.utils import log_errors lo...
bsd-3-clause
db322c6022c44c4d67081266d2f68bd8
29.884793
88
0.630707
4.54065
false
false
false
false
dask/distributed
distributed/protocol/tests/test_serialize.py
1
16735
from __future__ import annotations import copy import pickle from array import array import msgpack import pytest from tlz import identity try: import numpy as np except ImportError: np = None # type: ignore import dask from distributed import Nanny, wait from distributed.comm.utils import from_frames, to...
bsd-3-clause
8ffc779310b08f0b9025b019ee4c306d
25.69059
87
0.609083
3.518713
false
true
false
false
dask/distributed
distributed/deploy/tests/test_ssh.py
1
9457
from __future__ import annotations import pytest pytest.importorskip("asyncssh") import sys import dask from distributed import Client from distributed.compatibility import MACOS, WINDOWS from distributed.deploy.ssh import SSHCluster from distributed.utils_test import gen_test pytestmark = [ pytest.mark.xfail...
bsd-3-clause
f26cd31c2b5786ab1f4bab9bc1575ea9
30.418605
88
0.583483
3.787345
false
true
false
false
dask/distributed
distributed/http/proxy.py
1
4377
from __future__ import annotations import logging from tornado import web logger = logging.getLogger(__name__) try: from jupyter_server_proxy.handlers import ProxyHandler class GlobalProxyHandler(ProxyHandler): """ A tornado request handler that proxies HTTP and websockets from a po...
bsd-3-clause
57afc58bfbf386c409ac7a060125bd29
31.909774
93
0.56934
4.196548
false
false
false
false
dask/distributed
distributed/shuffle/_shuffle.py
1
4851
from __future__ import annotations import logging from typing import TYPE_CHECKING, Any from dask.base import tokenize from dask.highlevelgraph import HighLevelGraph from dask.layers import SimpleShuffleLayer from distributed.shuffle._shuffle_extension import ShuffleId, ShuffleWorkerExtension logger = logging.getLo...
bsd-3-clause
37f26b9a5a777bd57074b276d7cbaac0
28.579268
117
0.59699
3.95677
false
false
false
false
jschneier/django-storages
storages/backends/azure_storage.py
1
14292
import mimetypes from datetime import datetime from datetime import timedelta from tempfile import SpooledTemporaryFile from azure.core.exceptions import ResourceNotFoundError from azure.storage.blob import BlobClient from azure.storage.blob import BlobSasPermissions from azure.storage.blob import BlobServiceClient fr...
bsd-3-clause
652eb4f7714dbfb0c4dc093983a7fe0a
33.858537
113
0.599566
4.142609
false
false
false
false
cherrypy/cherrypy
cherrypy/_cpcompat.py
10
1992
"""Compatibility code for using CherryPy with various versions of Python. To retain compatibility with older Python versions, this module provides a useful abstraction over the differences between Python versions, sometimes by preferring a newer idiom, sometimes an older one, and sometimes a custom one. In particular...
bsd-3-clause
88fa05e896ebb4035050b0a7ab7d7b3d
32.762712
78
0.725904
4.008048
false
false
false
false
cherrypy/cherrypy
cherrypy/test/modfcgid.py
1
4192
"""Wrapper for mod_fcgid, for use as a CherryPy HTTP server when testing. To autostart fcgid, the "apache" executable or script must be on your system path, or you must override the global APACHE_PATH. On some platforms, "apache" may be called "apachectl", "apache2ctl", or "httpd"--create a symlink to them if needed. ...
bsd-3-clause
370a490a84f3dcba987db95f449f42f7
33.644628
77
0.674857
3.601375
false
true
false
false
cherrypy/cherrypy
cherrypy/lib/static.py
6
16592
"""Module with helpers for serving static files.""" import os import platform import re import stat import mimetypes import urllib.parse import unicodedata from email.generator import _make_boundary as make_boundary from io import UnsupportedOperation import cherrypy from cherrypy._cpcompat import ntob from cherrypy...
bsd-3-clause
1cc8acc84b0ddd13f6ec936fbec950bf
38.884615
79
0.606377
4.156313
false
false
false
false
cherrypy/cherrypy
cherrypy/_cpdispatch.py
1
25216
"""CherryPy dispatchers. A 'dispatcher' is the object which looks up the 'page handler' callable and collects config for the current request based on the path_info, other request attributes, and the application architecture. The core calls the dispatcher as early as possible, passing it a 'path_info' argument. The de...
bsd-3-clause
5bdae5491bb0095204a756a5ce47e6c6
35.973607
79
0.591172
4.495632
false
true
false
false
cherrypy/cherrypy
cherrypy/_cpserver.py
10
8320
"""Manage HTTP servers with CherryPy.""" import cherrypy from cherrypy.lib.reprconf import attributes from cherrypy._cpcompat import text_or_bytes from cherrypy.process.servers import ServerAdapter __all__ = ('Server', ) class Server(ServerAdapter): """An adapter for an HTTP server. You can set attributes...
bsd-3-clause
06f089dd83f15678474cf151ff5338d0
33.522822
79
0.619111
4.221208
false
false
false
false
mozilla/mozilla-ignite
vendor-local/src/django-voting/voting/templatetags/voting_tags.py
32
8050
from django import template from django.utils.html import escape from voting.models import Vote register = template.Library() # Tags class ScoreForObjectNode(template.Node): def __init__(self, object, context_var): self.object = object self.context_var = context_var def render(self, context...
bsd-3-clause
be0f15ad0479801990048a706c88a06a
33.852814
98
0.626335
3.870192
false
false
false
false
mozilla/mozilla-ignite
apps/projects/migrations/0005_auto__add_link__del_field_project_github__del_field_project_blog.py
2
10765
# encoding: utf-8 from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Link' db.create_table('projects_link', ( ('id', self.gf('django.db.models.fields.AutoField')(primary...
bsd-3-clause
c4d9dda8c1891fd922f521909aca98a5
63.077381
182
0.550302
3.726203
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/django_extensions/mongodb/models.py
40
2596
""" Django Extensions abstract base mongoengine Document classes. """ import datetime from mongoengine.document import Document from mongoengine.fields import StringField, IntField, DateTimeField from mongoengine.queryset import QuerySetManager from django.utils.translation import ugettext_lazy as _ from django_extensi...
bsd-3-clause
7457094da01268046f9cf1c9928d5947
36.623188
91
0.691448
4.468158
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/requests/packages/urllib3/connectionpool.py
33
18424
# urllib3/connectionpool.py # Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import logging import socket from socket import error as SocketError, timeout as Socket...
bsd-3-clause
3de6152b345b53612d41a8e63b98370a
34.295019
80
0.592054
4.561525
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/requests/cookies.py
4
8923
""" Compatibility code to be able to use `cookielib.CookieJar` with requests. requests.utils imports from here, so be careful with imports. """ import collections from .compat import cookielib, urlparse, Morsel try: import threading # grr, pyflakes: this fixes "redefinition of unused 'threading'" threadi...
bsd-3-clause
80fc1ca261ff17fbfac32d0a4d173a31
32.799242
99
0.639247
4.083753
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/rsa/util.py
5
2778
# -*- coding: utf-8 -*- # # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
bsd-3-clause
38287aff1cf7abaa767f3413161e7f16
35.064935
77
0.638459
3.783379
false
false
false
false
mozilla/mozilla-ignite
apps/challenges/migrations/0022_wipe_judge_assignment.py
1
14798
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'JudgeAssignment' db.delete_table('challenges_judgeassignment') def backwards(self,...
bsd-3-clause
6f4a2777288e25aef6b1be5ca814034d
76.072917
194
0.553656
3.698575
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/requests/utils.py
1
13350
# -*- coding: utf-8 -*- """ requests.utils ~~~~~~~~~~~~~~ This module provides utility functions that are used within Requests that are also useful for external consumption. """ import cgi import codecs import os import random import re import zlib from netrc import netrc, NetrcParseError from .compat import parse...
bsd-3-clause
0147703293240dedb128eb912ef85ed7
27.771552
88
0.611386
3.836207
false
false
false
false
mozilla/mozilla-ignite
apps/timeslot/baseconv.py
1
1571
""" Convert numbers from base 10 integers to base X strings and back again. Original: http://www.djangosnippets.org/snippets/1431/ Sample usage: >>> base20 = BaseConverter('0123456789abcdefghij') >>> base20.from_decimal(1234) '31e' >>> base20.to_decimal('31e') 1234 """ class BaseConverter(object): decimal_digi...
bsd-3-clause
8f703c2a9c917d96f02dce333dcb200b
25.627119
71
0.57352
3.9275
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/markdown/extensions/meta.py
9
2759
#!usr/bin/python """ Meta Data Extension for Python-Markdown ======================================= This extension adds Meta Data handling to markdown. Basic Usage: >>> import markdown >>> text = '''Title: A Test Doc. ... Author: Waylan Limberg ... John Doe ... Blank_Data: ... ....
bsd-3-clause
d4e73b16845cd2368965c75679f2ee39
27.739583
99
0.542588
3.753741
false
true
false
false
mozilla/mozilla-ignite
apps/resources/migrations/0001_initial.py
1
2929
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Resource' db.create_table('resources_resource', ( ('id', self.gf('django.db.mo...
bsd-3-clause
54d2ac57f6a582d6cfa170aba23baae9
56.431373
229
0.598156
3.798962
false
false
false
false
mozilla/mozilla-ignite
vendor-local/src/django-voting/setup.py
17
1354
from distutils.core import setup from distutils.command.install import INSTALL_SCHEMES # Tell distutils to put the data_files in platform-specific installation # locations. See here for an explanation: # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb for scheme i...
bsd-3-clause
55101721dd9d83e5ec5fee61efe5c592
40.060606
104
0.641802
3.890805
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/pyasn1/type/univ.py
20
39555
# ASN.1 "universal" data types import operator, sys from pyasn1.type import base, tag, constraint, namedtype, namedval, tagmap from pyasn1.codec.ber import eoo from pyasn1.compat import octets from pyasn1 import error # "Simple" ASN.1 types (yet incomplete) class Integer(base.AbstractSimpleAsn1Item): tagSet = bas...
bsd-3-clause
aded309ab4ad5f6cea34f69ffd6280db
37.143684
117
0.551182
4.210218
false
false
false
false
mozilla/mozilla-ignite
apps/challenges/migrations/0031_auto__add_field_submission_life_improvements__add_field_submission_tak.py
1
17108
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): depends_on = ( ('challenges', '0030_remove_min_criterion_value'), ) def forwards(self, orm): # Adding field 'Submissio...
bsd-3-clause
b8f44a053c670e90786c897c2b802573
74.035088
241
0.561141
3.699027
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/requests/packages/urllib3/request.py
107
5427
# urllib3/request.py # Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php try: from urllib.parse import urlencode except ImportError: from urllib import urlencod...
bsd-3-clause
87aa22cf0791422b2a2ce44f71d97c4d
41.398438
81
0.616178
4.583615
false
false
false
false
mozilla/mozilla-ignite
apps/users/models.py
1
4554
# -*- coding: utf-8 -*- import base64 import hashlib from django.conf import settings from django.contrib.auth.models import User from django.db import models from innovate.models import BaseModel from innovate.utils import get_partition_id, safe_filename, ImageStorage from tower import ugettext_lazy as _ def det...
bsd-3-clause
dd9431b340699a98469ac09a6452d833
35.416
78
0.605009
3.941126
false
false
false
false
mozilla/mozilla-ignite
vendor-local/lib/python/rsa/key.py
5
17161
# -*- coding: utf-8 -*- # # Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
bsd-3-clause
478102e7657183434a2dde06f026d27b
28.433962
87
0.562296
3.658849
false
false
false
false
mozilla/mozilla-ignite
apps/users/migrations/0003_auto__add_link__add_field_profile_bio.py
2
6019
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Link' db.create_table('users_link', ( ('id', self.gf('django.db.models.fields....
bsd-3-clause
e663ad42e41ed388f0d0845555ddb8f5
59.19
182
0.556571
3.720025
false
false
false
false
mozilla/mozilla-ignite
apps/challenges/migrations/0015_auto.py
1
12702
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding M2M table for field category on 'Submission' db.create_table('challenges_submission_category', ( ...
bsd-3-clause
6ed8fc8753cbda11e40b5b9e4b84156d
75.05988
182
0.552118
3.705368
false
false
false
false
mitsuhiko/zine
zine/services.py
1
1400
# -*- coding: utf-8 -*- """ zine.services ~~~~~~~~~~~~~ The builtin (JSON) services. :copyright: (c) 2010 by the Zine Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from werkzeug import abort from zine.models import Comment, Tag from zine.privileges import MO...
bsd-3-clause
ad2861248ea411b94cb34ea16c40f985
24.925926
73
0.569286
3.589744
false
false
false
false
mitsuhiko/zine
zine/utils/crypto.py
1
5077
""" zine.utils.crypto ~~~~~~~~~~~~~~~~~ This module implements various cryptographic functions. :copyright: (c) 2010 by the Zine Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import string from random import choice, randrange try: from hashlib import sha1...
bsd-3-clause
93013a602699b39ffde1fd9dda411f59
29.769697
81
0.623006
3.437373
false
false
false
false
mitsuhiko/zine
zine/database.py
1
14745
# -*- coding: utf-8 -*- """ zine.database ~~~~~~~~~~~~~ This module is a rather complex layer on top of SQLAlchemy. Basically you will never use the `zine.database` module except if you are a core developer, but always the high level :mod:`~zine.database.db` module which you can import from th...
bsd-3-clause
3a39e4cc3d99af3b4c5713f38e0de227
35.139706
81
0.66158
3.724425
false
false
false
false
globocom/database-as-a-service
dbaas/logical/models.py
1
51081
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import simple_audit import logging import datetime import urllib from datetime import date, timedelta from django.db import models, transaction, Error from django.db.models.signals import pre_save, post_save, pre_delete from django.contrib...
bsd-3-clause
55527fe57ab2d2fc5d87735de3592982
32.561761
129
0.590963
4.235923
false
false
false
false
globocom/database-as-a-service
dbaas/physical/migrations/0097_auto__add_field_script_configure_log.py
1
27134
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Script.configure_log' db.add_column(u'physical_script', '...
bsd-3-clause
ed8c66f307f3eaf3dad285a286ffc085
92.568966
239
0.563831
3.565103
false
false
false
false
globocom/database-as-a-service
dbaas/tsuru/views/getServiceStatus.py
1
1640
from rest_framework.views import APIView from rest_framework.renderers import JSONRenderer, JSONPRenderer from rest_framework.response import Response from rest_framework import status from logical.models import Database from notification.models import TaskHistory from ..utils import get_url_env, get_database, LOG from...
bsd-3-clause
d7d96f90253000a6bc5f9ab75b44446e
34.673913
77
0.630488
4.350133
false
false
false
false
globocom/database-as-a-service
dbaas/logical/migrations/0009_auto__del_field_database_group__add_field_database_team.py
1
12359
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Database.group' db.delete_column(u'logical_database', 'group_id') # Adding field ...
bsd-3-clause
e1bd0e4b8f90d41afeb94102dbec1ab4
77.221519
205
0.553281
3.612686
false
false
false
false
globocom/database-as-a-service
dbaas/maintenance/admin/remove_instance_database.py
1
1160
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.utils.html import format_html from .database_maintenance_task import DatabaseMaintenanceTaskAdmin class RemoveInstanceDatabaseAdmin(DatabaseMaintenanceTaskAdmin): list_filter = [ "database__team", "current_step",...
bsd-3-clause
28636fc56fa3da5570f1534da68b0fd3
33.117647
80
0.623276
3.828383
false
false
false
false
globocom/database-as-a-service
dbaas/physical/migrations/0041_auto__del_field_plan_flipperfox_equivalent_plan.py
1
13264
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Plan.flipperfox_equivalent_plan' db.delete_column(u'phy...
bsd-3-clause
5ad779c4037da2d00b2b19eead203a99
86.847682
227
0.565365
3.556032
false
false
false
false