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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mitdbg/aurum-datadiscovery | api/annotation.py | 1 | 2289 | from collections import namedtuple
from enum import Enum
BaseMDHit = namedtuple(
'MDHit', 'id, author, md_class, text, source, target, relation')
BaseMDComment = namedtuple('MDComment', 'id, author, text, ref_id')
class MDClass(Enum):
WARNING = 0
INSIGHT = 1
QUESTION = 2
class MDRelation(Enum):
... | mit | ccf6bcaf4805f3ed623a955791e35a36 | 21.441176 | 68 | 0.530799 | 3.633333 | false | false | false | false |
mitdbg/aurum-datadiscovery | ontomatch/javarandom.py | 1 | 4787 | import time
import math
class Random(object):
"""
An implementation of the Java SE 6 random number generator.
Java's RNG is based on a classic Knuth-style linear congruential formula,
as described in
http://download.oracle.com/javase/6/docs/api/java/util/Random.html. This
makes it quite trivia... | mit | f7e1fd4084c00338636ec2a74e684d8c | 27 | 78 | 0.540004 | 4.087959 | false | false | false | false |
mitdbg/aurum-datadiscovery | nearpy/examples/example2.py | 1 | 5674 | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Ole Krause-Sparmann
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | mit | f7b0c725dba4bedee7519eb814767af8 | 30.876404 | 90 | 0.652097 | 3.923928 | false | false | false | false |
mitdbg/aurum-datadiscovery | knowledgerepr/ekgstore/neo4j_store.py | 1 | 2165 | from neo4j.v1 import GraphDatabase
from tqdm import tqdm
from api.apiutils import Relation
from knowledgerepr import fieldnetwork
class Neo4jExporter(object):
def __init__(self,
host='localhost',
port=7687,
user="neo4j",
pwd="aurum"):
se... | mit | e488bc876262a51877e5122b70f6d847 | 46.065217 | 124 | 0.55843 | 3.739206 | false | false | false | false |
mitdbg/aurum-datadiscovery | networkbuildercoordinator.py | 1 | 5695 | from modelstore.elasticstore import StoreHandler
from knowledgerepr import fieldnetwork
from knowledgerepr import networkbuilder
from knowledgerepr.fieldnetwork import FieldNetwork
from inputoutput import inputoutput as io
import sys
import time
def main(output_path=None):
start_all = time.time()
network = F... | mit | e393eeb3382285144d208a67b3da1756 | 31.357955 | 97 | 0.648464 | 3.269231 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/block/replication/disaster_recovery_failover.py | 2 | 2006 | """Failover an inaccessible block volume to its available replicant volume."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
@click.command(cls=SoftLayer.CLI.command.SLComman... | mit | 71b55a41e02005eb043a82de123ef007 | 50.435897 | 115 | 0.723829 | 4.268085 | false | true | false | false |
softlayer/softlayer-python | SoftLayer/CLI/vpn/ipsec/cancel.py | 2 | 1073 | """Cancel an IPSec service."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('identifier')
@click.option('--immediate',
is_flag=True,
default=False,
... | mit | 49e4c470e0fc170cfaa5298c102dd178 | 33.612903 | 105 | 0.696179 | 4.064394 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/email/list.py | 2 | 2745 | """Lists Email Delivery Service """
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.managers.account import AccountManager
from SoftLayer.managers.email import... | mit | e83b98df3cff66158537d9d549d67a44 | 38.214286 | 105 | 0.653552 | 3.972504 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/user/remove_access.py | 2 | 1640 | """User remove access to devices."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('identifier')
@click.option('--hardware', '-h',
help="Display hardware this user... | mit | 55ebb64c86ec983161563b7e4fd84f06 | 34.652174 | 116 | 0.611585 | 4.350133 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/hardware/create_options.py | 2 | 6630 | """Server order options for a given chassis."""
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.managers import account
from SoftLayer.managers import hardware... | mit | 78f9e6b366aab3bf5e3f4a1804ec998e | 36.247191 | 113 | 0.607843 | 3.904594 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/securitygroup/rule.py | 2 | 6250 | """Manage security group rules."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
COLUMNS = ['id',
'remoteIp',
'remoteGroupId',
'direction',
... | mit | 8cc10a96a4bc5ab13f13b2dcd6e046f1 | 32.42246 | 82 | 0.60384 | 3.843788 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/ticket/detach.py | 2 | 1466 | """Detach devices from a ticket."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import helpers
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('identifier', type=int)
... | mit | fb0f892d3c64b85aa4e9cb514b800b89 | 40.885714 | 102 | 0.727149 | 4.117978 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/hardware/power.py | 2 | 3127 | """Power commands."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('... | mit | dc4de03d4751f7c17084c3682c3b7817 | 31.572917 | 82 | 0.677646 | 3.696217 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/virt/storage.py | 2 | 3491 | """Get storage details for a virtual server."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('identifier'... | mit | dcf115f5dc84794f6d68d6bc2c0ba6e3 | 38.670455 | 113 | 0.614437 | 4.035838 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/vlan/create_options.py | 2 | 1101 | """Vlan order options."""
# :license: MIT, see LICENSE for more details.
# pylint: disable=too-many-statements
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
@click.command(cls=SoftLayer.CLI.command.SLCommand, short_help="Get options to use for creating Vlan ... | mit | 86e6cde2926e020aa6ef7037ee0d62f1 | 32.363636 | 111 | 0.69119 | 3.836237 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/fixtures/SoftLayer_Product_Package.py | 2 | 72806 | # pylint: skip-file
HARDWARE_ITEMS = [
{'attributes': [],
'capacity': '999',
'description': 'Unknown',
'itemCategory': {'categoryCode': 'unknown', 'id': 325},
'keyName': 'UNKNOWN',
'prices': [{'accountRestrictions': [],
'currentPriceFlag': '',
'hourlyRecurr... | mit | 11a4dd47ef993997ee055bc076c5c2cf | 31.825068 | 106 | 0.370244 | 4.430206 | false | false | true | false |
softlayer/softlayer-python | SoftLayer/CLI/vlan/list.py | 2 | 3160 | """List VLANs."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI.vlan.detail import get_gateway_firewall
from SoftLayer import utils
COLUMNS = ['Id',
'Number',
'Fully qual... | mit | a06da184b105a3ffd423a9b54ec86db1 | 33.347826 | 107 | 0.572468 | 3.994943 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/tags/delete.py | 2 | 1098 | """Delete Tags."""
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.managers.tags import TagManager
@click.command(cls=SLCommand)
@click.argument('identifier')
@click.option('--name', required=Fa... | mit | 0cd2473266484ff5fec6b1f827ec8775 | 35.6 | 91 | 0.693078 | 3.623762 | false | false | false | false |
kashifrazzaqui/vyked | vyked/services.py | 1 | 21561 | import json
import logging
import socket
import time
import setproctitle
from asyncio import iscoroutine, coroutine, wait_for, TimeoutError, Future, get_event_loop, async
from functools import wraps, partial
from aiohttp.web import Response, WebSocketResponse
from again.utils import unique_hex
from .packet import Mes... | mit | d632224dfd91ccff8358ed16eaeea489 | 34.638017 | 120 | 0.581513 | 4.217723 | false | false | false | false |
kashifrazzaqui/vyked | vyked/bus.py | 1 | 11821 | import asyncio
from collections import defaultdict
from functools import partial
import json
import logging
import random
import uuid
from again.utils import unique_hex
import aiohttp
from retrial.retrial import retry
from .services import TCPServiceClient, HTTPServiceClient
from .pubsub import PubSub
from .packet im... | mit | 7dd3d0ea7e3d9f06372731e04f8ec567 | 40.477193 | 119 | 0.602233 | 4.052451 | false | false | false | false |
jmschrei/pomegranate | tests/test_markov_network.py | 1 | 18046 | # test_bayes_net.py
# Authors: Jacob Schreiber <jmschreiber91@gmail.com>
'''
These are unit tests for the Markov network model of pomegranate.
'''
from __future__ import division
from pomegranate import JointProbabilityTable
from pomegranate import MarkovNetwork
from pomegranate.io import DataGenerator
from pomegran... | mit | 95ea743ffd7fd8bcffc1ab32f641d716 | 30.439024 | 96 | 0.643522 | 2.370419 | false | true | false | false |
jmschrei/pomegranate | pomegranate/io.py | 1 | 12415 | import numpy
try:
import pandas
except:
pandas = None
class BaseGenerator(object):
"""The base data generator class.
This object is inherited by data generator objects in order to specify that
they are data generators. Do not use this object directly.
"""
def __init__(self):
pass
def __len__(self):
re... | mit | 799b02557fb73c268a0a146a72b72ea2 | 26.345815 | 76 | 0.681595 | 3.116997 | false | false | false | false |
franzinc/agraph-python | src/franz/openrdf/model/statement.py | 1 | 5862 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable-msg=C0103
################################################################################
# Copyright (c) 2006-2017 Franz Inc.
# All rights reserved. This program and the accompanying materials are
# made available under the terms of the MIT License w... | mit | beb22c5a85df9c2cb06f943f2756164d | 33.081395 | 116 | 0.581713 | 4.544186 | false | false | false | false |
catalyst-cooperative/pudl | test/unit/analysis/plant_parts_eia_test.py | 1 | 13499 | """Tests for timeseries anomalies detection and imputation."""
import pandas as pd
import pudl.analysis.plant_parts_eia
GENS_MEGA = pd.DataFrame(
{
"plant_id_eia": [1, 1, 1, 1],
"report_date": ["2020-01-01", "2020-01-01", "2020-01-01", "2020-01-01"],
"utility_id_eia": [111, 111, 111, 111],... | mit | c0b0bba143a5b689aa0fd5ca11cea8ea | 29.471783 | 92 | 0.42055 | 3.466615 | false | true | false | false |
catalyst-cooperative/pudl | test/unit/harvest_test.py | 1 | 14730 | """Tests for Resource harvesting methods."""
from typing import Any, Dict, List
import numpy as np
import pandas as pd
import pytest
from pudl.metadata import Resource
from pudl.metadata.helpers import most_frequent
# ---- Helpers ---- #
def _assert_frame_equal(a: pd.DataFrame, b: pd.DataFrame, **kwargs: Any) -> N... | mit | a9594c7e7afa9394c891fef693aee562 | 31.95302 | 88 | 0.459335 | 3.093238 | false | false | false | false |
catalyst-cooperative/pudl | src/pudl/glue/ferc1_eia.py | 1 | 31314 | """Extract and transform glue tables between FERC Form 1 and EIA 860/923.
FERC1 and EIA report on many of the same plants and utilities, but have no
embedded connection. We have combed through the FERC and EIA plants and
utilities to generate id's which can connect these datasets. The resulting
fields in the PUDL tabl... | mit | 37e26db92feb2f8f84c1895a8834e622 | 37.996264 | 90 | 0.636936 | 3.298989 | false | false | false | false |
vimalloc/flask-jwt-extended | examples/custom_decorators.py | 1 | 1288 | from functools import wraps
from flask import Flask
from flask import jsonify
from flask_jwt_extended import create_access_token
from flask_jwt_extended import get_jwt
from flask_jwt_extended import JWTManager
from flask_jwt_extended import verify_jwt_in_request
app = Flask(__name__)
app.config["JWT_SECRET_KEY"] = ... | mit | d967f14d176ebcd352456d3af6be956a | 24.254902 | 77 | 0.65295 | 3.788235 | false | false | false | false |
vimalloc/flask-jwt-extended | examples/blocklist_redis.py | 1 | 1920 | from datetime import timedelta
import redis
from flask import Flask
from flask import jsonify
from flask_jwt_extended import create_access_token
from flask_jwt_extended import get_jwt
from flask_jwt_extended import jwt_required
from flask_jwt_extended import JWTManager
ACCESS_EXPIRES = timedelta(hours=1)
app = Flas... | mit | 3114eac5ce093211966557a7d30f4396 | 31 | 82 | 0.732813 | 3.447038 | false | false | false | false |
otto-torino/django-baton | testapp/app/app/tests/test_e2e_index.py | 1 | 3449 | import time
from django.test import TestCase
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from webdriver_manager.chrome imp... | mit | 3b2ff9fd2d286bfc8e7f3a5b3789f92b | 36.467391 | 116 | 0.64839 | 3.730519 | false | true | false | false |
csparpa/pyowm | pyowm/stationsapi30/buffer.py | 1 | 3242 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import json
from pyowm.stationsapi30.measurement import Measurement
from pyowm.utils import timestamps, formatting
class Buffer:
station_id = None
created_at = None
measurements = None
def __init__(self, station_id):
assert station_i... | mit | 34e991f183107c8b2c26bc8e6b7bc690 | 29.018519 | 82 | 0.608267 | 4.226858 | false | false | false | false |
csparpa/pyowm | tests/unit/airpollutionapi30/test_ozone.py | 1 | 5186 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import json
from datetime import datetime
import pyowm.commons.exceptions
from pyowm.weatherapi25.location import Location
from pyowm.airpollutionapi30.ozone import Ozone
from pyowm.utils.formatting import datetime_to_UNIXtime
OZONE_JSON = '{"time":"2016-1... | mit | e354c76bbeb8e3b5b85ef705e7c4fa37 | 43.706897 | 124 | 0.60914 | 3.649543 | false | true | false | false |
csparpa/pyowm | pyowm/commons/tile.py | 1 | 4288 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
from pyowm.commons.image import Image
from pyowm.utils.geo import Polygon
class Tile:
"""
Wrapper class for an image tile
:param x: horizontal tile number in OWM tile reference system
:type x: int
:param y: vertical tile number in OWM til... | mit | 7d671dbe39dcc57307ea14f88c6b6ce7 | 36.614035 | 133 | 0.594916 | 3.633898 | false | false | false | false |
csparpa/pyowm | pyowm/commons/cityidregistry.py | 1 | 7156 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import bz2
import sqlite3
import tempfile
from pkg_resources import resource_filename
from pyowm.weatherapi25.location import Location
CITY_ID_DB_PATH = 'cityids/cities.db.bz2'
class CityIDRegistry:
MATCHINGS = {
'exact': "SELECT city_id, name, country, sta... | mit | 39655ab81d4f530403ad0a7b4bfe0d54 | 43.447205 | 110 | 0.634992 | 4.18235 | false | false | false | false |
csparpa/pyowm | pyowm/weatherapi25/observation.py | 1 | 6191 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from pyowm.commons import exceptions
from pyowm.utils import formatting
from pyowm.weatherapi25 import location
from pyowm.weatherapi25 import weather
class Observation:
"""
A class representing the weather which is currently being observed in a
c... | mit | 729ce7537245801a6fcf9da1df052606 | 42 | 116 | 0.60911 | 4.425304 | false | false | false | false |
ggtracker/sc2reader | new_units.py | 1 | 1275 | # Shows new data entries from the requested build files:
#
# Usage: python new_units.py sc2reader/data/HotS/24764_units.csv sc2reader/data/HotS/24764_abilites.csv
#
# The output from this can be used to update the unit_lookup.csv and ability_lookup.csv files. Maybe the
# script can be fixed to append these lines automa... | mit | 74d82d7ebb3bd644d73f012ff6a33a1f | 32.552632 | 104 | 0.657255 | 3.252551 | false | false | false | false |
virtool/virtool | virtool/otus/data.py | 2 | 23306 | import asyncio
from copy import deepcopy
from typing import Optional, Tuple, Mapping
from pymongo.results import DeleteResult
from virtool_core.models.enums import HistoryMethod
from virtool_core.models.otu import OTU, OTUSequence
import virtool.history.db
import virtool.otus.db
import virtool.utils
from virtool.conf... | mit | b6b4df5a67afdff3cf8692ca0f988dbe | 31.687237 | 88 | 0.5121 | 4.210659 | false | false | false | false |
virtool/virtool | tests/fixtures/response.py | 2 | 2556 | import pytest
class RespIs:
@staticmethod
async def no_content(resp):
assert resp.status == 204
@staticmethod
async def bad_gateway(resp, message="Bad gateway"):
"""
Check whether a response object is a valid Virtool ``bad gateway``.
"""
assert resp.status == 5... | mit | 84f9be29486ed7357bf15d9dea2ea163 | 28.045455 | 85 | 0.56651 | 4.376712 | false | false | false | false |
virtool/virtool | tests/fixtures/fake.py | 2 | 7955 | import datetime
from abc import ABC, abstractmethod
import arrow
import pytest
from sqlalchemy.ext.asyncio import AsyncSession
from virtool_core.models.enums import Permission
from virtool.fake.next import DataFaker
from virtool.fake.wrapper import FakerWrapper
from virtool.subtractions.models import SubtractionFile
... | mit | be1efa85f47e69c6f73c57d59b009cb3 | 29.132576 | 84 | 0.505091 | 4.240405 | false | false | false | false |
ggtracker/sc2reader | sc2reader/__init__.py | 1 | 3570 | """
sc2reader
~~~~~~~~~~~
A library for loading data from Starcraft II game resources.
SC2Factory methods called on the package will be delegated to the default
SC2Factory. To default to a cached factory set one or more of the following
variables in your environment:
SC2READER_CACHE_D... | mit | 224df0b0b49842d6f2935b66b7f25d5f | 31.752294 | 86 | 0.723529 | 3.814103 | false | false | false | false |
virtool/virtool | virtool/references/db.py | 2 | 26417 | """
Work with references in the database
"""
import asyncio
import datetime
import logging
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from virtool.uploads.models import Upload as SQLUpload
import pymongo
from aiohttp import ClientConnectorError
from aiohttp.web import Request
from mo... | mit | dfeb4b19ea2037a8e8f4eb998efbccea | 27.223291 | 88 | 0.602264 | 3.939308 | false | false | false | false |
thouska/spotpy | src/spotpy/examples/spot_setup_hymod_python_pareto.py | 1 | 2290 | """
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This example implements the python version of hymod into SPOTPY.
"""
import os
import numpy as np
import spotpy
from spotpy.examples.hymod_python.hymod import hymod
class spot_setup(ob... | mit | 766976e2341a6bde1d23bae6027676af | 33.69697 | 77 | 0.621834 | 3.309249 | false | false | false | false |
pythondigest/pythondigest | digest/management/commands/import_news.py | 1 | 6467 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import re
import socket
from time import mktime
from typing import List, Dict
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
import feedparser
from django.core.management.base import BaseCommand
from reque... | mit | e5b321f6113805c72453d1097434c7ee | 30.99 | 97 | 0.553923 | 3.790284 | false | false | false | false |
open2c/cooltools | setup.py | 1 | 2346 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import re
from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Build import cythonize
import numpy as np
classifiers = """\
Development Status :: 4 - Beta
Programming Language :: Python
Program... | mit | 65d81a97049ac916793cb3bc84e31224 | 22.938776 | 85 | 0.622336 | 3.637209 | false | false | false | false |
pythondigest/pythondigest | digest/management/commands/download_pages.py | 1 | 1144 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django_q.tasks import async
from digest.models import Item
def get_article(item):
path = os.path.join(settings.DATASET_ROOT, '{0}.html'.format(item... | mit | 2326b65db340f729119bd9d92ace9bb0 | 25.690476 | 79 | 0.604817 | 3.651466 | false | false | false | false |
thouska/spotpy | src/spotpy/algorithms/dds.py | 1 | 20855 | import numpy as np
from spotpy.parameter import ParameterSet
from . import _algorithm
class DDSGenerator:
"""
This class is used by the DDS algorithm to generate a new sample of parameters based on the current one.
Current parameter are exchanged in `ParameterSet` objects.
"""
def __init__(self... | mit | 3b7953b846f72fc3444052d48a4d62aa | 42.629707 | 128 | 0.587581 | 4.21228 | false | false | false | false |
pythondigest/pythondigest | frontend/admin.py | 1 | 1047 | # coding=utf-8
from django.contrib import admin
from frontend.models import EditorMaterial, Tip
class EditorMaterialAdmin(admin.ModelAdmin):
list_display = ('title', 'link_html', 'status', 'section', 'user',
'created_at')
search_fields = ('title', 'announce', 'contents')
list_filter ... | mit | fa0f4fd21e5d6344272f5b55d0348fd5 | 26.236842 | 79 | 0.647343 | 3.532423 | false | false | false | false |
thouska/spotpy | src/spotpy/algorithms/demcz.py | 1 | 26346 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2018 by Tobias Houska
This file is part of Statistical Parameter Optimization Tool for Python(SPOTPY).
:author: Tobias Houska
"""
import numpy as np
from . import _algorithm
class demcz(_algorithm):
"""
Implements the DE-MC_Z algorithm from ter Braak and Vrugt (2008... | mit | 099747d3c02f80d89d86da4ecbe28c47 | 36.107042 | 123 | 0.562286 | 4.222115 | false | false | false | false |
thouska/spotpy | src/spotpy/examples/spot_setup_hymod_python.py | 1 | 2934 | """
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This example implements the python version of hymod into SPOTPY.
"""
import os
from spotpy.examples.hymod_python.hymod import hymod
from spotpy.objectivefunctions import rmse
from spotpy.... | mit | d60e93edcc5df859d74deafb095559d6 | 37.605263 | 85 | 0.624744 | 3.42757 | false | false | false | false |
pythondigest/pythondigest | digest/migrations/0043_auto_20160503_2051.py | 1 | 18801 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 20:51
from __future__ import unicode_literals
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('digest', '0... | mit | 7b95e5471ce67d2dbe2069814798a268 | 38.433761 | 180 | 0.475427 | 4.827361 | false | false | false | false |
open2c/cooltools | cooltools/lib/checks.py | 1 | 20476 | import warnings
from itertools import tee, starmap
from operator import gt
from copy import copy
import numpy as np
import pandas as pd
import bioframe
from . import schemas
from .common import make_cooler_view
def _is_sorted_ascending(iterable):
# code copied from "more_itertools" package
"""Returns ``True... | mit | 7bc10387a7004a5dcd46a209f2994780 | 35.695341 | 101 | 0.592743 | 4.364954 | false | false | false | false |
thouska/spotpy | src/spotpy/parameter.py | 1 | 30718 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Philipp Kraft and Tobias Houska
Contains classes to generate random parameter sets
"""
import copy
import sys
from itertools import cycle
import numpy as np
import numpy.random ... | mit | d25f2fe59b93bbfe4a9768f326a7f33b | 33.055432 | 104 | 0.588678 | 4.28723 | false | false | false | false |
thouska/spotpy | tutorials/tutorial_fast_hymod.py | 1 | 1292 | # -*- coding: utf-8 -*-
"""
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This class holds example code how to use the FAST algorithm
"""
import numpy as np
import spotpy
# from spotpy.examples.spot_setup_hymod_python import spot_setup
f... | mit | 246403f16ba43fd7979b534dc15c7d03 | 30.512195 | 87 | 0.72291 | 3.520436 | false | false | false | false |
open2c/cooltools | cooltools/lib/numutils.py | 1 | 50306 | import warnings
from scipy.linalg import toeplitz
import scipy.sparse.linalg
import scipy.interpolate
from scipy.ndimage import zoom, gaussian_filter1d
import numpy as np
import numba
import cooler
from functools import partial
from ._numutils import (
iterative_correction_symmetric as _iterative_correction_symmet... | mit | 64004a8d5f0640c9544d9b528107590b | 30.859405 | 103 | 0.581124 | 3.465078 | false | false | false | false |
open2c/cooltools | tests/test_dotfinder_stats.py | 1 | 9625 | import numpy as np
import pandas as pd
from scipy.stats import poisson
from cooltools.api.dotfinder import (
histogram_scored_pixels,
determine_thresholds,
annotate_pixels_with_qvalues,
extract_scored_pixels,
)
# helper functions for BH-FDR copied from www.statsmodels.org
def _fdrcorrection(pvals, al... | mit | 53d8e332aaef8346a52871da87ac08c8 | 33.873188 | 89 | 0.670338 | 3.533407 | false | true | false | false |
open2c/cooltools | cooltools/cli/eigs_cis.py | 1 | 5542 | import pandas as pd
import numpy as np
import cooler
import bioframe
from ..api import eigdecomp
from ..lib.common import make_cooler_view
from ..lib.io import read_viewframe_from_file
import click
from .util import TabularFilePath, sniff_for_header
from . import cli
@cli.command()
@click.argument("cool_path", metav... | mit | cdf90096e269baa2be5b0bf4ee908612 | 28.795699 | 90 | 0.571093 | 3.707023 | false | false | false | false |
pythondigest/pythondigest | jobs/migrations/0002_jobitem.py | 1 | 1887 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='JobItem',
fields=[
... | mit | bf0787d0697921ad169a15319b95ee7f | 40.113636 | 80 | 0.462687 | 4.327751 | false | false | false | false |
pythondigest/pythondigest | digest/management/commands/import_python_weekly.py | 1 | 3889 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from urllib.error import URLError
from urllib.request import urlopen
import lxml.html as html
from bs4 import BeautifulSoup
from bs4.element import Tag
from django.core.management.base import BaseCommand
from lxml import etree
from typing import Sequence... | mit | a0313af12ac112a85b98d3c5eb272da9 | 27.562963 | 78 | 0.608662 | 3.597015 | false | false | false | false |
open2c/cooltools | cooltools/cli/pileup.py | 1 | 7718 | import pandas as pd
import numpy as np
import cooler
import bioframe
from .. import api
from ..lib.common import make_cooler_view
from ..lib.io import read_viewframe_from_file, read_expected_from_file
import click
from functools import partial
from . import cli
from .util import sniff_for_header, validate_csv
import... | mit | 9586211dff5606cb31e99f045858885d | 28.234848 | 101 | 0.590438 | 3.543618 | false | false | false | false |
znick/anytask | anytask/issues/model_issue_student_filter.py | 1 | 2807 | # coding: utf-8
import django_filters
from django import forms
from django.utils.translation import ugettext_lazy as _
from courses.models import Course
from issues.models import Issue
from issues.model_issue_status import IssueStatus
class IssueFilterStudent(django_filters.FilterSet):
is_active = django_filte... | mit | 2bfff263a85ca0b5683d9c78e1e36397 | 43.555556 | 116 | 0.640185 | 3.877072 | false | false | false | false |
python-attrs/attrs | tests/typing_example.py | 2 | 8316 | # SPDX-License-Identifier: MIT
import re
from typing import Any, Dict, List, Tuple, Union
import attr
import attrs
# Typing via "type" Argument ---
@attr.s
class C:
a = attr.ib(type=int)
c = C(1)
C(a=1)
@attr.s
class D:
x = attr.ib(type=List[int])
@attr.s
class E:
y = attr.ib(type="List[int]")
... | mit | 49590dd04c36ab38d6835fb3c1451363 | 17.772009 | 78 | 0.636604 | 2.926108 | false | false | false | false |
python-attrs/attrs | src/attr/_make.py | 2 | 94404 | # SPDX-License-Identifier: MIT
import copy
import enum
import linecache
import sys
import types
import typing
from operator import itemgetter
# We need to import _compat itself in addition to the _compat members to avoid
# having the thread-local in the globals here.
from . import _compat, _config, setters
from ._co... | mit | 505eee9474c8765389776b1d100ed295 | 31.330137 | 79 | 0.554966 | 4.110956 | false | false | false | false |
znick/anytask | anytask/issues/forms.py | 1 | 6201 | # coding: utf-8
from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.db.models import Q
from issues.model_issue_status import IssueStatus
class Defa... | mit | 973d29a2d7aaeb9e4459e391b8c4afa1 | 33.847458 | 120 | 0.613651 | 3.5986 | false | false | false | false |
znick/anytask | anytask/courses/course_statistics.py | 1 | 4827 | from django.db.models import Q
from tasks.models import TaskTaken
class CourseStatistics(object):
def __init__(self, course_tasks):
self.course_tasks = course_tasks
self.groups_statistics = {}
self.course_statistics = {
'summ_scores': 0,
'number_students': 0,
... | mit | 5cac63ce0a2bb2cfc7d24dbd056d8427 | 40.25641 | 110 | 0.594572 | 4.241652 | false | false | false | false |
znick/anytask | anytask/mail/common.py | 1 | 4172 | # -*- coding: utf-8 -*-
from django.core.mail import get_connection, EmailMultiAlternatives
from django.conf import settings
from django.template import Template, Context
from django.template.loader import render_to_string
from django.utils import translation
from django.utils.translation import ugettext as _
from djan... | mit | 279a480a7400a40046997974c061b25d | 33.479339 | 99 | 0.613375 | 4.301031 | false | false | false | false |
xeroc/python-graphenelib | graphenecommon/amount.py | 1 | 10973 | # -*- coding: utf-8 -*-
from .asset import Asset
from .instance import AbstractBlockchainInstanceProvider
class Amount(dict, AbstractBlockchainInstanceProvider):
""" This class deals with Amounts of any asset to simplify dealing with the tuple::
(amount, asset)
:param list args: Allows to de... | mit | 77cc933355cc6e99af098c90a211e4ec | 31.178886 | 88 | 0.504693 | 4.22526 | false | false | false | false |
xeroc/python-graphenelib | graphenecommon/vesting.py | 1 | 2101 | # -*- coding: utf-8 -*-
from .exceptions import VestingBalanceDoesNotExistsException
from .blockchainobject import BlockchainObject
from .instance import AbstractBlockchainInstanceProvider
class Vesting(BlockchainObject, AbstractBlockchainInstanceProvider):
""" Read data about a Vesting Balance in the chain
... | mit | aacc24ce2309a6c8f50fb6d80ca1fd57 | 34.016667 | 88 | 0.588767 | 4.253036 | false | false | false | false |
xeroc/python-graphenelib | tests/test_message_aio.py | 1 | 2381 | # -*- coding: utf-8 -*-
import json
import aiounittest
from .fixtures_aio import fixture_data, Message, MessageV1, MessageV2
from pprint import pprint
from graphenecommon.exceptions import InvalidMessageSignature
class Testcases(aiounittest.AsyncTestCase):
def setUp(self):
fixture_data()
async def te... | mit | 8789a02cc867f43ebde2505cdd42a799 | 32.535211 | 150 | 0.622428 | 3.052564 | false | true | false | false |
python-hyper/hyper-h2 | src/h2/utilities.py | 1 | 23246 | # -*- coding: utf-8 -*-
"""
h2/utilities
~~~~~~~~~~~~
Utility functions that do not belong in a separate module.
"""
import collections
import re
from string import whitespace
from hpack import HeaderTuple, NeverIndexedHeaderTuple
from .exceptions import ProtocolError, FlowControlError
UPPER_RE = re.compile(b"[A-Z]... | mit | 24338a3d2cf2b81b3ad6bb0fcc93b3bf | 33.583333 | 79 | 0.646213 | 4.215491 | false | false | false | false |
wradlib/wradlib | wradlib/classify.py | 3 | 6356 | #!/usr/bin/env python
# Copyright (c) 2011-2020, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Hydrometeor Classification (HMC)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autosummary::
:nosignatures:
:toctree: generated/
{}
"""
__all__ = ["msf_index_indep", "trapezoid... | mit | 8ed98bb8a45cc3d535cbe70ea87d80e3 | 30.310345 | 88 | 0.600063 | 3.498074 | false | false | false | false |
xeroc/python-graphenelib | graphenecommon/aio/transactionbuilder.py | 1 | 15670 | # -*- coding: utf-8 -*-
import struct
import logging
from binascii import unhexlify
from ..exceptions import (
InsufficientAuthorityError,
InvalidWifError,
MissingKeyError,
WalletLocked,
)
from ..utils import formatTimeFromNow
from graphenebase.objects import Asset
from ..transactionbuilder import (
... | mit | 17d278d2dd351927e93a3775b3f5d5b0 | 38.175 | 90 | 0.562029 | 4.577856 | false | false | false | false |
xeroc/python-graphenelib | grapheneapi/websocket.py | 1 | 2277 | # -*- coding: utf-8 -*-
import ssl
import json
import logging
import websocket
from .rpc import Rpc
from threading import Lock
log = logging.getLogger(__name__)
class Websocket(Rpc):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# We need a lock to ensure thread-safty
... | mit | 61cf8e79aacf5232b0f303ef184f5f83 | 27.4625 | 80 | 0.548968 | 4.080645 | false | false | false | false |
xeroc/python-graphenelib | graphenecommon/asset.py | 1 | 2974 | # -*- coding: utf-8 -*-
from .blockchainobject import BlockchainObject
from .exceptions import AssetDoesNotExistsException
from .instance import AbstractBlockchainInstanceProvider
class Asset(BlockchainObject, AbstractBlockchainInstanceProvider):
""" Deals with Assets of the network.
:param str Asset: Sy... | mit | 1ab99130cbd587fc1b99fd800fd02e9f | 32.044444 | 83 | 0.602892 | 4.285303 | false | false | false | false |
xeroc/python-graphenelib | grapheneapi/aio/api.py | 1 | 4550 | # -*- coding: utf-8 -*-
import asyncio
import logging
from grapheneapi.exceptions import NumRetriesReached, RPCError
from grapheneapi.api import Api as SyncApi
from .websocket import Websocket
from .http import Http
log = logging.getLogger(__name__)
class Api(SyncApi):
def __init__(self, *args, **kwargs):
... | mit | e5ebaf6cc61aed358798a34ed27d0ad1 | 33.210526 | 85 | 0.510989 | 4.628688 | false | false | false | false |
xeroc/python-graphenelib | graphenecommon/aio/genesisbalance.py | 1 | 6835 | # -*- coding: utf-8 -*-
from .blockchainobject import BlockchainObject
from ..exceptions import GenesisBalanceDoesNotExistsException, MissingKeyError
from ..genesisbalance import (
GenesisBalance as SyncGenesisBalance,
GenesisBalances as SyncGenesisBalances,
)
class GenesisBalance(BlockchainObject, SyncGenesi... | mit | 4e8e43e5f7ef575c8afb91ec87095d98 | 34.598958 | 88 | 0.492026 | 4.970909 | false | false | false | false |
python-hyper/hyper-h2 | src/h2/stream.py | 2 | 54533 | # -*- coding: utf-8 -*-
"""
h2/stream
~~~~~~~~~
An implementation of a HTTP/2 stream.
"""
from enum import Enum, IntEnum
from hpack import HeaderTuple
from hyperframe.frame import (
HeadersFrame, ContinuationFrame, DataFrame, WindowUpdateFrame,
RstStreamFrame, PushPromiseFrame, AltSvcFrame
)
from .errors impo... | mit | 731209e14545ee28597d6a4af8182077 | 38.776076 | 79 | 0.628537 | 4.175574 | false | false | false | false |
xeroc/python-graphenelib | graphenebase/utils.py | 1 | 1795 | # -*- coding: utf-8 -*-
import sys
import time
from datetime import datetime, timezone
timeFormat = "%Y-%m-%dT%H:%M:%S"
def _bytes(x): # pragma: no branch
""" Python3 and Python2 compatibility
"""
if sys.version > "3":
return bytes(x, "utf8")
else: # pragma: no cover
return x.__byte... | mit | 1df562614fb26549d9f1b758e02c750a | 24.642857 | 82 | 0.559889 | 3.561508 | false | false | false | false |
tfeldmann/organize | organize/filters/filecontent.py | 1 | 2009 | import logging
import re
from typing import Any
from fs.base import FS
from fs.errors import NoSysPath
from .filter import Filter, FilterResult
logger = logging.getLogger(__name__)
class FileContent(Filter):
"""Matches file content with the given regular expression
Args:
expr (str): The regular ex... | mit | a86d0927095bf480fc4a4fe6ca6e42dd | 27.295775 | 78 | 0.571429 | 4.348485 | false | false | false | false |
tfeldmann/organize | organize/filters/date_lastused.py | 1 | 1686 | import subprocess
import sys
from datetime import datetime
from typing import Union
from fs.base import FS
from ._timefilter import TimeFilter
class DateLastUsed(TimeFilter):
"""Matches files by the time the file was last used.
**`date_lastused` is only available on macOS!**
Args:
years (int)... | mit | da58285870deaf3b33c05071c82c8932 | 30.222222 | 87 | 0.603203 | 4.072464 | false | false | false | false |
tfeldmann/organize | organize/actions/action.py | 1 | 2047 | import logging
from typing import Any, Dict
from typing import Optional as tyOptional
from typing import Union
from fs.base import FS
from schema import Optional, Or, Schema
from organize.console import pipeline_error, pipeline_message
logger = logging.getLogger(__name__)
class Error(Exception):
pass
class A... | mit | b492975ccc0a312cf6fdb7d1fc2864d1 | 25.934211 | 84 | 0.55789 | 4.029528 | false | false | false | false |
stevearc/pypicloud | doc/conf.py | 1 | 1659 | # -*- coding: utf-8 -*-
""" Sphinx config """
import sys
import importlib
import inspect
import os
import sphinx_rtd_theme
# pylint: disable=C0103
docs_basepath = os.path.abspath(os.path.dirname(__file__))
addtl_paths = (
os.pardir,
'extensions',
)
for path in addtl_paths:
sys.path.insert(0, os.path.abspa... | mit | 4848fb5dee271e5e1fbb6e20e93d5015 | 27.603448 | 74 | 0.625075 | 3.311377 | false | false | false | false |
stevearc/pypicloud | tests/test_scripts.py | 1 | 4196 | """ Tests for commandline scripts """
import unittest
from mock import patch
from pypicloud import scripts
class TestScripts(unittest.TestCase):
"""Tests for commandline scripts"""
@patch.object(scripts, "getpass")
def test_gen_password(self, getpass):
"""Generate a password"""
passwds... | mit | 4bf4f9271ce9fe8e4a5513b8e0444e27 | 34.863248 | 68 | 0.59652 | 3.6329 | false | true | false | false |
openstates/openstates.org | graphapi/legislative.py | 1 | 13439 | import graphene
import re
from django.db.models import Prefetch
from openstates.data.models import Bill, BillActionRelatedEntity, PersonVote
from openstates.utils.transformers import fix_bill_id
from .common import OCDBaseNode, DjangoConnectionField, CountableConnectionBase
from .core import (
LegislativeSessionNod... | mit | 5ff2e202667e60c7b57d7dbad69912b7 | 30.399533 | 88 | 0.593124 | 4.123658 | false | false | false | false |
openstates/openstates.org | people_admin/migrations/0007_personretirement.py | 1 | 1475 | # Generated by Django 3.2 on 2021-05-27 21:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("data", "0035_auto_20210422_1926"),
("people_admin", "0006_alter_persondelta_data_changes"),
]
operations = [
... | mit | 30649523a57c31a9285c6bfe8a72305f | 30.382979 | 85 | 0.418983 | 5.175439 | false | false | false | false |
openstates/openstates.org | dashboards/views.py | 1 | 7083 | import datetime
from collections import defaultdict, Counter
from django.contrib.auth.decorators import user_passes_test
from django.db.models import Count, F
from django.contrib.auth.models import User
from django.shortcuts import render
from allauth.socialaccount.models import SocialAccount
from profiles.models impor... | mit | 37570019dbfbb88bdfa5de0232808ab6 | 31.944186 | 91 | 0.613299 | 3.729858 | false | false | false | false |
demisto/content | Packs/ProofpointThreatResponse/Integrations/ProofpointThreatResponse/ProofpointThreatResponse.py | 1 | 33625 | import json
import requests
from datetime import date, timedelta
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import dateparser
import urllib3
urllib3.disable_warnings()
''' GLOBAL VARS '''
TIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
BASE_URL = demisto.params().get('url')
if BAS... | mit | 36b41745b3993a74af798552bbcab3e6 | 34.619703 | 129 | 0.617636 | 3.886385 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/LookupCSV/LookupCSV.py | 2 | 3665 | """
Given a CSV file in the War Room by entry ID, searches based on column and value.
If the column is not present, simply parse the CSV into a list of lists or list of dicts (if header row supplied).
"""
from CommonServerPython import *
import csv
def search_dicts(k, v, data):
"""
Search a list of dicts by k... | mit | 04b818638ce5a2e7ee082eea84fc979c | 29.541667 | 119 | 0.555252 | 3.829676 | false | false | false | false |
demisto/content | Packs/DeprecatedContent/Integrations/PaloAltoNetworksCortex/PaloAltoNetworksCortex.py | 2 | 70813 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import os
import requests
import json
from pancloud import LoggingService, Credentials
import base64
from dateutil.parser import parse
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from ... | mit | db5e5c6e99633dae015d3161dae5f9ed | 40.851655 | 120 | 0.605185 | 3.747711 | false | false | false | false |
demisto/content | Packs/ServiceDeskPlus_On_Premise/Integrations/ServiceDeskPlus_On_Premise/ServiceDeskPlus_On_Premise.py | 2 | 28696 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
from typing import Tuple, Dict, List, Any
from _collections import defaultdict
import requests
import ast
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' CONSTANTS '''
API_... | mit | 0dc9f1cb90f04be6a0832517f6f511bf | 35.83697 | 123 | 0.603778 | 4.004466 | false | false | false | false |
demisto/content | Packs/AbnormalSecurity/Integrations/AbnormalSecurity/AbnormalSecurity.py | 2 | 21601 | import demistomock as demisto
from CommonServerPython import *
import requests
requests.packages.urllib3.disable_warnings()
class Client(BaseClient):
def __init__(self, server_url, verify, proxy, headers, auth):
super().__init__(base_url=server_url, verify=verify, proxy=proxy, headers=headers, auth=auth... | mit | c0f6a8c384b6e7d5ba76197cd625e7b4 | 34.123577 | 127 | 0.656775 | 3.71918 | false | false | false | false |
missionpinball/mpf | mpf/platforms/interfaces/switch_platform_interface.py | 1 | 1167 | """Interface for switches."""
import abc
from typing import Any
from mpf.core.platform import SwitchConfig, SwitchPlatform
class SwitchPlatformInterface(metaclass=abc.ABCMeta):
"""Interface for switches in hardware platforms.
SwitchPlatformInterface is an abstract base class that should be overridden for al... | mit | b068b1fdff21b7314d8d64f0c81b4ea8 | 36.645161 | 100 | 0.675236 | 4.705645 | false | true | false | false |
missionpinball/mpf | mpf/config_players/flat_config_player.py | 1 | 1810 | """Base class for flat config players."""
from typing import List
import abc
from mpf.core.config_player import ConfigPlayer
class FlatConfigPlayer(ConfigPlayer, metaclass=abc.ABCMeta):
"""Flat show players."""
__slots__ = [] # type: List[str]
def validate_config_entry(self, settings, name):
... | mit | 887ca16ebd6ac69263c3886303d38d85 | 30.754386 | 77 | 0.649724 | 4.617347 | false | true | false | false |
missionpinball/mpf | mpf/core/ball_search.py | 1 | 12569 | """Implements the ball search procedure."""
from collections import namedtuple
from typing import List
from mpf.core.delays import DelayManager
from mpf.core.machine import MachineController
from mpf.core.mpf_controller import MpfController
MYPY = False
if MYPY: # pragma: no cover
from mpf.devices.playfield im... | mit | 87196839e06504dc43f135efff5d9a5b | 35.431884 | 120 | 0.593842 | 4.39937 | false | false | false | false |
missionpinball/mpf | mpf/platforms/interfaces/driver_platform_interface.py | 1 | 2299 | """Interface for drivers."""
import abc
from collections import namedtuple
from typing import Any
from mpf.core.platform import DriverConfig
PulseSettings = namedtuple("PulseSettings", ["power", "duration"])
HoldSettings = namedtuple("HoldSettings", ["power", "duration"])
# Python 3.7 supports a defaults arg in named... | mit | 4005cf399dc769ba714a919ff8a334ad | 35.492063 | 105 | 0.680731 | 4.607214 | false | true | false | false |
missionpinball/mpf | mpf/platforms/osc.py | 1 | 6609 | """A platform to control lights via OSC."""
try:
from pythonosc.dispatcher import Dispatcher
from pythonosc.osc_server import AsyncIOOSCUDPServer
from pythonosc.udp_client import SimpleUDPClient
except ImportError:
# pythonosc is not a requirement for MPF so we fail with a nice error when loading
Di... | mit | 5819b127e04dbe40474748a82e009384 | 35.513812 | 118 | 0.600847 | 4.174984 | false | true | false | false |
missionpinball/mpf | mpf/devices/logic_blocks.py | 1 | 23276 | """Logic Blocks devices."""
from random import shuffle
from typing import Any, List, Optional
from mpf.core.delays import DelayManager
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.events import event_handler
from mpf.core.machine import MachineController
from mpf.core.mode import Mode, MODE_STARTIN... | mit | 62ff4e5ce12b9d2a9ab79926c1eebdc7 | 33.688525 | 119 | 0.59774 | 4.346592 | false | true | false | false |
missionpinball/mpf | mpf/devices/ball_device/ball_count_handler.py | 1 | 12535 | """Maintains the ball count for a ball device."""
import asyncio
from typing import Optional
from mpf.devices.ball_device.physical_ball_counter import PhysicalBallCounter, EjectTracker
from mpf.devices.ball_device.entrance_switch_counter import EntranceSwitchCounter
from mpf.devices.ball_device.switch_counter import S... | mit | 4b278e2bce5b86e22f7ca5477e284679 | 41.205387 | 115 | 0.588034 | 3.959255 | false | false | false | false |
missionpinball/mpf | mpf/devices/extra_ball.py | 1 | 6329 | """Device that implements an extra ball."""
from typing import Optional
from mpf.core.events import event_handler
from mpf.core.machine import MachineController
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.mode import Mode
from mpf.core.mode_device import ModeDevice
from mpf.core.player import Playe... | mit | f093bea8df4a9c4a98f056782ef4cbe5 | 32.664894 | 80 | 0.592511 | 4.158344 | false | false | false | false |
missionpinball/mpf | mpf/platforms/interfaces/segment_display_platform_interface.py | 1 | 3384 | """Support for physical segment displays."""
import abc
from typing import Any, Optional
from enum import Enum
from mpf.devices.segment_display.segment_display_text import ColoredSegmentDisplayText
class FlashingType(Enum):
"""Determine how a segment display should flash."""
NO_FLASH = False
FLASH_ALL ... | mit | ea046873f0040a1fe4e6ce266cc27f69 | 33.530612 | 105 | 0.617612 | 4.023781 | false | false | false | false |
missionpinball/mpf | mpf/devices/ball_device/ball_device_state_handler.py | 1 | 1423 | """Base class for ball device handlers."""
import asyncio
from mpf.core.utility_functions import Util
class BallDeviceStateHandler:
"""Base class for ball device handler."""
__slots__ = ["ball_device", "machine", "_task"]
def __init__(self, ball_device):
"""Initialise handler.
Args:
... | mit | 98989677fd7106d64e7041bd45d71316 | 26.901961 | 91 | 0.57695 | 3.92011 | false | false | false | false |
missionpinball/mpf | mpf/tests/test_Achievement.py | 1 | 31538 | """Test achievements."""
from mpf.tests.MpfFakeGameTestCase import MpfFakeGameTestCase
class TestAchievement(MpfFakeGameTestCase):
def get_config_file(self):
return 'config.yaml'
def get_machine_path(self):
return 'tests/machine_files/achievement/'
def test_enable_when_all_done(self):
... | mit | fb8c52bff2989443fdf3b09e8c9e2545 | 38.770492 | 104 | 0.65077 | 3.615499 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.