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
daler/gffutils
gffutils/helpers.py
1
18443
import copy import sys import os import simplejson as json import time import tempfile import six from gffutils import constants from gffutils import bins import gffutils from gffutils import gffwriter from gffutils import parser from gffutils.attributes import dict_class HERE = os.path.dirname(os.path.abspath(__file_...
mit
3d71b02489738eea4918c6b674087f7b
30.20643
174
0.588408
3.816846
false
false
false
false
daler/gffutils
gffutils/convert.py
1
1389
""" Conversion functions that operate on :class:`FeatureDB` classes. """ import six def to_bed12(f, db, child_type="exon", name_field="ID"): """ Given a top-level feature (e.g., transcript), construct a BED12 entry Parameters ---------- f : Feature object or string This is the top-level f...
mit
a2ebf2067cc09c8d6168b3312584fadd
30.568182
79
0.579554
3.507576
false
false
false
false
daler/gffutils
gffutils/test/test_issues.py
1
15046
""" Tests for specific issues and pull requests """ import os import tempfile import difflib from textwrap import dedent import gffutils from gffutils import feature from gffutils import merge_criteria as mc from nose.tools import assert_raises def test_issue_79(): gtf = gffutils.example_filename("keep-order-te...
mit
40df47b16299a4a0c3b50b7f7095fc5a
34.072261
140
0.61724
3.114469
false
true
false
false
daler/gffutils
gffutils/create.py
1
54349
import copy import warnings import collections import tempfile import sys import os import sqlite3 import six from textwrap import dedent from gffutils import constants from gffutils import version from gffutils import bins from gffutils import helpers from gffutils import feature from gffutils import interface from gf...
mit
a616f8c4a30faa43df34c53c750ee909
37.300916
88
0.5346
4.664349
false
false
false
false
conjure-up/conjure-up
test/test_utils.py
3
3454
#!/usr/bin/env python # # tests test/utils.py # # Copyright Canonical, Ltd. import asyncio import logging import unittest from unittest.mock import patch from conjureup import utils from .helpers import test_loop class UtilsTestCase(unittest.TestCase): def test_valid_hostnames(self): "Verify is_valid...
mit
29fa1a41b14c42d41baca03e75c3ed53
28.775862
74
0.502027
3.956472
false
true
false
false
conjure-up/conjure-up
conjureup/ui/views/jaas.py
3
1827
from ubuntui.utils import Color, Padding from urwid import Columns, Edit, Text from conjureup.ui.views.base import BaseView class JaaSLoginView(BaseView): title = 'Login to JaaS' subtitle = 'Enter your Ubuntu SSO credentials' footer = ('Enter your Ubuntu SSO (Launchpad) email address and ' ...
mit
19fbec2726320c3ac5ef69f64b4be3e2
33.471698
78
0.55884
3.946004
false
false
false
false
conjure-up/conjure-up
conjureup/ui/views/shutdown.py
3
1640
""" A View to inform user that shutdown is in progress. """ from ubuntui.utils import Padding from urwid import Columns, LineBox, Pile, Text, WidgetWrap from conjureup import events from conjureup.app_config import app from conjureup.ui.widgets.buttons import SubmitButton class ShutdownView(WidgetWrap): def __...
mit
bde7539de36a75a1eeea6546eb665dfd
29.943396
74
0.539634
4.039409
false
false
false
false
conjure-up/conjure-up
conjureup/controllers/juju/jaaslogin/gui.py
3
4361
import asyncio from subprocess import CalledProcessError from conjureup import controllers, juju from conjureup.app_config import app from conjureup.consts import JAAS_DOMAIN from conjureup.ui.views.interstitial import InterstitialView from conjureup.ui.views.jaas import JaaSLoginView class JaaSLoginController: ...
mit
c00aab82477a0598a26379f83296f43e
36.921739
77
0.573034
4.292323
false
false
false
false
conjure-up/conjure-up
conjureup/ui/views/destroy_confirm.py
3
3999
import datetime from ubuntui.utils import Color, Padding from ubuntui.widgets.buttons import menu_btn from ubuntui.widgets.hr import HR from ubuntui.widgets.text import Instruction from urwid import Columns, Filler, Frame, Pile, Text, WidgetWrap class DestroyConfirmView(WidgetWrap): def __init__(self, app, cont...
mit
dbe2a05e0372c74a47981ee45cd7e46e
33.179487
84
0.540635
4.139752
false
false
false
false
conjure-up/conjure-up
conjureup/ui/views/spellpicker.py
3
2161
from ubuntui.ev import EventLoop from ubuntui.utils import Color from urwid import Text from conjureup.ui.views.base import BaseView from conjureup.ui.views.bundle_readme_view import BundleReadmeView from conjureup.ui.widgets.selectors import MenuSelectButtonList class SpellPickerView(BaseView): title = "Spell S...
mit
395e586c4e00c6d46135a6b4fd85f48d
29.871429
66
0.586765
3.893694
false
false
false
false
conjure-up/conjure-up
conjureup/events.py
3
6590
import asyncio import errno import inspect from concurrent.futures import CancelledError from pathlib import Path from ubuntui.ev import EventLoop from urwid import ExitMainLoop from conjureup import errors, utils from conjureup.app_config import app from conjureup.telemetry import track_exception class Event(async...
mit
2e6bf8dc07a30551f2b420a2d64d32aa
31.146341
76
0.591958
4.028117
false
false
false
false
conjure-up/conjure-up
conjureup/controllers/juju/credentials/gui.py
3
4000
from os import path import yaml from conjureup import controllers, juju, utils from conjureup.app_config import app from conjureup.consts import CUSTOM_PROVIDERS, cloud_types from conjureup.ui.views.credentials import ( CredentialPickerView, NewCredentialView ) from . import common class CredentialsControl...
mit
19b683932d450909204e42a00789662a
32.613445
78
0.584
4.376368
false
false
false
false
conjure-up/conjure-up
conjureup/bundle.py
3
9430
""" Bundle class for providing some common utilities when manipulating the bundle spec """ from collections import Mapping from itertools import chain import yaml from conjureup.consts import spell_types class BundleInvalidApplication(Exception): pass class BundleInvalidFragment(Exception): pass class B...
mit
5f9bf787675c5e6d879232a6accb4d7b
29.616883
78
0.537116
4.668317
false
false
false
false
stripe/stripe-python
stripe/util.py
1
7795
from __future__ import absolute_import, division, print_function import functools import hmac import io import logging import sys import os import re import stripe from stripe import six from stripe.six.moves.urllib.parse import parse_qsl, quote_plus STRIPE_LOG = os.environ.get("STRIPE_LOG") logger = logging.getLog...
mit
6c3759e62a89c0bd4ffcc90eefda7577
27.977695
80
0.605773
3.767521
false
false
false
false
stripe/stripe-python
tests/api_resources/abstract/test_searchable_api_resource.py
1
3046
from __future__ import absolute_import, division, print_function import stripe class TestSearchableAPIResource(object): class MySearchable(stripe.api_resources.abstract.SearchableAPIResource): OBJECT_NAME = "mysearchable" @classmethod def search(cls, *args, **kwargs): return ...
mit
69b6ff36bc07f966ee4c7bc669ed9cb4
32.108696
76
0.478332
3.950713
false
true
false
false
stripe/stripe-python
stripe/api_resources/cash_balance.py
1
1070
# -*- coding: utf-8 -*- # File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function from stripe import util from stripe.api_resources.abstract import APIResource from stripe.api_resources.customer import Customer from stripe.six.moves.urllib.parse import quote_plus class C...
mit
e0d5a76d683b68a5752f69ae3a9d61bd
35.896552
217
0.692523
3.848921
false
false
false
false
stripe/stripe-python
stripe/six.py
4
34581
# Copyright (c) 2010-2020 Benjamin Peterson # # 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, modify, merge, publi...
mit
f8672965ef67411bf2f2b64ab91d455d
33.650301
118
0.624765
4.013114
false
false
false
false
okfn/website
aldryn_video/migrations/0001_initial.py
2
1862
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('cms', '0015_auto_20160421_0000'), ('contenttypes', '0001_initial'), ] operations = [ migrati...
mit
e497aa553c7f681e476666e8be6b9450
43.333333
169
0.559076
4.391509
false
false
false
false
stripe/stripe-python
stripe/api_resources/payment_intent.py
1
6998
# -*- coding: utf-8 -*- # File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function from stripe import util from stripe.api_resources.abstract import CreateableAPIResource from stripe.api_resources.abstract import ListableAPIResource from stripe.api_resources.abstract import...
mit
f67885628e08acb9e10a7f3fc6fe69fc
29.692982
94
0.573592
4.068605
false
false
false
false
stripe/stripe-python
stripe/api_resources/financial_connections/account.py
1
3222
# -*- coding: utf-8 -*- # File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function from stripe import util from stripe.api_resources.abstract import ListableAPIResource class Account(ListableAPIResource): """ A Financial Connections Account represents an account t...
mit
fa4455cb8d8ab4a87894a487801b55ca
29.11215
142
0.563625
4.130769
false
false
false
false
okfn/website
foundation/organisation/cms_plugins.py
1
4101
from django.conf import settings from django.utils.translation import ugettext_lazy as _ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.models.pluginmodel import CMSPlugin from cms.extensions.extension_pool import extension_pool from .models import (Project, Theme, FeaturedT...
mit
1d515aa6b234746ed03040b0c29ad93a
28.292857
79
0.691782
4.101
false
false
false
false
okfn/website
foundation/organisation/migrations/0001_initial.py
2
15921
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django_countries.fields class Migration(migrations.Migration): dependencies = [ ('cms', '0013_urlconfrevision'), ] operations = [ migrations.CreateModel( name='Boa...
mit
2c8f62b4602851bb84b0a0d3e819e498
43.472067
162
0.51743
4.715936
false
false
false
false
stripe/stripe-python
stripe/__init__.py
1
1399
from __future__ import absolute_import, division, print_function import os # Stripe Python bindings # API docs at http://stripe.com/docs/api # Authors: # Patrick Collison <patrick@stripe.com> # Greg Brockman <gdb@stripe.com> # Andrew Metcalf <andrew@stripe.com> # Configuration variables api_key = None client_id = N...
mit
c660449c31e0b71f68effb996becba2b
24.436364
77
0.710508
3.299528
false
false
false
false
stripe/stripe-python
stripe/api_resources/payment_method.py
1
2770
# -*- coding: utf-8 -*- # File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function from stripe import util from stripe.api_resources.abstract import CreateableAPIResource from stripe.api_resources.abstract import ListableAPIResource from stripe.api_resources.abstract import...
mit
09ebd77ffefd2ea09b70115f89ec9f34
31.209302
174
0.610469
4.067548
false
false
false
false
stripe/stripe-python
stripe/api_resources/customer_balance_transaction.py
1
1581
# -*- coding: utf-8 -*- # File generated from our OpenAPI spec from __future__ import absolute_import, division, print_function from stripe import util from stripe.api_resources.abstract import APIResource from stripe.api_resources.customer import Customer from stripe.six.moves.urllib.parse import quote_plus class C...
mit
022b7f3cc363c4d1f03b389a5214b6db
42.916667
133
0.710942
3.923077
false
false
false
false
stripe/stripe-python
tests/api_resources/abstract/test_test_helpers_api_resource.py
1
2351
from __future__ import absolute_import, division, print_function import stripe import pytest from stripe import util from stripe.api_resources.abstract import APIResourceTestHelpers class TestTestHelperAPIResource(object): @stripe.api_resources.abstract.test_helpers class MyTestHelpersResource(stripe.api_res...
mit
6af9455e9ad9165c6be8889d4f7ed385
34.621212
79
0.592088
3.810373
false
true
false
false
okfn/website
foundation/press/cms_menus.py
2
1126
# flake8: noqa from menus.base import NavigationNode from menus.menu_pool import menu_pool from django.utils.translation import ugettext_lazy as _ from cms.menu_bases import CMSAttachMenu from .models import PressRelease, PressMention class PressReleaseMenu(CMSAttachMenu): name = _("Press Releases") def get...
mit
94d59110598b1a3ffb8a4190b5523c17
24.590909
55
0.58881
3.978799
false
false
false
false
stripe/stripe-python
stripe/api_resources/list_object.py
1
4503
from __future__ import absolute_import, division, print_function from stripe import six, util from stripe.stripe_object import StripeObject from stripe.six.moves.urllib.parse import quote_plus class ListObject(StripeObject): OBJECT_NAME = "list" def list( self, api_key=None, stripe_version=None, st...
mit
2963b7c707f31414549d83d9d1844799
27.320755
79
0.522096
4.053105
false
false
false
false
python-provy/provy
provy/more/centos/package/pip.py
1
12688
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Roles in this namespace are meant to provision packages installed via the `PIP <http://www.pip-installer.org/>`_ package manager for CentOS distributions. ''' import xmlrpclib from fabric.api import settings from provy.core import Role from provy.more.centos.package.yum...
mit
90829b62b186dca94ed739314f8c3b7f
38.52648
180
0.574874
4.419366
false
false
false
false
drj11/pypng
code/pngsuite.py
1
36500
#!/usr/bin/env python # pngsuite.py # PngSuite Test PNGs. # https://docs.python.org/3.2/library/argparse.html import argparse import sys """ After you import this module with "import pngsuite" use ``pngsuite.bai0g01`` to get the bytes for a particular PNG image, or use ``pngsuite.png`` to get a dict() of them all. ...
mit
f60d01e049a6a844a5e903ce3d6706ee
53.722639
69
0.952685
1.86739
false
false
false
false
drj11/pypng
code/minpng.py
1
1182
# minpng.py import struct import zlib """ minpng.py MinPNG (minimal PNG) is the antidote to PyPNG. Where PyPNG is several thousand lines and can write and read all PNG formats, MinPNG is two-dozen lines that writes an 8-bit greyscale PNG and does nothing else. """ def rows_to_png(out, rows, size): """Write to ...
mit
614a46638acb7e4fbe116c307ae17cb3
25.266667
69
0.647208
3.118734
false
false
false
false
drj11/pypng
code/prix.py
1
1753
# prix.py """ prix (Python Raster Image eXtensions) A collection of routines useful for raster image processing, mostly not associate with the PNG format, but using datatypes from PyPNG. """ # https://pypi.org/project/pypng/ import png def window(image, tl, br): """image is a png.Image instance (or like one). ...
mit
c953d23198a453ffca8a5f9136e1f887
25.560606
65
0.608671
3.957111
false
false
false
false
psf/black
src/black/mode.py
1
6841
"""Data structures configuring Black behavior. Mostly around Python language feature support per version and Black configuration chosen by the user. """ import sys from dataclasses import dataclass, field from enum import Enum, auto from hashlib import sha256 from operator import attrgetter from typing import Dict, S...
mit
3ced27505a4512925c18f40cedac8441
29.815315
87
0.640257
3.65438
false
false
false
false
psf/black
tests/data/simple_cases/fmtonoff5.py
2
3319
# Regression test for https://github.com/psf/black/issues/3129. setup( entry_points={ # fmt: off "console_scripts": [ "foo-bar" "=foo.bar.:main", # fmt: on ] # Includes an formatted indentation. }, ) # Regression test for https://github.com/psf/blac...
mit
45b87ba650505b8353cec6a048c8b28a
20.006329
64
0.536306
3.446521
false
true
false
false
kaste/mockito-python
mockito/spying.py
1
3115
# Copyright (c) 2008-2016 Szczepan Faber, Serhiy Oplakanets, Herr Kaste # # 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
e7efde0fe2da4ce7c7a397bf7d73affa
30.785714
79
0.673836
4.071895
false
false
false
false
pydata/numexpr
numexpr/__init__.py
1
2262
################################################################### # Numexpr - Fast numerical array expression evaluator for NumPy. # # License: MIT # Author: See AUTHORS.txt # # See LICENSE.txt and LICENSES/*.txt for details about copyright and # rights to use. ##########################################...
mit
138e18922318486fb7c49bc1c2be451a
32.776119
113
0.683908
3.906736
false
true
false
false
kalaspuff/tomodachi
tomodachi/transport/schedule.py
1
28392
import asyncio import datetime import inspect import logging import random import time from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast import pytz import tzlocal from tomodachi.helpers.crontab import get_next_datetime from tomodachi.helpers.execution_context import ( decrease_execution_...
mit
766296b7ced8f7d23be582073fbb7f9c
44.066667
127
0.480417
4.448065
false
false
false
false
kalaspuff/tomodachi
examples/docker_example/http_service/app/service.py
1
1415
import json import tomodachi class Service(tomodachi.Service): name = "example" options = tomodachi.Options( http=tomodachi.Options.HTTP( port=31337, content_type="application/json; charset=utf-8", ), ) _healthy = True @tomodachi.http("GET", r"/") asyn...
mit
8efe7322edef5f6a9a47f3fe457475c5
29.106383
65
0.596466
3.723684
false
false
false
false
kalaspuff/tomodachi
tomodachi/helpers/logging.py
1
3633
import logging from logging.handlers import WatchedFileHandler from typing import Any, Optional, Union class CustomServiceLogHandler(WatchedFileHandler): pass def log_setup( service: Any, name: Optional[str] = None, level: Optional[Union[str, int]] = None, formatter: Optional[Union[logging.Forma...
mit
28595a2e7fe74b31566dab2304b6b396
32.638889
116
0.59455
3.772586
false
false
false
false
wireservice/agate
agate/config.py
3
4037
#!/usr/bin/env python # -*- coding: utf8 -*- """ This module contains the global configuration for agate. Users should use :meth:`get_option` and :meth:`set_option` to modify the global configuration. **Available configuation options:** +-------------------------+------------------------------------------+----------...
mit
8153b0705500b0cbee6d24dd73043dbb
44.784091
112
0.384711
5.603616
false
true
false
false
kalaspuff/tomodachi
examples/basic_examples/amqp_middleware_service.py
1
2061
import os from typing import Any, Callable, Dict import tomodachi from tomodachi import Options, amqp, amqp_publish from tomodachi.discovery import DummyRegistry from tomodachi.envelope import JsonBase async def middleware_function( func: Callable, service: Any, message: Any, routing_key: str, context: Dict, *ar...
mit
ab8fadc630655e52c8ab2b61bfe205f7
35.732143
106
0.704424
3.837687
false
false
false
false
kalaspuff/tomodachi
tomodachi/transport/http.py
1
64366
import asyncio import functools import inspect import ipaddress import logging import os import pathlib import platform import re import time import uuid from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, SupportsInt, Tuple, Union, cast import yarl from aiohttp import WSMsgType from aiohttp imp...
mit
d04d8d067e53354adf4282273ab9086e
43.979734
147
0.510891
4.753767
false
false
false
false
wireservice/agate
tests/test_table/test_print_table.py
3
4657
#!/usr/bin/env python # -*- coding: utf8 -*- import six from babel.numbers import get_decimal_symbol from agate import Table from agate.data_types import Number, Text from agate.testcase import AgateTestCase class TestPrintTable(AgateTestCase): def setUp(self): self.rows = ( ('1.7', 2000, 20...
mit
fb5af9a8c29fc435a8cf73069e90bbe0
33.451852
79
0.57235
3.510189
false
true
false
false
wireservice/agate
agate/table/rename.py
3
2489
#!/usr/bin/env python # pylint: disable=W0212 from agate import utils def rename(self, column_names=None, row_names=None, slug_columns=False, slug_rows=False, **kwargs): """ Create a copy of this table with different column names or row names. By enabling :code:`slug_columns` or :code:`slug_rows` and no...
mit
c682c0d618328d1ee1e9d5d5f80be37c
39.803279
108
0.669345
3.944532
false
false
false
false
wireservice/agate
tests/test_table/test_pivot.py
3
7880
#!/usr/bin/env python # -*- coding: utf8 -*- import sys try: from cdecimal import Decimal except ImportError: # pragma: no cover from decimal import Decimal from agate import Table from agate.aggregations import Sum from agate.computations import Percent from agate.data_types import Number, Text from agate....
mit
f27a2ee6f49814b95b15e7d253cf2bbf
32.389831
110
0.562817
3.565611
false
true
false
false
kalaspuff/tomodachi
tomodachi/envelope/json_base.py
1
2554
import base64 import json import time import uuid import zlib from typing import Any, Dict, Tuple, Union PROTOCOL_VERSION = "tomodachi-json-base--1.0.0" class JsonBase(object): @classmethod async def build_message(cls, service: Any, topic: str, data: Any, **kwargs: Any) -> str: data_encoding = "raw" ...
mit
fa41b3244e58cc52bbe40f527cf90f79
36.014493
117
0.516836
4.060413
false
false
false
false
kalaspuff/tomodachi
examples/basic_examples/websockets/websocket_service.py
1
1893
import os import uuid as uuid_ from typing import Callable, Tuple, Union from aiohttp import web from aiohttp.web_fileresponse import FileResponse import tomodachi from tomodachi import Options, http, http_error, http_static, websocket class ExampleWebsocketService(tomodachi.Service): name = "example-websocket-...
mit
35de95a35ad615f5980cdf6b8b77bc12
32.803571
107
0.632858
4.02766
false
false
false
false
kalaspuff/tomodachi
examples/basic_examples/http_auth_service.py
1
1208
import os import uuid as uuid_ from typing import Any from aiohttp import web import tomodachi from tomodachi import HttpResponse, Options, http @tomodachi.decorator async def require_auth_token(instance: Any, request: web.Request) -> Any: post_body = await request.read() if request.body_exists else None if...
mit
e6bd9884ffe08efa4d5c2517a37b1f70
28.463415
98
0.662252
3.660606
false
false
false
false
wireservice/agate
agate/table/to_csv.py
4
1109
#!/usr/bin/env python # pylint: disable=W0212 import os def to_csv(self, path, **kwargs): """ Write this table to a CSV. This method uses agate's builtin CSV writer, which supports unicode on both Python 2 and Python 3. `kwargs` will be passed through to the CSV writer. :param path: Fil...
mit
9befada3799ec9f57da4e3507bd4b002
23.108696
78
0.569883
3.83737
false
false
false
false
wireservice/agate
agate/aggregations/summary.py
4
1052
#!/usr/bin/env python from agate.aggregations.base import Aggregation class Summary(Aggregation): """ Apply an arbitrary function to a column. :param column_name: The name of a column to be summarized. :param data_type: The return type of this aggregation. :param func: A ...
mit
460bd481cf69ebc88450bd82e4827cf3
28.222222
77
0.624525
3.984848
false
false
false
false
wireservice/agate
agate/table/group_by.py
3
2067
#!/usr/bin/env python # pylint: disable=W0212 from collections import OrderedDict from agate.data_types import Text from agate.tableset import TableSet def group_by(self, key, key_name=None, key_type=None): """ Create a :class:`.TableSet` with a table for each unique key. Note that group names will alw...
mit
3a701ea2f3d8c449c3ce50495283c41b
30.318182
89
0.63135
3.813653
false
false
false
false
wireservice/agate
agate/data_types/number.py
3
3479
#!/usr/bin/env python # -*- coding: utf8 -*- try: from cdecimal import Decimal, InvalidOperation except ImportError: # pragma: no cover from decimal import Decimal, InvalidOperation import warnings import six from babel.core import Locale from agate.data_types.base import DataType from agate.exceptions imp...
mit
92176598103cf0424d4dcc4af106e0fa
29.245614
117
0.576276
3.818383
false
false
false
false
cyanfish/heltour
heltour/local/ben_vbox_ubuntu.py
1
1064
from datetime import timedelta DEBUG = True GOOGLE_SERVICE_ACCOUNT_KEYFILE_PATH = '/home/ben/gspread-creds.json' SLACK_API_TOKEN_FILE_PATH = '/home/ben/slack-token' SLACK_WEBHOOK_FILE_PATH = '/home/ben/slack-webhook' FCM_API_KEY_FILE_PATH = '/home/ben/fcm-key' LICHESS_DOMAIN = 'https://listage.ovh/' JAVAFO_COMMAND = '...
mit
fc6a4735a6ecda5634132de8b723047f
31.242424
69
0.637218
2.931129
false
false
true
false
cyanfish/heltour
heltour/tournament/migrations/0080_auto_20160824_2233.py
1
1531
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-24 22:33 import django.core.validators from django.db import migrations, models import heltour.tournament.models class Migration(migrations.Migration): dependencies = [ ('tournament', '0079_loneplayerscore_perf_rating'), ] operatio...
mit
ff72e7368ed75ae8e8d15e4840783a80
29.019608
116
0.570869
4.349432
false
false
false
false
cyanfish/heltour
heltour/tournament/migrations/0189_auto_20210221_0424.py
1
2032
# Generated by Django 2.2.13 on 2021-02-21 04:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tournament', '0188_auto_20191223_1457'), ] operations = [ migrations.AlterField( model_name='alternate', name='boar...
mit
fb1f2285986df8bc3879a1fca0aa5abf
46.255814
182
0.448327
2.97511
false
false
false
false
cyanfish/heltour
heltour/api_worker/views.py
1
3605
import logging import requests import time from . import worker from django.core.cache import cache from django.http.response import HttpResponse, JsonResponse from django.utils.crypto import get_random_string from django.views.decorators.csrf import csrf_exempt from django.conf import settings logger = logging.getLog...
mit
d9022d8e908abb5f3e3eb0c5f6bec654
32.073394
99
0.610818
3.5
false
false
false
false
cyanfish/heltour
heltour/tournament/migrations/0157_playerpresence.py
1
1322
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2017-07-30 00:28 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('tournament', '0156_modrequest'), ] operations = [ migrations.CreateModel( ...
mit
bf3640e263f0f0ee3988c20ef0390130
39.060606
123
0.593041
4.13125
false
false
false
false
cyanfish/heltour
heltour/tournament/simulation.py
1
2407
import random import math from heltour.tournament.models import * from heltour.tournament import pairinggen sysrand = random.SystemRandom() def simulate_round(round_): forfeit_chance = 0.10 forfeit_results = ['1X-0F', '1/2Z-1/2Z', '0F-1X', '0F-0F'] def result_chances(rating_delta): rating_delta_...
mit
0515c5d6ced8275e27dec93dcc807400
32.901408
89
0.57499
3.32
false
false
false
false
cyanfish/heltour
heltour/tournament/migrations/0061_auto_20160813_2319.py
1
1046
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-13 23:19 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('tournament', '0060_auto_20160813_2319'), ] operations = [ migrations.RemoveField( model_name='loneplayerpairing...
mit
7cccc7ecf762d44b192c7956c3db2cef
24.512195
50
0.549713
4.150794
false
false
false
false
nanograv/enterprise
tests/test_white_signals.py
2
19022
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_white_signals ---------------------------------- Tests for white signal modules. """ import unittest import numpy as np import scipy.linalg as sl from enterprise.pulsar import Pulsar from enterprise.signals import gp_signals, parameter, selections, utils, whi...
mit
6d16f4844e2fe560659ce112b4f7c35a
36.592885
118
0.569288
2.874717
false
true
false
false
nanograv/enterprise
enterprise/signals/selections.py
2
3956
# selections.py """Contains various selection functions to mask parameters by backend flags, time-intervals, etc.""" import functools import inspect import numpy as np def call_me_maybe(obj): """See `here`_ for description. .. _here: https://www.youtube.com/watch?v=fWNaR-rxAic """ return obj() if ...
mit
2c046cb6462f7e15daff8c4880ff1ab6
28.522388
100
0.588473
3.70412
false
false
false
false
pytest-dev/pytest-bdd
tests/feature/test_alias.py
1
1585
"""Test step alias when decorated multiple times.""" import textwrap def test_step_alias(pytester): pytester.makefile( ".feature", alias=textwrap.dedent( """\ Feature: Step aliases Scenario: Multiple step aliases Given I have an empty li...
mit
2e8808706ea7ef580cc08ee77977a885
25.416667
71
0.490852
4.342466
false
true
false
false
neuropoly/spinalcordtoolbox
testing/cli/test_cli.py
1
1746
import pytest import pkg_resources import importlib scripts = pkg_resources.get_entry_map('spinalcordtoolbox')['console_scripts'].keys() scripts_where_no_args_is_valid = [ 'isct_test_ants', # No args -> tests ants binaries 'sct_check_dependencies', # No args -> checks dependencies 'sct_version' ...
mit
c36eb6a92f4177aadcb58b7c2215da24
39.604651
99
0.709622
3.457426
false
true
false
false
neuropoly/spinalcordtoolbox
spinalcordtoolbox/deepseg_sc/cnn_models_3d.py
1
3867
"""Model. Created: 2018-05 Last changes: 2018-05-23 Contributors: charley """ import numpy as np import tensorflow as tf from keras import backend as K from keras.engine import Input, Model from keras.layers import Conv3D, MaxPooling3D, UpSampling3D, Activation, BatchNormalization from keras.optimizers import Adam f...
mit
c71657bca887f58a02eb88e07f102656
41.494505
113
0.650634
3.641243
false
false
false
false
neuropoly/spinalcordtoolbox
spinalcordtoolbox/aggregate_slicewise.py
1
25919
#!/usr/bin/env python # -*- coding: utf-8 # Functions dealing with metrics aggregation (mean, std, etc.) across slices and/or vertebral levels # TODO: when mask is empty, raise specific message instead of throwing "Weight sum to zero..." import os import numpy as np import math import operator import functools import...
mit
ce8aa869cf7d5a6452ef48dea840eec5
45.119217
133
0.611096
3.590884
false
false
false
false
neuropoly/spinalcordtoolbox
testing/api/test_deepseg_sc.py
1
3912
#!/usr/bin/env python # -*- coding: utf-8 # pytest unit tests for spinalcordtoolbox.deepseg_sc import pytest import numpy as np import nibabel as nib from keras import backend as K import spinalcordtoolbox as sct from spinalcordtoolbox.image import Image import spinalcordtoolbox.deepseg_sc.core from spinalcordtoolbox...
mit
0b5ed790574027d0fc0751a4b17a2536
38.12
113
0.643916
2.737579
false
true
false
false
darknessomi/musicbox
NEMbox/player.py
1
19114
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: omi # @Date: 2014-07-15 15:48:27 # @Last Modified by: AlanAlbert # @Last Modified time: 2018-11-21 14:00:00 """ 网易云音乐 Player """ # Let's make some noise import os import random import subprocess import threading import time from . import logger from .api imp...
mit
a4149507d41f75797ee7b4f95d3b0479
30.643927
91
0.52587
3.856824
false
false
false
false
darknessomi/musicbox
NEMbox/const.py
1
1349
# encoding: UTF-8 # KenHuang: 使配置文件夹符合XDG标准 import os class Constant(object): if "XDG_CONFIG_HOME" in os.environ: conf_dir = os.path.join(os.environ["XDG_CONFIG_HOME"], "netease-musicbox") else: conf_dir = os.path.join(os.path.expanduser("~"), ".netease-musicbox") config_path = os.path.joi...
mit
5f028c946f762b78b800b5f57c7e95c2
41.870968
82
0.62453
2.876623
false
true
false
false
bethgelab/foolbox
foolbox/attacks/carlini_wagner.py
1
8195
from typing import Union, Tuple, Any, Optional from functools import partial import numpy as np import eagerpy as ep from ..devutils import flatten from ..devutils import atleast_kd from ..types import Bounds from ..models import Model from ..distances import l2 from ..criteria import Misclassification from ..crit...
mit
e74812413b9c40075c72a9ff2932a35a
35.748879
90
0.589262
3.719927
false
false
false
false
bethgelab/foolbox
foolbox/attacks/contrast_min.py
1
4045
from typing import Union, Any, Optional import eagerpy as ep from ..devutils import atleast_kd from ..models import Model from ..criteria import Criterion from ..distances import Distance from .base import FlexibleDistanceMinimizationAttack from .base import T from .base import get_is_adversarial from .base import...
mit
062ab19dbcbfad8cf55ef7af5af39001
28.742647
88
0.596292
3.816038
false
false
false
false
bethgelab/foolbox
tests/test_gen_attack_utils.py
1
1233
import eagerpy as ep import numpy as np import pytest from typing import Any from foolbox.attacks.gen_attack_utils import rescale_images def test_rescale_axis(request: Any, dummy: ep.Tensor) -> None: backend = request.config.option.backend if backend == "numpy": pytest.skip() x_np = np.random.un...
mit
25ec81306ad391d187ca65d7ee96878e
28.357143
67
0.605028
2.461078
false
true
false
false
bethgelab/foolbox
foolbox/models/base.py
1
6321
from typing import TypeVar, Callable, Optional, Tuple, Any from abc import ABC, abstractmethod import copy import eagerpy as ep from ..types import Bounds, BoundsInput, Preprocessing from ..devutils import atleast_kd T = TypeVar("T") PreprocessArgs = Tuple[Optional[ep.Tensor], Optional[ep.Tensor], Optional[int]] c...
mit
ee2407bad57ea145f3b3b2cbad1df938
30.137931
100
0.5651
4.175033
false
false
false
false
bethgelab/foolbox
foolbox/distances.py
1
2412
from abc import ABC, abstractmethod from typing import TypeVar import eagerpy as ep from .devutils import flatten from .devutils import atleast_kd T = TypeVar("T") class Distance(ABC): @abstractmethod def __call__(self, reference: T, perturbed: T) -> T: ... @abstractmethod def clip_perturb...
mit
1c1c8429df450bb0f35b47568d14943f
30.324675
83
0.606136
3.573333
false
false
false
false
bethgelab/foolbox
examples/multiple_attacks_pytorch_resnet18.py
1
2313
#!/usr/bin/env python3 import torchvision.models as models import eagerpy as ep from foolbox import PyTorchModel, accuracy, samples import foolbox.attacks as fa import numpy as np if __name__ == "__main__": # instantiate a model (could also be a TensorFlow or JAX model) model = models.resnet18(pretrained=True...
mit
5c3b3e0ec5c1849994597acfd332db14
30.657534
88
0.603635
3.349275
false
false
false
false
bethgelab/foolbox
foolbox/attacks/gradient_descent_base.py
1
8297
from typing import Union, Any, Optional, Callable, Tuple from abc import ABC, abstractmethod import eagerpy as ep from ..devutils import flatten from ..devutils import atleast_kd from ..types import Bounds from ..models.base import Model from ..criteria import Misclassification, TargetedMisclassification from ..di...
mit
0ca5b821b31fd4aac2596873731d9427
29.170909
87
0.601181
3.338833
false
false
false
false
bethgelab/foolbox
tests/test_brendel_bethge_attack.py
1
1834
from typing import Tuple, Union, List, Any import eagerpy as ep import foolbox as fbn import foolbox.attacks as fa from foolbox.devutils import flatten from foolbox.attacks.brendel_bethge import BrendelBethgeAttack import pytest from conftest import ModeAndDataAndDescription def get_attack_id(x: Tuple[BrendelBethge...
mit
5f192d5309ebf13c016066db2944debf
30.084746
81
0.692475
2.778788
false
true
false
false
bethgelab/foolbox
foolbox/attacks/sparse_l1_descent_attack.py
1
3358
from typing import Optional import eagerpy as ep import numpy as np from ..devutils import flatten from ..devutils import atleast_kd from ..types import Bounds from .gradient_descent_base import L1BaseGradientDescent from .gradient_descent_base import normalize_lp_norms class SparseL1DescentAttack(L1BaseGradientDe...
mit
2b87e0569324d009547be808da50b0bf
36.719101
126
0.605302
3.526261
false
false
false
false
bethgelab/foolbox
foolbox/attacks/blended_noise.py
1
3238
from typing import Union, Optional, Any import numpy as np import eagerpy as ep from ..devutils import atleast_kd from ..distances import Distance from .base import FlexibleDistanceMinimizationAttack from .base import Model from .base import Criterion from .base import T from .base import get_is_adversarial from .ba...
mit
d02b58d9437c3ea4fa8d5edb99269ab1
28.436364
88
0.579679
3.968137
false
false
false
false
bethgelab/foolbox
foolbox/external/clipping_aware_rescaling.py
1
2461
# Copyright (c) 2020, Jonas Rauber # # Licensed under the BSD 3-Clause License # # Last changed: # * 2020-07-15 # * 2020-01-08 # * 2019-04-18 import eagerpy as ep def l2_clipping_aware_rescaling(x, delta, eps: float, a: float = 0.0, b: float = 1.0): # type: ignore """Calculates eta such that norm(clip(x + eta *...
mit
d7bd171f1beb94bbf1398f7ea05bf457
37.453125
102
0.595693
3.00122
false
false
false
false
bethgelab/foolbox
foolbox/attacks/binarization.py
1
3895
from typing import Union, Optional, Any from typing_extensions import Literal import eagerpy as ep import numpy as np from ..models import Model from ..criteria import Criterion from ..distances import Distance from .base import FlexibleDistanceMinimizationAttack from .base import T from .base import get_is_adversa...
mit
acca6d45e7ea9560c43bbdd1f0b3c4b4
31.190083
92
0.601797
3.918511
false
false
false
false
egnyte/gitlabform
gitlabform/ui.py
1
6334
import sys from typing import Any import luddite import pkg_resources from cli_ui import ( message, info, info_1, error, fatal, reset, green, purple, blue, red, yellow, Symbol, Token, ) from cli_ui import debug as verbose from packaging import version as packaging_v...
mit
eab37b3bf584c029580c1411e19f73e0
27.727273
107
0.544146
3.930348
false
false
false
false
python-cmd2/cmd2
cmd2/argparse_custom.py
1
58853
# coding=utf-8 """ This module adds capabilities to argparse by patching a few of its functions. It also defines a parser class called Cmd2ArgumentParser which improves error and help output over normal argparse. All cmd2 code uses this parser and it is recommended that developers of cmd2-based apps either use it or wr...
mit
bdfb6c01da9a58f5c5d1882379c0d621
39.421016
127
0.62233
4.409125
false
false
false
false
python-cmd2/cmd2
examples/pirate.py
1
3293
#!/usr/bin/env python # coding=utf-8 """ This example is adapted from the pirate8.py example created by Catherine Devlin and presented as part of her PyCon 2010 talk. It demonstrates many features of cmd2. """ import cmd2 from cmd2 import ( Fg, ) from cmd2.constants import ( MULTILINE_TERMINATOR, ) color_cho...
mit
a644a03425651b187ff185fd49063116
31.284314
117
0.604009
3.469968
false
false
false
false
python-cmd2/cmd2
tests_isolated/test_commandset/test_categories.py
1
4417
#!/usr/bin/env python3 # coding=utf-8 """ Simple example demonstrating basic CommandSet usage. """ from typing import ( Any, ) import cmd2 from cmd2 import ( CommandSet, with_default_category, ) @with_default_category('Default Category') class MyBaseCommandSet(CommandSet): """Defines a default catego...
mit
76c134ae4a148dd9654c0d3abb9d002e
35.204918
125
0.725832
3.671654
false
false
false
false
python-cmd2/cmd2
cmd2/clipboard.py
1
1251
# coding=utf-8 """ This module provides basic ability to copy from and paste to the clipboard/pastebuffer. """ from typing import ( cast, ) import pyperclip # type: ignore[import] # noinspection PyProtectedMember # Can we access the clipboard? Should always be true on Windows and Mac, but only sometimes on Lin...
mit
ecaa92bc118c596bb75cc7ed9666f55a
27.431818
101
0.719424
3.779456
false
false
false
false
python-cmd2/cmd2
examples/default_categories.py
1
2474
#!/usr/bin/env python3 # coding=utf-8 """ Simple example demonstrating basic CommandSet usage. """ import cmd2 from cmd2 import ( CommandSet, with_default_category, ) @with_default_category('Default Category') class MyBaseCommandSet(CommandSet): """Defines a default category for all sub-class CommandSets...
mit
c0a5b7af7032cd0ed94dab1eb9875c10
26.797753
119
0.704123
3.902208
false
false
false
false
python-cmd2/cmd2
plugins/template/tests/test_myplugin.py
1
1894
# # coding=utf-8 import cmd2_myplugin from cmd2 import ( cmd2, ) ###### # # define a class which uses our plugin and some convenience functions # ###### class MyApp(cmd2_myplugin.MyPluginMixin, cmd2.Cmd): """Simple subclass of cmd2.Cmd with our SayMixin plugin included.""" def __init__(self, *args, **...
mit
49504b48f5a5ef9de5fd00c4d8669ef6
24.945205
92
0.693242
3.780439
false
false
false
false
python-cmd2/cmd2
examples/hooks.py
1
4507
#!/usr/bin/env python # coding=utf-8 """ A sample application for cmd2 demonstrating how to use hooks. This application shows how to use postparsing hooks to allow case insensitive command names, abbreviated commands, as well as allowing numeric arguments to follow a command without any intervening whitespace. """ i...
mit
b33e2e34014ce01f10a4fcff598ac256
35.056
110
0.636787
4.031306
false
false
false
false
python-cmd2/cmd2
examples/migrating.py
1
1221
#!/usr/bin/env python # coding=utf-8 """ A sample application for cmd which can be used to show how to migrate to cmd2. """ import cmd import random class CmdLineApp(cmd.Cmd): """Example cmd application.""" MUMBLES = ['like', '...', 'um', 'er', 'hmmm', 'ahh'] MUMBLE_FIRST = ['so', 'like', 'well'] MUM...
mit
921122c8f0ca5429b5ae5227635fda9b
23.918367
78
0.556102
3.317935
false
false
false
false
python-cmd2/cmd2
cmd2/history.py
1
14524
# coding=utf-8 """ History management classes """ import json import re from collections import ( OrderedDict, ) from typing import ( Any, Callable, Dict, Iterable, List, Optional, Union, overload, ) import attr from . import ( utils, ) from .parsing import ( Statement, ) ...
mit
d44196885b3a1a598e3ef8c34271442c
39.011019
121
0.600661
4.374699
false
false
false
false
python-cmd2/cmd2
tests/conftest.py
1
7300
# coding=utf-8 """ Cmd2 unit/functional testing """ import sys from contextlib import ( redirect_stderr, redirect_stdout, ) from typing import ( List, Optional, Union, ) from unittest import ( mock, ) from pytest import ( fixture, ) import cmd2 from cmd2.rl_utils import ( readline, ) f...
mit
0a6317a63e32a32758306bb67eb1d3c0
37.020833
122
0.548082
4.617331
false
false
false
false
python-cmd2/cmd2
examples/modular_commands/commandset_complex.py
1
1795
# coding=utf-8 # flake8: noqa E302 """ Test CommandSet """ import argparse from typing import ( List, ) import cmd2 @cmd2.with_default_category('Fruits') class CommandSetA(cmd2.CommandSet): def do_apple(self, statement: cmd2.Statement): self._cmd.poutput('Apple!') def do_banana(self, statement:...
mit
84a991b05ef714bab2ae84a5fcfc9354
32.867925
103
0.641226
3.06314
false
false
false
false
python-cmd2/cmd2
examples/table_creation.py
1
11090
#!/usr/bin/env python # coding=utf-8 """Examples of using the cmd2 table creation API""" import functools import sys from typing import ( Any, List, ) from cmd2 import ( EightBitBg, EightBitFg, Fg, ansi, ) from cmd2.table_creator import ( AlternatingTable, BorderedTable, Column, ...
mit
5c609dc83ced15a6955a7cd636742fd1
38.607143
124
0.668801
3.42919
false
false
false
false
pydoit/doit
doit/action.py
1
19895
"""Implements actions used by doit tasks """ import os import sys import subprocess import io from io import StringIO import inspect from pathlib import PurePath from threading import Thread import pdb from .exceptions import InvalidTask, TaskFailed, TaskError def normalize_callable(ref): """return a list with ...
mit
d8a94923119cc4437033a552839886cd
34.782374
79
0.55813
4.399602
false
false
false
false
pydoit/doit
doit/exceptions.py
1
3303
"""Handle exceptions generated from 'user' code""" import sys import traceback class InvalidCommand(Exception): """Invalid command line argument.""" def __init__(self, *args, **kwargs): self.not_found = kwargs.pop('not_found', None) super(InvalidCommand, self).__init__(*args, **kwargs) ...
mit
d1d8824272064c9d70e5aacb521dd759
29.027273
90
0.61096
4.077778
false
false
false
false
pydoit/doit
tests/test_cmd_clean.py
1
6519
from io import StringIO from unittest import mock import pytest from doit.exceptions import InvalidCommand from doit.task import Task from doit.cmd_clean import Clean from .conftest import CmdFactory class TestCmdClean(object): @pytest.fixture def tasks(self, request): self.cleaned = [] def ...
mit
a83f071c60c36880de18fe026b85de80
42.751678
78
0.56435
3.796738
false
true
false
false
grow/grow
grow/translators/google_sheets_test.py
1
19110
"""Tests for Google Sheets translations.""" import unittest import mock from nose.plugins import skip from googleapiclient import errors from grow.preprocessors import google_drive from grow.common import oauth from grow.pods import pods from grow import storage from grow.testing import google_service from grow.testin...
mit
c57396c378938a18f3e74ba4a5b37dc9
34.388889
99
0.425955
4.746647
false
false
false
false
grow/grow
grow/performance/profile_report.py
1
3158
"""Profiling report for analyizing the performance of the app""" class ProfileReport: """Analyzes the timers to report on the app timing.""" def __init__(self, profile): self.profile = profile self.items = {} for timer in self.profile: if timer.key not in self.items: ...
mit
5cba4da7b97aec1d0322c6557aa6e9ca
29.660194
98
0.559848
4.256065
false
false
false
false
grow/grow
grow/sdk/installers/gerrit_installer.py
1
1751
"""Gerrit installer class.""" import subprocess import urllib.parse from grow.common import utils from grow.sdk.installers import base_installer KNOWN_GERRIT_HOSTS = ( 'googlesource.com', ) class GerritInstaller(base_installer.BaseInstaller): """Gerrit installer.""" KIND = 'gerrit' @property d...
mit
8ba281d78399aaf617a0e30a04a5891a
31.425926
81
0.587664
4.062645
false
false
false
false
grow/grow
grow/sdk/installers/base_installer.py
1
1558
"""Base installer class.""" from grow.sdk import sdk_utils class Error(Exception): """Base error for installers.""" def __init__(self, message): super(Error, self).__init__(message) self.message = message class MissingPrerequisiteError(Error): """Installer is missing a prerequisite."""...
mit
231a2c9a30b6c0a8a0613dd96db51eca
24.540984
73
0.630937
4.50289
false
false
false
false