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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
the-blue-alliance/the-blue-alliance | src/backend/common/consts/fcm/platform_priority.py | 1 | 2306 | from __future__ import annotations
import enum
from typing import Dict
from backend.common.consts.fcm.platform_type import PlatformType
@enum.unique
class PlatformPriority(enum.IntEnum):
"""
Constants regarding the priority of a push notification.
"""
NORMAL = 0
HIGH = 1
@staticmethod
... | mit | 9b4f923e54faa16311b4500878bc5296 | 35.03125 | 186 | 0.67216 | 4.47767 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/controllers/admin/admin_offseason_scraper_controller.py | 8 | 3271 | import datetime
import logging
import os
from google.appengine.ext import ndb
from google.appengine.ext.webapp import template
from controllers.base_controller import LoggedInHandler
from datafeeds.datafeed_usfirst_offseason import DatafeedUsfirstOffseason
from consts.event_type import EventType
from helpers.event_m... | mit | b7fbcf6cf33e84e6c153165dc2430a35 | 37.482353 | 119 | 0.612351 | 3.803488 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/web/handlers/tests/helpers.py | 1 | 11612 | import json
import re
from datetime import datetime, timedelta
from typing import Generator, List, NamedTuple, Optional, Tuple
import bs4
from google.appengine.ext import ndb
from pyre_extensions import none_throws
from backend.common.consts.event_type import EventType
from backend.common.models.district import Distr... | mit | d92ce018def98d62ef3679002ab69173 | 31.709859 | 88 | 0.594557 | 3.437537 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/datafeed_parsers/csv_offseason_matches_parser.py | 1 | 3429 | import csv
import json
import re
from io import StringIO
class CSVOffseasonMatchesParser:
@classmethod
def parse(cls, data):
"""
Parse CSV that contains match results.
Format is as follows:
match_id, red1, red2, red3, blue1, blue2, blue3, red score, blue score
Example ... | mit | 4a24ecf7c08166eba6c7b8bee65a1e78 | 27.106557 | 84 | 0.514436 | 3.632415 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/tests/test_match_controller.py | 5 | 3134 | from datetime import datetime
import unittest2
import webapp2
import webtest
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from webapp2_extras.routes import RedirectRoute
from consts.event_type import EventType
from controllers.match_controller import MatchDetail
from models.event impo... | mit | 4f70b71defe74bf50bb3593a9fe39cbe | 31.989474 | 93 | 0.506063 | 3.89801 | false | true | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/middleware.py | 1 | 2444 | from typing import Any, Callable
from flask import Flask
from google.appengine.ext import ndb
from werkzeug.wrappers import Request
from werkzeug.wsgi import ClosingIterator
from backend.common.environment import Environment
from backend.common.profiler import send_traces, Span, trace_context
from backend.common.run_... | mit | 7a5b559b9b24a8dbf5a1343850efbc6d | 31.157895 | 83 | 0.678396 | 4.039669 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/api/api_trusted_parsers/json_matches_parser.py | 1 | 9527 | import datetime
import json
from typing import (
Any,
AnyStr,
Dict,
Mapping,
MutableSequence,
Optional,
Sequence,
TypedDict,
)
from pyre_extensions import safe_json
from backend.common.consts.alliance_color import AllianceColor
from backend.common.consts.comp_level import COMP_LEVELS, ... | mit | b63d48e141aa6cb07c6aa7b26feb8dbd | 45.473171 | 262 | 0.52346 | 4.536667 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/api/handlers/decorators.py | 1 | 4838 | from functools import wraps
from typing import Set
from flask import g, request
from backend.api.trusted_api_auth_helper import TrustedApiAuthHelper
from backend.common.auth import current_user
from backend.common.consts.auth_type import AuthType
from backend.common.consts.renamed_districts import RenamedDistricts
fr... | mit | 3cbbb73989fe3e03af67ae8d5d0fb929 | 35.651515 | 156 | 0.560149 | 4.21796 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/tasks_io/handlers/math.py | 1 | 11587 | import json
import logging
from typing import List, Optional
from flask import abort, Blueprint, make_response, render_template, request, url_for
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from werkzeug.wrappers import Response
from backend.common.consts.event_type import EventTyp... | mit | 44be528b1106c023fee2bd9fd9e5f933 | 34.218845 | 88 | 0.661604 | 3.738948 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/models/district_team.py | 1 | 1730 | from typing import Set
from google.appengine.ext import ndb
from backend.common.models.cached_model import CachedModel
from backend.common.models.district import District
from backend.common.models.keys import DistrictKey, DistrictTeamKey, TeamKey, Year
from backend.common.models.team import Team
class DistrictTeam... | mit | 1ec0bf519879294bfe1b9018c3a07fea | 31.641509 | 82 | 0.642775 | 3.596674 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/helpers/webcast_online_helper.py | 1 | 9187 | import json
import logging
from typing import Any, Generator, List, Optional
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
from backend.common.consts.webcast_status import WebcastStatus
from backend.common.consts.webcast_type import WebcastType
from backend.common.memcache import Memc... | mit | e4ed06458d91333ad308c9f71ce50ac2 | 38.429185 | 126 | 0.553282 | 4.307079 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/models/team_admin_access.py | 1 | 1112 | from google.appengine.ext import ndb
from backend.common.models.account import Account
from backend.common.models.team import Team
class TeamAdminAccess(ndb.Model):
"""
This class represents a pre-issued token that the TBA admins can generate
and grant to whitelisted accounts. Accounts linked to these to... | mit | a0418e071e174b1ad8ba2221690d1a78 | 30.771429 | 78 | 0.706835 | 3.901754 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/controllers/district_controller.py | 1 | 6347 | import datetime
import logging
import os
from google.appengine.ext import ndb
from controllers.base_controller import CacheableHandler
from consts.event_type import EventType
from database.district_query import DistrictQuery, DistrictHistoryQuery, DistrictsInYearQuery
from database.event_query import DistrictEventsQ... | mit | 55f2ef6286d89ddd20816e7be5dd6f73 | 41.033113 | 139 | 0.61147 | 3.839685 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/web/handlers/suggestions/tests/suggest_match_video_review_controller_test.py | 1 | 10045 | import re
from datetime import datetime
from typing import List
from urllib.parse import urlparse
import pytest
from bs4 import BeautifulSoup
from google.appengine.ext import ndb
from werkzeug.test import Client
from backend.common.consts.account_permission import AccountPermission
from backend.common.consts.event_ty... | mit | 3449b0631d65aebcf5718f32d487d2e8 | 30.003086 | 83 | 0.587456 | 3.61461 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/web/handlers/suggestions/tests/suggest_event_webcast_controller_test.py | 1 | 6166 | from datetime import datetime
from typing import cast, List
from urllib.parse import urlparse
import pytest
from bs4 import BeautifulSoup
from werkzeug.test import Client
from backend.common.consts.event_type import EventType
from backend.common.consts.suggestion_state import SuggestionState
from backend.common.const... | mit | 1e1e229e6ea49648eac519dbb1ab23cb | 31.624339 | 88 | 0.670289 | 3.595335 | false | true | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/helpers/match_tiebreakers.py | 1 | 13633 | from __future__ import annotations
from typing import Dict, List, Optional, Tuple
from pyre_extensions import none_throws
from backend.common.consts.alliance_color import (
AllianceColor,
TMatchWinner,
)
from backend.common.consts.comp_level import CompLevel, ELIM_LEVELS
from backend.common.models.match impo... | mit | 007ad6ee08a2885a0c31d431cbefb8c4 | 35.549598 | 97 | 0.581163 | 3.848955 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/tasks_io/datafeeds/parsers/fms_api/fms_api_event_rankings_parser.py | 1 | 1337 | from typing import Any, Dict, List, Optional
from backend.common.helpers.rankings_helper import RankingsHelper
from backend.common.models.event_ranking import EventRanking
from backend.tasks_io.datafeeds.parsers.json.parser_json import ParserJSON
class FMSAPIEventRankingsParser(ParserJSON[List[EventRanking]]):
d... | mit | 0542cdfda22773f59d5d97895f988a55 | 32.425 | 78 | 0.524308 | 4.594502 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/web/handlers/admin/sitevars.py | 1 | 1171 | from flask import redirect, request, url_for
from werkzeug.wrappers import Response
from backend.common.models.sitevar import Sitevar
from backend.web.profiled_render import render_template
def sitevars_list() -> str:
sitevars = Sitevar.query().fetch(10000)
template_values = {
"sitevars": sitevars,
... | mit | c371f86d8824b051e232567d3fcea903 | 23.914894 | 83 | 0.668659 | 3.474777 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/helpers/event_team_status_helper.py | 1 | 19941 | import copy
from google.appengine.ext import ndb
from google.appengine.ext.ndb.tasklets import Future
from consts.playoff_type import PlayoffType
from helpers.match_helper import MatchHelper
from helpers.rankings_helper import RankingsHelper
from helpers.team_helper import TeamHelper
from models.event_details import ... | mit | a535a6eae3564db77534f74d8dd00181 | 43.511161 | 156 | 0.483978 | 4.343498 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/controllers/cron_controller.py | 1 | 13631 | import datetime
import logging
import os
import json
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from consts.event_type import EventType
from controllers.api.api_status_controller import Api... | mit | bf9e13cc98f5facf3bb226ad8f9d61d2 | 36.040761 | 126 | 0.656592 | 3.818207 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/cache_clearing/tests/database_cache_clearer_test.py | 1 | 21752 | import unittest
import pytest
from google.appengine.ext import ndb
from backend.common.cache_clearing import get_affected_queries
from backend.common.consts.award_type import AwardType
from backend.common.consts.event_type import EventType
from backend.common.consts.media_tag import MediaTag
from backend.common.model... | mit | 0d639ecbf6ba851368d08855b760033e | 38.334539 | 100 | 0.603669 | 3.68553 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/datafeeds/parsers/json/json_alliance_selections_parser.py | 8 | 1187 | import json
import re
from datafeeds.parser_base import ParserInputException, ParserBase
class JSONAllianceSelectionsParser(ParserBase):
@classmethod
def parse(self, alliances_json):
"""
Parse JSON that contains team_keys
Format is as follows:
[[captain1, pick1-1, pick1-2(, ..... | mit | 7fec066585d29bc5c6c723c54a15e6b7 | 32.914286 | 115 | 0.550969 | 4.037415 | false | false | false | false |
the-blue-alliance/the-blue-alliance | old_py2/tests/test_event_simulator.py | 1 | 16081 | import unittest2
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from helpers.event_simulator import EventSimulator
from helpers.match_helper import MatchHelper
from models.event import Event
class TestEventSimulator(unittest2.TestCase):
def setUp(self):
self.testbed = test... | mit | 2c3a8fd09d29dd386bf0b7fb859e07d2 | 45.20977 | 934 | 0.58168 | 3.726767 | false | false | false | false |
the-blue-alliance/the-blue-alliance | src/backend/common/helpers/tests/offseason_event_helper_test.py | 1 | 8088 | import datetime
import pytest
from backend.common.consts.event_type import EventType
from backend.common.helpers.offseason_event_helper import OffseasonEventHelper
from backend.common.models.event import Event
@pytest.fixture(autouse=True)
def auto_add_ndb_stub(ndb_stub):
yield
def test_is_direct_match_key_na... | mit | df7d248f3ca94d4136dd92b43c9f0479 | 31.481928 | 89 | 0.612636 | 3.328395 | false | false | false | false |
boppreh/keyboard | keyboard/_darwinmouse.py | 2 | 6515 | import os
import datetime
import threading
import Quartz
from ._mouse_event import ButtonEvent, WheelEvent, MoveEvent, LEFT, RIGHT, MIDDLE, X, X2, UP, DOWN
_button_mapping = {
LEFT: (Quartz.kCGMouseButtonLeft, Quartz.kCGEventLeftMouseDown, Quartz.kCGEventLeftMouseUp, Quartz.kCGEventLeftMouseDragged),
RIGHT: (Q... | mit | df4417b7fffb2ec47e8a779b8bab003f | 36.66474 | 207 | 0.652955 | 3.527342 | false | false | false | false |
bcb/jsonrpcserver | jsonrpcserver/methods.py | 1 | 1389 | """A method is a Python function that can be called by a JSON-RPC request.
They're held in a dict, a mapping of function names to functions.
The @method decorator adds a method to jsonrpcserver's internal global_methods dict.
Alternatively pass your own dictionary of methods to `dispatch` with the methods param.
... | mit | d4ff12b5dbbc37ffe48504fb2057a311 | 31.302326 | 87 | 0.694024 | 4.183735 | false | false | false | false |
sissaschool/elementpath | elementpath/xpath31/_xpath31_functions.py | 1 | 3474 | #
# Copyright (c), 2018-2021, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@... | mit | 7faa353055e33f6ee69fba54b674b32e | 39.395349 | 83 | 0.681059 | 3.477477 | false | false | false | false |
andriyko/sublime-robot-framework-assistant | dataparser/run_index.py | 2 | 2605 | import argparse
import sys
import shutil
import multiprocessing
from os import path, listdir, makedirs
ROOT_DIR = path.dirname(path.abspath(__file__))
SETTING_DIR = path.join(ROOT_DIR, '..', 'setting')
sys.path.append(SETTING_DIR)
from index.index import index_a_table
from index.index import Index
def... | mit | a3867ffd5feb290fd0ab258b7327fe94 | 28.290698 | 72 | 0.578503 | 3.658708 | false | false | false | false |
robbievanleeuwen/section-properties | sectionproperties/pre/pre.py | 1 | 4404 | from typing import Union, List
from dataclasses import dataclass
import numpy as np
import triangle
class GeometryError(Exception):
"""Exception raised when invalid geometry is found."""
pass
@dataclass(eq=True, frozen=True)
class Material:
"""Class for structural materials.
Provides a way of stor... | mit | c82368e4f78b6dc861d7ead6c3fc03b4 | 33.952381 | 99 | 0.673933 | 3.819601 | false | false | false | false |
gae-init/gae-init | main/model/config_auth.py | 3 | 2679 | # coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
from api import fields
import model
class ConfigAuth(object):
bitbucket_key = ndb.StringProperty(default='', verbose_name='Key')
bitbucket_secret = ndb.StringProperty(default='', verbose_name='Secret')
facebook_app_id... | mit | 6d8bf69f54b8edfd2ac05c0e484448e5 | 35.69863 | 90 | 0.72751 | 3.674897 | false | false | false | false |
eerimoq/cantools | cantools/tester.py | 2 | 13317 | # The tester module.
import time
from collections import UserDict
import queue
import can
from .errors import Error
class DecodedMessage(object):
"""A decoded message.
"""
def __init__(self, name, signals):
self.name = name
self.signals = signals
class Messages(dict):
def __mis... | mit | 4bb3bc5c4ee03c598eec4551893f9f37 | 30.48227 | 113 | 0.535706 | 4.617545 | false | true | false | false |
gae-init/gae-init | main/control/admin.py | 2 | 6189 | # coding: utf-8
import flask
import flask_wtf
import wtforms
import auth
import config
import model
import util
from main import app
###############################################################################
# Admin Stuff
###############################################################################
@app.rou... | mit | fbef850c0ce41cf32e34fcc4fb82ad2d | 47.351563 | 172 | 0.682986 | 3.647024 | false | true | false | false |
gae-init/gae-init | main/control/user.py | 2 | 11875 | # coding: utf-8
import copy
from google.appengine.ext import ndb
from webargs import fields as wf
from webargs.flaskparser import parser
import flask
import flask_login
import flask_wtf
import wtforms
import auth
import cache
import config
import model
import task
import util
from main import app
################... | mit | a38905b96a9acc2e5e877ac7be39465c | 31.269022 | 98 | 0.617937 | 3.629279 | false | false | false | false |
eerimoq/cantools | cantools/__init__.py | 2 | 2980 | import sys
import argparse
import importlib
import pathlib
import os
from . import tester
from . import j1939
from . import logreader
from .errors import Error
# Remove once less users are using the old package structure.
from . import database as db
from .version import __version__
__author__ = 'Erik Moqvist'
cla... | mit | e0fad484f82fd46bf97f956ec37c9bf2 | 31.391304 | 85 | 0.612081 | 4.156206 | false | false | false | false |
eerimoq/cantools | tests/test_monitor.py | 2 | 55472 | import unittest
import curses
import traceback
try:
from unittest.mock import Mock
from unittest.mock import patch
from unittest.mock import call
except ImportError:
from mock import Mock
from mock import patch
from mock import call
import can
from cantools.subparsers.monitor import Monitor
... | mit | 939b86bcebfeb0b81905900de58f52f6 | 42.644375 | 104 | 0.382842 | 3.859996 | false | false | false | false |
liampauling/betfair | examples/examplestreaminghistorical.py | 2 | 2645 | import logging
import betfairlightweight
from betfairlightweight import StreamListener
"""
Data needs to be downloaded from:
https://historicdata.betfair.com
"""
# setup logging
logging.basicConfig(level=logging.INFO)
# create trading instance (don't need username/password)
trading = betfairlightweight.APIClien... | mit | 3c611b2f0dbefd4da3357d106580b778 | 32.481013 | 85 | 0.58034 | 4.11353 | false | false | false | false |
liampauling/betfair | examples/exampleone.py | 2 | 2709 | import betfairlightweight
from betfairlightweight import filters
# create trading instance
trading = betfairlightweight.APIClient("username", "password", app_key="appKey")
# login
trading.login()
# make event type request to find horse racing event type
horse_racing_event_type_id = trading.betting.list_event_types(... | mit | f1b9a26eb29f0279af00f45e7d11fb8a | 33.291139 | 88 | 0.632337 | 3.91474 | false | false | false | false |
liampauling/betfair | betfairlightweight/endpoints/scores.py | 2 | 4681 | import requests
from typing import Union, List
from .baseendpoint import BaseEndpoint
from .. import resources
from ..utils import clean_locals
class Scores(BaseEndpoint):
"""
Scores operations.
"""
URI = "ScoresAPING/v1.0/"
def list_race_details(
self,
meeting_ids: list = None,... | mit | 21473a0c467e53ccb1d6b5524c6f6cc0 | 38.336134 | 112 | 0.644948 | 4.232369 | false | false | false | false |
liampauling/betfair | betfairlightweight/resources/baseresource.py | 2 | 1242 | import functools
import datetime
from typing import Union, Optional
from ..compat import basestring, integer_types, json, parse_datetime
class BaseResource:
"""Lightweight data structure for resources."""
def __init__(self, **kwargs):
self.elapsed_time = kwargs.pop("elapsed_time", None)
now ... | mit | 6c95d19fe2b5d0cfb9688923c8d4d5bf | 28.571429 | 78 | 0.585346 | 4.566176 | false | false | false | false |
liampauling/betfair | tests/test_bettingresources.py | 2 | 25166 | import datetime
import unittest
from betfairlightweight import resources
from betfairlightweight.resources.bettingresources import (
LimitOrder,
LimitOnCloseOrder,
MarketOnCloseOrder,
PriceSize,
)
from betfairlightweight.compat import BETFAIR_DATE_FORMAT
from tests.tools import create_mock_json
class... | mit | 6567e8b1dcee420a4bb4d6f969cb5415 | 44.019678 | 100 | 0.597473 | 4.388143 | false | true | false | false |
liampauling/betfair | betfairlightweight/resources/streamingresources.py | 1 | 14959 | from .baseresource import BaseResource
from .bettingresources import PriceLadderDescription
class MarketDefinitionRunner:
"""
:type adjustment_factor: float
:type id: int
:type removal_date: datetime.datetime
:type sort_priority: int
:type status: unicode
"""
def __init__(
sel... | mit | cee5bf23e91f11fe78a972cc1b538333 | 30.492632 | 88 | 0.612608 | 3.506564 | false | false | false | false |
liampauling/betfair | setup.py | 2 | 1423 | import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "requirements.txt")) as f:
INSTALL_REQUIRES = f.read().splitlines()
with open(os.path.join(here, "requirements-speed.txt")) as f:
extras_require = f.read().splitlines()
EXTRAS_REQUIRE = {... | mit | 2c6a34831ac1ddcb5b82b2e10125ce30 | 29.934783 | 80 | 0.616304 | 3.639386 | false | false | true | false |
liampauling/betfair | betfairlightweight/resources/racecardresources.py | 2 | 10419 | from .baseresource import BaseResource
class RaceType:
"""
:type abbr: unicode
:type full: unicode
:type key: unicode
"""
def __init__(self, abbr, full, key):
self.abbr = abbr
self.full = full
self.key = key
class RaceClassification:
"""
:type classification:... | mit | 9b05f1cbce30d32864e0c0f6b4709f9d | 26.858289 | 87 | 0.610519 | 3.743802 | false | false | false | false |
missionpinball/mpf-mc | mpfmc/widgets/ellipse.py | 1 | 2531 | """An ellipse widget."""
from typing import Optional
from kivy.graphics.vertex_instructions import Ellipse as KivyEllipse
from kivy.graphics.context_instructions import Color, Rotate, Scale
from kivy.properties import NumericProperty
from mpfmc.uix.widget import Widget
MYPY = False
if MYPY: # pragma: no cover
f... | mit | 6f28fb22b92ae67e012ea9da55e757c2 | 30.246914 | 95 | 0.596997 | 3.917957 | false | false | false | false |
missionpinball/mpf-mc | mpfmc/core/keyboard.py | 1 | 7430 | """Handles key strokes in the media manager."""
import logging
from kivy.core.window import Window
from kivy.uix.widget import Widget as KivyWidget
class Keyboard(KivyWidget):
"""Handles key strokes in the media manager."""
def __init__(self, mc, **kwargs):
super().__init__(**kwargs)
self.... | mit | b9f0a016e1466149caf419cfa857407e | 34.550239 | 100 | 0.520996 | 4.176504 | false | false | false | false |
missionpinball/mpf-mc | mpfmc/core/bcp_server.py | 1 | 9542 | """BCP Server interface for the MPF Media Controller"""
import logging
import queue
import socket
import sys
import threading
import time
import traceback
import select
import mpf.core.bcp.bcp_socket_client as bcp
from mpf.exceptions.runtime_error import MpfRuntimeError
class BCPServer(threading.Thread):
"""Pa... | mit | b3022f558c6d7a666f325ba1d39bcdcd | 35.7 | 114 | 0.521798 | 4.751992 | false | false | false | false |
missionpinball/mpf-mc | mpfmc/effects/color_dmd.py | 1 | 3949 | from typing import List
from kivy.properties import NumericProperty, ListProperty, BooleanProperty
from mpfmc.uix.effects import EffectsChain
from mpfmc.effects.dot_filter import DotFilterEffect
from mpfmc.effects.gain import GainEffect
from mpfmc.effects.reduce import ReduceEffect
MYPY = False
if MYPY: # pragma: ... | mit | 8f8b2d56cf2d6a8e601ac22c43d6f470 | 29.145038 | 101 | 0.658141 | 3.82655 | false | false | false | false |
missionpinball/mpf-mc | mpfmc/core/assets.py | 1 | 5327 | """Threaded Asset Loader for MC."""
import logging
import threading
import traceback
from queue import PriorityQueue, Queue, Empty
import sys
from mpf.core.assets import BaseAssetManager
from mpf.exceptions.config_file_error import ConfigFileError
class ThreadedAssetManager(BaseAssetManager):
"""AssetManager w... | mit | 22677bce96def22890b76950f7b45a70 | 38.753731 | 113 | 0.57706 | 4.726708 | false | false | false | false |
kronenthaler/mod-pbxproj | mod_pbxproj.py | 1 | 2082 | # MIT License
#
# Copyright (c) 2016 Ignacio Calderon aka kronenthaler
#
# 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,... | mit | b999f0eab104f5742dc2606ad5eb24c6 | 39.823529 | 120 | 0.742555 | 4.14741 | false | false | false | false |
kronenthaler/mod-pbxproj | tests/pbxsections/TestPBXFileReference.py | 1 | 1492 | import unittest
from pbxproj.pbxsections.PBXFileReference import PBXFileReference
class PBXFileReferenceTest(unittest.TestCase):
def testPrintOnSingleLine(self):
obj = {"isa": "PBXFileReference", "name": "something"}
dobj = PBXFileReference().parse(obj)
self.assertEqual(dobj.__repr__(), ... | mit | 34c5d24261884f1201b6b9811d84e51d | 32.155556 | 89 | 0.691689 | 4.155989 | false | true | false | false |
ottowayi/pycomm3 | pycomm3/packets/logix.py | 1 | 15290 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Ian Ottoway <ian@ottoway.dev>
# Copyright (c) 2014 Agostino Ruscito <ruscito@gmail.com>
#
# 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 withou... | mit | eda154f535169fb930a6ac75f2ca9327 | 33.282511 | 113 | 0.598365 | 3.869906 | false | false | false | false |
kronenthaler/mod-pbxproj | tests/pbxsections/TestXCBuildConfiguration.py | 1 | 5185 | import unittest
from pbxproj.pbxsections.XCBuildConfiguration import XCBuildConfiguration
class XCBuildConfigurationTest(unittest.TestCase):
def testAddFlagOnNewObject(self):
obj = XCBuildConfiguration()
obj.add_flags('flag', '-flag')
self.assertIsNotNone(obj.buildSettings)
self.... | mit | 8e3314b1a7edaf0bcc38033455921687 | 38.280303 | 94 | 0.647252 | 3.880988 | false | true | false | false |
oemof/feedinlib | tests/test_examples.py | 1 | 2121 | import os
import subprocess
import tempfile
import nbformat
import pytest
class TestExamples:
def _notebook_run(self, path):
"""
Execute a notebook via nbconvert and collect output.
Returns (parsed nb object, execution errors)
"""
dirname, __ = os.path.split(path)
... | mit | d4b67e7d313638451906c0a87fbed172 | 35.568966 | 76 | 0.558227 | 3.986842 | false | true | false | false |
openpathsampling/openpathsampling | openpathsampling/experimental/storage/test_mdtraj_json.py | 3 | 2273 | from .mdtraj_json import *
import pytest
import numpy as np
import numpy.testing as npt
from ..simstore.custom_json import bytes_codec, numpy_codec, custom_json_factory
from ..simstore.test_custom_json import CustomJSONCodingTest
from openpathsampling.tests.test_helpers import data_filename
class MDTrajCodingTest(C... | mit | f4806c62637496c5af1f91af305ef435 | 31.471429 | 80 | 0.587769 | 3.820168 | false | true | false | false |
openpathsampling/openpathsampling | openpathsampling/analysis/tis/crossing_probability.py | 3 | 5290 | import collections
import openpathsampling as paths
from openpathsampling.netcdfplus import StorableNamedObject
from openpathsampling.numerics import LookupFunction
import pandas as pd
import numpy as np
from .core import EnsembleHistogrammer, MultiEnsembleSamplingAnalyzer
class FullHistogramMaxLambdas(EnsembleHistog... | mit | 749bd30c090483114bda8075827ca86b | 39.692308 | 78 | 0.655198 | 4.437919 | false | false | false | false |
openpathsampling/openpathsampling | openpathsampling/storage/util.py | 4 | 2682 | import openpathsampling as paths
def split_md_storage(filename):
"""
Split storage into two files; trajectories and the rest
Currently this makes only sense for storage with snapshots that use
additional stores. Otherwise we need to store the full snapshots for
CVs anyway and nothing is gained.
... | mit | 3ce4fab4b1d7e5c5e9b23f175b18c957 | 27.231579 | 76 | 0.623788 | 3.547619 | false | false | false | false |
openpathsampling/openpathsampling | openpathsampling/movechange.py | 3 | 18289 | __author__ = 'Jan-Hendrik Prinz'
import logging
import openpathsampling as paths
from openpathsampling.netcdfplus import StorableObject, lazy_loading_attributes
from openpathsampling.netcdfplus import DelayedLoader
from .treelogic import TreeMixin
logger = logging.getLogger(__name__)
# @lazy_loading_attributes('de... | mit | a1c71557317e00418c9e0d8c4a7100de | 27.576563 | 136 | 0.597299 | 4.45747 | false | false | false | false |
openpathsampling/openpathsampling | openpathsampling/experimental/simstore/storage.py | 3 | 28000 | """
A simple storage interface for simulation objects and data objects.
Reserved words
--------------
Table names:
* ``uuid``
* ``tables``
* ``metadata``
Column names:
* ``uuid``
* ``idx``
"""
import logging
import collections
from collections import abc
import itertools
from . import tools
from .serialization_h... | mit | 47b8a006111a0ce5962ba34915d23be3 | 39.114613 | 79 | 0.579464 | 4.17039 | false | false | false | false |
openpathsampling/openpathsampling | openpathsampling/netcdfplus/cache.py | 4 | 13834 | from collections import OrderedDict
import weakref
__author__ = 'Jan-Hendrik Prinz'
class Cache(object):
"""
A cache like dict
"""
@property
def count(self):
"""
int : the number of strong references
int : the number of weak references
"""
return len(self),... | mit | c567e645013385a9b5a20531f65f898a | 24.336996 | 78 | 0.536143 | 4.229288 | false | false | false | false |
openpathsampling/openpathsampling | openpathsampling/tests/test_interface_set.py | 3 | 9129 | from __future__ import absolute_import
from builtins import zip
from builtins import range
from builtins import object
from nose.tools import (assert_equal, assert_not_equal, assert_almost_equal,
raises)
from nose.plugins.skip import Skip, SkipTest
from .test_helpers import (
true_func, asse... | mit | fceb851af257832bbf670f9d3a6ba59d | 39.93722 | 79 | 0.580458 | 3.437123 | false | true | false | false |
jpadilla/pyjwt | jwt/utils.py | 2 | 3973 | import base64
import binascii
import re
from typing import Union
try:
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
from cryptography.hazmat.primitives.asymmetric.utils import (
decode_dss_signature,
encode_dss_signature,
)
except ModuleNotFoundError:
EllipticCu... | mit | 6fabfa91a96ded3469f839ff539693aa | 23.83125 | 157 | 0.631009 | 2.958302 | false | false | false | false |
theolind/pymysensors | tests/test_gateway_mqtt.py | 1 | 8474 | """Test mysensors MQTT gateway with unittest."""
import logging
import time
from unittest import mock
import pytest
from mysensors.gateway_mqtt import MQTTGateway
from mysensors.sensor import Sensor
# pylint: disable=redefined-outer-name
@pytest.fixture
def mock_pub():
"""Return a mock callback to publish to m... | mit | 51ae479e66e8284266ad1633154e6ccc | 34.755274 | 85 | 0.64633 | 3.144341 | false | true | false | false |
theolind/pymysensors | mysensors/cli/gateway_serial.py | 1 | 1251 | """Start a serial gateway."""
import click
from mysensors.cli.helper import (
common_gateway_options,
handle_msg,
run_async_gateway,
run_gateway,
)
from mysensors.gateway_serial import AsyncSerialGateway, SerialGateway
def common_serial_options(func):
"""Supply common serial gateway options."""
... | mit | 7bb64e7663b5793d60f94e6342e87505 | 25.0625 | 76 | 0.665867 | 3.897196 | false | false | false | false |
dashwav/nano-chan | cogs/utils/helpers.py | 1 | 3379 | """
Helper functions for nano-chan.
Did take a few from kitsu-chan and modify them tbh
"""
import asyncio
import discord
from discord.ext import commands
async def confirm(ctx: commands.Context, member_to_kick, reason):
"""
Yes no helper. Ask a confirmation message with a timeout of 5 seconds.
... | mit | ab0661a33e1e90e69ccde24eb2c28404 | 38.035714 | 77 | 0.558727 | 4.278626 | false | false | false | false |
gocardless/gocardless-pro-python | tests/integration/institutions_integration_test.py | 1 | 3986 | # WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
import json
import requests
import responses
from nose.tools import (
assert_equal,
assert_is_instance,
assert_is_none,
assert_is_not_none,
assert_not_equal,
assert_raises
)
from gocardless_pro.e... | mit | 780d6045fd9e15b0ad7295f8b90b157e | 38.078431 | 79 | 0.672102 | 3.568487 | false | false | false | false |
maxking/docker-mailman | web/mailman-web/settings.py | 1 | 12645 | # -*- coding: utf-8 -*-
# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
#
# This file is part of Mailman Suite.
#
# Mailman Suite is free sofware: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3... | mit | f94ed7b90b6b918b71728aea5f05bd49 | 29.543478 | 127 | 0.652748 | 3.574053 | false | false | false | false |
gocardless/gocardless-pro-python | gocardless_pro/services/payments_service.py | 1 | 5991 | # WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
from . import base_service
from .. import resources
from ..paginator import Paginator
from .. import errors
class PaymentsService(base_service.BaseService):
"""Service class that provides access to the pa... | mit | 06215932d043e90960411da7b380254e | 30.867021 | 79 | 0.566183 | 4.835351 | false | false | false | false |
gocardless/gocardless-pro-python | gocardless_pro/services/subscriptions_service.py | 1 | 9566 | # WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
from . import base_service
from .. import resources
from ..paginator import Paginator
from .. import errors
class SubscriptionsService(base_service.BaseService):
"""Service class that provides access to t... | mit | 79b49f77f3c54255c9c126438453df0d | 33.164286 | 80 | 0.587706 | 5.032088 | false | false | false | false |
gocardless/gocardless-pro-python | tests/integration/mandate_pdfs_integration_test.py | 1 | 2055 | # WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
import json
import requests
import responses
from nose.tools import (
assert_equal,
assert_is_instance,
assert_is_none,
assert_is_not_none,
assert_not_equal,
assert_raises
)
from gocardless_pro.e... | mit | b34ee36741e0897aff51c745d6e0fe3e | 33.25 | 82 | 0.711922 | 3.261905 | false | false | false | false |
gocardless/gocardless-pro-python | gocardless_pro/services/customer_notifications_service.py | 1 | 1612 | # WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
from . import base_service
from .. import resources
from ..paginator import Paginator
from .. import errors
class CustomerNotificationsService(base_service.BaseService):
"""Service class that provides acc... | mit | cc67de3ed16ed36977012056610b2d88 | 31.24 | 89 | 0.630893 | 4.855422 | false | false | false | false |
gocardless/gocardless-pro-python | gocardless_pro/services/creditors_service.py | 1 | 3406 | # WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
from . import base_service
from .. import resources
from ..paginator import Paginator
from .. import errors
class CreditorsService(base_service.BaseService):
"""Service class that provides access to the c... | mit | bfc25009b96374eb495756be697df137 | 27.14876 | 79 | 0.551086 | 4.750349 | false | false | false | false |
gocardless/gocardless-pro-python | gocardless_pro/webhooks.py | 1 | 1372 | import json
import hmac
import hashlib
import sys
from gocardless_pro.resources.event import Event
from gocardless_pro.errors import InvalidSignatureError
# Python 3+ does not have the basestring type, so we alias it
try:
basestring
except:
basestring = str
# Python 3.0 < x < 3.4 does not support handing a m... | mit | f20172a2cdb0c549a8df8034f91bebf8 | 25.901961 | 67 | 0.691691 | 3.698113 | false | false | false | false |
zzzeek/mako | mako/ast.py | 9 | 6642 | # mako/ast.py
# Copyright 2006-2022 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""utilities for analyzing expressions and blocks of Python
code, as well as generating Python from AST no... | mit | 7fa59769ba5d294f10b225fb5f4901da | 31.881188 | 79 | 0.558416 | 4.338341 | false | false | false | false |
zzzeek/mako | examples/bench/basic.py | 2 | 6593 | # basic.py - basic benchmarks adapted from Genshi
# Copyright (C) 2006 Edgewall Software
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the ab... | mit | 21d7a4672e44ca82444f28862af23a81 | 28.433036 | 79 | 0.629455 | 4.120625 | false | false | false | false |
zzzeek/mako | mako/template.py | 9 | 23858 | # mako/template.py
# Copyright 2006-2022 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Provides the Template class, a facade for parsing, generating and executing
template strings, as w... | mit | b3c92f9aaddc870ea33f7f23902987fa | 32.321229 | 79 | 0.615601 | 4.335453 | false | false | false | false |
alisaifee/limits | limits/aio/storage/base.py | 1 | 2941 | from abc import ABC, abstractmethod
from deprecated.sphinx import versionadded
from limits.storage.registry import StorageRegistry
from limits.typing import List, Optional, Tuple, Union
from limits.util import LazyDependency
@versionadded(version="2.1")
class Storage(LazyDependency, metaclass=StorageRegistry):
... | mit | a32fa10abb64284043f00dcf945a7b71 | 27.009524 | 82 | 0.616117 | 4.69059 | false | false | false | false |
alisaifee/limits | tests/conftest.py | 1 | 7329 | import os
import platform
import socket
import time
import pymemcache
import pymemcache.client
import pymongo
import pytest
import redis
import redis.sentinel
def check_redis_cluster_ready(host, port):
try:
return redis.Redis(host, port).cluster("info")["cluster_state"] == "ok"
except Exception:
... | mit | 7a1041dca290e05b2a9d71e7b390202b | 23.43 | 88 | 0.6769 | 3.510057 | false | true | false | false |
rst2pdf/rst2pdf | rst2pdf/tests/input/sphinx-issue529/conf.py | 1 | 1322 | # -*- coding: utf-8 -*-
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['rst2pdf.pdfbuilder']
# The master toctree document.... | mit | 94642590accf87dc403893fccc3b3e2f | 26.541667 | 80 | 0.638427 | 3.787966 | false | false | false | false |
kivy/python-for-android | pythonforandroid/recipes/python3/__init__.py | 1 | 16612 | import glob
import sh
import subprocess
from multiprocessing import cpu_count
from os import environ, utime
from os.path import dirname, exists, join
from pathlib import Path
import shutil
from pythonforandroid.logger import info, warning, shprint
from pythonforandroid.patching import version_starts_with
from pythonf... | mit | 7a29299d2bc8facaae62b435fa764231 | 37.722611 | 91 | 0.575066 | 3.855187 | false | false | false | false |
kivy/python-for-android | tests/test_pythonpackage.py | 3 | 3645 | """
THESE TESTS DON'T RUN IN GITHUB-ACTIONS (takes too long!!)
ONLY THE BASIC ONES IN test_pythonpackage_basic.py DO.
(This file basically covers all tests for any of the
functions that aren't already part of the basic
test set)
"""
import os
import shutil
import tempfile
from pythonforandroid.pythonpackage import (... | mit | 219a2d0ae791f0914c0708a4466dd11c | 31.837838 | 77 | 0.651303 | 3.898396 | false | true | false | false |
rst2pdf/rst2pdf | rst2pdf/pygments2style.py | 1 | 2603 | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
'''
Creates a rst2pdf stylesheet for each pygments style.
'''
import os
from dumpstyle import dumps
from pygments.token import STANDARD_TYPES
from pygments import styles as pstyles
# First get a list of all possible classes
classnames = set()
for name in... | mit | 27ee036a9e0ac4b4ef19feac2803f39d | 34.657534 | 81 | 0.566654 | 3.816716 | false | false | false | false |
kivy/python-for-android | setup.py | 1 | 4752 |
import glob
from io import open # for open(..,encoding=...) parameter in python 2
from os import walk
from os.path import join, dirname, sep
import re
from setuptools import setup, find_packages
# NOTE: All package data should also be set in MANIFEST.in
packages = find_packages()
package_data = {'': ['*.tmpl',
... | mit | 7711fa1ed9bfcb0124c0ee20736381f4 | 35.837209 | 84 | 0.569865 | 4.044255 | false | false | false | false |
kivy/python-for-android | pythonforandroid/recipes/android/src/android/_ctypes_library_finder.py | 3 | 2516 |
import sys
import os
def get_activity_lib_dir(activity_name):
from jnius import autoclass
# Get the actual activity instance:
activity_class = autoclass(activity_name)
if activity_class is None:
return None
activity = None
if hasattr(activity_class, "mActivity") and \
act... | mit | 2afd20e264beebeacde46553537128fa | 36.552239 | 78 | 0.641494 | 3.543662 | false | false | false | false |
rst2pdf/rst2pdf | rst2pdf/styles.py | 1 | 35530 | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
from copy import copy
import os
import os.path
import sys
import re
import docutils.nodes
import reportlab
import reportlab.lib.colors as colors
from reportlab.lib.fonts import addMapping
import reportlab.lib.pagesizes as pagesizes
from reportlab.lib.style... | mit | dc542aa8134531e4a5e0cdec50f7e7a3 | 36.99893 | 93 | 0.473501 | 4.475249 | false | false | false | false |
kivy/python-for-android | pythonforandroid/recipes/liblzma/__init__.py | 1 | 2557 | import sh
from multiprocessing import cpu_count
from os.path import exists, join
from pythonforandroid.archs import Arch
from pythonforandroid.logger import shprint
from pythonforandroid.recipe import Recipe
from pythonforandroid.util import current_directory
class LibLzmaRecipe(Recipe):
version = '5.2.4'
... | mit | d77da9432581d8dae0e843dfa71ae368 | 32.207792 | 78 | 0.546734 | 3.995313 | false | false | false | false |
rst2pdf/rst2pdf | rst2pdf/image.py | 1 | 15554 | # -*- coding: utf-8 -*-
from copy import copy
import glob
import os
from os.path import abspath, dirname
import sys
from urllib.request import urlretrieve
from PIL import Image as PILImage
from reportlab.platypus.flowables import Image, Flowable
from reportlab.lib.units import cm, inch
from .log import log, nodeid
... | mit | 3c0365aae9022ae91e1f2cba042ebcc5 | 33.184615 | 112 | 0.520381 | 4.428815 | false | false | false | false |
kivy/python-for-android | pythonforandroid/recipes/ifaddrs/__init__.py | 5 | 2114 | """ ifaddrs for Android
"""
from os.path import join, exists
import sh
from pythonforandroid.logger import info, shprint
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
from pythonforandroid.toolchain import current_directory
class IFAddrRecipe(CompiledComponentsPythonRecipe):
version = '8f9a87... | mit | a5094fdd7b9b512b6e1ce4d87de21262 | 38.148148 | 82 | 0.599811 | 3.626072 | false | false | false | false |
kivy/python-for-android | pythonforandroid/recipes/gevent/__init__.py | 5 | 1567 | import re
from pythonforandroid.logger import info
from pythonforandroid.recipe import CythonRecipe
class GeventRecipe(CythonRecipe):
version = '1.4.0'
url = 'https://pypi.python.org/packages/source/g/gevent/gevent-{version}.tar.gz'
depends = ['librt', 'setuptools']
patches = ["cross_compiling.patch"]... | mit | 7d7935091670f251f11a3dba756db03a | 45.088235 | 97 | 0.613274 | 3.482222 | false | false | false | false |
rst2pdf/rst2pdf | rst2pdf/tests/input/sphinx-issue285/conf.py | 1 | 1163 | # -*- coding: utf-8 -*-
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['rst2pdf.pdfbuilder']
# The master toctree document.... | mit | ca3f861dbb126505f873ffb9dbb91e3a | 29.631579 | 86 | 0.656922 | 3.775974 | false | false | false | false |
rst2pdf/rst2pdf | rst2pdf/createpdf.py | 1 | 65875 | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
# Some fragments of code are copied from Reportlab under this license:
#
#####################################################################################
#
# Copyright (c) 2000-2008, ReportLab Inc.
# All rights reserved.
#
# Redistri... | mit | c1a2062d6e86af9332123a9874e4592e | 32.973698 | 125 | 0.547385 | 4.195325 | false | false | false | false |
kivy/python-for-android | pythonforandroid/recipes/android/src/android/mixer.py | 5 | 6326 | # This module is, as much a possible, a clone of the pygame
# mixer api.
import android._android_sound as sound
import time
import threading
import os
condition = threading.Condition()
def periodic():
for i in range(0, num_channels):
if i in channels:
channels[i].periodic()
num_channels = ... | mit | 323be6ac1288a38251c9416cbee1adc9 | 18.524691 | 70 | 0.577774 | 3.680047 | false | false | false | false |
luanfonceca/speakerfight | deck/migrations/0012_auto_20151211_1354.py | 4 | 1446 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('deck', '0011_auto_20150825_1628'),
]
operations = [
migrations.AlterField(
model_name='activity',
na... | mit | 4eccd86ddc18cd39265a6ba08eee5a37 | 37.052632 | 303 | 0.592669 | 4.05042 | false | false | false | false |
bd-j/prospector | prospect/plotting/sfh.py | 1 | 17351 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import Namespace
from copy import deepcopy
import numpy as np
from scipy.special import gamma, gammainc
from ..models.transforms import logsfr_ratios_to_masses
from ..sources.constants import cosmo
from .corner import quantile
__all__ = ["params_to_sfh", "... | mit | 35fb8c7162ba45dff4d154130bc83257 | 34.923395 | 115 | 0.584462 | 3.025458 | false | false | false | false |
luanfonceca/speakerfight | api/serializers.py | 1 | 2924 | from django.contrib import auth
from rest_framework.reverse import reverse
from rest_framework import serializers
from deck.models import Event, Activity, Track
from deck.templatetags.deck_tags import get_user_photo
class UserSerializer(serializers.ModelSerializer):
full_name = serializers.SerializerMethodField... | mit | eecdc9dd330e4b5fa6ffbcee1b292c6d | 29.778947 | 65 | 0.665869 | 4.237681 | false | false | false | false |
bd-j/prospector | scripts/prospector_dynesty.py | 1 | 6908 | import time, sys, os
import numpy as np
np.errstate(invalid='ignore')
from prospect.models import model_setup
from prospect.io import write_results
from prospect import fitting
from prospect.likelihood import lnlike_spec, lnlike_phot, write_log
from dynesty.dynamicsampler import stopping_function, weight_function, _kl... | mit | 726a67435a494e96a61e1e4976625bd8 | 31.739336 | 178 | 0.565431 | 3.721983 | false | false | false | false |
luanfonceca/speakerfight | core/models.py | 1 | 2691 |
from django.core.exceptions import AppRegistryNotReady
from django.core.urlresolvers import reverse_lazy
from django.conf import settings
from django.db import models
from django.db.models.signals import post_save, pre_save
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation imp... | mit | a3846a56230f9a8ca22b01a3de084cd2 | 30.290698 | 74 | 0.668153 | 3.806223 | false | false | false | false |
luanfonceca/speakerfight | organization/views.py | 1 | 1947 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from . models import Organization
from core.mixins im... | mit | ee6ae4420677d3a4530b4160bd6c3e85 | 33.767857 | 80 | 0.715973 | 4.288546 | false | false | false | false |
bd-j/prospector | scripts/prospector_restart.py | 3 | 7080 | #!/usr/local/bin/python
import time, sys, os
import numpy as np
np.errstate(invalid='ignore')
from prospect.models import model_setup
from prospect.io import write_results
from prospect.io import read_results as pr
from prospect import fitting
from prospect.likelihood import lnlike_spec, lnlike_phot, write_log, chi_s... | mit | f660792cde39df74e40bd32d65fd674a | 30.607143 | 87 | 0.582345 | 3.610403 | false | false | false | false |
bd-j/prospector | prospect/utils/prospect_args.py | 1 | 7518 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""prospect_args.py - methods to get a default argument parser for prospector.
"""
import argparse
__all__ = ["get_parser", "show_default_args"]
def show_default_args():
parser = get_parser()
parser.print_help()
def get_parser(fitters=["optimize", "emcee", "d... | mit | 8addbfef31fac78d5047230354a73eda | 44.017964 | 106 | 0.568901 | 4.48568 | false | false | false | false |
bd-j/prospector | prospect/likelihood/likelihood.py | 1 | 7851 | import time, sys, os
import numpy as np
from scipy.linalg import LinAlgError
__all__ = ["lnlike_spec", "lnlike_phot", "chi_spec", "chi_phot", "write_log"]
def lnlike_spec(spec_mu, obs=None, spec_noise=None, f_outlier_spec=0.0, **vectors):
"""Calculate the likelihood of the spectroscopic data given the
spectr... | mit | 75357ead569f38b38a7f50f494c65dae | 35.179724 | 96 | 0.617374 | 3.596427 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.