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
theonion/django-bulbs
tests/contributions/test_contributions_utils.py
1
5195
from django.contrib.auth import get_user_model from bulbs.content.models import Content, FeatureType from bulbs.contributions.models import ( Contribution, ContributorRole, FeatureTypeRate, FeatureTypeOverride, FlatRate, FlatRateOverride, HourlyRate, HourlyOverride, OverrideProfile ) from bulbs.contributions.u...
mit
ee3ce10ff2b4189ac9ec58cc325aa016
44.570175
98
0.676035
3.632867
false
true
false
false
theonion/django-bulbs
bulbs/campaigns/migrations/0001_initial.py
2
1592
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import djbetty.fields class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Campaign', fields=[ ('id'...
mit
f41c5590a06cb2748bed1482e879394f
36.904762
114
0.546482
4.326087
false
false
false
false
theonion/django-bulbs
bulbs/api/metadata.py
1
1057
from rest_framework.metadata import SimpleMetadata from bulbs.infographics.metadata import InfographicMetadata from bulbs.infographics.utils import get_infographics_serializer from bulbs.super_features.metadata import BaseSuperFeatureMetadata from bulbs.super_features.utils import get_superfeature_serializer SUPERFE...
mit
064afc30acff58513402c82671703bd8
38.148148
74
0.742668
4.177866
false
false
false
false
wireservice/csvkit
csvkit/convert/fixed.py
1
5779
#!/usr/bin/env python from codecs import iterdecode from collections import namedtuple import agate import six def fixed2csv(f, schema, output=None, skip_lines=0, **kwargs): """ Convert a fixed-width file to csv using a CSV-formatted schema description. A schema CSV must start with a header row with (a...
mit
d9c147543074adf14f1af00d51f0cdab
30.752747
92
0.623983
4.199855
false
false
false
false
cole/aiosmtplib
tests/test_sendmail.py
1
19384
""" SMTP.sendmail and SMTP.send_message method testing. """ import asyncio import copy import email.generator import email.header import email.message from typing import Any, Callable, Coroutine, List, Tuple, Type import pytest from aiosmtpd.smtp import SMTP as SMTPD from aiosmtplib import ( SMTP, SMTPNotSupp...
mit
ed9261dc18d7cd7050148fbc567a122a
29.626582
87
0.659692
3.571877
false
true
false
false
theislab/scib
tests/metrics/test_all.py
1
1171
import scanpy as sc import scib from tests.common import LOGGER def test_fast(adata_neighbors): metrics_df = scib.me.metrics_fast( adata_neighbors, adata_neighbors, batch_key="batch", label_key="celltype", embed="X_pca", ) for score in metrics_df: LOGGER.i...
mit
6b91dd19d645de3bc32ed3d5962dd865
20.685185
39
0.566183
2.891358
false
true
false
false
agronholm/apscheduler
src/apscheduler/triggers/combining.py
1
5734
from __future__ import annotations from abc import abstractmethod from datetime import datetime, timedelta from typing import Any import attrs from .._exceptions import MaxIterationsReached from .._validators import as_timedelta, require_state_version from ..abc import Trigger from ..marshalling import marshal_objec...
mit
b0fae89c69fe784be8618027f6b37668
37.226667
88
0.62766
4.225497
false
false
false
false
agronholm/apscheduler
examples/web/wsgi_noframework.py
1
1413
""" Example demonstrating use with WSGI (raw WSGI application, no framework). Requires the "postgresql" and "redis" services to be running. To install prerequisites: pip install sqlalchemy psycopg2 uwsgi To run: uwsgi -T --http :8000 --wsgi-file wsgi_noframework.py It should print a line on the console on a one-secon...
mit
eb493b295c1041aeb94a159c52831713
31.860465
80
0.7615
3.881868
false
false
false
false
agronholm/apscheduler
src/apscheduler/_validators.py
1
5069
from __future__ import annotations import sys from datetime import date, datetime, timedelta, timezone, tzinfo from typing import Any from attrs import Attribute from tzlocal import get_localzone from ._exceptions import DeserializationError from .abc import Trigger if sys.version_info >= (3, 9): from zoneinfo ...
mit
a90ed389bf2a06c4c4cff034ddc0e10c
27.161111
88
0.618465
4.151515
false
false
false
false
lmjohns3/theanets
test/util.py
1
2671
'''Helper code for theanets unit tests.''' import numpy as np np.random.seed(13) NUM_EXAMPLES = 64 NUM_INPUTS = 7 NUM_HID1 = 8 NUM_HID2 = 12 NUM_OUTPUTS = 5 NUM_CLASSES = 6 INPUTS = np.random.randn(NUM_EXAMPLES, NUM_INPUTS).astype('f') INPUT_WEIGHTS = abs(np.random.randn(NUM_EXAMPLES, NUM_INPUTS)).astype('f') OUTPU...
mit
cbfb54dfac6a8eef6d67420ac4d6c02d
30.05814
79
0.673156
2.835456
false
true
false
false
uccser/cs-unplugged
csunplugged/tests/topics/TopicsTestDataGenerator.py
1
12032
"""Create test data for topic tests.""" import os.path import yaml from topics.models import ( Topic, Lesson, LessonNumber, AgeGroup, CurriculumIntegration, CurriculumArea, ProgrammingChallenge, ProgrammingChallengeDifficulty, ProgrammingChallengeLanguage, ProgrammingChallengeI...
mit
417acf73f3859f14b6ae6374f92445ed
31.085333
93
0.53499
4.957561
false
true
false
false
uccser/cs-unplugged
csunplugged/topics/management/commands/_LessonsLoader.py
1
10682
"""Custom loader for loading lessons.""" from django.core.exceptions import ObjectDoesNotExist from utils.TranslatableModelLoader import TranslatableModelLoader from utils.convert_heading_tree_to_dict import convert_heading_tree_to_dict from utils.errors.MissingRequiredFieldError import MissingRequiredFieldError from ...
mit
6827c93deccadccd97f38a5a5090390b
45.043103
109
0.521251
5.5956
false
false
false
false
uccser/cs-unplugged
csunplugged/resources/utils/BaseResourceGenerator.py
1
9233
"""Class for generator for a resource.""" import os.path from abc import ABC, abstractmethod from resources.utils.resize_encode_resource_images import resize_encode_resource_images from utils.errors.ThumbnailPageNotFoundError import ThumbnailPageNotFoundError from utils.errors.MoreThanOneThumbnailPageFoundError import...
mit
b9c56ece8b66bca7669eee27dcf6fd89
34.106464
113
0.601213
4.63504
false
false
false
false
uccser/cs-unplugged
csunplugged/general/views.py
1
1414
"""Views for the general application.""" from django.views.generic import TemplateView class GeneralIndexView(TemplateView): """View for the homepage that renders from a template.""" template_name = "general/index.html" class GeneralAboutView(TemplateView): """View for the about page that renders from...
mit
088a9ce54c68cc277cf01e70c3eea59b
26.72549
88
0.732673
3.811321
false
false
false
false
uccser/cs-unplugged
csunplugged/resources/generators/LeftRightCardsResourceGenerator.py
1
2209
"""Class for Left and Right Cards resource generator.""" from PIL import Image, ImageDraw from math import pi from utils.TextBoxDrawer import TextBoxDrawer, TextBox from django.utils.translation import ugettext_lazy as _ from resources.utils.BaseResourceGenerator import BaseResourceGenerator from resources.utils.coord...
mit
019f01aa20275d9b80919c2d6ab0c4a9
31.970149
81
0.53101
3.923623
false
false
false
false
uccser/cs-unplugged
csunplugged/tests/resources/generators/test_searching_cards.py
1
11613
from django.http import QueryDict from django.test import tag from resources.generators.SearchingCardsResourceGenerator import SearchingCardsResourceGenerator from tests.resources.generators.utils import BaseGeneratorTest @tag("resource") class SearchingCardsResourceGeneratorTest(BaseGeneratorTest): def __init__...
mit
05eeb86fa8e971f3af5d7e47b82b33e8
40.327402
106
0.6429
3.780273
false
true
false
false
uccser/cs-unplugged
csunplugged/tests/utils/translatable_model_loader/test_TranslatableModelLoader.py
1
12476
"""Test class for TranslatableModelLoader.""" import imp from unittest import mock from modeltranslation import settings as mt_settings from modeltranslation.translator import translator, TranslationOptions from django.db import models from django.test import SimpleTestCase from django.utils import translation from...
mit
d4258c7bebac97952b9699f3e1bb557e
46.984615
114
0.689243
4.091833
false
true
false
false
uccser/cs-unplugged
csunplugged/topics/migrations/0016_auto_20170226_2234.py
1
1187
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-26 22:34 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('resources', '0004_auto_20170226_0758'), ('topics', ...
mit
be3e25eb7a5e068326f8470cdef9a39a
37.290323
154
0.625948
4.179577
false
false
false
false
jewettaij/moltemplate
examples/coarse_grained/DNA_models/dsDNA_only/2strands/3bp_2particles/simple_dna_example/measure_persistence_length/merge_lines_periodic.py
4
10846
#!/usr/bin/env python import sys, math g_filename = __file__.split('/')[-1] g_module_name = g_filename g_program_name = g_filename if g_filename.rfind('.py') != -1: g_module_name = g_filename[:g_filename.rfind('.py')] g_date_str = '2020-1-19' g_version_str = '0.3.0' usage_example = g_program_name + """...
mit
17984489aa310e279f151bb4937e6154
32.68323
104
0.51466
3.810963
false
false
false
false
jewettaij/moltemplate
moltemplate/nbody_Angles.py
2
2608
# Author: Andrew Jewett (jewett.aij at g mail) # License: MIT License (See LICENSE.md) # Copyright (c) 2013 try: from .nbody_graph_search import Ugraph except (ImportError, SystemError, ValueError): # not installed as a package from nbody_graph_search import Ugraph # This file defines how 3-body angle ...
mit
62f62324ba0944200cce28c6d3a87007
41.064516
79
0.684433
3.647552
false
false
false
false
jewettaij/moltemplate
moltemplate/depreciated/oplsaa_moltemplate.py
2
17508
#! /usr/bin/env python # # Author: Jason Lambert # (some additional corrections by Miguel Gonzalez, Yue Chun Chiu and others) # License: MIT License (See LICENSE.md) # Copyright (c) 2014 # # The purpose of this script is to create a moltemplate lt file for the oplsaa. # forcefield. This will assist researchers in bu...
mit
a503bc436c2a96b171619bc36fa738d1
34.513185
120
0.563914
2.982115
false
false
false
false
jewettaij/moltemplate
moltemplate/nbody_alt_symmetry/cenJsortIKL.py
13
1732
try: from ..nbody_graph_search import Ugraph except: # not installed as a module from nbody_graph_search import Ugraph # To find 4-body "improper" interactions, we would use this subgraph: # 3 # * 1st bond connects atoms 1 and 0 # | => 2nd bon...
mit
870b6f4854561e2fa8ff615e9785bd29
38.363636
75
0.624134
3.491935
false
false
false
false
jewettaij/moltemplate
examples/coarse_grained/protein_folding_examples/1bead+chaperone/unfrustrated+chaperonin/moltemplate_files/generate_tables/calc_chaperone_table.py
39
3038
#!/usr/bin/env python # Calculate a table of pairwise energies and forces between atoms in the # protein and a chaperone provided in the supplemental materials section of: # AI Jewett, A Baumketner and J-E Shea, PNAS, 101 (36), 13192-13197, (2004) # This is stored in a tabulated force field with a singularity at a dis...
mit
99876f3d212891a83ffdcb3252a37b0f
33.91954
83
0.575379
2.548658
false
false
false
false
jewettaij/moltemplate
examples/coarse_grained/membrane_examples/membrane_Cooke_Kremer_DesernoPRE2005/moltemplate_files/calc_table/gen_potential-cooke.py
37
4383
#!/usr/bin/python2.7 import os,sys from fractions import Fraction from numpy import * ### PARAMETERS ### sigma = 1.00 epsilon = 1.00 b_hh = 0.95 * sigma b_ht = 0.95 * sigma b_tt = 1.00 * sigma r_init = 0.000001 r_max = sigma * 3. r_space = 0.01 ################## ### INPUTS ### if len(sys.argv) == 2: w_cut = flo...
mit
53e24897adbb5291e0f71b70d935eccb
29.4375
116
0.585672
2.300787
false
false
false
false
jewettaij/moltemplate
moltemplate/ttree_lex.py
1
90925
# -*- coding: iso-8859-1 -*- ### -*- coding: utf-8 -*- # Authors: Eric S. Raymond, 21 Dec 1998 # Andrew Jewett (jewett.aij at g mail) # LICENSE: The PSF license: # https://docs.python.org/3/license.html # The PSF license is compatible with the GPL license. It is not a copyleft # license. It is apparently si...
mit
365f052b6db5d1cd56933917cddb880e
39.285778
192
0.521815
4.319477
false
false
false
false
gawel/irc3
irc3/plugins/userlist.py
1
6805
# -*- coding: utf-8 -*- from irc3 import plugin from irc3 import utils from irc3 import rfc from irc3.dec import event from irc3.utils import IrcString from collections import defaultdict __doc__ = ''' ============================================== :mod:`irc3.plugins.userlist` User list plugin =========================...
mit
fe2d00583f9360b2f1e8a5ff9f8a4add
31.559809
77
0.545334
3.91092
false
false
false
false
gawel/irc3
irc3/_gen_doc.py
1
2996
# -*- coding: utf-8 -*- from . import rfc from . import template import os def render_attrs(title, attrs, out): out.write(title + '\n') out.write(len(title) * '=' + '\n') out.write('\n') for attr in attrs: name = attr.name title = name if isinstance(attr, int): titl...
mit
2135126fa6b59074a0b0578e5d3c9c00
33.837209
73
0.497997
3.471611
false
false
false
false
miguelgrinberg/python-engineio
src/engineio/server.py
1
33822
import base64 import gzip import importlib import io import logging import secrets import urllib import zlib from . import exceptions from . import packet from . import payload from . import socket default_logger = logging.getLogger('engineio.server') class Server(object): """An Engine.IO server. This clas...
mit
1f7664aa60b9313758b36999c284d0bf
42.867704
79
0.548578
4.813149
false
false
false
false
miguelgrinberg/python-engineio
tests/asyncio/test_async_aiohttp.py
1
1902
import unittest from unittest import mock from engineio.async_drivers import aiohttp as async_aiohttp class AiohttpTests(unittest.TestCase): def test_create_route(self): app = mock.MagicMock() mock_server = mock.MagicMock() async_aiohttp.create_route(app, mock_server, '/foo') app....
mit
df7ef82677e3dfd828da5a638f2ffc36
34.886792
79
0.542587
3.575188
false
true
false
false
miguelgrinberg/python-engineio
src/engineio/async_drivers/asgi.py
1
10181
import os import sys import asyncio from engineio.static_files import get_static_file class ASGIApp: """ASGI application middleware for Engine.IO. This middleware dispatches traffic to an Engine.IO application. It can also serve a list of static files to the client, or forward unrelated HTTP traffic...
mit
c882552251925af79497a0b504bfc647
37.711027
79
0.530793
4.187988
false
false
false
false
miguelgrinberg/python-engineio
src/engineio/async_drivers/tornado.py
1
5901
import asyncio import sys from urllib.parse import urlsplit from .. import exceptions import tornado.web import tornado.websocket def get_tornado_handler(engineio_server): class Handler(tornado.websocket.WebSocketHandler): # pragma: no cover def __init__(self, *args, **kwargs): super().__ini...
mit
13da81d5e05d6d28fc0d0ececd996892
31.423077
78
0.59312
4.24838
false
false
false
false
miguelgrinberg/python-engineio
src/engineio/asyncio_socket.py
1
10248
import asyncio import sys import time from . import exceptions from . import packet from . import payload from . import socket class AsyncSocket(socket.Socket): async def poll(self): """Wait for packets to send to the client.""" try: packets = [await asyncio.wait_for( ...
mit
14a7398738665a231ec2bee1912e3694
39.828685
79
0.540203
4.782081
false
false
false
false
miguelgrinberg/python-engineio
src/engineio/async_drivers/sanic.py
1
4468
import sys from urllib.parse import urlsplit try: # pragma: no cover from sanic.response import HTTPResponse try: from sanic.server.protocols.websocket_protocol import WebSocketProtocol except ImportError: print('yay') from sanic.websocket import WebSocketProtocol except ImportErro...
mit
3e9dbfcd1a3c20811a5c8411e087d989
29.394558
79
0.598254
4.110396
false
false
false
false
yourlabs/django-autocomplete-light
src/dal/test/utils.py
1
1926
"""Utils for testing autocompletes.""" from django.apps import apps class Fixtures(object): """Callback for post_migrate to create many objects.""" def __init__(self, model_name=None): """Preset a model name, ie. 'auth.user'.""" self.model_name = model_name def get_model(self, sender): ...
mit
eb802d58629e8c42a40e7774927aaf4d
29.09375
76
0.556075
3.987578
false
true
false
false
iclab/centinel
centinel/primitives/foctor_core/foctor_authentication.py
3
16818
__author__ = 'rishabn' import time import signal import errno import os from functools import wraps from selenium.common.exceptions import StaleElementReferenceException, ElementNotSelectableException, \ NoSuchElementException, ElementNotVisibleException, TimeoutException from selenium.webdriver.common.keys impor...
mit
5a7e0d7a9a9283a8505b584f643cbd9c
39.72155
120
0.532881
4.223506
false
false
false
false
iclab/centinel
centinel/primitives/foctor_core/foctor_args_error.py
3
3834
__author__ = 'rishabn' def fp_crawler_mode_error(): str_err = "Please specify a crawl mode: standard, tor, search_log, or login_log \n" str_err += "python front-page-crawler.py <crawl-mode>" print str_err raise SystemExit def fp_crawler_standard_mode_error(): str_err = "Usage for standard crawl:...
mit
b3037d3306a40535cab99ce9945bbf6f
36.223301
114
0.673709
3.246401
false
false
false
false
usgo/agagd
agagd/agagd_core/views/players_profile.py
1
4733
# Date Imports from datetime import date # AGAGD Models Imports import agagd_core.models as agagd_models from agagd_core.tables.games import GamesTable # AGAGD Django Tables Imports from agagd_core.tables.players import ( PlayersInformationTable, PlayersOpponentTable, PlayersTournamentTable, ) # Django I...
mit
e662d8e43e9a455b2832aeb04e48d90c
34.856061
86
0.563702
3.885878
false
false
false
false
usgo/agagd
agagd/agagd_core/tables/players.py
1
1944
import agagd_core.defaults.styles.django_tables2 as django_tables2_styles import django_tables2 as tables from agagd_core.models import Chapters from django.utils.html import format_html class PlayersInformationTable(tables.Table): full_name = tables.Column() members_chapter_name = tables.Column( verb...
mit
769445fa7061d63635266a56103679b8
31.949153
84
0.653807
3.633645
false
false
false
false
usgo/agagd
agagd/agagd_core/views/api.py
1
3806
from datetime import datetime, timedelta from agagd_core.json_response import JsonResponse from agagd_core.models import Game, Member from django.db.models import Avg, Count from django.db.models.functions import TruncMonth, TruncWeek from django.http import HttpResponse from django.views import View class ApiStatus...
mit
273f332138770e5e2a6c9ccc8438f8b5
34.240741
88
0.524172
4.023256
false
false
false
false
usgo/agagd
agagd/agagd/settings/base.py
1
6757
import os import django.conf.global_settings as DEFAULT_SETTINGS PROJECT_ROOT = os.environ["PROJECT_ROOT"] # AGAGD Administrators Configuration: # # This assumes AGAGD_ADMINS environmental variable is formated as follows: # 'webmaster:webmaster@usgo.org,agagd_webmaster:agagd+webmaster@usgo.org' # # For local configu...
mit
4be9fa20bac6e92269589a286a8063a4
35.524324
88
0.667308
3.86335
false
false
false
false
pytest-dev/execnet
doc/example/sysinfo.py
1
4881
# -*- coding: utf-8 -*- """ sysinfo.py [host1] [host2] [options] obtain system info from remote machine. (c) Holger Krekel, MIT license """ import optparse import re import sys import execnet import py parser = optparse.OptionParser(usage=__doc__) parser.add_option( "-f", "--sshconfig", action="store",...
mit
4d8c478fea1690acc585229e385b62c7
27.051724
83
0.509527
3.879968
false
true
false
false
hhatto/autopep8
test/inspect_example.py
15
104371
"""Get useful information from live Python objects. This module encapsulates the interface provided by the internal special attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion. It also provides some help for examining source code and class layout. Here are some of the useful functions provided by this module:...
mit
2c587a5534dbdf5bf5cbf6f1c09d3cd4
36.747197
84
0.581704
4.556293
false
false
false
false
mfenniak/heroku-buildpack-python-libffi
vendor/distribute-0.6.36/pkg_resources.py
40
93398
"""Package resource API -------------------- A resource is a logical file contained within a package, or a logical subdirectory thereof. The package resource API expects resource names to have their path parts separated with ``/``, *not* whatever the local path separator is. Do not use os.path operations to manipula...
mit
defabfc0db382a114d5dfebe9eeb51ad
32.037849
94
0.600816
4.238813
false
false
false
false
mfenniak/heroku-buildpack-python-libffi
vendor/distribute-0.6.36/setuptools/__init__.py
132
3744
"""Extensions to the 'distutils' for large or complex distributions""" from setuptools.extension import Extension, Library from setuptools.dist import Distribution, Feature, _get_unpatched import distutils.core, setuptools.command from setuptools.depends import Require from distutils.core import Command as _Command fro...
mit
ef765426b638829921015795f4fa860a
35
93
0.672543
3.736527
false
false
false
false
mfenniak/heroku-buildpack-python-libffi
vendor/distribute-0.6.36/_markerlib/markers.py
71
3878
# -*- coding: utf-8 -*- """Interpret PEP 345 environment markers. EXPR [in|==|!=|not in] EXPR [or|and] ... where EXPR belongs to any of those: python_version = '%s.%s' % (sys.version_info[0], sys.version_info[1]) python_full_version = sys.version.split()[0] os.name = os.name sys.platform = sys.platfo...
mit
01abb7653d4b69109df88af585008b58
32.721739
106
0.625064
3.917172
false
false
false
false
mfenniak/heroku-buildpack-python-libffi
vendor/pip-1.3.1/pip/commands/search.py
63
4751
import sys import textwrap import pkg_resources import pip.download from pip.basecommand import Command, SUCCESS from pip.util import get_terminal_size from pip.log import logger from pip.backwardcompat import xmlrpclib, reduce, cmp from pip.exceptions import CommandError from pip.status_codes import NO_MATCHES_FOUND f...
mit
e200a7704eaf7f3f07c36a81a9163172
35.546154
102
0.604925
4.257168
false
false
false
false
abelfunctions/abelfunctions
abelfunctions/tests/test_riemann_surface_path.py
1
18004
import unittest import numpy from numpy import pi, sqrt from sage.all import QQ, QQbar, e, I from abelfunctions.complex_path import ( ComplexLine, ComplexArc, ComplexRay, ) from abelfunctions.puiseux import puiseux from abelfunctions.riemann_surface import RiemannSurface from abelfunctions.riemann_surface...
mit
1c5a6a19d4035260e241d9ab08c1fccd
29.828767
79
0.564041
2.958265
false
true
false
false
abelfunctions/abelfunctions
abelfunctions/complex_path_factory.py
1
27469
r"""X-Path Factory :mod:`abelfunctions.complex_path_factory` ================================================= Module for computing the monodromy group of the set of discriminant points of a complex plane algebraic curve. """ import numpy from numpy import double, floor, angle from sage.all import infinity, QQbar, s...
mit
3eb8b59840c7f190639f19a86f452d19
35.143421
86
0.585897
4.044317
false
false
false
false
pmorissette/bt
bt/algos.py
1
76303
""" A collection of Algos used to create Strategy logic. """ from __future__ import division import abc import random import re import numpy as np import pandas as pd import sklearn.covariance import bt from bt.core import Algo, AlgoStack, SecurityBase, is_zero def run_always(f): """ Run always decorator t...
mit
ce644626aca7b452c6e043b3bb31655a
30.067997
114
0.60514
4.130068
false
false
false
false
abelfunctions/abelfunctions
abelfunctions/tests/test_puiseux_series_ring.py
2
10394
import unittest from .test_abelfunctions import AbelfunctionsTestCase from abelfunctions.puiseux_series_ring import PuiseuxSeriesRing from abelfunctions.puiseux_series_ring_element import LaurentSeries_V from sage.all import SR, CC from sage.rings.laurent_series_ring import LaurentSeriesRing from sage.rings.rational_...
mit
2a998244f0ac508f07120ccac0b62de2
27.398907
73
0.489513
2.630061
false
true
false
false
abelfunctions/abelfunctions
abelfunctions/integralbasis.py
1
11914
r"""Integral Basis :mod:`abelfunctions.integralbasis` ================================================= A module for computing integral bases of algebraic function fields of the form :math:`O(X) = \mathbb{C}[x,y] / (f(x,y))` where :math:`X : f(x,y) = 0`. For polynomials over :math:`\mathbb{Q}[x,y]` we use Singular's ...
mit
e57f9250b2f4e867c1f67b1fb6a3c66f
29.392857
80
0.61113
3.465387
false
false
false
false
thefactory/marathon-python
marathon/models/queue.py
1
1946
from .base import MarathonResource from .app import MarathonApp class MarathonQueueItem(MarathonResource): """Marathon queue item. See: https://mesosphere.github.io/marathon/docs/rest-api.html#queue List all the tasks queued up or waiting to be scheduled. This is mainly used for troubleshooting and...
mit
e8a699281b2278f15321332ad3357a9b
37.156863
89
0.701439
3.97955
false
false
false
false
vnpy/vnpy
vnpy/trader/constant.py
1
4083
""" General constant enums used in the trading platform. """ from enum import Enum class Direction(Enum): """ Direction of order/trade/position. """ LONG = "多" SHORT = "空" NET = "净" class Offset(Enum): """ Offset of order/trade. """ NONE = "" OPEN = "开" CLOSE = "平" ...
mit
8e68175bbadd5b1d621286d2896ac493
25.046053
71
0.51907
2.928254
false
false
false
false
stamparm/maltrail
core/httpd.py
1
32994
#!/usr/bin/env python """ Copyright (c) 2014-2022 Maltrail developers (https://github.com/stamparm/maltrail/) See the file 'LICENSE' for copying permission """ from __future__ import print_function import datetime import glob import gzip import hashlib import io import json import mimetypes import os import re import...
mit
0b1a8f3a86f01d4ee3492aa91e941b6a
43.109626
294
0.490907
4.42101
false
false
false
false
marcwebbie/passpie
passpie/process.py
2
1376
import logging import os from subprocess import Popen, PIPE from ._compat import basestring DEVNULL = open(os.devnull, 'w') class Proc(Popen): def communicate(self, **kwargs): if kwargs.get('input') and isinstance(kwargs['input'], basestring): kwargs['input'] = kwargs['input'].encode('utf-...
mit
21852a88d9ce300b3c9d1c1c5a44de9a
27.666667
75
0.594477
4.035191
false
false
false
false
hips/autograd
autograd/scipy/special.py
2
5135
from __future__ import absolute_import import scipy.special import autograd.numpy as np from autograd.extend import primitive, defvjp, defjvp from autograd.numpy.numpy_vjps import unbroadcast_f, repeat_to_match_shape ### Beta function ### beta = primitive(scipy.special.beta) betainc = primitive(scipy.special.betain...
mit
b408a8f734951b3ad126429d7552cd18
39.433071
117
0.643817
2.532051
false
false
false
false
hips/autograd
examples/negative_binomial_maxlike.py
3
2159
from __future__ import division, print_function import autograd.numpy as np import autograd.numpy.random as npr from autograd.scipy.special import gammaln from autograd import grad import scipy.optimize # The code in this example implements a method for finding a stationary point of # the negative binomial likelihoo...
mit
dfebfe93899cc218c620d7f562367ff1
31.712121
93
0.670218
2.941417
false
false
false
false
hips/autograd
autograd/misc/flatten.py
3
1120
""" Handy functions for flattening nested containers containing numpy arrays. The main purpose is to make examples and optimizers simpler. """ from autograd import make_vjp from autograd.builtins import type import autograd.numpy as np def flatten(value): """Flattens any nesting of tuples, lists, or dicts, with nu...
mit
50073291c6a1fa823b7a8361c86bd1be
32.939394
77
0.69375
3.708609
false
false
false
false
conan-io/conan-package-tools
cpt/packager.py
1
40145
import os import platform import re import sys import copy from collections import defaultdict from itertools import product import six from conans import tools from conans.client.conan_api import Conan from conans.client.runner import ConanRunner from conans.model.ref import ConanFileReference from conans.model.versi...
mit
1b73eb038461b2a7c4320f5f8da99749
47.020335
125
0.558849
4.226679
false
false
false
false
euske/pdfminer
pdfminer/pdffont.py
1
27098
#!/usr/bin/env python import sys import struct from io import BytesIO from .cmapdb import CMapDB from .cmapdb import CMapParser from .cmapdb import FileUnicodeMap from .cmapdb import CMap from .encodingdb import EncodingDB from .encodingdb import name2unicode from .psparser import PSStackParser from .psparser import PS...
mit
2ad22a810be76b93701d9a2b944aeb2f
35.718157
98
0.539449
3.452414
false
false
false
false
euske/pdfminer
tools/runapp.py
1
3528
#!/usr/bin/env python ## ## WebApp class runner ## ## usage: ## $ runapp.py pdf2html.cgi ## import sys import urllib from httplib import responses from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler ## WebAppHandler ## class WebAppHandler(SimpleHTTPRequestHandler): A...
mit
744c045482fe81937576d0f2e09fffea
30.221239
79
0.549036
3.644628
false
false
false
false
plamere/spotipy
examples/title_chain.py
1
1871
from spotipy.oauth2 import SpotifyClientCredentials import spotipy import random ''' generates a list of songs where the first word in each subsequent song matches the last word of the previous song. usage: python title_chain.py [song name] ''' client_credentials_manager = SpotifyClientCredentials() sp =...
mit
aed01a7df6c8542116fb9c77bc7b1094
26.115942
76
0.538215
3.818367
false
false
false
false
fuzeman/trakt.py
trakt/core/context_collection.py
2
3772
from __future__ import absolute_import, division, print_function from trakt.core.helpers import synchronized from six.moves import xrange from six.moves import _thread as thread from threading import RLock import logging log = logging.getLogger(__name__) class ListCollection(object): def __init__(self, *lists)...
mit
1806cd82d09f46425a9859b945527b49
22.141104
72
0.550901
4.167956
false
false
false
false
fuzeman/trakt.py
trakt/interfaces/sync/core/mixins.py
2
2967
from __future__ import absolute_import, division, print_function from trakt.core.helpers import dictfilter from trakt.core.pagination import PaginationIterator from trakt.interfaces.base import Interface, authenticated from trakt.mapper.sync import SyncMapper import requests class Get(Interface): flags = {} ...
mit
b555edc5c05aeb79c08c013549dde5e6
23.121951
89
0.519717
4.65047
false
false
false
false
fuzeman/trakt.py
tests/sync/watchlist/test_mixed.py
1
5667
# flake8: noqa: F403, F405 from tests.core import mock from trakt import Trakt from trakt.objects import Movie, Show, Season, Episode from datetime import datetime from dateutil.tz import tzutc from hamcrest import * from httmock import HTTMock def test_basic(): with HTTMock(mock.sync_watchlist, mock.unknown): ...
mit
d979f876eb3b758619a9d866e880ec05
26.509709
80
0.369861
4.296437
false
false
false
false
fuzeman/trakt.py
tests/oauth/test_oauth.py
1
5552
from __future__ import absolute_import, division, print_function from tests.core import mock from tests.core.helpers import assert_url from trakt import Trakt, TraktClient from httmock import HTTMock from threading import Event import calendar import datetime import pytest def test_authorize_url(): Trakt.site_u...
mit
56c332f9d38f37b1c43f5e29c9efe539
33.271605
108
0.597442
3.893408
false
true
false
false
fuzeman/trakt.py
trakt/interfaces/sync/history.py
2
2373
from __future__ import absolute_import, division, print_function from trakt.core.helpers import to_iso8601_datetime from trakt.interfaces.base import authenticated from trakt.interfaces.sync.core.mixins import Get, Add, Remove class SyncHistoryInterface(Get, Add, Remove): path = 'sync/history' flags = {'is_w...
mit
bc45f35144f033088aa152761cbd1be3
25.076923
100
0.524231
3.871126
false
false
false
false
fuzeman/trakt.py
trakt/interfaces/__init__.py
2
2427
from __future__ import absolute_import, division, print_function from trakt.interfaces import auth from trakt.interfaces import calendars from trakt.interfaces import lists from trakt.interfaces import movies from trakt.interfaces import oauth from trakt.interfaces import scrobble from trakt.interfaces import search f...
mit
62bfb41b1905b102c4a7b805c42146fc
19.567797
64
0.658838
4.099662
false
false
false
false
fuzeman/trakt.py
trakt/interfaces/users/history.py
2
3409
from __future__ import absolute_import, division, print_function from trakt.core.helpers import clean_username, dictfilter, to_iso8601_datetime from trakt.core.pagination import PaginationIterator from trakt.interfaces.base import Interface, authenticated from trakt.mapper import SyncMapper import requests class Us...
mit
0fe8c777d4f4e3e842020b448ae1170b
25.84252
100
0.523614
4.172583
false
false
false
false
fuzeman/trakt.py
trakt/objects/comment.py
6
3241
from __future__ import absolute_import, division, print_function from trakt.core.helpers import from_iso8601_datetime from trakt.objects.core.helpers import update_attributes class Comment(object): def __init__(self, client, keys): self._client = client self.keys = keys """ :type...
mit
a7cc918a62c846277f4bdec6ad8149d2
19.25625
87
0.487812
4.225554
false
false
false
false
lneuhaus/pyrpl
pyrpl/software_modules/lockbox/output.py
1
16258
from __future__ import division import numpy as np from scipy import interpolate from ...software_modules.lockbox.input import Signal from ...attributes import BoolProperty, FloatProperty, SelectProperty, \ FilterProperty, FrequencyProperty, IntProperty from ...curvedb import CurveDB from ...hardware_modules.asg ...
mit
bef9d14127dfc71a973e4311bf0373ad
42.587131
104
0.570119
4.054364
false
false
false
false
lneuhaus/pyrpl
pyrpl/redpitaya.py
1
23600
############################################################################### # pyrpl - DSP servo controller for quantum optics with the RedPitaya # Copyright (C) 2014-2016 Leonhard Neuhaus (neuhaus@spectro.jussieu.fr) # # This program is free software: you can redistribute it and/or modify # it under t...
mit
1752ef5eb6e89fd280bf11d18f133142
45.825397
145
0.572415
4.410391
false
false
false
false
lneuhaus/pyrpl
pyrpl/acquisition_module.py
1
21707
""" Everything involving asynchronicity in acquisition instruments is in this file. In particular, this includes getting curves and continuously averaging curves. Using the coroutine syntax introduced in python 3.4+ would make the code more elegant, but it would not be compatible with python 2.7. Hence we have chosen...
mit
02a5909dac36e825cab59578a28db904
38.253165
181
0.616806
4.321521
false
false
false
false
lneuhaus/pyrpl
pyrpl/hardware_modules/sampler.py
1
2772
import numpy as np from ..pyrpl_utils import time from ..attributes import FloatRegister from ..modules import HardwareModule from . import DSP_INPUTS class Sampler(HardwareModule): """ this module provides a sample of each signal. This is a momentary workaround, will be improved later on with an upgraded FP...
mit
25b9829bc35e8928f4d1aa42f64e811a
29.8
100
0.550144
4.428115
false
false
false
false
lneuhaus/pyrpl
pyrpl/software_modules/lockbox/input.py
1
24829
from __future__ import division import scipy import numpy as np import logging from ...attributes import SelectProperty, FloatProperty, FrequencyProperty, \ PhaseProperty, FilterProperty, FrequencyRegister, ProxyProperty from ...widgets.module_widgets import LockboxInputWidget from ...hardware_modules.dsp import DS...
mit
0a4b49ad32aa13939d946b53b8c95d77
39.306818
120
0.564743
4.425058
false
false
false
false
lneuhaus/pyrpl
pyrpl/widgets/pyrpl_widget.py
1
13403
from qtpy import QtCore, QtWidgets import sys from traceback import format_exception, format_exception_only import logging from .. import APP class ExceptionLauncher(QtCore.QObject): # Used to display exceptions in the status bar of PyrplWidgets show_exception = QtCore.Signal(list) # use a signal to make ...
mit
314c53db0e5ba97e2d81f547859baf2c
37.185185
96
0.605238
3.998508
false
false
false
false
kbr/fritzconnection
fritzconnection/cli/fritzhomeauto.py
1
2507
""" fritzhomeauto.py Module to inspect the FritzBox homeautomation API. CLI interface. This module is part of the FritzConnection package. https://github.com/kbr/fritzconnection License: MIT (https://opensource.org/licenses/MIT) Author: Klaus Bremer """ from ..lib.fritzhomeauto import FritzHomeAutomation from . util...
mit
1af68d1e7b8556f66035ccfd84be1109
28.833333
85
0.612929
3.637155
false
false
false
false
pyparsing/pyparsing
examples/simpleWiki.py
1
1108
from pyparsing import * wikiInput = """ Here is a simple Wiki input: *This is in italics.* **This is in bold!** ***This is in bold italics!*** Here's a URL to {{Pyparsing's Wiki Page->https://site-closed.wikispaces.com}} """ def convertToHTML(opening, closing): def conversionParseAction(s, l,...
mit
a7026243bcd7d35cdfe7f22c086d60c2
27.157895
88
0.636282
3.388379
false
false
false
false
pyparsing/pyparsing
examples/number_words.py
1
3884
# number_words.py # # Copyright 2020, Paul McGuire # # Parser/evaluator for expressions of numbers as written out in words: # - one # - seven # - twelve # - twenty six # - forty-two # - one hundred and seven # # # BNF: """ optional_and ::= ["and" | "-"] optional_dash ::= ["-"] units ::= one | two | t...
mit
c24fba6f7eee1aad5a9d527e5371df05
27.350365
87
0.635427
3.124698
false
false
false
false
pyparsing/pyparsing
examples/unicode_denormalizer.py
1
3790
# unicode_denormalizer.py # # Demonstration of the pyparsing's transform_string() method, to # convert identifiers in Python source code to equivalent Unicode # characters. Python's compiler automatically normalizes Unicode # characters back to their ASCII equivalents, so that identifiers may # be rewritten using other...
mit
a2e20164aca9775545c4ac79254140bb
29.284553
115
0.654765
3.236316
false
false
false
false
pyparsing/pyparsing
examples/htmlTableParser.py
1
2096
# # htmlTableParser.py # # Example of parsing a simple HTML table into a list of rows, and optionally into a little database # # Copyright 2019, Paul McGuire # import pyparsing as pp import urllib.request # define basic HTML tags, and compose into a Table table, table_end = pp.makeHTMLTags("table") thead, thead_end ...
mit
abe5e92f8d7e4b707b323f55b25f4a14
26.220779
99
0.691317
3.091445
false
false
false
false
pyparsing/pyparsing
examples/antlr_grammar.py
1
11143
""" antlr_grammar.py Created on 4 sept. 2010 @author: luca Submitted by Luca DallOlio, September, 2010 (Minor updates by Paul McGuire, June, 2012) (Code idiom updates by Paul McGuire, April, 2019) """ from pyparsing import ( Word, ZeroOrMore, printables, Suppress, OneOrMore, Group, LineEn...
mit
e3767837dac73989cf70ca6458ba032a
27.719072
110
0.609351
3.393118
false
false
false
false
pyparsing/pyparsing
examples/httpServerLogParser.py
1
3565
# httpServerLogParser.py # # Copyright (c) 2016, Paul McGuire # """ Parser for HTTP server log output, of the form: 195.146.134.15 - - [20/Jan/2003:08:55:36 -0800] "GET /path/to/page.html HTTP/1.0" 200 4649 "http://www.somedomain.com/020602/page.html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" 127.0.0.1 - u....
mit
598711f552a4af2677f8e66ff1294ec3
33.61165
253
0.601964
3.036627
false
false
false
false
pyparsing/pyparsing
examples/partial_gene_match.py
1
2400
# partial_gene_match.py # # Example showing how to use the CloseMatch class, to find strings in a gene with up to 'n' mismatches # import pyparsing as pp from urllib.request import urlopen # read in a bunch of genomic data data_url = "http://toxodb.org/common/downloads/release-6.0/Tgondii/TgondiiApicoplastORFsNAs_To...
mit
e07130f75b02f2d98fd0b46062ea5779
33.782609
109
0.62625
3.453237
false
false
false
false
codeeu/coding-events
web/processors/media.py
2
1247
import os import uuid from django.conf import settings from django.core.files.uploadedfile import InMemoryUploadedFile from django.template.defaultfilters import slugify from PIL import Image as PilImage import StringIO class UploadImageError(Exception): pass class ImageSizeTooLargeException(Exception): pa...
mit
cfaf599f726e9a9747c32d91bfc86300
26.108696
106
0.636728
3.778788
false
false
false
false
codeeu/coding-events
api/migrations/0009_auto__add_field_userprofile_role__add_field_userprofile_is_main_contac.py
2
8691
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'UserProfile.role' db.add_column(u'api_userprofile', 'role...
mit
388b49a12ab53fb1dbb1529b1b08458d
70.245902
195
0.55195
3.665542
false
false
false
false
codeeu/coding-events
web/tests/test_event_views.py
2
17216
# coding=utf-8 import datetime import pytest import StringIO import os from py.path import local from django.test import TestCase from django.test import Client from django.core.urlresolvers import reverse from django.core.files.uploadedfile import InMemoryUploadedFile from django.contrib.auth.models import User, Gro...
mit
e6b2187611569f91976fbce4e0d4a985
37.848758
488
0.632307
3.376496
false
true
false
false
skoczen/will
will/backends/io_adapters/shell.py
5
3879
import cmd import random import sys import time import logging import requests import threading import readline import traceback import warnings from will import settings from will.utils import Bunch, UNSURE_REPLIES, html_to_text from will.abstractions import Message, Person, Channel from .base import StdInOutIOBacken...
mit
776e7fd6d10c5e5e9b9b18026882ad75
34.263636
138
0.594225
3.998969
false
false
false
false
skoczen/will
will/abstractions.py
5
5128
# -- coding: utf-8 - import datetime import hashlib import logging from pytz import timezone as pytz_timezone from will.utils import Bunch class Message(object): will_internal_type = "Message" REQUIRED_FIELDS = [ "is_direct", "is_private_chat", "is_group_chat", "will_is_mentio...
mit
8755a56f43a42fdd59b4ffb93bbb75c0
29.47619
115
0.544922
3.869992
false
false
false
false
skoczen/will
will/backends/storage/couchbase_backend.py
5
2382
from six.moves.urllib import parse from couchbase import Couchbase, exceptions as cb_exc from .base import BaseStorageBackend class CouchbaseStorage(BaseStorageBackend): """ A storage backend using Couchbase You must supply a COUCHBASE_URL setting that is passed through urlparse. All parameters supp...
mit
025fe7381e8cac8edc43bf03e5e45708
28.775
100
0.61251
4.092784
false
false
false
false
skoczen/will
will/backends/execution/base.py
2
3800
import imp import logging import signal import traceback from will import settings from will.decorators import require_settings from will.acl import verify_acl from will.abstractions import Event from multiprocessing import Process class ExecutionBackend(object): is_will_execution_backend = True def handle_e...
mit
55f0af8bd83a6f9da8a1284e36e67f64
33.234234
155
0.519737
4.470588
false
false
false
false
agdsn/sipa
sipa/blueprints/documents.py
1
2011
import os from flask import Blueprint, send_from_directory, current_app from flask_login import current_user from flask.views import View from sipa.base import login_manager bp_documents = Blueprint('documents', __name__) class StaticFiles(View): def __init__(self, directory, login_required=False, member_requ...
mit
42dbdac7c8b4cd3d7744496d79622953
37.673077
90
0.57633
4.622989
false
false
false
false
indico/indico-plugins
payment_sixpay/indico_payment_sixpay/controllers.py
1
16728
# This file is part of the Indico plugins. # Copyright (C) 2017 - 2022 Max Fischer, Martin Claus, CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. import json import time from urllib.parse import u...
mit
b0f387d6a7dd6bef3034b3d216122d3d
44.088949
117
0.635521
4.564256
false
false
false
false
indico/indico-plugins
citadel/indico_citadel/schemas_test.py
1
17756
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2022 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. from datetime import datetime, timedelta from io import BytesIO import pytes...
mit
6aee2c36a2f6b30cab3ddd9209bf6d8e
39.263039
119
0.626943
3.770652
false
true
false
false
indico/indico-plugins
citadel/indico_citadel/cli.py
1
2691
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2022 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. import os import sys import time import traceback import click from indico....
mit
c24b460b0945733fc6f374563bbb7904
35.364865
109
0.663322
3.75838
false
false
false
false
indico/indico-plugins
piwik/indico_piwik/controllers.py
1
2435
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2022 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. from flask import jsonify, request from flask_pluginengine import current_plu...
mit
facda99eb36b8aab30b05ffb924b4c6b
32.819444
98
0.674333
3.70624
false
false
false
false
indico/indico-plugins
previewer_jupyter/indico_previewer_jupyter/controllers.py
1
2235
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2022 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. import nbformat from flask import current_app, render_template, request, sess...
mit
3ab18696838a66ecdc149299412ba91c
38.910714
115
0.695749
3.788136
false
true
false
false
indico/indico-plugins
livesync/indico_livesync/task.py
1
1345
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2022 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. from celery.schedules import crontab from indico.core.celery import celery f...
mit
c492f418cdefd41e5cf12e341cefce45
37.428571
107
0.705576
3.864943
false
false
false
false
indico/indico-plugins
citadel/indico_citadel/search.py
1
5022
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2022 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. import base64 import zlib import requests from flask import current_app from...
mit
392913658d26adce34fd53aff28136f1
39.829268
108
0.639188
3.83945
false
false
false
false
indico/indico-plugins
piwik/indico_piwik/queries/graphs.py
1
2063
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2022 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. from base64 import b64encode from flask_pluginengine import current_plugin ...
mit
9cd1ae9339d55205da8fa2cab82d87e5
40.26
115
0.672807
4.053045
false
false
false
false