code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- mode: python; c-basic-offset: 2; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
## gearman-interface: Interface Wrappers for Gearman
## Copyright (C) 2009 Sun Microsystems, Inc.
## Copyright (C) 2009 David Lenwell
##
## This program is free software; y... | emonty/gearman-interface | python3/test_worker.py | Python | bsd-3-clause | 1,401 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Kristofer Monisit'
__email__ = 'kmonisit@gmail.com'
__version__ = '0.1.0'
from microlab_instruments import \
Arceus, \
Meloetta, \
Xerneas, \
Darkrai, \
Deoxys, \
Genesect, \
Giratina, \
Heatran, \
Ho_oh, \
Kyurem, \
... | kitmonisit/microlab-instruments | microlab_instruments/__init__.py | Python | bsd-3-clause | 472 |
from setuptools import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['roscreate'],
package_dir={'': 'src'},
scripts=['scripts/roscreate-pkg'],
requires=['roslib', 'rospkg']
)
setup(**d)
| ros/ros | tools/roscreate/setup.py | Python | bsd-3-clause | 265 |
import getpass
import os
import simplejson
import socket
import sys
import time
import urllib2
import urlparse
import traceback
from conpaas.core.https import client
class HTTPMethod(object):
GET, POST, DELETE = range(3)
class BaseClient(object):
def __init__(self, logger):
self.logger = logger
... | ConPaaS-team/conpaas | cps-tools/src/cps_tools/base.py | Python | bsd-3-clause | 14,047 |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0055_daily_consumption'),
]
operations = [
migrations.AddField(
model_name='ledgervalue',
name='last_modified_form_id',
field=models.Ch... | dimagi/commcare-hq | corehq/form_processor/migrations/0056_last_modified_form_id.py | Python | bsd-3-clause | 408 |
from __future__ import absolute_import
from mock import patch, MagicMock
from django.core import mail
from util.tests.test_email_notification.base import EmailBaseTest
SUBJECT_TASK_SCHEDULE_CREATED = (
'[DBaaS] Automatic Task created for Database {}'
)
SUBJECT_TASK_SCHEDULE_UPDATED = (
'[DBaaS] Automatic Ta... | globocom/database-as-a-service | dbaas/dbaas/tests/test_send_mail_helper.py | Python | bsd-3-clause | 6,321 |
"""Make step-by-step solution. """
import gc, sys
from sympy.printing.latex import LatexPrinter
from sympy.printing.mathml import MathMLPrinter
from sympy.core import sympify
from sympy.utilities.solution_en import solution_comment_table_en
from sympy.utilities.solution_ru import solution_comment_table_ru
solution_li... | hrashk/sympy | sympy/utilities/solution.py | Python | bsd-3-clause | 2,674 |
from datetime import datetime, timedelta
from random import randint
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.utils import timezone
from devilry.apps.core.models import Node
from devilry.apps.core.models import Subject
from devilry.apps.core.models import Period
from ... | devilry/devilry-django | devilry/devilry_sandbox/sandbox.py | Python | bsd-3-clause | 4,704 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import errno
from exhibitionist import get_server
from exhibitionist.exceptions import ExhibitionistError
import unittest
from exhibitionist.objectRegistry import ObjectRegistry
from exhibitionist.toolbox import ExhibitionistRequestHandler
context = None ... | kentfrazier/Exhibitionist | exhibitionist/tests/test_server.py | Python | bsd-3-clause | 9,257 |
"""
Belief propagation iterations for binary tomography reconstruction
"""
import numpy as np
from solve_lines import solve_line, solve_uncoupled_line
try:
from joblib import Parallel, delayed
joblib_import = True
except ImportError:
joblib_import = False
if not joblib_import:
try:
from sklearn.... | eddam/bp-for-tomo | bptomo/bp_reconstruction.py | Python | bsd-3-clause | 19,377 |
def extractIsekaintrWordpressCom(item):
'''
Parser for 'isekaintr.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Saint Doll', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractIsekaintrWordpressCom.py | Python | bsd-3-clause | 1,418 |
"""
Note that sometimes you will get duplicate signals emitted, depending on configuration of your systems.
If you do encounter this, you will need to add the "dispatch_uid" to your connect handlers:
http://code.djangoproject.com/wiki/Signals#Helppost_saveseemstobeemittedtwiceforeachsave
"""
from __future__ import uni... | aldenjenkins/foobargamingwebsite | paypal/standard/ipn/signals.py | Python | bsd-3-clause | 3,143 |
#coding:utf-8
import web
from app.views import wrapper as views
from app.views import render
from app.models import wtdata
from app.controllers import auth
class index:
def GET(self):
categories = wtdata.get_super_categories()
currrent_userid = auth.get_current_userid()
if str(currrent_us... | minixalpha/WatchTips | app/controllers/base.py | Python | bsd-3-clause | 942 |
import json
from django.contrib.gis.gdal import DataSource
from django.core.management import BaseCommand
from django.db.models import Value
from core.mixins import ReadFromFileMixin
from core.models import JsonbSet
from elections.models import Election
def get_layer(data, layer_index=0):
data_source = DataSour... | DemocracyClub/EveryElection | every_election/apps/elections/management/commands/add_tags.py | Python | bsd-3-clause | 3,037 |
#!/usr/bin/env python
import gbp.deb as du
import os
import sys
DEB_VERSION = du.parse_changelog(filename="debian/changelog")["Version"]
BASE_VERSION = DEB_VERSION.split('-')[0]
print "Base version: %s" % BASE_VERSION
ORIG_FILENAME = '../webilder_%s.orig.tar.gz' % BASE_VERSION
if os.path.exists(ORIG_FILENAME):
os... | thesamet/webilder | build_dep.py | Python | bsd-3-clause | 639 |
"""Client/manager side object for querying Agent via PySNMP v3"""
from twisted.internet import defer, reactor
from twisted.python import failure
from twistedsnmp.pysnmpproto import v2c,v1, error, oid, cacheOIDEncoding
from twistedsnmp.pysnmpproto import CAN_CACHE_OIDS, USE_STRING_OIDS
from twistedsnmp.pysnmpproto impor... | mmattice/TwistedSNMP | v3/agentproxy.py | Python | bsd-3-clause | 12,644 |
import urlparse
from collections import namedtuple
PageRequest = namedtuple(
'PageRequest',
['path', 'http_method', 'occurrences', 'total_time', 'avg_time'])
class SlowPages(object):
def __init__(self, parsed_data, slow_threshold):
self.parsed_data = parsed_data
self.slow_threshold = slow_... | winhamwr/django-mature-optimization | mature_optimization/analyze.py | Python | bsd-3-clause | 1,681 |
#!/usr/bin/env python
from distutils.core import setup
setup(
name="Djapian",
version="2.3",
license="New BSD License",
author='Alex Koshelev, Rafael "SDM" Sierra',
author_email="daevaorn@gmail.com",
url="http://code.google.com/p/djapian/",
packages=[
"djapian",
"djapia... | adalekin/djapian | setup.py | Python | bsd-3-clause | 718 |
def import_sphinx():
"""
sphinx is an optional extra, so only load it when necessary
"""
try:
import sphinx
except ImportError:
raise ImportError(
"Sphinx is not installed. "
"Please install ipypublish with the sphinx extras: "
">> pip install ipyp... | chrisjsewell/ipypublish | ipypublish/sphinx/utils.py | Python | bsd-3-clause | 463 |
import os
import tempfile
import pytest
import diofant
from diofant import Eq, Idx, IndexedBase, sin, symbols
from diofant.abc import a, b, c
from diofant.external import import_module
from diofant.utilities.autowrap import (CodeWrapError, F2PyCodeWrapper,
autowrap, ufuncify)
... | skirpichev/omg | diofant/tests/external/test_autowrap.py | Python | bsd-3-clause | 7,694 |
from django.utils.functional import LazyObject
__version__ = '1.1.0.internal.1'
default_app_config = 'constance.apps.ConstanceConfig'
class LazyConfig(LazyObject):
def _setup(self):
from .base import Config
self._wrapped = Config()
config = LazyConfig()
| dmugtasimov/django-constance | constance/__init__.py | Python | bsd-3-clause | 279 |
"""\
optitrack.csv_reader : a plain-Python parser for reading Optitrack CSV files in version 1.2 or 1.21 format.
This uses only Python modules common between CPython, IronPython, and
RhinoPython for compatibility with both Rhino and offline testing.
Reference for the format: http://wiki.optitrack.com/index.php?title=... | cmuphyscomp/hmv-s16 | python/optitrack/csv_reader.py | Python | bsd-3-clause | 10,105 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-17 14:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ussd', '0001_initial'),
]
operations = [
m... | dirkcuys/save4life | ussd/migrations/0002_auto_20161017_1422.py | Python | bsd-3-clause | 2,145 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
import os
README = os.path.join(os.path.dirname(__file__), 'README.md')
setup(
name='toastbot',
version='0.4.3',
description='A clean, extensible IRC bot using irckit.',
long_description=open(README, 'r').read(),
author... | toastdriven/toastbot | setup.py | Python | bsd-3-clause | 744 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 0, transform = "Integration", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Integration/trend_ConstantTrend/cycle_0/ar_12/test_artificial_1024_Integration_ConstantTrend_0_12_20.py | Python | bsd-3-clause | 272 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 - 2015 -- Lars Heuer <heuer[at]semagia.com>
# All rights reserved.
#
# License: BSD, see LICENSE.txt for more details.
#
"""\
This module provides some global constants.
:author: Lars Heuer (heuer[at]semagia.com)
:organization: Semagia - <http://www.semagia.com/>
:l... | heuer/cablemap | cablemap.core/cablemap/core/consts.py | Python | bsd-3-clause | 15,169 |
#!/usr/bin/python
from flask import request #, make_response
# List all of the views to be automatically imported here.
__all__ = ["index", "controller1", "controller2"]
def valueFromRequest(key=None, request=None, default=None, lower=False, list=False, boolean=False):
''' Convenience function to retrieve values fr... | demitri/DtU_api | dtu-api/dtu_api/controllers/__init__.py | Python | bsd-3-clause | 1,338 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2012, Dongsheng Cai
#
# 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 retain the above copyright
# notice, this ... | pathikb/airnotifier | pushservices/apns.py | Python | bsd-3-clause | 11,900 |
# -*- coding: utf-8 -*-
from biplist import *
import datetime
import os
from test_utils import *
import unittest
try:
unicode
toUnicode = lambda x: x.decode('unicode-escape')
except NameError:
unicode = str
toUnicode = lambda x: x
class TestValidPlistFile(unittest.TestCase):
def setUp(self):
... | ForrestAlfred/biplist | tests/test_valid.py | Python | bsd-3-clause | 4,192 |
#!/usr/bin/env python
'''
This module is copied from https://github.com/segwayrobotics/segway_DRIVE_benchmark/blob/master/scripts/tf_helpers.py
This module includes functions to manipulate ros transforms
As rospy depends on python, this module works with only python2.
'''
from __future__ import print_function
impor... | JzHuai0108/vio_common | python/tf_helpers.py | Python | bsd-3-clause | 7,357 |
# -*- coding: utf-8 -*-
from django import forms
from cms.models import Page
from cms.utils.urlutils import static_with_version
from .wizard_pool import entry_choices, wizard_pool
def step2_form_factory(mixin_cls, entry_form_class, attrs=None):
"""
Combines a form mixin with a form class, sets attrs to the ... | jproffitt/django-cms | cms/wizards/forms.py | Python | bsd-3-clause | 2,992 |
import debug_toolbar
from django.conf.urls import url, include
from django.http import HttpResponse
def empty_page(request):
return HttpResponse('<body></body>')
urlpatterns = [
url(r'^$', empty_page),
url(r'^__debug__/', include(debug_toolbar.urls)),
]
| BertrandBordage/django-cachalot | runtests_urls.py | Python | bsd-3-clause | 270 |
#!/usr/bin/env python
# coding: utf-8
#
# Copyright (c) 2015, PAL Team.
# All rights reserved. See LICENSE for details.
#
# Module for APIs created by the PAL team
#
# Author: Alex Simonides
class DataNotAvailableException(Exception):
pass
| Machyne/pal | api/__init__.py | Python | bsd-3-clause | 246 |
"""Functions to make simple plot on evoked M/EEG data (besides topographies)
"""
from __future__ import print_function
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Lars... | jniediek/mne-python | mne/viz/evoked.py | Python | bsd-3-clause | 70,907 |
"""Merge OpenAPI YAML files together into a single output file."""
import sys
import argparse
import yaml
from glob import glob
from openapi_spec_validator import validate_spec
from openapi_spec_validator.readers import read_from_filename
from pathlib import Path
class OpenApiTree:
"""Hold the association of the... | DataBiosphere/terra-workspace-manager | openapi/tools/merge_openapi.py | Python | bsd-3-clause | 5,979 |
# -*- coding: utf-8 -*-
from wakatime.main import execute
from wakatime.packages import requests
import logging
import os
import time
import shutil
from testfixtures import log_capture
from wakatime.compat import is_py26, u
from wakatime.constants import SUCCESS
from wakatime.exceptions import NotYetImplemented
from... | wakatime/wakatime | tests/test_dependencies.py | Python | bsd-3-clause | 16,387 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 12, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingMedian/cycle_12/ar_12/test_artificial_128_RelativeDifference_MovingMedian_12_12_0.py | Python | bsd-3-clause | 277 |
import datetime
import logging
import re
from django.utils import timezone
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django_auth_policy import signals
from django_auth_policy.models import LoginAttempt... | Dreamsolution/django-auth-policy | django_auth_policy/authentication.py | Python | bsd-3-clause | 10,726 |
from markdown import util, Extension
from markdown.blockprocessors import BlockQuoteProcessor
class NLBQExtension(Extension):
def extendMarkdown(self, md, md_globals):
md.parser.blockprocessors['quote'] = NLBQProcessor(md.parser)
class NLBQProcessor(BlockQuoteProcessor):
def run(self, parent, blocks... | atodorov/Markdown-No-Lazy-BlockQuote-Extension | nlbqx/nlbqx.py | Python | bsd-3-clause | 1,206 |
from setuptools import setup
setup(
name = 'FoundryDataBrowser',
version = '190903.1',
description = 'Data Browser for Foundry microscope data files',
#long_description =open('README.md', 'r').read(),
# Author details
author='Edward S. Barnard',
author_email='esbarnard@lbl.g... | ScopeFoundry/FoundryDataBrowser | setup.py | Python | bsd-3-clause | 963 |
import json
import sys
from pprint import pformat
import requests
import requests.auth
from . import sessions
from . import __version__
FORM = 'application/x-www-form-urlencoded; charset=utf-8'
JSON = 'application/json; charset=utf-8'
DEFAULT_UA = 'HTTPie/%s' % __version__
def get_response(args, config_dir):
... | mrmuhammed/pythonhttpie | httpie/client.py | Python | bsd-3-clause | 2,786 |
"""
Test date comparisons in drs.translate.py
"""
from test import translator
from drslib.translate import drs_dates_overlap
def check_overlap(file1, file2, expect):
drs1 = translator.filename_to_drs(file1)
drs2 = translator.filename_to_drs(file2)
assert drs_dates_overlap(drs1, drs2) == expect
tes... | ESGF/esgf-drslib | test/test_dates.py | Python | bsd-3-clause | 1,242 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import requests
from collections import namedtuple
from time import sleep
from django.core.exceptions import ObjectDoesNotExist
from django.utils.encoding import python_2_unicode_compatible
from dbaas_credentials.models import CredentialTy... | globocom/database-as-a-service | dbaas/workflow/steps/util/base.py | Python | bsd-3-clause | 17,098 |
"""
==========================
Decoding source space data
==========================
Decoding, a.k.a MVPA or supervised machine learning applied to MEG
data in source space on the left cortical surface. Here f-test feature
selection is employed to confine the classification to the potentially
relevant features. The cl... | mne-tools/mne-tools.github.io | 0.13/_downloads/plot_decoding_spatio_temporal_source.py | Python | bsd-3-clause | 5,952 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contacts', '0018_contact_is_blocked'),
]
operations = [
migrations.AddField(
model_name='group',
nam... | xkmato/casepro | casepro/contacts/migrations/0019_group_is_dynamic.py | Python | bsd-3-clause | 450 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class LoansConfig(AppConfig):
name = 'loans'
| Amandil/django-tech-test | loans/apps.py | Python | bsd-3-clause | 150 |
"""Core models used by the CMS."""
from __future__ import unicode_literals
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.core import urlresolvers
from django.db import models, connection, transaction
from django.db.models import Q, F
from django.utils.encoding imp... | danielsamuels/cms | cms/apps/pages/models.py | Python | bsd-3-clause | 15,000 |
# pylint: disable-msg=W0611, W0612, W0511
"""Tests suite for MaskedArray.
Adapted from the original test_ma by Pierre Gerard-Marchant
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
__author__ = "Pierre GF Gerard-Marchant ($... | dagss/numpy_svn | numpy/ma/tests/test_extras.py | Python | bsd-3-clause | 32,655 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'Tile hash proxy server',
'author': 'Matt Amos',
'url': 'https://github.com/mapzen/tile-hash-proxy',
'author_email': 'matt.amos@mapzen.com',
'version': '0.1',
'install_requir... | mapzen/tile-hash-proxy | setup.py | Python | bsd-3-clause | 464 |
from django.shortcuts import render_to_response
from django.views.generic import DetailView
from django.views.generic.base import TemplateView
from templation.locals import thread_locals
from templation.views import ResourceStoreMixin
from .models import MyResource
def index(request, pk):
thread_locals.resource =... | qdqmedia/django-templation | tests/views.py | Python | bsd-3-clause | 795 |
""" Thanks to the sympy project
REMINDER: remove the clock from the window and put it to the engine """
from pyglet.window import Window
from pyglet.clock import Clock
class ManagedWindow(Window):
"""
A pyglet window with an event loop which executes automatically
in a separate thread. Behavior is added b... | fos/fos-legacy | fos/core/window/managed_window.py | Python | bsd-3-clause | 3,524 |
from __future__ import absolute_import, print_function
import logging
from collections import namedtuple
from .view import ConfigureView
class MigratingIdentityId(namedtuple("MigratingIdentityId", ["id", "legacy_id"])):
"""
MigratingIdentityId may be used in the ``id`` field of an identity
dictionary to... | mvaled/sentry | src/sentry/auth/provider.py | Python | bsd-3-clause | 3,605 |
import random
import re
import uuid
from collections import defaultdict
from distutils.version import LooseVersion
from functools import wraps
from django.conf import settings
from django.db import OperationalError, connections, transaction
from django.db.utils import DEFAULT_DB_ALIAS, DatabaseError
from django.db.uti... | dimagi/commcare-hq | corehq/sql_db/util.py | Python | bsd-3-clause | 14,560 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Song.name'
db.delete_column('djpandora_song', 'name')
# Adding field 'Song.titl... | f4nt/djpandora | djpandora/migrations/0005_auto__del_field_song_name__add_field_song_title__add_field_song_album_.py | Python | bsd-3-clause | 6,364 |
#!/usr/bin/python3
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|.|c|o|m|.|t|w|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# Copyright (c) 2021, raspberrypi.com.tw
# All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# push_button_in... | raspberrypi-tw/gpio-game-console | 04_4-push_button_internal_pull_up/push_button_internal_pull_up.py | Python | bsd-3-clause | 1,020 |
from couchdbkit.ext.django.schema import Document, StringProperty, DecimalProperty
TYPE_DOMAIN = 'domain'
TYPE_PRODUCT = 'product'
TYPE_SUPPLY_POINT_TYPE = 'supply-point-type'
TYPE_SUPPLY_POINT = 'supply-point'
class DefaultConsumption(Document):
"""
Model for setting the default consumption value of an ent... | gmimano/commcaretest | corehq/apps/consumption/models.py | Python | bsd-3-clause | 1,239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Thomas Boch (github: tboch) - thomas dot boch at astro dot unistra dot fr
# Affiliation: Observatoire astronomique de Strasbourg
"""
CGI script for Simple-Cone-Search-Creator project
This script enables a Cone Search service
from a data structure previously cr... | tboch/Simple-Cone-Search-Creator | cgi/cs.py | Python | bsd-3-clause | 6,485 |
#!/usr/bin/env python
#
# Copyright 2019 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Create the asset."""
import argparse
import common # pylint: disable=unused-import
import os
import subprocess
import utils
# Remember to also update the... | youtube/cobalt | third_party/skia/infra/bots/assets/go_win/create.py | Python | bsd-3-clause | 893 |
from collections import OrderedDict
from django.db.models import Q
from django.forms import CheckboxSelectMultiple
from django.utils.translation import pgettext_lazy
from django_filters import MultipleChoiceFilter, OrderingFilter, RangeFilter
from ..core.filters import SortedFilterSet
from .models import Attribute, P... | UITools/saleor | saleor/product/filters.py | Python | bsd-3-clause | 4,137 |
from pytest_factoryboy import register
from .factories import DocumentFactory
register(DocumentFactory)
| jonasundderwolf/django-localizedfields | example/tests/conftest.py | Python | bsd-3-clause | 106 |
from tester import assertRaises
# issue 5
assert(isinstance(__debug__,bool))
# issue #6 : unknown encoding: windows-1250
s = "Dziś jeść ryby"
b = s.encode('windows-1250')
assert b == b'Dzi\x9c je\x9c\xe6 ryby'
assert b.decode('windows-1250') == "Dziś jeść ryby"
# issue #7 : attribute set on module is not available f... | jonathanverner/brython | www/tests/issues.py | Python | bsd-3-clause | 35,471 |
#!/usr/bin/env python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This tool helps with updating Git commit IDs in the
pnacl/COMPONENT_REVISIONS file to the latest commits. It creates a
Ri... | cvsuser-chromium/native_client | pnacl/deps_update.py | Python | bsd-3-clause | 6,261 |
def extractPeppermintiiTumblrCom(item):
'''
Parser for 'peppermintii.tumblr.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('18+OGPC', '18 Kin otome gēmu de, teisō o mamorinukimasu!', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractPeppermintiiTumblrCom.py | Python | bsd-3-clause | 551 |
from django.dispatch import Signal
pre_enter_atomic_block = Signal(providing_args=['using',
'outermost',
'savepoint'])
post_enter_atomic_block = Signal(providing_args=['using',
... | graingert/django_atomic_signals | django_atomic_signals/signals.py | Python | bsd-3-clause | 879 |
# -*- coding: utf-8 -*-
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This module tests the cros stage command and subfunctions."""
from __future__ import print_function
import sys
from chromite... | endlessm/chromium-browser | third_party/chromite/cli/cros/cros_stage_unittest.py | Python | bsd-3-clause | 1,850 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['PolyTrend'] , ['Seasonal_DayOfWeek'] , ['ARX'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Difference/model_control_one_enabled_Difference_PolyTrend_Seasonal_DayOfWeek_ARX.py | Python | bsd-3-clause | 162 |
def extractOtakutlsBlogspotCom(item):
'''
Parser for 'otakutls.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Blade And Sword God Soverigen', 'Blade And Sword God Soverigen'... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractOtakutlsBlogspotCom.py | Python | bsd-3-clause | 551 |
#!/usr/bin/env python
# encoding: utf-8
"""
tweets-client.py
Created by Breyten Ernsting on 2010-05-30.
Copyright (c) 2010 Back-End-Front Web Development. All rights reserved.
"""
import os
import sys
import argparse
import signal
import configparser
from functools import reduce
import socket
# disable buffering
#so... | sunlightlabs/politwoops-tweet-collector | bin/tweets-client.py | Python | bsd-3-clause | 9,699 |
import numpy as np
from math import sin, cos
class Transformation:
"""
Class that represents a transformation in 3-D space.
Transformations are represented as 4x4 affine transformation matrices.
To see more about the maths used in this class, see for example:
http://www.euclideanspace.com/maths/g... | ISISComputingGroup/EPICS-inst_servers | CollisionAvoidanceMonitor/transform.py | Python | bsd-3-clause | 6,499 |
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.forms.models import modelform_factory
from tagging.managers import ModelTaggedItemManager
from jflow.conf import settings
from jflow.db.instdata.converters import convert
from jflow.db.instdata.fields import sl... | lsbardel/flow | flow/db/instdata/managers.py | Python | bsd-3-clause | 14,549 |
import os
from settings.common import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'project',
}
}
CACHES = {
'default': {
'BACKEND': 'redis_cache.RedisCache',
'LOCATION': '127.0.0.1:6379',
'OPTIONS': {
'DB': ... | beni55/djangolint | project/settings/production.py | Python | isc | 715 |
import sys
class BaseModel(object):
def info(self, msg):
self.pdriver.info_log(
self.info_format.format(
self=self,
msg=msg
)
)
def debug(self, msg):
self.pdriver.debug_log(
self.info_format.format(
... | brome-hq/brome | example/model/basemodel.py | Python | isc | 1,878 |
#!/usr/local/bin/python3
# The MIT License (MIT)
#
# Copyright (c) 2014-2017, Institute for Software & Systems Engineering
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restric... | maul-esel/ssharp | Models/Small Models/Model3/createGraphFigure.py | Python | mit | 3,466 |
import unittest
class TestAllianceParser(unittest.TestCase):
@classmethod
def setUpClass(cls):
# html_page = get_request("")
# cls.parser = AllianceParser(html_page=html_page)
pass
# @unittest.skip("Not implemented yet")
# def test_get_engine_nb(self):
# self.assertEqu... | egenerat/gae-django | app/test/alliance/test_alliance_parser.py | Python | mit | 404 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Fabrice Laporte, Yevgeny Bezman, and Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restrict... | kelvinhammond/beets | beetsplug/replaygain.py | Python | mit | 34,016 |
import oauth2 as oauth
import urlparse
import os
import pickle
app_id = "your_app_id_here"
url = "http://%s.appspot.com/resource" % app_id
consumer_key = '%s.appspot.com' % app_id
consumer_secret = 'your_consumer_secret_here'
access_token_file = "token.dat"
request_token_url = "https://%s.appspot.com/_ah/OAuthGet... | brunosan/highmap | python/oauth_client.py | Python | mit | 3,096 |
"""Test linting.
This is only intended to test pylint support for python 3.8's
positional-only arguments (PEP 570).
"""
class Foobar:
"""Class for frobulating the Foobar."""
@classmethod
def buildme(cls, /, value):
"""Construct object using alternate method."""
return cls(value).abc
... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/r/regression/regression_posonly_args.py | Python | mit | 483 |
# Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O'],
kineticsEstimator = 'rate rules',
)
# Constraints on generated species
gener... | enochd/RMG-Py | examples/rmg/minimal_sensitivity/input.py | Python | mit | 1,132 |
# -*- coding: utf-8 -*-
"""
oss2.defaults
~~~~~~~~~~~~~
全局缺省变量。
"""
#: 连接超时时间
connect_timeout = 10
#: 缺省重试次数
request_retries = 3
#: 对于某些接口,上传数据长度大于或等于该值时,就采用分片上传。
multipart_threshold = 10 * 1024 * 1024
#: 缺省分片大小
part_size = 10 * 1024 * 1024 | johnkeepmoving/oss-ftp | python27/win32/Lib/site-packages/oss2/defaults.py | Python | mit | 357 |
"""
Dataset's metadata loader classes.
"""
import h5py
from dbcollection.utils.string_ascii import convert_ascii_to_str
class FieldLoader(object):
"""Field metadata loader class.
This class contains several methods to fetch data from a specific
field of a set (group) in a hdf5 file. It contains useful ... | dbcollection/dbcollection | dbcollection/core/loader.py | Python | mit | 28,772 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import djorm_pgfulltext.fields
class Migration(migrations.Migration):
dependencies = [
('bots', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Log',
... | metabrainz/botbot-web | botbot/apps/logs/migrations/0001_initial.py | Python | mit | 1,735 |
import os
import time
def replace_in_file(file_path, search, replace):
with open(file_path, "r") as handle:
content = handle.read()
if search not in content:
raise Exception("Incorrect development version in conans/__init__.py")
content = content.replace(search, replace)
conten... | memsharded/conan | .ci/bump_dev_version.py | Python | mit | 672 |
from Heap.DHeapNode import DHeapNode
class BinaryHeapNode(DHeapNode):
def __init__(self, elem, key, index):
super().__init__(elem, key, index)
| andreweb/HeapHeap | Heap/BinaryHeapNode.py | Python | mit | 160 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from sqlalchemy.ext.associationproxy import association_proxy
fro... | mvidalgarcia/indico | indico/modules/rb/models/blockings.py | Python | mit | 3,659 |
import unittest
from redlock import Redlock
class TestRedlock(unittest.TestCase):
def setUp(self):
self.redlock = Redlock([{"host": "localhost"}])
def test_lock(self):
lock = self.redlock.lock("pants", 100)
self.assertEqual(lock.resource, "pants")
self.redlock.unlock(lock)
... | stephanerobert/redlock-py | tests/test_redlock.py | Python | mit | 891 |
"""Toolbox for imbalanced dataset in machine learning.
``imbalanced-learn`` is a set of python methods to deal with imbalanced
datset in machine learning and pattern recognition.
Subpackages
-----------
combine
Module which provides methods based on over-sampling and under-sampling.
ensemble
Module which prov... | glemaitre/UnbalancedDataset | imblearn/__init__.py | Python | mit | 1,117 |
from enum import Enum
class StatsEnum(Enum):
Health = 'health'
Mana = 'mana'
Strength = 'strength'
Dexterity = 'dexterity'
Constitution = 'constitution'
Intelligence = 'intelligence'
Charisma = 'charisma'
Wisdom = 'wisdom'
Sharpness = 'sharpness'
Hardness = 'hardness'
Weigh... | jpalladino84/Python-Roguelike-Framework | stats/enums.py | Python | mit | 614 |
# File name: pagelayout.py
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.uix.pagelayout import PageLayout
class MyPageLayout(PageLayout):
pass
class PageLayoutApp(App):
def build(self):
return MyPageLayout()
if __name__=="__main__":
PageLayoutApp().run()
| pimier15/PyGUI | Kivy/Kivy/Bk_Interractive/sample/Chapter_01_code/07 - PageLayout - swiping pages/pagelayout.py | Python | mit | 302 |
import readline
from pprint import pprint
import os
# Set up the database before importing the Flask app.
TEST_DB = os.path.join(os.path.dirname(os.path.realpath(__file__)),'sqlite_hackathon_shell.db')
os.environ["FLASK_OVERRIDE_DB"] = "sqlite:///%s" % (TEST_DB, )
print "DB path : %s" % (TEST_DB,)
import www
# This ... | mdda/hackathon-starter-flask-plus | backend/flask/shell.py | Python | mit | 1,541 |
#!/usr/bin/env python
import sys
import os
# Prepare and send a new release to PyPI
if "release" in sys.argv[-1]:
os.system("python setup.py sdist")
os.system("twine upload dist/K2fov*")
os.system("rm -rf dist/K2fov*")
sys.exit()
try:
from setuptools import setup
setup
except ImportError:
... | KeplerGO/K2fov | setup.py | Python | mit | 1,658 |
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | letuananh/pydemo | django/002_pollapp/mysite/mysite/urls.py | Python | mit | 800 |
import os, sys, subprocess
import argparse
import subprocess
import threading
import timeit
from random import random, randint
import numpy as np
from configobj import ConfigObj
# TODO NOTE - load only the useful configuration
class CVConfigList(object):
def __init__(self):
self.range = []
self.nam... | gwparikh/cvguipy | cvguipy/cvconfig.py | Python | mit | 4,947 |
from itertools import product
from collections import defaultdict
import h5py
import numpy
import six
import tables
from six.moves import zip, range
from fuel.datasets import Dataset
from fuel.utils import do_not_pickle_attributes
@do_not_pickle_attributes('nodes', 'h5file')
class PytablesDataset(Dataset):
"""A... | ejls/fuel | fuel/datasets/hdf5.py | Python | mit | 25,786 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
try:
from mock import patch
except ImportError:
from unittest.mock import patch
from csvkit.utilities.csvcut import CSVCut, launch_new_instance
from tests.utils import CSVKitTestCase, ColumnsTests, EmptyFileTests, NamesTests
class TestCSVCut(CSVKitTe... | onyxfish/csvkit | tests/test_utilities/test_csvcut.py | Python | mit | 2,653 |
import unittest
import os
from test.aiml_tests.client import TestClient
from programy.config.brain import BrainFileConfiguration
class MapsTestsClient(TestClient):
def __init__(self):
TestClient.__init__(self, debug=True)
def load_configuration(self, arguments):
super(MapsTestsClient, self).... | CHT5/program-y | bots/y-bot/src/test/extensions/maps/test_aiml.py | Python | mit | 1,135 |
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | thonkify/thonkify | src/lib/gcloud/bigtable/test__helpers.py | Python | mit | 4,697 |
from . import FinishAfter
class FinishIfNoImprovementAfter(FinishAfter):
"""Stop after improvements have ceased for a given period.
Parameters
----------
notification_name : str
The name of the log record to look for which indicates a new
best performer has been found. Note that the ... | rizar/attention-lvcsr | libs/blocks/blocks/extensions/stopping.py | Python | mit | 3,227 |
"""General utilities used by the Rust package."""
import sublime
import textwrap
import os
PACKAGE_NAME = __package__.split('.')[0]
def index_with(l, cb):
"""Find the index of a value in a sequence using a callback.
:param l: The sequence to search.
:param cb: Function to call, should return true if t... | rust-lang/sublime-rust | rust/util.py | Python | mit | 5,154 |
import unittest
from quickbooks import QuickBooks
from quickbooks.objects.bill import Bill
class BillTests(unittest.TestCase):
def test_unicode(self):
bill = Bill()
bill.Balance = 1000
self.assertEquals(str(bill), "1000")
def test_to_LinkedTxn(self):
bill = Bill()
bi... | sidecars/python-quickbooks | tests/unit/objects/test_bill.py | Python | mit | 986 |
#!/usr/bin/env python
###
# (C) Copyright (2012-2015) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | danielreed/python-hpOneView | examples/scripts/del-enclosure.py | Python | mit | 5,394 |