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
clips/pattern
examples/08-server/02-api/api.py
1
3541
from __future__ import print_function from __future__ import unicode_literals from builtins import str, bytes, dict, int import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) from pattern.server import App from pattern.server import MINUTE, HOUR, DAY from pattern.text import l...
bsd-3-clause
664210a783c1158be9b17fd2bb73f660
36.273684
81
0.704038
3.324883
false
false
false
false
daxm/fmcapi
fmcapi/api_objects/object_services/securityzones.py
1
1284
"""Security Zones Class.""" from fmcapi.api_objects.apiclasstemplate import APIClassTemplate import logging class SecurityZones(APIClassTemplate): """The SecurityZones Object in the FMC.""" VALID_JSON_DATA = [ "id", "name", "type", "description", "interfaceMode", ...
bsd-3-clause
d4e78995adccc4354aea4534759ffd76
26.913043
68
0.584891
4.102236
false
false
false
false
daxm/fmcapi
fmcapi/api_objects/update_packages/upgradepackages.py
1
1268
"""Upgrade Packages Class.""" from fmcapi.api_objects.apiclasstemplate import APIClassTemplate import logging class UpgradePackages(APIClassTemplate): """The UpgradePackages Object in the FMC.""" VALID_JSON_DATA = ["id", "name", "type"] VALID_FOR_KWARGS = VALID_JSON_DATA + [] URL_SUFFIX = "/updates/...
bsd-3-clause
6eccf3d38db9a562b92bba6fcefacae9
32.368421
85
0.636435
4.090323
false
false
false
false
daxm/fmcapi
setup.py
1
1947
from setuptools import setup, find_packages __author__ = "Dax Mickelson" __author_email = "dmickels@cisco.com" __license__ = "BSD" setup( name="fmcapi", version="20210802.0", description="Easier interface to Cisco's FMC API than writing your own way.", long_description="""With the removal to configure...
bsd-3-clause
e68b0f1041b7cfa7ca890ca78d573083
42.266667
118
0.646636
4.142553
false
false
true
false
conda/conda-concourse-ci
conda_concourse_ci/concourse.py
1
4478
import json import logging import subprocess from contextlib import AbstractContextManager class Concourse(AbstractContextManager): """ A class for interacting with a Concourse CI instance Uses fly for interactions, a compatible version must be installed and on path. This can be used as a contex...
bsd-3-clause
f93ff6f4e5d474e5ad2c8c8c8151dd4c
28.460526
76
0.553149
4.212606
false
false
false
false
adblockplus/gyp
pylib/gyp/generator/xcode.py
16
58863
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import filecmp import gyp.common import gyp.xcodeproj_file import gyp.xcode_ninja import errno import os import sys import posixpath import re import shutil import...
bsd-3-clause
91b3aeead89284e784a7b3f0698f82f3
43.899314
80
0.657799
4.044733
false
true
false
false
adblockplus/gyp
test/standalone-static-library/gyptest-standalone-static-library.py
47
1747
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies build of a static_library with the standalone_static_library flag set. """ import os import subprocess import sys import TestG...
bsd-3-clause
8f02cf7ef488fff9c110dff540f7c642
33.94
79
0.737836
3.366089
false
true
false
false
adblockplus/gyp
test/lib/TestWin.py
87
3168
# Copyright (c) 2014 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ TestWin.py: a collection of helpers for testing on Windows. """ import errno import os import re import sys import subprocess class Registry(object): def ...
bsd-3-clause
50813975684abbe5f45ff6353e58bb17
30.366337
80
0.65846
3.854015
false
false
false
false
adblockplus/gyp
pylib/gyp/generator/dump_dependency_json.py
1523
3426
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import collections import os import gyp import gyp.common import gyp.msvs_emulation import json import sys generator_supports_multiple_toolsets = True generator_...
bsd-3-clause
4ec7046093339005326a345e0550da53
33.606061
77
0.697607
3.840807
false
false
false
false
dbcli/vcli
vcli/vexecute.py
1
10588
import logging import socket import sys import sqlparse import vertica_python as vertica from sqlparse.tokens import Token as _Token from sqlparse.sql import Token from .packages import vspecial as special from .encodingutils import PY2 _logger = logging.getLogger(__name__) class VExecute(object): # The bo...
bsd-3-clause
768f752e03cc0567855ec75d22d8bba0
33.376623
107
0.579146
3.953697
false
false
false
false
dbcli/vcli
vcli/vbuffer.py
1
1105
from prompt_toolkit.buffer import Buffer from prompt_toolkit.filters import Condition class VBuffer(Buffer): def __init__(self, always_multiline, *args, **kwargs): self.always_multiline = always_multiline @Condition def is_multiline(): doc = self.document return sel...
bsd-3-clause
228ad19e5b3ace93cd16630989a34a2c
43.2
86
0.555656
4.384921
false
false
false
false
dbcli/vcli
vcli/packages/sqlcompletion.py
1
13865
from __future__ import print_function import sys import sqlparse from sqlparse.sql import Comparison, Identifier, Where from .parseutils import last_word, extract_tables, find_prev_keyword from .vspecial import parse_special_command PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 if PY3: string_type...
bsd-3-clause
85173c5b3dd5594f72fa00e697aa4e28
41.015152
82
0.560765
4.185029
false
false
false
false
pecan/pecan
pecan/tests/middleware/test_static.py
3
2390
from pecan.middleware.static import (StaticFileMiddleware, FileWrapper, _dump_date) from pecan.tests import PecanTestCase import os class TestStaticFileMiddleware(PecanTestCase): def setUp(self): super(TestStaticFileMiddleware, self).setUp() def app(environ,...
bsd-3-clause
ba4bbd62224c13f3bc5f060833a3e8d6
32.194444
71
0.606695
3.956954
false
true
false
false
tulip-control/tulip-control
examples/pwa.py
1
3986
#!/usr/bin/env python """Controller synthesis for system with piecewise-affine continuous dynamics.""" # This example is an extension of `robot_continuous.py` # by Petter Nilsson and Nok Wongpiromsarn. # Necmiye Ozay, August 26, 2012 from __future__ import print_function import numpy as np from polytope import box2pol...
bsd-3-clause
a193d5b2bec2554f1db966299e1c03e1
25.573333
80
0.646764
2.871758
false
false
false
false
tulip-control/tulip-control
tulip/spec/prioritized_safety.py
1
5753
# Copyright (c) 2020 by California Institute of Technology # and University of Texas at Austin # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain t...
bsd-3-clause
7815dd2e23f69e59564a48fd0d9cf50d
33.449102
87
0.641057
4.196207
false
false
false
false
tulip-control/tulip-control
tulip/spec/parser.py
1
2869
# Copyright (c) 2011-2014 by California Institute of Technology # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice,...
bsd-3-clause
8d8305fb21ad084b80eac557302a18ca
37.77027
74
0.730917
4.188321
false
false
false
false
poldracklab/mriqc
mriqc/classifier/sklearn/_validation.py
1
8919
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <nipreps@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
bsd-3-clause
0504c439ff7036b0f067edaae4d95805
30.967742
88
0.625855
3.682494
false
true
false
false
poldracklab/mriqc
mriqc/qc/functional.py
2
9444
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <nipreps@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
bsd-3-clause
1e51489be857ab4800ddc6ca4baa0378
33.206522
119
0.662536
3.113786
false
false
false
false
poldracklab/mriqc
mriqc/workflows/anatomical.py
1
28238
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <nipreps@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
bsd-3-clause
d517a0bae12e30ec252dd6a28e6be64e
31.569781
98
0.55057
3.501736
false
false
false
false
poldracklab/mriqc
mriqc/viz/utils.py
1
18968
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <nipreps@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
bsd-3-clause
a61b2d50932af6d0da472f151766d822
26.935199
80
0.561683
2.964676
false
false
false
false
poldracklab/mriqc
mriqc/bin/labeler.py
2
3116
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <nipreps@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
bsd-3-clause
03b63710d6510bbf0bbdbada91260c45
30.795918
74
0.563864
3.548975
false
false
false
false
scrapy/parsel
parsel/selector.py
1
21147
""" XPath selectors based on lxml """ import typing import warnings from typing import ( Any, Dict, List, Mapping, Optional, Pattern, Type, TypeVar, Union, ) from warnings import warn from cssselect import GenericTranslator as OriginalGenericTranslator from lxml import etree, html ...
bsd-3-clause
450aad471083f3f9a9a3c784f608d44b
31.634259
132
0.578333
4.289452
false
false
false
false
scrapy/parsel
tests/typing/selector.py
1
1758
# Basic usage of the Selector, strongly typed to test the typing of parsel's API. import re from parsel import Selector def correct() -> None: selector = Selector( text="<html><body><ul><li>1</li><li>2</li><li>3</li></ul></body></html>" ) li_values: list[str] = selector.css("li").getall() sel...
bsd-3-clause
5df9fba692eeea6cccb2bd34fae9f0b4
30.963636
90
0.607509
3.316981
false
false
false
false
quantmind/pulsar
pulsar/utils/__init__.py
1
1138
''' Documentation for utilities used by pulsar internals. This module is independent from all other pulsar modules and therefore can be used as a stand-alone library. HTTP ============ .. automodule:: pulsar.utils.httpurl .. _tools-ws-parser: Websocket ============================== .. automodule:: pulsar.utils.w...
bsd-3-clause
b3343da38d2718abe498b6a856658351
12.232558
68
0.565905
3.635783
false
false
false
false
quantmind/pulsar
pulsar/apps/data/redis/__init__.py
1
1272
''' Pulsar is shipped with a :class:`.Store` implementation for redis_ and :ref:`pulsard-ds <pulsar-data-store>` servers. .. _redis: http://redis.io/ Redis Store ~~~~~~~~~~~~ .. autoclass:: pulsar.apps.data.redis.store.RedisStore :members: :member-order: bysource Redis Client ~~~~~~~~~~~~~~~ .. autoclass:: ...
bsd-3-clause
a33c47e0a495fa36c1c610a468bd73dd
23.941176
75
0.683962
3.46594
false
false
false
false
quantmind/pulsar
pulsar/async/access.py
1
5246
import os import threading import logging import asyncio from concurrent.futures import ThreadPoolExecutor from collections import OrderedDict from threading import current_thread from inspect import isawaitable from asyncio import Future, ensure_future from ..utils.config import Config, Global from ..utils.system imp...
bsd-3-clause
915b72c2155923441aed899d46037b59
24.466019
77
0.617042
3.834795
false
false
false
false
quantmind/pulsar
pulsar/apps/http/client.py
1
34495
import os import platform import logging import asyncio from functools import partial from collections import namedtuple from io import StringIO, BytesIO from urllib.parse import urlparse, parse_qsl, urlencode, urlunparse from http.client import responses try: import ssl BaseSSLError = ssl.SSLError except Impor...
bsd-3-clause
ba11a09c858e74ed1e95bfd6a6beb7c3
32.425388
79
0.574083
4.267599
false
false
false
false
quantmind/pulsar
pulsar/utils/tools/arity.py
1
2604
import inspect __all__ = ['checkarity'] def checkarity(func, args, kwargs, discount=0): '''Check if arguments respect a given function arity and return an error message if the check did not pass, otherwise it returns ``None``. :parameter func: the function. :parameter args: function arguments. ...
bsd-3-clause
6cf1721812f1911ef0586b71179cc3bb
34.671233
77
0.53341
4.018519
false
false
false
false
quantmind/pulsar
pulsar/utils/structures/misc.py
1
5833
from itertools import islice import collections Mapping = collections.Mapping COLLECTIONS = (list, tuple, set, frozenset) def mapping_iterator(iterable): if isinstance(iterable, Mapping): return iterable.items() else: return iterable or () def inverse_mapping(iterable): if isinstance(...
bsd-3-clause
cbbc4376c835ce9909d6811453f0101d
24.696035
76
0.520487
4.330364
false
false
false
false
quantmind/pulsar
pulsar/utils/lib.py
1
1261
import os if os.environ.get('PULSARPY', 'no') == 'yes': HAS_C_EXTENSIONS = False else: HAS_C_EXTENSIONS = True try: import httptools # noqa from .clib import ( EventHandler, ProtocolConsumer, Protocol, Producer, WsgiProtocol, AbortEvent, RedisParser, WsgiResponse,...
bsd-3-clause
2b53cbc9cca73ff46ad55e21c2f29427
28.325581
78
0.632831
3.844512
false
false
true
false
quantmind/pulsar
pulsar/utils/system/winprocess.py
8
1245
import sys import os from multiprocessing import forking, process, freeze_support from multiprocessing.util import _logger, _log_to_stderr WINEXE = forking.WINEXE def get_preparation_data(name): ''' Return info about parent needed by child to unpickle process object. Monkey-patch from '''...
bsd-3-clause
0e7d72990be7ca9146eb42e18445dc8f
28.365854
73
0.587952
3.619186
false
false
false
false
quantmind/pulsar
tests/bench/test_wsgi.py
1
1110
import unittest from pulsar.apps.wsgi import WsgiResponse from pulsar.utils.lib import WsgiResponse as Wsgi common = { 200: 'OK', 400: 'Bad Request', 404: 'Not Found', 500: 'Internal Server Error' } class TestWsgi(unittest.TestCase): __benchmark__ = True __number__ = 20000 def setUp(se...
bsd-3-clause
fcbd7689b7d4ca611628b369e15b455f
24.813953
77
0.617117
3.627451
false
true
false
false
healthchecks/healthchecks
hc/front/management/commands/pygmentize.py
1
1907
from __future__ import annotations from django.core.management.base import BaseCommand def _process(name, lexer): from pygments import highlight from pygments.formatters import HtmlFormatter source = open("templates/front/snippets/%s.txt" % name).read() processed = highlight(source, lexer, HtmlForma...
bsd-3-clause
b99a275b83fb004fd054d0a80c4ebae8
39.574468
76
0.648663
4.014737
false
false
false
false
healthchecks/healthchecks
hc/api/migrations/0065_auto_20191127_1240.py
2
1098
# Generated by Django 2.2.6 on 2019-11-27 12:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0064_auto_20191119_1346'), ] operations = [ migrations.AddField( model_name='check', name='methods', ...
bsd-3-clause
9603f442276822ab6582cc98d2586b60
46.73913
604
0.575592
3.43125
false
false
false
false
healthchecks/healthchecks
hc/front/tests/test_switch_channel.py
1
2299
from __future__ import annotations from hc.accounts.models import Project from hc.api.models import Channel, Check from hc.test import BaseTestCase class SwitchChannelTestCase(BaseTestCase): def setUp(self): super().setUp() self.check = Check.objects.create(project=self.project) self.cha...
bsd-3-clause
ed01358442838aef4cd28c7d98244fb7
37.316667
84
0.661157
3.564341
false
true
false
false
healthchecks/healthchecks
hc/front/tests/test_add_pagertree.py
1
1739
from __future__ import annotations from django.test.utils import override_settings from hc.api.models import Channel from hc.test import BaseTestCase class AddPagerTreeTestCase(BaseTestCase): def setUp(self): super().setUp() self.url = "/projects/%s/add_pagertree/" % self.project.code def t...
bsd-3-clause
8ffc3c9f7fcda1de8f0c8d41f2334fb3
33.78
76
0.655549
3.578189
false
true
false
false
healthchecks/healthchecks
hc/api/migrations/0027_auto_20161213_1059.py
2
1514
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-12-13 10:59 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("api", "0026_auto_20160415_1824")] operations = [ migrations.AddField( model_...
bsd-3-clause
dea1f54332860962b573a94578efaae1
29.28
72
0.439894
4.519403
false
false
false
false
onepercentclub/onepercentclub-site
apps/vouchers/urlsapi.py
1
1059
from django.conf.urls import patterns urlpatterns = patterns('', # Voucher code is disabled for now. # # surl(r'^orders/<order_pk:#>/vouchers/$', OrderVoucherList.as_view(), name='fund-order-voucher-list'), # surl(r'^orders/<order_pk:#>/vouchers/<pk:#>$', OrderVoucherDetail.as_view(), name='fund-order...
bsd-3-clause
9ede93cdf5fa04335e6d4d8f3c4219b2
57.833333
142
0.668555
3.078488
false
false
false
false
onepercentclub/onepercentclub-site
apps/donations/wallposts.py
1
2096
from django.contrib.contenttypes.models import ContentType from django.db.models.signals import post_save from django.dispatch.dispatcher import receiver from apps.fund.models import Donation, DonationStatuses from bluebottle.wallposts.models import SystemWallPost @receiver(post_save, weak=False, sender=Donation) de...
bsd-3-clause
fa910593ded95419a750efaef6b38ded
40.92
109
0.555821
4.39413
false
false
false
false
onepercentclub/onepercentclub-site
apps/fund/migrations/0008_payout_status.py
1
32490
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): orm['payouts.ProjectPayout'].objects.filter(status='completed').update(status='settled') orm['payouts.ProjectPayo...
bsd-3-clause
74d1ff664b6bac7aef2f9063a94ec4d9
93.723032
197
0.557495
3.586093
false
false
false
false
onepercentclub/onepercentclub-site
apps/bluebottle_salesforce/sync.py
1
33097
import logging from apps.recurring_donations.models import MonthlyDonor from bluebottle.payments.models import OrderPayment import re from django.utils import timezone from registration.models import RegistrationProfile from apps.cowry_docdata.models import payment_method_mapping from apps.projects.models import Projec...
bsd-3-clause
644c2fd720ca6f942d5cd214d118d925
39.659705
120
0.637641
3.945756
false
false
false
false
onepercentclub/onepercentclub-site
apps/organizations/forms.py
1
1111
from django import forms from django.contrib.admin.widgets import AdminFileWidget from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from django.utils.encoding import force_text from django.utils.html import conditional_escape, format_html from django.utils.safestring import...
bsd-3-clause
bad99b69d4fc94e78fcba66fc8447285
29.027027
71
0.643564
4.306202
false
false
false
false
onepercentclub/onepercentclub-site
apps/recurring_donations/tests/test_api.py
1
4512
from bluebottle.bb_projects.models import ProjectPhase from bluebottle.geo.models import Country from bluebottle.test.factory_models.accounts import BlueBottleUserFactory from bluebottle.test.factory_models.geo import CountryFactory from django.core.urlresolvers import reverse from onepercentclub.tests.factory_models.p...
bsd-3-clause
600472e4c7ee571cc630b236154619e3
51.465116
131
0.682846
3.893011
false
true
false
false
jamesoff/simplemonitor
simplemonitor/Alerters/nc.py
1
1456
""" SimpleMonitor alerts via macOS Notification Center """ import platform try: import pync PYNC_AVAILABLE = True except ImportError: PYNC_AVAILABLE = False from ..Monitors.monitor import Monitor from .alerter import Alerter, AlertLength, AlertType, register @register class NotificationCenterAlerter(A...
bsd-3-clause
209fba4c7b4ffdfe9b9d891b4d52144b
28.12
83
0.635302
4.044444
false
false
false
false
jamesoff/simplemonitor
simplemonitor/Monitors/file.py
1
1619
""" File-based monitors for SimpleMonitor """ import os import os.path import time from .monitor import Monitor, register @register class MonitorBackup(Monitor): """ Monitor Veritas BackupExec May be out of date """ monitor_type = "backup" filename = os.path.join( "C:\\", "Program ...
bsd-3-clause
9fd82d197e3ce1ed683771c6a4b8805c
24.698413
80
0.565781
4.119593
false
false
false
false
jamesoff/simplemonitor
simplemonitor/Loggers/seq.py
1
3076
""" Simplemonitor logger for seq Inspiration from https://raw.githubusercontent.com/eifinger/appdaemon-scripts/master/seqSink/seqSink.py """ import datetime import json from typing import cast import requests from ..Monitors.monitor import Monitor from .logger import Logger, register @register class SeqLogger(Log...
bsd-3-clause
ca8ec1a422deb10c9ef21777cfe0c3d3
29.156863
86
0.54974
4.344633
false
false
false
false
jamesoff/simplemonitor
simplemonitor/util/envconfig.py
1
2768
"""A version of ConfigParser which supports subsitutions from environment variables.""" import os import re from configparser import BasicInterpolation, ConfigParser from typing import Any, List, Optional class EnvironmentAwareConfigParser(ConfigParser): """A subclass of ConfigParser which allows %env:VAR% inter...
bsd-3-clause
ae732f2c01baa6277fa8242ed5236462
37.444444
96
0.569364
4.707483
false
true
false
false
dieseldev/diesel
tests/unit/test_pipeline.py
1
3297
#12345678 # That comment above matters (used in the test!) from diesel.pipeline import Pipeline, PipelineClosed, PipelineCloseRequest from cStringIO import StringIO FILE = __file__ if FILE.endswith('.pyc') or FILE.endswith('.pyo'): FILE = FILE[:-1] def test_add_string(): p = Pipeline() assert (p.add("foo"...
bsd-3-clause
d5031886b9134162510f05210359feaa
20.98
74
0.544131
2.94375
false
true
false
false
dieseldev/diesel
examples/udp_echo.py
1
1225
# vim:ts=4:sw=4:expandtab '''Simple udp echo server and client. ''' import sys from diesel import ( UDPService, UDPClient, call, send, datagram, quickstart, receive, ) class EchoClient(UDPClient): """A UDPClient example. Very much like a normal Client but it can only receive datagrams from the wire. ...
bsd-3-clause
710269079a1aa5de581b4a9c3a924c38
24.520833
77
0.64898
3.816199
false
false
false
false
dieseldev/diesel
examples/convoy.py
1
1416
from diesel.convoy import convoy, ConvoyRole import kv_palm convoy.register(kv_palm) from kv_palm import ( GetRequest, GetOkay, GetMissing, SetRequest, SetOkay ) class KvNode(ConvoyRole): limit = 1 def __init__(self): self.values = {} ConvoyRole.__init__(self) def ha...
bsd-3-clause
f31a8506b9912d207e61236584b50ebd
30.466667
107
0.618644
3.232877
false
false
false
false
dieseldev/diesel
diesel/convoy/__init__.py
1
12398
from collections import defaultdict from uuid import uuid4 from time import time from random import choice import operator as op from palm.palm import ProtoBase from functools import partial from diesel import quickstart, Thunk, sleep, log, fork from diesel.util.queue import Queue, first from diesel.logmod import LOGL...
bsd-3-clause
12d76ca5daa8c27daf34d9b3e571af9c
33.34349
106
0.517503
4.043705
false
false
false
false
topazproject/topaz
topaz/objects/fiberobject.py
1
6701
import copy from rpython.rlib import jit from rpython.rlib.rstacklet import StackletThread from topaz.interpreter import RaiseReturn, RaiseBreak from topaz.module import ClassDef from topaz.objects.objectobject import W_Object class State(object): def __init__(self, space): self.current = None def ...
bsd-3-clause
5a4e5e255ed8dd772b44da0f5bef94ba
35.221622
136
0.635875
3.66977
false
false
false
false
topazproject/topaz
topaz/modules/ffi/ffi.py
1
3964
from __future__ import absolute_import from topaz.error import RubyError from topaz.module import ModuleDef from topaz.modules.ffi.type import (POINTER, lltype_sizes, W_TypeObject, type_names, W_BuiltinType) from topaz.modules.ffi.function import W_FFIFunctionObject from topaz.modul...
bsd-3-clause
b56c2b333d84113234193e5887414383
46.190476
76
0.628406
3.684015
false
false
false
false
topazproject/topaz
tests/jit/test_instance_vars.py
2
6469
from .base import BaseJITTest class TestInstanceVars(BaseJITTest): def test_initialize(self, topaz, tmpdir): traces = self.run(topaz, tmpdir, """ class A def initialize @a = 1 @b = 2 @c = 3 end end i = 0 while i < 1000...
bsd-3-clause
f273dd63ce7450d2edeeab7ba804e21d
46.218978
103
0.585716
2.85481
false
false
false
false
topazproject/topaz
tests/objects/test_classobject.py
3
3295
import pytest from ..base import BaseTopazTest class TestClassObject(BaseTopazTest): def test_name(self, space): space.execute("Class") def test_generated_subclass(self, space): w_res = space.execute(""" class Foo class Bar class Baz end end...
bsd-3-clause
9c44ab4a68476a0ff8f6feb0948816f6
26.923729
80
0.537481
3.403926
false
true
false
false
klen/peewee_migrate
tests/test_migrator.py
1
4700
import peewee as pw def test_migrator(): from playhouse.db_url import connect from peewee_migrate import Migrator database = connect("sqlite:///:memory:") migrator = Migrator(database) @migrator.create_table class Customer(pw.Model): name = pw.CharField() assert Customer == mig...
bsd-3-clause
e3df67426fc8345361ec6c0992f2160b
27.484848
87
0.669149
3.790323
false
false
false
false
dokterbob/satchmo
satchmo/apps/satchmo_store/shop/templatetags/satchmo_currency.py
14
1159
from decimal import Decimal, InvalidOperation from django import template from django.utils.safestring import mark_safe from l10n.utils import moneyfmt from satchmo_utils.templatetags import get_filter_args import logging log = logging.getLogger("satchmo_currency") register = template.Library() def currency(value, ...
bsd-3-clause
cb083b70ae68579f53684b1e307ae054
26.595238
68
0.686799
4.010381
false
false
false
false
dokterbob/satchmo
satchmo/apps/shipping/modules/canadapost/shipper.py
5
7138
''' Canada Post Shipping Module v0.1.1 ''' # Note, make sure you use decimal math everywhere! from decimal import Decimal from django.core.cache import cache from django.template import loader, Context from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ from livesettings i...
bsd-3-clause
c59f541a46de2707b9a800c813a1f222
33.483092
130
0.550714
4.312991
false
false
false
false
dokterbob/satchmo
satchmo/apps/shipping/modules/tieredquantity/models.py
13
7113
""" Tiered shipping models """ from decimal import Decimal from django.conf import settings from django.db import models from django.utils.translation import get_language, ugettext_lazy as _ from shipping.modules.base import BaseShipper import datetime import logging import operator log = logging.getLogger('shipping.T...
bsd-3-clause
0d52ac7a5223cdff87071abb03ef6681
30.334802
119
0.578237
4.316141
false
false
false
false
dokterbob/satchmo
satchmo/apps/shipping/modules/usps/shipper.py
5
13163
""" USPS Shipping Module You must have a USPS account to use this module. You may register at usps.com This module uses the XML online tools for maximum flexibility. It is primarily created for use in the US but reconfiguring for international shipping or more advanced uses should be straightforward. It is recommend...
bsd-3-clause
01afecf8cf0b5e164b8f1ecfa02c8862
36.933718
108
0.538631
4.153676
false
false
false
false
dokterbob/satchmo
satchmo/apps/satchmo_ext/brand/templatetags/satchmo_brands.py
13
1239
"""Tags for manipulating brands on templates.""" from django.template import Library, Node, TemplateSyntaxError from satchmo_ext.brand.models import Brand from satchmo_utils.templatetags import get_filter_args register = Library() class BrandListNode(Node): """Template Node tag which pushes the brand list into t...
bsd-3-clause
f8079a0fbdd9a04c24f18ac7ea5037cc
29.219512
100
0.639225
3.971154
false
false
false
false
dokterbob/satchmo
satchmo/apps/shipping/modules/fedex/shipper.py
4
10772
''' FedEx Shipping Module v0.4 By Neum Schmickrath - www.pageworthy.com You must have a Fedex account to use this module. You may register at fedex.com ''' from decimal import Decimal from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe from django.template import loader, ...
bsd-3-clause
143bb423f48685ef73c81a77cbce0fff
34.906667
136
0.567118
4.45124
false
false
false
false
dokterbob/satchmo
satchmo/apps/satchmo_store/shop/views/orders.py
13
1715
from django.contrib.auth.decorators import login_required from django.shortcuts import render_to_response from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ from satchmo_store.contact.models import Contact from satchmo_store.shop.models import Order from satchmo_utils.vie...
bsd-3-clause
7488303d082a399beba8b4df08b6427f
34
120
0.689213
3.997669
false
true
false
false
dokterbob/satchmo
satchmo/apps/satchmo_utils/cookies.py
13
3056
"""From http://www.davidcramer.net/code/62/set-cookies-without-a-response-in-django.html Used with permission. Thank you David Cramer. To install, add the prehandler to the beginning of your middleware list, and the posthandler to the end. Then, you can use request.COOKIES.get|set|delete anywhere in the code and th...
bsd-3-clause
e69242c12d6ceedf0f61ffe4f14b4204
34.137931
227
0.606348
3.933076
false
false
false
false
dokterbob/satchmo
satchmo/apps/satchmo_ext/newsletter/simple.py
13
1676
""" Just tracks subscriptions, nothing more. """ from satchmo_ext.newsletter.models import Subscription from django.utils.translation import ugettext as _ import logging log = logging.getLogger('simple newsletter') def is_subscribed(contact): return Subscription.email_is_subscribed(contact.email) def update_con...
bsd-3-clause
cad8c28d026cda3c263924c88cdb8fa2
30.037037
74
0.588305
4.422164
false
false
false
false
dokterbob/satchmo
scripts/clonesatchmo.py
1
6127
#!/usr/bin/env python """ This is the installation script for Satchmo. It will create the base Satchmo configuration. Before running this script, you must have python and pip installed. It is also recommended that you install Python Imaging using your distribution's package method. The simplest way to install Satchmo...
bsd-3-clause
fa49a8b9effea257a7c1aeec510361ec
39.309211
139
0.654643
3.601999
false
false
false
false
dokterbob/satchmo
satchmo/apps/product/prices.py
13
2704
from decimal import Decimal from l10n.utils import moneyfmt import datetime def get_product_quantity_adjustments(product, qty=1, parent=None): """Gets a list of adjustments for the price found for a product/qty""" qty_discounts = product.price_set.exclude( expires__isnull=False, expires__lt=da...
bsd-3-clause
ae95b91ed399be4b8d1f4d971336cef4
29.044444
94
0.620192
4.16641
false
false
false
false
dokterbob/satchmo
satchmo/apps/payment/modules/sagepay/forms.py
12
4637
"""Sage Pay Form""" from django import forms from django.utils.translation import ugettext as _ from livesettings import config_value from payment.forms import CreditPayShipForm, MONTHS from payment.modules.sagepay.config import REQUIRES_ISSUE_NUMBER import datetime import logging log = logging.getLogger('payment.sage...
bsd-3-clause
2d40710f7227c002b705345f1d13d443
40.401786
118
0.589821
3.997414
false
false
false
false
django/djangosnippets.org
cab/forms.py
1
2453
from django import forms from django.contrib import admin from .models import VERSIONS, Language, Snippet, SnippetFlag def validate_non_whitespace_only_string(value): """ Additionally to requiring a non-empty string, this validator also strips the string to treat strings with only whitespaces in them as ...
bsd-3-clause
e3d8e3adc241afe2ed834b9fd6d5d98e
37.328125
106
0.682837
3.9248
false
false
false
false
django/djangosnippets.org
djangosnippets/settings/production.py
1
4022
from __future__ import absolute_import import os from urllib import parse import dj_database_url import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration from .base import * # noqa: F403 def env_to_bool(input): """ Must change String from environment variable into Boolean default...
bsd-3-clause
17ed465bc7527125066324a22ba4ea30
28.144928
112
0.63277
3.351667
false
false
false
false
django/djangosnippets.org
cab/templatetags/cab_tags.py
1
1078
from django import template from django.contrib.postgres.search import SearchVector from ..models import Bookmark, Snippet, SnippetFlag register = template.Library() @register.filter def is_bookmarked(snippet, user): """ {% if snippet|is_bookmarked:request.user %} already bookmarked {% else %} ...
bsd-3-clause
3358f89f20212cc4326265db310bb03a
24.069767
80
0.641929
3.85
false
false
false
false
scrapy/scrapy
scrapy/commands/startproject.py
1
4041
import re import os import string from importlib.util import find_spec from pathlib import Path from shutil import ignore_patterns, move, copy2, copystat from stat import S_IWUSR as OWNER_WRITE_PERMISSION import scrapy from scrapy.commands import ScrapyCommand from scrapy.utils.template import render_templatefile, str...
bsd-3-clause
8fac05b01fb7be6c3ca3c68a78ce4a85
31.328
115
0.594407
3.930934
false
false
false
false
scrapy/scrapy
scrapy/http/request/rpc.py
4
1087
""" This module implements the XmlRpcRequest class which is a more convenient class (that Request) to generate xml-rpc requests. See documentation in docs/topics/request-response.rst """ import xmlrpc.client as xmlrpclib from typing import Optional from scrapy.http.request import Request from scrapy.utils.python impo...
bsd-3-clause
6be47b87c21042a003c0aa0cda5bc0e5
30.057143
79
0.670653
4.05597
false
false
false
false
scrapy/scrapy
scrapy/mail.py
4
5156
""" Mail sending helpers See documentation in docs/topics/email.rst """ import logging from email import encoders as Encoders from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart from email.mime.nonmultipart import MIMENonMultipart from email.mime.text import MIMEText from email.utils im...
bsd-3-clause
356ee91640fecb855e19a66b39ccdcdc
34.558621
112
0.594841
3.730825
false
false
false
false
scrapy/scrapy
scrapy/utils/signal.py
4
3107
"""Helper functions for working with signals""" import collections.abc import logging from twisted.internet.defer import DeferredList, Deferred from twisted.python.failure import Failure from pydispatch.dispatcher import Anonymous, Any, disconnect, getAllReceivers, liveReceivers from pydispatch.robustapply import rob...
bsd-3-clause
00930e85092403c72b88ce8c303d46dc
38.833333
104
0.655938
4.273728
false
false
false
false
scrapy/scrapy
scrapy/commands/settings.py
3
1803
import json from scrapy.commands import ScrapyCommand from scrapy.settings import BaseSettings class Command(ScrapyCommand): requires_project = False default_settings = {'LOG_ENABLED': False, 'SPIDER_LOADER_WARN_ONLY': True} def syntax(self): return "[options]" def ...
bsd-3-clause
e11e39f95819e947902a363f8b4027ea
37.361702
82
0.583472
4.419118
false
false
false
false
scrapy/scrapy
scrapy/downloadermiddlewares/ajaxcrawl.py
7
3280
import re import logging from w3lib import html from scrapy.exceptions import NotConfigured from scrapy.http import HtmlResponse logger = logging.getLogger(__name__) class AjaxCrawlMiddleware: """ Handle 'AJAX crawlable' pages marked as crawlable via meta tag. For more info see https://developers.goog...
bsd-3-clause
d05ec132bc62b8b25468a0fdbafeb89e
34.268817
117
0.641768
3.78316
false
false
false
false
turbulenz/gyp
test/compiler-override/gyptest-compiler-env-toolchain.py
94
2877
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies that the user can override the compiler and linker using CC/CXX/NM/READELF environment variables. """ import TestGyp import os i...
bsd-3-clause
bcfb2fa97b0b6ad50f65a2d00d658acf
35.884615
79
0.698297
3.23622
false
true
false
false
djc/couchdb-python
setup.py
1
2269
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2007-2009 Christopher Lenz # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. import sys try: from setuptools import setup has_setuptools = True exc...
bsd-3-clause
fe60f894f1c943153b2b4f69c95e2767
32.367647
97
0.615249
3.852292
false
false
false
false
turbulenz/gyp
test/prune_targets/gyptest-prune-targets.py
47
2285
#!/usr/bin/env python # Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies --root-target removes the unnecessary targets. """ import TestGyp test = TestGyp.TestGyp() # The xcode-ninja generator has it...
bsd-3-clause
36101a7a1308cffa6f2f76ab9f210beb
33.621212
77
0.708096
2.831475
false
true
false
false
djc/couchdb-python
couchdb/view.py
1
7322
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2007-2008 Christopher Lenz # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. """Implementation of a view server for functions written in Python.""" from c...
bsd-3-clause
f16b4a58407af5c1dfeee51ae48ccf28
30.157447
78
0.521989
4.186392
false
false
false
false
turbulenz/gyp
pylib/gyp/input_test.py
10
3195
#!/usr/bin/env python # Copyright 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Unit tests for the input.py file.""" import gyp.input import unittest import sys class TestFindCycles(unittest.TestCase): def setUp(self...
bsd-3-clause
5401839cb575aca0d3ee313ef0290d75
34.5
76
0.604695
3.573826
false
true
false
false
jjhelmus/nmrglue
nmrglue/analysis/peakpick.py
2
19775
""" Peak picking routines, lineshape parameter guessing, and related functions. """ import numpy as np import scipy.ndimage as ndimage from .analysisbase import ndwindow_index, valid_pt from .lineshapes1d import gauss, ls_str2class from .segmentation import find_all_downward, find_all_upward from .segmentation import...
bsd-3-clause
99d6728fcc99524ea011a3e02614ca23
34.249554
79
0.600708
4.054747
false
false
false
false
jjhelmus/nmrglue
tests/pipe_proc_tests/ext.py
4
1927
#! /usr/bin/env python """ Create files for ext unit test """ from subprocess import check_call import nmrglue.fileio.pipe as pipe import nmrglue.process.pipe_proc as p d, a = pipe.read("time_complex.fid") d, a = p.ext(d, a, left=True, sw=True) pipe.write("ext1.glue", d, a, overwrite=True) d, a = pipe.read("time_co...
bsd-3-clause
332dc1c06911dc9afa8cd87ee80c7288
26.927536
60
0.629476
2.225173
false
false
false
false
jobovy/galpy
galpy/potential/PerfectEllipsoidPotential.py
1
3638
############################################################################### # PerfectEllipsoidPotential.py: Potential of the perfect ellipsoid # (de Zeeuw 1985): # # \rho(x,y,z) ~ 1/(1+m^2)^2 # # with m^2 = x^2+y^2/b^2...
bsd-3-clause
784a91f31987311202d5723d8c902d88
31.774775
122
0.512644
3.60198
false
false
false
false
jobovy/galpy
doc/source/examples/dierickx-edist.py
1
2765
import csv import os import os.path import cPickle as pickle import numpy as nu from galpy.orbit import Orbit from galpy.potential import (HernquistPotential, LogarithmicHaloPotential, MiyamotoNagaiPotential, NFWPotential) from galpy.util import plot _degtorad= nu.pi/180. def calc_es(): ...
bsd-3-clause
6a73e997c6757a5c20ca926d8a3ed7f2
28.414894
96
0.552622
2.995666
false
false
false
false
jobovy/galpy
galpy/potential/AnySphericalPotential.py
1
4735
############################################################################### # AnySphericalPotential: Potential of an arbitrary spherical density ############################################################################### import numpy from scipy import integrate from ..util import conversion from ..util._opti...
bsd-3-clause
d9b01e08cf2aca655c83de6626e7bca2
39.470085
135
0.51679
4.005922
false
false
false
false
jobovy/galpy
galpy/actionAngle/actionAngleTorus.py
1
9521
############################################################################### # class: actionAngleTorus # # Use McMillan, Binney, and Dehnen's Torus code to calculate (x,v) # given actions and angles # # ############################################################################### impor...
bsd-3-clause
fa08b5737213eecad0ce3dce4223c3a5
29.225397
253
0.553093
3.509399
false
false
false
false
jobovy/galpy
galpy/potential/BurkertPotential.py
1
4240
############################################################################### # BurkertPotential.py: Potential with a Burkert density ############################################################################### import numpy from scipy import special from ..util import conversion from .SphericalPotential import ...
bsd-3-clause
e73e1f79b05d3ceb3ec2c867d6d9bc78
33.471545
134
0.461792
3.533333
false
false
false
false
jobovy/galpy
galpy/actionAngle/actionAngleVertical.py
1
6501
############################################################################### # actionAngle: a Python module to calculate actions, angles, and frequencies # # class: actionAngleVertical # # methods: # Jz # anglez # Tz # calczmax # calcEz ##...
bsd-3-clause
cb6c35370fa939c39e03c25236fa4397
28.958525
98
0.50423
3.817381
false
false
false
false
jobovy/galpy
galpy/potential/AnyAxisymmetricRazorThinDiskPotential.py
1
9827
############################################################################### # AnyAxisymmetricRazorThinDiskPotential.py: class that implements the # potential of an arbitrary # axisymmetric, razor-thin disk ####################...
bsd-3-clause
05cfffbde9eef66387875a741ecdf59e
34.222222
172
0.479597
3.352781
false
false
false
false
jobovy/galpy
galpy/potential/Cautun20.py
1
3326
# Cautun (2020) potential # Thanks to Thomas Callingham (Durham University, UK) which implemented the potential within galpy import numpy from ..potential import (AdiabaticContractionWrapperPotential, DiskSCFPotential, NFWPotential, PowerSphericalPotentialwCutoff, SCFP...
bsd-3-clause
a95fa0973e4e0e70a9e80bac97400989
35.955556
98
0.615153
2.493253
false
false
false
false
jobovy/galpy
galpy/potential/McMillan17.py
1
2549
# McMillan (2017) potential as first implemented in the galpy framework by # Mackereth & Bovy (2018) import numpy from ..potential import (DiskSCFPotential, NFWPotential, SCFPotential, mwpot_helpers, scf_compute_coeffs_axi) from ..util import conversion # Suppress the numpy floating-point war...
bsd-3-clause
d65cc1c04cb8c830e93daa3d898ead49
32.539474
79
0.652413
2.334249
false
false
false
false
jobovy/galpy
galpy/potential/RingPotential.py
1
6425
############################################################################### # RingPotential.py: The gravitational potential of a thin, circular ring ############################################################################### import numpy from scipy import special from ..util import conversion from .Potential...
bsd-3-clause
5b5b89e65be86f23e220671d24260424
31.780612
258
0.494163
3.28141
false
false
false
false
jobovy/galpy
galpy/df/constantbetaHernquistdf.py
1
3488
# Class that implements the anisotropic spherical Hernquist DF with constant # beta parameter import numpy import scipy.integrate import scipy.special from ..potential import HernquistPotential, evaluatePotentials from ..util import conversion from .constantbetadf import _constantbetadf class constantbetaHernquistdf...
bsd-3-clause
a80bab8a8b6e416cc7c092f1c2b2dd5d
32.219048
99
0.564507
3.450049
false
false
false
false
jobovy/galpy
galpy/util/ars.py
1
14076
############################################################################# #Copyright (c) 2011, Jo Bovy #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: # # Redistributions of source code must re...
bsd-3-clause
8a7c2a5c67783feff22e832e81ef3d03
36.43617
137
0.574737
3.038204
false
false
false
false
jobovy/galpy
galpy/util/symplecticode.py
1
4554
############################################################################# #Symplectic ODE integrators #Follows scipy.integrate.odeint inputs as much as possible ############################################################################# #############################################################################...
bsd-3-clause
6ad6b18aba06e31b59e03fe2cd0b608a
38.947368
79
0.610233
3.385874
false
false
false
false
jobovy/galpy
galpy/potential/SolidBodyRotationWrapperPotential.py
1
2266
############################################################################### # SolidBodyRotationWrapperPotential.py: Wrapper to make a potential rotate # with a fixed pattern speed, around # the z axis #################################...
bsd-3-clause
c7e3f342dcd7f7c98fbb28fc4155dbdf
30.041096
179
0.530891
4.307985
false
false
false
false
jobovy/galpy
galpy/potential/AdiabaticContractionWrapperPotential.py
1
7099
############################################################################### # AdiabaticContractionWrapperPotential.py: Wrapper to adiabatically # contract a DM halo in response # to the growth of a baryonic # ...
bsd-3-clause
9da6afa1de9a307b96cc24006920633c
46.966216
387
0.58473
3.464617
false
false
false
false
sergiocorreia/panflute
panflute/table_elements.py
1
13625
""" Classes corresponding to Pandoc Table elements """ # --------------------------- # Imports # --------------------------- from .utils import decode_ica, check_group, check_type, check_type_or_value, encode_dict, debug from .containers import ListContainer from .base import Element, Block, Inline # -------------...
bsd-3-clause
b2ee32d8d8e2844956e7500d9248d785
32.893035
141
0.606018
3.740049
false
false
false
false