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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mozilla/make.mozilla.org | vendor-local/lib/python/chardet/charsetgroupprober.py | 218 | 3642 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights ... | bsd-3-clause | c269c8a5e7d8966d936e99c86b75ac78 | 36.9375 | 90 | 0.593081 | 4.403869 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/celery/events/state.py | 14 | 11609 | # -*- coding: utf-8 -*-
"""
celery.events.state
~~~~~~~~~~~~~~~~~~~
This module implements a datastructure used to keep
track of the state of a cluster of workers and the tasks
it is working on (by consuming events).
For every event consumed the state is updated,
so the state represents th... | bsd-3-clause | 97d9234f0b117e999f09d471a20a4dcf | 32.944444 | 79 | 0.579809 | 4.093441 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/requests/packages/oreos/monkeys.py | 34 | 26078 | # -*- coding: utf-8 -*-
"""
oreos.monkeys
~~~~~~~~~~~~~
Monkeypatches.
"""
#!/usr/bin/env python
#
####
# Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software
# and its documentation for any purpose and without... | bsd-3-clause | 43b18bee445535df7dc11e565f0b7706 | 32.736093 | 82 | 0.556139 | 3.52596 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/kombu/transport/pika2.py | 2 | 8444 | """
kombu.transport.pika
====================
Pika transport.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import socket
from operator import attrgetter
from . import base
from ..exceptions import StdChannelError
import pika
fro... | bsd-3-clause | 0ad118884616fd1f6e69917835ad2186 | 36.198238 | 79 | 0.549266 | 4.886574 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/celery/events/dumper.py | 14 | 2536 | # -*- coding: utf-8 -*-
"""
celery.events.dumper
~~~~~~~~~~~~~~~~~~~~
THis is a simple program that dumps events to the console
as they happen. Think of it like a `tcpdump` for Celery events.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __fu... | bsd-3-clause | 51c0a895ec135eba7353c7f24a2a2db4 | 30.7 | 76 | 0.53194 | 3.871756 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/djcelery/loaders.py | 1 | 4765 | from __future__ import absolute_import
import imp
import importlib
import warnings
from celery import signals
from celery.loaders.base import BaseLoader
from celery.datastructures import DictAttribute
from django import db
from django.conf import settings
from django.core import cache
from django.core.mail import ma... | bsd-3-clause | 04d2d15d2515b1836e279dee9d2ed49d | 28.78125 | 79 | 0.611962 | 4.262075 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/kombu/transport/beanstalk.py | 1 | 3430 | """
kombu.transport.beanstalk
=========================
Beanstalk transport.
:copyright: (c) 2010 - 2012 by David Ziegler.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import socket
from Queue import Empty
from anyjson import loads, dumps
from beanstalkc import Connectio... | bsd-3-clause | 1920418d48c651b93de1b7734db0bc3b | 24.984848 | 69 | 0.549854 | 4.213759 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/amqplib/client_0_8/channel.py | 22 | 86923 | """
AMQP 0-8 Channels
"""
# Copyright (C) 2007-2008 Barry Pederson <bp@barryp.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your opti... | bsd-3-clause | 6dac500cde994a7ce534a8f87a7caef0 | 31.265405 | 76 | 0.562831 | 5.154658 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/south/management/commands/syncdb.py | 40 | 4459 | """
Overridden syncdb command
"""
import sys
from optparse import make_option
from django.core.management.base import NoArgsCommand, BaseCommand
from django.core.management.color import no_style
from django.utils.datastructures import SortedDict
from django.core.management.commands import syncdb
from django.conf imp... | bsd-3-clause | 2c260cdf316e20a3393239d9ca028cfd | 39.171171 | 148 | 0.585109 | 4.341772 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/kombu/utils/limits.py | 13 | 1909 | """
kombu.utils.limits
==================
Token bucket implementation for rate limiting.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
import time
__all__ = ["TokenBucket"]
class TokenBucket(object):
"""Token Bucket Algorithm.
See http://en.wikipedia.org/wiki/... | bsd-3-clause | aeee291c890b9636663791dfda128edf | 25.887324 | 77 | 0.6066 | 4.132035 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/kombu/serialization.py | 13 | 10988 | """
kombu.serialization
===================
Serialization utilities.
:copyright: (c) 2009 - 2012 by Ask Solem
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import codecs
import sys
import pickle as pypickle
try:
import cPickle as cpickle
except ImportError: # pragma: ... | bsd-3-clause | 596b3a6b4d3b50f0dffdd00b9934f95f | 31.702381 | 76 | 0.627139 | 4.365515 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/celery/task/sets.py | 12 | 5651 | # -*- coding: utf-8 -*-
"""
celery.task.sets
~~~~~~~~~~~~~~~~
Creating and applying groups of tasks.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from __future__ import with_statement
from .. import registry
fro... | bsd-3-clause | d51c3d20c685a449802ec67b372579bd | 33.248485 | 78 | 0.60361 | 3.960056 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/kombu/tests/test_transport_memory.py | 3 | 4122 | from __future__ import absolute_import
from __future__ import with_statement
import socket
from kombu.connection import BrokerConnection
from kombu.entity import Exchange, Queue
from kombu.messaging import Consumer, Producer
from .utils import TestCase
class test_MemoryTransport(TestCase):
def setUp(self):
... | bsd-3-clause | fa398fd64a0263050bee451c92882b5a | 29.087591 | 78 | 0.575206 | 4.001942 | false | true | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/celery/task/__init__.py | 14 | 2664 | # -*- coding: utf-8 -*-
"""
celery.task
~~~~~~~~~~~
Creating tasks, subtasks, sets and chords.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from ..app import app_or_default, current_task as _current_task
from ..... | bsd-3-clause | ed53b559585dfaa6db1fab83e8cbc66d | 27.042105 | 72 | 0.565315 | 4.012048 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/chardet/universaldetector.py | 191 | 6635 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | bsd-3-clause | 05cc1be5ed834ab8dfe5ca5be8026e8c | 42.084416 | 104 | 0.577091 | 4.141698 | false | false | false | false |
mozilla/make.mozilla.org | vendor-local/lib/python/kombu/transport/couchdb.py | 2 | 3298 | """
kombu.transport.couchdb
=======================
CouchDB transport.
:copyright: (c) 2010 - 2012 by David Clymer.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from Queue import Empty
import socket
import couchdb
from anyjson import loads, dumps
from ..utils import uui... | bsd-3-clause | 2fe1ecb5dd55653b33ce14c944d60369 | 26.714286 | 78 | 0.55943 | 4.233633 | false | false | false | false |
striglia/pyramid_swagger | pyramid_swagger/model.py | 1 | 2981 | # -*- coding: utf-8 -*-
"""
The core model we use to represent the entire ingested swagger schema for this
service.
"""
from __future__ import absolute_import
import re
from collections import namedtuple
PyramidEndpoint = namedtuple(
'PyramidEndpoint',
'path route_name view renderer')
class PathNotMatchedE... | bsd-3-clause | b3b2d40bec7a5631591a710b7fbdf6e5 | 32.494382 | 79 | 0.66689 | 4.134535 | false | false | false | false |
sphinx-gallery/sphinx-gallery | plotly_examples/plot_0_plotly.py | 1 | 2760 | """
========================================
Example with the plotly graphing library
========================================
Sphinx-Gallery supports examples made with the `plotly library`_.
Sphinx-Gallery is able to capture the ``_repr_html_`` of plotly figure objects
(see :ref:`capture_repr`). To display the figur... | bsd-3-clause | f4562b3b437b430fe5698c0d4a232756 | 40.818182 | 91 | 0.692029 | 3.471698 | false | false | false | false |
striglia/pyramid_swagger | tests/tween_test.py | 1 | 14554 | # -*- coding: utf-8 -*-
"""Unit tests for tweens.py"""
from __future__ import absolute_import
import re
import mock
import pytest
import simplejson
from bravado_core.exception import SwaggerMappingError
from bravado_core.operation import Operation
from bravado_core.spec import Spec
from mock import Mock
from pyramid.... | bsd-3-clause | 1a1a05ea6ecae3cb714c154992723af2 | 34.935802 | 83 | 0.687234 | 3.590035 | false | true | false | false |
striglia/pyramid_swagger | pyramid_swagger/renderer.py | 1 | 1809 | # -*- coding: utf-8 -*-
"""
This model contains the main factory of renderers to use while dealing with Swagger 2.0 endpoints.
"""
from __future__ import absolute_import
from functools import partial
from bravado_core.exception import MatchingResponseNotFound
from bravado_core.exception import SwaggerMappingError
fro... | bsd-3-clause | ae07e96e0298500945cee20f98960603 | 37.489362 | 112 | 0.676064 | 4.390777 | false | false | false | false |
striglia/pyramid_swagger | tests/acceptance/relative_ref_test.py | 1 | 5144 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import json
import os.path
import re
import sys
import pytest
import yaml
from six import BytesIO
from webtest import TestApp as App
from tests.acceptance.app import main
DESERIALIZERS = {
'json': lambda r: json.loads(r.body.decode('utf-8')),
'... | bsd-3-clause | a897cdf7e1d10b6cfbcb566267ec763b | 30.175758 | 83 | 0.640747 | 3.799114 | false | true | false | false |
rlpy/rlpy | rlpy/Agents/TDControlAgent.py | 1 | 5051 | """Control Agents based on TD Learning, i.e., Q-Learning and SARSA"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
fro... | bsd-3-clause | a0e7515b5127bbd946ce086f294ea6e9 | 35.338129 | 85 | 0.598495 | 4.113192 | false | false | false | false |
rlpy/rlpy | rlpy/Domains/PacmanPackage/graphicsUtils.py | 1 | 12625 | from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
# graphicsUtils.py
# ----------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projec... | bsd-3-clause | 411a159070ed58c6f1ede47d7d5abf7b | 25.138716 | 89 | 0.567762 | 3.188131 | false | false | false | false |
rlpy/rlpy | rlpy/Representations/KernelizediFDD.py | 1 | 19069 | """Kernelized Incremental Feature Dependency Discovery"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import super
from future import standard_library
standard_library.install_aliases()
from builtins ... | bsd-3-clause | 78f96c0a3cc356fa763bd29f808397c7 | 36.760396 | 143 | 0.516178 | 3.906781 | false | false | false | false |
rlpy/rlpy | examples/puddleworld/tabular_gap.py | 1 | 2017 | """
Cart-pole balancing with continuous / Kernelized iFDD
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from rlpy.Domains.PuddleWorld import ... | bsd-3-clause | c9f054f982007308d92740581337e520 | 35.017857 | 87 | 0.680714 | 3.216906 | false | false | false | false |
rlpy/rlpy | examples/system_administrator/incr_tabular.py | 1 | 1832 | """
System Administrator with incremental tabular representation, Q-Learning
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from rlpy.Domains.S... | bsd-3-clause | ce51c0ccb98ab4fc21f52042746e4b14 | 34.230769 | 98 | 0.692686 | 3.57115 | false | false | false | false |
rlpy/rlpy | doc/conf.py | 1 | 8850 | # -*- coding: utf-8 -*-
#
# RLPy documentation build configuration file, created by
# sphinx-quickstart on Sun Jul 14 22:41:58 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | bsd-3-clause | 8c9e64ea795109004e8c9d58669da1fa | 31.777778 | 117 | 0.701017 | 3.704479 | false | true | false | false |
rlpy/rlpy | rlpy/Policies/FixedPolicy.py | 1 | 12074 | """Fixed policy. Encodes fixed policies for particular domains."""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
from ... | bsd-3-clause | e3040463e2c3b0434ab3efea2cd070ac | 43.553506 | 132 | 0.519546 | 4.496834 | false | false | false | false |
rlpy/rlpy | rlpy/Representations/Tabular.py | 1 | 1559 | """Tabular representation"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import super
from builtins import int
from future import standard_library
standard_library.install_aliases()
from .Representati... | bsd-3-clause | 12bf37cfec9c12129af4a1f42a28e483 | 33.644444 | 78 | 0.685696 | 3.668235 | false | false | false | false |
rlpy/rlpy | rlpy/Experiments/MDPSolverExperiment.py | 1 | 1693 | """Standard Experiment for Learning Control in RL"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import rlpy.Tools.ipshell
from .Experiment imp... | bsd-3-clause | 165c2eda367f7b660c7e791e44557544 | 30.351852 | 87 | 0.647962 | 4.021378 | false | false | false | false |
rlpy/rlpy | examples/tutorial/ChainMDPTut_example.py | 1 | 2147 | #!/usr/bin/env python
"""
Domain Tutorial for RLPy
=================================
Assumes you have created the ChainMDPTut.py domain according to the
tutorial and placed it in the current working directory.
Tests the agent using SARSA with a tabular representation.
"""
from __future__ import unicode_literals
from _... | bsd-3-clause | 46a99858919ffd6f2bfaf480ec186f2a | 32.030769 | 134 | 0.70191 | 3.998138 | false | false | false | false |
rlpy/rlpy | examples/uav/q-indep.py | 1 | 1720 | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from rlpy.Domains import PST
from rlpy.Agents import Q_Learning
from rlpy.Representations import *
f... | bsd-3-clause | c4b110bc14f4bca0c294aeefe625f216 | 34.833333 | 87 | 0.661628 | 3.339806 | false | false | false | false |
rlpy/rlpy | rlpy/Representations/IncrementalTabular.py | 1 | 2652 | """Incrementally expanded Tabular Representation"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
from .Representation... | bsd-3-clause | 7fe4f6490374afe0ffda603f52bd2714 | 30.571429 | 79 | 0.603695 | 3.860262 | false | false | false | false |
rlpy/rlpy | examples/hiv/ifdd.py | 1 | 2557 | """
Cart-pole balancing with continuous / Kernelized iFDD
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from rlpy.Domains import HIVTreatment
... | bsd-3-clause | 0bda34cbe05228f15ab9f47320bdd308 | 37.164179 | 98 | 0.630817 | 3.469471 | false | false | false | false |
oasis-open/cti-python-stix2 | stix2/test/v21/test_indicator.py | 1 | 10518 | import datetime as dt
import re
import pytest
import pytz
import stix2
from .constants import FAKE_TIME, INDICATOR_ID, INDICATOR_KWARGS
EXPECTED_INDICATOR = """{
"type": "indicator",
"spec_version": "2.1",
"id": "indicator--a740531e-63ff-4e49-a9e1-a0a3eed0e3e7",
"created": "2017-01-01T00:00:01.000Z"... | bsd-3-clause | c4891c40740e27abcaae9a6f70fa0782 | 35.648084 | 115 | 0.663434 | 3.292019 | false | true | false | false |
oasis-open/cti-python-stix2 | stix2/datastore/memory.py | 1 | 13001 | """Python STIX2 Memory Source/Sink"""
import io
import itertools
import json
import os
from stix2 import v20, v21
from stix2.base import _STIXBase
from stix2.datastore import DataSink, DataSource, DataStoreMixin
from stix2.datastore.filters import FilterSet, apply_common_filters
from stix2.parsing import parse
def ... | bsd-3-clause | b01b64d81c65860c1da4932875fc85b7 | 34.425068 | 111 | 0.601954 | 4.106443 | false | false | false | false |
oasis-open/cti-python-stix2 | stix2/test/v21/test_opinion.py | 1 | 2937 | import datetime as dt
import re
import pytest
import pytz
import stix2
from .constants import OPINION_ID
EXPLANATION = (
'This doesn\'t seem like it is feasible. We\'ve seen how '
'PandaCat has attacked Spanish infrastructure over the '
'last 3 years, so this change in targeting seems too great'
' t... | bsd-3-clause | b612c98793ae23636b1dfd3fa6114fa2 | 30.244681 | 89 | 0.608104 | 2.672429 | false | false | false | false |
oasis-open/cti-python-stix2 | stix2/test/v21/test_datastore_composite.py | 1 | 5289 | import pytest
from stix2.datastore import CompositeDataSource, make_id
from stix2.datastore.filters import Filter
from stix2.datastore.memory import MemorySink, MemorySource, MemoryStore
from stix2.utils import parse_into_datetime
from stix2.v21.common import TLP_GREEN
def test_add_remove_composite_datasource():
... | bsd-3-clause | 8617964950551a891a6a40fa79b77ac6 | 31.447853 | 92 | 0.668936 | 3.015393 | false | true | false | false |
oasis-open/cti-python-stix2 | stix2/test/v20/test_course_of_action.py | 1 | 2282 | import datetime as dt
import pytest
import pytz
import stix2
from .constants import COURSE_OF_ACTION_ID, IDENTITY_ID
EXPECTED = """{
"type": "course-of-action",
"id": "course-of-action--8e2e2d2b-17d4-4cbf-938f-98ee46b3cd3f",
"created_by_ref": "identity--311b2d2d-f010-4473-83ec-1edf84858f4c",
"create... | bsd-3-clause | a4e353c953dce2364341b7033079ce85 | 37.677966 | 139 | 0.648992 | 3.169444 | false | true | false | false |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/endpoints/resource.py | 1 | 7374 | # -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849.endpoints.resource
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of the resource protection provider logic of
OAuth 1.0 RFC 5849.
"""
import logging
from .. import errors
from .base import BaseEndpoint
log = logging.getLogger(__name__)... | bsd-3-clause | 30ddb4879872e107aee8df52729531b0 | 44.239264 | 114 | 0.621101 | 4.85451 | false | false | false | false |
oasis-open/cti-python-stix2 | stix2/properties.py | 1 | 32623 | """Classes for representing properties of STIX Objects and Cyber Observables."""
import base64
import binascii
import collections.abc
import copy
import inspect
import re
import uuid
import stix2
import stix2.hashes
from .base import _STIXBase
from .exceptions import CustomContentError, DictionaryKeyError, STIXError... | bsd-3-clause | 5065129ee54df35e86990bba6fa6bf9c | 35.369008 | 101 | 0.583974 | 4.429464 | false | false | false | false |
dask/dask | dask/delayed.py | 2 | 24353 | import operator
import types
import uuid
import warnings
from collections.abc import Iterator
from dataclasses import fields, is_dataclass, replace
from functools import partial
from tlz import concat, curry, merge, unique
from dask import config
from dask.base import (
DaskMethodsMixin,
dont_optimize,
is... | bsd-3-clause | 66869d853352f7fda504621096ba567b | 30.342342 | 113 | 0.595861 | 3.814096 | false | false | false | false |
dask/dask | dask/highlevelgraph.py | 2 | 47382 | from __future__ import annotations
import abc
import copy
import html
from collections.abc import Hashable, Iterable, KeysView, Mapping, MutableMapping, Set
from typing import Any, cast
import tlz as toolz
from dask import config
from dask.base import clone_key, flatten, is_dask_collection
from dask.core import keys... | bsd-3-clause | 10f60badba853171215921f1ff1631d5 | 35.33589 | 112 | 0.565637 | 4.356565 | false | false | false | false |
dask/dask | dask/dataframe/tests/test_optimize_dataframe.py | 2 | 1031 | import pandas as pd
import dask
import dask.dataframe as dd
dsk = {
("x", 0): pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, index=[0, 1, 3]),
("x", 1): pd.DataFrame({"a": [4, 5, 6], "b": [3, 2, 1]}, index=[5, 6, 8]),
("x", 2): pd.DataFrame({"a": [7, 8, 9], "b": [0, 0, 0]}, index=[9, 9, 9]),
}
dfs = list(... | bsd-3-clause | 908b7d7d5f36b47c3472b4a7b6e3a9ea | 24.775 | 78 | 0.536372 | 2.62341 | false | false | false | false |
dask/dask | dask/dataframe/accessor.py | 2 | 11692 | from __future__ import annotations
import warnings
import numpy as np
import pandas as pd
from dask.utils import derived_from
def _bind_method(cls, pd_cls, attr, min_version=None):
def func(self, *args, **kwargs):
return self._function_map(attr, *args, **kwargs)
func.__name__ = attr
func.__qua... | bsd-3-clause | a0027722597a23fa26b6a9d971a22f0d | 27.173494 | 109 | 0.557048 | 3.939353 | false | false | false | false |
dask/dask | dask/array/svg.py | 3 | 8012 | import math
import re
import numpy as np
def svg(chunks, size=200, **kwargs):
"""Convert chunks from Dask Array into an SVG Image
Parameters
----------
chunks: tuple
size: int
Rough size of the image
Returns
-------
text: An svg string depicting the array as a grid of chunks... | bsd-3-clause | a83684d7b473a81f313f5a3e095f16f5 | 27.512456 | 87 | 0.506116 | 2.897649 | false | false | false | false |
dask/dask | dask/dataframe/io/parquet/utils.py | 2 | 27077 | import re
import pandas as pd
from dask import config
from dask.dataframe.io.utils import _is_local_fs
from dask.utils import natural_sort_key
class Engine:
"""The API necessary to provide a new Parquet reader/writer"""
@classmethod
def read_metadata(
cls,
fs,
paths,
cat... | bsd-3-clause | 4503435f002be7da14e181e726388505 | 34.302477 | 88 | 0.567419 | 4.349719 | false | false | false | false |
dask/dask | dask/array/image.py | 2 | 1960 | import os
from glob import glob
try:
from skimage.io import imread as sk_imread
except (AttributeError, ImportError):
pass
from dask.array.core import Array
from dask.base import tokenize
def add_leading_dimension(x):
return x[None, ...]
def imread(filename, imread=None, preprocess=None):
"""Read ... | bsd-3-clause | 1c1a4cd808af7a22ba1683e06027ca63 | 27.405797 | 83 | 0.639796 | 3.959596 | false | false | false | false |
dask/dask | dask/dataframe/io/orc/arrow.py | 2 | 4452 | import pyarrow as pa
import pyarrow.orc as orc
from dask.dataframe.io.utils import _get_pyarrow_dtypes, _meta_from_dtypes
class ArrowORCEngine:
@classmethod
def read_metadata(
cls,
fs,
paths,
columns,
index,
split_stripes,
aggregate_files,
**kwa... | bsd-3-clause | edd0cb0e28cb939e14648a75bcbd786d | 34.333333 | 88 | 0.515499 | 4.152985 | false | false | false | false |
dask/dask | dask/dataframe/core.py | 2 | 286695 | from __future__ import annotations
import operator
import warnings
from collections.abc import Hashable, Iterator, Sequence
from functools import partial, wraps
from numbers import Integral, Number
from operator import getitem
from pprint import pformat
from typing import Any, Callable, ClassVar, Literal, Mapping
imp... | bsd-3-clause | 97a42d14327fdf1c2e8c5602a19faca4 | 34.07377 | 111 | 0.567384 | 4.069511 | false | false | false | false |
dask/dask | dask/array/utils.py | 2 | 18638 | import contextlib
import functools
import itertools
import math
import numbers
import warnings
import numpy as np
from tlz import concat, frequencies
from dask.array.core import Array
from dask.highlevelgraph import HighLevelGraph
from dask.utils import has_keyword, is_arraylike, is_cupy_type
def normalize_to_array... | bsd-3-clause | ccbf6f64c760390408f1dc7b6f97bc62 | 31.527051 | 106 | 0.558751 | 3.775932 | false | false | false | false |
rapidpro/casepro | casepro/urls.py | 1 | 1783 | from pydoc import locate
from django.conf import settings
from django.conf.urls import include
from django.urls import re_path
from django.views import static
from django.views.i18n import JavaScriptCatalog
from casepro.utils.views import PartialTemplate
urlpatterns = [
re_path(r"", include("casepro.cases.urls")... | bsd-3-clause | 281e6bc814af5e7d96f655d5ce1d1203 | 39.522727 | 118 | 0.67078 | 3.357815 | false | false | false | false |
rapidpro/casepro | casepro/statistics/migrations/0016_auto_20191209_2222.py | 1 | 1307 | # Generated by Django 2.2.8 on 2019-12-09 22:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("statistics", "0015_populate_is_squashed"),
]
operations = [
migrations.AlterField(
model_name="dailycount",
name="is... | bsd-3-clause | da1c029eb11f9fd512e65f81a2f773de | 28.704545 | 54 | 0.533282 | 4.460751 | false | false | false | false |
rapidpro/casepro | casepro/contacts/migrations/0011_migrate_suspend_groups.py | 2 | 1288 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import json
from django.db import migrations
def create_suspend_groups(apps, schema_editor):
Org = apps.get_model("orgs", "Org")
Group = apps.get_model("contacts", "Group")
num_created = 0
num_updated = 0
for org i... | bsd-3-clause | 220f5705d129e6f172d45e8f9972da9c | 32.025641 | 117 | 0.618789 | 3.987616 | false | true | false | false |
rapidpro/casepro | casepro/backend/rapidpro.py | 1 | 15169 | from typing import Tuple
from dash.utils import chunks, is_dict_equal
from dash.utils.sync import BaseSyncer, SyncOutcome, sync_local_to_changes, sync_local_to_set
from django.utils.timezone import now
from casepro.contacts.models import Contact, Field, Group
from casepro.msgs.models import Label, Message, Outgoing
... | bsd-3-clause | 697eee36ff7fa0a1cd0b8483d89055cf | 34.52459 | 119 | 0.614279 | 3.827656 | false | false | false | false |
rapidpro/casepro | casepro/profiles/migrations/0006_notification.py | 2 | 1921 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
INDEX_SQL = """
-- for displaying a user's latest notifications in a given org
CREATE INDEX profiles_notification_org_user_created_on ON profiles_notif... | bsd-3-clause | 06ed3c00e013b7519e4b7bd60865130d | 39.87234 | 116 | 0.613222 | 4.231278 | false | false | false | false |
rapidpro/casepro | casepro/msgs/migrations/0053_faq.py | 2 | 1561 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("orgs", "0016_taskstate_is_disabled"), ("msgs", "0052_triggers")]
operations = [
migrations.CreateModel(
name="FAQ",
... | bsd-3-clause | 7d2617c3f58d55330dcaa181b13e9d7a | 34.477273 | 119 | 0.444587 | 5.05178 | false | false | false | false |
rapidpro/casepro | casepro/statistics/migrations/0015_populate_is_squashed.py | 1 | 1185 | # Generated by Django 2.2.8 on 2019-12-09 21:03
from django.db import migrations
BATCH_SIZE = 2500
def populate_is_squashed(apps, schema_editor):
DailyCount = apps.get_model("statistics", "DailyCount")
DailySecondTotalCount = apps.get_model("statistics", "DailySecondTotalCount")
TotalCount = apps.get_mo... | bsd-3-clause | 64c0135ef3fed9607667a5ad16595626 | 26.55814 | 81 | 0.643882 | 3.385714 | false | false | false | false |
rapidpro/casepro | casepro/statistics/views.py | 1 | 6793 | from datetime import timedelta
from dash.orgs.views import OrgPermsMixin
from dateutil.relativedelta import relativedelta
from smartmin.mixins import NonAtomicMixin
from smartmin.views import SmartCreateView, SmartCRUDL, SmartTemplateView
from temba_client.utils import parse_iso8601
from django.http import JsonRespon... | bsd-3-clause | 09ca3f7531286bf6f87002703f9385d3 | 31.194313 | 114 | 0.633152 | 3.707969 | false | false | false | false |
rootpy/rootpy | rootpy/plotting/root2matplotlib.py | 3 | 28662 | """
This module provides functions that allow the plotting of ROOT histograms and
graphs with `matplotlib <http://matplotlib.org/>`_.
If you just want to save image files and don't want matplotlib to attempt to
create a graphical window, tell matplotlib to use a non-interactive backend
such as ``Agg`` when importing i... | bsd-3-clause | 4ef4d069c848386ccb091517a2544a45 | 33.202864 | 84 | 0.577873 | 3.900653 | false | false | false | false |
rootpy/rootpy | rootpy/utils/extras.py | 3 | 3462 | from __future__ import absolute_import
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlopen
else:
from urllib2 import urlopen
import xml.dom.minidom as minidom
from itertools import chain
try:
from itertools import izip as zip
except ImportError: # will be 3.x series
pass
from ..... | bsd-3-clause | 6a57b98744824d2b44ed19ab91f7e9e6 | 24.455882 | 102 | 0.548527 | 3.767138 | false | false | false | false |
rootpy/rootpy | rootpy/plotting/legend.py | 3 | 3298 | from __future__ import absolute_import
import numbers
from .. import ROOT, QROOT, asrootpy
from ..base import Object
from .hist import HistStack
from .box import _Positionable
from ..memory.keepalive import keepalive
__all__ = [
'Legend',
]
class Legend(_Positionable, Object, QROOT.TLegend):
_ROOT = QROOT.... | bsd-3-clause | 9439a0071dc533617d8b2bad005c0a3a | 29.256881 | 92 | 0.559733 | 4.076638 | false | false | false | false |
rootpy/rootpy | rootpy/extern/lockfile/linklockfile.py | 465 | 2649 | from __future__ import absolute_import
import time
import os
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
AlreadyLocked)
class LinkLockFile(LockBase):
"""Lock access to a file using atomic property of link(2).
>>> lock = LinkLockFile('somefile')
>>> lock = LinkL... | bsd-3-clause | efadc8785336eb7f86163b9aaf9c5da8 | 35.287671 | 75 | 0.508116 | 4.407654 | false | false | false | false |
rootpy/rootpy | rootpy/tree/treeobject.py | 3 | 8864 | from __future__ import absolute_import
from copy import deepcopy
from ..extern.six.moves import range
__all__ = [
'TreeObject',
'TreeCollectionObject',
'TreeCollection',
]
__MIXINS__ = {}
def mix_classes(cls, mixins):
if not isinstance(mixins, tuple):
mixins = (mixins,)
classes = (cls,... | bsd-3-clause | 3a47a38ffc6856629c603d9d2f24c480 | 29.777778 | 78 | 0.557536 | 4 | false | false | false | false |
rootpy/rootpy | examples/tree/overwrite.py | 7 | 2158 | #!/usr/bin/env python
"""
======================================
Copy a tree while overwriting branches
======================================
This is an example showing how to copy a tree while overwriting one or more of
its branches with new values.
"""
print(__doc__)
from rootpy.tree import Tree, TreeModel, FloatCo... | bsd-3-clause | d56b567fcff0459957ffe731c29cca14 | 29.394366 | 79 | 0.68443 | 3.632997 | false | true | false | false |
rootpy/rootpy | rootpy/stats/dataset.py | 3 | 1291 | from __future__ import absolute_import
import ROOT
from . import log; log = log[__name__]
from .. import QROOT, asrootpy
from ..base import NamedObject
from ..extern.six import string_types
__all__ = [
'DataSet',
]
class DataSet(NamedObject, QROOT.RooDataSet):
_ROOT = QROOT.RooDataSet
class Entry(object... | bsd-3-clause | 5a2160a912be0a5c06c3235b2e52054f | 27.065217 | 73 | 0.594888 | 3.842262 | false | false | false | false |
cobrateam/splinter | splinter/driver/webdriver/remote.py | 1 | 1557 | # -*- coding: utf-8 -*-
# Copyright 2013 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from selenium.webdriver import Remote
from selenium.webdriver.remote import remote_connection
from selenium.webdriver.common.desired_cap... | bsd-3-clause | bbd9c2d7df244e4364235fb63319901a | 32.847826 | 78 | 0.693642 | 4.313019 | false | false | false | false |
celery/django-celery | docs/conf.py | 4 | 2481 | # -*- coding: utf-8 -*-
import sys
import os
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
sys.path.insert(0, os.getcwd())
import django # noqa
os.environ.setdefault('DJANGO_SETTINGS_MO... | bsd-3-clause | 3a0948e39ca9642289225b9eebe29a2d | 27.848837 | 78 | 0.702942 | 3.549356 | false | false | false | false |
omab/django-social-auth | example/app/facebook.py | 14 | 3176 | from django.conf import settings
from django.contrib.auth import BACKEND_SESSION_KEY
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.views.decorators.csrf import csrf... | bsd-3-clause | 23b9eadbadbae28fab97cfa4a4cc8f66 | 34.288889 | 79 | 0.632872 | 4.441958 | false | false | false | false |
celery/django-celery | djcelery/compat.py | 8 | 1047 | from __future__ import absolute_import
import os
import sys
from kombu.utils.encoding import bytes_to_str, str_to_bytes
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
def python_2_unicode_compatible(cls):
"""Taken from Django project (django/utils/encoding.py) & modified a bit to
always have... | bsd-3-clause | 58be9ed5e9ae230401df31d5a1b770f1 | 22.795455 | 79 | 0.579752 | 3.444079 | false | false | false | false |
celery/django-celery | djcelery/picklefield.py | 3 | 3804 | """
Based on django-picklefield which is
Copyright (c) 2009-2010 Gintautas Miliauskas
but some improvements including not deepcopying values.
Provides an implementation of a pickled object field.
Such fields can contain any picklable objects.
The implementation is taken and adopted from Django... | bsd-3-clause | dfbcb6aad4b9b1f49364282d8a25d43e | 28.71875 | 77 | 0.670347 | 3.788845 | false | false | false | false |
celery/django-celery | djcelery/management/commands/celerymon.py | 1 | 1069 | """
Start the celery clock service from the Django management command.
"""
from __future__ import absolute_import, unicode_literals
import sys
from djcelery.app import app
from djcelery.management.base import CeleryCommand
try:
from celerymon.bin.celerymon import MonitorCommand
mon = MonitorCommand(app=app... | bsd-3-clause | f1fc7e7da99458e8082bb519d658382c | 21.744681 | 78 | 0.643592 | 3.973978 | false | false | false | false |
mitodl/open-discussions | widgets/models.py | 1 | 1061 | """WidgetApp models"""
from django.db import models
from django.contrib.postgres.fields import JSONField
class WidgetList(models.Model):
"""
WidgetList handles authentication and is linked to a set of WidgetInstances
"""
class Meta:
app_label = "widgets"
class WidgetInstance(models.Model):
... | bsd-3-clause | a58bd370b8cf19b9c393ee86432fd15c | 28.472222 | 103 | 0.649387 | 4.420833 | false | false | false | false |
mitodl/open-discussions | course_catalog/etl/xpro_test.py | 1 | 10122 | """Tests for MicroMasters ETL functions"""
import json
# pylint: disable=redefined-outer-name
from datetime import datetime
from itertools import chain
import pytest
from course_catalog.constants import PlatformType
from course_catalog.etl import xpro
from course_catalog.etl.utils import UCC_TOPIC_MAPPINGS
from cour... | bsd-3-clause | 1b70190a893444956f7f33c69a5f7b4e | 41.351464 | 99 | 0.501778 | 4.429759 | false | true | false | false |
mitodl/open-discussions | course_catalog/etl/pipelines_test.py | 1 | 6854 | """Tests for ETL pipelines"""
from contextlib import contextmanager
from importlib import reload
from unittest.mock import patch
from course_catalog.constants import PlatformType
from course_catalog.etl import pipelines
from course_catalog.etl.constants import (
ProgramLoaderConfig,
CourseLoaderConfig,
Lea... | bsd-3-clause | 43451bebcca32fe6e79fa4b378f8d1aa | 35.849462 | 87 | 0.694923 | 3.770077 | false | true | false | false |
mitodl/open-discussions | course_catalog/etl/mitxonline.py | 1 | 7324 | """MITX Online course catalog ETL"""
import copy
import logging
import re
from datetime import datetime
from urllib.parse import urljoin
import pytz
import requests
from django.conf import settings
from course_catalog.constants import OfferedBy, PlatformType
from course_catalog.etl.utils import transform_topics
log ... | bsd-3-clause | e245f7329ec3d31f83a3f56108faf8f2 | 34.043062 | 90 | 0.593392 | 4 | false | false | false | false |
mitodl/open-discussions | channels/serializers/channels.py | 1 | 9295 | """
Serializers for channel REST APIs
"""
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from channels.constants import VALID_CHANNEL_TYPES, VALID_LINK_TYPES
from channels.models import Channel
from open_discussions.utils import filter_dict_with_renamed_keys
from open_disc... | bsd-3-clause | dfc7fb7cd6a4c03ea7840293107f7d96 | 37.568465 | 100 | 0.645939 | 4.466603 | false | false | false | false |
mitodl/open-discussions | channels_fields/models.py | 1 | 2242 | """Models for channels_fields"""
from django.contrib.auth.models import Group
from django.db import models
from django.db.models import deletion
from channels_fields.constants import FIELD_ROLE_CHOICES
from course_catalog.models import UserList
from discussions.models import BaseChannel
from open_discussions.models im... | bsd-3-clause | 8876ad90756ec5870e59e84cb9c3afa5 | 29.712329 | 93 | 0.694915 | 3.968142 | false | false | false | false |
mitodl/open-discussions | course_catalog/migrations/0001_initial.py | 1 | 1666 | # Generated by Django 2.0.8 on 2018-12-21 02:17
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Course",
fields=[
... | bsd-3-clause | 5344c2766d4cb0010d36797f52a15ff7 | 37.744186 | 88 | 0.516807 | 4.732955 | false | false | false | false |
mitodl/open-discussions | search/management/commands/recreate_index.py | 1 | 2429 | """Management command to index reddit content"""
from django.core.management.base import BaseCommand, CommandError
from open_discussions.utils import now_in_utc
from search.tasks import start_recreate_index
from search.constants import VALID_OBJECT_TYPES
class Command(BaseCommand):
"""Indexes reddit content"""
... | bsd-3-clause | 5a7732f0604fb98af2d7dd230670579b | 36.369231 | 106 | 0.570193 | 4.368705 | false | false | false | false |
mitodl/open-discussions | course_catalog/migrations/0047_add_video_resource.py | 1 | 2313 | # Generated by Django 2.1.11 on 2019-10-21 19:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("course_catalog", "0046_add_learning_resource_offeror")]
operations = [
migrations.CreateModel(
name="VideoResource",
fields=[
... | bsd-3-clause | 89528f3ce5828f2da8026b2e686f56dc | 39.578947 | 88 | 0.479032 | 4.879747 | false | false | false | false |
mitodl/open-discussions | channels/serializers/moderators.py | 1 | 2912 | """Serializers for moderator REST APIs"""
from django.contrib.auth import get_user_model
from rest_framework import serializers
from channels.serializers.validators import validate_email, validate_username
from open_discussions.serializers import WriteableSerializerMethodField
from profiles.models import Profile
User... | bsd-3-clause | 4d92f3a8e5f657a2086466ea8981a47e | 33.666667 | 85 | 0.662088 | 4.378947 | false | false | false | false |
mitodl/open-discussions | course_catalog/etl/edx_shared.py | 1 | 2958 | """Shared functions for EdX sites"""
import logging
import os
import re
from subprocess import CalledProcessError, check_call
from tempfile import TemporaryDirectory
from django.contrib.contenttypes.models import ContentType
from course_catalog.etl.loaders import load_content_files
from course_catalog.etl.utils impor... | bsd-3-clause | 678e0c5853487a740a8eccea8f5e25d2 | 35.975 | 89 | 0.585531 | 4.225714 | false | false | false | false |
mitodl/open-discussions | course_catalog/migrations/0032_contenttype_limit_choice_models.py | 1 | 1353 | # Generated by Django 2.1.10 on 2019-08-02 19:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("course_catalog", "0031_add_course_run")]
operations = [
migrations.AlterField(
model_name="favoriteitem",
... | bsd-3-clause | 1707737462ec4aa8227813a8508aec7b | 32 | 78 | 0.529933 | 4.570946 | false | false | false | false |
theislab/scanpy | scanpy/tests/test_performance.py | 1 | 1060 | import json
import sys
from subprocess import run
def descend(profimp_data, modules, path):
module = profimp_data["module"]
path = [*path, module]
if module in modules:
yield " → ".join(e for e in path if e is not None)
modules.remove(module)
for child in profimp_data["children"]:
... | bsd-3-clause | 631558afb958cc1d91d4dc036d9b725a | 27.594595 | 78 | 0.620038 | 3.491749 | false | false | false | false |
theislab/scanpy | scanpy/experimental/_docs.py | 1 | 2752 | """Shared docstrings for experimental function parameters.
"""
doc_adata = """\
adata
The annotated data matrix of shape `n_obs` × `n_vars`.
Rows correspond to cells and columns to genes.
"""
doc_dist_params = """\
theta
The negative binomial overdispersion parameter `theta` for Pearson residuals.
Hig... | bsd-3-clause | 39b7cc288ec823ed044f9273014df129 | 33.822785 | 106 | 0.70956 | 3.831476 | false | false | false | false |
theislab/scanpy | scanpy/plotting/_tools/paga.py | 1 | 47424 | import warnings
import collections.abc as cabc
from pathlib import Path
from types import MappingProxyType
from typing import Optional, Union, List, Sequence, Mapping, Any, Tuple
import numpy as np
import pandas as pd
import scipy
from anndata import AnnData
from pandas.api.types import is_categorical_dtype
from matpl... | bsd-3-clause | 4fba84574633bb64248e2999db211b4c | 34.748115 | 88 | 0.56331 | 3.771642 | false | false | false | false |
theislab/scanpy | scanpy/external/tl/_phate.py | 1 | 5331 | """\
Embed high-dimensional data using PHATE
"""
from typing import Optional, Union
from anndata import AnnData
from ..._settings import settings
from ..._compat import Literal
from ... import logging as logg
from ..._utils import AnyRandom
def phate(
adata: AnnData,
n_components: int = 2,
k: int = 5,
... | bsd-3-clause | d0f2f89e07db0e9c4f46be5f83d14947 | 32.515723 | 93 | 0.623194 | 3.665062 | false | false | false | false |
theislab/scanpy | scanpy/tests/test_scaling.py | 1 | 1974 | import pytest
import numpy as np
from anndata import AnnData
from scipy.sparse import csr_matrix
import scanpy as sc
# test "data" for 3 cells * 4 genes
X = [
[-1, 2, 0, 0],
[1, 2, 4, 0],
[0, 2, 2, 0],
] # with gene std 1,0,2,0 and center 0,2,2,0
X_scaled = [
[-1, 2, 0, 0],
[1, 2, 2, 0],
[0, ... | bsd-3-clause | 188bcad80acc08898f811b8bfef78356 | 35.555556 | 81 | 0.64691 | 2.89019 | false | true | false | false |
theislab/scanpy | scanpy/datasets/_datasets.py | 1 | 14227 | from pathlib import Path
from typing import Optional
import warnings
import numpy as np
import pandas as pd
import anndata as ad
from packaging import version
from .. import logging as logg, _utils
from .._compat import Literal
from .._settings import settings
from ..readwrite import read, read_visium
from ._utils im... | bsd-3-clause | 7747a59f4a06d9df23d7bc883ff2b0bf | 32.235981 | 139 | 0.653286 | 3.225624 | false | false | false | false |
theislab/scanpy | scanpy/external/tl/_wishbone.py | 1 | 4828 | import collections.abc as cabc
from typing import Iterable, Collection, Union
import numpy as np
import pandas as pd
from anndata import AnnData
from ... import logging
def wishbone(
adata: AnnData,
start_cell: str,
branch: bool = True,
k: int = 15,
components: Iterable[int] = (1, 2, 3),
num... | bsd-3-clause | 927fa55496dbcd55af753f58f001530b | 29.948718 | 87 | 0.634838 | 3.5631 | false | false | false | false |
theislab/scanpy | scanpy/plotting/_tools/scatterplots.py | 1 | 43061 | import collections.abc as cabc
from copy import copy
from numbers import Integral
from itertools import combinations, product
from typing import (
Collection,
Union,
Optional,
Sequence,
Any,
Mapping,
List,
Tuple,
)
from warnings import warn
import numpy as np
import pandas as pd
from an... | bsd-3-clause | c3dc08af017981c00c62d097a52c6f19 | 30.661029 | 102 | 0.576093 | 3.751111 | false | false | false | false |
aaugustin/websockets | example/tutorial/step2/app.py | 1 | 5034 | #!/usr/bin/env python
import asyncio
import json
import secrets
import websockets
from connect4 import PLAYER1, PLAYER2, Connect4
JOIN = {}
WATCH = {}
async def error(websocket, message):
"""
Send an error message.
"""
event = {
"type": "error",
"message": message,
}
awa... | bsd-3-clause | 2217046cb9ed1d84e5af6975ab5cc7ad | 25.494737 | 77 | 0.596941 | 4.191507 | false | false | false | false |
theislab/scanpy | scanpy/tests/test_embedding.py | 1 | 2917 | from importlib.util import find_spec
from unittest.mock import patch
import warnings
from scanpy.tests._data._cached_datasets import pbmc68k_reduced
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_raises
import scanpy as sc
def test_tsne():
pbmc = ... | bsd-3-clause | 140282c74c7e5f313630a5d982314c05 | 31.775281 | 86 | 0.658896 | 2.940524 | false | true | false | false |
theislab/scanpy | scanpy/tools/_embedding_density.py | 1 | 5990 | """\
Calculate density of cells in embeddings
"""
import numpy as np
from anndata import AnnData
from typing import Union, Optional, Sequence
from .. import logging as logg
from .._utils import sanitize_anndata
def _calc_density(x: np.ndarray, y: np.ndarray):
"""\
Calculates the density of points in 2 dimen... | bsd-3-clause | 06fc27bf13fd39285fef1ab23018fa0d | 30.361257 | 85 | 0.634057 | 3.88961 | false | false | false | false |
theislab/scanpy | scanpy/tools/_louvain.py | 1 | 8506 | from types import MappingProxyType
from typing import Optional, Tuple, Sequence, Type, Mapping, Any
import numpy as np
import pandas as pd
from anndata import AnnData
from natsort import natsorted
from scipy.sparse import spmatrix
from packaging import version
from ._utils_clustering import rename_groups, restrict_ad... | bsd-3-clause | 2176fbd0dcac3d716c9e6d097a53b736 | 35.333333 | 85 | 0.606093 | 4.040875 | false | false | false | false |
theislab/scanpy | scanpy/metrics/_metrics.py | 1 | 2381 | """
Metrics which don't quite deserve their own file.
"""
from typing import Optional, Sequence, Union
import pandas as pd
from pandas.api.types import is_categorical_dtype
from natsort import natsorted
import numpy as np
def confusion_matrix(
orig: Union[pd.Series, np.ndarray, Sequence],
new: Union[pd.Serie... | bsd-3-clause | ecd783ada05ee8a1612c041490e201cc | 26.056818 | 83 | 0.629147 | 3.624049 | false | false | false | false |
theislab/scanpy | scanpy/plotting/_qc.py | 1 | 3371 | from typing import Optional, Union
import numpy as np
import pandas as pd
from anndata import AnnData
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from . import _utils
from ._docs import doc_show_save_ax
from ..preprocessing._normalization import normalize_total
from .._utils import _doc_para... | bsd-3-clause | 2892d2b682e6ecf6ad40e85d80d570e7 | 33.357143 | 105 | 0.647164 | 3.446264 | false | false | false | false |
theislab/scanpy | scanpy/plotting/_docs.py | 1 | 13507 | """\
Shared docstrings for plotting function parameters.
"""
doc_adata_color_etc = """\
adata
Annotated data matrix.
color
Keys for annotations of observations/cells or variables/genes, e.g.,
`'ann1'` or `['ann1', 'ann2']`.
gene_symbols
Column name in `.var` DataFrame that stores gene symbols. By defa... | bsd-3-clause | 96f084f08b1068f0a2bd63b1021fa005 | 42.003185 | 105 | 0.71673 | 3.777063 | false | false | false | false |
aaugustin/websockets | tests/legacy/test_http.py | 1 | 5629 | import asyncio
from websockets.exceptions import SecurityError
from websockets.legacy.http import *
from websockets.legacy.http import read_headers
from .utils import AsyncioTestCase
class HTTPAsyncTests(AsyncioTestCase):
def setUp(self):
super().setUp()
self.stream = asyncio.StreamReader(loop=s... | bsd-3-clause | e388da7d82594cd250990d70d6272a60 | 40.696296 | 86 | 0.644342 | 3.55142 | false | true | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.